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();
 }
Beispiel #2
0
 public function init()
 {
     if (!$this->action && Yii::app()->params->isPhoneGap) {
         $this->action = AuxLib::getRequestUrl();
     }
     return parent::init();
 }
    public function init()
    {
        parent::init();

        if ($this->enableSaveToLocalStorage) {
            $this->registerClientScript();
        }
    }
Beispiel #4
0
 /**
  * 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();
 }
    /**
     * 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();
    }
 /**
  * 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();
 }
Beispiel #7
0
 /**
  * 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();
 }
Beispiel #8
0
 /**
  * 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();
 }
Beispiel #9
0
    /**
     * 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();
    }
Beispiel #10
0
 /**
  *### .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();
 }
Beispiel #11
0
 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();
 }
Beispiel #12
0
 /**
  * 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();
 }
Beispiel #13
0
 public function init()
 {
     $this->id = $this->resolveId($this->id);
     parent::init();
 }
 /**
  * Registers clientscripts for radio and checkbox if needed
  */
 public function init()
 {
     if ($this->enableRadioToggle) {
         $this->registerRadioClientScript();
     }
     if ($this->enableChecboxToggle) {
         $this->registerCheckboxClientScript();
     }
     parent::init();
 }
Beispiel #15
0
 /**
  * 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();
 }
Beispiel #16
0
 public function init()
 {
     $this->id = $this->resolveId($this->id);
     if ($this->instantiateJSClassOnInit) {
         $this->registerPackages();
         $this->instantiateJSClass(false);
     }
     parent::init();
     echo CHtml::hiddenField(X2WidgetBehavior::NAMESPACE_KEY, $this->namespace);
 }
Beispiel #17
0
 /**
  * Initializes the widget.
  * This renders the form open tag.
  */
 public function init()
 {
     Html::addCssClass($this->htmlOptions, 'form-' . $this->type);
     if (!isset($this->inlineErrors)) {
         $this->inlineErrors = $this->type === self::TYPE_HORIZONTAL;
     }
     if (!isset($this->errorMessageCssClass)) {
         if ($this->inlineErrors) {
             $this->errorMessageCssClass = 'help-inline error';
         } else {
             $this->errorMessageCssClass = 'help-block error';
         }
     }
     if ($this->type == self::TYPE_HORIZONTAL && !isset($this->clientOptions['inputContainer'])) {
         $this->clientOptions['inputContainer'] = 'div.control-group';
     }
     parent::init();
 }
Beispiel #18
0
 public function init()
 {
     $this->widget('ext.pixelmatrix.EUniform', $this->uniform);
     parent::init();
 }
Beispiel #19
0
 public function init()
 {
     $this->id = $this->resolveId($this->id);
     if ($this->instantiateJSClass) {
         $this->registerPackages();
         $this->registerJSClassInstantiationScript();
     }
     parent::init();
     echo CHtml::hiddenField(X2Widget::NAMESPACE_KEY, $this->namespace);
 }
 /**
  * Initializes the widget.
  * This renders the form open tag.
  */
 public function init()
 {
     self::addCssClass($this->htmlOptions, 'form' . self::$typeClasses[$this->type]);
     if (!isset($this->errorMessageCssClass)) {
         $this->errorMessageCssClass = 'help-block error';
     }
     if (!isset($this->clientOptions['errorCssClass'])) {
         $this->clientOptions['errorCssClass'] = 'has-error';
     }
     if (!isset($this->clientOptions['successCssClass'])) {
         $this->clientOptions['successCssClass'] = 'has-success';
     }
     if (!isset($this->clientOptions['inputContainer'])) {
         $this->clientOptions['inputContainer'] = 'div.form-group';
     }
     parent::init();
 }
Beispiel #21
0
 /**
  * Initializes the widget.
  * Don't render the open tag
  */
 public function init()
 {
     ob_start();
     parent::init();
     ob_get_clean();
 }
Beispiel #22
0
 /**
  * Initialization
  *
  * Replaces the default required label
  */
 public function init()
 {
     // replaces the automatically appended '*' to required labels
     CHtml::$afterRequiredLabel = '&nbsp;<span class="text-danger">*</span>';
     return parent::init();
 }