예제 #1
0
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'actions' => ['index', 'view', 'changestatus', 'changeformat', 'export', 'statistics', 'exportall'], 'roles' => [User::USER_GROUP_MODERATOR, User::USER_GROUP_ADMIN]]]], 'excelExport' => ['class' => ExcelexportBehavior::className(), 'dataTitle' => 'Доклады', 'nStartRow' => 1, 'columnTitles' => ['Тема', 'Тип', 'Конференция', 'Секция', 'Лидер', 'Email', 'Телефон', 'Организация', 'Класс / должность', 'Согласование', 'Формат', 'Описание', 'Создан', 'Участники', 'Руководители', 'Файл'], 'columnWidth' => [30, 20, 30, 30, 30, 20, 20, 40, 20, 20, 20, 60, 20, 30, 30, 20], 'columnValues' => ['doc_subject', function ($model, $index) {
         /** @var Doclad $model */
         //                        Yii::info('Raw: ' . $index . ' + ' . $model->doc_subject);
         return $model->typeTitle();
     }, function ($model, $index) {
         /** @var Doclad $model */
         return $model->section->conference->cnf_title;
     }, function ($model, $index) {
         /** @var Doclad $model */
         return $model->section->sec_title;
     }, function ($model, $index) {
         /** @var Doclad $model */
         return $model->getLeadername(false);
     }, 'doc_lider_email', 'doc_lider_phone', 'doc_lider_org', function ($model, $index) {
         /** @var Doclad $model */
         return $model->doc_type == Doclad::DOC_TYPE_PERSONAL ? $model->doc_lider_group : $model->doc_lider_position . ' / ' . $model->doc_lider_lesson;
     }, 'status', 'format', 'doc_description', function ($model, $index) {
         /** @var Doclad $model */
         return date('d.m.Y H:i', strtotime($model->doc_created));
     }, function ($model, $index) {
         /** @var Doclad $model */
         $sValue = '';
         if (count($model->members) > 0) {
             $sValue = implode("\n", ArrayHelper::map($model->members, 'prs_id', function ($ob, $default) {
                 /** @var $ob app\models\Person */
                 return $ob->getPersonname(false) . ' ' . $ob->prs_org;
             }));
         }
         return $sValue;
     }, function ($model, $index) {
         /** @var Doclad $model */
         $sValue = '';
         if (count($model->persons) > 0) {
             $sValue = implode("\n", ArrayHelper::map($model->persons, 'prs_id', function ($ob, $default) {
                 /** @var $ob app\models\Person */
                 return $ob->getPersonname(false) . ' ' . $ob->prs_email . ' ' . $ob->prs_org;
             }));
         }
         return $sValue;
     }, function ($model, $index) {
         /** @var Doclad $model */
         $sValue = '';
         $aFiles = $model->files;
         if (count($aFiles) > 0) {
             $sValue = array_reduce($aFiles, function ($sRes, $item) {
                 /** @var File $item */
                 $s = basename(str_replace('\\', '/', $item->file_name));
                 return $s . ($sRes != '' ? "\n" : '') . $sRes;
             }, '');
         }
         return $sValue;
     }]]];
 }
예제 #2
0
 public function behaviors()
 {
     return ['access' => ['class' => AccessControl::className(), 'rules' => [['allow' => true, 'actions' => ['index', 'view', 'export'], 'roles' => [User::USER_GROUP_MODERATOR]]]], 'excelExport' => ['class' => ExcelexportBehavior::className(), 'dataTitle' => 'Гости', 'nStartRow' => 1, 'columnTitles' => ['Конференция', 'Секция', 'ФИО', 'Email', 'Организация', 'Должность'], 'columnWidth' => [30, 30, 30, 20, 40, 30], 'columnValues' => [function ($model, $index) {
         /** @var Person $model */
         return $model->section->conference->cnf_title;
     }, function ($model, $index) {
         /** @var Person $model */
         return $model->section->sec_title;
     }, function ($model, $index) {
         /** @var Person $model */
         return $model->getPersonname(false);
     }, 'prs_email', 'prs_org', function ($model, $index) {
         /** @var Person $model */
         $s = $model->prs_position;
         $s .= ($s != '' && $model->prs_lesson != '' ? ' / ' : '') . $model->prs_lesson;
         return $s;
     }]]];
 }