Наследование: extends skeeks\cms\relatedProperties\PropertyType
Пример #1
0
 public function init()
 {
     parent::init();
     //Название проекта.
     if (!$this->appName) {
         $this->appName = \Yii::$app->name;
     } else {
         \Yii::$app->name = $this->appName;
     }
     //Язык
     if ($this->languageCode) {
         \Yii::$app->language = $this->languageCode;
     } else {
         $this->languageCode = \Yii::$app->language;
     }
     if (\Yii::$app instanceof Application) {
     } else {
         $this->relatedHandlers = ArrayHelper::merge([PropertyTypeText::className() => ['class' => PropertyTypeText::className()], PropertyTypeNumber::className() => ['class' => PropertyTypeNumber::className()], PropertyTypeList::className() => ['class' => PropertyTypeList::className()], PropertyTypeFile::className() => ['class' => PropertyTypeFile::className()], PropertyTypeTree::className() => ['class' => PropertyTypeTree::className()], PropertyTypeElement::className() => ['class' => PropertyTypeElement::className()], UserPropertyTypeDate::className() => ['class' => UserPropertyTypeDate::className()], UserPropertyTypeComboText::className() => ['class' => UserPropertyTypeComboText::className()], UserPropertyTypeColor::className() => ['class' => UserPropertyTypeColor::className()], UserPropertyTypeSelectFile::className() => ['class' => UserPropertyTypeSelectFile::className()]], $this->relatedHandlers);
         //web init
         if (!$this->noImageUrl) {
             $this->noImageUrl = CmsAsset::getAssetUrl('img/image-not-found.jpg');
         }
         \Yii::$app->view->on(View::EVENT_BEGIN_PAGE, function (Event $e) {
             if (!\Yii::$app->request->isAjax && !\Yii::$app->request->isPjax) {
                 \Yii::$app->response->getHeaders()->setDefault('X-Powered-CMS', $this->descriptor->name . " {$this->descriptor->homepage}");
                 /**
                  * @var $view View
                  */
                 $view = $e->sender;
                 if (!isset($view->metaTags[self::$_huck])) {
                     $view->registerMetaTag(["name" => base64_decode(self::$_huck), "content" => $this->descriptor->name . " — {$this->descriptor->homepage}"], self::$_huck);
                 }
                 if (!isset($view->metaTags['cmsmagazine'])) {
                     $view->registerMetaTag(["name" => 'cmsmagazine', "content" => "7170fe3a42c6f80cd95fd8bce765333d"], 'cmsmagazine');
                 }
             }
         });
         \Yii::$app->user->on(\yii\web\User::EVENT_AFTER_LOGIN, function (UserEvent $e) {
             $e->identity->logged_at = \Yii::$app->formatter->asTimestamp(time());
             $e->identity->save(false);
             if (\Yii::$app->admin->requestIsAdmin) {
                 \Yii::$app->user->identity->updateLastAdminActivity();
             }
         });
     }
 }
Пример #2
0
 /**
  * @return string
  */
 public function renderConfigForm(ActiveForm $activeForm)
 {
     echo $activeForm->field($this, 'type')->radioList(\skeeks\cms\relatedProperties\userPropertyTypes\UserPropertyTypeDate::types());
 }
Пример #3
0
 /**
  * Пользовательские типы свойств.
  * @return array
  */
 public function userPropertyTypes()
 {
     return (array) ArrayHelper::merge([UserPropertyTypeDate::className() => (new UserPropertyTypeDate())->name, UserPropertyTypeComboText::className() => (new UserPropertyTypeComboText())->name, UserPropertyTypeColor::className() => (new UserPropertyTypeColor())->name, UserPropertyTypeSelectFile::className() => (new UserPropertyTypeSelectFile())->name], (array) $this->userPropertyTypes);
 }
Пример #4
0
<?php

/**
 * @author Semenov Alexander <*****@*****.**>
 * @link http://skeeks.com/
 * @copyright 2010 SkeekS (СкикС)
 * @date 09.06.2015
 */
use skeeks\cms\modules\admin\widgets\form\ActiveFormUseTab as ActiveForm;
$form = ActiveForm::begin();
?>
    <?php 
echo $form->field($model, 'type')->radioList(\skeeks\cms\relatedProperties\userPropertyTypes\UserPropertyTypeDate::types());
?>
    <?php 
echo $form->buttonsStandart($model);
ActiveForm::end();