* * You can contact X2Engine, Inc. P.O. Box 66752, Scotts Valley, * California 95067, USA. or at email address contact@x2engine.com. * * The interactive user interfaces in modified source and object code versions * of this program must display Appropriate Legal Notices, as required under * Section 5 of the GNU Affero General Public License version 3. * * 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". *****************************************************************************************/ // default view parameters $modelList = !isset($modelList) ? Fields::getDisplayedModelNamesList() : $modelList; $actionModel = !isset($actionModel) ? $model : $actionModel; Yii::app()->clientScript->registerCss('actionsFormCss', "\n #Actions_actionDescription {\n box-sizing: border-box;\n }\n"); $themeUrl = Yii::app()->theme->getBaseUrl(); $backdating = !(Yii::app()->user->checkAccess('ActionsAdmin') || Yii::app()->settings->userActionBackdating); ?> <div class="form" id="action-form"> <?php $form = $this->beginWidget('X2ActiveForm', array('id' => 'actions-newCreate-form', 'namespace' => isset($namespace) ? $namespace : '', 'enableAjaxValidation' => false)); echo $form->errorSummary($actionModel); ?> <div class="row"> <b><?php echo $form->labelEx($actionModel, 'subject'); ?> </b>
/** * Calls renderInput for model and input type with given names and returns the result. */ public function actionGetX2ModelInput($modelName, $fieldName) { if (!isset($modelName) || !isset($fieldName)) { throw new CHttpException(400, 'modelName or fieldName not set'); return; } $model = X2Model::model($modelName); if (!$model) { throw new CHttpException(400, 'Invalid model name'); return; } $field = $model->getField($fieldName); if (!$model) { throw new CHttpException(400, 'Invalid field name'); return; } $input = ''; if ($fieldName == 'associationName') { $input .= CHtml::activeDropDownList($model, 'associationType', array_merge(array('none' => Yii::t('app', 'None'), 'calendar' => Yii::t('calendar', 'Calendar')), Fields::getDisplayedModelNamesList()), array('ajax' => array('type' => 'POST', 'url' => CController::createUrl('/actions/actions/parseType'), 'update' => '#', 'data' => 'js:$(this).serialize()', 'success' => 'function(data){ if(data){ $("#auto_select").autocomplete("option","source",data); $("#auto_select").val(""); $("#auto_complete").show(); }else{ $("#auto_complete").hide(); } }'))); $input .= "<div id='auto_complete' style='display: none'>"; $input .= $this->widget('zii.widgets.jui.CJuiAutoComplete', array('name' => 'auto_select', 'value' => $model->associationName, 'source' => $model->associationType !== 'Calendar' ? $this->createUrl(X2Model::model($modelName)->autoCompleteSource) : '', 'options' => array('minLength' => '2', 'select' => 'js:function( event, ui ) { $("#' . CHtml::activeId($model, 'associationId') . '").val(ui.item.id); $(this).val(ui.item.value); return false; }')), true); $input .= "</div>"; } else { $input .= $model->renderInput($fieldName); } // force loading of scripts normally rendered in view $input .= '<br /><br /><script id="x2-model-render-input-scripts">' . "\n"; if (isset(Yii::app()->clientScript->scripts[CClientScript::POS_READY])) { foreach (Yii::app()->clientScript->scripts[CClientScript::POS_READY] as $id => $script) { if (strpos($id, 'logo') === false) { $input .= "{$script}\n"; } } } $input .= "</script>"; $response = array('input' => $input, 'field' => array('type' => $field->type)); echo CJSON::encode($response); }
<?php $form = $this->beginWidget('CActiveForm', array('id' => 'criteria-form', 'enableAjaxValidation' => false)); ?> <em><?php echo Yii::t('app', 'Fields with <span class="required">*</span> are required.'); ?> </em><br> <div class="row"> <?php echo $form->labelEx($model, 'modelType'); ?> <?php echo $form->dropDownList($model, 'modelType', Fields::getDisplayedModelNamesList(), array('empty' => Yii::t('admin', 'Select a model'), 'ajax' => array('type' => 'POST', 'url' => $this->createUrl('/admin/getAttributes', array('criteria' => 1)), 'update' => '#' . CHtml::activeId($model, 'modelField')))); ?> <?php echo $form->error($model, 'modelType'); ?> </div> <div class="row"> <?php echo $form->labelEx($model, 'modelField'); ?> <?php echo $form->dropDownList($model, 'modelField', array(), array('empty' => Yii::t('admin', 'Select a model first'))); ?> <?php echo $form->error($model, 'modelField');