function view($id = null) { if (is_null($id)) { echo "error: no id supplied"; return false; } $this->load->library('bitly'); $this->form_validation->set_rules('name', 'Task Name', 'required|trim'); $data = array(); $docket = new Docket(); $task = new Task(); $user = new User(); if (!$docket->where('shared', 1)->where('id', $id)->count()) { redirect('dockets'); } else { $data['docket'] = $docket->get_by_id($id); } if ($docket->short_url == '') { $docket->short_url = $this->bitly->shorten(base_url() . 'index.php/pub/view/' . $docket->id); $docket->save(); } if ($task->where('completed', 0)->where_related_docket('id', $docket->id)->count() == 0) { $data['pending_tasks'] = array(); } else { $data['pending_tasks'] = $task->where('completed', 0)->where_related_docket('id', $docket->id)->get()->all; } if ($task->where('completed', 1)->where_related_docket('id', $docket->id)->count() == 0) { $data['completed_tasks'] = array(); } else { $data['completed_tasks'] = $task->where('completed', 1)->where_related_docket('id', $docket->id)->get()->all; } $data['user'] = $user->get_by_id($docket->user_id); $this->load->view('pub/view', $data); }
function uncomplete_task() { $id = $this->input->post('id'); $user = new User(); $task = new Task(); if ($task->where('user_id', $this->dx_auth->get_user_id())->where('id', $id)->count() == 0) { return; } $task->get_by_id($id); $task->completed = 0; $task->save(); $docket = new Docket(); $docket->get_by_id($task->docket_id); $task->clear(); if ($task->where('docket_id', $docket->id)->where('completed', 0)->count() == 0) { $docket->completed = 1; $docket->save(); } else { $docket->completed = 0; $docket->save(); } $gold = $this->treasure->decrease($this->dx_auth->get_user_id()); $task->clear(); $task->get_by_id($id); $result = array('id' => $task->id, 'name' => $task->name, 'docket_id' => $docket->id, 'gold' => $gold); echo json_encode($result); }
/** * Update the specified resource in storage. * PUT /tasks/{id} * * @param int $id * @return Response */ public function update($id) { $tasks = Task::where('id', $id)->update(Input::all()); if ($tasks) { return ['status' => true, 'data' => $tasks]; } else { return ['status' => false]; } }
/** * 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 add() { $this->load->library('jdf'); $this->load->helper('form'); $this->load->library('form_validation'); $this->load->library("session"); if ($this->form_validation->run('item/add') === FALSE) { $this->load->view("templates/errorForm.php", array("fields" => array('rating', 'isDone', 'task', 'date', 'endTime', 'startTime'))); } else { $item = new Item(); $task = new Task(); $user = new User($this->session->getStudentId()); if ($this->input->post("isDone") == 1) { $state = ITEM_STATE_DONE; } else { $state = ITEM_STATE_UNDONE; } $task->where("user_id", $this->session->getStudentId()); $task->where("id", $this->input->post("task")); $start = makeTime($this->input->post("date"), $this->input->post("startTime")); $end = makeTime($this->input->post("date"), $this->input->post("endTime")); try { $task->get(); $item->create($start, $end, $this->input->post("description"), $state, $this->input->post("rating"))->save($user, $task); $this->load->view("item/item_created.php", array("item" => $this->setFormat(array($item)))); } catch (Item_Overlap_With_Other_Item $e) { $this->load->view("item/item_error.php"); Item_Error::Item_Overlap_With_Other_Item(); } catch (Item_Create_With_Zero_Duration $e) { $this->load->view("item/item_error.php"); Item_Error::Item_Create_With_Zero_Duration(); } catch (Item_Feedback_Wrong $e) { $this->load->view("item/item_error.php"); Item_Error::Item_Feedback_Wrong(); } catch (Item_Start_Greater_Than_End_Exception $e) { $this->load->view("item/item_error.php"); Item_Error::Item_Start_Greater_Than_End_Exception(); } catch (Task_Not_Found $e) { $this->load->view("task/task_error.php"); } } }
/** * Remove the specified resource from storage. * DELETE /users/{id} * * @param int $id * @return Response */ public function destroy($id) { // Delete everything related to the user Task::where('user_id', Auth::id())->delete(); Credential::where('user_id', Auth::id())->delete(); Project::where('user_id', Auth::id())->delete(); Client::where('user_id', Auth::id())->delete(); User::where('id', Auth::id())->delete(); // Logout and redirect back to home page Auth::logout(); return Redirect::to('/'); }
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()); }
/** * 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')); }
public function storage() { $user_id = 2; if (Task::where('user_id', $user_id)->count()) { $task = Task::where('user_id', $user_id)->first(); } else { $task = new Task(); } $task->user_id = $user_id; $task->tasks = json_encode($_POST); $task->save(); exit; }
private function checkExist($user, $name) { $task = new Task(); /** * midoonam ridam to in ghete code !!! */ try { $task->where(array("name" => $name))->get_by_related($user); // echo $task->check_last_query(); throw new Task_Whit_This_Name_Already_Exist(); } catch (Task_Not_Found $e) { } }
/** * Display a listing of the resource. * * @return Response */ public function index() { if (Input::get('searchTitle') || Input::get('searchDescription') || Input::get('searchComplaint')) { $searchComplaint = Input::get('searchComplaint'); $searchTitle = Input::get('searchTitle'); $searchDescription = Input::get('searchDescription'); $complaint = Task::where('complaint', 'NOT LIKE', "No complaints so far.")->where(function ($query) use($searchTitle, $searchDescription, $searchComplaint) { $query->where('title', 'LIKE', "%{$searchTitle}%")->where('complaint', 'LIKE', "%{$searchComplaint}%")->where('description', 'LIKE', "%{$searchDescription}%"); })->paginate(5); return View::make('complaints.complaint', ['tasks' => $complaint]); } $complaint = Task::where('complaint', 'NOT LIKE', "No complaints so far.")->paginate(5); return View::make('complaints.complaint', ['tasks' => $complaint]); }
public function viewEdit($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('/update', compact('id')); } if ($id == 0 || $id == "") { return view('errorUrl'); } }
private function getTask($id) { $this->load->library("session"); $task = new Task(); $whereArr = array(); if ($id != "all") { $whereArr["id"] = $id; } $whereArr["user_id"] = $this->session->getStudentId(); $task->where($whereArr)->get(); $tasks = array(); /** @var Task $t */ foreach ($task as $t) { $tasks[] = array("id" => $t->getId(), "name" => $t->getName(), "color" => $t->getColor()); } return $tasks; }
public function show() { //show my tasks page if (Auth::check()) { $id = Auth::user()->id; if (Input::has('search')) { $search = Input::get('search'); $taskIds = Task::where('employee_id', '=', $id)->where(function ($query) use($search) { $query->where('description', 'LIKE', "%{$search}%")->orwhere('title', 'LIKE', "%{$search}%"); })->paginate(5); return View::make('tasks.userTasks', ['taskIds' => $taskIds]); } $taskIds = Task::where('employee_id', '=', $id)->paginate(5); return View::make('tasks.userTasks', ['taskIds' => $taskIds]); } return View::make('home.home'); }
function atom($id) { if ($id == '') { echo 'No Feed exists at this address'; return; } $docket = new Docket(); $task = new Task(); $user = new User(); $data['docket'] = $docket->get_by_id($id); if ($docket->shared == 0) { echo 'No Feed exists at this address'; return; } $data['tasks'] = $task->where('docket_id', $docket->id)->get()->all; $data['author_name'] = $user->get_by_id($docket->user_id); $this->load->view('feed/atom', $data); }
function email_docket($docket_id, $to, $from_email, $from_name) { $this->ci->load->library('email'); $this->email->from($from_email, $from_name); $this->email->to($to); $this->email->subject($from_name . 'wants to share this Docket with you'); $message = "Hi There\n\n%s wants to share the following Docket with you\n\n%s\n\nRegards,\nDockets Team"; $docket = new Docket(); $tasks = new Task(); $docket->get_by_id($id); $tasks->where('docket_id', $id)->get(); foreach ($tasks->all as $task) { $status = $task->pending ? "Pending" : "Completed"; $task_list .= '> ' . $task->name . " (" . $task->due . ") [" . $status . "]" . "\n\r"; } $message = sprintf($message, $this->dx_auth->get_username(), $task_list); $this->email->message($message); return $this->email->send(); }
/** * Delete project */ public function deleteProject($projectId, $userId) { //Get the task Ids of the project $tasks = \Task::where('project_id', $projectId)->lists('id'); if ($tasks == null) { //No Tasks. Delete data and users from the database $projectUsers = ProjectUsers::where('project_id', $projectId)->delete(); $project = Project::find($projectId); $project->deleted_by = $userId; $project->save(); $project->delete(); return true; } else { //Delete all users and data for all tasks of the project. Also delete all the users and data for the project $projectUsers = ProjectUsers::where('project_id', $projectId)->delete(); $taskUsers = TaskUser::whereIn('task_id', $tasks)->delete(); //$tasks = Task::where('project_id',$projectId)->delete(); foreach ($tasks as $taskId) { $task = \Task::find($taskId); $task->deleted_by = $userId; $task->save(); $task->delete(); } $project = Project::find($projectId); $project->deleted_by = $userId; $project->save(); $project->delete(); return true; } }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($user_id) { $entry = User::findOrFail($user_id); $user = $entry['username']; $entry->delete(); $count = Logbook::where('user_id', '=', $user_id)->count(); $logbooks = Logbook::where('user_id', '=', $user_id)->update(array('user_id' => 0)); $tasks = Task::where('user_id', '=', $user_id)->update(array('user_id' => 0)); $attachments = Attachment::where('user_id', '=', $user_id)->update(array('user_id' => 0)); if ($count == 1) { return Redirect::to(route('settings.index'))->with('message', ['content' => 'Gebruiker met succes verwijderd! Let op, ' . $count . ' logboek van gebruiker ' . $user . ' is veranderd naar eigenaar Systeem!', 'class' => 'warning']); } else { if ($count > 1) { return Redirect::to(route('settings.index'))->with('message', ['content' => 'Gebruiker met succes verwijderd! Let op, ' . $count . ' logboeken van gebruiker ' . $user . ' zijn veranderd naar eigenaar Systeem!', 'class' => 'warning']); } } return Redirect::to(route('settings.index'))->with('message', ['content' => 'Gebruiker met succes verwijderd!', 'class' => 'success']); }
function email_docket($id) { $data['id'] = $id; $data['message'] = null; $this->form_validation->set_rules('email', 'Email Address', 'required|trim|valid_email'); if ($this->form_validation->run() == false) { } else { $data['message'] = '<p class="success">This Docket has been successfully emailed to ' . $this->input->post('email') . '</p>'; $this->load->library('profile'); $from_name = $this->profile->get_name($this->dx_auth->get_user_id()); $this->email->from($this->dx_auth->get_user_email(), $from_name); $this->email->to($this->input->post('email')); $this->email->subject($from_name . ' wants to share this Docket with you'); $message = "Hi There\n\n%s wants to share the following Docket with you\n\n%s\n\nRegards,\nDockets Team"; $docket = new Docket(); $tasks = new Task(); $docket->get_by_id($id); $tasks->where('docket_id', $id)->get(); foreach ($tasks->all as $task) { $status = $task->pending ? "Pending" : "Completed"; $task_list .= '> ' . $task->name . " (" . $task->due . ") [" . $status . "]" . "\n\r"; } $message = sprintf($message, $from_name, $task_list); $this->email->message($message); $this->email->send(); } $this->load->view('ajax/email_docket', $data); }
public function taskState($task_id) { $task = Task::where('id', $task_id)->first(); return $task->state; }
public function getClose($id = false) { if (!$id) { return App::abort(404); } $item = Task::find($id); if (!$item) { return App::abort(404); } // если в задаче есть незакрытый этап бизнес логики, то осуществить переназначение задачи вместо закрытия $businessLogic = $item->logic; if ($businessLogic) { foreach ($businessLogic->steps()->orderBy("sort")->get() as $step) { $assinment = Taskassign::where("task_id", $item->id)->where("logicstep_id", $step->id)->first(); if ($assinment) { continue; } $position = $step->position; if (!$position) { continue; } $user = $position->users()->first(); if (!$user) { continue; } $assign = new Taskassign(); $assign->task_id = $item->id; $assign->logicstep_id = $step->id; $assign->user_from_id = $item->author_id; $assign->user_to_id = $user->id; $assign->save(); Taskemails::taskAssigned($assign); return Redirect::to($_SERVER["HTTP_REFERER"])->with("message", "Задача согласована и переназначена другому исполнителю."); } } // если есть незакрытые подзадачи, то закрыть нельзя $countOpenedSubtasks = Task::where("subtask_id", $item->id)->where("is_active", 1)->count(); if ($countOpenedSubtasks > 0) { $message = "У этой задачи есть незакрытые подзадачи. Вы сможете закрыть задачу только после закрытия подзадач."; return Redirect::to($_SERVER["HTTP_REFERER"])->with("error", $message); } // в других случаях закрыть задачу $item->who_closed_id = $this->userdata->id; $item->closed_at = date("Y-m-d H:i:s"); $item->is_active = 0; $item->save(); Taskemails::taskClosed($item); return Redirect::to($_SERVER["HTTP_REFERER"])->with("message", "Задача закрыта."); }
public function isBidder($task_id) { $task = Task::where(['id' => $task_id])->first(); if ($task->type == 1) { $bidder_array = CommitPivot::where(['task_id' => $task_id, 'user_id' => Auth::user()->id])->get(); } else { if ($task->type == 2) { $bidder_array = QuotePivot::where(['task_id' => $task_id, 'user_id' => Auth::user()->id])->get(); } } if (count($bidder_array)) { return true; } else { return false; } }
public function postOrder() { $task_ids = explode(',', Input::get('taskIds')); foreach ($task_ids as $task_id) { $task = Task::where('id', $task_id)->first(); $winning_commit = $task->winningCommit; echo $winning_commit->user->alipay_account; echo '<br />'; } }
function check_task($name) { $task = new Task(); if ($task->where('name', $name)->where('docket_id', $this->uri->segment(3))->where('user_id', $this->dx_auth->get_user_id())->count() > 0) { $this->form_validation->set_message('check_task', 'You already have a task with same title'); return false; } else { return true; } }
public function postDelay($task_id) { $userInput = ['expiration' => Input::get('expiration')]; $rules = ['expiration' => 'required']; $validator = Validator::make($userInput, $rules); if ($validator->passes()) { $task = Task::where('id', $task_id)->first(); $task->expiration = $userInput['expiration']; $task->state = 1; $task->save(); } return Redirect::back(); }
/** * Remove the specified resource from storage. * DELETE /projects/{id} * * @param int $id * @return Response */ public function destroy($id) { $pTitle = "Projects"; $project = Project::find(Input::get("id")); // delete everything associated with project Task::where('project_id', Input::get("id"))->delete(); Credential::where('project_id', Input::get("id"))->delete(); $project->members()->detach(); // delete the project $project->delete(); $counter = 0; $user = User::find(Auth::id()); $projects = $user->projects()->get(); $inProjects = $user->inProjects()->orderBy('created_at', 'desc')->take(5)->get(); return View::make('projects.index', compact(['projects', 'counter', 'inProjects', 'pTitle'])); }
$users = array(); foreach ($members as $member) { $users[] = User::findOrFail($member->usersid); } return Response::json(array('task' => $task, 'users' => $users)); } }); //get all task Route::get('tareas/taskAll', function () { if (Request::ajax()) { $id = Input::get("id"); $idUser = Input::get("idUser"); $tasks = Task::where('issueid', '=', $id)->get(); $userLoggedIn = User::findOrFail($idUser); if ($userLoggedIn->rol != 'Administrator') { $tasks = Task::where('issueid', '=', $id)->where('userid', '=', $userLoggedIn->id)->get(); } foreach ($tasks as $task) { if ($task->userid != null) { $user = User::findOrFail($task->userid); $task->username = $user->name; } } return Response::json(array('tasks' => $tasks)); } }); //udpate STATE task Route::get('tareas/updateTaks', function () { if (Request::ajax()) { $id = Input::get("id"); $state = Input::get("state");
public function postRate($task_id) { $task = Task::where('id', $task_id)->first(); $comment = new Comment(); $userInput = ['user_id' => Input::get('user_id'), 'star' => Input::get('star'), 'content' => Input::get('content'), 'from_whom_id' => $task->user->id]; $rules = ['content' => 'required']; $validator = Validator::make($userInput, $rules); if ($validator->passes()) { $comment->from_whom_id = $userInput['from_whom_id']; $comment->user_id = $userInput['user_id']; $comment->star = $userInput['star']; $comment->content = $userInput['content']; $comment->save(); CommitPivot::where('id', $task->winning_commit_id)->update(['comment_id' => $comment->id]); return Redirect::to('dashboard/taskOrder'); } else { return Redirect::to("/dashboard/rate/{$task_id}")->withErrors($validator); } }
if ($taskch == 0) { $taskc = TaskDetails::where('doc_id', $docs->id)->where('status', 'Done')->orderBy('id', 'DESC')->first(); } else { $taskc = TaskDetails::where('doc_id', $docs->id)->where('status', 'New')->orWhere('status', 'Active')->first(); } //Queries $workflow = Workflow::find($docs->work_id); $section = Section::where('workflow_id', $workflow->id)->orderBy('section_order_id', 'ASC')->get(); $taskd = TaskDetails::where('doc_id', $docs->id)->orderBy('id', 'ASC')->get(); $sectioncheck = 0; $prdays = 0; $lastid = 0; if ($taskexist != 0) { foreach ($section as $sections) { $sectiondays = 0; $task = Task::where('section_id', $sections->section_order_id)->where('wf_id', $workflow->id)->orderBy('order_id', 'ASC')->get(); echo "<div class='panel panel-success'><div class='panel-heading'><h3 class='panel-title'>" . $sections->section_order_id . ". " . $sections->sectionName . "</h3></div>"; echo "<div class='panel-body'>"; echo "<table border='1' class='workflow-table'>"; //Addon Display $otherc = OtherDetails::where('section_id', $sections->id)->count(); if ($otherc != 0) { $otherd = OtherDetails::where('section_id', $sections->id)->get(); foreach ($otherd as $otherdetails) { if ($otherdetails->label == "Total Days for BAC Documents Preparation" || $otherdetails->label == "Compliance" || $otherdetails->label == "Remarks") { } else { echo "<tr><td width='30%'><b>" . $otherdetails->label . "</b></td>"; $valuesc = Values::where('otherDetails_id', $otherdetails->id)->where('purchase_request_id', $purchase->id)->count(); $values = Values::where('otherDetails_id', $otherdetails->id)->where('purchase_request_id', $purchase->id)->first(); ?> @if ($valuesc==0)
public function fetchMissionByPostID() { // get all post / get input $input = Input::all(); // get the task id from post id $post = Post::where('id', $input['postid'])->take(1)->get(); // get the task conttent $task = Task::where('id', $post[0]['task_id'])->take(1)->get(); // return the task content to the client return json_encode($task[0]); }