本文整理汇总了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);
}
示例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);
}