本文整理汇总了PHP中CForm::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP CForm::__construct方法的具体用法?PHP CForm::__construct怎么用?PHP CForm::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CForm
的用法示例。
在下文中一共展示了CForm::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
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);
}
示例2: __construct
/**
* 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'));
}
示例3: array
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');
}
示例4: __construct
/** 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'))));
}
示例5: array
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');
}
示例6: __construct
/** 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'))));
}
示例7: __construct
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);
}
示例8: create
/**
* 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;
}
示例9: CFrontendSetup
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');
}
示例10: create
/**
* 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;
}
示例11: __construct
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();
}
示例12: __construct
/** 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'));
}
示例13: __construct
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();
}
示例14: __construct
/** 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);
}
}
示例15: __construct
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);
}