Example #1
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // set titles
     $this->setCreateTitle(Yii::t('kalibao.backend', 'mail_mail_template_create_title'));
     $this->setUpdateTitle(Yii::t('kalibao.backend', 'mail_mail_template_update_title'));
     // models
     $models = $this->getModels();
     // language
     $language = $this->getLanguage();
     // get drop down list methods
     $dropDownList = $this->getDropDownList();
     // upload config
     $uploadConfig['main'] = $this->uploadConfig[(new \ReflectionClass($models['main']))->getName()];
     // set items
     $items = [];
     if (!$models['main']->isNewRecord) {
         $items[] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'id', 'value' => $models['main']->id]);
     }
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'mail_template_group_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'mail_template_group_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-add-action' => Url::to('/mail/mail-template-group/create'), 'data-update-action' => Url::to('/mail/mail-template-group/update'), 'data-update-argument' => 'id', 'data-related-field' => '.link_mail_template_group_title', 'data-text' => !empty($models['main']->mail_template_group_id) ? MailTemplateGroupI18n::findOne(['mail_template_group_id' => $models['main']->mail_template_group_id, 'i18n_id' => $language])->title : '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'html_mode', 'type' => 'activeCheckbox', 'options' => ['class' => '', 'label' => '']]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'sql_request', 'type' => 'activeTextarea', 'options' => ['class' => 'form-control input-sm', 'placeholder' => $models['i18n']->getAttributeLabel('sql_request')]]);
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'sql_param', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('sql_param')]]);
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'object', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('object')]]);
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'message', 'type' => 'activeTextarea', 'options' => ['class' => 'form-control input-sm wysiwyg-textarea', 'data-ckeditor-language' => $language]]);
     if (!$models['main']->isNewRecord) {
         $items[] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'created_at', 'value' => Yii::$app->formatter->asDatetime($models['main']->created_at, I18N::getDateFormat())]);
     }
     if (!$models['main']->isNewRecord) {
         $items[] = new SimpleValueField(['model' => $models['main'], 'attribute' => 'updated_at', 'value' => Yii::$app->formatter->asDatetime($models['main']->updated_at, I18N::getDateFormat())]);
     }
     $this->setItems($items);
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // get model
     $model = $this->getModel();
     // language
     $language = $this->getLanguage();
     // get drop down list methods
     $dropDownList = $this->getDropDownList();
     // set titles
     $this->setTitle(Yii::t('kalibao.backend', 'mail_mail_template_list_title'));
     // set head attributes
     $this->setGridHeadAttributes(['mail_template_group_i18n_title' => true, 'mail_template_i18n_object' => true, 'mail_template_i18n_message' => true]);
     // set head filters
     $this->setGridHeadFilters([new InputField(['model' => $model, 'attribute' => 'mail_template_group_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'mail_template_group_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->mail_template_group_id) ? MailTemplateGroupI18n::findOne(['mail_template_group_id' => $model->mail_template_group_id, 'i18n_id' => $language])->title : '']]), new InputField(['model' => $model, 'attribute' => 'mail_template_i18n_object', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'mail_template_i18n_message', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]])]);
     // set advanced filters
     $this->setAdvancedFilters([new InputField(['model' => $model, 'attribute' => 'id', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'mail_template_group_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'mail_template_group_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-text' => !empty($model->mail_template_group_id) ? MailTemplateGroupI18n::findOne(['mail_template_group_id' => $model->mail_template_group_id, 'i18n_id' => $language])->title : '']]), new InputField(['model' => $model, 'attribute' => 'html_mode', 'type' => 'activeDropDownList', 'data' => $dropDownList('checkbox-drop-down-list'), 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'class' => 'form-control input-sm']]), new InputField(['model' => $model, 'attribute' => 'sql_request', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'sql_param', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'mail_template_i18n_object', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new InputField(['model' => $model, 'attribute' => 'mail_template_i18n_message', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'placeholder' => Yii::t('kalibao', 'input_search')]]), new DateRangeField(['model' => $model, 'attribute' => 'created_at', 'start' => new InputField(['model' => $model, 'attribute' => 'created_at_start', 'type' => 'activeTextInput', 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'maxlength' => true, 'class' => 'form-control input-sm date-picker date-range']]), 'end' => new InputField(['model' => $model, 'attribute' => 'created_at_end', 'type' => 'activeTextInput', 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'maxlength' => true, 'class' => 'form-control input-sm date-picker date-range']])]), new DateRangeField(['model' => $model, 'attribute' => 'updated_at', 'start' => new InputField(['model' => $model, 'attribute' => 'updated_at_start', 'type' => 'activeTextInput', 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'maxlength' => true, 'class' => 'form-control input-sm date-picker date-range']]), 'end' => new InputField(['model' => $model, 'attribute' => 'updated_at_end', 'type' => 'activeTextInput', 'options' => ['placeholder' => Yii::t('kalibao', 'input_search'), 'maxlength' => true, 'class' => 'form-control input-sm date-picker date-range']])])]);
 }
 /**
  * @inheritdoc
  */
 public function init()
 {
     parent::init();
     // models
     $models = $this->getModels();
     // language
     $language = $this->getLanguage();
     // get drop down list methods
     $dropDownList = $this->getDropDownList();
     // upload config
     $uploadConfig['main'] = $this->uploadConfig[(new \ReflectionClass($models['main']))->getName()];
     // set items
     $items = [];
     $items[] = new InputField(['model' => $models['main'], 'attribute' => 'mail_template_group_id', 'type' => 'activeHiddenInput', 'options' => ['class' => 'form-control input-sm input-ajax-select', 'data-action' => Url::to(['advanced-drop-down-list', 'id' => 'mail_template_group_i18n.title']), 'data-allow-clear' => 1, 'data-placeholder' => Yii::t('kalibao', 'input_select'), 'data-add-action' => Url::to('/mail/mail-template-group/create'), 'data-update-action' => Url::to('/mail/mail-template-group/update'), 'data-update-argument' => 'id', 'data-related-field' => '.link_mail_template_group_title', 'data-text' => !empty($models['main']->mail_template_group_id) ? MailTemplateGroupI18n::findOne(['mail_template_group_id' => $models['main']->mail_template_group_id, 'i18n_id' => $language])->title : '']]);
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'object', 'type' => 'activeTextInput', 'options' => ['class' => 'form-control input-sm', 'maxlength' => true, 'placeholder' => $models['main']->getAttributeLabel('object')]]);
     $items[] = new InputField(['model' => $models['i18n'], 'attribute' => 'message', 'type' => 'activeTextarea', 'options' => ['class' => 'form-control input-sm wysiwyg-textarea', 'data-ckeditor-language' => $language]]);
     $this->setItems($items);
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getMailTemplateGroupI18ns()
 {
     return $this->hasMany(MailTemplateGroupI18n::className(), ['mail_template_group_id' => 'mail_template_group_id']);
 }