| Server IP : 172.67.178.83 / Your IP : 216.73.217.141 Web Server : Apache System : Linux hosting01.arsenalhost.com 4.18.0-425.13.1.lve.el8.x86_64 #1 SMP Mon Feb 27 15:23:24 EST 2023 x86_64 User : corbizre ( 1013) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/corbizre/gotofindhomes.com3/components/Menu/Controllers/ |
Upload File : |
<?php
/**
* Documentation
* @author
* @category
* @package
* @subpackage
* @copyright Copyright (c) 2005-2009 ITCrimea Ukraine Inc. (http://www.itcrimea.com)
* @license
*/
class Menu_IndexController extends System_Controller_Db_Table {
/**
* Documentation
* @author
* @return mixed
*/
function init() {
parent::init();
}
/**
* Индех
* @author [email protected]
* @return mixed
*/
function indexAction() {
}
/**
* Индех
* @author [email protected]
* @return mixed
*/
function getlistAction() {
$paramSort = $this->getRequest()->getParam('sort', 'ID');
$this->getRequest()->setParam('sort', $paramSort);
$this->getRequest()->setParam('results', $this->getRequest()->getParam('results', 20));
parent::getlistAction();
$this->view->sort = $paramSort;
}
/**
* Вывод формы редактирования. Обработка _POST данных.
* @author [email protected]
* @return void
*/
function editAction() {
$paramMenuID = $this->getRequest()->getParam('ID', $this->getRequest()->getParam('id'));
$paramSubmit = $this->getRequest()->getParam('submitform');
$paramUserID = System_User::getID();
$paramCompanyID = $this->getRequest()->getParam('CompanyID', System_Company::getID());
if (empty($paramCompanyID))
throw new Zend_Exception('Company ID was not provided.');
if (System_User::getRoleID() == User_Role::ADMIN)
User::checkAccess($paramCompanyID);
if (!$paramMenuID) {
$objectMenu = $this->_model->createRow();
} else {
$objectMenu = $this->_model->find($paramMenuID)->current();
}
$form = $this->getForm();
if ($this->getRequest()->isPost()) {
if ($form->isValid($_POST)) {
if ($objectMenu->User_ID == 0) {
$objectMenu->User_ID = $paramUserID;
}
foreach (array_keys($this->_modelMetaData) as $ColumnName) {
if ($form->getValue($ColumnName)) {
$objectMenu->$ColumnName = $form->getValue($ColumnName);
}
}
$objectMenu->Company_ID = $paramCompanyID;
$objectMenu->save();
$this->addOkMessage('Menu has been successfully saved');
if ($paramSubmit == 'save') {
$this->render('edit-success');
}
} else {
$this->addErrorMessage('Some information is incorrect or missing. Please correct your entries and try again.');
}
}
$form->setDefaults($objectMenu->toArray());
$this->view->Menu = $objectMenu->toArray();
$this->view->form = $form;
}
/**
* Удаление.
* @author [email protected]
* @return void
*/
function deleteAction() {
parent::deleteAction();
}
/**
* Построение и вывод пунктов меню.
* @author [email protected]
* @return void
*/
function showAction() {
$paramMenuID = $this->getRequest()->getParam('Menu_ID', 0);
$paramTemplate = $this->getRequest()->getParam('template');
$objectMenu = $this->_model->find($paramMenuID)->current();
$tableMenuItem = new Menu_Item_Table();
$select = $tableMenuItem->select();
$select->where('MenuID = ?', $objectMenu->ID);
$select->where('Status = ?', 0);
$select->order('Order');
$objectMenuItems = $tableMenuItem->fetchAll($select);
$objectNavigation = new Zend_Navigation();
if (is_object($objectMenuItems)) {
foreach ($objectMenuItems as $itemRow) {
if ($itemRow->Type == 'mvc') {
// created route
$routeMenuItem = new Zend_Controller_Router_Route(
$itemRow->URL,
array('module' => $itemRow->Module,
'controller' => $itemRow->Controller,
'action' => $itemRow->Action
)
);
// add route
System_Router::getInstance()->getRouter()->addRoute($itemRow->Route, $routeMenuItem);
$options = array('action' => $itemRow->Action,
'controller' => $itemRow->Controller,
'module' => $itemRow->Module,
'route' => $itemRow->Route,
'label' => $itemRow->Name,
'title' => $itemRow->Name . ' ' . $itemRow->Description,
'id' => $itemRow->TagID,
'class' => $itemRow->Class,
'target' => $itemRow->Target
);
$objectPage = new Zend_Navigation_Page_Mvc($options);
$objectNavigation->addPage($objectPage);
} elseif ($itemRow->Type == 'url') {
$options = array('uri' => $itemRow->URL,
'label' => $itemRow->Name,
'title' => $itemRow->Name . ' ' . $itemRow->Description,
'id' => $itemRow->TagID,
'class' => $itemRow->Class,
'target' => $itemRow->Target
);
$objectPage = new Zend_Navigation_Page_Uri($options);
$objectNavigation->addPage($objectPage);
} else {
throw new Zend_Exception('Undefined Type for Menu Item - ' . $itemRow->Name);
}
}
}
$this->view->Navigation = $objectNavigation;
if ($paramTemplate) {
$this->render('show-' . $paramTemplate);
}
}
/**
* Обновляем ордер.
* @author [email protected]
* @return void
*/
function changeorderAction() {
$paramOrders = $this->getRequest()->getParam('order', 0);
$objectMenu = $this->_model->fetchAll();
if (is_object($objectMenu) && $objectMenu->count()) {
foreach ($objectMenu as $Item) {
if (isset($paramOrders[$Item->ID])) {
$Item->Order = $paramOrders[$Item->ID];
$Item->save();
}
}
}
}
}