/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $task = Task::find($id); if ($task) { $task->delete(); } }
public function completeTask() { $id = $_GET['id']; $Task = Task::find($id); $Task->complete(); return Redirect::back(); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $tasks = Task::find($id); $tasks->delete(); // redirect return Redirect::route('tasks.index'); }
public static function edit($id) { self::check_logged_in(); $task = Task::find($id); $task->projectids = explode(",", $task->projectids); $projects = Project::all(); View::make('task/edit.html', array('attributes' => $task, 'projects' => $projects)); }
public function destroy($id_task) { $task = Task::find($id_task); if ($task) { $task->delete(); } return Redirect::route('index_admin'); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id) { $input = Input::json(); $task = Task::find($id); $task->title = $input->get('title'); $task->completed = $input->get('completed'); $task->save(); }
/** * Check dead tasks for current worker, and break it if dead. */ public function cleanDeadTasks() { $deadTasks = Task::find()->andWhere(['status' => 'in-progress'])->andWhere('dead_time > NOW()')->all(); foreach ($deadTasks as $deadTask) { $deadTask->status = 'aborted'; $deadTask->save(); } return true; }
/** * Update the specified resource in storage. * PUT /tasks/{id} * * @param int $id * @return Response */ public function update($id) { $task = Task::where('id', $id)->update(Input::all()); if ($task) { $data = Task::find($id); return ['status' => true, 'data' => $data]; } else { return ['status' => false]; } }
public function getEmailtaskopened($id = false) { if (!$id) { return App::abort(404); } $task = Task::find($id); if (!$task) { return App::abort(404); } Taskemails::taskOpened($task); }
function test_find() { $description = "Wash the dog"; $description2 = "Water the lawn"; $test_Task = new Task($description); $test_Task->save(); $test_Task2 = new Task($description2); $test_Task2->save(); $id = $test_Task->getId(); $result = Task::find($id); $this->assertEquals($test_Task, $result); }
public function complete($id) { $date = time(); $task = Task::find($id); $task->done_at = $date; $task->isDone = 1; $task->save(); $tache = Task::where('id', '=', $id)->get(); $titre = $tache[0]->title; Session::flash('completed', "La tâche <em>{$titre}</em> a bien été complété."); return Redirect::to(URL::previous()); }
function test_find() { //Arrange $description = "Wash the Casey"; $description2 = "Eat the taco"; $test_Task = new Task($description); $test_Task->save(); $test_Task2 = new Task($description2); $test_Task2->save(); //Act $id = $test_Task->getId(); $result = Task::find($id); //Assert $this->assertEquals($test_Task, $result); }
public function updateOrder() { Log::debug(__METHOD__); if (Input::get('id') == null) { return 'update_order noop'; } // 並び順の変更はタイムスタンプを更新したくない foreach (Input::get('id') as $i => $task_id) { $target_task = Task::find($task_id); $target_task->timestamps = false; $target_task->order_no = $i; $target_task->save(); $target_task->timestamps = true; } return 'update_order ok'; }
public function edit(Request $request, $id) { //$tache=new Task(); //$tache=Task::all()->where('user_id',$id); $user = Auth::user()->id; $tache = Task::where('id', $id)->where('user_id', $user)->get(); if (!$tache->isEmpty()) { //Ecriture dans la DB de la forme Tache $input = $request->all(); $tache = new Task(); $tache = Task::find($id); $tache->user_id = $user; $tache->name = $request->input('tache'); $tache->descriptionTache = $request->input('description'); $tache->update(); return redirect('/list')->with('flash_message', 'Modifié avec succés'); } else { return redirect('/list')->with('flash_message_bad', "Erreur vous avez modifié l'id"); } }
public function workflowSubmit() { $designation = e(Input::get('designa')); if ($designation == 0) { $des_name = ""; } else { $des = Designation::find($designation); $des_name = e($des->designation); } $id = Input::get('task_id'); $assignd = Task::find($id); $assignd->designation_id = Input::get('designa'); $assignd->save(); if ($designation == 0) { $data = array("html" => "<div id='insert_{$id}' class='mode1'> None </div> <input type='hidden' id='hide_currentDesignation' class='hide_currentDesignation' value='0' > "); } else { $data = array("html" => "<div id='insert_{$id}' class='mode1'> {$des_name} </div> <input type='hidden' id='hide_currentDesignation' class='hide_currentDesignation' value='{$assignd->designation_id}' > "); } return Response::json($data); }
public function getEntries($day, $userId) { try { //Get the entries $tempEntries = Timesheet::where('date', $day)->where('user_id', $userId)->get()->toArray(); $finalEntries = array(); //Get Task Name foreach ($tempEntries as $entry) { if ($entry['task_id'] != null) { $entry['task'] = \Task::find($entry['task_id'])->toArray(); } else { $entry['task'] = null; } $finalEntries[] = $entry; } return $finalEntries; } catch (\Exception $e) { \Log::error('Something Went Wrong in Timesheet Repository - getEntries():' . $e->getMessage()); throw new SomeThingWentWrongException(); } }
/** * This will handle both updating and deleting tasks */ public function updateTask() { if ($_POST) { if (Input::has('delete')) { $task = Task::find(Input::get('id')); if (is_null($task)) { return Redirect::to('tasks/manage'); } $task->delete(); return Redirect::to('tasks/manage'); } elseif (Input::has('edit')) { $task = Task::find(Input::get('id')); if (is_null($task)) { return Redirect::to('tasks/manage'); } return Redirect::to('task/edit')->with('update_task', serialize($task)); } elseif (Input::has('update')) { $task = Task::find(Input::get('id')); if (is_null($task)) { return Redirect::to('tasks/manage'); } $task->name = Input::get('name'); $task->description = Input::get('description'); $task->didyouknow = Input::get('didyouknow'); $task->reference = Input::get('reference'); $task->author = Input::get('taskauthor'); $task->save(); return Redirect::to('tasks/manage'); } } $task = unserialize(Session::get('update_task')); if (is_null($task) || empty($task->id)) { return Redirect::to('tasks/manage'); } return $this->layout->content = View::make('task.edit')->with('task', $task); }
$prfirstdate = date('Y-m-d', strtotime($purchase->dateReceived)); $sectionfirstdate = date('Y-m-d', strtotime($purchase->dateReceived)); if ($taskc->id == $taskp->id) { $lastid = $taskc->id - 1; } else { $lastid = $taskp->id; } } else { if ($taskp->status == "Pending") { } else { $taskprevlast = TaskDetails::find($taskp->id - 1); $taskprevtask = Task::find($taskprevlast->task_id); if ($taskprevtask->section_id != $tasks->section_id) { $sectionfirstdate = date('Y-m-d', strtotime($taskp->dateFinished)); } $taskctask = Task::find($taskc->task_id); if ($taskctask->section_id == $tasks->section_id) { if ($taskc->id == $taskp->id) { $lastid = $taskc->id - 1; } else { $lastid = $taskp->id; } if ($purchase->status == "Closed") { $lastid = $taskp->id; } } else { $lastid = $taskp->id; } } } //End Initializers Total Function
$task = Task::find($id); return $app['twig']->render('task_edit.html.twig', array('task' => $task)); }); $app->patch("/tasks/{id}", function ($id) use($app) { $task = Task::find($id); $task->update($_POST['description'], $_POST['due_date']); return $app['twig']->render('tasks.html.twig', array('tasks' => Task::getAll())); }); $app->delete("/tasks/{id}", function ($id) use($app) { $task = Task::find($id); $task->delete(); return $app['twig']->render('tasks.html.twig', array('tasks' => Task::getAll())); }); $app->post("/add_categories", function () use($app) { $category = Category::find($_POST['category_id']); $task = Task::find($_POST['task_id']); $task->addCategory($category); return $app['twig']->render('task.html.twig', array('task' => $task, 'tasks' => Task::getAll(), 'categories' => $task->getCategories(), 'all_categories' => Category::getAll())); }); $app->get("/categories/{id}/edit", function ($id) use($app) { $category = Category::find($id); return $app['twig']->render('category_edit.html.twig', array('category' => $category)); }); $app->patch("/categories/{id}", function ($id) use($app) { $category = Category::find($id); $category->update($_POST['name']); return $app['twig']->render('categories.html.twig', array('categories' => Category::getAll())); }); $app->delete("/categories/{id}", function ($id) use($app) { $category = Category::find($id); $category->delete();
//actualizar a finalizado la tarea $task->closed = 'SI'; $task->save(); } $user = User::findOrFail($task->userid); return Response::json(array('succes' => '1', 'task' => $task, 'user' => $user, 'final' => $final)); } }); /** * grabar un gasto adicional de la tarea **/ Route::get('tareas/delete', function () { if (Request::ajax()) { $id = Input::get("id"); if (!empty(Input::get("id"))) { $task = Task::find($id); $issue = $task->issue; $iteration = $issue->iterations; $iteration->realTime = $iteration->realTime - $task->timeReal; $iteration->estimatedTime = $iteration->estimatedTime - $task->timeEstimated; $iteration->save(); $task->delete(); } return Response::json(array('succes' => '1')); } }); /** * grabar un gasto adicional de la tarea **/ Route::get('aditionalCost/save', function () { if (Request::ajax()) {
public function taskpagecall($id) { $user_id = Auth::User()->id; $taskd = TaskDetails::find($id); $task = Task::find($taskd->task_id); $desig = UserHasDesignation::where('users_id', $user_id)->where('designation_id', $task->designation_id)->count(); if ($taskd->status == "Done") { return Redirect::to("task/active"); } if ($taskd->status == "New") { if ($desig == 0) { return Redirect::to('/'); } else { Session::put('taskdetails_id', $id); return View::make('tasks.task'); } } else { if ($taskd->assignee_id == $user_id) { Session::put('taskdetails_id', $id); return View::make('tasks.task'); } else { return Redirect::to('/'); } } }
function test_find() { //Arrange $description = "Wash the dog"; $due_date = '2015-01-01'; $id = 1; $test_task = new Task($description, $id, $due_date); $test_task->save(); $description2 = "Water the lawn"; $id2 = 2; $test_task2 = new Task($description2, $id2, $due_date); $test_task2->save(); //Act $result = Task::find($test_task->getId()); //Assert $this->assertEquals($test_task, $result); }
public function postSavereassignment() { if (!Request::ajax()) { return App::abort(404); } $fields = ["user" => Input::get("user"), "id" => Input::get("id")]; $rules = ["user" => "required|numeric|exists:users,id", "id" => "required|numeric|exists:tasks,id"]; $customMessages = ["user.required" => "Вы не выбрали сотрудника"]; $validator = Validator::make($fields, $rules, $customMessages); if ($validator->fails()) { $error = ""; foreach (array_keys($fields) as $k) { $message = $validator->messages()->first($k); if ($message) { $error .= $message; } } return Response::json(["error" => $error]); } $task = Task::find(Input::get("id")); if (!$task) { return App::abort(404); } $task->deadline_at = $this->makeDeadlineDate(); $task->save(); $assign = new Taskassign(); $assign->task_id = Input::get("id"); $assign->user_from_id = $this->userdata->id; $assign->user_to_id = Input::get("user"); $assign->save(); Taskemails::taskAssigned($assign); return Response::json(["error" => ""]); }
function test_find() { //Arrange $name = "Home stuff"; $id = null; $test_category = new Category($name, $id); $test_category->save(); $description = "Wash the dog"; $user_date = "2015-08-18"; $category_id = $test_category->getId(); $test_task = new Task($description, $user_date, $id, $category_id); $test_task->save(); $description2 = "Water the lawn"; $user_date2 = "2015-08-18"; $test_task2 = new Task($description2, $user_date2, $id, $category_id); $test_task2->save(); //Act $result = Task::find($test_task->getId()); //Assert $this->assertEquals($test_task, $result); }
</div> <div class="user-task-track"> @include('play.tasktrack') </div> </div> <div class="col-md-8"> <div class="user-welcome"> <div class="image"> <span class="statuspagewelcome">{{ trans('master.statuspagewelcome',['name'=>$user->firstname]) }}</span> </div> </div> <?php $userCurrentTask = $user->getPendingTask($group->id, $group->outcome); if (!empty($userCurrentTask)) { $currentTask = Task::find($userCurrentTask[0]->task_id); } else { $currentTask = 0; } if ($currentTask) { $hasPosted = $user->hasPosted($group->id, $currentTask->id); } ?> @include('plugins.rolledTask') <div class="status-page-instr"> </div> <div class="status-container"> @if($errors->any()) <div class="alert alert-danger"> <a class="close" href="#" data-dismiss="alert">x</a> <ul>
return $app['twig']->render('categories.html.twig', array('categories' => Category::getAll())); }); $app->get("/categories/{id}", function ($id) use($app) { $category = Category::find($id); $tasks = $category->getTasks(); var_dump($tasks[0]); var_dump($tasks[1]); return $app['twig']->render('category.html.twig', array('category' => $category, 'tasks' => $category->getTasks(), 'all_tasks' => Task::getAll())); }); $app->post("/add_tasks", function () use($app) { $category = Category::find($_POST['category_id']); $task = Task::find($_POST['task_id']); $category->addTask($task); return $app['twig']->render('category.html.twig', array('category' => $category, 'categories' => Category::getAll(), 'tasks' => $category->getTasks(), 'all_tasks' => Task::getAll())); }); $app->post("/add_categories", function () use($app) { $category = Category::find($_POST['category_id']); $task = Task::find($_POST['task_id']); $task->addCategory($category); return $app['twig']->render('task.html.twig', array('task' => $task, 'tasks' => Task::getAll(), 'categories' => $task->getCategories(), 'all_categories' => Category::getAll())); }); $app->patch("/task_update", function () use($app) { $mark = $_POST['mark']; $task_id = $_POST['task_id']; var_dump($mark); $task = Task::find($task_id); $task->updateMark($mark); $category = Category::find($_POST['category_id']); return $app['twig']->render('category.html.twig', array('category' => $category, 'tasks' => $category->getTasks())); }); return $app;
function test_find() { //Arrange $id = 1; $description = "Wash the dog"; $date_due = "1990-12-11"; $time_due = "09:00:00"; $test_task = new Task($id, $description, $date_due, $time_due); $test_task->save(); $id2 = 2; $description2 = "Water the lawn"; $date_due2 = "1990-11-11"; $time_due2 = "09:01:00"; $test_task2 = new Task($id2, $description2, $date_due2, $time_due2); $test_task2->save(); //Act $result = Task::find($test_task->getId()); //Assert $this->assertEquals($test_task, $result); }
function testFind() { //arrange $description = "Wash the dog"; $id = 1; $test_task = new Task($description, $id); $test_task->save(); $description2 = "Water the lawn"; $id2 = 2; $test_task2 = new Task($description2, $id); $test_task2->save(); //act $result = Task::find($test_task->getId()); //assert $this->assertEquals($test_task, $result); }
/** * Remove the specified resource from storage. * DELETE /tasks/{id} * * @param int $id * @return Response */ public function destroy($id) { $task = Task::find(Input::get('id')); $task->delete(); return Redirect::back(); }
public function tasksUpdate() { if (isset($_POST['task_id'])) { $tasks = Task::find($_POST['task_id']); foreach ($tasks as $t) { /** * @var Task $t */ $action_status = array('Enable' => TaskInterface::TASK_STATUS_ACTIVE, 'Disable' => TaskInterface::TASK_STATUS_INACTIVE, 'Delete' => TaskInterface::TASK_STATUS_DELETED); $t->setStatus($action_status[$_POST['action']]); $t->save(); } } }