Exemple #1
0
 /**
  * @param ChastTemy $chastTemy
  * @return string
  */
 private function renderChastTemy($chastTemy)
 {
     $tema = $chastTemy->tema;
     if (!$this->filter->filterTema($tema)) {
         return '';
     }
     $numbers = [ArrayHelper::getValue($tema, 'podrazdel_rel.razdel_rel.nomer'), ArrayHelper::getValue($tema, 'podrazdel_rel.nomer'), $tema->nomer];
     $inPotokEm = $chastTemy->getIsInPotok() ? Html::tag('em', 'в потоке', ['class' => 'label label-warning label-in-potok']) : '';
     $nazvanieDiv = Html::tag('div', $this->renderNumbered($this->nazvanieChastiTemy($chastTemy), $numbers) . $inPotokEm, ['class' => 'col-md-7']);
     /* @var $formatter Formatter */
     $formatter = Yii::$app->formatter;
     /* @var $prepodavatel FizLico */
     $prepodavatel = $this->prepodavatelChastiTemy($chastTemy);
     $prepodavatelContent = '';
     if ($prepodavatel) {
         $podrazdelenie = ArrayHelper::getValue($prepodavatel, 'pervoe_strukturnoe_podrazdelenie_briop');
         $podrazdelenieSpan = Html::tag('span', ArrayHelper::getValue($podrazdelenie, 'sokrashennoe_nazvanie') ?: ArrayHelper::getValue($podrazdelenie, 'nazvanie'), ['class' => 'podrazdelenie']);
         $prepodavatelContent = $formatter->asFizLico($prepodavatel) . "\n" . $podrazdelenieSpan;
     }
     $prepodavatelDiv = Html::tag('div', $prepodavatelContent, ['class' => 'col-md-2']);
     $vidZanyatiyaDiv = Html::tag('div', ArrayHelper::getValue($tema, 'tip_raboty_rel.nazvanie'), ['class' => 'col-md-2']);
     $nedelyaDiv = Html::tag('div', $formatter->asInteger($tema->nedelya) . ' нед.', ['class' => 'col-md-1']);
     $options = ['class' => 'row tema-picker-item', 'data-id' => $tema->id, 'data-chast' => $chastTemy->chast];
     return Html::tag('div', $nazvanieDiv . $vidZanyatiyaDiv . $prepodavatelDiv . $nedelyaDiv, $options);
 }
Exemple #2
0
 public function actionIndex($kurs)
 {
     $kursRecord = Kurs::findOne($kurs);
     if (!$kursRecord) {
         throw new NotFoundHttpException();
     }
     $filter = new TemaFilter();
     $filter->load(Yii::$app->request->get());
     if (!$filter->validate()) {
         $filter = new TemaFilter();
     }
     $temySettings = function (ActiveQuery $q) {
         $q->orderBy('tema.nomer');
     };
     $podrazdelySettings = function (ActiveQuery $q) {
         $q->orderBy('nomer');
     };
     $query = $kursRecord->getRazdely_kursa_rel()->orderBy('nomer')->with(['nazvanie_rel', 'podrazdely_rel' => $podrazdelySettings, 'podrazdely_rel.temy_with_unused_chasti_rel' => $temySettings, 'podrazdely_rel.temy_with_unused_chasti_rel.prepodavatel_fiz_lico_rel']);
     return TemaPickerContent::widget(['data' => $query->all(), 'filter' => $filter]);
 }