本文整理汇总了PHP中item::reorder方法的典型用法代码示例。如果您正苦于以下问题:PHP item::reorder方法的具体用法?PHP item::reorder怎么用?PHP item::reorder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类item
的用法示例。
在下文中一共展示了item::reorder方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
//.........这里部分代码省略.........
}
navitable::jqgridJson($out, $page, $offset, $max, $total);
break;
}
core_terminate();
break;
case 'load':
case 'create':
case 'edit':
case 2:
// edit/new form
if (!empty($_REQUEST['id'])) {
$item->load(intval($_REQUEST['id']));
if ($user->permission("items.edit") == "false" && $item->author != $user->id) {
$layout->navigate_notification(t(610, "Sorry, you are not allowed to execute the requested function"), true);
$_REQUEST['act'] = 'list';
return run();
}
// check if the current user can edit this item
if ($item->association == 'category' && !empty($item->category)) {
if (!structure::category_allowed($item->category)) {
$layout->navigate_notification(t(610, "Sorry, you are not allowed to execute the requested function"), true);
$_REQUEST['act'] = 'list';
return run();
}
}
}
if (isset($_REQUEST['form-sent'])) {
$item->load_from_post();
try {
$item->save();
property::save_properties_from_post('item', $item->id);
if (!empty($_REQUEST['items-order'])) {
item::reorder($_REQUEST['items-order']);
}
$layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
$item->load($item->id);
users_log::action($_REQUEST['fid'], $item->id, 'save', $item->dictionary[$website->languages_list[0]]['title'], json_encode($_REQUEST));
} catch (Exception $e) {
$layout->navigate_notification($e->getMessage(), true, true);
}
} else {
users_log::action($_REQUEST['fid'], $item->id, 'load', $item->dictionary[$website->languages_list[0]]['title']);
}
$out = items_form($item);
break;
case 'delete':
case 4:
// remove
if (!empty($_REQUEST['id'])) {
$item->load(intval($_REQUEST['id']));
try {
if (!empty($item->id)) {
$deleted = $item->delete() > 0;
if ($deleted) {
$layout->navigate_notification(t(55, 'Item removed successfully.'), false);
$out = items_list();
users_log::action($_REQUEST['fid'], $item->id, 'remove', $item->dictionary[$website->languages_list[0]]['title'], json_encode($_REQUEST));
}
}
if (!$deleted) {
$layout->navigate_notification(t(56, 'Unexpected error.'), false);
if (!empty($item->id)) {
$out = items_form($item);
} else {
$out = items_list();
示例2: run
function run()
{
global $user;
global $layout;
global $DB;
global $website;
global $theme;
$out = '';
$item = new structure();
switch ($_REQUEST['act']) {
case 'load':
case 'edit':
case 2:
// edit/new form
if (!empty($_REQUEST['id'])) {
$item->load(intval($_REQUEST['id']));
}
if (isset($_REQUEST['form-sent'])) {
$item->load_from_post();
try {
$item->save();
property::save_properties_from_post('structure', $item->id);
$item = $item->reload();
// reorder associated category elements
if (!empty($_POST['elements-order'])) {
$response = item::reorder($_POST['elements-order']);
if ($response !== true) {
throw new Exception($response);
}
}
$layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
} catch (Exception $e) {
$layout->navigate_notification($e->getMessage(), true, true);
}
if (!empty($item->id)) {
users_log::action($_REQUEST['fid'], $item->id, 'save', $item->dictionary[$website->languages_list[0]]['title'], json_encode($_REQUEST));
}
} else {
if (!empty($item->id)) {
users_log::action($_REQUEST['fid'], $item->id, 'load', $item->dictionary[$website->languages_list[0]]['title']);
}
}
$out = structure_form($item);
break;
case 3:
case "reorder":
$ok = structure::reorder($_REQUEST['parent'], $_REQUEST['children_order']);
echo json_encode($ok);
core_terminate();
break;
case "homepager":
$node = $_REQUEST['node'];
$website->homepage = $node;
$ok = $website->save();
echo json_encode($ok);
core_terminate();
break;
case 4:
case "remove":
if (!empty($_REQUEST['id'])) {
$item->load(intval($_REQUEST['id']));
if ($item->delete() > 0) {
$layout->navigate_notification(t(55, 'Item removed successfully.'), false);
$structure = structure::hierarchy(-1);
// root level (0) including Web node (-1)
$out = structure_tree($structure);
users_log::action($_REQUEST['fid'], $item->id, 'remove');
} else {
$layout->navigate_notification(t(56, 'Unexpected error.'), false);
$out = structure_form($item);
}
}
break;
case 95:
// free path checking
$path = $_REQUEST['path'];
$id = $_REQUEST['id'];
$DB->query('SELECT type, object_id, lang
FROM nv_paths
WHERE path = ' . protect($path) . '
AND website = ' . $website->id);
$rs = $DB->result();
echo json_encode($rs);
core_terminate();
break;
case "category_path":
// return category paths
echo json_encode(path::loadElementPaths('structure', intval($_REQUEST['id'])));
core_terminate();
break;
case 'json_find_item':
// find items by its title
// the items must have its own path (free OR not embedded to a category)
$DB->query('
SELECT SQL_CALC_FOUND_ROWS nvw.node_id as id, nvw.text as text
FROM nv_webdictionary nvw, nv_items nvi
WHERE nvw.node_type = "item"
AND nvw.node_id = nvi.id
AND nvw.subtype = "title"
AND ( nvi.association = "free" OR
//.........这里部分代码省略.........