Example #1
1
 public function actionPrintRaspisanie()
 {
     if (!isset($_GET['kurs'])) {
         throw new ErrorException('Kurs is required');
     }
     $kurs_id = $_GET['kurs'];
     $schedule = [];
     $sql = 'select
                 z.data,
                 z.nomer,
                 t.nazvanie as tema,
                 z.forma,
                 fl.familiya,
                 fl.imya,
                 fl.otchestvo,
                 a.nazvanie as auditoriya,
                 rpt.nazvanie as tip_rabot
             from zanyatie as z
             inner join zanyatie_chasti_temy as zct on z.id = zct.zanyatie
             inner join tema as t on zct.tema = t.id
             inner join podrazdel_kursa as pk on t.podrazdel = pk.id
             inner join razdel_kursa as rk on pk.razdel = rk.id
             inner join auditoriya as a on z.auditoriya = a.id
             inner join fiz_lico as fl on z.prepodavatel = fl.id
             inner join rabota_po_teme as rpt on t.tip_raboty = rpt.id
             where rk.kurs = :kurs_id
             order by z.data, z.nomer';
     $data = Yii::$app->db->createCommand($sql)->bindValue(':kurs_id', $kurs_id)->queryAll();
     foreach ($data as $item) {
         if (!isset($schedule[$item['data']])) {
             $schedule[$item['data']] = [];
         }
         $schedule[$item['data']][] = $item;
     }
     $kurs = \app\records\Kurs::findOne($kurs_id);
     $content = $this->renderPartial('/pdf/raspisanie.php', ['kurs' => $kurs, 'schedule' => $schedule]);
     $pdf = new Pdf($this->getPdfSeetings($content, 'Расписание курса "' . $kurs->nazvanie . '"'));
     // return the pdf output as per the destination setting
     return $pdf->render();
 }
Example #2
0
 public function actionIndex($kurs)
 {
     // todo can rule
     $kursRecord = Kurs::findOne($kurs);
     if (!$kursRecord) {
         throw new NotFoundHttpException();
     }
     $query = Slushatel::findForKurs($kurs)->orderBy(['kurs_fiz_lica.status' => SORT_ASC, 'fiz_lico.familiya' => SORT_ASC, 'fiz_lico.imya' => SORT_ASC, 'fiz_lico.otchestvo' => SORT_ASC]);
     $provider = new ActiveDataProvider(['query' => $query, 'pagination' => false]);
     return $this->render('index', compact('provider', 'kursRecord'));
 }