本文整理汇总了PHP中CActiveForm::init方法的典型用法代码示例。如果您正苦于以下问题:PHP CActiveForm::init方法的具体用法?PHP CActiveForm::init怎么用?PHP CActiveForm::init使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CActiveForm
的用法示例。
在下文中一共展示了CActiveForm::init方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: init
public function init()
{
// Set input container for error class addition when validation fails
if (isset($this->clientOptions)) {
if (!isset($this->clientOptions['inputContainer'])) {
$this->clientOptions['inputContainer'] = '.control-group';
}
} else {
$this->clientOptions = array('inputContainer' => '.control-group');
}
// Set default for class
if (!isset($this->type) || !in_array($this->type, array('vertical', 'inline', 'search', 'horizontal'))) {
$this->type = 'horizontal';
}
$class = 'form-' . $this->type;
if (isset($this->htmlOptions)) {
if (!isset($this->htmlOptions['class'])) {
$this->htmlOptions['class'] = $class;
} else {
$this->htmlOptions['class'] .= ' ' . $class;
}
} else {
$this->htmlOptions = array('class' => $class);
}
// then do($magic)
parent::init();
}
示例2: init
public function init()
{
if (!$this->action && Yii::app()->params->isPhoneGap) {
$this->action = AuxLib::getRequestUrl();
}
return parent::init();
}
示例3: init
public function init()
{
parent::init();
if ($this->enableSaveToLocalStorage) {
$this->registerClientScript();
}
}
示例4: init
/**
* Initializes the widget.
*/
public function init()
{
if (!in_array($this->type, array(TbHtml::FORM_HORIZONTAL, TbHtml::FORM_INLINE, TbHtml::FORM_VERTICAL))) {
$this->type = TbHtml::FORM_VERTICAL;
}
$this->htmlOptions = TbHtml::addClassName('form-' . $this->type, $this->htmlOptions);
if (null === $this->helpType) {
$this->helpType = $this->type == TbHtml::FORM_HORIZONTAL ? TbHtml::HELP_INLINE : TbHtml::HELP_BLOCK;
}
parent::init();
}
示例5: init
/**
* Initializes the widget.
* This renders the form open tag.
*/
public function init()
{
echo <<<EOD
<div class="form gii2">
\t<p class="note">
\t\tFields with <span class="required">*</span> are required.
\t\tClick on the <span class="sticky">highlighted fields</span> to edit them.
\t</p>
EOD;
parent::init();
}
示例6: init
/**
* Init the widget .
*
* @access public
* @return void
*/
public function init()
{
if ($this->horizontal) {
EBootstrap::mergeClass($this->htmlOptions, array('form-horizontal'));
}
if ($this->cssFile === false) {
$cssFile = dirname(__FILE__) . '/css/bootstrap.css';
$this->cssFile = Yii::app()->getAssetManager()->publish($cssFile);
Yii::app()->clientScript->registerCssFile($this->cssFile);
}
parent::init();
}
示例7: init
/**
* Initializes the widget.
* This renders the form open tag.
*/
public function init()
{
if (!isset($this->htmlOptions['class'])) {
$this->htmlOptions['class'] = 'form-' . $this->type;
} else {
$this->htmlOptions['class'] .= ' form-' . $this->type;
}
if ($this->inlineErrors) {
$this->errorMessageCssClass = 'help-inline';
} else {
$this->errorMessageCssClass = 'help-block';
}
parent::init();
}
示例8: init
/**
* Initializes the widget.
* This renders the form open tag.
*/
public function init()
{
$cssClass = $this->stacked ? 'form-stacked' : '';
if (!isset($this->htmlOptions['class'])) {
$this->htmlOptions['class'] = $cssClass;
} else {
$this->htmlOptions['class'] .= ' ' . $cssClass;
}
if ($this->errorMessageType === 'inline') {
$this->errorMessageCssClass = 'help-inline';
} else {
$this->errorMessageCssClass = 'help-block';
}
parent::init();
}
示例9: init
/**
* Initializes the widget.
*/
public function init()
{
$script = <<<SCRIPT
\t\$('#{$this->id} .{$this->containerCssClass} :radio:not(:checked)').siblings('.{$this->contentCssClass}').hide();
\t\$('#{$this->id} .{$this->containerCssClass} :radio').click(function(){
\t\t\$('.{$this->contentCssClass}', \$(this).parents('div:first')).css('display', this.checked ? 'inline':'none');
\t\t\$('#{$this->id} .{$this->containerCssClass} :radio:not(:checked)').siblings('.{$this->contentCssClass}').hide();
\t});
\t\$('#{$this->id} .{$this->containerCssClass} :checkbox:not(:checked)').siblings('.{$this->contentCssClass}').hide();
\t\$('#{$this->id} .{$this->containerCssClass} :checkbox').click(function(){
\t\t\$('.{$this->contentCssClass}', \$(this).parents('div:first')).css('display', this.checked ? 'block':'none');
\t});
SCRIPT;
Yii::app()->clientScript->registerScript(__CLASS__ . '#' . $this->id, $script, CClientScript::POS_READY);
parent::init();
}
示例10: init
/**
*### .init()
* Initializes the widget.
* This renders the form open tag.
*/
public function init()
{
if (!isset($this->htmlOptions['class'])) {
$this->htmlOptions['class'] = 'form-' . $this->type;
} else {
$this->htmlOptions['class'] .= ' form-' . $this->type;
}
if (!isset($this->inlineErrors)) {
$this->inlineErrors = $this->type === self::TYPE_HORIZONTAL;
}
if ($this->inlineErrors) {
$this->errorMessageCssClass = 'help-inline error';
} else {
$this->errorMessageCssClass = 'help-block error';
}
parent::init();
}
示例11: init
public function init()
{
Yii::app()->clientScript->registerPackage('jquery.ui');
Yii::app()->clientScript->registerPackage('jquery');
Yii::app()->clientScript->registerPackage('cookie');
Yii::app()->clientScript->registerScript('modelData', 'var modelData = ' . json_encode($this->model->toArray()) . ';', CClientScript::POS_HEAD);
$assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . '/assets');
Yii::app()->clientScript->registerScriptFile($assets . '/js/modelForm.js', CClientScript::POS_END);
if (!$this->fromModel && $this->model instanceof IFileBased) {
echo $this->upload('id');
}
if (!$this->fromModel) {
$this->htmlOptions['onsubmit'] = 'return modelFormSubmit();';
}
$this->htmlOptions['isNew'] = (int) (!$this->model->id);
$this->htmlOptions['class'] = 'modelForm';
parent::init();
}
示例12: init
/**
* Initializes the widget.
* This renders the form open tag.
*/
public function init()
{
if (!isset($this->htmlOptions['class'])) {
$this->htmlOptions['class'] = 'form-' . $this->type;
} else {
$this->htmlOptions['class'] .= ' form-' . $this->type;
}
if (!isset($this->inlineErrors)) {
$this->inlineErrors = $this->type === self::TYPE_HORIZONTAL;
}
if (!isset($this->errorField)) {
self::$showError = $this->errorField;
}
if ($this->inlineErrors) {
$this->errorMessageCssClass = 'help-inline error';
} else {
$this->errorMessageCssClass = 'help-block has-error';
}
if ($this->enter2tab) {
$this->enterToTab();
}
$this->htmlOptions['role'] = "form";
parent::init();
}
示例13: init
public function init()
{
$this->id = $this->resolveId($this->id);
parent::init();
}
示例14: init
/**
* Registers clientscripts for radio and checkbox if needed
*/
public function init()
{
if ($this->enableRadioToggle) {
$this->registerRadioClientScript();
}
if ($this->enableChecboxToggle) {
$this->registerCheckboxClientScript();
}
parent::init();
}
示例15: init
/**
* Init the form widget
*/
public function init()
{
if ($this->layout !== 'standard') {
$class = 'form-' . $this->layout;
if (isset($this->htmlOptions['class'])) {
$this->htmlOptions['class'] .= " {$class}";
} else {
$this->htmlOptions['class'] = $class;
}
}
parent::init();
}