public function renderInput($fieldName, $htmlOptions = array()) { $field = $this->getField($fieldName); if (!$field) { return; } if (isset($this->inputRenderer) && $this->inputRenderer instanceof FieldInputRenderer) { // check if there's a renderer for this field type if ($input = $this->inputRenderer->renderInput($field, $htmlOptions)) { return $input; } } return X2Model::renderModelInput($this->owner, $field, $htmlOptions); }
public function renderContactFields($model) { $defaultFields = X2Model::model('Fields')->findAllByAttributes(array('modelName' => 'Contacts'), array('condition' => "fieldName IN ('firstName', 'lastName', 'email', 'phone')")); $requiredFields = X2Model::model('Fields')->findAllByAttributes(array('modelName' => 'Contacts', 'required' => 1), array('condition' => "fieldName NOT IN ('firstName', 'lastName', 'phone', 'email', 'visibility')")); $i = 0; $fields = array_merge($requiredFields, $defaultFields); foreach ($fields as $field) { if ($field->type === 'boolean') { $class = ""; echo "<div>"; } else { $class = $field->fieldName === 'firstName' || $field->fieldName === 'lastName' ? 'quick-contact-narrow' : 'quick-contact-wide'; } $htmlAttr = array('class' => $class, 'tabindex' => 100 + $i, 'title' => $field->attributeLabel, 'id' => 'quick_create_' . $field->modelName . '_' . $field->fieldName); if ($field->type === 'boolean') { echo CHtml::label($field->attributeLabel, $htmlAttr['id']); } echo X2Model::renderModelInput($model, $field, $htmlAttr); if ($field->type === 'boolean') { echo "</div>"; } ++$i; } }
</div></div><?php echo '<br />'; echo CHtml::activeLabel($model, 'data'); echo CHtml::activeTextArea($model, 'data', array('id' => 'custom-field-template')); echo '<br />' . Yii::t('admin', 'The template defines how the field will be displayed in X2Engine. The type defines how to interpret the template. If the type is Formula, it will be interpreted as an X2Workflow formula.'); echo '<br /><br />'; break; } if ($model->type != 'timerSum') { $dummyFieldName = 'customized_field'; foreach ($model->getErrors('defaultValue') as $index => $message) { $dummyModel->addError('customized_field', $message); } echo CHtml::label($model->getAttributeLabel('defaultValue'), CHtml::resolveName($dummyModel, $dummyFieldName)); $model->fieldName = 'customized_field'; echo X2Model::renderModelInput($dummyModel, $model, array('id' => 'defaultValue-input-' . $model->type)); echo CHtml::error($dummyModel, 'customized_field'); } echo "<script id=\"input-clientscript-" . time() . "\">\n"; Yii::app()->clientScript->echoScripts(); echo "\n</script>"; ?> </div> <br> <?php if ($model->type != 'timerSum') { ?> <div class="row"> <?php echo $form->checkBox($model, 'required', array('id' => 'required'));
public function renderAssignment($field, array $htmlOptions = array()) { // enables custom multi-select menu for non-phonegap x2touch. Not needed for phonegap since // it uses a native multiselct if ($field->linkType === 'multiple' && !Yii::app()->params->isPhoneGap) { $htmlOptions['data-native-menu'] = 'false'; } return X2Model::renderModelInput($this->owner, $field, $htmlOptions); }
* * In accordance with Section 7(b) of the GNU Affero General Public License version 3, * 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->registerScriptFile(Yii::app()->controller->module->assetsUrl . '/js/SettingsController.js'); $this->onPageLoad("function () {\n x2.main.controllers['{$this->pageId}'] = new x2.SettingsController (" . CJSON::encode(array('translations' => array('changeUrlMessage' => Yii::t('app', 'Performing this action will log you out of X2CRM.'), 'changeUrlTitle' => 'Change web address?', 'changeUrlButtonConfirm' => 'Okay', 'changeUrlButtonCancel' => 'Back'))) . ");\n}"); ?> <div class='detail-view'> <?php $form = $this->beginWidget('MobileActiveForm'); ?> <div class="field-container"> <div class="field-label"><?php echo CHtml::encode($profile->getField('language')->attributeLabel); ?> </div> <div class="field-value"> <?php echo X2Model::renderModelInput($profile, $profile->getField('language'), array('class' => 'profile-language')); ?> </div> </div> <?php $this->endWidget(); ?> </div>