/** * Widget's run function */ public function run() { list($name, $id) = $this->resolveNameID(); if ($this->hasModel()) { if ($this->form) { echo $this->form->checkBox($this->model, $this->attribute, $this->htmlOptions); } else { echo CHtml::activeCheckBox($this->model, $this->attribute, $this->htmlOptions); } } else { echo CHtml::checkBox($name, $this->value, $this->htmlOptions); } $this->registerClientScript($id); }
public function run() { /* <div class="switch-toggle switch-3 switch-ios large-9 columns" data="<?php echo $checked->accepted ?>"> <input id="DataItem_<?php echo $genId ?>_accepted_0" name="DataItem[<?php echo $genId ?>][accepted]" type="radio" value="1" <?php echo $checked->accepted==1?'checked':''?> /> <label for="DataItem_<?php echo $genId ?>_accepted_0" onclick="">Yes</label> <input id="DataItem_<?php echo $genId ?>_accepted_1" name="DataItem[<?php echo $genId ?>][accepted]" type="radio" value="-1" <?php echo $checked->accepted==-1?'checked':''?> /> <label for="DataItem_<?php echo $genId ?>_accepted_1" onclick="">No</label> <input id="DataItem_<?php echo $genId ?>_accepted_2" name="DataItem[<?php echo $genId ?>][accepted]" type="radio" value="0" <?php echo $checked->accepted==0?'checked':''?> /> <label for="DataItem_<?php echo $genId ?>_accepted_2" onclick="">N/A</label> <a></a> </div> */ $cs = Yii::app()->getClientScript(); $assets = Yii::app()->getAssetManager()->publish(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets'); $cs->registerCssFile($assets . DIRECTORY_SEPARATOR . 'toggle-switch.css'); $cs->registerScriptFile($assets . DIRECTORY_SEPARATOR . 'script.js', CClientScript::POS_BEGIN); $nOfItems = count($this->data); if ($this->type == 'switch-toggle') { //You can add up to 5 items by using the .switch-3, .switch-4 and .switch-5 classes. echo CHtml::openTag('div', array('class' => 'switch-toggle switch-' . $nOfItems . ' ' . $this->scheme . ' columns')); foreach ($this->data as $key => $label) { $checked = $this->selected == $key; echo CHtml::radioButton($this->name, $checked, array('value' => $key, 'id' => $this->name . '_' . $key)); echo CHtml::label($label, $this->name . '_' . $key, array('onclick' => '')); } echo CHtml::tag('a', array(), '', true); echo CHtml::closeTag('div'); } if ($this->type == 'switch-light') { echo CHtml::openTag('label', array('class' => 'switch-light ' . $this->scheme, 'onclick' => '')); echo CHtml::checkBox(''); echo CHtml::openTag('span'); echo CHtml::tag('span', array(), 'Off'); echo CHtml::tag('span', array(), 'On'); echo CHtml::closeTag('span'); echo CHtml::tag('a', array(), '', true); echo CHtml::closeTag('label'); } }
public function formInput(&$controller, $tagOptions=array()) { ob_start(); $inputName = $this->formInputName(); $inputID = "i_{$inputName}"; echo CHtml::label($this->label, $inputID); echo CHtml::tag('br'); if($this->isReadonly) $tagOptions['disabled'] = true; $tagOptions['id'] = $inputID; if($this->value) { $tagOptions['value'] = 1; ?> <div> <?php echo Yii::t('AutoAdmin.form', '<span class="warning">Replace</span> password')?> (<?php echo Yii::t('AutoAdmin.form', 'set checkbox on for confirm')?>): <br/><label><?php echo CHtml::checkBox("{$inputName}[is_new]", null, $tagOptions)?> <?php echo Yii::t('AutoAdmin.common', 'Yes')?></label> </div> <?php echo CHtml::passwordField("{$inputName}[val]", '******', array('disabled'=>true)); } else { if(!empty($this->options['pattern'])) $tagOptions['pattern'] = $this->options['pattern']; if(isset($this->options['maxlength'])) $tagOptions['maxlength'] = $this->options['maxlength']; echo CHtml::passwordField("{$inputName}[val]", $this->value, $tagOptions); } return ob_get_clean(); }
public function run() { $output = '<div class="grid-view"> <table class="items"> <thead> <tr> <th>Menu</th> <th>View</th> <th>Create</th> <th>Update</th> <th>Delete</th> </tr> </thead> <tbody>'; $roles = Yii::app()->authManager->getRoles($this->user_id); $table = AdminAcl::getAllAclName(); $count = 0; foreach ($table as $key => $types) { $count++; if ($count % 2 == 1) { $output .= '<tr class="odd">'; } else { $output .= '<tr class="even">'; } $output .= '<td style="text-align:left;">' . $key . '</td>'; $output .= $this->appendRow(array_search('view', $types) !== false ? CHtml::checkBox($this->prefix . '[view_' . $key . ']', isset($roles['view_' . $key]), array('disabled' => $this->readonly)) : ''); $output .= $this->appendRow(array_search('create', $types) !== false ? CHtml::checkBox($this->prefix . '[create_' . $key . ']', isset($roles['create_' . $key]), array('disabled' => $this->readonly)) : ''); $output .= $this->appendRow(array_search('update', $types) !== false ? CHtml::checkBox($this->prefix . '[update_' . $key . ']', isset($roles['update_' . $key]), array('disabled' => $this->readonly)) : ''); $output .= $this->appendRow(array_search('delete', $types) !== false ? CHtml::checkBox($this->prefix . '[delete_' . $key . ']', isset($roles['delete_' . $key]), array('disabled' => $this->readonly)) : ''); $output .= '</tr>'; } $output .= '</tbody></table></div>'; echo $output; }
public function fileField($model, $attribute, $htmlOptions = array()) { $controlOptions = BsArray::popValue('controlOptions', $htmlOptions, array()); $labelOptions = BsArray::popValue('labelOptions', $htmlOptions, array()); $layout = $this->layout; $output = ''; $output .= CHtml::activeFileField($model, $attribute, $htmlOptions); $attr = $model->{$attribute}; if (!empty($attr)) { //Special logic for ContentTypes $tmpModel = $model; if ($model instanceof ContentType) { $tmpModel = $model->Content; } $output .= '<p class="file">' . CHtml::link($model->{$attribute}, array('/site/getFile', 'id' => $tmpModel->id, 'field' => $attribute, 'modelName' => get_class($tmpModel))) . '</p>'; $output .= '<div class="checkbox">' . CHtml::checkBox($attribute . '_delete'); $output .= CHtml::label('Delete?', $attribute . '_delete') . '</div>'; } $htmlOptions['input'] = $output; $htmlOptions['labelOptions'] = BsHtml::setLabelOptionsByLayout($layout, $labelOptions); if (!empty($layout)) { if ($layout === BsHtml::FORM_LAYOUT_HORIZONTAL) { $controlClass = BsArray::popValue('class', $controlOptions, BsHtml::$formLayoutHorizontalControlClass); BsHtml::addCssClass($controlClass, $htmlOptions['controlOptions']); } } return BsHTML::activeTextFieldControlGroup($model, $attribute, $htmlOptions); }
public function run() { //begin form echo CHtml::beginForm($this->action, $this->method, array('id' => $this->id, 'enctype' => $this->enctype, 'class' => $this->class)); foreach ($this->model as $item) { if ($this->selector) { echo CHtml::checkBox('selector_' . $item['key']); } $name = Awecms::generateFriendlyName($item["key"]); ?> <div class="settings row"> <?php echo $this->getlabel($item['key']); switch ($item['type']) { //add new types here case 'textfield': echo $this->getFullTextField($item); break; case 'boolean': echo CHtml::hiddenField($item['key'], 0); echo CHtml::checkBox($item['key'], $item['value']); break; case 'image_url': echo $this->getFullTextField($item); echo "<a class=\"right\" href=\"{$item["value"]}\" target=\"_blank\"><img src=\"{$item["value"]}\" title=\"{$name}\" alt=\"{$name}\" /></a>"; break; case 'email': echo $this->getFullTextField($item); break; case 'textarea': echo CHtml::textArea($item['key'], $item['value']); case 'NULL': break; default: echo "Unsupported type: " . $item['type'] . " of " . $item['key'] . " with value " . $item['value'] . "<br/>"; break; } if (isset($item['hint'])) { ?> <p class="hint"> <?php echo $item['hint']; ?> </p> <?php } ?> </div> <?php } ?> <div class="row buttons"> <?php echo CHtml::submitButton('Submit!'); ?> </div> <?php echo CHtml::endForm(); }
public function renderHeader() { echo CHtml::openTag('header', array('id' => 'header')); echo CHtml::openTag('div', array('class' => 'navbar navbar-fixed-top')); echo CHtml::openTag('div', array('class' => 'navbar-inner')); echo CHtml::openTag('a', array('class' => 'brand', 'style' => 'font-size:14px;margin-top:5px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;')); echo $this->model->getAttributeLabel('title'); echo CHtml::textField('title', $this->model->title, array('style' => 'margin-left:36px;margin-bottom:0px;')); echo CHtml::closeTag('a'); echo CHtml::openTag('a', array('class' => 'brand', 'style' => 'font-size:14px;margin-top:5px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;')); echo $this->model->getAttributeLabel('main_id') . ' '; $this->widget('core.widgets.TTreeDropdown', array('treeId' => 'main_id', 'data' => HelpCategory::getHelpTree(), 'options' => array('view' => array('showLine' => false, 'showIcon' => true)), 'defaultText' => $this->model->main->name ? $this->model->main->name : '未分类', 'selectNode' => $this->model->main_id ? $this->model->main_id : '')); echo CHtml::closeTag('a'); //置顶 echo CHtml::openTag('a', array('class' => 'brand', 'style' => 'font-size:14px;margin-top:5px;margin-right:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;')); echo CHtml::checkBox('top', $checked = $this->model->top ? true : false, array('style' => 'margin-left:36px;margin-bottom:0px;margin-right:0px')); echo CHtml::closeTag('a'); echo CHtml::openTag('a', array('class' => 'brand', 'style' => 'font-size:14px;margin-top:8px;margin-left:0px;margin-bottom:0px;padding-top:0px;padding-bottom:0px;')); echo $this->model->getAttributeLabel('top'); echo CHtml::closeTag('a'); $this->controller->widget('bootstrap.widgets.TbButton', array('label' => '关闭', 'type' => 'primary', 'htmlOptions' => array('class' => 'pull-right', 'style' => 'margin-left:6px;', 'id' => 'btnCancel'))); $this->controller->widget('bootstrap.widgets.TbButton', array('label' => '保存', 'type' => 'danger', 'htmlOptions' => array('style' => 'margin-left:6px;', 'class' => 'pull-right', 'id' => 'btnSave'))); $this->controller->widget('bootstrap.widgets.TbButton', array('label' => '预览', 'htmlOptions' => array('class' => 'pull-right', 'id' => 'btnPrev'))); echo CHtml::closeTag('div'); echo CHtml::closeTag('div'); echo CHtml::closeTag('header'); }
public function formInput(&$controller, $tagOptions=array()) { ob_start(); $inputName = $this->formInputName(); $inputID = "i_{$inputName}"; echo CHtml::label($this->label, $inputID); echo CHtml::tag('br'); if($this->isReadonly) $tagOptions['disabled'] = true; if($this->value) { $oldOptions = array('readonly'=>true); if($this->isReadonly) $tagOptions['disabled'] = true; echo CHtml::textField("{$inputName}[old]", $this->value, $oldOptions); unset($oldOptions['readonly']); ?> <label class="delfile"> <?php echo Yii::t('AutoAdmin.form', '<b class="warning">Delete</b> the file')?> <span class="tip">(<?php echo Yii::t('AutoAdmin.form', 'set checkbox on for confirm')?>)</span>: <?php echo CHtml::checkBox("{$inputName}[del]", false, $oldOptions);?> </label> <?php } $tagOptions['id'] = $inputID; echo CHtml::label(Yii::t('AutoAdmin.form', 'New file').':', $inputID); ?> <div class="tip inline"><a href=<?php echo $this->options['directoryPath']?>/</div> <?php echo CHtml::fileField(AutoAdmin::INPUT_PREFIX."[{$this->name}_new]", null, $tagOptions); return ob_get_clean(); }
/** * @param $attribute * @param null $value * @param null $name * @param array $htmlOptions * @return mixed|null|string */ public static function renderField($attribute, $value = null, $name = null, $htmlOptions = []) { $name = $name ?: 'Attribute[' . $attribute->id . ']'; switch ($attribute->type) { case Attribute::TYPE_SHORT_TEXT: return CHtml::textField($name, $value, $htmlOptions); break; case Attribute::TYPE_TEXT: return Yii::app()->getController()->widget(Yii::app()->getModule('store')->getVisualEditor(), ['name' => $name, 'value' => $value], true); break; case Attribute::TYPE_DROPDOWN: $data = CHtml::listData($attribute->options, 'id', 'value'); return CHtml::dropDownList($name, $value, $data, array_merge($htmlOptions, ['empty' => '---'])); break; case Attribute::TYPE_CHECKBOX_LIST: $data = CHtml::listData($attribute->options, 'id', 'value'); return CHtml::checkBoxList($name . '[]', $value, $data, $htmlOptions); break; case Attribute::TYPE_CHECKBOX: return CHtml::checkBox($name, $value, CMap::mergeArray(['uncheckValue' => 0], $htmlOptions)); break; case Attribute::TYPE_NUMBER: return CHtml::numberField($name, $value, $htmlOptions); break; case Attribute::TYPE_FILE: return CHtml::fileField($name . '[name]', null, $htmlOptions); break; } return null; }
public static function getViewActionMenuListItem($modelId) { if (Yii::app()->controller->action->getId() === 'view') { return array('name' => 'view', 'label' => Yii::t('app', 'View') . X2Html::minimizeButton(array('class' => 'record-view-type-menu-toggle'), '#record-view-type-menu', true, Yii::app()->params->profile->miscLayoutSettings['viewModeActionSubmenuOpen']), 'encodeLabel' => false, 'url' => array('view', 'id' => $modelId), 'linkOptions' => array('onClick' => '$(this).find ("i:visible").click ();'), 'itemOptions' => array('id' => 'view-record-action-menu-item'), 'submenuOptions' => array('id' => 'record-view-type-menu', 'style' => Yii::app()->params->profile->miscLayoutSettings['viewModeActionSubmenuOpen'] ? '' : 'display: none;'), 'items' => array(array('encodeLabel' => false, 'name' => 'journalView', 'label' => CHtml::checkBox('journalView', Yii::app()->params->profile->miscLayoutSettings['enableJournalView'], array('class' => 'journal-view-checkbox')) . CHtml::label(Yii::t('app', 'Journal View'), 'journalView')), array('encodeLabel' => false, 'name' => 'transactionalView', 'label' => CHtml::checkBox('transactionalView', Yii::app()->params->profile->miscLayoutSettings['enableTransactionalView'], array('class' => 'transactional-view-checkbox')) . CHtml::label(Yii::t('app', 'List View'), 'transactionalView')))); } else { return array('name' => 'view', 'label' => Yii::t('app', 'View'), 'encodeLabel' => true, 'url' => array('view', 'id' => $modelId)); } }
public static function getBattleCheckBox($name, $id, $container = 'div', $htmlOptions = array('class' => 'checkbox')) { if ($id === '') { return ''; } $checkBox = CHtml::checkBox('ids', isset($_COOKIE['battle_' . $id]), array('class' => 'battle-person', 'data-id' => $id, 'data-name' => $name)); $text = CHtml::tag('span', array(), Yii::t('common', 'Battle')); $label = CHtml::tag('label', array('class' => 'battle-label'), $checkBox . $text); return CHtml::tag($container, $htmlOptions, $label); }
public function renderCheckbox($name, array $metaData, $form = null) { $out = ''; $id = $name; $value = isset($metaData['current']) ? (bool) $metaData['current'] : false; if (isset($metaData['label'])) { $out .= CHtml::label($metaData['label'], $id); } $out .= CHtml::checkBox($id, $value, array('id' => $id, 'form' => $form, 'container' => 'div', 'separator' => '')); return $out; }
/** * Renders the input field */ public function renderField() { $options = $this->buildOptions(); echo \CHtml::openTag('div', $options); if ($this->hasModel()) { echo \CHtml::activeCheckBox($this->model, $this->attribute, $this->options); } else { echo \CHtml::checkBox($this->options['name'], $this->value, $this->options); } echo \CHtml::closeTag('div'); }
public function getField($widgetId, $rowGroupName = '', $rowIndex, $model, $attribute, $name, $value = '', $fieldClassName = '', $htmlOptions = array(), $hasError = false, $data = '', $params = '') { if ($hasError) { $fieldClassName = $fieldClassName . ' ' . CHtml::$errorCss; } $htmlOptions = ClonnableFields::addClass($htmlOptions, $fieldClassName); if (ClonnableFields::isModel($model)) { return CHtml::activeCheckBox($model, $attribute, $htmlOptions); } else { return CHtml::checkBox($name, (int) $value > 0, $htmlOptions); } }
public function renderInput($attr) { switch ($attr) { case 'password': echo CHtml::activePasswordField($this, $attr, $this->htmlOptions($attr)); echo CHtml::label(Yii::t('app', 'Visible?'), 'visible', array('style' => 'display: inline')); echo CHtml::checkBox('visible', false, array('id' => 'password-visible', 'onchange' => 'js: x2.credManager.swapPasswordVisibility("#Credentials_auth_password")')); break; default: parent::renderInput($attr); } }
protected function renderHeaderCellContent() { if ($this->selectableRows === null && $this->grid->selectableRows > 1) { echo CHtml::checkBox($this->id . '_all', false, array('class' => 'select-on-check-all')); } else { if ($this->selectableRows > 1) { echo trim($this->header) !== '' ? $this->header . ' ' . CHtml::checkBox($this->id . '_all', false) : $this->grid->blankDisplay; } else { parent::renderHeaderCellContent(); } } }
protected function renderHeaderCellContent() { if (trim($this->headerTemplate) === '') { echo $this->grid->blankDisplay; return; } $item = ''; if ($this->selectableRows === null && $this->grid->selectableRows > 1) { $item = CHtml::checkBox($this->id . '_all', false, array('class' => 'select-on-check-all dropdown-toggle', 'data-toggle' => 'dropdown')); } else { if ($this->selectableRows > 1) { $item = CHtml::checkBox($this->id . '_all', false); } else { ob_start(); parent::renderHeaderCellContent(); $item = ob_get_clean(); } } ?> <div class="dropdown"> <?php echo strtr($this->headerTemplate, array('{item}' => $item)); ?> <ul class="dropdown-menu" aria-labelledby="<?php echo $this->id; ?> _all" role="menu"> <li> <?php echo CHtml::link('<i class="icon-ok"></i> ' . Yii::t('EDataTables.edt', 'Select all'), '#', array('id' => "{$this->id}-select-all", 'class' => "dropdown-select-all")); ?> </li> <li> <?php echo CHtml::link('<i class="icon-remove"></i> ' . Yii::t('EDataTables.edt', 'Deselect all'), '#', array('id' => "{$this->id}-deselect-all", 'class' => 'dropdown-deselect-all')); ?> </li> <li class="divider"></li> <li> <?php echo CHtml::link('<i class="icon-ok"></i> ' . Yii::t('EDataTables.edt', 'Select on page'), '#', array('id' => "{$this->id}-select-page", 'class' => 'dropdown-select-page')); ?> </li> <li> <?php echo CHtml::link('<i class="icon-remove"></i> ' . Yii::t('EDataTables.edt', 'Deselect on page'), '#', array('id' => "{$this->id}-deselect-page", 'class' => 'dropdown-deselect-page')); ?> </li> </ul> </div> <?php }
public function renderRecursive($attribute_name, $parent_id = null) { echo CHtml::openTag('ul'); $nodes = $this->tree_model->findAllByAttributes(array($this->parent_attribute => $parent_id)); foreach ($nodes as $node) { echo CHtml::openTag('li'); echo CHtml::checkBox($attribute_name, '', array('style' => 'margin-right: 5px', 'value' => $node->id, 'class' => 'node')); echo $node->name; $this->renderRecursive($attribute_name, $node->id); echo CHtml::closeTag('li'); } echo CHtml::closeTag('ul'); }
public function formInput(&$controller, $tagOptions=array()) { ob_start(); $inputName = $this->formInputName(); $inputID = "i_{$inputName}"; echo CHtml::label($this->label, $inputID); echo CHtml::tag('br'); if($this->isReadonly) $tagOptions['disabled'] = true; $tagOptions['id'] = $inputID; echo CHtml::checkBox($inputName, (bool)(isset($this->value) ? $this->value : $this->defaultValue), $tagOptions); return ob_get_clean(); }
public function getField($widgetId, $rowGroupName = '', $rowIndex, $model, $attribute, $name, $value = '', $fieldClassName = '', $htmlOptions = array(), $hasError = false, $data = '', $params = '') { if ($hasError) { $fieldClassName = $fieldClassName . ' ' . CHtml::$errorCss; } $toggleButtonHtmlOptions = array('class' => 'toggle-button ' . $fieldClassName); $result = CHtml::openTag('div', $toggleButtonHtmlOptions); if (ClonnableFields::isModel($model)) { $result .= CHtml::activeCheckBox($model, $attribute, $htmlOptions); } else { $result .= CHtml::checkBox($name, $value, $htmlOptions); } $result .= CHtml::closeTag('div'); return $result; }
public function renderInput($attr) { switch ($attr) { case 'email': echo '<p class="fieldhelp-thin-small">' . Yii::t('app', '(example@gmail.com)') . '</p>'; echo CHtml::activeTextField($this, $attr, $this->htmlOptions($attr)); break; case 'password': echo CHtml::activePasswordField($this, $attr, $this->htmlOptions($attr)); echo CHtml::label(Yii::t('app', 'Visible?'), 'visible', array('style' => 'display: inline')); echo CHtml::checkBox('visible', false, array('id' => 'password-visible', 'onchange' => 'js: x2.credManager.swapPasswordVisibility("#Credentials_auth_password")')); break; default: parent::renderInput($attr); } }
/** * @see IExporter::getSettingsView() */ public function getSettingsView() { $r = ''; // Structure $r .= '<fieldset>'; $r .= CHtml::label(Yii::t('core', 'separateFieldsBy'), 'Export_settings_CsvExporter_fieldTerminator') . ' '; $r .= " " . CHtml::textField("Export[settings][CsvExporter][fieldTerminator]", $this->settings["fieldTerminator"]) . '<br />'; $r .= CHtml::label(Yii::t('core', 'encloseFieldsBy'), 'Export_settings_CsvExporter_fieldEncloseString') . ' '; $r .= " " . CHtml::textField("Export[settings][CsvExporter][fieldEncloseString]", $this->settings["fieldEncloseString"]) . '<br />'; $r .= CHtml::label(Yii::t('core', 'escapeFieldTextDelimiterWith'), 'Export_settings_CsvExporter_fieldEscapeString') . ' '; $r .= " " . CHtml::textField("Export[settings][CsvExporter][fieldEscapeString]", $this->settings["fieldEscapeString"]) . '<br />'; $r .= CHtml::checkBox('Export[settings][CsvExporter][fieldsFirstRow]', $this->settings['fieldsFirstRow']) . ' '; $r .= CHtml::label(Yii::t('core', 'fieldNamesInFirstRow'), 'Export_settings_CsvExporter_fieldsFirstRow') . '<br />'; $r .= CHtml::checkBox('Export[settings][CsvExporter][hexBlobs]', $this->settings['hexBlobs']) . ' '; $r .= CHtml::label(Yii::t('core', 'useHexForBlob'), 'Export_settings_SqlExporter_hexBlobs') . '<br />'; $r .= '</fieldset>'; return $r; }
/** * Renders the header cell content. * This method will render a checkbox in the header when {@link selectableRows} is greater than 1 * or in case {@link selectableRows} is null when {@link CGridView::selectableRows} is greater than 1. */ protected function renderHeaderCellContent() { if ($this->grid->json) { if (trim($this->headerTemplate) === '') { return $this->grid->blankDisplay; } if ($this->selectableRows === null && $this->grid->selectableRows > 1) { $item = CHtml::checkBox($this->id . '_all', false, array('class' => 'select-on-check-all')); } else { if ($this->selectableRows > 1) { $item = CHtml::checkBox($this->id . '_all', false); } else { ob_start(); parent::renderHeaderCellContent(); $item = ob_get_clean(); } } return strtr($this->headerTemplate, array('{item}' => $item)); } parent::renderHeaderCellContent(); }
<input type="checkbox" id="status-trigger"> </label> <div class="controls"> <?php $x = 0; ?> <table style="border-collapse: collapse;"> <tr> <?php foreach ($model->getStatusesList() as $key => $status) { ?> <td> <?php echo CHtml::checkBox('Deal[dea_status][' . $x . ']', in_array($key, (array) $model->dea_status), ['value' => $key, 'uncheckValue' => '', 'class' => 'status-checkbox attr-status']); ?> <label class="checkbox-enabler attr-status" for="Deal_dea_status_<?php echo $x; ?> " data-key="<?php echo $x; ?> "><?php echo $status; ?> </label> </td> <?php echo ++$x % 6 == 0 ? '</tr><tr>' : '';
</div> <?php } ?> <table class="dataGrid"> <?php if ($fields) { foreach ($fields as $field) { ?> <tr> <th class="label"><?php //echo CHtml::encode($field->TITLE); ?> </th> <th class="label"><?php echo CHtml::checkBox($field->TITLE); ?> </th> <td> <?php //echo (($model->{$field->VARNAME})?$model->{$field->VARNAME}:''); ?> </td> </tr> <?php } } ?> <tr> <th class="label"><?php echo CHtml::encode($model->getAttributeLabel('CREATED_BY'));
public function __toString() { $input = ""; if (is_string($this->field)) { return "[{$this->field}]"; } if (!isset($this->dateformat) || $this->dateformat == '') { $this->dateformat = 'dd/mm/yy'; } if (!in_array($this->field->uicomponent, array("textbox", "textarea", "listbox", "combobox", "checkbox", "datebox"))) { return "[invalid: " . $this->field->uicomponent . "]"; } if (!in_array($this->descriptionLocation, array('visible', 'title'))) { $this->descriptionLocation = 'title'; } $descrVisibleTag = ''; if ($this->descriptionLocation == 'visible') { $descrVisibleTag = "<div class='descr'>{$this->descr}</div>"; } if ($this->descriptionLocation == 'title') { if (!isset($this->htmlOptions['title'])) { $this->htmlOptions['title'] = CHtml::encode($this->descr); } } $name = $this->getName(); if ($this->getValue() == '') { $this->setValue(CHtml::encode($this->default)); } $value = $this->getValue(); $htmlOptions = array(); if (isset($this->htmlOptions)) { $htmlOptions += $this->htmlOptions; } if (isset($this->field->htmlOptions)) { $htmlOptions += $this->field->htmlOptions; } // clear empty attributes // if (isset($htmlOptions)) { foreach ($htmlOptions as $opt => $val) { if (empty($val)) { unset($htmlOptions[$opt]); } } } // // IMPORTANT: // every input field must have 'alt' signature stablished to 'input' or it wont be recognized // by eyuiform.js when post. if (!isset($htmlOptions['alt'])) { $htmlOptions['alt'] = 'input'; } $inputName = $this->modelName . "[" . $name . "]"; $htmlOptions['id'] = $this->getName(); $req = $this->required == true ? '*' : ''; $reqClass = $this->required == true ? 'required' : ''; if ($this->field->uicomponent == 'textbox') { $input = CHtml::textField($inputName, $value, $htmlOptions); } if ($this->field->uicomponent == 'textarea') { $input = CHtml::textArea($inputName, $value, $htmlOptions); } if ($this->field->uicomponent == 'listbox') { $input = CHtml::listBox($inputName, $value, $this->checkOptions($this->field->options), $htmlOptions); } if ($this->field->uicomponent == 'combobox') { $prompt = array(); if ($this->field->prompt != null) { $prompt = $this->field->prompt; } $input = CHtml::dropDownList($inputName, $value, $prompt + $this->checkOptions($this->field->options), $htmlOptions); } if ($this->field->uicomponent == 'checkbox') { if (!isset($htmlOptions['class'])) { $htmlOptions['class'] = 'checkbox'; } $input = CHtml::checkBox($inputName, $this->getValue() > 0, $htmlOptions); } if ($this->field->uicomponent == 'datebox') { $id = $this->getName(); $language = Yii::app()->language; $dp_options = CJavaScript::encode(array('constrainInput' => true, 'dateFormat' => $this->dateformat, 'showOn' => "both", 'showButtonPanel' => true, 'changeMonth' => true, 'changeYear' => true)); if ($language == 'en' || $language == "" || $language == 'en-US' || $language == 'en_us') { $language = 'en-GB'; } $js = "jQuery('#{$id}').datepicker(jQuery.extend({showMonthAfterYear:false}, jQuery.datepicker.regional['{$language}'], {$dp_options}));"; $input = CHtml::textField($inputName, $value, $htmlOptions); Yii::app()->getClientScript()->registerScript(__CLASS__ . '#' . $id, $js); } if ($this->field->uicomponent == 'checkboxlist') { /* $input = "<div class='checkboxes'>"; foreach($this->field->options as $_key=>$_val){ $_id = $this->id."_".$_key; $input .= "<span class='checkbox'><label for='{$_id}'>{$_val}</label>".CHtml::checkBox( $name,false,array('id'=>$_id))."</span>"; } $input .= "</div>"; */ } return "\n<li class='{$reqClass}'>\n\t<label>{$req}{$this->label}:</label><br/>\n\t<span class='fieldspan'>{$input}</span><span class='loader'></span>\n\t<div class='info'>\n\t\t{$descrVisibleTag}\n\t\t<div class='error'></div>\n\t</div>\n</li>\n"; }
if ($file->operation === CCodeFile::OP_OVERWRITE) { ?> (<?php echo CHtml::link('diff', array('diff', 'id' => $i), array('class' => 'view-code', 'rel' => $file->path)); ?> ) <?php } ?> </td> <td class="confirm"> <?php if ($file->operation === CCodeFile::OP_SKIP) { echo 'unchanged'; } else { $key = md5($file->path); echo CHtml::label($file->operation, "answers_{$key}") . ' ' . CHtml::checkBox("answers[{$key}]", $model->confirmed($file)); } ?> </td> </tr> <?php } ?> </table> <?php } ?> </div> <?php }
/** * Renders the data cell content. * This method renders a checkbox in the data cell. * @param integer the row number (zero-based) * @param mixed the data associated with the row */ protected function renderDataCellContent($row, $data) { if ($this->value !== null) { $value = $this->evaluateExpression($this->value, array('data' => $data, 'row' => $row)); } else { if ($this->name !== null) { $value = CHtml::value($data, $this->name); } else { $value = $this->grid->dataProvider->keys[$row]; } } $checked = false; if ($this->checked !== null) { $checked = $this->evaluateExpression($this->checked, array('data' => $data, 'row' => $row)); } $options = $this->checkBoxHtmlOptions; $options['value'] = $value; $options['id'] = $this->id . '_' . $row; echo CHtml::checkBox($this->id . '[]', $checked, $options); }
public function run() { // here render procedures echo CHtml::beginForm($this->action, $this->method, array('id' => $this->id, 'enctype' => $this->enctype, 'target' => $this->target)); // you better create a function but // for the sake of the example... foreach ($this->attributes as $attr) { // here we can actually say i // this is very simple but you get the idea echo CHtml::label($attr['label'], $attr['name']); if ($attr['type'] == 'text') { echo CHtml::textField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'textarea') { echo CHtml::textArea($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'password') { echo CHtml::passwordField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'checkbox') { echo CHtml::checkBox($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'checkboxlist') { echo CHtml::checkBoxList($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'date') { echo CHtml::dateField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['htmlOptions']); } else { if ($attr['type'] == 'dropdownlist') { echo CHtml::dropDownList($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'file') { echo CHtml::fileField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'hidden') { echo CHtml::hiddenField($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'radio') { echo CHtml::radioButton($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['items'], $attr['htmlOptions']); } else { if ($attr['type'] == 'radiolist') { echo CHtml::radioButtonList($this->model_name . '[' . $this->category . ']' . '[' . $attr['name'] . ']', $attr['value'], $attr['items'], $attr['htmlOptions']); } } } } } } } } } } } // do more here } echo "<br/><br/><div class='row-fluid'>"; echo CHtml::submitButton($this->submit['label'], $this->submit['options']); echo "</div>"; echo CHtml::endForm(); }
/** * @see IExporter::getSettingsView() */ public function getSettingsView() { $r = ''; // Structure $r .= '<fieldset>'; $r .= '<legend>' . CHtml::checkBox('Export[settings][SqlExporter][exportStructure]', $this->settings['exportStructure']) . ' ' . CHtml::label(Yii::t('core', 'exportStructure'), 'Export_settings_SqlExporter_exportStructure') . '</legend>'; $r .= CHtml::checkBox('Export[settings][SqlExporter][addDropObject]', $this->settings['addDropObject']) . ' ' . CHtml::label(Yii::t('core', 'addDropObject'), 'Export_settings_SqlExporter_addDropObject') . '<br />' . CHtml::checkBox('Export[settings][SqlExporter][addIfNotExists]', $this->settings['addIfNotExists']) . ' ' . CHtml::label(Yii::t('core', 'addIfNotExists'), 'Export_settings_SqlExporter_addIfNotExists'); $r .= '</fieldset>'; // Data $r .= '<fieldset>'; $r .= '<legend>' . CHtml::checkBox('Export[settings][SqlExporter][exportData]', $this->settings['exportData']) . ' ' . CHtml::label(Yii::t('core', 'exportData'), 'Export_settings_SqlExporter_exportData') . '</legend>'; $r .= CHtml::label(Yii::t('core', 'command'), 'Export_settings_SqlExporter_insertCommand') . ': ' . CHtml::radioButtonList('Export[settings][SqlExporter][insertCommand]', $this->settings['insertCommand'], array('INSERT' => 'INSERT', 'REPLACE' => 'REPLACE'), array('separator' => ' ')) . '<br />' . CHtml::label(Yii::t('core', 'rowsPerInsert'), 'Export_settings_SqlExporter_rowsPerInsert') . ': ' . CHtml::textField('Export[settings][SqlExporter][rowsPerInsert]', $this->settings['rowsPerInsert']) . '<br />' . CHtml::checkBox('Export[settings][SqlExporter][completeInserts]', $this->settings['completeInserts']) . ' ' . CHtml::label(Yii::t('core', 'useCompleteInserts'), 'Export_settings_SqlExporter_completeInserts') . '<br />' . CHtml::checkBox('Export[settings][SqlExporter][ignoreInserts]', $this->settings['ignoreInserts']) . ' ' . CHtml::label(Yii::t('core', 'useInsertIgnore'), 'Export_settings_SqlExporter_ignoreInserts') . '<br />' . CHtml::checkBox('Export[settings][SqlExporter][delayedInserts]', $this->settings['delayedInserts']) . ' ' . CHtml::label(Yii::t('core', 'useDelayedInserts'), 'Export_settings_SqlExporter_delayedInserts') . '<br />' . CHtml::checkBox('Export[settings][SqlExporter][hexBlobs]', $this->settings['hexBlobs']) . ' ' . CHtml::label(Yii::t('core', 'useHexForBlob'), 'Export_settings_SqlExporter_hexBlobs') . '<br />'; $r .= '</fieldset>'; return $r; }