Exemplo n.º 1
0
 /**
  * Lists all Lesson models.
  * @return mixed
  */
 public function actionIndex()
 {
     if (isset(Yii::$app->request->get()['group'])) {
         $group = Yii::$app->request->get()['group'];
         return $this->render('group', ['group' => $group]);
     }
     if (isset(Yii::$app->request->get()['teacher'])) {
         $teacher = Yii::$app->request->get()['teacher'];
         return $this->render('teacher', ['teacher' => $teacher]);
     }
     $teachers = \common\models\Teacher::find()->all();
     $groups = \common\models\Group::find()->all();
     $teacherRequest = null;
     $groupRequest = null;
     if (Yii::$app->request->isAjax) {
         //$teacher = Yii::$app->request->post()['teacher_name'];
         if (isset(Yii::$app->request->post()['teacher_fullname'])) {
             $searchTeacher = new \frontend\models\TeacherSearch();
             $teacherRequest = Yii::$app->request->post()['teacher_fullname'];
             $dataProviderTeacher = $searchTeacher->search(['TeacherSearch' => ['fullname' => $teacherRequest]]);
             $teachers = $dataProviderTeacher->getModels();
         }
         if (isset(Yii::$app->request->post()['group_name'])) {
             $searchGroup = new \frontend\models\GroupSearch();
             $groupRequest = Yii::$app->request->post()['group_name'];
             $dataProviderGroup = $searchGroup->search(['GroupSearch' => ['name' => $groupRequest]]);
             $groups = $dataProviderGroup->getModels();
         }
         //$teachers = json_encode();
         //return $this->render('index',['teachers' => $teachers, 'groups' => $groups]);
     }
     return $this->render('index', ['teachers' => $teachers, 'groups' => $groups, 'teacherRequest' => $teacherRequest, 'groupRequest' => $groupRequest]);
 }
Exemplo n.º 2
0
 public function actionIndex()
 {
     $this->layout = 'bjui';
     $query = Group::find();
     $models = $query->where(['pid' => 0])->with('groups')->all();
     $assignmentModels = [];
     $user = YII::$app->user;
     $authManager = Yii::$app->getAuthManager();
     foreach ($models as $key => $model) {
         $isAccess = $authManager->checkAccess($user->getId(), $model->name);
         if ($isAccess) {
             array_push($assignmentModels, $model);
         } else {
             $groups = $model->groups;
             $isAccessGroups = false;
             foreach ($groups as $k => $group) {
                 $isAccess = $authManager->checkAccess($user->getId(), $group->name);
                 if ($isAccess) {
                     $isAccessGroups = true;
                 } else {
                     unset($groups[$k]);
                 }
             }
             if ($isAccessGroups) {
                 //$model->setGroups($groups);
                 array_push($assignmentModels, $model);
             }
         }
     }
     return $this->render('index', ['models' => $models, 'user' => $user, 'authManager' => $authManager]);
 }
 /**
  * Finds the group model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return group the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Group::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 4
0
 public function actionNodeDrop($id)
 {
     $model = Group::findOne($id);
     $model->attributes = Yii::$app->request->get();
     if (Yii::$app->request->get('movetype') == 'inner') {
     }
     if ($model->save()) {
         return $this->ok('转移成功');
     } else {
         return $this->error('转移失败');
     }
 }
Exemplo n.º 5
0
 /**
  * Renders the index view for the module
  * @return string
  */
 public function actionChangeGroup()
 {
     $count = 0;
     foreach (Object::find()->all() as $object) {
         /** @var $object Object */
         $group = Group::find()->where(['name' => mb_substr($object->name, 0, 1)])->one();
         if ($group) {
             \Yii::$app->db->createCommand()->update('object', ['group_id' => $group->id], ['id' => $object->id])->execute();
             $count++;
         }
     }
     echo "done - {$count}\n";
 }
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Group::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'parent_id' => $this->parent_id]);
     $query->andFilterWhere(['like', 'name', $this->name]);
     return $dataProvider;
 }
Exemplo n.º 7
0
 /**
  * Renders the index view for the module
  * @return string
  */
 public function actionIndex()
 {
     $data = [];
     foreach (Group::find()->all() as $group) {
         /* @var $group Group */
         $childs = [];
         foreach ($group->objects as $object) {
             /* @var $object Object */
             $childs[] = ['title' => trim($object->name), 'folder' => true, 'expanded' => false, 'key' => 'o-' . $object->id, 'children' => [['title' => 'Информация', 'key' => 'i-' . $object->id], ['title' => 'Документы', 'key' => 'd-' . $object->id]]];
         }
         $data[] = ['title' => $group->name, 'folder' => true, 'expanded' => true, 'key' => 'g-' . $group->id, 'children' => $childs];
     }
     return $this->render('index', ['data' => KskObjectDataHelper::getData()]);
 }
Exemplo n.º 8
0
 public function saveGroup()
 {
     $cleanUrl = preg_replace("/[^a-zA-Z0-9\\/_|+ -]/", '', $this->name);
     $cleanUrl = strtolower(trim($cleanUrl, '-'));
     $cleanUrl = preg_replace("/[\\/_|+ -]+/", '-', $cleanUrl);
     $this->url = $cleanUrl;
     $urlExists = Group::findOne(['url' => $cleanUrl]);
     if ($urlExists) {
         if ($this->isNewRecord) {
             $lastGroup = Group::find()->orderBy(['id' => SORT_DESC])->one();
             $this->url = $lastGroup->id++ . '-' . $this->url;
         } else {
             if ($urlExists->id !== $this->id) {
                 $this->url = $this->id . '-' . $this->url;
             }
         }
     }
     if (!$this->save()) {
         return false;
     }
     $tags = explode(',', str_replace(['[', ']', '\''], ['', '', ''], $this->tag));
     foreach ($tags as $tag) {
         $newTag = Tag::findOne(['name' => strtolower($tag)]);
         if (!$newTag) {
             $newTag = new Tag();
             $newTag->name = strtolower($tag);
             if ($newTag->save()) {
                 $tagToGroup = new TagToGroup();
                 $tagToGroup->tag_id = $newTag->id;
                 $tagToGroup->group_id = $this->id;
                 $tagToGroup->save();
             }
         } else {
             $tagToGroup = new TagToGroup();
             $tagToGroup->tag_id = $newTag->id;
             $tagToGroup->group_id = $this->id;
             $tagToGroup->save();
         }
     }
     $userToGroup = new UserToGroup();
     $userToGroup->user_id = Yii::$app->user->getIdentity()->id;
     $userToGroup->group_id = $this->id;
     $userToGroup->can_edit = 1;
     $userToGroup->group_admin = 1;
     if ($userToGroup->save()) {
         return true;
     }
     return false;
 }
Exemplo n.º 9
0
 public function search()
 {
     $query = Group::find();
     if ($this->name) {
         $query->andFilterWhere(['like', 'group.name', $this->name]);
     }
     if ($this->city_id) {
         $query->andFilterWhere(['group.city_id' => $this->city_id]);
     }
     if ($this->university_id) {
         $query->andFilterWhere(['group.university_id' => $this->university_id]);
     }
     if ($this->tag_id) {
         $query->leftJoin(TagToGroup::tableName() . ' AS tag', 'tag.group_id = group.id')->andFilterWhere(['tag.tag_id' => $this->tag_id]);
     }
     return $query->orderBy('group.name')->all();
 }
Exemplo n.º 10
0
 private function getParentGroups($groupId = '')
 {
     $groups = $_dataMap = [];
     if (!$groupId) {
         $groupId = $this->Id;
     }
     $_dataMap = ArrayHelper::map(Group::find()->where(['status' => '1'])->andWhere('Id <=' . $groupId)->all(), 'Id', 'parentId');
     $groups[] = $key = $groupId;
     while ($key != 0) {
         if (isset($_dataMap[$key]) && $_dataMap[$key] != 0) {
             $groups[] = $key = $_dataMap[$key];
         } else {
             $key = 0;
         }
     }
     return $groups;
 }
Exemplo n.º 11
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Group::find();
     if (!isset($params['sort'])) {
         $query->orderBy(['id_group' => SORT_DESC]);
     }
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id_group' => $this->id_group, 'id_custodian' => $this->id_custodian, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'group_id', $this->group_id]);
     return $dataProvider;
 }
Exemplo n.º 12
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Group::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 10]]);
     $dataProvider->setSort(['attributes' => ['specialityName' => ['asc' => ['speciality.name' => SORT_ASC], 'desc' => ['speciality.name' => SORT_DESC]], 'group.name']]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'speciality_id' => $this->speciality_id, 'steward_student_id' => $this->steward_student_id]);
     $query->andFilterWhere(['like', 'group.name', $this->name]);
     $query->joinWith(['speciality' => function ($q) {
         $q->where('speciality.name LIKE "%' . $this->specialityName . '%"');
     }]);
     return $dataProvider;
 }
Exemplo n.º 13
0
 public static function getData()
 {
     $data_size = 0;
     $data = [];
     foreach (Region::find()->all() as $region) {
         /* @var $region Region */
         $data[$data_size] = ['title' => $region->name, 'folder' => true, 'expanded' => true, 'key' => 'r-' . $region->id, 'children' => []];
         foreach (Group::find()->all() as $group) {
             /* @var $group Group */
             $objects = [];
             foreach ($group->objects as $object) {
                 if ($object->region_id === $region->id) {
                     $objects[] = ['title' => $object->name, 'folder' => true, 'expanded' => false, 'count' => 2, 'key' => 'o-' . $object->id, 'children' => [['title' => 'Информация', 'key' => 'i-' . $object->id], ['title' => 'Документы', 'key' => 'd-' . $object->id]]];
                 }
             }
             if (sizeof($objects) > 0) {
                 $data[$data_size]['children'][] = ['title' => $group->name, 'folder' => true, 'expanded' => false, 'count' => sizeof($objects), 'key' => 'g-' . $group->id, 'children' => $objects];
             }
         }
         $data[$data_size]['count'] = sizeof($data[$data_size]['children']);
         $data_size++;
     }
     return $data;
 }
Exemplo n.º 14
0
<div class="group-has-discipline-form">
    
    <?php 
$form = ActiveForm::begin(['id' => 'project-form', 'enableAjaxValidation' => true]);
?>
    
    <?php 
echo $form->field($model, 'teacherHasDiscipline')->widget(MultipleInput::className(), ['min' => 1, 'columns' => [['name' => 'teacher_id', 'type' => 'dropDownList', 'defaultValue' => 1, 'items' => ArrayHelper::map(\common\models\Teacher::find()->all(), 'id', 'user.fullname')]]]);
?>

    <?php 
echo $form->field($model, 'discipline_id')->dropDownList(ArrayHelper::map(Discipline::find()->all(), 'id', 'name'));
?>

    <?php 
echo $model->isNewRecord ? $form->field($model, 'group_id')->dropDownList(ArrayHelper::map(Group::find()->all(), 'id', 'name'), ['prompt' => '-Группа-', 'onchange' => '
                $.post( "' . Yii::$app->urlManager->createUrl('group-has-discipline/semlist?id=') . '"+$(this).val(), function( data ) {
                  $( "select#grouphasdiscipline-semester_id" ).html( data );
                });
            ', 'class' => 'form-control']) : "";
?>

    <?php 
echo $model->isNewRecord ? $form->field($model, 'semester_number')->widget(DepDrop::classname(), ['options' => ['id' => 'semester_number'], 'pluginOptions' => ['depends' => ['grouphasdiscipline-group_id'], 'placeholder' => 'Выберите группу...', 'url' => Url::to(['/group-has-discipline/semesters'])]]) : $form->field($model, 'semester_number')->dropDownList($semesterList);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Создать' : 'Сохранить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>
Exemplo n.º 15
0
<div class="student-form">
    <?php 
Pjax::begin();
?>
    <?php 
$form = ActiveForm::begin(['id' => 'project-form']);
?>
        
    
    <?php 
echo $model->isNewRecord ? $form->field($model, 'user_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(User::find()->all(), 'id', 'usernameFullname'), 'options' => ['placeholder' => 'Введите Ф.И.О...'], 'pluginOptions' => ['allowClear' => true]]) : '';
?>
    
    <?php 
echo $form->field($model, 'group_id')->widget(Select2::classname(), ['data' => ArrayHelper::map(Group::find()->all(), 'id', 'name'), 'options' => ['placeholder' => 'Введите название группы...'], 'pluginOptions' => ['allowClear' => true]]);
?>
    
    <?php 
echo $form->field($model, 'education_start_date')->widget(DatePicker::classname(), ['clientOptions' => ['changeMonth' => true, 'changeYear' => true, 'yearRange' => "-100:+100"], 'options' => ['class' => 'form-control']]);
?>

    <?php 
echo $form->field($model, 'education_end_date')->widget(DatePicker::classname(), ['clientOptions' => ['changeMonth' => true, 'changeYear' => true, 'yearRange' => "-100:+100"], 'options' => ['class' => 'form-control']]);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Создать' : 'Сохранить', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>
Exemplo n.º 16
0
Arquivo: User.php Projeto: jedzura/nzs
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getGroups()
 {
     return $this->hasMany(Group::className(), ['id' => 'group_id'])->viaTable('user_to_group', ['user_id' => 'id']);
 }
Exemplo n.º 17
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
/* @var $this yii\web\View */
/* @var $model common\models\Group */
/* @var $form yii\widgets\ActiveForm */
$group_list = \common\models\Group::find();
if (!$model->isNewRecord) {
    $group_list->where(['<>', 'id', $model->id]);
}
$group_list = $group_list->all();
?>

<div class="group-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'parent_id')->dropDownList(\yii\helpers\ArrayHelper::map($group_list, 'id', 'name'), ['prompt' => '(не установлен)']);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
Exemplo n.º 18
0
 public function getGroups()
 {
     return $this->hasMany(Group::className(), ['id_group' => 'id_group'])->via('advisorGroups');
 }
Exemplo n.º 19
0
 public function getGroups()
 {
     return Group::find()->innerJoin("group_has_discipline ghd", '`ghd`.`group_id` = `group`.`id`')->innerJoin("lesson", '`lesson`.`ghd_id` = `ghd`.`id`')->all();
 }
Exemplo n.º 20
0
 public function getGroups()
 {
     return $this->hasMany(Group::className(), ['story_id' => 'id']);
 }
Exemplo n.º 21
0
 public function actionTermCreateGroup($group = null, $discipline = null)
 {
     if ($group && $discipline && Yii::$app->user->can('teacher')) {
         if (Yii::$app->user->identity->teacher->isTeacherHasDiscipline($discipline)) {
             $groupModel = Group::findOne($group);
             $disciplineModel = \common\models\GroupHasDiscipline::findOne($discipline);
             $errors = false;
             foreach ($groupModel->students as $student) {
                 $model = new Work();
                 $model->scenario = Work::SCENARIO_TERM;
                 $model->ghd_id = $disciplineModel->discipline_id;
                 $model->student_id = $student->id;
                 $model->teacher_id = Yii::$app->user->identity->teacher->id;
                 $model->work_type_id = Work::TYPE_TERM;
                 if ($model->validate()) {
                     $model->save();
                     $model->id = $model->getPrimaryKey();
                 } else {
                     $errors = true;
                 }
             }
             if (!$errors) {
                 return 'Создано';
             } else {
                 return 'Произошла ошибка';
             }
         }
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 22
0
?>

    <?php 
echo $form->field($model, 'firstname')->textInput(['maxlength' => 45]);
?>

    <?php 
echo $form->field($model, 'lastname')->textInput(['maxlength' => 45]);
?>
    
    <?php 
echo $form->field($model, 'phone')->textInput(['maxlength' => 10]);
?>

    <?php 
echo $form->field($model, 'groupId')->dropDownList(ArrayHelper::merge(['Select' => 'Select'], ArrayHelper::map(\common\models\Group::find()->where(['status' => '1'])->all(), 'Id', 'name')));
?>
    
    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
        <?php 
echo Html::button('Back', ['class' => 'btn btn-default', 'onclick' => 'history.go(-1);return true;']);
?>
    </div>

    <?php 
ActiveForm::end();
?>
Exemplo n.º 23
0
      else{*/
    $menuItems[] = ['label' => $t->user->fullname, 'url' => Url::to(['lesson/index', 'teacher' => $t->id])];
    //}
}
echo Html::beginTag('div', ['class' => 'list-group']);
foreach ($menuItems as $item) {
    echo Html::a($item['label'], $item['url'], ['class' => 'list-group-item']);
}
echo Html::endTag('div');
Pjax::end();
$this->endBlock('teachers');
//Архив
$this->beginBlock('archive');
$menuItems = [];
$formatter = Yii::$app->formatter;
$groups = Group::find()->all();
echo Html::beginTag('div', ['class' => 'list-group']);
foreach ($groups as $gr) {
    $count = \common\models\GroupSemesters::find()->where(['group_id' => $gr->id])->andWhere(['<=', 'end_date', date('U')])->count();
    if (!$count) {
        break;
    }
    echo Html::beginTag('div', ['class' => 'list-group-item']);
    echo "<span class='list-group-item'><i class='glyphicon glyphicon-chevron-right'></i>{$gr->name}</span>";
    echo "<div class='list-group'  style='display: none;'>";
    foreach ($gr->semesters as $semester) {
        if ($semester->end_date > date('U')) {
            break;
        }
        $link = Url::toRoute(['lesson/archive', 'group' => $gr->id, 'semester' => $semester->semester_number]);
        echo "<a href='{$link}' class='list-group-item'>Семестр: {$semester->semester_number}  " . "<span class='badge'>{$formatter->asDate($semester->begin_date)} — {$formatter->asDate($semester->end_date)}</span></a>";
Exemplo n.º 24
0
<div class="character-form">

    <?php 
$form = ActiveForm::begin();
?>

    <?php 
echo $form->field($model, 'char_name')->textInput(['maxlength' => true]);
?>

    <?php 
echo $form->field($model, 'story_id')->label('Story')->widget(Select2::classname(), ['addon' => ['prepend' => ['content' => '<span class="fa fa-flag" aria-hidden="true"></span> Leaders']], 'data' => ArrayHelper::map(Story::find()->all(), 'id', 'story_name'), 'options' => ['placeholder' => 'Select Story ...']]);
?>

    <?php 
echo $form->field($model, 'group_id')->label('Group')->widget(Select2::classname(), ['addon' => ['prepend' => ['content' => '<span class="fa fa-flag" aria-hidden="true"></span> Leaders']], 'data' => ArrayHelper::map(Group::find()->all(), 'id', 'group_name'), 'options' => ['placeholder' => 'Select Group ...']]);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
    </div>

    <?php 
ActiveForm::end();
?>

</div>
Exemplo n.º 25
0
 /**
  * @get discipline
  */
 public function getGroup()
 {
     return $this->hasOne(Group::className(), ['id' => 'group_id']);
 }
Exemplo n.º 26
0
use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
/**
 * @var yii\web\View $this
 * @var common\models\User $model
 * @var yii\widgets\ActiveForm $form
 */
//print_r($model->groupMap);
?>
<div class="user-form">
    <?php 
$form = ActiveForm::begin();
?>
    <?php 
echo $form->field($model, 'groupMap')->checkboxList(ArrayHelper::map(\common\models\Group::find()->where(['status' => '1'])->all(), 'Id', 'name'), ['class' => 'list-group', 'itemOptions' => ['class' => 'list-group-item']]);
?>

    <div class="form-group">
        <?php 
echo Html::submitButton($model->isNewRecord ? 'Create' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary']);
?>
        <?php 
echo Html::button('Back', ['class' => 'btn btn-default', 'onclick' => 'history.go(-1);return true;']);
?>
    </div>
    <?php 
ActiveForm::end();
?>
</div>
Exemplo n.º 27
0
use yii\widgets\MaskedInput;
use common\models\State;
use kartik\widgets\Select2;
/* @var $this yii\web\View */
/* @var $model common\models\Client */
/* @var $form yii\widgets\ActiveForm */
?>

<div class="client-form">

    <?php 
$form = ActiveForm::begin(['enableAjaxValidation' => true]);
?>

    <?php 
echo $form->field($model, 'id_group', ['options' => ['class' => 'col-xs-6']])->dropDownList(ArrayHelper::map(Group::find()->asArray()->all(), 'id_group', 'group_id'), ['prompt' => 'Select...'])->label('Group <span style="color:red">*</span>');
?>



	<?php 
echo $form->field($userModel, 'first_name', ['options' => ['class' => 'col-xs-6']])->textInput(['maxlength' => true])->label('First Name <span style="color:red">*</span>');
?>
    <?php 
if (!$model->isNewRecord) {
    ?>
    		<?php 
    echo $form->field($model, 'client_id', ['options' => ['class' => 'col-xs-6']])->textInput(['maxlength' => true, 'readonly' => true]);
    ?>
    	<?php 
}
Exemplo n.º 28
0
use yii\helpers\Html;
use yii\widgets\ListView;
use common\models\Lesson;
use common\models\GroupHasDiscipline;
use yii\helpers\Url;
use yii\web\NotFoundHttpException;
use yii\bootstrap\Tabs;
use yii\helpers\ArrayHelper;
use common\widgets\Schedule;
use yii\bootstrap\Modal;
/* @var $this yii\web\View */
/* @var $dataProvider yii\data\ActiveDataProvider */
$date = new DateTime();
$todayDate = $date->format("Y-m-d");
$model = \common\models\Group::find()->where(['id' => $group])->one();
//$ghd = GroupHasDiscipline::find()->where(['group_id' => $group])->andWhere(['<=','start_date',$todayDate])->andWhere(['>=','end_Date',$todayDate])->all();
//if(!$ghd) {  throw new NotFoundHttpException('Страница не найдена.');}
$this->title = 'Расписание группы ' . $model->name;
$this->params['breadcrumbs'][] = ['label' => 'Информация', 'url' => Url::to(['site/information'])];
$this->params['breadcrumbs'][] = ['label' => 'Расписание', 'url' => Url::to(['lesson/index'])];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="lesson-index">

    <h3><?php 
echo "Расписание группы: " . Html::a($model->name, ['//group/view', 'id' => $model->id]);
?>
</h3>

    <?php 
 public function actionIndex($id_app_task)
 {
     $model = AppTask::findOne($id_app_task);
     $loanModel = Loan::find()->where(['id_application' => $model->id_application])->one();
     // 如果 loan 不存在,则新建
     if (is_null($loanModel)) {
         $loanModel = new Loan();
         $loanModel->loan_number = '';
         $loanModel->id_application = $model->id_application;
         $loanModel->status = 0;
         $loanModel->loc = $model->application->loc;
         $loanModel->balance = 0;
         $loanModel->advance_rate = 50;
         $loanModel->maintainance_rate = 70;
         $loanModel->collateral_value = $model->application->collateral_value;
         $loanModel->save(false);
     }
     // 读取所以检查项
     $checkPointsData = AppTaskCheckpoint::find()->where(['id_app_task' => $id_app_task])->all();
     $checkPoints = [];
     $check_points_ctrl = true;
     foreach ($checkPointsData as $val) {
         $checkPoints[$val['id_app_task_checkpoint_type']] = $val;
         if (!$val->status) {
             $check_points_ctrl = false;
         }
     }
     //  判断是否可以 approve
     $loanModel->setScenario('review');
     $loanCheck = clone $loanModel;
     $loan_ctrl = $loanCheck->validate();
     if (Yii::$app->request->post()) {
         // 如果选择 wet­signed
         $post = Yii::$app->request->post();
         if ($post['type'] == 'wet­signed') {
             //关闭sign agreements
             $task_e_sign_box = AppTask::findOne(['id_application' => $model->id_application, 'id_app_task_type' => DictTask::TYPE_SIGN_AGREEMENTS_BOX]);
             AppTask::close($task_e_sign_box->id_app_task);
         }
         // 确认 Application Review and Check 结束
         $applicationModel = $model->application;
         //g3
         AppDocument::createPdfByApplication($applicationModel, DictDocument::TYPE_G3);
         //control_agreement
         AppDocument::createPdfByApplication($applicationModel, DictDocument::TYPE_CONTROL_AGREEMENT);
         //line_agreements
         AppDocument::createPdfByApplication($applicationModel, DictDocument::TYPE_LINE_AGREEMENT);
         //w9
         AppDocument::createPdfByApplication($applicationModel, DictDocument::TYPE_W9);
         $loanModel->id_application = $applicationModel->id_application;
         $id_application = $loanModel->id_application;
         //active log.loan officer approved the application.
         Active::operationLog($id_application, [Yii::$app->user->getIdentity()->first_name, Yii::$app->user->getIdentity()->last_name], DictActive::APPROVED_APPLICATION, Yii::$app->user->getIdentity()->id);
         AppTask::taskFinish($id_app_task);
         //find Control Agreement--type--schwab(control agreement->id_application->id_group->Coustidian)
         $application = Application::find()->andWhere(['id_application' => $id_application])->one();
         $group = Group::find()->andWhere(['id_group' => $application->id_group])->one();
         //judge for id_custodian
         //send application approval email to client and cc to advisor(email($email_type,[$task_type,$id_app_task,$loan,$group]))
         $res = SendEmail::email(DictEmail::EMAIL_LETTER_ABOUT_LINE, [DictEmail::LETTER_APPLICATION_APPROVAL, $id_app_task, $loanModel, $group]);
         if ($res) {
             //判断是否有两个client参与
             $user = SendEmail::findUserByApplication($id_application);
             if (is_null($user['co_applicant'])) {
                 Active::operationLog($id_application, [$user['applicant']->first_name, $user['applicant']->last_name, '', $user['advisor']->first_name, $user['advisor']->last_name], DictActive::SYSTEM_SEND_APPROVAL_LETTER, 0);
             } else {
                 Active::operationLog($id_application, [$user['applicant']->first_name, $user['applicant']->last_name, ',' . $user['co_applicant']->first_name . ' ' . $user['co_applicant']->last_name, $user['advisor']->first_name, $user['advisor']->last_name], DictActive::SYSTEM_SEND_APPROVAL_LETTER, 0);
             }
         }
         //active.system geneerated all the line agreements
         Active::operationLog($id_application, [], DictActive::SYSTEM_GENERATED_LINE_AGREEMENTS, 0);
         //find user
         $user = SendEmail::findUserByApplication($id_application);
         //create a task line-agreement to loan officer
         Active::operationLog($model->id_application, [DictTask::$taskType[DictTask::TYPE_LINE_AGREEMENTS], $user['supernova']->first_name, $user['supernova']->last_name], DictActive::SYSTEM_CREATE_TASK_TO_USER, 0);
         //system created task line-agreements
         //System send email new task "Line Agrrements Notification" to betterdebt($email_type,[$task_type,$id_application,$id_app_task])
         SendEmail::email(DictEmail::EMAIL_TASK_NOTIFICATION, [DictTask::TYPE_LINE_AGREEMENTS, $id_application, $id_app_task + 2]);
         if ($post['type'] != 'wet­signed') {
             // docusign
             $result_docusign = SendDocuSign::appReview($id_application);
         }
         //crate a task sign-line-agreement to client
         Active::operationLog($model->id_application, [DictTask::$taskType[DictTask::TYPE_SIGN_AGREEMENTS], $user['applicant']->first_name, $user['applicant']->last_name], DictActive::SYSTEM_CREATE_TASK_TO_USER, 0);
         //system created task line-agreements
         Active::operationLog($model->id_application, [DictTask::$taskType[DictTask::TYPE_LINE_AGREEMENTS], $user['applicant']->first_name, $user['applicant']->last_name], DictActive::SYSTEM_SEND_DOCUSIGN_EMAIL, 0);
         //system send sign agreement docusign email to client
         return $this->redirect(['/application/view', 'id' => $model->id_application]);
     }
     $data = CollateralAccount::find()->andWhere(['line_type' => 1, 'id_line' => $model->id_application])->orderBy(['data_date' => SORT_DESC])->one();
     if ($data) {
         $account = CollateralAccount::find()->andWhere(['line_type' => 1, 'id_line' => $model->id_application, 'data_date' => $data['data_date']])->orderBy(['data_date' => SORT_DESC])->all();
         $line_account = LineAccount::find()->andWhere(['line_type' => 1, 'id_line' => $model->id_application, 'data_date' => $data['data_date']])->orderBy(['data_date' => SORT_DESC])->one();
     } else {
         $account = '';
         $line_account = '';
     }
     //credit score
     $applicant = AppApplicant::find()->andWhere(['id_application' => $model->id_application])->all();
     return $this->render('index', ['model' => $model, 'loanModel' => $loanModel, 'checkPoints' => $checkPoints, 'approve_ctrl' => $check_points_ctrl && $loan_ctrl, 'collateral_account' => $account, 'line_account' => $line_account, 'date' => empty($data) ? '' : $data['data_date'], 'applicant' => empty($applicant) ? '' : $applicant]);
 }
Exemplo n.º 30
0
 public static function getLessonsList($arr)
 {
     $group = isset($arr['group']) ? $arr['group'] : null;
     $teacher = isset($arr['teacher']) ? $arr['teacher'] : null;
     if ($group !== null) {
         if (!isset($arr['semester'])) {
             $semester = Group::findOne($group)->currentSemester;
         } else {
             $semester = GroupSemesters::find()->where(['group_id' => $arr['group'], 'semester_number' => $arr['semester']])->one();
         }
         if (!$semester) {
             return false;
         }
         $lessons = Lesson::find()->joinWith('groupHasDiscipline', true, "INNER JOIN")->where(['group_has_discipline.group_id' => $group])->andWhere(['group_has_discipline.semester_number' => $semester->semester_number])->orderBy('week ASC, day ASC, time ASC')->all();
         return $lessons;
     } elseif ($teacher !== null) {
         $lessons = Lesson::find()->select('lesson.*')->innerJoin("teacher_has_discipline thd", "`thd`.`id` = `lesson`.`thd_id`")->innerJoin("group_has_discipline ghd", '`ghd`.`id` = `lesson`.`ghd_id`')->innerJoin("group g", '`g`.`id` = `ghd`.`group_id`')->innerJoin("group_semesters gs", '`gs`.`group_id` = `g`.`id` AND `ghd`.`semester_number`  = `gs`.`semester_number`')->where(['<=', 'gs.begin_date', date('U')])->andWhere(['>=', 'gs.end_date', date('U')])->andWhere(['thd.teacher_id' => $teacher])->orderBy('week ASC, day ASC, time ASC, id ASC')->all();
         return $lessons;
     }
 }