コード例 #1
0
 /**
  * Constructor.
  *
  * @param string $value Value for the checked element
  * @return void
  */
 public function __construct($value = null)
 {
     parent::__construct();
     $this->addElements(array(array('hidden', 'permission_id'), array('hidden', 'group_id'), array('checkbox', 'switch'), array('submit', 'submit')));
     if (!is_null($value)) {
         $this->getElement('switch')->setChecked($value);
     }
     foreach ($this->getElements() as $element) {
         $element->removeDecorator('Label');
         $element->removeDecorator('Description');
         $element->removeDecorator('HtmlTag');
     }
     $this->getElement('submit')->removeDecorator('DtDdWrapper');
     $this->addDecorator('HtmlTag', array('tag' => 'div'));
 }
コード例 #2
0
ファイル: Login.php プロジェクト: netconstructor/Centurion
 /**
  * Constructor.
  *
  * @param array $params Params to instantiate the form validator
  * @param string $formName Form name
  * @param string $loginLifetime Number of seconds to expire the namespace
  * @return void
  */
 public function __construct(array $params, $formName = self::FORM_NAME, $loginLifetime = 904800)
 {
     $this->cleanForm();
     $keys = array('dbAdapter', 'tableName', 'loginColumn', 'passwordColumn');
     $diff = array_diff_key(array_flip($keys), $params);
     if (count($diff) != 0) {
         throw new Centurion_Form_Exception('constructor array must have keys for ' . implode(' ', array_keys($diff)));
     }
     if (!$params['dbAdapter'] instanceof Zend_Db_Adapter_Abstract) {
         throw new Centurion_Form_Exception('dbAdapter must be an instance of Zend_Db_Adapter_Abstract');
     }
     $this->addElements(array(array('text', 'login', array('required' => true, 'Label' => $this->_translate('Username@backoffice'))), array('password', 'password', array('required' => true, 'Label' => $this->_translate('Password@backoffice'), 'validators' => array(array('validator' => 'StringLength', 'options' => array('min' => 5), 'breakChainOnFailure' => true), array(new $this->_formValidator($params))))), array('checkbox', 'remember_me', array('Label' => $this->_translate('Remember me@backoffice'))), array('hidden', 'next', array())));
     $this->addElement('hash', '_XSRF', array('salt' => 'login'));
     $this->setMethod(self::METHOD_POST)->setName($formName)->setAttrib('id', $formName);
     $this->_loginLifetime = abs((int) $loginLifetime);
     parent::__construct();
 }
コード例 #3
0
ファイル: Filter.php プロジェクト: netconstructor/Centurion
 public function __construct($options = null)
 {
     parent::__construct($options);
 }
コード例 #4
0
ファイル: Translation.php プロジェクト: rom1git/Centurion
 public function __construct($options = array())
 {
     parent::__construct($options);
     $subForm = new Centurion_Form();
     $this->addSubForm($subForm, 'language');
 }