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


PHP MenuItem::populateWithArray方法代码示例

本文整理汇总了PHP中MenuItem::populateWithArray方法的典型用法代码示例。如果您正苦于以下问题:PHP MenuItem::populateWithArray方法的具体用法?PHP MenuItem::populateWithArray怎么用?PHP MenuItem::populateWithArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MenuItem的用法示例。


在下文中一共展示了MenuItem::populateWithArray方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: editProcessAction

 function editProcessAction()
 {
     $enumerationId = (int) $this->_getParam('enumerationId');
     $menuParams = $this->_getParam('menuItem');
     $menuId = (int) $menuParams['menuId'];
     $origMenuId = $menuId;
     $menuParams['menuId'] = $menuId;
     $objMenu = new MenuItem();
     if ($menuId !== 0) {
         $objMenu->menuId = $menuId;
         $objMenu->populate();
     }
     $menuParams['action'] = '';
     if (isset($menuParams['type'])) {
         switch ($menuParams['type']) {
             case 'freeform':
                 if ($this->_getParam('typefreeform') !== NULL) {
                     $menuParams['action'] = $this->_getParam('typefreeform');
                 }
                 break;
             case 'report':
                 if ($this->_getParam('typereport') !== NULL) {
                     $x = explode('-', $this->_getParam('typereport'));
                     $x[0] = (int) $x[0];
                     $x[1] = (int) $x[1];
                     $menuParams['action'] = "Report/report?reportId={$x[0]}&templateId={$x[1]}";
                 }
                 break;
             case 'form':
                 if ($this->_getParam('typeform') !== NULL) {
                     $typeForm = (int) $this->_getParam('typeform');
                     $menuParams['action'] = "Form/fillout?formId={$typeForm}";
                 }
                 break;
         }
     }
     $menuParams['active'] = (int) $this->_getParam('active');
     if ($this->_getParam('chSiteSection') !== NULL) {
         $menuParams['siteSection'] = $this->_getParam('chSiteSection');
     }
     $menuParams['parentId'] = (int) $menuParams['parentId'];
     $objMenu->populateWithArray($menuParams);
     if ($enumerationId !== 0) {
         // update its parent
         $enumerationsClosure = new EnumerationsClosure();
         $objMenu->parentId = $enumerationsClosure->getParentById($enumerationId);
     }
     $objMenu->persist();
     if ($menuId === 0 && $enumerationId !== 0) {
         $enumeration = new Enumeration();
         $enumeration->enumerationId = $enumerationId;
         $enumeration->populate();
         $enumeration->ormId = $objMenu->menuId;
         $enumeration->persist();
     }
     $msg = __("Record Saved for Menu: " . ucfirst($objMenu->title));
     $data = array();
     $data['msg'] = $msg;
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }
开发者ID:dragonlet,项目名称:clearhealth,代码行数:62,代码来源:MenuManagerController.php

示例2: editProcessAction

 function editProcessAction()
 {
     $menuParams = $this->_getParam('menuItem');
     $menuId = (int) $menuParams['menuId'];
     if ($menuId === 0 && substr($menuParams['menuId'], 0, 11) != 'newMenuItem') {
         $msg = __("Invalid menu id.");
         throw new Exception($msg);
     }
     $menuParams['menuId'] = (int) $menuParams['menuId'];
     $objMenu = new MenuItem();
     $objMenu->menuId = $menuId;
     $objMenu->populate();
     $menuParams['action'] = '';
     if (isset($menuParams['type'])) {
         switch ($menuParams['type']) {
             case 'freeform':
                 if ($this->_getParam('typefreeform') !== NULL) {
                     $menuParams['action'] = $this->_getParam('typefreeform');
                 }
                 break;
             case 'report':
                 if ($this->_getParam('typereport') !== NULL) {
                     $x = explode('-', $this->_getParam('typereport'));
                     $x[0] = (int) $x[0];
                     $x[1] = (int) $x[1];
                     $menuParams['action'] = "Report/report?reportId={$x[0]}&templateId={$x[1]}";
                 }
                 break;
             case 'form':
                 if ($this->_getParam('typeform') !== NULL) {
                     $typeForm = (int) $this->_getParam('typeform');
                     $menuParams['action'] = "Form/fillout?formId={$typeForm}";
                 }
                 break;
         }
     }
     $menuParams['active'] = (int) $this->_getParam('active');
     if ($this->_getParam('chSiteSection') !== NULL) {
         $menuParams['siteSection'] = $this->_getParam('chSiteSection');
     }
     $menuParams['parentId'] = (int) $menuParams['parentId'];
     $objMenu->populateWithArray($menuParams);
     $objMenu->persist();
     $msg = __("Record Saved for Menu: " . ucfirst($objMenu->title));
     $data = array();
     $data['msg'] = $msg;
     $json = Zend_Controller_Action_HelperBroker::getStaticHelper('json');
     $json->suppressExit = true;
     $json->direct($data);
 }
开发者ID:psoas,项目名称:ch3-dev-preview,代码行数:50,代码来源:MenuManagerController.php


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