/** * @param View $view * @param KursExtended $kursRecord * @param mixed $tip * @return string */ function renderRazdelyTipa($view, $kursRecord, $tip) { $ret = ''; $query = $kursRecord->getRazdelyKursaRel()->orderBy('nomer')->where(['tip' => TipRazdelaKursa::asSql($tip)]); foreach ($query->all() as $razdelRecord) { $ret .= $view->render('_razdel-kursa', compact('razdelRecord')); } return $ret; }
public function search($tip, $data) { /** * @var EntityQuery $query */ $query = KursExtended::findTip($tip); $query->orderBy('least([[ochnoe_nachalo]], [[zaochnoe_nachalo]])'); if ($this->load($data) && $this->validate()) { if ($this->kategoriiSlushatelej) { $query->joinWith('kategoriiSlushatelejRel')->andWhere(['kategoriya_slushatelya.id' => $this->kategoriiSlushatelej]); } $query->andFilterWhere(['and', ['like', 'kurs.nazvanie', $this->nazvanie], ['kurs.rukovoditel' => $this->rukovoditel], ['kurs.raschitano_chasov' => $this->chasy], ['kurs.plan_prospekt_god' => $this->planProspektGod]]); if ($this->nachalo || $this->konec) { $nach = self::dateToQuotedSql($this->nachalo, true); $kon = self::dateToQuotedSql($this->konec); $query->andWhere("(coalesce(least(ochnoe_nachalo, zaochnoe_nachalo),'-infinity') <= {$kon})" . " and ({$nach} <= coalesce(greatest(ochnoe_konec, zaochnoe_konec),'infinity'))"); } } return new ActiveDataProvider(['query' => $query, 'sort' => false]); }
public function actionSpisok($god = null) { $employees = KursGlobals::get_sotrudniki(); $data = new ActiveDataProvider(['query' => KursExtended::findMyAsRukovoditel()->andFilterWhere(['plan_prospekt_god' => $god])->orderBy('id'), 'key' => 'hashids', 'sort' => false]); return $this->render('spisok', compact('data', 'employees')); }
private function actionIsAvailable($kurs, $action) { /* @var $kursRecord KursExtended */ $kursRecord = KursExtended::find()->where(['kurs.id' => $kurs])->one(); if (!$kursRecord || $kursRecord->getAvailableAction()[0] !== $action) { return false; } return true; }