Ejemplo n.º 1
0
 /**
  * Assigns entity to form ( Doctrine 2 ).
  *
  * @param object $entity The Doctrine2 Entity
  * @param OSS_Controller_Action $controller An instance of OSS_Controller_Action
  * @param bool $isEdit
  * @return OSS_Form The form object
  */
 public function assignEntityToForm($entity, $controller, $isEdit = true)
 {
     $fields = $controller->getD2EM()->getClassMetadata(get_class($entity))->getFieldNames();
     foreach ($this->getElements() as $eName => $eConfig) {
         if (in_array($eName, $fields)) {
             $fn = 'get' . Doctrine\Common\Util\Inflector::classify($eName);
             if ($entity->{$fn}() instanceof DateTime) {
                 $this->getElement($eName)->setValue($entity->{$fn}()->format('Y-m-d H:i:s'));
             } else {
                 $this->getElement($eName)->setValue($entity->{$fn}());
             }
         }
     }
     return $this;
 }
Ejemplo n.º 2
0
 /**
  * Override the Zend_Controller_Action's constructor (which is called
  * at the very beginning of this function anyway).
  *
  * @param object $request See Parent class constructer
  * @param object $response See Parent class constructer
  * @param object $invokeArgs See Parent class constructer
  */
 public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = null)
 {
     // call the parent's version where all the Zend magic happens
     parent::__construct($request, $response, $invokeArgs);
     $errorHandler = $this->getFrontController()->getPlugin('Zend_Controller_Plugin_ErrorHandler');
     $errorHandler->setErrorHandlerModule('apiv1');
     $errorHandler->setErrorHandlerController('error');
     $errorHandler->setErrorHandlerAction('error');
 }
Ejemplo n.º 3
0
 /**
  * Override the Zend_Controller_Action's constructor (which is called
  * at the very beginning of this function anyway).
  *
  *
  * @param object $request See Parent class constructor
  * @param object $response See Parent class constructor
  * @param object $invokeArgs See Parent class constructor
  */
 public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = null)
 {
     // call the parent's version where all the Zend magic happens
     parent::__construct($request, $response, $invokeArgs);
     // load device / node array
     if (is_readable(APPLICATION_PATH . '/configs/devices.ini')) {
         $this->_devices = new Zend_Config_Ini(APPLICATION_PATH . '/configs/devices.ini');
         $this->view->devices_ini = $this->_devices;
         $this->view->_devices = $this->_devices->devices;
     }
 }
Ejemplo n.º 4
0
 /**
  * Override the Zend_Controller_Action's constructor (which is called
  * at the very beginning of this function anyway).
  *
  * @param object $request See Parent class constructer
  * @param object $response See Parent class constructer
  * @param object $invokeArgs See Parent class constructer
  */
 public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = null)
 {
     // call the parent's version where all the Zend magic happens
     parent::__construct($request, $response, $invokeArgs);
     // we need this for access to class constants in the template
     $this->view->registerClass('USER', '\\Entities\\User');
     $this->view->registerClass('CUSTOMER', '\\Entities\\Customer');
     $this->view->registerClass('SWITCHPORT', '\\Entities\\SwitchPort');
     $this->view->registerClass('VLAN', '\\Entities\\Vlan');
     $this->view->resellerMode = $this->resellerMode();
     $this->view->multiIXP = $this->multiIXP();
     $this->view->as112UiActive = $this->as112UiActive();
     if ($this->getAuth()->hasIdentity() && $this->getUser()->getPrivs() == Entities\User::AUTH_SUPERUSER) {
         $this->superUserSetup();
     }
 }
Ejemplo n.º 5
0
 /**
  * Override the OSS_Controller_Action's constructor (which is called
  * at the very beginning of this function anyway).
  *
  * @param object $request See Parent class constructor
  * @param object $response See Parent class constructor
  * @param object $invokeArgs See Parent class constructor
  */
 public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = null)
 {
     // call the parent's version where all the Zend magic happens
     parent::__construct($request, $response, $invokeArgs);
     // if we issue a redirect, we want it to exit immediatly
     $this->getHelper('Redirector')->setExit(true);
     // SECURITY and other stuff for logged in users
     if ($this->getAuth()->hasIdentity()) {
         // version check
         $this->checkVersion();
         // SECURITY and load objects
         if ($aid = $this->getParam('aid', false)) {
             $this->_targetAdmin = $this->loadAdmin($aid);
         }
         if ($did = $this->getParam('did', false)) {
             $this->_domain = $this->loadDomain($did);
         }
         if ($mid = $this->getParam('mid', false)) {
             $this->_mailbox = $this->loadMailbox($mid);
         }
         if ($alid = $this->getParam('alid', false)) {
             $this->_alias = $this->loadAlias($alid);
         }
         if ($arid = $this->getParam('arid', false)) {
             $this->_archive = $this->loadArchive($arid);
         }
     }
 }
 /**
  * Override the OSS_Controller_Action's constructor (which is called
  * at the very beginning of this function anyway).
  *
  * @param object $request See Parent class constructor
  * @param object $response See Parent class constructor
  * @param object $invokeArgs See Parent class constructor
  */
 public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = null)
 {
     parent::__construct($request, $response, $invokeArgs);
 }
Ejemplo n.º 7
0
 /**
  * Override the Zend_Controller_Action's constructor (which is called
  * at the very beginning of this function anyway).
  *
  * @param object $request See Parent class constructer
  * @param object $response See Parent class constructer
  * @param object $invokeArgs See Parent class constructer
  */
 public function __construct(Zend_Controller_Request_Abstract $request, Zend_Controller_Response_Abstract $response, array $invokeArgs = null)
 {
     // call the parent's version where all the Zend magic happens
     parent::__construct($request, $response, $invokeArgs);
 }