当前位置: 首页>>代码示例>>PHP>>正文


PHP CMSCategory::updatePosition方法代码示例

本文整理汇总了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);
 }
开发者ID:greench,项目名称:prestashop,代码行数:79,代码来源:AdminCMSCategories.php


注:本文中的CMSCategory::updatePosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。