Esempio n. 1
0
 public function __construct($path, $model)
 {
     $this->model = $model;
     list($module, $form) = explode(".", $path, 2);
     $form_path = "application.modules.{$module}.forms.{$form}";
     parent::__construct($form_path, $model);
 }
Esempio n. 2
0
 /**
 * Constructor
 */
 public function __construct($content)
 {
     parent::__construct();
     $this->content = $content;
     $save = isset($content['id']) ? 'save' : 'create';
     $this->AddElement(new CFormElementHidden('id', array('value' => $content['id'])))->AddElement(new CFormElementText('title', array('value' => $content['title'])))->AddElement(new CFormElementText('key', array('value' => $content['key'])))->AddElement(new CFormElementTextarea('data', array('label' => 'Content:', 'value' => $content['data'])))->AddElement(new CFormElementText('type', array('value' => $content['type'])))->AddElement(new CFormElementText('filter', array('value' => $content['filter'])))->AddElement(new CFormElementSubmit($save, array('callback' => array($this, 'DoSave'), 'callback-args' => array($content))))->AddElement(new CFormElementSubmit('delete', array('callback' => array($this, 'DoDelete'), 'callback-args' => array($content))));
     $this->SetValidation('title', array('not_empty'))->SetValidation('key', array('not_empty'));
 }
Esempio n. 3
0
 function __construct(&$ZBX_CONFIG)
 {
     $this->DISABLE_NEXT_BUTTON = false;
     $this->ZBX_CONFIG =& $ZBX_CONFIG;
     $this->stage = array(0 => array('title' => '1. Introduction', 'fnc' => 'stage0'), 1 => array('title' => '2. Licence Agreement', 'fnc' => 'stage1'), 2 => array('title' => '3. Check of pre-requisites', 'fnc' => 'stage2'), 3 => array('title' => '4. Configure DB connection', 'fnc' => 'stage3'), 4 => array('title' => '5. ZABBIX server details', 'fnc' => 'stage4'), 5 => array('title' => '6. Pre-Installation Summary', 'fnc' => 'stage5'), 6 => array('title' => '7. Install', 'fnc' => 'stage6'), 7 => array('title' => '8. Finish', 'fnc' => 'stage7'));
     $this->EventHandler();
     parent::__construct(null, 'post');
 }
Esempio n. 4
0
 /** Create all form elements and validation rules in the constructor.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $items = array('tomato', 'potato', 'apple', 'pear', 'banana');
     $shoppingcart = array('potato', 'pear');
     $this->AddElement(new CFormElementCheckboxMultiple('items', array('values' => $items, 'checked' => $shoppingcart)));
     $this->AddElement(new CFormElementSubmit('submit', array('callback' => array($this, 'DoSubmit'))));
 }
Esempio n. 5
0
 function __construct(&$ZBX_CONFIG)
 {
     $this->DISABLE_NEXT_BUTTON = false;
     $this->ZBX_CONFIG =& $ZBX_CONFIG;
     $this->stage = array(0 => array('title' => '1. Welcome', 'fnc' => 'stage1'), 1 => array('title' => '2. Check of pre-requisites', 'fnc' => 'stage2'), 2 => array('title' => '3. Configure DB connection', 'fnc' => 'stage3'), 3 => array('title' => '4. Zabbix server details', 'fnc' => 'stage4'), 4 => array('title' => '5. Pre-Installation summary', 'fnc' => 'stage5'), 5 => array('title' => '6. Install', 'fnc' => 'stage6'));
     $this->eventHandler();
     parent::__construct('post');
 }
Esempio n. 6
0
 /** Create all form elements and validation rules in the constructor.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $items = array('tomato', 'potato', 'apple', 'pear', 'banana');
     $shoppingcart = array('potato', 'pear');
     foreach ($items as $item) {
         $this->AddElement(new CFormElementCheckbox($item, array('value' => $item, 'label' => $item, 'checked' => in_array($item, $shoppingcart))));
     }
     $this->AddElement(new CFormElementSubmit('submit', array('callback' => array($this, 'DoSubmit'))));
 }
Esempio n. 7
0
 public function __construct($title = null, $action = null, $method = null, $enctype = null, $form_variable = null)
 {
     $method = is_null($method) ? 'post' : $method;
     parent::__construct($method, $action, $enctype);
     $this->setTitle($title);
     $form_variable = is_null($form_variable) ? 'form' : $form_variable;
     $this->addVar($form_variable, get_request($form_variable, 1));
     $this->bottom_items = new CCol(SPACE, 'form_row_last');
     $this->bottom_items->setColSpan(2);
 }
 /**
  * Constructor
  *
  */
 public function create($successCallback, $values = null)
 {
     parent::__construct();
     $message = $values ? $values['message'] : "";
     $email = $values ? $values['email'] : "";
     $name = $values ? $values['name'] : "";
     $id = $values ? $values['id'] : "";
     $this->AddElement(new CFormElementText('message', ['value' => $message]))->AddElement(new CFormElementText('name', ['value' => $name]))->AddElement(new CFormElementText('email', ['value' => $email]))->AddElement(new CFormElementHidden('id', ['value' => $id]))->AddElement(new CFormElementSubmit('submit', array('callback' => $successCallback)))->AddElement(new CFormElementSubmit('submit-fail', array('callback' => array($this, 'DoSubmitFail'))));
     return $this;
 }
Esempio n. 9
0
 function __construct()
 {
     $this->DISABLE_CANCEL_BUTTON = false;
     $this->DISABLE_BACK_BUTTON = false;
     $this->SHOW_RETRY_BUTTON = false;
     $this->STEP_FAILED = false;
     $this->frontendSetup = new CFrontendSetup();
     $this->stage = [0 => ['title' => _('Welcome'), 'fnc' => 'stage0'], 1 => ['title' => _('Check of pre-requisites'), 'fnc' => 'stage1'], 2 => ['title' => _('Configure DB connection'), 'fnc' => 'stage2'], 3 => ['title' => _('Zabbix server details'), 'fnc' => 'stage3'], 4 => ['title' => _('Pre-installation summary'), 'fnc' => 'stage4'], 5 => ['title' => _('Install'), 'fnc' => 'stage5']];
     $this->eventHandler();
     parent::__construct('post');
 }
Esempio n. 10
0
 /**
  * Constructor
  *
  */
 public function create($successCallback, $user = null)
 {
     parent::__construct();
     $acronym = $user ? $user->acronym : "";
     $email = $user ? $user->email : "";
     $name = $user ? $user->name : "";
     $id = $user ? $user->id : "";
     $password = $user ? $user->password : "";
     $this->AddElement(new CFormElementText('acronym', ['value' => $acronym]))->AddElement(new CFormElementText('name', ['value' => $name]))->AddElement(new CFormElementText('email', ['value' => $email]))->AddElement(new CFormElementHidden('id', ['value' => $id]))->AddElement(new CFormElementPassword('password', ['value' => $password]))->AddElement(new CFormElementSubmit('submit', array('callback' => $successCallback)))->AddElement(new CFormElementSubmit('submit-fail', array('callback' => array($this, 'DoSubmitFail'))));
     return $this;
 }
Esempio n. 11
0
 public function __construct($config, $model = null, $parent = null)
 {
     $side = Yii::app()->controller instanceof AdminController ? 'admin' : 'client';
     if ($this->back_button_show === null) {
         $this->back_button_show = $side == 'admin';
     }
     if (is_string($config)) {
         $config = self::getFullAlias($config);
     }
     parent::__construct($config, $model, $parent);
     $this->addAttributesToButtons();
 }
Esempio n. 12
0
 /** Create all form elements and validation rules in the constructor.
  *
  */
 public function __construct()
 {
     parent::__construct();
     /*
         $this->AddElement(new CFormElementText('name', array('label'=>'Name of contact person:', 'required'=>true)))
              ->AddElement(new CFormElementText('email', array('required'=>true)))
              ->AddElement(new CFormElementText('phone', array('required'=>true))); */
     $this->AddElement(new CFormElementCheckbox('accept_mail', array('label' => 'It´s great if you send me product information by mail.', 'checked' => false)))->AddElement(new CFormElementCheckbox('accept_phone', array('label' => 'You may call me to try and sell stuff.', 'checked' => true)))->AddElement(new CFormElementCheckbox('accept_agreement', array('label' => 'You must accept the <a href=http://opensource.org/licenses/GPL-3.0>license agreement</a>.', 'required' => true)))->AddElement(new CFormElementSubmit('submit', array('callback' => array($this, 'DoSubmit'))))->AddElement(new CFormElementSubmit('submit-fail', array('callback' => array($this, 'DoSubmitFail'))));
     /*$this->SetValidation('name', array('not_empty'))
       ->SetValidation('email', array('not_empty'))
       ->SetValidation('phone', array('not_empty', 'numeric')); */
     $this->SetValidation('accept_agreement', array('must_accept'));
 }
Esempio n. 13
0
 public function __construct($config, $model = null, $parent = null)
 {
     if ($this->side == null) {
         $this->side = Yii::app()->controller instanceof AdminController ? 'admin' : 'client';
     }
     if ($this->inputElementClass == null) {
         $this->inputElementClass = ucfirst($this->side) . 'FormInputElement';
     }
     if (is_string($config)) {
         $config = self::getFullAlias($config);
     }
     parent::__construct($config, $model, $parent);
     $this->addAttributesToButtons();
     $this->formatDateAttributes();
 }
Esempio n. 14
0
 /** Create all form elements and validation rules in the constructor.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $tests = array('not_empty' => 'not_empty', 'numeric' => 'numeric', 'mail_address' => 'mail_address');
     $testKeys = array_keys($tests);
     $this->AddElement(new CFormElementText('Enter-a-value', array()))->AddElement(new CFormElementCheckboxMultiple('items', array('description' => 'Choose the validation rules to use.', 'values' => $testKeys, 'checked' => null)))->AddElement(new CFormElementSubmit('submit', array('callback' => array($this, 'DoSubmit'))));
     if (!empty($_POST['items'])) {
         $validation = array();
         foreach ($_POST['items'] as $val) {
             $validation[] = $tests[$val];
         }
         //echo "<pre>" . print_r($validation, true) . "</pre>";
         $this->SetValidation('Enter-a-value', $validation);
     }
 }
Esempio n. 15
0
 public function __construct($title = null, $action = null, $method = null, $enctype = null, $form_variable = null)
 {
     $this->top_items = array();
     $this->center_items = array();
     $this->bottom_items = array();
     $this->tableclass = 'formtable';
     if (null == $method) {
         $method = 'post';
     }
     if (null == $form_variable) {
         $form_variable = 'form';
     }
     parent::__construct($action, $method, $enctype);
     $this->setTitle($title);
     $this->setAlign('center');
     $this->setHelp();
     $this->addVar($form_variable, get_request($form_variable, 1));
     $this->addVar('form_refresh', get_request('form_refresh', 0) + 1);
     $this->bottom_items = new CCol(SPACE, 'form_row_last');
     $this->bottom_items->setColSpan(2);
 }
Esempio n. 16
0
 /** Create all form elements and validation rules in the constructor.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->AddElement(new CFormElementText('name'))->AddElement(new CFormElementText('email'))->AddElement(new CFormElementText('phone'))->AddElement(new CFormElementSubmit('submit', array('callback' => array($this, 'DoSubmit'))));
 }
Esempio n. 17
0
 /**
 * Constructor
 */
 public function __construct($object)
 {
     parent::__construct();
     $this->AddElement(new CFormElementText('acronym'))->AddElement(new CFormElementPassword('password'))->AddElement(new CFormElementSubmit('login', array('callback' => array($object, 'DoLogin'))));
     $this->SetValidation('acronym', array('not_empty'))->SetValidation('password', array('not_empty'));
 }
Esempio n. 18
0
 /**
  * Form to create a new user.
  *
  * @param CUser $user the user object.   
  */
 public function CreateUserCreate($user)
 {
     parent::__construct();
     $this->AddElement(new CFormElementText('acronym', array('required' => true)))->AddElement(new CFormElementPassword('password1', array('required' => true, 'label' => 'Password:'******'password2', array('required' => true, 'label' => 'Password again:')))->AddElement(new CFormElementText('name', array('required' => true)))->AddElement(new CFormElementText('email', array('required' => true)))->AddElement(new CFormElementSubmit('create', array('callback' => array($this, 'DoCreate'), 'callback-args' => array($user))));
     $this->SetValidation('acronym', array('not_empty'))->SetValidation('password1', array('not_empty'))->SetValidation('password2', array('not_empty', 'match' => 'password1'))->SetValidation('name', array('not_empty'))->SetValidation('email', array('not_empty'));
 }
Esempio n. 19
0
 /**
 * Constructor
 */
 public function __construct($object)
 {
     parent::__construct();
     $this->AddElement(new CFormElementText('acronym', array('required' => true)))->AddElement(new CFormElementPassword('password', array('required' => true)))->AddElement(new CFormElementPassword('password1', array('required' => true, 'label' => 'Password again:')))->AddElement(new CFormElementText('name', array('required' => true)))->AddElement(new CFormElementText('email', array('required' => true)))->AddElement(new CFormElementSubmit('create', array('callback' => array($object, 'DoCreate'))));
     $this->SetValidation('acronym', array('not_empty'))->SetValidation('password', array('not_empty'))->SetValidation('password1', array('not_empty'))->SetValidation('name', array('not_empty'))->SetValidation('email', array('not_empty'));
 }
Esempio n. 20
0
 /** Create all form elements and validation rules in the constructor.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->AddElement(new CFormElementText('name'))->AddElement(new CFormElementText('email'))->AddElement(new CFormElementText('phone'))->AddElement(new CFormElementSubmit('submit', array('callback' => array($this, 'DoSubmit'))))->AddElement(new CFormElementSubmit('submit-fail', array('callback' => array($this, 'DoSubmitFail'))));
     $this->SetValidation('name', array('not_empty'))->SetValidation('email', array('not_empty'))->SetValidation('phone', array('not_empty', 'numeric'));
 }
Esempio n. 21
0
 /**
  * Constructor Method
  *
  * @access public
  * @param string|array $config
  * @param CModel $model
  * @param CBaseController|CForm $parent
  * @return void
  */
 public function __construct($config, $model = null, $parent = null)
 {
     parent::__construct($config, $model, $parent);
     \application\components\EventManager::attach($this);
 }
Esempio n. 22
0
 /**
  * Constructor.
  * @param mixed $parent the direct parent of this form. This could be either a {@link CBaseController}
  * @param mixed $config the configuration for this form. It can be a configuration array
  * @param CModel $model the model object associated with this form. If it is null,
  * @param mixed $key
  */
 public function __construct($config, $model, $parent = null, $key = null)
 {
     $this->_key = $key;
     parent::__construct($config, $model, $parent);
 }
Esempio n. 23
0
 /**
 * Constructor
 */
 public function __construct($object, $user)
 {
     parent::__construct();
     $this->AddElement(new CFormElementText('acronym', array('readonly' => true, 'value' => $user['acronym'])))->AddElement(new CFormElementPassword('password'))->AddElement(new CFormElementPassword('password1', array('label' => 'Password again:')))->AddElement(new CFormElementSubmit('change_password', array('callback' => array($object, 'DoChangePassword'))))->AddElement(new CFormElementText('name', array('value' => $user['name'], 'required' => true)))->AddElement(new CFormElementText('email', array('value' => $user['email'], 'required' => true)))->AddElement(new CFormElementSubmit('save', array('callback' => array($object, 'DoProfileSave'))));
     $this->SetValidation('name', array('not_empty'))->SetValidation('email', array('not_empty'));
 }
Esempio n. 24
0
 public function __construct($oDBTable, $sAction = '.', $aFormFields = array())
 {
     parent::__construct($sAction, $aFormFields);
     $this->_oDBTable = $oDBTable;
     $this->addFieldsFromDBTable($this->_oDBTable);
 }
Esempio n. 25
0
 /** Create all form elements and validation rules in the constructor.
  *
  */
 public function __construct()
 {
     parent::__construct();
     $this->AddElement(new CFormElementText('name', array('label' => 'Name of contact person:', 'required' => true)))->AddElement(new CFormElementText('email', array('required' => true)))->AddElement(new CFormElementText('phone', array('required' => true)))->AddElement(new CFormElementSubmit('submit', array('callback' => array($this, 'DoSubmit'))))->AddElement(new CFormElementSubmit('submit-fail', array('callback' => array($this, 'DoSubmitFail'))));
     $this->SetValidation('name', array('not_empty'))->SetValidation('email', array('not_empty'))->SetValidation('phone', array('not_empty', 'numeric'));
 }
Esempio n. 26
0
 /**
 * Constructor
 */
 public function __construct($object)
 {
     parent::__construct();
     $this->objecyt = $object;
     $this->AddElement(new CFormElementTextarea('data', array('label' => 'Add entry:')))->AddElement(new CFormElementSubmit('add', array('callback' => array($this, 'DoAdd'), 'callback-args' => array($object))));
 }