Esempio n. 1
0
 /**
  * 返回基本信息
  * @param $id
  */
 public static function getTaskInfo($id)
 {
     $model = Task::where("id", $id)->get();
     $att_arr = $model[0]->attributes;
     unset($att_arr['id']);
     return $att_arr;
 }
 public function put($done, Task $task)
 {
     //echo $done."<br>";
     //var_dump($task);
     //echo "hallo";
     //var_dump($request-done);
     //echo $done ."<br>";
     //var_dump($task->id);
     //echo $task->id;
     //$task->done();
     //$task->done($done);
     //var_dump($task->done);
     //echo "hallo";
     //Task->done($task-id) = $request->name;
     //$numberOfDone = Task::findOrFail($task->id)->done(1);
     //$numberOfDone = Task::update(array('done' => 1));
     //echo $numberOfDone;
     //Task::findOrFail($task->id)->done->save();
     //var_dump($taskss);
     //var_dump(Task->done;
     //echo "hallo";
     /*
            $taskssss = Task::where('user_id', $request->user()->id)->get();
      foreach ($taskssss as $task){
          echo $task->done;
      }
     */
     //return redirect('/tasks');
     Task::where('id', $task->id)->update(['done' => $done]);
     return redirect('/tasks');
 }
 /**
  * ユーザーの全タスクをリスト表示
  *
  * @param  Request  $request
  * @return Response
  */
 public function index(Request $request)
 {
     #$tasks = Task::where('user_id', $request->user()->id)->get();
     // ページネーション
     $tasks = Task::where('user_id', $request->user()->id)->paginate(3);
     return view('tasks.index', ['tasks' => $tasks]);
 }
Esempio n. 4
0
 public function search(Request $request)
 {
     $results = array();
     $term = $request->get('term');
     $goals = Goal::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $objectives = Objective::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $actions = Action::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $tasks = Task::where('body', 'like', '%' . $term . '%')->orderBy('body', 'asc')->get();
     $teams = Team::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
     $departments = Department::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get();
     $users = User::where('name', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get()->all();
     foreach (User::where('email', 'like', '%' . $term . '%')->orderBy('name', 'asc')->get() as $matching_user_email) {
         if (in_array($matching_user_email, $users)) {
             continue;
         }
         $users[] = $matching_user_email;
     }
     $notes = Note::where('content', 'like', '%' . $term . '%')->orderBy('content', 'asc')->get();
     $types = [$goals, $objectives, $actions, $tasks, $teams, $departments, $users, $notes];
     foreach ($types as $type) {
         foreach ($type as $result) {
             $results[] = $result;
         }
     }
     return view('search.show')->with('results', $results)->with('term', $term);
 }
Esempio n. 5
0
 public static function checkTasks()
 {
     $finished_tasks = Task::where('finished_at', '<=', Carbon::now())->orWhere('type', 20)->orderBy('finished_at', 'asc')->get();
     $finished_tasks->each(function ($task) {
         self::finishTask($task);
     });
 }
Esempio n. 6
0
 /**
  * Display the specified resource.
  *
  * @param $timeCardHoursWorkedId
  *
  * @return \Illuminate\Http\Response|\Illuminate\View\View
  */
 public function show($timeCardHoursWorkedId)
 {
     // set appGlobal.clientId to current view, otherwise 'if (appGlobal.clientId)' in TimeCard.js causes a js load failure.
     appGlobals::populateJsGlobalClient();
     // used for routing.
     appGlobals::setSessionVariableAppGlobalTimeCardTableName($timeCardHoursWorkedId);
     // get all task for a specific time_card.date.
     /* @noinspection PhpUndefinedMethodInspection */
     $tasks = Task::where('time_card_hours_worked_id', '=', $timeCardHoursWorkedId)->get()->sortBy('start_time');
     // derive total hours worked.
     $totalHoursWorked = 0;
     foreach ($tasks as $task) {
         $totalHoursWorked += $task->hours_worked;
     }
     // eager load task_type for each task.
     /* @noinspection PhpUndefinedMethodInspection */
     $tasks->load('taskType');
     // get time_card data.
     /* @noinspection PhpUndefinedMethodInspection */
     $timeCard = TimeCardHoursWorked::where('id', '=', $timeCardHoursWorkedId)->get();
     // check if $timeCardHoursWorkedId exists, if not return 404 message.
     if (count($timeCard) == 0) {
         abort(404, 'Your Task ID does not exist.');
     }
     // pass the data to the view.
     return view('pages.userTaskView')->with('tasks', $tasks)->with('timeCard', $timeCard)->with('timeCardHoursWorkedId', $timeCardHoursWorkedId)->with('totalHoursWorked', $totalHoursWorked);
 }
Esempio n. 7
0
 public function postDeleteComplete(Request $request)
 {
     $tasks = \App\Task::where('list_id', $request->list_id)->where('complete', 1)->get();
     foreach ($tasks as $task) {
         $task->delete();
     }
 }
Esempio n. 8
0
 function postTask(Request $request)
 {
     $task = $request->all();
     Task::create($task);
     $comm = Committee::where('id', $task['comm_id'])->first();
     $evnt = Event::where('id', $comm['event_id'])->first();
     //UPDATING WEIGHT OF COMMITTEE AND EVENT
     $comm->increment('weight', $task['weight']);
     $evnt->increment('weight', $task['weight']);
     //UPDATING PROGRESS OF COMMITTEE
     $progress = 0;
     $tasks = Task::where('comm_id', $comm->id)->get();
     foreach ($tasks as $task1) {
         $progress += $task1->weight * $task1->progress;
     }
     $progress = $progress / $comm->weight;
     $comm->progress = $progress;
     $comm->save();
     //UPDATING PROGRESS OF EVENT
     $progress2 = 0;
     $committees = Committee::all();
     foreach ($committees as $committee) {
         if ($committee->event_id == $evnt->id) {
             $progress2 += $committee->weight * $committee->progress;
         }
     }
     $progress2 = $progress2 / $evnt->weight;
     $evnt->progress = $progress2;
     $evnt->save();
     return redirect('profile');
 }
 public function index(Request $request)
 {
     echo "hallo controller tasks";
     //return view('tasks.index');
     $tasks = Task::where('user_id', $request->user()->id)->get();
     //hier waren verkeerde variabelen doorgegeven.
     return view('tasks.index', ['tasks' => $tasks]);
 }
Esempio n. 10
0
 /**
  * new query to find all user's tasks
  * @param  [type] $id [description]
  * @return [type]     [description]
  */
 public static function findByUser($id)
 {
     $task = Task::where('id', $id)->where('user_id', Auth::id())->first();
     if (!$task) {
         throw new ModelNotFoundException();
     }
     return $task;
 }
Esempio n. 11
0
 public function clearComplete()
 {
     $tasks = \App\Task::where('is_complete', true)->get();
     foreach ($tasks as $task) {
         $task->delete();
     }
     return redirect('/');
 }
Esempio n. 12
0
 public function checkIfEndTimeOverLaps($timeCardId, $endTime)
 {
     $val = Task::where('time_card_hours_worked_id', '=', $timeCardId)->where('start_time', '<', $endTime)->where('end_time', '>=', $endTime)->first();
     if (is_null($val)) {
         return false;
     }
     return true;
 }
Esempio n. 13
0
 public static function getWhitelist($user, $tasks)
 {
     $whitelist = $tasks->diff($user->taskExemptions->pluck('task_id'));
     if (($bad = Task::where('slug', 'recycling')->first()->id) && $tasks->contains($bad) && !$user->canDoRecycling()) {
         $whitelist->pull($whitelist->search($bad));
     }
     return $whitelist;
 }
Esempio n. 14
0
 public function delete($id)
 {
     TaskModel::where('project_id', $id)->delete();
     ProjectModel::where('id', $id)->delete();
     $alert['msg'] = 'Project has been deleted successfully';
     $alert['type'] = 'success';
     return Redirect::route('project')->with('alert', $alert);
 }
Esempio n. 15
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index(Request $request)
 {
     $statuses = [];
     foreach (Status::paginate() as $status) {
         $statuses[$status->id] = $status->name;
     }
     $data = ['tasks' => Task::where('user_id', $request->user()->id)->paginate(), 'statuses' => Status::paginate()];
     return view('task.index')->with($data);
 }
Esempio n. 16
0
 /**
  * Show the application dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $nowDateMinusWeek = date('Y-m-d', strtotime("-1 week")) . ' 00:00:00';
     $tasks = Task::where('deleted', false)->where('created_at', '>=', $nowDateMinusWeek)->orderBy('created_at', 'desc')->paginate(15);
     Task::resolveTasksDependencies($tasks);
     $statistics = Statistic::all();
     $statistics_array = array('users' => $statistics[0]->value, 'tasks' => $statistics[1]->value, 'solutions' => $statistics[2]->value);
     return view('home/index', ['tasks' => $tasks, 'statistics' => $statistics_array]);
 }
Esempio n. 17
0
 public function stop($hash)
 {
     $task = Task::where('hash', $hash)->where('state', 'syncing')->get()->first();
     if ($task) {
         $task->command = 'stop';
     }
     $this->signal();
     return back();
 }
Esempio n. 18
0
 public static function getGroupedDateByLineId($lineId)
 {
     $tasks = Task::where('line_id', $lineId)->orderBy('date')->get();
     $tasksGroupedDate = [];
     foreach ($tasks as $task) {
         $tasksGroupedDate[$task->date][$task->type] = $task->content;
     }
     return $tasksGroupedDate;
 }
Esempio n. 19
0
 /**
  * Responds to requests to GET /tasks
  */
 public function getIndex(Request $request)
 {
     $userTasks = \App\Task::where('user_id', '=', \Auth::id())->orderBy('id', 'DESC');
     $completedTasks = \App\Task::where('status', '=', 'Completed')->where('user_id', '=', \Auth::id())->with('owner')->get();
     $inProgressTasks = \App\Task::where('status', '=', 'In progress')->where('user_id', '=', \Auth::id())->with('owner')->get();
     $notStartedTasks = \App\Task::where('status', '=', 'Not Started')->where('user_id', '=', \Auth::id())->with('owner')->get();
     $tasks = $userTasks->with('owner')->get();
     return view('tasks.index')->with('tasks', $tasks)->with('notStartedTasks', $notStartedTasks)->with('inProgressTasks', $inProgressTasks)->with('completedTasks', $completedTasks);
 }
Esempio n. 20
0
 public function delete($id)
 {
     $task = TaskModel::find($id);
     $projectId = $task->project_id;
     TaskModel::where('id', $id)->delete();
     $alert['msg'] = 'Project has been deleted successfully';
     $alert['type'] = 'success';
     return Redirect::route('project.view', $projectId)->with('alert', $alert);
 }
Esempio n. 21
0
 public function itemDone()
 {
     $userId = \Auth::user()->id;
     $task = \Input::get('text');
     $item = Task::where(['task' => $task, 'user_id' => $userId])->first();
     $item->status = 1;
     $item->save();
     \Event::fire(new Purchased($item));
 }
Esempio n. 22
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $prefs = [['name' => 'Jennifer Lamb', 'slug' => 'plants']];
     foreach ($prefs as $pref) {
         $taskPref = new TaskPref();
         $taskPref->user_id = User::where('name', $pref['name'])->first()->id;
         $taskPref->task_id = Task::where('slug', $pref['slug'])->first()->id;
         $taskPref->save();
     }
 }
 public function tearDown()
 {
     $user = \App\User::find(static::$idUser);
     $tasks = \App\Task::where('user_id', '=', $user->id);
     $tasks->forceDelete();
     if (null !== $user) {
         $user->delete();
     }
     parent::tearDown();
 }
 public function index()
 {
     $userType = Auth::user()->type;
     if ($userType == "admin" || $userType == "manager") {
         $tasks = Task::latest()->get();
     } else {
         $tasks = Task::where(['taskType' => 'user', 'assignedTo' => Auth::user()->id])->get();
     }
     return view('tasks.index', compact('tasks'));
 }
Esempio n. 25
0
 /**
  * Display a listing of the resource.
  *
  * @return \Illuminate\Http\Response
  */
 public function index()
 {
     $mynodes = \App\Task::where('user_id', \Auth::user()->id)->count();
     $myonlinenodes = \App\Node::join('tasks', 'tasks.node_id', '=', 'nodes.id')->where('tasks.user_id', \Auth::user()->id)->join('nodestats', 'nodestats.node_id', '=', 'nodes.id')->where('nodestats.isonline', 0)->count();
     $procent = $mynodes > 0 ? $myonlinenodes / $mynodes * 100 : 0;
     $myclients = \App\Nodestat::join('tasks', 'tasks.node_id', '=', 'nodestats.id')->where('tasks.user_id', \Auth::user()->id)->where('clientcount', '>', 0)->get();
     $myclients = $myclients->sum(function ($node) {
         return $node->clientcount;
     });
     return view('home/index')->with('mynodes', $mynodes)->with('onlineprocent', $procent)->with('myclients', $myclients);
 }
Esempio n. 26
0
 /**
  * constraint test
  *
  * @test
  */
 public function POS_it_checks_if_id_of_type_record_exists()
 {
     // this assumes that a Task records exists.
     // see '/create_data; endpoint in routes file.
     $task = Task::where('id', '>', 0)->first();
     // populate task_type.id with task_type_id from task
     $taskType = new TaskType();
     $taskType->id = $task->task_type_id;
     $result = $taskType->checkTaskTypeDeleteAudits($taskType);
     // expected result
     $this->assertEquals($result, appGlobals()::TBL_TASK_TYPE_CONSTRAINT_VIOLATION);
 }
Esempio n. 27
0
 /** @test */
 public function should_return_the_user_that_the_task_belongs_to(FunctionalTester $I)
 {
     // given ... task that belongs to user 1
     $user = User::find(1);
     $I->assertSame('Sherlock Holmes', $user['name']);
     $task = Task::where('name', "solve the crime")->first();
     $I->assertSame($user['id'], intval($task['user_id']));
     // when ... we call get user on that task
     $task_user = $task->user()->first();
     // then ... should return user 1
     $I->assertSame("Sherlock Holmes", $task_user['name']);
 }
Esempio n. 28
0
 public function update(Request $request)
 {
     $inputs = $request->all();
     $task = App\Task::where('title', $inputs['title'])->first();
     // create task if the there is no task with that title
     if (null == $task) {
         $task = App\Task::create(['title' => $inputs['title'], 'carry_over' => 1]);
     }
     if ($inputs['task_id'] != $task->id) {
         $inputs['task_id'] = $task->id;
     }
     return Todo::where('id', $inputs['id'])->update($inputs);
 }
Esempio n. 29
0
 /**
  * Run a general search.
  * @return  array of objects with the search results.
  */
 public function search()
 {
     $q = Input::get("q");
     // redirect user back if nothing was typed
     if (empty(trim($q))) {
         return Redirect::back();
     }
     $clients = Client::where('name', 'like', '%' . $q . '%')->whereUserId(Auth::id())->get();
     $projects = Project::where('name', 'like', '%' . $q . '%')->whereUserId(Auth::id())->get();
     $tasks = Task::where('name', 'like', '%' . $q . '%')->whereUserId(Auth::id())->get();
     $pTitle = "Search Results";
     return View::make('search', compact('q', 'clients', 'projects', 'tasks', 'pTitle'));
 }
Esempio n. 30
0
 public function AddSousTaches(Request $request, $id)
 {
     $id = $id;
     $user = Auth::user()->id;
     $tache = Task::where('id', $id)->where('user_id', $user)->get();
     if ($tache->isEmpty()) {
         return redirect('/list')->with('flash_message_bad', 'Ceci n\'est pas votre tache');
     } else {
         return view('NewSousTache', compact('id'));
     }
     if ($id == 0 || $id == "") {
         return view('errorUrl');
     }
 }