Exemplo n.º 1
0
 public function save()
 {
     $logger = Zupal_Module_Manager::getInstance()->get('people')->logger();
     parent::save();
     $logger->info('Employee ' . $this->get_domain()->identity() . ' saved');
     $cache = Zupal_Bootstrap::$registry->cache;
     $cache->remove('employee_data');
 }
Exemplo n.º 2
0
 /**
  *
  * @param <type> $pModel = NULL
  * @return <type>
  */
 public function __construct($pModel = NULL)
 {
     if (is_null($pModel)) {
         $pModel = new Zupal_Modules();
     }
     parent::__construct(new Zend_Config_Ini(dirname(__FILE__) . DS . 'Form.ini', 'fields'));
     $this->set_domain($pModel);
 }
Exemplo n.º 3
0
 public function __construct($pAction = NULL)
 {
     $ini_path = preg_replace('~php$~', 'ini', __FILE__);
     $config = new Zend_Config_Ini($ini_path, 'fields');
     parent::__construct($config);
     if ($pAction) {
         $this->setAction($pAction);
     }
 }
Exemplo n.º 4
0
 public function __construct($pDomain)
 {
     $ini_path = preg_replace('~php$~', 'ini', __FILE__);
     $config = new Zend_Config_Ini($ini_path, 'fields');
     parent::__construct($config);
     if ($pDomain) {
         $this->set_domain($pDomain);
         $this->domain_to_form();
     }
 }
Exemplo n.º 5
0
 /**
  *
  * @param string $pParams
  * @return void
  */
 public function isValid($pParams)
 {
     if (array_key_exists('title', $pParams)) {
         $this->get_domain()->set_title($pParams['title']);
     }
     if (array_key_exists('lead', $pParams)) {
         $this->get_domain()->set_lead($pParams['lead']);
     }
     if (array_key_exists('content', $pParams)) {
         $this->get_domain()->set_content($pParams['content']);
     }
     return parent::isValid($pParams);
 }
Exemplo n.º 6
0
 /**
  *
  * @param array $pFields
  * @return boolean
  */
 public function isValid($pFields)
 {
     if (!parent::isValid($pFields)) {
         return FALSE;
     }
     if ($this->name_first->getValue() || $this->username->getValue() || $this->name_last->getValue() || $this->email->getValue()) {
         return true;
     }
     $this->name_first->addErrorMessage('Must have this OR');
     $this->name_last->addErrorMessage('Must have this OR');
     $this->username->addErrorMessage('Must have this OR');
     $this->email->addErrorMessage('Must have this');
     return false;
 }
Exemplo n.º 7
0
 public function __construct(Zupal_Node_Abstract $pContent = NULL, $pOptions = NULL)
 {
     parent::__construct($pOptions);
     $elements = array();
     foreach ($this->getElements() as $element) {
         $elements[] = $element->getName();
     }
     $this->set_domain($pContent);
     $this->removeDecorator('HtmlTag');
     $this->addDisplayGroup($elements, 'content', array('legend' => 'Content', 'seperator' => ''));
     $this->getDisplayGroup('content')->removeDecorator('DtDdWrapper');
     $this->addElement('multiCheckbox', 'status', array('label' => 'Status', 'separator' => ''));
     $this->status->setMultiOptions(Zupal_Nodes::$STATUS_PHRASES);
     $this->addDisplayGroup(array('status'), 'node', array('legend' => 'Node', 'order' => 10));
     $this->getDisplayGroup('node')->removeDecorator('DtDdWrapper');
     $this->addElement('submit', 'submit', array('label' => 'Submit'));
     $this->addDisplayGroup(array('submit'), 'buttons', array('order' => 12));
     $this->getDisplayGroup('buttons')->removeDecorator('DtDdWrapper');
     $this->setMethod('post');
 }
Exemplo n.º 8
0
 public function __construct($pRole = NULL)
 {
     $ini_path = dirname(__FILE__) . DS . 'Form.ini';
     $config = new Zend_Config_Ini($ini_path, 'fields');
     parent::__construct($config);
     $root = Zend_Controller_Front::getInstance()->getBaseUrl() . DS . 'admin' . DS . 'acl' . DS;
     if (is_null($pRole)) {
         $pRole = new Zupal_Resources();
     } elseif (is_string($pRole)) {
         $pRole = new Zupal_Resources($pRole);
     }
     $this->set_domain($pRole);
     if ($pRole->identity()) {
         $this->setAction($root . 'resupdatevalidate');
     } else {
         $this->setAction($root . 'resaddvalidate');
         $this->submit->setLabel('Create Resource');
     }
     $this->setMethod('post');
 }
Exemplo n.º 9
0
 /**
  *
  * @return void
  */
 public function fields_to_domain(array $pFields = NULL)
 {
     parent::fields_to_domain($pFields);
     $this->get_domain()->module = $this->rolemodule->getValue();
 }
Exemplo n.º 10
0
 /**
  *
  * @param array $pFields
  * @return void
  */
 public function domain_to_fields(array $pFields = NULL)
 {
     $this->resourcemodule->setValue($this->get_domain()->module);
     parent::domain_to_fields($pFields);
 }
Exemplo n.º 11
0
 /**
  *
  * @return void
  */
 public function fields_to_domain(array $pFields = NULL)
 {
     parent::fields_to_domain($pFields);
     $this->domain()->module = $this->menumodule->getValue();
     $this->domain()->controller = $this->menucontroller->getValue();
     $this->domain()->action = $this->menuaction->getValue();
 }