private static function field($key, $value, $sModel, $model) { if (strpos($sModel, "listT(") === 0) { $modelName = str_replace("listT(", "", $sModel); $modelName = str_replace(")", "", $modelName); $type = substr($modelName, strpos($modelName, '[') + 1, strpos($modelName, '[') - strpos($modelName, ']') + 1); //echo $type; //exit; $modelName = str_replace("[" . $type . "]", "", $modelName); $temp = CHtml::listData($modelName::model()->findAllByType($type), 'id', 'name'); $temp[''] = Yii::t('app', 'None'); //$label = Yii::t('app', $sModel->id) ; $field = CHtml::dropDownList($model . '[' . $key . '][value]', $value, $temp) . "<br/>"; } elseif (strpos($sModel, "list(") === 0) { $modelName = str_replace("list(", "", $sModel); $modelName = str_replace(")", "", $modelName); $temp = CHtml::listData($modelName::model()->findAll(), 'id', 'name'); $temp[''] = Yii::t('app', 'None'); //$label = Yii::t('app', $sModel->id) ; $field = CHtml::dropDownList($model . '[' . $key . '][value]', $value, $temp) . "<br/>"; } elseif (strpos($sModel, "select(") === 0) { $list = str_replace("select(", "", $sModel); $list = CJSON::decode(str_replace(")", "", $list)); foreach ($list as &$item) { //print $item; $item = Yii::t('app', $item); } //$temp = CHtml::listData(CJSON::decode($list), 'id', 'name'); $temp[''] = Yii::t('app', 'None'); //$label = Yii::t('app', $sModel->id); $field = CHtml::dropDownList($model . '[' . $key . '][value]', $value, $list) . "<br/>"; } elseif ($sModel == 'file') { //$label = Yii::t('app', $sModel->id) ; $field = CHtml::fileField($model . '[' . $key . '][value]', $value) . CHtml::hiddenField($model . '[' . $key . '][value]', $value) . "<a href='javascript:del();'>" . Yii::t('app', 'Delete') . "</a><br />"; } elseif ($sModel == 'boolean') { //$label = Yii::t('app', $sModel->id); $field = CHtml::hiddenField($model . '[' . $key . '][value]', false) . CHtml::checkbox($model . '[' . $key . '][value]', $value == 'true' ? true : false); } elseif ($sModel == 'date') { //$label = Yii::t('app', $sModel->id); $field = CHtml::textField($model . '[' . $key . '][value]', $value, array('class' => 'date')); $name = str_replace("[", "_", str_replace("]", "_", $model)); $field .= "<script>\njQuery('#{$name}{$key}_value').datepicker();</script>"; } else { //$label = Yii::t('app', $sModel->id); $field = CHtml::textField($model . '[' . $key . '][value]', $value); } return $field; }
/** * @desc render RBAC Item in context "Move" * @param array $item * @return string rendered RBAC Item */ public function renderItemAssign($child) { $colUsername = $this->colUsername; $colUserid = $this->colUserid; if (!$this->_user) { throw new CHttpException("RBACDisplayHelper::_user is not set. Use setUser(object \$user)"); } $urlPrefix = 'index.php?r='; $item = $child['this']; $out = "\n"; $types = $this->types; // Manage Tree Header $out .= ' <table id="rbacItem" ><tr> <th width="10%" id="rbacItem' . $item->type . '" >' . $this->_displayName($child['this-name'], $item->type) . '</th>' . '<th width="5%" id="rbacItem" ><b>Type</b></th>' . '<th width="20%" id="rbacItem" ><b>Description</b></th>' . '<th width="20%" id="rbacItem" ><b>Buisness Rule</b></th>' . '<th width="5%" id="rbacItem" ><b>Data</b></th> </tr> '; $isAssigned = AuthAssignment::userIsAssigned($this->_user->{$colUserid}, $child['this-name']); $checkBoxName = $isAssigned ? 'removeAssignments[]' : 'addAssignments[]'; $out .= ' <tr> <td id="rbacItem" >' . CHtml::checkbox($checkBoxName, false, array('value' => $child['this-name'])) . ' ' . ($isAssigned ? '<span style="color:#ff0000">Eject</span>' : 'Assign') . '</td>' . '<td id="rbacItem" >' . $types[$item->type] . '</td>' . '<td id="rbacItem" >' . nl2br(CHtml::encode($item->description)) . '</td>' . '<td id="rbacItem" >' . nl2br(CHtml::encode($item->bizrule)) . '</td>' . '<td id="rbacItem" >' . nl2br(CHtml::encode($item->data)) . '</td></tr></table>'; return $out; }
</div> <br> <div class="exportOption"> <?php if (Yii::app()->params->isAdmin) { echo CHtml::label(Yii::t('admin', 'Include Hidden Records?'), 'includeHidden'); echo CHtml::checkbox('includeHidden', false); echo X2Html::hint2(Yii::t('admin', 'Include records that were hidden by the duplicate checker.')); } ?> </div> <div class="exportOption"> <?php echo CHtml::label(Yii::t('admin', 'Include Tags?'), 'includeTags'); echo CHtml::checkbox('includeTags', false); ?> </div> <?php echo CHtml::button(Yii::t('app', 'Export'), array('class' => 'x2-button', 'id' => 'export-button')); ?> <div id="status-text"> </div> <div style="display:none" id="download-link-box"> <?php echo Yii::t('admin', 'Please click the link below to download {model}.', array('{model}' => $model)); ?>
public function generateColumnSelectorHtml() { $this->columnSelectorHtml = CHtml::beginForm(array('/site/saveGvSettings'), 'get') . '<ul class="column-selector x2-dropdown-list' . ($this->fixedHeader ? ' fixed-header' : '') . '" id="' . $this->columnSelectorId . '">'; $i = 0; foreach ($this->allFieldNames as $fieldName => &$attributeLabel) { $i++; $selected = array_key_exists($fieldName, $this->gvSettings); $this->columnSelectorHtml .= "<li>" . CHtml::checkbox($this->namespacePrefix . 'columns[]', $selected, array('value' => $fieldName, 'id' => $this->namespacePrefix . 'checkbox-' . $i)) . CHtml::label($attributeLabel, $fieldName . '_checkbox') . "</li>"; } $this->columnSelectorHtml .= '</ul></form>'; }
/** * (non-PHPdoc) * @see framework/CWidget::run() */ public function run() { $cs = Yii::app()->getClientScript(); list($name, $id) = $this->resolveNameID(); if (isset($this->htmlOptions['id'])) { $id = $this->htmlOptions['id']; } else { $this->htmlOptions['id'] = $id; } if (isset($this->htmlOptions['name'])) { $name = $this->htmlOptions['name']; } else { $this->htmlOptions['name'] = $name; } if ($this->buttonType == 'buttonset') { echo CHtml::closeTag($this->htmlTag); $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').buttonset();"); } else { switch ($this->buttonType) { case 'submit': echo CHtml::submitButton($this->caption, $this->htmlOptions) . "\n"; break; case 'button': echo CHtml::htmlButton($this->caption, $this->htmlOptions) . "\n"; break; case 'link': echo CHtml::link($this->caption, $this->url, $this->htmlOptions) . "\n"; break; case 'radio': if ($this->hasModel()) { echo CHtml::activeRadioButton($this->model, $this->attribute, $this->htmlOptions); echo CHtml::label($this->caption, CHtml::activeId($this->model, $this->attribute)) . "\n"; } else { echo CHtml::radioButton($name, $this->value, $this->htmlOptions); echo CHtml::label($this->caption, $id) . "\n"; } break; case 'checkbox': if ($this->hasModel()) { echo CHtml::activeCheckbox($this->model, $this->attribute, $this->htmlOptions); echo CHtml::label($this->caption, CHtml::activeId($this->model, $this->attribute)) . "\n"; } else { echo CHtml::checkbox($name, $this->value, $this->htmlOptions); echo CHtml::label($this->caption, $id) . "\n"; } break; default: throw new CException(Yii::t('zii', 'The button type "{type}" is not supported.', array('{type}' => $this->buttonType))); } $options = empty($this->options) ? '' : CJavaScript::encode($this->options); if (isset($this->onclick)) { if (strpos($this->onclick, 'js:') !== 0) { $this->onclick = 'js:' . $this->onclick; } $click = CJavaScript::encode($this->onclick); $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').button({$options}).click({$click});"); } else { $cs->registerScript(__CLASS__ . '#' . $id, "jQuery('#{$id}').button({$options});"); } } }
<tr> <th colspan=2> <label for='attvisible' id='attvisible'> <?php $clang->eT('Attribute visible:'); ?> </label> </th> </tr> <tr> <td class='data'> <?php if ($attributes['visible'] == "TRUE") { echo CHtml::checkbox('visible', TRUE, array('value' => 'TRUE', 'uncheckValue' => 'FALSE')); } else { echo CHtml::checkbox('visible', FALSE, array('value' => 'TRUE', 'uncheckValue' => 'FALSE')); } ?> </td> <td class='actions'> </td> </tr> </table> <table width='400' id='ddtable' class='hovertable' style='display: none'> <tr> <th colspan='2'><?php $clang->eT('Values:'); ?> </th> </tr> <?php
/** * Echos or returns the file field, temp name hidden field, the delete checkbox and preview image and set up the uploadcare widget if used. * * @param CActiveForm $form the form in which the widget is called. Can be null if CActiveForm is not used. Defaults to null in parent class. * * @param boolean $return whether to return the html or just echo it. Defaults to false in parent class. * * @param string $attributePostName the fields name if non standard. Such as if using array notation. The format is [key1][key2][keyn...]attributeName, no class name. Defaults to null in parent class. * * @param array $fileFieldHtmlOptions html options for file field. Defaults to empty array in parent class. * * @param array $checkboxHtmlOptions html options for checkbox field. Defaults to empty array in parent class. * * @param array $previewImageHtmlOptions html options for preview image. Defaults to empty array in parent class. * * @return string the html. */ public function makeField($form, $attributePostName, $fileFieldHtmlOptions, $checkboxHtmlOptions, $previewImageHtmlOptions) { $behavior = $this->_behavior; $owner = $behavior->owner; $attribute = $behavior->attribute; $ownerClass = get_class($owner); $html = ''; if (isset($attributePostName)) { $postAttributeArrays = substr($attributePostName, 0, strrpos($attributePostName, ']') + 1); } else { $postAttributeArrays = ''; } foreach ($owner->behaviors() as $ownerBehaviorName => $ownerBehaviorParams) { if (($ownerBehaviorParams['class'] == 'application.components.behaviors.UploadingBehavior.ActiveRecordUploadingBehavior' || $ownerBehaviorParams['class'] == 'application.components.behaviors.UploadingBehavior.ModelUploadingBehavior') && $ownerBehaviorParams['attribute'] == $behavior->attribute) { $behaviorName = $ownerBehaviorName; break; } } $html .= '<div class="uploadFieldWrap">'; if ($owner->{$attribute} != '') { if ($behavior->showPreviewImage) { $html .= CHtml::image(Yii::app()->request->baseUrl . '/' . ($owner->{$behaviorName}->tempName != '' ? $owner->{$behaviorName}->tempDir . '/' . $this->fileSuffix($owner->{$behaviorName}->tempName, $behavior->previewImageSuffix) : $owner->{$behaviorName}->dir . '/' . $this->fileSuffix($owner->{$attribute}, $behavior->previewImageSuffix)), '', $previewImageHtmlOptions); } if ($behavior->allowDelete) { $html .= CHtml::checkbox($ownerClass . $postAttributeArrays . '[' . $behaviorName . '][delete]', $behavior->delete, $checkboxHtmlOptions) . '<span>' . Yii::t('admin', 'Supprimer ou') . ' </span>'; } $html .= CHtml::hiddenField($ownerClass . $postAttributeArrays . '[' . $behaviorName . '][tempName]', $behavior->tempName); } if ($behavior->uploadcare !== null) { Yii::app()->clientScript->registerScript('UploadingBehaviorUploadCarePublicKey', "UPLOADCARE_PUBLIC_KEY = '" . $this->_uploadcareApi->getPublicKey() . "'; UPLOADCARE_LOCALE = '" . (isset($behavior->uploadcare['language']) ? $behavior->uploadcare['language'] : Yii::app()->language) . "';", CClientScript::POS_HEAD); Yii::app()->clientScript->registerScriptFile($this->_uploadcareApi->widget->getScriptSrc(), CClientScript::POS_HEAD); $options = array('role' => 'uploadcare-uploader'); $uploadcareArr = $behavior->uploadcare; unset($uploadcareArr['publicKey']); unset($uploadcareArr['privateKey']); unset($uploadcareArr['language']); $options = array_merge($options, $uploadcareArr); if (!isset($options['data-images-only']) && isset($behavior->formats)) { $options['data-images-only'] = 'true'; } if (!isset($options['data-crop']) && isset($behavior->formats)) { $options['data-crop'] = 'true'; } $html .= CHtml::hiddenField($ownerClass . $postAttributeArrays . '[' . $attribute . ']', '', $options); } else { if ($form !== null) { $html .= $form->fileField($owner, $postAttributeArrays . $attribute, $fileFieldHtmlOptions); } else { $html .= CHtml::activeFileField($owner, $postAttributeArrays . $attribute, $fileFieldHtmlOptions); } } $html .= '</div>'; return $html; }
<?php if (CCaptcha::checkRequirements()) { ?> <div class="row captcha"> <div class="large-6 columns"> <?php $this->widget('CCaptcha'); ?> <p>Please enter the letters as they are shown in the image above. Letters are not case-sensitive.</p> </div> <div class="large-6 columns"> <?php echo CHtml::label('Subscribe to our mailing list', 'register'); ?> <?php echo CHtml::checkbox('register', CHtml::value($_POST, 'register', true)); ?> </div> </div> <div class="row"> <div class="large-6 columns"> <?php echo $form->labelEx($model, 'verify_code'); ?> <?php echo $form->textField($model, 'verify_code'); ?> <?php echo $form->error($model, 'verify_code'); ?> </div>
/** * Parse each setting */ public function buildFormField($field, $userId) { $name = 'UserCustomField[' . $field->getKey() . ']'; $value = UserCustomFieldData::model()->getFieldValue($field, $userId); switch ($field->type) { case 'textarea': echo CHtml::textArea($name, $value, array('rows' => 5, 'class' => 'textbox')); break; case 'dropdown': echo CHtml::dropDownList($name, $value, $this->convertExtraToArray($field->extra), array('class' => 'chosen')); break; case 'multi': echo CHtml::listBox($name, $value ? explode(',', $value) : '', $this->convertExtraToArray($field->extra), array('multiple' => 'multiple', 'class' => 'chosen')); break; case 'checkbox': echo CHtml::checkbox($name, $value, array('class' => '')); break; case 'yesno': echo CHtml::dropDownList($name, $value, array('0' => Yii::t('global', 'No'), '1' => Yii::t('global', 'Yes')), array('class' => 'chosen')); break; case 'editor': Yii::app()->customEditor->getEditor(array('name' => $name, 'value' => $value)); break; case 'text': default: echo CHtml::textField($name, $value, array('class' => 'textbox')); break; } }
<div class="corners"> <?php echo CHtml::textField('searchField', '', array('autocomplete' => 'off')); ?> <img src="css/images/magnifier.png" alt="Search" onclick="jQuery('#search-form').submit();"></div> <ul id="search"> <li> <input id="cbxAll" type="checkbox" name="GlobalSearchForm[all]" value="1"> <?php echo ECHtml::label(Yii::t('modules', 'all'), 'cbxAll'); ?> </li> <?php foreach ($this->getModulesToSearch() as $module) { ?> <li> <?php echo CHtml::checkbox('GlobalSearchForm[' . $module->module_name . ']', false); echo CHtml::label(Yii::t('modules', $module->module_name), 'GlobalSearchForm_' . $module->module_name); ?> </li> <?php } ?> </ul> </li> </ul> <?php $this->endWidget(); ?> </div>
/** * Parse each setting */ public function getSettingForm($setting) { $setting = $this->parseSetting($setting); $name = 'setting_' . $setting->id; $value = $setting->value !== null ? $setting->value : $setting->default_value; switch ($setting->type) { case 'textarea': echo CHtml::textArea($name, $value, array('rows' => 5, 'class' => 'textbox', 'disabled' => $setting->disabled ? 'disabled' : '')); break; case 'dropdown': echo CHtml::dropDownList($name, $value, $this->convertExtraToArray($setting->extra), array('class' => 'chzn-select', 'disabled' => $setting->disabled ? 'disabled' : '')); break; case 'multi': echo CHtml::listBox($name, $value ? explode(',', $value) : '', $this->convertExtraToArray($setting->extra), array('size' => 20, 'multiple' => 'multiple', 'class' => 'chosen', 'disabled' => $setting->disabled ? 'disabled' : '')); break; case 'checkbox': echo CHtml::checkbox($name, $setting->value != '' ? $setting->value : $setting->default_value, array('class' => '', 'disabled' => $setting->disabled ? 'disabled' : '')); break; case 'yesno': echo CHtml::dropDownList($name, $value, array('0' => Yii::t('global', 'No'), '1' => Yii::t('global', 'Yes')), array('class' => 'chzn-select', 'disabled' => $setting->disabled ? 'disabled' : '')); break; case 'editor': Yii::app()->customEditor->getEditor(array('name' => $name, 'value' => $value)); break; case 'text': default: echo CHtml::textField($name, $value, array('class' => 'textbox', 'disabled' => $setting->disabled ? 'disabled' : '')); break; } }
?> </div> <div class="cell"> <?php echo CHtml::label(Yii::t('admin', 'Default View'), 'defaultView'); ?> <?php echo CHtml::checkbox('defaultView', $defaultView); ?> </div> <div class="cell"> <?php echo CHtml::label(Yii::t('admin', 'Default Form'), 'defaultForm'); ?> <?php echo CHtml::checkbox('defaultForm', $defaultForm); ?> </div> <div class="cell right" style="padding-top:11px;"> <?php echo CHtml::button(Yii::t('admin', 'Preview Mode'), array('id' => 'borderToggleButton', 'class' => 'x2-button right')); ?> <?php echo CHtml::submitButton(Yii::t('admin', 'Save'), array('class' => 'x2-button highlight right', 'style' => 'margin-right:5px;', 'id' => 'saveButton')); ?> </div> <?php } ?> </div> </div>
<div class="section"> <h3 class="uk-h3"><?php echo Yii::t("default", "Ingredients"); ?> </h3> <?php foreach ($data['ingredients'] as $val) { ?> <?php $item_data['ingredients_id'] = isset($item_data['ingredients_id']) ? $item_data['ingredients_id'] : ''; ?> <li> <div class="price" id="price_wrap"> <span class="size"> <?php echo CHtml::checkbox('ingredients[]', in_array($val, (array) $item_data['ingredients']) ? true : false, array('value' => $val)); ?> <?php echo $val; ?> </span> </div> </li> <?php } ?> <div class="clear"></div> </div> <?php }
<div class="control-group"> <label for="form-field-1" class="control-label">Date</label> <div class="controls"> <?php $this->widget('zii.widgets.jui.CJuiDatePicker', array('name' => 'report_date', 'language' => strstr(Yii::app()->language . '_', '_', true), 'htmlOptions' => array('size' => 10), 'value' => $report_date, 'options' => array('showButtonPanel' => true, 'changeYear' => true, 'dateFormat' => 'yy.mm.dd'))); ?> </div> </div> <div class="control-group"> <label for="form-field-1" class="control-label">Excelis</label> <div class="controls"> <?php echo CHtml::checkbox('excel', false, array('id' => 'excel', 'class' => 'checkbox_class')); ?> </div> </div> <div class="form-actions"> <?php $this->widget("bootstrap.widgets.TbButton", array("label" => 'Create report', "icon" => "icon-ok bigger-110", "type" => "primary", "htmlOptions" => array("onclick" => "\$('#report-form').submit();"))); ?> </div> <?php $this->endWidget(); ?> </div>
<?php echo '<div style="width:600px;">'; ?> <?php echo Yii::t('admin', 'Please click the button below to begin the export. Do not close this page until the export is finished, which may take some time if you have a large number of records. A counter will keep you updated on how many records have been successfully updated.'); ?> <br><br> <?php echo isset($listName) ? Yii::t('admin', 'You are currently exporting: ') . "<b>{$listName}</b>" : ''; ?> </div> <br> <?php if (is_null($listId)) { echo CHtml::label(Yii::t('admin', 'Include Hidden Records?'), 'includeHidden'); echo CHtml::checkbox('includeHidden', false); } ?> <?php echo CHtml::button(Yii::t('app', 'Export'), array('class' => 'x2-button', 'id' => 'export-button')); ?> <div id="status-text" style="color:green"> </div> <div style="display:none" id="download-link-box"> <?php echo Yii::t('admin', 'Please click the link below to download {model}.', array('{model}' => $model)); ?> <br><br> <a class="x2-button" id="download-link" href="#"><?php
?> </li> <li><label for="atttype"><?php eT('Attribute type:'); ?> </label> <?php echo CHtml::dropDownList('attribute_type', $attributes['attribute_type'], array('TB' => 'Text box', 'DD' => 'Drop-down list', 'DP' => 'Date')); ?> </li> <li><label for='attvisible' id='attvisible'><?php eT('Attribute visible:'); ?> </label> <?php echo CHtml::checkbox('visible', $attributes['visible'] == "TRUE", array('value' => 'TRUE', 'uncheckValue' => 'FALSE')); ?> </li> </ul> <div id='ddtable' style='display: none'> <table class='hovertable'> <tr> <th colspan='2'><?php eT('Values:'); ?> </th> </tr> <?php foreach ($attributevalues as $row => $value) { ?>
* these Appropriate Legal Notices must retain the display of the "Powered by * X2Engine" logo. If the display of the logo is not reasonably feasible for * technical reasons, the Appropriate Legal Notices must display the words * "Powered by X2Engine". *****************************************************************************************/ Yii::app()->clientScript->registerCss('exportFormatCss', ' .compressOutput label { display: inline !important; } '); ?> <div class="compressOutput exportOption"> <?php echo CHtml::label(Yii::t('admin', 'Compress Output?'), 'compressOutput'); echo CHtml::checkbox('compressOutput', false); ?> </div> <br /> <?php Yii::app()->clientScript->registerScript('exportFormatControls', ' if (typeof x2 === "undefined") x2 = {}; if (typeof x2.exportFormats === "undefined") x2.exportFormats = {}; // Build a parameter string of the format controls for the selected type x2.exportFormats.readExportFormatOptions = function() { var type = $("#targetType").children (":checked").val();
<div class="gThTitle"> <?php echo $item['title']; ?> </div> <?php } ?> <div class="fbitem_tools"> <div class="checkbox_delete ttp" title="<?php echo $this->tr('checkToDelete'); ?> "> <?php echo CHtml::checkbox(uniqid('check_'), false, array('class' => 'checked_img', 'data-filename' => $item['fileName'])); ?> </div> <div class="deleteIcon ttp" title="<?php echo $this->tr('clickDelete'); ?> "></div> <div class="coverIcon <?php echo $coverClass; ?> ttp" title="<?php echo $this->tr('setCover'); ?> "></div> <div id="<?php echo uniqid($this->idPrefix);
?> </label> <div class='col-sm-4'> <?php echo CHtml::textField('maxremindercount'); ?> </div> </div> <div class='form-group'> <?php echo CHtml::label(gT("Bypass date control before sending email."), 'bypassdatecontrol', array('title' => gt("If some tokens have a 'valid from' date set which is in the future, they will not be able to access the survey before that 'valid from' date."), 'unescaped', 'class' => 'control-label col-sm-2')); ?> <div class='col-sm-1'> <?php echo CHtml::checkbox('bypassdatecontrol', false); ?> </div> <div class='col-sm-9'></div> </div> <div class='form-group'> <div class='col-sm-2'></div> <div class='col-sm-1'> <?php echo CHtml::submitButton(gT("Send Reminders"), array('class' => 'btn btn-default')); ?> </div> <?php echo CHtml::hiddenField('ok', 'absolutely');
?> <div class="clear"></div> </td> </tr> </tfoot> <tbody> <?php if (count($members)) { ?> <?php foreach ($members as $row) { ?> <tr> <td><?php echo CHtml::checkbox('user[' . $row->id . ']'); ?> </td> <td><?php $this->widget('application.extensions.VGGravatarWidget', array('email' => $row->email, 'size' => 20)); ?> </td> <td><a href="<?php echo $this->createUrl('members/viewuser', array('id' => $row->id)); ?> " title="<?php echo Yii::t('adminmembers', 'View User'); ?> " class='tooltip'><?php echo CHtml::encode($row->username); ?>
if (isset($lookupModel)) { echo $lookupModel->createLink(); } //CHtml::link($lookupModel->name,array('/'.$field->linkType.'/'.$model->$fieldName),array('target'=>'_blank')); // } elseif($className == 'ContactList') { // $lookupModel = CActiveRecord::model('X2List')->findByPk($model->$fieldName); // if(isset($lookupModel)) // echo CHtml::link($lookupModel->name,array('/contacts/list/'.$lookupModel->id),array('target'=>'_blank')); } } elseif (!empty($model->{$fieldName})) { echo $model->{$fieldName}; } else { echo ' '; } } elseif ($field->type == 'boolean') { echo CHtml::checkbox('', $model->{$fieldName}, array('onclick' => 'return false;', 'onkeydown' => 'return false;')); } elseif ($field->type == 'currency') { if ($model instanceof Product) { // products have their own currency echo Yii::app()->locale->numberFormatter->formatCurrency($model->{$fieldName}, $model->currency); } elseif (!empty($model->{$fieldName})) { echo Yii::app()->locale->numberFormatter->formatCurrency($model->{$fieldName}, Yii::app()->params['currency']); } else { echo ' '; } } elseif ($field->type == 'dropdown') { echo empty($model->{$fieldName}) ? ' ' : Yii::t(strtolower(Yii::app()->controller->id), $model->{$fieldName}); } elseif ($field->type == 'text') { echo empty($model->{$fieldName}) ? ' ' : $this->convertUrls($model->{$fieldName}); } else { echo empty($model->{$fieldName}) ? ' ' : $model->{$fieldName};
?> <div class="clear"></div> </td> </tr> </tfoot> <tbody> <?php if (count($rows)) { ?> <?php foreach ($rows as $row) { ?> <tr> <td><?php echo CHtml::checkbox('record[' . $row->id . ']'); ?> </td> <td><?php echo CHtml::encode($row->title); ?> </td> <td><?php echo CHtml::encode($row->alias); ?> </td> <td> <?php echo Yii::app()->dateFormatter->formatDateTime($row->postdate, 'short', 'short'); ?> <?php
<div class="row"> <?php echo Shop::getCountryChooser($form, $address); ?> </div> <?php if (Shop::module()->useWithYum && $customer->isNewRecord) { ?> <?php echo CHtml::label(Shop::t('Register an account'), 'register'); ?> <?php echo CHtml::checkbox('register', true); ?> <div class="registration"> <?php echo Shop::t('Enter a password to create an user account'); ?> <div class="row"> <?php echo $form->labelEx($customer, 'password'); ?> <?php echo $form->passwordField($customer, 'password', array('size' => 45, 'maxlength' => 45)); ?> <?php echo $form->error($customer, 'password');
<?php if (Yii::app()->getModule('event')->termine_first) { if ($logged_in) { echo "Zeilenumbrüche mit einer neuen Zeile im Text<br/>\n"; $form = $this->beginWidget('CActiveForm', array('id' => 'aktuelles_form', 'enableAjaxValidation' => false)); echo 'Titel 1: ' . CHtml::textField('infodate', $date->info, array('class' => 'form-control')) . '<br/>'; echo 'Titel 2: ' . CHtml::textField('infotitel', $titel->info, array('class' => 'form-control')) . '<br/>'; echo 'Aktiv?: ' . CHtml::checkbox('infoactive', $active->info) . '<br/>'; $textModel = new Page(); $textModel->text = $text->info; ShortWidgets::ckEditor($textModel, 'text'); //echo $info->inputfield('<textarea rows="25" cols="96" name="%s">%s</textarea>', 2); echo '<input type="submit" name="stop" class="btn btn-primary" value="eintragen"/>'; $this->endWidget(); } if (!$text->info) { echo '<!-- leerer text -->'; } else { if (!$active->info) { echo '<!-- nicht aktiv -->'; } else { ?> <div class="termin" id="specialtermin"> <p class="terminHead"> <span class="terminTitle2"> <?php echo $date->info; ?> <div style="float:right"><?php echo $titel->info;
public function init() { // $this->selectionChanged = 'js:function() { console.debug($.fn.yiiGridView.getSelection("'.$this->id.'")); }'; // if(empty($this->modelName)) // $this->modelName = $this->getId(); if (empty($this->viewName)) { $this->viewName = $this->modelName; } if ($this->modelName == 'Quotes') { $this->modelName = 'Quote'; } $this->columnSelectorId = $this->getId() . '-column-selector'; if (isset($_GET['gvSettings']) && isset($_GET['viewName']) && $_GET['viewName'] == $this->viewName) { $this->gvSettings = json_decode($_GET['gvSettings'], true); // unset($_GET['gvSettings']); // die(var_dump($this->gvSettings)); ProfileChild::setGridviewSettings($this->gvSettings, $this->viewName); } else { $this->gvSettings = ProfileChild::getGridviewSettings($this->viewName); } if ($this->gvSettings == null) { $this->gvSettings = $this->defaultGvSettings; } // die(var_dump($this->gvSettings)); // die(var_dump(ProfileChild::getGridviewSettings($this->viewName))); // load names from $specialColumns into $specialColumnNames foreach ($this->specialColumns as $columnName => &$columnData) { if (isset($columnData['header'])) { $this->specialColumnNames[$columnName] = $columnData['header']; } else { $this->specialColumnNames[$columnName] = CActiveRecord::model($this->modelName)->getAttributeLabel($columnName); } } // start allFieldNames with the special fields if (!empty($this->specialColumnNames)) { $this->allFieldNames = $this->specialColumnNames; } // add controls column if specified if ($this->enableControls) { $this->allFieldNames['gvControls'] = Yii::t('app', 'Tools'); } $this->allFieldNames['gvCheckbox'] = Yii::t('app', 'Checkbox'); // load fields from DB // $fields=Fields::model()->findAllByAttributes(array('modelName'=>ucwords($this->modelName))); $fields = CActiveRecord::model($this->modelName)->getFields(); foreach ($fields as $field) { $this->allFields[$field->fieldName] = $field; } // add tags column if specified if ($this->enableTags) { $this->allFieldNames['tags'] = Yii::t('app', 'Tags'); } foreach ($this->allFields as $fieldName => &$field) { $this->allFieldNames[$fieldName] = CActiveRecord::model($this->modelName)->getAttributeLabel($field->fieldName); } // update columns if user has submitted data if (isset($_GET['columns']) && isset($_GET['viewName']) && $_GET['viewName'] == $this->viewName) { // has the user changed column visibility? foreach (array_keys($this->gvSettings) as $key) { $index = array_search($key, $_GET['columns']); // search $_GET['columns'] for the column if ($index === false) { // if it's not in there, unset($this->gvSettings[$key]); } else { // othwerise, remove it from $_GET['columns'] unset($_GET['columns'][$index]); } // so the next part doesn't add it a second time } foreach (array_keys($this->allFieldNames) as $key) { // now go through $allFieldNames and add any fields that if (!isset($this->gvSettings[$key]) && in_array($key, $_GET['columns'])) { // are present in $_GET['columns'] but not already in the list $this->gvSettings[$key] = 80; } // default width of 80 } } unset($_GET['columns']); // prevents columns data from ending up in sort/pagination links unset($_GET['viewName']); unset($_GET['gvSettings']); // adding/removing columns changes the total width, // so let's scale the columns to match the correct total (590px) $totalWidth = array_sum(array_values($this->gvSettings)); if ($totalWidth > 0) { $widthFactor = 585 / $totalWidth; //- count($this->gvSettings) $sum = 0; $scaledSum = 0; foreach ($this->gvSettings as $columnName => &$columnWidth) { $sum += $columnWidth; $columnWidth = round($sum * $widthFactor) - $scaledSum; // map each point onto the nearest integer in the scaled space $scaledSum += $columnWidth; } } // die(var_dump($this->gvSettings).' '.$this->viewName); ProfileChild::setGridviewSettings($this->gvSettings, $this->viewName); // save the new Gridview Settings // die(var_dump($this->gvSettings)); $columns = array(); $datePickerJs = ''; foreach ($this->gvSettings as $columnName => $width) { // $width = (!empty($width) && is_numeric($width))? 'width:'.$width.'px;' : null; // make sure width is reasonable, then convert it to CSS $width = !empty($width) && is_numeric($width) ? $width : null; // make sure width is reasonable // $isDate = in_array($columnName,array('createDate','completeDate','lastUpdated','dueDate', 'expectedCloseDate', 'expirationDate', 'timestamp','lastactivity')); $isCurrency = in_array($columnName, array('annualRevenue', 'quoteAmount')); $lang = Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage(); //if($isDate) //$datePickerJs .= ' $("#'.$columnName.'DatePicker").datepicker(' //.'$.extend({showMonthAfterYear:false}, {"dateFormat":"'.$this->controller->formatDatePicker().'"})); '; // .'{"showAnim":"fold","dateFormat":"yy-mm-dd","changeMonth":"true","showButtonPanel":"true","changeYear":"true","constrainInput":"false"}));'; $newColumn = array(); if (array_key_exists($columnName, $this->specialColumnNames)) { $newColumn = $this->specialColumns[$columnName]; // $newColumn['name'] = 'lastName'; $newColumn['id'] = 'C_' . $columnName; // $newColumn['header'] = Yii::t('contacts','Name'); $newColumn['headerHtmlOptions'] = array('colWidth' => $width); // $newColumn['value'] = 'CHtml::link($data->firstName." ".$data->lastName,array("view","id"=>$data->id))'; // $newColumn['type'] = 'raw'; // die(print_r($newColumn)); $columns[] = $newColumn; } else { if (array_key_exists($columnName, $this->allFields)) { // && $this->allFields[$columnName]->visible == 1)) { $newColumn['name'] = $columnName; $newColumn['id'] = 'C_' . $columnName; $newColumn['header'] = CActiveRecord::model($this->modelName)->getAttributeLabel($columnName); $newColumn['headerHtmlOptions'] = array('colWidth' => $width); if ($isCurrency) { $newColumn['value'] = 'Yii::app()->locale->numberFormatter->formatCurrency($data->' . $columnName . ',Yii::app()->params->currency)'; $newColumn['type'] = 'raw'; } else { if ($columnName == 'assignedTo') { $newColumn['value'] = 'empty($data->assignedTo)?Yii::t("app","Anyone"):UserChild::getUserLinks($data->assignedTo)'; $newColumn['type'] = 'raw'; } elseif ($this->allFields[$columnName]->type == 'date') { $newColumn['value'] = 'empty($data["' . $columnName . '"])? "" : Yii::app()->dateFormatter->format(Yii::app()->locale->getDateFormat("medium"), $data["' . $columnName . '"])'; } elseif ($this->allFields[$columnName]->type == 'link') { $newColumn['value'] = 'X2Model::getModelLink($data->' . $columnName . ',"' . $this->allFields[$columnName]->linkType . '")'; // $type=ucfirst($field->linkType); // $newColumn['value']="!is_null($type::model()->findByPk(\$data->$columnName))?CHtml::link($type::model()->findByPk(\$data->$columnName)->name,array('/".$field->linkType."/default/view/id/'.\$data->$columnName),array('target'=>'_blank')):\$data->$columnName"; $newColumn['type'] = 'raw'; } elseif ($this->allFields[$columnName]->type == 'boolean') { $field = $this->allFields[$columnName]; $type = ucfirst($field->linkType); $newColumn['value'] = '$data->' . $columnName . '==1?Yii::t("actions","Yes"):Yii::t("actions","No")'; $newColumn['type'] = 'raw'; } } if (Yii::app()->language == 'en') { $format = "M d, yy"; } else { $format = Yii::app()->locale->getDateFormat('medium'); // translate Yii date format to jquery $format = str_replace('yy', 'y', $format); $format = str_replace('MM', 'mm', $format); $format = str_replace('M', 'm', $format); } /*$newColumn['filter'] = $isDate? $this->widget("zii.widgets.jui.CJuiDatePicker",array( 'model'=>$this->filter, //Model object // 'id'=>$columnName.'DatePicker', 'attribute'=>$columnName, //attribute name // 'mode'=>'datetime', //use 'time','date' or 'datetime' (default) // 'htmlOptions'=>array('style'=>'width:80%;'), 'options'=>array( 'dateFormat'=>$format, ), // jquery plugin options 'language'=>$lang, ),true) : null;*/ $columns[] = $newColumn; } else { if ($columnName == 'gvControls') { $newColumn['id'] = 'C_gvControls'; $newColumn['class'] = 'CButtonColumn'; $newColumn['header'] = Yii::t('app', 'Tools'); $newColumn['headerHtmlOptions'] = array('colWidth' => $width); if (Yii::app()->user->getName() != 'admin') { $newColumn['template'] = '{view}{update}'; } $columns[] = $newColumn; } else { if ($columnName == 'tags') { $newColumn['id'] = 'C_' . 'tags'; // $newColumn['class'] = 'CDataColumn'; $newColumn['header'] = Yii::t('app', 'Tags'); $newColumn['headerHtmlOptions'] = array('colWidth' => $width); $newColumn['value'] = 'Tags::getTagLinks("' . $this->modelName . '",$data->id,2)'; $newColumn['type'] = 'raw'; $newColumn['filter'] = CHtml::textField('tagField', isset($_GET['tagField']) ? $_GET['tagField'] : ''); $columns[] = $newColumn; } else { if ($columnName == 'gvCheckbox') { $newColumn['id'] = 'C_gvCheckbox'; $newColumn['class'] = 'CCheckBoxColumn'; $newColumn['selectableRows'] = 2; $newColumn['headerHtmlOptions'] = array('colWidth' => $width); $columns[] = $newColumn; } } } } } } // $this->afterAjaxUpdate = 'function(id, data) { '.$datePickerJs.' }'; if (!empty($this->afterAjaxUpdate)) { $this->afterAjaxUpdate = "var callback = " . $this->afterAjaxUpdate . "; if(typeof callback == 'function') callback();"; } $this->afterAjaxUpdate = " function(id,data) { " . $this->afterAjaxUpdate . " " . $datePickerJs; if ($this->enableGvSettings) { $this->afterAjaxUpdate .= "\n\t\t\t\$('#" . $this->getId() . " table').gvSettings({\n\t\t\t\tviewName:'" . $this->viewName . "',\n\t\t\t\tcolumnSelectorId:'" . $this->columnSelectorId . "',\n\t\t\t\tajaxUpdate:true\n\t\t\t});"; } $this->afterAjaxUpdate .= " } "; $this->columns = $columns; natcasesort($this->allFieldNames); // sort column names // generate column selector HTML $this->columnSelectorHtml = CHtml::beginForm(array('site/saveGvSettings'), 'get') . '<ul class="column-selector" id="' . $this->columnSelectorId . '">'; foreach ($this->allFieldNames as $fieldName => &$attributeLabel) { $selected = array_key_exists($fieldName, $this->gvSettings); $this->columnSelectorHtml .= "<li>" . CHtml::checkbox('columns[]', $selected, array('id' => $fieldName . '_checkbox', 'value' => $fieldName)) . CHtml::label($attributeLabel, $fieldName . '_checkbox') . "</li>"; } $this->columnSelectorHtml .= '</ul>' . CHtml::endForm(); // Yii::app()->clientScript->renderBodyBegin($columnHtml); // Yii::app()->clientScript->registerScript(__CLASS__.'#'.$this->getId().'_columnSelector', // "$('#".$this->getId()." table').after('".addcslashes($columnHtml,"'")."'); // ",CClientScript::POS_READY); $themeURL = Yii::app()->theme->getBaseUrl(); Yii::app()->clientScript->registerScript('logos', "\n\t\t\$(window).load(function(){\n\t\t\tif((!\$('#main-menu-icon').length) || (!\$('#x2touch-logo').length) || (!\$('#x2crm-logo').length)){\n\t\t\t\t\$('a').removeAttr('href');\n\t\t\t\talert('Please put the logo back');\n\t\t\t\twindow.location='http://www.x2engine.com';\n\t\t\t}\n\t\t\tvar touchlogosrc = \$('#x2touch-logo').attr('src');\n\t\t\tvar logosrc=\$('#x2crm-logo').attr('src');\n\t\t\tif(logosrc!='{$themeURL}/images/x2footer.png'|| touchlogosrc!='{$themeURL}/images/x2touch.png'){\n\t\t\t\t\$('a').removeAttr('href');\n\t\t\t\talert('Please put the logo back');\n\t\t\t\twindow.location='http://www.x2engine.com';\n\t\t\t}\n\t\t}); \n\t\t"); parent::init(); }
<div class="form-group"> <?php echo $form->textField($model, 'tema', array('size' => 50, 'maxlength' => 50, 'class' => 'form-control')); ?> <?php echo $form->error($model, 'tema'); ?> </div> </div> </div> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 text-center"> <div class="form-group"> <div class="pull-right"> <?php echo CHtml::checkbox('noticias', true, array('id' => 'noticias', 'class' => 'checkbox_class')); ?> Deseo recibir noticias. </div> </div> </div> </div> <div class="row"> <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 text-center"> <div class="form-group"> <div class="pull-right"> <?php $this->widget('bootstrap.widgets.TbButton', array('buttonType' => 'submit', 'type' => 'primary', 'label' => $model->isNewRecord ? 'Registrar' : 'Actualizar Perfil')); ?> </div> </div>
?> <div class="clear"></div> </td> </tr> </tfoot> <tbody> <?php if (count($comments)) { ?> <?php foreach ($comments as $row) { ?> <tr> <td><?php echo CHtml::checkbox('comment[' . $row->id . ']'); ?> </td> <td><?php echo $row->id; ?> </td> <td><?php echo $row->author ? $row->author->username : Yii::t('global', 'Unknown'); ?> </td> <td class='tooltip' title='<?php echo Yii::t('admintuts', 'Joined Date'); ?> '><?php echo Yii::app()->dateFormatter->formatDateTime($row->postdate, 'short', 'short');
$('#fileUploaderButton_contentFormFiles').bind('fileuploadprogressall', function (e, data) { var progress = parseInt(data.loaded / data.total * 100, 10); if (progress != 100) { // Fix: remove focus from upload button to hide tooltip $('#post_submit_button').focus(); // hide form buttons $('.btn_container').hide(); } }); </script> <!-- public checkbox --> <?php echo CHtml::checkbox("visibility", "", array('id' => 'contentForm_visibility', 'class' => 'contentForm hidden')); ?> <!-- content sharing --> <div class="pull-right"> <span class="label label-success label-public hidden"><?php echo Yii::t('WallModule.widgets_views_contentForm', 'Public'); ?> </span> <ul class="nav nav-pills preferences" style="right: 0; top: 5px;"> <li class="dropdown"> <a class="dropdown-toggle" style="padding: 5px 10px;" data-toggle="dropdown" href="#"><i class="fa fa-cogs"></i></a> <ul class="dropdown-menu pull-right">
protected function getSettingsMenuContentDialogs() { return '<div id="grid-settings-dialog-' . $this->widgetKey . '" style="display: none;">' . '<div>' . Yii::t('profile', 'Use persistent filter and sort settings?') . '</div>' . CHtml::checkbox('dbPersistentGridSettings', self::getJSONProperty($this->profile, 'dbPersistentGridSettings', $this->widgetType, $this->widgetUID), array('id' => 'dbPersistentGridSettings-' . $this->widgetKey)) . X2Html::hint(Yii::t('profile', 'Leaving this box checked will prevent your grid filter and ' . 'sort settings from being reset when you log out of the app.'), false, null, true, true) . '</div>' . parent::getSettingsMenuContentDialogs(); }
/** * Parse each setting */ public function parseSetting($setting) { $name = 'setting_' . $setting->id; $value = $setting->value ? $setting->value : $setting->default_value; switch ($setting->type) { case 'textarea': echo CHtml::textArea($name, $value, array('rows' => 5, 'class' => 'text-input')); break; case 'dropdown': echo CHtml::dropDownList($name, $value, $this->convertExtraToArray($setting->extra), array('class' => 'text-input')); break; case 'multi': echo CHtml::listBox($name, explode(',', $value), $this->convertExtraToArray($setting->extra), array('multiple' => 'multiple', 'size' => 5, 'class' => 'text-input')); break; case 'checkbox': echo CHtml::checkbox($name, $setting->value != '' ? $setting->value : $setting->default_value, array('class' => 'text-input')); break; case 'yesno': echo CHtml::dropDownList($name, $value, array('0' => Yii::t('global', 'No'), '1' => Yii::t('global', 'Yes')), array('class' => 'text-input')); break; case 'editor': $this->createWidget('application.widgets.ckeditor.CKEditor', array('name' => $name, 'value' => $value, 'editorTemplate' => 'basic'))->run(); break; case 'text': default: echo CHtml::textField($name, $value, array('class' => 'text-input medium-input')); break; } }