public function actionIzmenitStatusKursa() { Yii::$app->response->format = \yii\web\Response::FORMAT_JSON; $response = new JsResponse(); $id = Yii::$app->request->post('id'); $status = Yii::$app->request->post('status'); $error = Kurs::isVariativnijRazdelHasError($id); if (!$error) { $kurs = Kurs::findOne($id); $kurs->statusProgrammy = $status; if (!$kurs->save()) { $response->type = JsResponse::ERROR; $response->msg = JsResponse::MSG_OPERATION_ERROR; } } else { $response->type = JsResponse::ERROR; $response->msg = 'Количество часов в блоках тем/дисциплинах вариативной части должно быть равным количеству часов первого блока тем/дисциплины вариативной части'; } return $response; }
public function getKursRel() { return $this->hasOne(Kurs::className(), ['id' => 'kurs'])->inverseOf('kursyFizLica'); }
public static function doesHaveProgram($kurs_id) { /** * @var Kurs $kurs */ $kurs = Kurs::find()->joinWith('razdelyKursaRel')->joinWith('kimRel')->joinWith('umkRel')->joinWith('kontroliruyushihKursaRel')->joinWith('temyDiplomnihRabotRel')->where(['kurs.id' => $kurs_id])->one(); if ($kurs->annotaciya != null or $kurs->aktualnost != null or $kurs->cel != null or $kurs->zadachi != null or $kurs->zadachi != null or $kurs->planiruemyeRezultaty != null or $kurs->formaItogovojAttestacii != null or $kurs->harakteristikaNovojKvalifikacii != null or $kurs->trebovaniya_k_urovnyu_podgotovki != null or $kurs->formaObucheniya != null or $kurs->informacionnyeUsloviya != null or $kurs->kadrovyeUsloviya != null or $kurs->uchebnometodicheskieUsloviya != null or $kurs->tehnicheskieUsloviya != null or $kurs->itogovayaAttestaciya != null or $kurs->rezhimZanyatij != null or $kurs->spisokLiteratury != null or $kurs->chasyItogovojAttestacii != null or $kurs->opisanieItogovojAttestacii != null or $kurs->nedelyaItogovojAttestacii != null or $kurs->harakteristikaNovojKvalifikacii != null or $kurs->sostaviteli != null or $kurs->recenzenti != null or $kurs->itogovayaAttestaciyaTekst != null or count($kurs->razdelyKursaRel) > 0 or count($kurs->kimRel) > 0 or count($kurs->umkRel) > 0 or count($kurs->kontroliruyushihKursaRel) > 0 or count($kurs->temyDiplomnihRabotRel) > 0) { return true; } else { return false; } }
<?php use app\entities\Kurs; use app\helpers\Html; use app\models\kurs_slushatelyu\ZapisNaKursForm; use app\widgets\KursSummary; /** * @var ZapisNaKursForm $model */ $kurs = Kurs::findOne($model->kurs); ?> <div class="jumbotron"> <h2>Вы отменили запись на курс «<?php echo $kurs->nazvanie; ?> » </h2> <?php echo KursSummary::widget(['model' => $kurs]); ?> <?php echo Html::returningA('Ок', ['class' => 'btn btn-primary btn-lg center-block']); ?> </div>
public function getKursyRukovoditelyaRel() { return $this->hasMany(Kurs::className(), ['rukovoditel' => 'id'])->inverseOf('rukovoditelRel'); }
}], ['format' => 'raw', 'value' => function ($kurs) { /* @var $kurs KursExtended */ $editLinkClass = ''; if ($kurs->statusProgrammy == StatusProgrammyKursa::ZAVERSHENA) { $editLinkClass = ' hidden'; } $result = Html::a('Редактор', ['/kurs/edit', 'id' => $kurs->id], ['class' => 'btn btn-primary' . $editLinkClass]) . Html::tag('p', '', ['class' => $editLinkClass]) . Html::button('Сделать копию', ['class' => 'btn btn-primary', 'ng-click' => 'main.copyProgram(' . $kurs->id . ')']) . Html::tag('p') . Html::button('Удалить программу', ['class' => 'btn btn-primary', 'ng-click' => 'main.deleteProgram(' . $kurs->id . ')']); /* @var $kurs2 Kurs */ $kurs2 = Kurs::findOne($kurs->id); if ($kurs2 && $kurs2->allowsZanyatiyaChange()) { $raspBtn = Html::a('Расписание', ['/upravlenie-kursami/raspisanie/zanyatie', 'kurs' => $kurs->id], ['class' => 'btn btn-primary']); $result .= Html::tag('p') . $raspBtn; } return $result; }]]]); $years = ArrayHelper::map(\app\entities\Kurs::find()->select(['EXTRACT(YEAR FROM plan_prospekt_god) as year'])->distinct()->orderBy('year')->where(['rukovoditel' => Yii::$app->user->fizLico->id])->asArray()->all(), 'year', 'year'); ?> <div id="copying-form" class="copying-form" ng-controller="CopyingController as copying" ng-show="copying.isShow"> <div class="form-group"> <div class="inline-block"> <label for="plan_prospekt_years">Выберите год</label> <?php echo Html::dropDownList('plan_prospekt_years', null, $years, ['id' => 'plan_prospekt_years', 'class' => 'form-control', 'ng-model' => 'copying.year']); ?> </div> <!-- <button ng-click="copying.loadKursy()" class="btn btn-primary inline-block vbottom">Загрузить доступные программы</button>--> <h4 ng-show="copying.kursy[copying.year].length>0">Выберите курс из списка</h4> <div id="plan_prospekts" ng-repeat="kurs in copying.kursy[copying.year]"> <div class="kurs" ng-class="kurs.id == copying.to ? 'chosen_kurs' : ''" ng-click="copying.chooseKurs(kurs.id)"> {{$index+1}}. {{kurs.nazvanie}}
use app\widgets\DeprecatedDatePicker; use app\widgets\KursSummary; use app\widgets\PasportNomerInput; use app\widgets\SwitchingFields; use app\widgets\TouchSpin; use kartik\widgets\ActiveForm; use app\helpers\Html; use kartik\widgets\Select2; use yii\widgets\MaskedInput; /** * @var ZapisNaKursForm $model * @var $this yii\web\View */ $this->title = 'Запись на курс в БРИОП'; $form = ActiveForm::begin(['fieldConfig' => ['template' => "{label}\n<div class=\"col-md-8\">\n{input}\n{hint}\n{error}\n</div>", 'labelOptions' => ['class' => 'control-label col-md-4']]]); $kursEntity = Kurs::findOne($kurs); ?> <h2>Запись на курс «<?php echo $kursEntity->nazvanie; ?> » </h2> <?php echo KursSummary::widget(['model' => $kursEntity]); ?> <div class="row"> <div class="col-md-5 form-horizontal"> <div class="fields-group-heading">
public function actionDeleteProgram() { Yii::$app->response->format = Response::FORMAT_JSON; $kurs_id = Yii::$app->request->post('kurs_id'); $response = new JsResponse(); /** * @var FuncResponse $deleting */ $deleting = Kurs::deleteProgram($kurs_id); $response->type = $deleting->type; $response->msg = $deleting->msg; return $response; }
private function sendSuccessfulEmail($fizLico, $kursId) { $kurs = Kurs::findOne($kursId); $message = Yii::$app->mailer->compose('kurs-slushatelyu/registraciya', compact('fizLico', 'kurs'))->setTo($fizLico->email); return $message->send(); }
/** * @inheritdoc */ public static function find() { $cols = ['{{kurs}}.*', 'zapisanoSlushatelej' => 'coalesce(count({{slushatel}}.[[id]]),0)', 'isUserZapisan' => self::userZapisanCond(), 'userStatusKursa' => 'kurs_tek_polzovatelya.status']; return parent::find()->select($cols)->joinWith(['slushateliRel' => function ($q) { $q->from(['slushatel' => 'fiz_lico']); }])->joinWith(['kursyFizLicaRel' => function ($q) { $q->from(['kurs_tek_polzovatelya' => 'kurs_fiz_lica'])->onCondition(['kurs_tek_polzovatelya.fiz_lico' => Val::of(Yii::$app->user->fizLico, 'id')]); }])->groupBy(['kurs.id', 'kurs_tek_polzovatelya.id'])->with('rukovoditelRel', 'kategoriiSlushatelejRel'); }