| 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/Page/Controllers/ |
Upload File : |
<?php
/**
* Documentation
* @author leonid
* @category
* @package
* @subpackage
* @copyright Copyright (c) 2005-2012 ITCrimea Ukraine Inc. (http://www.itcrimea.com)
* @license
*/
class Page_OptionRulesController extends System_Controller_Db_Table {
/**
* Load page options using rules
* @throws Zend_Exception
*/
public function loadAction() {
$paramIdentifier = $this->getRequest()->getParam('identifier');
$paramCompanyID = $this->getRequest()->getParam('companyid', System_Company::getID());
if (empty($paramIdentifier))
throw new Zend_Exception('Param identifier is required to load page option rules');
if (empty($paramCompanyID))
$paramCompanyID = System_Company::getID();
$paramVars = $this->getRequest()->getParam('variables', array());
$this->view->row = $this->_model->getPageOptions($paramIdentifier, $paramVars, $paramCompanyID);
}
/**
* View all available (default) page option rules
*/
public function listAction() {
$select = $this->_model->select();
$select->where('Company_ID IS NULL');
$this->view->rows = $this->_model->fetchAll($select);
$this->view->companyid = $this->getRequest()->getParam('companyid');
}
/**
* Edit single page option rule
* @throws Zend_Exception
*/
public function editAction() {
$paramCompanyID = $this->getRequest()->getParam('companyid', System_Company::getID());
if (empty($paramCompanyID))
throw new Zend_Exception('Required parameter "companyid" is empty');
if (System_User::getRoleID() == User_Role::ADMIN)
User::checkAccess($paramCompanyID);
$paramIdentifier = $this->getRequest()->getParam('identifier', System_Company::getID());
if (empty($paramIdentifier))
throw new Zend_Exception('Required parameter "identifier" is empty');
$objRules = $this->_model->get($paramIdentifier, $paramCompanyID);
if ($this->getRequest()->isPost()) {
if (!is_object($objRules)) {
$defaultRules = $this->_model->getDefault($paramIdentifier);
$objRules = $this->_model->createRow();
$objRules->Identifier = $defaultRules->Identifier;
$objRules->Identifier_Description = $defaultRules->Identifier_Description;
$objRules->Variables = $defaultRules->Variables;
$objRules->Company_ID = $paramCompanyID;
}
$objRules->Title = $this->getRequest()->getParam('Title', '');
$objRules->Keywords = $this->getRequest()->getParam('Keywords', '');
$objRules->Description = $this->getRequest()->getParam('Description', '');
$objRules->H1 = $this->getRequest()->getParam('H1', '');
$objRules->TextTop = $this->getRequest()->getParam('TextTop', '');
$objRules->TextBottom = $this->getRequest()->getParam('TextBottom', '');
$objRules->save();
$this->addOkMessage('Rule with key "'.$paramIdentifier.'" has been successfully saved');
$this->_redirect($this->view->url(array('section'=>'admin','module' => 'page', 'controller' => 'option-rules', 'action' => 'list', 'companyid' => $paramCompanyID), 'section-default', TRUE));
} else {
if (!is_object($objRules))
$objRules = $this->_model->getDefault($paramIdentifier);
}
$this->view->row = $objRules->toArray();
$this->view->companyid = $paramCompanyID;
$this->view->identifier = $paramIdentifier;
}
}