/**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $stages = ['Just starting out', 'Some market research done', 'Business plan/model done', 'Landing page done', 'Wireframes done', 'Prototype done', 'Pitched to Investors', 'Generated Revenue'];
     foreach ($stages as $stageName) {
         $stage = Stage::create(['name' => $stageName]);
         $stage->save();
     }
 }
Esempio n. 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Stage::find();
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['create_time' => SORT_DESC]]]);
     $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, 'deadline' => $this->deadline, 'status' => $this->status, 'create_time' => $this->create_time, 'update_time' => $this->update_time, 'user_id' => $this->user_id, 'project_id' => $this->project_id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['user_id' => Yii::$app->user->identity->id]);
     return $dataProvider;
 }
Esempio n. 3
0
 /**
  * Updates Stage into database
  *
  * @param Stage $stage
  * @param array $input
  *
  * @return Stage
  */
 public function update($stage, $input)
 {
     $stage->fill($input);
     $stage->save();
     return $stage;
 }
 /**
  * @param $startup
  * @return $this
  */
 public function edit($startup)
 {
     $startup = Startup::where('url', '=', $startup)->firstOrFail();
     $tags = Tag::lists('name', 'id')->all();
     $stages = Stage::lists('name', 'id')->all();
     $needs = Skill::lists('name', 'id')->all();
     return view('startups.edit')->with('startup', $startup)->with('tags', $tags)->with('stages', $stages)->with('needs', $needs);
 }
Esempio n. 5
0
 public function notifyStage()
 {
     //Samy tupoi variant reweniya uvedomleny
     // $stages = Stage::find()->where(['user_id' => Yii::$app->user->identity->id, 'status' => [R::STAGE_CREATED, R::STAGE_PROCESS, R::STAGE_APPROVED, R::STAGE_DONE], 'notify_status' => R::NOTIFY_ACTIVE])->all();
     $stages = Stage::find()->where(['user_id' => Yii::$app->user->identity->id, 'notify_status' => R::NOTIFY_ACTIVE])->all();
     foreach ($stages as $stage) {
         // if ($stage->notify_times == 1) {
         $stage->notify_status = R::NOTIFY_NOTIFIED;
         $stage->save();
         // } else {
         // $stage->notify_times += 1;
         // $stage->save();
         // }
     }
 }
Esempio n. 6
0
<body>
<?php 
$this->beginBody();
?>

<div class="wrap">
    <?php 
$items = [];
if (!Yii::$app->user->isGuest) {
    $n_sr = isset($this->params['n_sr']) ? $this->params['n_sr'] : false;
    $n_ar = isset($this->params['n_ar']) ? $this->params['n_ar'] : false;
    $n_s = isset($this->params['n_s']) ? $this->params['n_s'] : false;
    $n_a = isset($this->params['n_a']) ? $this->params['n_a'] : false;
    $logout = ['label' => '<img src="' . Yii::$app->user->identity->avatar . '" style="width:16px;height:16px">', 'items' => [['label' => 'Выход', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']], ['label' => 'Профиль', 'url' => ['/user/view?id=' . Yii::$app->user->identity->id]]]];
    $manager = Bid::find()->where(['status' => R::BID_SENT_TO_MANAGER])->count();
    $teammate = Stage::find()->where(['user_id' => Yii::$app->user->identity->id, 'status' => R::STAGE_CREATED])->count();
    if (Yii::$app->user->identity->role == R::ADMIN) {
        $items = [['label' => 'Архив', 'items' => [['label' => 'Проекты', 'url' => ['/leader/project-done']], ['label' => 'Поручения', 'url' => ['/leader/assignment-done']]]], ['label' => 'Журнал', 'url' => ['/logbook/logbook/logbooks']], ['label' => 'Пользователи', 'url' => ['/user/index']], ['label' => 'Отчеты' . ($n_sr || $n_ar ? '<span class="circle"></span>' : ''), 'items' => [['label' => 'Проекты' . ($n_sr ? '<span class="circle"></span>' : ''), 'url' => ['/leader/stage-reports']], ['label' => 'Поручения' . ($n_ar ? '<span class="circle"></span>' : ''), 'url' => ['/leader/assignment-reports']]]], ['label' => 'Поручения', 'url' => ['/leader/assignments']], ['label' => 'Проекты', 'url' => ['/leader/index']]];
    }
    if (Yii::$app->user->identity->role == R::DESIGNER || Yii::$app->user->identity->role == R::FRONTEND || Yii::$app->user->identity->role == R::COPYRIGHTER || Yii::$app->user->identity->role == R::PROTOTYPER || Yii::$app->user->identity->role == R::TESTER || Yii::$app->user->identity->role == R::BACKEND || Yii::$app->user->identity->role == R::CONTENTER) {
        $items = [['label' => 'Журнал', 'url' => ['/logbook/logbook/index']], ['label' => 'Отчеты' . ($n_sr || $n_ar ? '<span class="circle"></span>' : ''), 'items' => [['label' => 'Проекты' . ($n_sr ? '<span class="circle"></span>' : ''), 'url' => ['/team/stage-reports']], ['label' => 'Поручения' . ($n_ar ? '<span class="circle"></span>' : ''), 'url' => ['/team/assignment-reports']]]], ['label' => 'Поручения' . ($n_a ? '<span class="circle"></span>' : ''), 'url' => ['/team/assignments']], ['label' => 'Работы' . ($n_s ? '<span class="circle"></span>' : ''), 'url' => ['/team/index']]];
    }
    if (Yii::$app->user->identity->role == R::CLIENT) {
        $items = [['label' => 'Проекты', 'url' => ['/client/projects']], ['label' => 'Уведомления' . ($n_sr ? '<span class="circle"></span>' : ''), 'url' => ['/client/reports']]];
    }
    array_push($items, $logout);
    // array_push($items, $avatar);
} else {
    $items = [['label' => 'Регистрация', 'url' => ['/user/fast-create']], ['label' => 'Вход', 'url' => ['/site/login']]];
}
NavBar::begin(['brandLabel' => 'G5 Control', 'brandUrl' => Yii::$app->homeUrl, 'options' => ['class' => 'navbar-inverse navbar-fixed-top']]);
Esempio n. 7
0
 /**
  * Отправка отчета менеджеру о выполнении стадии
  * создаем отчет, меняем статус стадии и проекта и уведомляем менеджера об отправки отчетности
  * Проверен (21.12.15)
  */
 public function actionSent()
 {
     if (isset($_POST)) {
         $bid = new Bid();
         $bid->text = $_POST['text'];
         $bid->name = "Test";
         $bid->status = R::BID_SENT_TO_MANAGER;
         $bid->user_id = Yii::$app->user->identity->id;
         $bid->obj_id = $_POST['stage_id'];
         $bid->bid_type = R::BID_STAGE;
         $bid->notify_status = R::NOTIFY_ACTIVE;
         $bid->create_time = time();
         $bid->update_time = time();
         $bid->save();
         if ($bid->save()) {
             $bid->uploadFiles(Yii::$app->session['cs_' . Yii::$app->user->identity->id]);
             $stage = Stage::findOne($bid->obj_id);
             $stage->status = R::STAGE_PROCESS;
             $stage->save();
             $stage->project->status = R::PROJECT_PROCESS;
             $stage->project->save();
             echo '1';
         }
     }
 }
Esempio n. 8
0
 public function getStage()
 {
     return $this->hasOne(Stage::className(), ['id' => 'obj_id']);
 }
Esempio n. 9
0
 public function getStageNotification()
 {
     if ($this->role == R::ADMIN) {
         // $bid = Bid::find()->where(['status' => [R::BID_SENT_TO_MANAGER, R::BID_REFUSED_BY_CLIENT, R::BID_APPROVED_BY_CLIENT], 'notify_status' => R::NOTIFY_ACTIVE])->count();
         // if ($bid == 0) {
         //     return false;
         // } else {
         //     return true;
         // }
     } elseif ($this->role == R::DESIGNER || $this->role == R::FRONTEND || $this->role == R::COPYRIGHTER || $this->role == R::PROTOTYPER || $this->role == R::TESTER || $this->role == R::BACKEND || $this->role == R::CONTENTER) {
         $stages = Stage::find()->where(['user_id' => $this->id, 'status' => [R::STAGE_CREATED, R::STAGE_APPROVED, R::STAGE_DONE], 'notify_status' => R::NOTIFY_ACTIVE])->count();
         if ($stages == 0) {
             return false;
         } else {
             return true;
         }
     }
 }
Esempio n. 10
0
 public function getStage()
 {
     return $this->hasOne(Stage::className(), ['id' => 'obj_id'])->andWhere(['bid_type' => R::BID_STAGE]);
 }
Esempio n. 11
0
 /**
  * Редактирование проекта
  * Суть такова: У каждого стадии есть id-шник. Если они приходять сюда POST-ом
  * значит они не были удалены во view-шке. Если же стадия была удалена во view-шке
  * соответсвенно ее надо удалить в базе.
  * Добавленные стадии создаются в обычном порядке.
  * Проверен (21.12.15) - все ровно
  */
 public function actionUpdate($id)
 {
     $model = $this->findModel($id);
     if ($model->load(Yii::$app->request->post())) {
         $model->deadline = date('Y-m-d', strtotime($model->deadline));
         $model->save();
         $stage_ids = $_POST['obj_id'];
         //id-шники всех стадий
         foreach ($model->stages as $stage) {
             $exist = false;
             foreach ($stage_ids as $k => $v) {
                 if ($stage->id == $v) {
                     $exist = true;
                 }
             }
             if ($exist == false) {
                 $stage->delete();
             }
         }
         if (isset($_POST['stage_name'])) {
             $stage_name = $_POST['stage_name'];
             $stage_description = $_POST['stage_description'];
             $stage_deadline = $_POST['stage_deadline'];
             $stage_who = $_POST['stage_who'];
             foreach ($stage_name as $k => $v) {
                 $exist = Stage::findOne($stage_ids[$k]);
                 if ($exist) {
                     $exist->name = $v;
                     $exist->description = $stage_description[$k];
                     $exist->deadline = strtotime($stage_deadline[$k]);
                     $exist->user_id = $stage_who[$k];
                     $exist->save();
                 } else {
                     $stage = new Stage();
                     $stage->name = $v;
                     $stage->description = $stage_description[$k];
                     $stage->deadline = strtotime($stage_deadline[$k]);
                     $stage->user_id = $stage_who[$k];
                     $stage->project_id = $model->id;
                     $stage->status = R::STAGE_CREATED;
                     $stage->create_time = time();
                     $stage->save();
                 }
             }
         }
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('update', ['model' => $model]);
     }
 }
Esempio n. 12
0
 public function getStages()
 {
     return $this->hasMany(Stage::className(), ['project_id' => 'id']);
 }
Esempio n. 13
0
 /**
  * @param Request $request
  * @param Response $response
  * @return Object
  * */
 public function getStages(Request $request, Response $response)
 {
     if ($request->ajax()) {
         $query = Stage::select(['name', 'alias'])->get();
         $param = (object) ['idNameSelect' => 'stages', 'url' => 'stage', 'prop' => ['name', 'alias']];
         return $response->json([$query, $param]);
     }
 }