[go: up one dir, main page]

Skip to content

Commit

Permalink
fix backend index sort remove image, backend index iframe display
Browse files Browse the repository at this point in the history
  • Loading branch information
liufee committed Dec 26, 2017
1 parent a27cc69 commit e5de280
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
9 changes: 7 additions & 2 deletions backend/actions/SortAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,13 @@ public function run()
/* @var $model yii\db\ActiveRecord */
$model = call_user_func([$this->modelClass, 'findOne'], $key);
if ($model->$field != $value) {
$model->$field = $value;
$model->save(false);
$primaryKey = $model->getPrimaryKey(true);
if( empty($primaryKey) ) throw new Exception("Cannot find primary key");
$primaryKeyName = key($primaryKey);
$primaryKeyValue = $primaryKey[$primaryKeyName];
$field = addslashes($field);
$tableName = call_user_func([$this->modelClass, 'tableName']);
yii::$app->db->createCommand("UPDATE {$tableName} SET $field=:value WHERE $primaryKeyName='$primaryKeyValue'")->bindParam(':value', $value)->execute();
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions backend/views/site/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@ function reloadIframe() {
current_iframe[0].contentWindow.location.reload();
return false;
}
if (window.top !== window.self) {
window.top.location = window.location;
}
</script>
</html>
<?php $this->endPage() ?>
4 changes: 1 addition & 3 deletions frontend/widgets/MenuView.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public function run()
if ($url == yii::$app->getRequest()->getUrl()) {
$current_menu_class = ' current-menu-item ';
}
unset($menus[$key]);
$submenu = $this->getSubMenu($menus, $menu['id']);
$content .= str_replace([
'{menu_id}',
Expand All @@ -74,7 +73,7 @@ public function run()
], $this->liTemplate);
}
}
echo str_replace('{lis}', $content, $this->template);
return str_replace('{lis}', $content, $this->template);
}

/**
Expand Down Expand Up @@ -111,7 +110,6 @@ private function getSubMenu($menus, $cur_id)
'{target}',
'{title}'
], [$menu['id'], $current_menu_class, $url, $menu['target'], $menu['name']], $this->subLitemplate);
unset($menus[$key]);
}
}
if ($content != '') {
Expand Down

0 comments on commit e5de280

Please sign in to comment.