activeTextField() public static method

Generates a text field input for a model attribute.
See also: self::activeTextInputField
public static activeTextField ( CModel $model, string $attribute, array $htmlOptions = [] ) : string
$model CModel the data model.
$attribute string the attribute.
$htmlOptions array additional HTML attributes.
return string the generated input field.
Example #1
0
 /**
  * Renders the filter cell content. Here we can provide HTML options for actual filter input
  */
 protected function renderFilterCellContent()
 {
     if (is_string($this->filter)) {
         echo $this->filter;
     } else {
         if ($this->filter !== false && $this->grid->filter !== null && $this->name !== null && strpos($this->name, '.') === false) {
             if ($this->filterInputOptions) {
                 $filterInputOptions = $this->filterInputOptions;
                 if (empty($filterInputOptions['id'])) {
                     $filterInputOptions['id'] = false;
                 }
             } else {
                 $filterInputOptions = array();
             }
             if (is_array($this->filter)) {
                 $filterInputOptions['prompt'] = '';
                 echo TbHtml::activeDropDownList($this->grid->filter, $this->name, $this->filter, $filterInputOptions);
             } else {
                 if ($this->filter === null) {
                     echo TbHtml::activeTextField($this->grid->filter, $this->name, $filterInputOptions);
                 }
             }
         } else {
             parent::renderFilterCellContent();
         }
     }
 }
 /**
  * Runs the widget.
  */
 public function run()
 {
     list($name, $id) = $this->resolveNameID();
     $id = $this->resolveId($id);
     if ($this->hasModel()) {
         echo TbHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo TbHtml::textField($name, $this->value, $this->htmlOptions);
     }
     if ($this->assetPath !== false) {
         $this->publishAssets($this->assetPath);
         $this->registerCssFile('/css/bootstrap-datetimepicker.css');
         if ($this->registerJs) {
             $this->registerScriptFile('/js/' . $this->resolveScriptVersion('bootstrap-datetimepicker.js'), CClientScript::POS_END);
             if (isset($this->locale)) {
                 $this->locale = str_replace('_', '-', $this->locale);
                 $this->registerScriptFile("/js/locales/bootstrap-datetimepicker.{$this->locale}.js", CClientScript::POS_END);
             }
         }
     }
     if ($this->bindPlugin) {
         $options = !empty($this->pluginOptions) ? CJavaScript::encode($this->pluginOptions) : '';
         $this->getClientScript()->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').datetimepicker({$options});");
     }
 }
Example #3
0
 /**
  * Renders field
  */
 public function renderField()
 {
     list($name, $id) = $this->resolveNameID();
     TbArray::defaultValue('id', $id, $this->htmlOptions);
     TbArray::defaultValue('name', $name, $this->htmlOptions);
     if ($this->hasModel()) {
         echo TbHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo TbHtml::textField($name, $this->value, $this->htmlOptions);
     }
 }
 /**
  * Renders the field if no selector has been provided
  */
 public function renderField()
 {
     if (null === $this->selector) {
         list($name, $id) = $this->resolveNameID();
         if ($this->hasModel()) {
             echo TbHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
         } else {
             echo TbHtml::textField($name, $this->value, $this->htmlOptions);
         }
         $this->setLocaleSettings();
     }
 }
Example #5
0
 /**
  * Renders the field if no selector has been provided
  */
 public function renderField()
 {
     if (null === $this->selector) {
         $options = array();
         list($name, $id) = $this->resolveNameID();
         $options['id'] = $id . '_datetimepicker';
         TbHtml::addCssClass('input-group date form_datetime', $options);
         echo TbHtml::openTag('div', $options);
         if ($this->hasModel()) {
             echo TbHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
         } else {
             echo TbHtml::textField($name, $this->value, $this->htmlOptions);
         }
         echo TbHtml::openTag('span', array('class' => 'input-group-addon'));
         echo '<i class="glyphicon glyphicon-th"' . '></i>';
         echo TbHtml::closeTag('span');
         echo TbHtml::closeTag('div');
     }
 }
Example #6
0
 /**
  * Renders the field if no selector has been provided
  */
 public function renderField()
 {
     if (null === $this->selector) {
         $options = array();
         list($name, $id) = $this->resolveNameID();
         $options['id'] = $id . '_datetimepicker';
         TbHtml::addCssClass('input-append', $options);
         echo TbHtml::openTag('div', $options);
         if ($this->hasModel()) {
             echo TbHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
         } else {
             echo TbHtml::textField($name, $this->value, $this->htmlOptions);
         }
         echo TbHtml::openTag('span', array('class' => 'add-on'));
         echo '<i data-time-icon="' . $this->iconTime . '" data-date-icon="' . $this->iconDate . '"></i>';
         echo TbHtml::closeTag('span');
         echo TbHtml::closeTag('div');
     }
 }
Example #7
0
echo TbHtml::activeLabelEx($model, 'title', array('class' => 'control-label'));
?>
            <div class="controls">
                <?php 
echo TbHtml::activeTextField($model, 'title', array());
?>
            </div>
        </div>
        
        <div class="control-group">
            <?php 
echo TbHtml::activeLabelEx($model, 'link', array('class' => 'control-label'));
?>
            <div class="controls">
                <?php 
echo TbHtml::activeTextField($model, 'link', array());
?>
            </div>
        </div>
    
        <div class="control-group">
            <?php 
echo TbHtml::activeLabelEx($model, Yii::t('main', 'Portfolio'), array('for' => 'Posting_portfolio', 'class' => 'control-label'));
?>
            <div class="controls">
                <?php 
$this->widget('application.modules.portfolio.widgets.PhotoPortfolio.PhotoPortfolioWidget', array('portfolio' => $portfolio, 'portfolioType' => 1, 'uploadAction' => Yii::app()->createUrl('portfolio/default/uploadMagazine'), 'photoCountMax' => 1, 'allowedExtensions' => array('jpg', 'png', 'swf', 'jpeg'), 'checkBoxClass' => 'hide', 'radiobuttonClass' => 'hide'));
?>
            </div>
        </div>
    </fieldset>
Example #8
0
<div class="form">
    <?php 
echo TbHtml::beginForm($request_url, 'post', array('enctype' => 'multipart/form-data'));
?>
    <div class="form-group has-success clearfix">
        <div class="wr col-sm-6">
            <?php 
echo TbHtml::activeTextField($model, 'reader_name', array('placeholder' => 'ФИО читателя', 'required' => 'true', 'autofocus' => 'true', 'class' => 'form-control', 'value' => isset($name) ? $name : ''));
?>
        </div>
    </div>
    <div>
        <?php 
echo TbHtml::submitButton('Сохранить', array('color' => TbHtml::BUTTON_COLOR_PRIMARY));
?>
    </div>
    <?php 
echo TbHtml::endForm();
?>
</div>
Example #9
0
            <?php 
echo TbHtml::activeLabelEx($model, Yii::t('main', 'Portfolio'), array('for' => 'Posting_portfolio', 'class' => 'control-label'));
?>
            <div class="controls">
                <?php 
$this->widget('application.modules.portfolio.widgets.PhotoPortfolio.PhotoPortfolioWidget', array('portfolio' => $portfolio, 'uploadAction' => Yii::app()->createUrl('portfolio/default/uploadfile'), 'photoCountMax' => 2, 'allowedExtensions' => array('gif', 'jpg', 'jpeg', 'png')));
?>
            </div>
        </div>
        
        <div class="control-group">
            <?php 
echo TbHtml::activeLabelEx($model, 'order_nr', array('class' => 'control-label'));
?>
            <div class="controls">
                <?php 
echo TbHtml::activeTextField($model, 'order_nr', array());
?>
            </div>
        </div>
        
    </fieldset>
  
        <div class="buttons">
            <?php 
echo TbHtml::submitButton($model->isNewRecord ? Yii::t('main', 'Create') : Yii::t('main', 'Save'), array('class' => 'fl-r'));
?>
        </div>
  
<?php 
$this->endWidget();
Example #10
0
echo TbHtml::beginForm($request_url, 'post', array('enctype' => 'multipart/form-data'));
?>
    <div class="form-group has-success clearfix">
        <div class="wr col-sm-6">
            <?php 
echo TbHtml::dropDownList('reader_list', 'id', $reader_list, array('empty' => 'Выберите Пользователя', 'required' => 'true', 'options' => array(isset($reader_id_checked) ? $reader_id_checked : '' => array('selected' => true))));
?>

        </div>
        <div class="wr col-sm-6">
            <?php 
echo TbHtml::dropDownList('books_list', 'id', $books_list, array('empty' => 'Выберите Книгу', 'required' => 'true', 'options' => array(isset($book_id_checked) ? $book_id_checked : '' => array('selected' => true))));
?>
        </div>
        <div class="wr col-sm-6">
            <?php 
echo TbHtml::activeTextField($model, 'count_books', array('placeholder' => 'Количество', 'required' => true, 'pattern' => '[0-9]{1,2}', 'value' => isset($count) ? $count : ''));
?>
        </div>
    </div>
    <div>
        <?php 
echo TbHtml::submitButton('Выдать', array('color' => TbHtml::BUTTON_COLOR_PRIMARY));
?>
    </div>
    <?php 
echo TbHtml::endForm();
?>
</div>

Example #11
0
            <?php 
echo CHtml::activeDropDownList($news, 'user_id', CHtml::listData(User::model()->findAll(), 'user_id', 'email'), array('size' => 1));
?>
            <?php 
//echo TbHtml::dropDownList($modelClass.'[user_id]', $news->user_id, CHtml::listData(User::model()->findAll(), 'user_id', 'email'), array('size'=>1));
?>
        </div>
    </div>
    
    <div class="control-group">
        <?php 
echo TbHtml::activeLabelEx($post, 'title', array('class' => 'control-label'));
?>
        <div class="controls">
            <?php 
echo TbHtml::activeTextField($post, 'title', array());
?>
        </div>
    </div>
        
    <?php 
echo $form->textFieldControlGroup($post, 'description', array('span' => 8));
?>

    <div class="control-group">
        <?php 
echo TbHtml::activeLabelEx($news, 'anounce', array('class' => 'control-label'));
?>
        <div class="controls">
            <?php 
$this->widget('application.widgets.imperaviRedactor.ImperaviRedactorWidget', array('model' => $news, 'attribute' => 'anounce', 'id' => $modelClass . '_anounce', 'name' => $modelClass . '[anounce]', 'options' => array('lang' => Yii::app()->language, 'direction' => 'ltr', 'minHeight' => 100, 'toolbar' => true, 'iframe' => false)));
Example #12
0
<div class="form">
<?php 
    echo TbHtml::beginForm();
    ?>

	<?php 
    echo TbHtml::errorSummary($form);
    ?>
	
	<div class="row-fluid">
		<?php 
    echo TbHtml::activeLabel($form, 'login_or_email');
    ?>
		<?php 
    echo TbHtml::activeTextField($form, 'login_or_email');
    ?>
		<p class="hint"><?php 
    echo UserModule::t("Please enter your login or email addres.");
    ?>
</p>
	</div>
	
	<div class="row-fluid submit">
		<?php 
    echo TbHtml::button(UserModule::t('Restore'), array('color' => TbHtml::BUTTON_COLOR_PRIMARY, 'submit' => ''));
    ?>
	</div>

<?php 
    echo TbHtml::endForm();
Example #13
0
<div class="control-group">
<?php 
echo Yii::t('main', 'Fields with <span class="required">*</span> are required.');
?>
</div>
<?php 
echo $form->errorSummary(array($model));
?>
<div class="control-group">
    <?php 
echo TbHtml::activeLabelEx($model, 'title', array('class' => 'control-label'));
?>
    <div class="controls">

        <?php 
echo TbHtml::activeTextField($model, 'title', array('style' => 'width:600px;'));
?>
    </div>
</div>

<div class="buttons">
    <?php 
echo TbHtml::submitButton($model->isNewRecord ? Yii::t('main', 'Create') : Yii::t('main', 'Save'), array('class' => 'fl-r'));
?>
</div>

<?php 
$this->endWidget();
?>

Example #14
0
for ($i = 1; $i <= 12; $i++) {
    $arrMonth[$i] = Magazine::getMonthName($i);
}
?>

<?php 
echo $form->errorSummary(array($model, $portfolio), null, null, array('class' => 'alert-error'));
?>

        <div class="control-group">
            <?php 
echo TbHtml::activeLabelEx($model, 'title', array('class' => 'control-label'));
?>
            <div class="controls">
                <?php 
echo TbHtml::activeTextField($model, 'title', array());
?>
            </div>
        </div>
        
        <?php 
//echo $form->dropDownListControlGroup($model, 'publication_year', $arrYear);
?>
        
        <?php 
//echo $form->dropDownListControlGroup($model, 'publication_month', $arrMonth);
?>
 
        
        <div class="control-group">
            <?php 
Example #15
0
<div class="form">
    <?php 
echo TbHtml::beginForm($request_url, 'post', array('enctype' => 'multipart/form-data'));
?>
    <div class="form-group has-success clearfix">
        <div class="wr col-sm-6">
            <?php 
echo TbHtml::activeTextField($model, 'name', array('placeholder' => 'Наименование Книги', 'required' => 'true', 'autofocus' => 'true', 'class' => 'form-control', 'value' => isset($result) ? $result->name : ''));
?>

        </div>
        <div class="wr col-sm-6">
            <?php 
echo TbHtml::activeTextField($model, 'count_books', array('placeholder' => 'Количество', 'required' => 'true', 'autofocus' => 'true', 'class' => 'form-control', 'pattern' => '[0-9]{1,2}', 'value' => isset($result) ? $result->count_books : ''));
?>

        </div>
        <div class="wr col-sm-6">
            <?php 
echo TbHtml::dropDownList('author_list', 'id', $author_list, array('multiple' => true, 'required' => 'true'));
?>
        </div>

    </div>
    <div>
        <?php 
echo TbHtml::submitButton('Сохранить', array('color' => TbHtml::BUTTON_COLOR_PRIMARY));
?>
    </div>
    <?php 
echo TbHtml::endForm();
Example #16
0
?>
		<?php 
echo $form->textField($model, 'NOPOL', array('size' => 25, 'maxlength' => 25));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'Tanggal Perbaikan');
?>
		<?php 
echo TbHtml::activeTextField($model, 'from_date', array("id" => "from_date"), 'required');
?>
		&nbsp; s/d &nbsp;
		<?php 
echo TbHtml::activeTextField($model, 'to_date', array("id" => "to_date"));
?>
		<?php 
$this->widget('application.extensions.calendar.SCalendar', array('inputField' => 'from_date', 'ifFormat' => '%Y-%m-%d'));
?>
		<?php 
$this->widget('application.extensions.calendar.SCalendar', array('inputField' => 'to_date', 'ifFormat' => '%Y-%m-%d'));
?>
	</div>

	<div class="row">
		<?php 
echo $form->label($model, 'Jenis Perbaikan');
?>
		<?php 
$data = array('0' => 'Perbaikan', '1' => 'Penggantian', '2' => 'Perbaikan & Penggantian');
Example #17
0
 /**
  * Renders a text field for a model attribute.
  * This method is a wrapper of {@link TbHtml::activeTextField}.
  * Please check {@link TbHtml::activeTextField} for detailed information
  * about the parameters for this method.
  * @param CModel $model the data model
  * @param string $attribute the attribute
  * @param array $htmlOptions additional HTML attributes.
  * @return string the generated input field
  */
 public function textField($model, $attribute, $htmlOptions = array())
 {
     return $this->wrapControl(TbHtml::activeTextField($model, $attribute, $htmlOptions));
 }
 public function testActiveTextField()
 {
     $I = $this->codeGuy;
     $html = TbHtml::activeTextField(new Dummy(), 'text', array('class' => 'input'));
     $input = $I->createNode($html, 'input[type=text].form-control');
     $I->seeNodeAttributes($input, array('class' => 'input form-control', 'id' => 'Dummy_text', 'name' => 'Dummy[text]', 'value' => 'text'));
     $html = TbHtml::activeTextField(new Dummy(), 'text', array('prepend' => 'Prepend text'));
     $div = $I->createNode($html, 'div');
     $I->seeNodeCssClass($div, 'input-group');
     $I->seeNodeChildren($div, array('span', 'input'));
     $span = $div->filter('span.input-group-addon');
     $I->seeNodeText($span, 'Prepend text');
     $html = TbHtml::activeTextField(new Dummy(), 'text', array('append' => 'Append text'));
     $div = $I->createNode($html, 'div');
     $I->seeNodeCssClass($div, 'input-group');
     $I->seeNodeChildren($div, array('input', 'span'));
     $span = $div->filter('span.input-group-addon');
     $I->seeNodeText($span, 'Append text');
     $html = TbHtml::activeTextField(new Dummy(), 'text', array('prepend' => 'Prepend text', 'append' => 'Append text'));
     $div = $I->createNode($html, 'div');
     $I->seeNodeCssClass($div, 'input-group');
     $I->seeNodeChildren($div, array('span.input-group-addon', 'input', 'span.input-group-addon'));
     $html = TbHtml::activeTextField(new Dummy(), 'text', array('span' => 6));
     $div = $I->createNode($html, 'div');
     $I->seeNodeCssClass($div, 'col-md-6');
     $I->seeNodeChildren($div, array('input'));
     $html = TbHtml::activeTextField(new Dummy(), 'text', array('xs' => 6, 'md' => 6));
     $div = $I->createNode($html, 'div');
     $I->seeNodeCssClass($div, 'col-xs-6');
     $I->seeNodeCssClass($div, 'col-md-6');
     $I->seeNodeChildren($div, array('input'));
     $html = TbHtml::activeTextField(new Dummy(), 'text', array('class' => 'col-md-4'));
     $div = $I->createNode($html, 'div');
     $I->seeNodeCssClass($div, 'col-md-4');
     $I->seeNodeChildren($div, array('input'));
 }
Example #19
0
	<p class="note"><?php 
echo UserModule::t('Fields withs <span class="required">*</span> are required.');
?>
</p>
	
	<?php 
echo TbHtml::errorSummary($model);
?>
	
	<div class="form-control input-lg" style="width: 45%;">
		<?php 
echo TbHtml::activeLabelEx($model, 'username');
?>
		<?php 
echo TbHtml::activeTextField($model, 'username');
?>
	</div><br/>
	
	<div class="form-control input-lg" style="width: 45%;">
		<?php 
echo TbHtml::activeLabelEx($model, 'password');
?>
		<?php 
echo TbHtml::activePasswordField($model, 'password');
?>
	</div><br/>
	
	<div style="width: 45%;">
		<p class="hint">
		<?php 
 /**
  * Renders a text field for a model attribute.
  * @param CModel $model the data model.
  * @param string $attribute the attribute.
  * @param array $htmlOptions additional HTML attributes.
  * @return string the generated input field.
  * @see TbHtml::activeTextField
  */
 public function textField($model, $attribute, $htmlOptions = array())
 {
     return TbHtml::activeTextField($model, $attribute, $htmlOptions);
 }
Example #21
0
echo TbHtml::activeLabelEx($model, 'newPassword', array('class' => 'fl-l w-200'));
?>
        <div class="controls">
            <?php 
echo TbHtml::activeTextField($model, 'newPassword', array('size' => 60, 'maxlength' => 128, 'style' => 'width:400px'));
?>
	    </div>
    </div>

    <div class="control-group">
        <?php 
echo TbHtml::activeLabelEx($model, 'verifyPassword', array('class' => 'fl-l w-200'));
?>
        <div class="controls">
            <?php 
echo TbHtml::activeTextField($model, 'verifyPassword', array('size' => 60, 'maxlength' => 128, 'style' => 'width:400px'));
?>
        </div>
    </div>
    
    <div class="buttons">
        <?php 
echo TbHtml::submitButton($model->isNewRecord ? Yii::t('main', 'Create') : Yii::t('main', 'Save'), array('class' => 'fl-r'));
?>
    </div>

<?php 
$this->endWidget();
?>

Example #22
0
 public function testActiveTextField()
 {
     $I = $this->codeGuy;
     $html = TbHtml::activeTextField(new Dummy(), 'text', array('class' => 'input'));
     $input = $I->createNode($html, 'input[type=text]');
     $I->seeNodeAttributes($input, array('class' => 'input', 'id' => 'Dummy_text', 'name' => 'Dummy[text]', 'value' => 'text'));
     $html = TbHtml::activeTextField(new Dummy(), 'text', array('prepend' => 'Prepend text'));
     $div = $I->createNode($html, 'div');
     $I->seeNodeCssClass($div, 'input-prepend');
     $I->seeNodeChildren($div, array('span.add-on', 'input'));
     $span = $div->filter('span.add-on');
     $I->seeNodeText($span, 'Prepend text');
     $html = TbHtml::activeTextField(new Dummy(), 'text', array('append' => 'Append text'));
     $div = $I->createNode($html, 'div');
     $I->seeNodeCssClass($div, 'input-append');
     $I->seeNodeChildren($div, array('input', 'span'));
     $span = $div->filter('span.add-on');
     $I->seeNodeText($span, 'Append text');
     $html = TbHtml::activeTextField(new Dummy(), 'text', array('prepend' => 'Prepend text', 'append' => 'Append text'));
     $div = $I->createNode($html, 'div');
     $I->seeNodeCssClass($div, 'input-prepend input-append');
     $I->seeNodeChildren($div, array('span.add-on', 'input', 'span.add-on'));
 }
 /**
  * Renders field
  */
 public function renderField()
 {
     list($name, $id) = $this->resolveNameID();
     $this->htmlOptions = TbHtml::defaultOption('id', $id, $this->htmlOptions);
     $this->htmlOptions = TbHtml::defaultOption('name', $name, $this->htmlOptions);
     // by using TbHtml we support all bootstrap options
     if ($this->hasModel()) {
         echo TbHtml::activeTextField($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo TbHtml::textField($name, $this->value, $this->htmlOptions);
     }
 }
Example #24
0
?>
		<?php 
echo TbHtml::error($model, 'widgetparams');
?>
		<p class="hint"><?php 
echo UserModule::t('JSON string (example: {example}).', array('{example}' => CJavaScript::jsonEncode(array('param1' => array('val1', 'val2'), 'param2' => array('k1' => 'v1', 'k2' => 'v2')))));
?>
</p>
	</div>

	<div class="row position">
		<?php 
echo TbHtml::activeLabelEx($model, 'position');
?>
		<?php 
echo TbHtml::activeTextField($model, 'position');
?>
		<?php 
echo TbHtml::error($model, 'position');
?>
		<p class="hint"><?php 
echo UserModule::t('Display order of fields.');
?>
</p>
	</div>

	<div class="row visible">
		<?php 
echo TbHtml::activeLabelEx($model, 'visible');
?>
		<?php