Exemplo n.º 1
1
 /**
  * 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);
 }
Exemplo n.º 2
0
 public function run()
 {
     echo '<div style="width: 35px">';
     // only for fixing modal error counting width
     echo CHtml::activeCheckBox($this->model, $this->attribute, $this->htmlOptions);
     echo '</div>';
 }
 /**
  * @param $value
  * @return string
  */
 public function editAttribute($model, $field, $params = array())
 {
     if (!isset($params['options'])) {
         $params['options'] = array();
     }
     $options = $params['options'];
     unset($params['options']);
     return CHtml::activeFileField($model, $field->varname, $params) . ($model->getAttribute($field->varname) ? '<br/>' . CHtml::activeCheckBox($model, '[uwfdel]' . $field->varname, $params) . ' ' . CHtml::activeLabelEx($model, '[uwfdel]' . $field->varname, array('label' => UserModule::t('Delete file'), 'style' => 'display:inline;')) : '');
 }
Exemplo n.º 4
0
 /**
  * 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');
 }
Exemplo n.º 5
0
 protected function renderDataCellContent($row, $data)
 {
     $model = CustomerDiscount::model()->findByAttributes(array('customer_id' => $this->customer_id, 'service_id' => $data->id));
     if (!$model instanceof CustomerDiscount) {
         $model = new CustomerDiscount();
     }
     $options = $this->checkBoxHtmlOptions;
     $options['name'] = str_replace('CustomerDiscount', 'CustomerDiscount[' . $row . ']', CHtml::activeName($model, $this->forAttribute));
     $options['class'] = $this->id;
     echo CHtml::activeCheckBox($model, $this->forAttribute, $options);
 }
Exemplo n.º 6
0
 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);
     }
 }
Exemplo n.º 7
0
 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;
 }
Exemplo n.º 8
0
 /**
  * HTML element ที่เหมาะสมเพื่อสร้าง switch input ตาม model และ field ที่ระบุ
  * @param CActiveRecord $model
  * @param string $fieldName
  * @param array $options
  * @return string
  */
 public static function switchInput(CActiveRecord $model, $fieldName, $options = array())
 {
     $containerCss = '';
     $options['class'] = 'toggle';
     if ($options['inputClass']) {
         $options['class'] .= " {$options['inputClass']}";
         unset($options['inputClass']);
     }
     if ($model->hasErrors($fieldName)) {
         $containerCss .= ' has-error';
         $errorHelp = '<span class="help-block">' . $model->getError($fieldName) . '</span>';
     }
     $str = "<div class=\"form-group{$containerCss}\">" . CHtml::activeLabelEx($model, $fieldName, array('class' => 'control-label col-md-3')) . '<div class="col-md-2"><div class="make-switch">' . CHtml::activeCheckBox($model, $fieldName, $options) . "</div>{$errorHelp}</div></div>";
     return $str;
 }
Exemplo n.º 9
0
 /**
  * Renders a checkbox for a model attribute.
  * This method is a wrapper of {@link CHtml::activeCheckBox}.
  * Please check {@link CHtml::activeCheckBox} 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 check box
  */
 public function checkBox($model, $attribute, $htmlOptions = array())
 {
     return CHtml::activeCheckBox($model, $attribute, $htmlOptions);
 }
	</div>
	<div class="field-row">
		<label for="<?php 
echo CHtml::modelName($element) . '_' . $side . '_description';
?>
">
			<?php 
echo $element->getAttributeLabel($side . '_description');
?>
:
		</label>
		<?php 
echo CHtml::activeTextArea($element, $side . '_description', array('rows' => "2", 'class' => 'autosize clearWithEyedraw'));
?>
	</div>
	<div class="field-row">
		<label>
			<?php 
echo CHtml::activeCheckBox($element, $side . '_phako', array('class' => 'clearWithEyedraw'));
?>
			<?php 
echo $element->getAttributeLabel($side . '_phako');
?>
		</label>
	</div>
	<div class="field-row">
		<button class="ed_report secondary small">Report</button>
		<button class="ed_clear secondary small">Clear</button>
	</div>
</div>
Exemplo n.º 11
0
?>

<div class="middlenarrow" style="padding-top: -100px">

    <?php 
echo CHtml::errorSummary($importAdminsSettings);
?>

    <h1>Export settings</h1>
    <?php 
echo CHtml::beginForm($this->createUrl('superadmin/exportadminssettings'), 'post', array('id' => 'formexportadminssettings'));
?>
    <table class="">
        <tr>
            <td><?php 
echo CHtml::activeCheckBox($exportAdminsSettings, 'user_settings');
?>
 <?php 
echo CHtml::activeLabel($exportAdminsSettings, 'user_settings');
?>
</td>
        </tr>
    </table>
    <br/><br/>
    <?php 
echo CHtml::hiddenField('type', 'export');
?>
    <?php 
echo CHtml::submitButton('Get Export');
?>
    <?php 
Exemplo n.º 12
0
echo at("Enter a title to group this settings and the next ones after it in a group of settings until you close it by checking the close opened group checkbox.");
?>
</span>
						<?php 
echo CHtml::error($model, 'group_title');
?>
					</div>
				</div>
					
				<div class="form-group">
					<?php 
echo CHtml::activeLabelEx($model, 'group_close', array('class' => $label_class));
?>
					<div class="col-md-6 col-xs-12">
						<?php 
echo CHtml::activeCheckBox($model, 'group_close', array('class' => 'form-control icheckbox'));
?>
						<br /><span class="subtip"><?php 
echo at("If you've entered a group title for a setting you may close that opened group by checking this checkbox to close it.");
?>
</span>
						<?php 
echo CHtml::error($model, 'group_close');
?>
					</div>
				</div>
					
				<div class="form-group">
					<?php 
echo CHtml::activeLabelEx($model, 'sort_ord', array('class' => $label_class));
?>
Exemplo n.º 13
0
                                </div>
                            <?php 
}
?>

                            <?php 
if ((bool) $params->is_max_layout_allowed || Yii::app()->user->username == Yii::app()->params['superAdminInfo']['username']) {
    ?>
                                <div class="form-group">
                                    <label class="col-md-3 control-label" for="title"><?php 
    echo CHtml::activeLabel($params, 'is_max_layout');
    ?>
</label>
                                    <div class="col-md-7">
                                        <?php 
    echo CHtml::activeCheckBox($params, 'is_max_layout');
    ?>
                                    </div>
                                </div>
                            <?php 
}
?>


                            <?php 
if (Yii::app()->user->username == Yii::app()->params['superAdminInfo']['username']) {
    ?>
                                <div class="form-group">
                                    <label class="col-md-3 control-label" for="title"><?php 
    echo CHtml::activeLabel($params, 'filter_header_color_background');
    ?>
Exemplo n.º 14
0
]</a>
                    <a href="javascript:void(0)" 
                     onclick="x2.dropdownManager.moveOptionDown(this);">[<?php 
echo Yii::t('admin', 'Down');
?>
]</a>
                    <a href="javascript:void(0)" 
                     onclick="x2.dropdownManager.deleteOption(this);">[<?php 
echo Yii::t('admin', 'Del');
?>
]</a>
                </div>
                <br />
            </li>
            <?php 
echo CHtml::activeLabel($model, 'multi', array('class' => 'multi-checkbox-label')) . '&nbsp;' . CHtml::activeCheckBox($model, 'multi');
?>
        </ol>
    </div>
    <a href="javascript:void(0)" 
     onclick="x2.dropdownManager.addOption();" class="add-dropdown-option">[<?php 
echo Yii::t('admin', 'Add Option');
?>
]</a>
    <div class="row buttons">
        <br />
		<?php 
echo CHtml::submitButton($model->isNewRecord ? Yii::t('app', 'Create') : Yii::t('app', 'Save'), array('class' => 'x2-button'));
?>
    </div>
<?php 
Exemplo n.º 15
0
			<th><?php 
echo CHtml::activeLabelEx($product, 'is_recommend');
?>
</th>
			<td><?php 
echo CHtml::activeCheckBox($product, 'is_recommend');
?>
</td>
		</tr>
		<tr>
			<th><?php 
echo CHtml::activeLabelEx($product, 'is_released');
?>
</th>
			<td><?php 
echo CHtml::activeCheckBox($product, 'is_released');
?>
</td>
		</tr>
	</table>
	<?php 
$basicContent = ob_get_clean();
$i18nTabs = array();
$tabs = array();
foreach (I18nHelper::getFrontendLanguages() as $lang => $prop) {
    $i18nTabs[$prop['label']] = $this->renderPartial('createI18n', array('product' => $product, 'lang' => $lang, 'prop' => $prop), true);
}
$this->widget('zii.widgets.jui.CJuiTabs', array('tabs' => array('基本资料' => $basicContent) + $i18nTabs));
?>
	<?php 
echo CHtml::endForm();
Exemplo n.º 16
0
 public function renderInputs()
 {
     $htmlOptions = array('style' => 'display:inline-block;margin-right: 10px;');
     echo CHtml::activeCheckBox($this, 'createContact', $this->htmlOptions('createContact', $htmlOptions));
     echo CHtml::activeLabel($this, 'createContact', $this->labelOptions('createContact', $htmlOptions));
     echo X2Html::hint(Yii::t('admin', 'If disabled, the email dropbox will ignore any emails that are to or from addresses not matching any contacts in X2Engine. If enabled, new contacts will be created automatically using name info contained in the email.'));
     echo '<br />';
     echo '<div style="margin-left:20px;' . ((bool) $this->createContact ? '' : 'display:none') . '" id="empty-contact">';
     echo CHtml::activeCheckBox($this, 'emptyContact', $this->htmlOptions('emptyContact', $htmlOptions));
     echo CHtml::activeLabel($this, 'emptyContact', $this->labelOptions('emptyContact', $htmlOptions));
     echo X2Html::hint(Yii::t('admin', "If enabled, the email dropbox will create a new contact record associated with a new unique email address even if the first and last name cannot be found in the email. If disabled, it ignores all email that does not contain contacts' first and last names. This setting has no effect if {ccfe} is disabled.", array('{ccfe}' => '"' . Yii::t('admin', 'Create contacts from emails') . '"')));
     echo '</div>';
     echo CHtml::activeCheckBox($this, 'zapLineBreaks', $this->htmlOptions('zapLineBreaks', $htmlOptions));
     echo CHtml::activeLabel($this, 'zapLineBreaks', $this->labelOptions('zapLineBreaks', $htmlOptions));
     echo X2Html::hint(Yii::t('admin', 'If enabled, the mail parser will (when extracting the body of an email) attempt to clear the text of artificial line breaks induced by RFC email format specifications (which limit lines to 78 characters). If disabled, the email parser will not do this.'));
     echo '<br />';
     echo CHtml::activeCheckBox($this, 'logging', $this->htmlOptions('logging', $htmlOptions));
     echo CHtml::activeLabel($this, 'logging', $this->labelOptions('logging', $htmlOptions));
     echo X2Html::hint(Yii::t('admin', 'If enabled, the email dropbox will record email capture events in a log file in protected/runtime. This option is useful for troubleshooting but will take up some extra disk space on a system that captures a high volume of emails.'));
     echo '<br />';
     echo CHtml::activeCheckBox($this, 'ignoreEmptyName', $this->htmlOptions('ignoreEmptyName', $htmlOptions));
     echo CHtml::activeLabel($this, 'ignoreEmptyName', $this->labelOptions('ignoreEmptyName', $htmlOptions));
     echo X2Html::hint(Yii::t('admin', "If disabled, the import will exit and send an error message email if the forwarded message header does not contain the sender's full name."));
     echo '<br />';
     echo CHtml::activeLabel($this, 'caseFlag', $this->labelOptions('caseFlag', $htmlOptions));
     echo CHtml::activeTextField($this, 'caseFlag', $this->htmlOptions('caseFlag', $htmlOptions));
     echo X2Html::hint(Yii::t('admin', 'When sending an email, you can specify a case to attach the email to by putting this code, followed immediately by the case ID, into the email body before the forwarded message, or without any case ID to create a new case from the email.'));
     echo '<br />';
     echo CHtml::activeLabel($this, 'alias', $this->labelOptions('alias', $htmlOptions));
     echo CHtml::activeTextField($this, 'alias', $this->htmlOptions('alias', $htmlOptions));
     echo X2Html::hint(Yii::t('admin', 'The address to use as the sender when sending error notification emails, if no default is set for system notifications. By default, if left blank, the email dropbox will use the first addresses in the {tohf} or {cchf} field that contains {dbat}.', array('{tohf}' => 'To:', '{cchf}' => 'CC:', '{dbat}' => '"dropbox@"')));
     echo '<br />';
     echo "<script type=\"text/javascript\">\n                (function(\$) {\n                    \$(\"[name='" . $this->resolveName('createContact') . "']\").change(function() {\n                        if(\$(this).is(':checked'))\n                            \$('#empty-contact').fadeIn(300);\n                        else\n                            \$('#empty-contact').fadeOut(300);\n                    }).each(function(){\n                        if(!\$(this).is(':checked'))\n                            \$('#empty-contact').hide();\n                        else\n                            \$('#empty-contact').show();\n                    });\n                })(jQuery);\n              </script>";
 }
Exemplo n.º 17
0
	$this->breadcrumbs=array('Importar'=>array('index'),'Datos',);

	//Inicio el widget
	$form=$this->beginWidget('CActiveForm', array('id'=>'importar-form','enableAjaxValidation'=>false,'htmlOptions' => array('enctype'=>'multipart/form-data'),)); ?>

	<div class="yiiForm">
		<?php echo CHtml::beginForm();?>
		
		<h5>El archivo de importación puede ser sql o xml</h5>
		
		<!--Diálogo para elegir el archivo-->
		<div class="simple">
		<?php echo $form->fileField($modelo, 'archivo');
			  echo $form->error($modelo, 'archivo'); ?>
	    </div></br>
		
		<!--Botón de check para comprobar las claves foráneas-->
		<div class="simple">
		<?php echo CHtml::activeCheckBox($modelo,'foraneas');
			  echo $form->label($modelo,'foraneas'); ?>
		</div></br>
		
		<div class="action">
		<?php echo CHtml::submitButton('Importar',array('name' => 'importarDatos', 'confirm' => "¿Está seguro que desea sobreescribir los datos almacenados")); ?>
		</div>
		
		<?php echo CHtml::endForm(); ?>
	</div>
	
	<?php $this->endWidget();
} ?>
Exemplo n.º 18
0
 /**
  * Generates a check box 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 check box.
  */
 public static function activeCheckBox($model, $attribute, $htmlOptions = array())
 {
     $label = TbArray::popValue('label', $htmlOptions, false);
     $labelOptions = TbArray::popValue('labelOptions', $htmlOptions, array());
     self::addCssClass('checkbox', $labelOptions);
     $input = parent::activeCheckBox($model, $attribute, $htmlOptions);
     return self::createCheckBoxAndRadioButtonLabel($label, $input, $labelOptions);
 }
Exemplo n.º 19
0
    public static function renderModelInput(CModel $model, $field, $htmlOptions = array())
    {
        if (!$field->asa('CommonFieldsBehavior')) {
            throw new Exception('$field must have CommonFieldsBehavior');
        }
        if ($field->required) {
            if (isset($htmlOptions['class'])) {
                $htmlOptions['class'] .= ' x2-required';
            } else {
                $htmlOptions = array_merge(array('class' => 'x2-required'), $htmlOptions);
            }
        }
        $fieldName = $field->fieldName;
        if (!isset($field)) {
            return null;
        }
        switch ($field->type) {
            case 'text':
                return CHtml::activeTextArea($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), array_merge(array('encode' => false), $htmlOptions)));
            case 'date':
                $oldDateVal = $model->{$fieldName};
                $model->{$fieldName} = Formatter::formatDate($model->{$fieldName}, 'medium');
                Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
                $pickerOptions = array('dateFormat' => Formatter::formatDatePicker(), 'changeMonth' => false, 'changeYear' => true);
                if (Yii::app()->getLanguage() === 'fr') {
                    $pickerOptions['monthNamesShort'] = Formatter::getPlainAbbrMonthNames();
                }
                $input = Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => $fieldName, 'mode' => 'date', 'options' => $pickerOptions, 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true);
                $model->{$fieldName} = $oldDateVal;
                return $input;
            case 'dateTime':
                $oldDateTimeVal = $model->{$fieldName};
                $pickerOptions = array('dateFormat' => Formatter::formatDatePicker('medium'), 'timeFormat' => Formatter::formatTimePicker(), 'ampm' => Formatter::formatAMPM(), 'changeMonth' => true, 'changeYear' => true);
                if (Yii::app()->getLanguage() === 'fr') {
                    $pickerOptions['monthNamesShort'] = Formatter::getPlainAbbrMonthNames();
                }
                $model->{$fieldName} = Formatter::formatDateTime($model->{$fieldName});
                Yii::import('application.extensions.CJuiDateTimePicker.CJuiDateTimePicker');
                $input = Yii::app()->controller->widget('CJuiDateTimePicker', array('model' => $model, 'attribute' => $fieldName, 'mode' => 'datetime', 'options' => $pickerOptions, 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions), 'language' => Yii::app()->language == 'en' ? '' : Yii::app()->getLanguage()), true);
                $model->{$fieldName} = $oldDateTimeVal;
                return $input;
            case 'dropdown':
                // Note: if desired to translate dropdown options, change the seecond argument to
                // $model->module
                $om = $field->getDropdownOptions();
                $multi = (bool) $om['multi'];
                $dropdowns = $om['options'];
                $curVal = $multi ? CJSON::decode($model->{$field->fieldName}) : $model->{$field->fieldName};
                $ajaxArray = array();
                if ($field instanceof Fields) {
                    $dependencyCount = X2Model::model('Dropdowns')->countByAttributes(array('parent' => $field->linkType));
                    $fieldDependencyCount = X2Model::model('Fields')->countByAttributes(array('modelName' => $field->modelName, 'type' => 'dependentDropdown', 'linkType' => $field->linkType));
                    if ($dependencyCount > 0 && $fieldDependencyCount > 0) {
                        $ajaxArray = array('ajax' => array('type' => 'GET', 'url' => Yii::app()->controller->createUrl('/site/dynamicDropdown'), 'data' => 'js:{
                                "val":$(this).val(),
                                "dropdownId":"' . $field->linkType . '",
                                "field":true, "module":"' . $field->modelName . '"
                            }', 'success' => '
                                function(data){
                                    if(data){
                                        data=JSON.parse(data);
                                        if(data[0] && data[1]){
                                            $("#' . $field->modelName . '_"+data[0]).html(data[1]);
                                        }
                                    }
                                }'));
                    }
                }
                $htmlOptions = array_merge($htmlOptions, $ajaxArray, array('title' => $field->attributeLabel));
                if ($multi) {
                    $multiSelectOptions = array();
                    if (!is_array($curVal)) {
                        $curVal = array();
                    }
                    foreach ($curVal as $option) {
                        $multiSelectOptions[$option] = array('selected' => 'selected');
                    }
                    $htmlOptions = array_merge($htmlOptions, array('options' => $multiSelectOptions, 'multiple' => 'multiple'));
                } elseif ($field->includeEmpty) {
                    $htmlOptions = array_merge($htmlOptions, array('empty' => Yii::t('app', "Select an option")));
                }
                return CHtml::activeDropDownList($model, $field->fieldName, $dropdowns, $htmlOptions);
            case 'dependentDropdown':
                return CHtml::activeDropDownList($model, $field->fieldName, array('' => '-'), array_merge(array('title' => $field->attributeLabel), $htmlOptions));
            case 'link':
                $linkSource = null;
                $linkId = '';
                $name = '';
                if (class_exists($field->linkType)) {
                    // Create a model for autocompletion:
                    if (!empty($model->{$fieldName})) {
                        list($name, $linkId) = Fields::nameAndId($model->{$fieldName});
                        $linkModel = X2Model::getLinkedModelMock($field->linkType, $name, $linkId, true);
                    } else {
                        $linkModel = X2Model::model($field->linkType);
                    }
                    if ($linkModel instanceof X2Model && $linkModel->asa('X2LinkableBehavior') instanceof X2LinkableBehavior) {
                        $linkSource = Yii::app()->controller->createUrl($linkModel->autoCompleteSource);
                        $linkId = $linkModel->id;
                        $oldLinkFieldVal = $model->{$fieldName};
                        $model->{$fieldName} = $name;
                    }
                }
                static $linkInputCounter = 0;
                $hiddenInputId = $field->modelName . '_' . $fieldName . "_id" . $linkInputCounter++;
                $input = CHtml::hiddenField($field->modelName . '[' . $fieldName . '_id]', $linkId, array('id' => $hiddenInputId)) . Yii::app()->controller->widget('zii.widgets.jui.CJuiAutoComplete', array('model' => $model, 'attribute' => $fieldName, 'source' => $linkSource, 'value' => $name, 'options' => array('minLength' => '1', 'select' => 'js:function( event, ui ) {
                                    $("#' . $hiddenInputId . '").
                                        val(ui.item.id);
                                    $(this).val(ui.item.value);
                                    return false;
                            }', 'create' => $field->linkType == 'Contacts' ? 'js:function(event, ui) {
                                    $(this).data( "uiAutocomplete" )._renderItem = 
                                        function(ul,item) {
                                            return $("<li>").data("item.autocomplete",item).
                                                append(x2.forms.renderContactLookup(item)).
                                                appendTo(ul);
                                        };
                            }' : ($field->linkType == 'BugReports' ? 'js:function(event, ui) {
                                $(this).data( "uiAutocomplete" )._renderItem = 
                                    function( ul, item ) {

                                    var label = "<a style=\\"line-height: 1;\\">" + item.label;

                                    label += "<span style=\\"font-size: 0.6em;\\">";

                                    // add email if defined
                                    if(item.subject) {
                                        label += "<br>";
                                        label += item.subject;
                                    }

                                    label += "</span>";
                                    label += "</a>";

                                    return $( "<li>" )
                                        .data( "item.autocomplete", item )
                                        .append( label )
                                        .appendTo( ul );
                                };
                            }' : '')), 'htmlOptions' => array_merge(array('title' => $field->attributeLabel), $htmlOptions)), true);
                if (isset($oldLinkFieldVal)) {
                    $model->{$fieldName} = $oldLinkFieldVal;
                }
                return $input;
            case 'rating':
                return Yii::app()->controller->widget('X2StarRating', array('model' => $model, 'attribute' => $field->fieldName, 'readOnly' => isset($htmlOptions['disabled']) && $htmlOptions['disabled'], 'minRating' => Fields::RATING_MIN, 'maxRating' => Fields::RATING_MAX, 'starCount' => Fields::RATING_MAX - Fields::RATING_MIN + 1, 'cssFile' => Yii::app()->theme->getBaseUrl() . '/css/rating/jquery.rating.css', 'htmlOptions' => $htmlOptions, 'callback' => 'function(value, link){
                        if (typeof x2 !== "undefined" &&
                            typeof x2.InlineEditor !== "undefined" &&
                            typeof x2.InlineEditor.ratingFields !== "undefined") {

                            x2.InlineEditor.ratingFields["' . $field->modelName . '[' . $field->fieldName . ']"] = value;
                        }
                    }'), true);
            case 'boolean':
                $checkbox = CHtml::openTag('div', X2Html::mergeHtmlOptions($htmlOptions, array('class' => 'checkboxWrapper')));
                $checkbox .= CHtml::activeCheckBox($model, $field->fieldName, array_merge(array('unchecked' => 0, 'title' => $field->attributeLabel), $htmlOptions));
                $checkbox .= CHtml::closeTag('div');
                return $checkbox;
            case 'assignment':
                $oldAssignmentVal = $model->{$fieldName};
                $model->{$fieldName} = !empty($model->{$fieldName}) ? $field->linkType == 'multiple' && !is_array($model->{$fieldName}) ? explode(', ', $model->{$fieldName}) : $model->{$fieldName} : X2Model::getDefaultAssignment();
                $dropdownList = CHtml::activeDropDownList($model, $fieldName, X2Model::getAssignmentOptions(true, true), array_merge(array('title' => $field->attributeLabel, 'id' => $field->modelName . '_' . $fieldName . '_assignedToDropdown', 'multiple' => $field->linkType == 'multiple' ? 'multiple' : null), $htmlOptions));
                $model->{$fieldName} = $oldAssignmentVal;
                return $dropdownList;
            case 'optionalAssignment':
                // optional assignment for users (can be left blank)
                $users = User::getNames();
                unset($users['Anyone']);
                return CHtml::activeDropDownList($model, $fieldName, $users, array_merge(array('title' => $field->attributeLabel, 'empty' => ''), $htmlOptions));
            case 'visibility':
                $permissionsBehavior = Yii::app()->params->modelPermissions;
                return CHtml::activeDropDownList($model, $field->fieldName, $permissionsBehavior::getVisibilityOptions(), array_merge(array('title' => $field->attributeLabel, 'id' => $field->modelName . "_visibility"), $htmlOptions));
                // 'varchar', 'email', 'url', 'int', 'float', 'currency', 'phone'
                // case 'int':
                // return CHtml::activeNumberField($model, $field->fieldNamearray_merge(array(
                // 'title' => $field->attributeLabel,
                // ), $htmlOptions));
            // 'varchar', 'email', 'url', 'int', 'float', 'currency', 'phone'
            // case 'int':
            // return CHtml::activeNumberField($model, $field->fieldNamearray_merge(array(
            // 'title' => $field->attributeLabel,
            // ), $htmlOptions));
            case 'percentage':
                $htmlOptions['class'] = empty($htmlOptions['class']) ? 'input-percentage' : $htmlOptions['class'] . ' input-percentage';
                return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions));
            case 'currency':
                $fieldName = $field->fieldName;
                $elementId = isset($htmlOptions['id']) ? '#' . $htmlOptions['id'] : '#' . $field->modelName . '_' . $field->fieldName;
                Yii::app()->controller->widget('application.extensions.moneymask.MMask', array('element' => $elementId, 'currency' => Yii::app()->params['currency'], 'config' => array('affixStay' => true, 'decimal' => Yii::app()->locale->getNumberSymbol('decimal'), 'thousands' => Yii::app()->locale->getNumberSymbol('group'))));
                return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel, 'class' => 'currency-field'), $htmlOptions));
            case 'credentials':
                $typeAlias = explode(':', $field->linkType);
                $type = $typeAlias[0];
                if (count($typeAlias) > 1) {
                    $uid = Credentials::$sysUseId[$typeAlias[1]];
                } else {
                    $uid = Yii::app()->user->id;
                }
                return Credentials::selectorField($model, $field->fieldName, $type, $uid);
            case 'timerSum':
                // Sorry, no-can-do. This is field derives its value from a sum over timer records.
                return $model->renderAttribute($field->fieldName);
            case 'float':
            case 'int':
                if (isset($model->{$fieldName})) {
                    $oldNumVal = $model->{$fieldName};
                    $model->{$fieldName} = Yii::app()->locale->numberFormatter->formatDecimal($model->{$fieldName});
                }
                $input = CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions));
                if (isset($oldNumVal)) {
                    $model->{$fieldName} = $oldNumVal;
                }
                return $input;
            default:
                return CHtml::activeTextField($model, $field->fieldName, array_merge(array('title' => $field->attributeLabel), $htmlOptions));
                // array(
                // 'tabindex'=>isset($item['tabindex'])? $item['tabindex'] : null,
                // 'disabled'=>$item['readOnly']? 'disabled' : null,
                // 'title'=>$field->attributeLabel,
                // 'style'=>$default?'color:#aaa;':null,
                // ));
        }
    }
Exemplo n.º 20
0
function getFieldsCheckbox($model, $fields, $setFields = array(), $ulId = 'tree')
{
    $cs = Yii::app()->getClientScript();
    $cs->registerCoreScript('jquery');
    $css = '
			/* Catalog Tree */
			#tree {
	    		list-style: none;
				padding-left:1em;
	    	}
			#tree ul {
	    		list-style: none;
				padding-left: 2em;
	    	}
			#tree input {
				margin-right: .5em;
			}
			div.form li label {
				display:inline;
			}
		';
    $js = '
			$(document).ready(function(){
				$("#check_all").click(function(){
					$("#tree input").attr("checked", "checked");
					return false;
				});
				$("#uncheck_all").click(function(){
					$("#tree input").removeAttr("checked");
					return false;
				});
    			
			});
		';
    $cs->registerCss(__CLASS__ . '#form', $css);
    $cs->registerScript(__CLASS__ . '#form', $js);
    $content = "<div class=\"row fields\"><p><a href=\"#\" id=\"check_all\">" . CartModule::t('Check All') . "</a> | <a href=\"#\" id=\"uncheck_all\">" . CartModule::t('Uncheck All') . "</a></p><ul id=\"{$ulId}\">";
    //echo '<pre>'; print_r($model); die();
    if (isset($_POST[get_class($model)]['fields'])) {
        $setFields = $_POST[get_class($model)]['fields'];
    } elseif (count($setFields)) {
        $new = array();
        foreach ($setFields as $item) {
            $new[$item->id] = 1;
        }
        $setFields = $new;
    }
    foreach ($fields as $item) {
        $htmlOptions = array();
        if (count($setFields)) {
            if (isset($setFields[$item->id]) && $setFields[$item->id]) {
                $htmlOptions['checked'] = 'checked';
            }
        }
        /*
        		$htmlOptions['value'] = $item->id;
        		
            	if ($model->isNewRecord) {
        			if (isset($setCat[$item->id])&&$setCat[$item->id]) 
        				$htmlOptions['checked'] = 'checked';
            	} else {
        			if (isset($setCat[$item->id]->id))
        				$htmlOptions['checked'] = 'checked';
        		}//*/
        $content .= '<li>' . CHtml::activeCheckBox($model, "fields[" . $item->id . "]", $htmlOptions) . '' . CHtml::activeLabelEx($model, "fields[" . $item->id . "]", array('label' => $item->title)) . ' </li>';
    }
    $content .= '</ul></div>';
    return $content;
}
Exemplo n.º 21
0
</a>
					</div>
					<p class="help-block text-error" style="color:red"><?php 
echo $post->getError('blog_rubrics__id');
?>
</p>
				</div>
			</div>	
			<div class='clear'></div>
			<div class="form-group">
				<?php 
echo CHtml::activeLabelEx($post, 'can_comment', array('class' => 'col-md-3 control-label', 'style' => 'float:left;padding:5px;width:15%'));
?>
				<div class="col-md-9">
					<?php 
echo CHtml::activeCheckBox($post, 'can_comment');
?>
				</div> 
			</div>
			<div class='clear'></div>
			<div class="form-group">
				<?php 
echo CHtml::activeLabelEx($postLang, 'title', array('class' => 'col-md-3 control-label', 'style' => 'float:left;padding:5px;width:15%'));
?>
				<div class="col-md-9">
					<div class="input-icon right">
						<i class="fa fa-exclamation tooltips" style="color:#f3565d; display:none;" data-original-title="<?php 
echo $postLang->getError('title');
?>
" data-container="body"></i>
						<?php 
Exemplo n.º 22
0
<p class="note"><?php 
echo Yii::t('common', 'Fields with <span class="required">*</span> are required.');
?>
</p>

<?php 
echo CHtml::errorSummary($friendlyUrl);
?>

<?php 
if ($this->canUseDirectUrl) {
    ?>
    <div class="rowold no-mrg">
        <?php 
    echo CHtml::activeCheckBox($friendlyUrl, 'direct_url');
    echo '&nbsp;' . CHtml::activeLabelEx($friendlyUrl, 'direct_url', array('class' => 'noblock'));
    ?>
    </div>
<?php 
}
?>

<?php 
echo CHtml::hiddenField('canUseDirectUrl', $this->canUseDirectUrl ? 1 : 0);
$this->widget('application.modules.lang.components.langFieldWidget', array('model' => $friendlyUrl, 'field' => 'url', 'type' => 'string', 'note' => $friendlyUrl->prefixUrl));
?>
<br/>

<?php 
$this->widget('application.modules.lang.components.langFieldWidget', array('model' => $friendlyUrl, 'field' => 'title', 'type' => 'string'));
Exemplo n.º 23
0
</td>
          </tr>
          <tr>
            <td align="right">验证码:</td>
            <td>

				<?php 
echo CHtml::activeTextField($model, 'verifyCode', array('size' => 10, 'maxlength' => 10, 'autocomplete' => 'on', 'class' => 'text1'));
$this->widget('CCaptcha', array('showRefreshButton' => array('style' => 'padding-left:-20px;'), 'clickableImage' => true, 'imageOptions' => array('alt' => '点击换图', 'title' => '点击换图', 'style' => 'cursor:pointer;')));
?>
			</td>
          </tr>
           <tr>
            <td align="right"></td>
            <td><?php 
echo CHtml::activeCheckBox($model, 'rememberMe') . $form->label($model, 'rememberMe');
?>
  <a href="<?php 
echo Yii::app()->request->baseUrl;
?>
/email/">忘记密码</a></td>
          </tr>
          <tr>
            <td></td>
            <td><a href="<?php 
echo Yii::app()->request->baseUrl;
?>
/site/register/"><img  src="<?php 
echo Yii::app()->request->baseUrl;
?>
/images/zc.png" value="注册" /></a><input class="dl" type="image" src="<?php 
<?php 
echo CHtml::activeTextField($user, 'username');
echo CHtml::error($user, 'username');
?>
</div>

<div class="simple">
<?php 
echo CHtml::activeLabel($user, 'password');
?>

<?php 
echo CHtml::activePasswordField($user, 'password');
echo CHtml::error($user, 'password');
?>
</div>

<div class="action">
<?php 
if ($this->enableRememberMe) {
    echo CHtml::activeCheckBox($user, 'rememberMe');
    ?>
 Remember me next time<br/>
<?php 
}
echo CHtml::submitButton('Login');
?>
</div>

</form>
</div>
Exemplo n.º 25
0
 /**
  * Renders the typeahead 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 $this->inputType == 'radio' ? CHtml::activeRadioButton($this->model, $this->attribute, $this->htmlOptions) : CHtml::activeCheckBox($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo $this->inputType == 'radio' ? CHtml::radioButton($this->name, $this->value, $this->htmlOptions) : CHtml::checkBox($this->name, $this->value, $this->htmlOptions);
     }
 }
Exemplo n.º 26
0
		<?php 
    echo CHtml::activeTextField($form, 'login', array('placeholder' => 'Логин'));
    ?>
<br>
		<?php 
    echo CHtml::activePasswordField($form, 'password', array('placeholder' => 'Пароль'));
    ?>
<br>
		<?php 
    echo CHtml::activeEmailField($form, 'email', array('placeholder' => 'E-mail'));
    ?>
<br>
	</fieldset>
	<br>
	<label class="checkbox"><?php 
    echo CHtml::activeCheckBox($form, 'license');
    ?>
 Я принимаю условия <?php 
    echo CHtml::link('лицензионного соглашения', array('/site/license'), array('target' => '_blank'));
    ?>
</label><br>
	<br>
	<?php 
    echo CHtml::submitButton('Установить', array('class' => 'btn btn-primary'));
    ?>
<br>

	<?php 
    echo CHtml::endForm();
    ?>
Exemplo n.º 27
0
</th>
							<th><?php 
    echo Yii::t('admin', 'Email');
    ?>
</th>
							<th><?php 
    echo Yii::t('admin', 'Status');
    ?>
</th>
						</thead>
						<tbody>
							<?php 
    echo CHtml::beginForm($this->createUrl('admin/users'), "post");
    foreach ($all as $key => $user) {
        echo '<tr>
								<td>' . CHtml::activeCheckBox($form, 'user_' . $user->id) . '</td>
								<td>' . ($key + 1) . '</td>
								<td>' . CHtml::encode($user->nick) . '</td>
								<td>' . CHtml::encode($user->email) . '</td>
								<td>' . ($user->status == 1 ? Yii::t('admin', 'Activated') : Yii::t('admin', 'Not activated')) . '</td>
								</tr>';
    }
    ?>
							<tr>
								<td colspan="2">
									<?php 
    echo Yii::t('cams', 'Mass actions: ');
    ?>
								</td>
								<td><?php 
    echo CHtml::submitButton(Yii::t('admin', 'Activate'), array('name' => 'active', 'class' => 'btn btn-primary'));
Exemplo n.º 28
0
 /**
  * Renders the input field
  */
 public function renderField()
 {
     list($name, $id) = $this->resolveNameID();
     echo CHtml::openTag($this->tagName, array('id' => 'wrapper-' . $id));
     if ($this->hasModel()) {
         echo CHtml::activeCheckBox($this->model, $this->attribute, $this->htmlOptions);
     } else {
         echo CHtml::checkBox($name, $this->value, $this->htmlOptions);
     }
     echo CHtml::closeTag($this->tagName);
 }
Exemplo n.º 29
0
Arquivo: login.php Projeto: reubsc/sds
	</div>
	
	<div class="row">
		<p class="hint">
		<?php 
echo CHtml::link(Yii::t("UserModule.user", "Registration"), Yii::app()->user->registrationUrl);
?>
 | <?php 
echo CHtml::link(Yii::t("UserModule.user", "Lost Password?"), Yii::app()->user->recoveryUrl);
?>
		</p>
	</div>
	
	<div class="row rememberMe">
		<?php 
echo CHtml::activeCheckBox($model, 'rememberMe');
?>
		<?php 
echo CHtml::activeLabelEx($model, 'rememberMe');
?>
	</div>

	<div class="row submit">
		<?php 
echo CHtml::submitButton(Yii::t("UserModule.user", "Login"));
?>
	</div>
	
<?php 
echo CHtml::endForm();
?>
Exemplo n.º 30
0
echo $form->labelEx($model, 'meta_description');
?>
        <?php 
echo $form->textArea($model, 'meta_description', array('rows' => 6, 'cols' => 50));
?>
        <?php 
echo $form->error($model, 'meta_description');
?>
    </div>

    <div class="row">
        <?php 
echo $form->labelEx($model, 'public');
?>
        <?php 
echo CHtml::activeCheckBox($model, 'public');
?>
        <?php 
echo $form->error($model, 'public');
?>
    </div>

    <hr/>
    <div class="row">
        <p class="label">Создание галереи:</p>
        <p class="more_img"><?php 
echo $form->fileField($imageModel, 'filename[]');
?>
<span class="addPhoto">+</span>
        </p>
    </div>