本文整理汇总了PHP中CMSCategory::updatePosition方法的典型用法代码示例。如果您正苦于以下问题:PHP CMSCategory::updatePosition方法的具体用法?PHP CMSCategory::updatePosition怎么用?PHP CMSCategory::updatePosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMSCategory
的用法示例。
在下文中一共展示了CMSCategory::updatePosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postProcess
public function postProcess($token = NULL)
{
global $cookie, $currentIndex;
$this->tabAccess = Profile::getProfileAccess($cookie->profile, $this->id);
if (Tools::isSubmit('submitAdd' . $this->table)) {
if ($id_cms_category = (int) Tools::getValue('id_cms_category')) {
if (!CMSCategory::checkBeforeMove($id_cms_category, (int) Tools::getValue('id_parent'))) {
$this->_errors[] = Tools::displayError('CMS Category cannot be moved here');
return false;
}
}
} elseif (isset($_GET['statuscms_category']) and Tools::getValue($this->identifier)) {
if ($this->tabAccess['edit'] === '1') {
if (Validate::isLoadedObject($object = $this->loadObject())) {
if ($object->toggleStatus()) {
Tools::redirectAdmin($currentIndex . '&conf=5' . ((int) $object->id_parent ? '&id_cms_category=' . (int) $object->id_parent : '') . '&token=' . Tools::getValue('token'));
} else {
$this->_errors[] = Tools::displayError('An error occurred while updating status.');
}
} else {
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
}
} elseif (isset($_GET['delete' . $this->table])) {
if ($this->tabAccess['delete'] === '1') {
if (Validate::isLoadedObject($object = $this->loadObject()) and isset($this->fieldImageSettings)) {
// check if request at least one object with noZeroObject
if (isset($object->noZeroObject) and sizeof($taxes = call_user_func(array($this->className, $object->noZeroObject))) <= 1) {
$this->_errors[] = Tools::displayError('You need at least one object.') . ' <b>' . $this->table . '</b><br />' . Tools::displayError('You cannot delete all of the items.');
} else {
$this->deleteImage($object->id);
if ($this->deleted) {
$object->deleted = 1;
if ($object->update()) {
Tools::redirectAdmin($currentIndex . '&conf=1&token=' . Tools::getValue('token'));
}
} elseif ($object->delete()) {
Tools::redirectAdmin($currentIndex . '&conf=1&token=' . Tools::getValue('token'));
}
$this->_errors[] = Tools::displayError('An error occurred during deletion.');
}
} else {
$this->_errors[] = Tools::displayError('An error occurred while deleting object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
} elseif (isset($_GET['position'])) {
if ($this->tabAccess['edit'] !== '1') {
$this->_errors[] = Tools::displayError('You do not have permission to edit here.');
} elseif (!Validate::isLoadedObject($object = new CMSCategory((int) Tools::getValue($this->identifier, Tools::getValue('id_cms_category_to_move', 1))))) {
$this->_errors[] = Tools::displayError('An error occurred while updating status for object.') . ' <b>' . $this->table . '</b> ' . Tools::displayError('(cannot load object)');
} elseif (!$object->updatePosition((int) Tools::getValue('way'), (int) Tools::getValue('position'))) {
$this->_errors[] = Tools::displayError('Failed to update the position.');
} else {
Tools::redirectAdmin($currentIndex . '&' . $this->table . 'Orderby=position&' . $this->table . 'Orderway=asc&conf=5' . (($id_category = (int) Tools::getValue($this->identifier, Tools::getValue('id_cms_category_parent', 1))) ? '&' . $this->identifier . '=' . $id_category : '') . '&token=' . Tools::getAdminTokenLite('AdminCMSContent'));
}
} elseif (Tools::getValue('submitDel' . $this->table)) {
if ($this->tabAccess['delete'] === '1') {
if (isset($_POST[$this->table . 'Box'])) {
$cms_category = new CMSCategory();
$result = true;
$result = $cms_category->deleteSelection(Tools::getValue($this->table . 'Box'));
if ($result) {
$cms_category->cleanPositions((int) Tools::getValue('id_cms_category'));
Tools::redirectAdmin($currentIndex . '&conf=2&token=' . Tools::getAdminTokenLite('AdminCMSContent') . '&id_category=' . (int) Tools::getValue('id_cms_category'));
}
$this->_errors[] = Tools::displayError('An error occurred while deleting selection.');
} else {
$this->_errors[] = Tools::displayError('You must select at least one element to delete.');
}
} else {
$this->_errors[] = Tools::displayError('You do not have permission to delete here.');
}
}
parent::postProcess(true);
}