public function actionSet() { if (\Yii::$app->request->post('func') === null) { return false; } $func = \Yii::$app->request->post('func'); if (\Yii::$app->request->post('value') === null) { return false; } $value = \Yii::$app->request->post('value'); // $func = 'resok'; // $value = 24; switch ($func) { case 'resok': //aceita tarefa que lhe foi atribuida $model = TaskAssign::findOne($value); if ($model) { $model->response = \app\enum\TaskResponse::Aceitou; $model->response_date = time(); return $model->save(); } case 'resko': //aceita tarefa que lhe foi atribuida $model = TaskAssign::findOne($value); if ($model) { $model->response = \app\enum\TaskResponse::Recusou; $model->response_date = time(); return $model->save(); } } return false; }
/** * This command echoes what you have entered as the message. * @param string $message the message to be echoed. */ public function actionIndex() { // EVENTOS $events = \app\models\CalendarEventAssign::findAll(['notification_status' => \app\enum\NotificationStatus::Envia_notificacao]); if (count($events) > 0) { foreach ($events as $event) { $family_name = $event->familyMember->family->name; $name = $event->familyMember->name; $email = $event->familyMember->user->username; if (self::sendNotificationNewEvent($name, $family_name, $email)) { $event->notification_status = \app\enum\NotificationStatus::Notificacao_enviada; $event->notification_date = time(); $event->save(); } } } // TAREFAS $tasks = \app\models\TaskAssign::findAll(['notification_status' => \app\enum\NotificationStatus::Envia_notificacao]); if (count($tasks) > 0) { foreach ($tasks as $task) { $family_name = $task->familyMember->family->name; $name = $task->familyMember->name; $email = $task->familyMember->user->username; if (self::sendNotificationNewTask($name, $family_name, $email)) { $task->notification_status = \app\enum\NotificationStatus::Notificacao_enviada; $task->notification_date = time(); $task->save(); } } } return 0; }
public static function getTasksWaitingForResponseArray($members) { $condition = ['member_id' => $members, 'response' => \app\enum\TaskResponse::Sem_resposta]; $res = TaskAssign::findAll($condition); if ($res) { foreach ($res as $record) { $resArray[] = $record->task_id; } } else { $resArray[] = -1; } return $resArray; }
public function actionDelete($id) { $model = Task::findOne($id); TaskAssign::deleteAll(['task_id' => $id]); $model->delete(); return $this->redirect('user'); }