public function getGoal($name) { $objectives = Objective::All(); $objective = $objectives->where('name', $name)->first(); $objective->toArray(); return $objective->goal_id; }
/** * Create a new controller instance. * * @return void */ public function __construct() { $this->middleware('auth'); $this->viewData['user_id'] = (int) Auth::User()->id; $this->viewData['controller_heading'] = 'Initiatives'; $this->viewData['controller_name'] = $this->controller; $this->viewData['whatisit'] = 'Initiative'; $this->viewData['plans'] = Plan::where('user_id', $this->viewData['user_id'])->where('status', 0)->orderBy('name')->lists('name', 'id'); $this->viewData['currentPlan'] = NULL; if (!empty($_GET['plan_id'])) { $this->viewData['currentPlan'] = Plan::find($_GET['plan_id']); } else { if (!empty($this->viewData['plans'])) { $this->viewData['currentPlan'] = Plan::where('user_id', $this->viewData['user_id'])->where('status', 0)->orderBy('name')->get()->first(); } } $this->viewData['dimensions'] = Dimension::leftJoin('plans', 'plans.id', '=', 'dimensions.plan_id')->where('plans.user_id', $this->viewData['user_id'])->where('dimensions.plan_id', $this->viewData['currentPlan']->id)->where('dimensions.status', 0)->orderBy('dimensions.name')->select('dimensions.*')->lists('dimensions.name', 'dimensions.id'); $this->viewData['currentDimension'] = NULL; if (!empty($_GET['dimension_id'])) { $this->viewData['currentDimension'] = Dimension::find($_GET['dimension_id']); } else { if (!empty($this->viewData['dimensions'])) { $this->viewData['currentDimension'] = Dimension::where('dimensions.plan_id', $this->viewData['currentPlan']->id)->where('dimensions.status', 0)->orderBy('dimensions.name')->get()->first(); } } $this->viewData['currentDimensionId'] = !empty($this->viewData['currentDimension']) ? $this->viewData['currentDimension']->id : ''; $this->viewData['objectives'] = Objective::leftJoin('dimensions', 'dimensions.id', '=', 'objectives.dimension_id')->leftJoin('plans', 'plans.id', '=', 'dimensions.plan_id')->where('plans.user_id', '=', $this->viewData['user_id'])->where('objectives.dimension_id', '=', $this->viewData['currentDimensionId'])->where('objectives.status', 0)->orderBy('objectives.name')->select('objectives.*')->lists('objectives.name', 'objectives.id'); }
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); }
public function addObjective(Request $request, Plan $plan) { if (isset($request->add)) { $newobjective = Objective::create($request->all()); $newobjective->save(); return view('plans.addobjectives')->with('plan', $plan); } else { return view('plans.addactions')->with('plan', $plan); } }
public function remove(Objective $objective) { foreach ($objective->actions as $action) { foreach ($action->tasks as $task) { Task::destroy($task->id); } Action::destroy($action->id); } Objective::destroy($objective->id); return redirect('/plan'); }
/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $this->viewData['success'] = true; $this->viewData['content'] = []; $objective = _MODEL::find($id); // objective if (empty($objective)) { $this->viewData['success'] = false; return response()->json($this->viewData); } $this->viewData['content']['objective'] = $objective; $this->viewData['content']['objective']['initiatives'] = $objective->initiatives; return response()->json($this->viewData); }
/** * Display a listing of the resource. * * @return Response */ public function index() { if (!empty(Input::get('plan_id'))) { $this->viewData['currentPlan'] = Plan::find(Input::get('plan_id')); } $list = _MODEL::leftJoin('plans', 'plans.id', '=', 'dimensions.plan_id')->where('plans.user_id', '=', $this->viewData['user_id'])->where('plans.id', '=', $this->viewData['currentPlan']->id)->select('dimensions.*')->get(); foreach ($list as $row) { $row->AVERAGE = 0; // get objectives list related to dimension $objectives = Objective::where('objectives.dimension_id', '=', (int) $row->id)->select('*')->get(); $objective_AVERAGE = 0; $objective_count = 0; foreach ($objectives as $objective) { //get initiatives related to objective $initiatives = Initiative::where('initiatives.objective_id', '=', (int) $objective->id)->select('*')->get(); $initiative_AVERAGE = 0; $initiative_count = 0; foreach ($initiatives as $initiative) { //get measures related to initiative $measures = Measure::where('measures.initiative_id', '=', (int) $initiative->id)->select('*')->get(); $measure_count = 0; $percent = 0; foreach ($measures as $measure) { $measure->actual = ActualMeasure::where('actual_measures.measure_id', '=', (int) $measure->id)->sum('actual_measures.actual_measure'); if ($measure->target != 0) { $percent += $measure->actual / $measure->target * 100; } $measure_count++; } //end measures if ($measure_count != 0) { $initiative_AVERAGE += $percent / $measure_count; } $initiative_count++; } //end initiative if ($initiative_count != 0) { $objective_AVERAGE += $initiative_AVERAGE / $initiative_count; } $objective_count++; } if ($objective_count != 0) { $row->AVERAGE = $objective_AVERAGE / $objective_count; } } return view($this->controller . '.index', compact('list'), $this->viewData); }
public function remove(Goal $goal) { if ($goal->body == "Non-Business Plan") { return back(); } foreach ($goal->objectives as $objective) { foreach ($objective->actions as $action) { foreach ($action->tasks as $task) { Task::destroy($task->id); } Action::destroy($action->id); } Objective::destroy($objective->id); } Goal::destroy($goal->id); return redirect('/plan'); }
/** * Display a listing of the resource. * * @return Response */ public function index() { $this->viewData['user_id'] = Auth::User()->id; $list = _MODEL::where('user_id', '=', (int) $this->viewData['user_id'])->get(); array_push($this->viewData['breadcrumb'], array()); foreach ($list as $row) { $row->AVERAGE = 0; // get objectives list related to dimension $objectives = Objective::where('objectives.dimension_id', '=', (int) $row->id)->select('*')->get(); $objective_AVERAGE = 0; $objective_count = 0; foreach ($objectives as $objective) { //get initiatives related to objective $initiatives = Initiative::where('initiatives.objective_id', '=', (int) $objective->id)->select('*')->get(); $initiative_AVERAGE = 0; $initiative_count = 0; foreach ($initiatives as $initiative) { //get measures related to initiative $measures = Measure::where('measures.initiative_id', '=', (int) $initiative->id)->select('*')->get(); $measure_count = 0; $percent = 0; foreach ($measures as $measure) { $measure->actual = ActualMeasure::where('actual_measures.measure_id', '=', (int) $measure->id)->sum('actual_measures.actual_measure'); if ($measure->target != 0) { $percent += $measure->actual / $measure->target * 100; } $measure_count++; } //end measures if ($measure_count != 0) { $initiative_AVERAGE += $percent / $measure_count; } $initiative_count++; } //end initiative if ($initiative_count != 0) { $objective_AVERAGE += $initiative_AVERAGE / $initiative_count; } $objective_count++; } if ($objective_count != 0) { $row->AVERAGE = $objective_AVERAGE / $objective_count; } } return view($this->controller . '.index', compact('list'), $this->viewData); }
public function getAverageDimension($dimension) { $dimension->AVERAGE = 0; // get objectives list related to dimension $objectives = Objective::where('objectives.dimension_id', '=', (int) $dimension->id)->select('*')->get(); $objective_AVERAGE = 0; $objective_count = 0; foreach ($objectives as $objective) { //get initiatives related to objective $initiatives = Initiative::where('initiatives.objective_id', '=', (int) $objective->id)->select('*')->get(); $initiative_AVERAGE = 0; $initiative_count = 0; foreach ($initiatives as $initiative) { //get measures related to initiative $measures = Measure::where('measures.initiative_id', '=', (int) $initiative->id)->select('*')->get(); $measure_count = 0; $percent = 0; foreach ($measures as $measure) { $measure->actual = ActualMeasure::where('actual_measures.measure_id', '=', (int) $measure->id)->sum('actual_measures.actual_measure'); if ($measure->target != 0) { $percent += $measure->actual / $measure->target * 100; } $measure_count++; } //end measures if ($measure_count != 0) { $initiative_AVERAGE += $percent / $measure_count; } $initiative_count++; } //end initiative if ($initiative_count != 0) { $objective_AVERAGE += $initiative_AVERAGE / $initiative_count; } $objective_count++; } if ($objective_count != 0) { $dimension->AVERAGE = (double) $objective_AVERAGE / $objective_count; } return $dimension; }
public function editActionFromComments($id, Requests\EditActionRequest $request) { $progress = ['0' => 'Not Started', '1' => 'In Progress', '2' => 'Done']; $model = new Action(); $action = Action::findOrFail($id); $bpid = $model->getBpIdFromAction($id); $objective = Objective::find($action->objective_id)->name; $groups = Group::lists('name', 'id'); $users = User::lists('name', 'id'); $names = explode(', ', $action->collaborators); $selectedUsers = array(); $selectedGroups = array(); foreach ($names as $name) { if (count(User::all()->where('name', $name)) > 0) { array_push($selectedUsers, User::all()->where('name', $name)->first()->id); } if (count(Group::all()->where('name', $name)) > 0) { array_push($selectedGroups, Group::all()->where('name', $name)->first()->id); } } return view('editActionComments', compact('action', 'objective', 'groups', 'users', 'bpid', 'selectedUsers', 'selectedGroups', 'progress')); }
function deleteObjective($idbp, $id) { Objective::findOrFail($id)->delete(); return; }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $objectives = \App\Objective::where('lesson_date', date('Y-m-d'))->get(); return view('display', ['objectives' => $objectives]); }
public function index() { $objectives = \App\Objective::orderBy('lesson_date', 'desc')->orderBy('section_id', 'asc')->get(); return view('admin.all_objectives', ['objectives' => $objectives]); }
/** * Display the specified resource. * * @param int $id * @return Response */ private function populateObjectiveTabularAndGraph($objective_id) { $list = _MODEL::leftJoin('dimensions', 'dimensions.id', '=', 'objectives.dimension_id')->leftJoin('plans', 'plans.id', '=', 'dimensions.plan_id')->where('objectives.id', '=', (int) $objective_id)->select('objectives.*')->get(); $this->viewData['graphData'] = []; $this->viewData['graphData']['title'] = "BSC Report - Objective: " . $list[0]->name; $this->viewData['graphData']['subtitle'] = "Report for " . $list[0]->name . "'s intiatives"; $this->viewData['graphData']['data'] = []; $objective_count = 0; foreach ($list as $objective) { $objective->AVERAGE = 0; //get initiatives related to objective $initiatives = $objective->initiatives; $initiative_AVERAGE = 0; $initiative_count = 0; $total_initiatives = 0; foreach ($initiatives as $initiative) { // get measures related to initiative $measures = $initiative->measures; $measure_count = 0; $percent = 0; foreach ($measures as $measure) { $measure->percent = 0; $measure->actual = ActualMeasure::where('actual_measures.measure_id', '=', (int) $measure->id)->sum('actual_measures.actual_measure'); if ($measure->target != 0) { $percent += $measure->actual / $measure->target * 100; $measure->AVERAGE = $measure->actual / $measure->target * 100; } $measure_count++; } $initiative->measures = $measures; //end measures if ($measure_count != 0) { $initiative_AVERAGE += $percent / $measure_count; $initiative->AVERAGE = $percent / $measure_count; } $initiative_count++; } //end initiative if ($initiative_count != 0) { $objective->AVERAGE += $initiative_AVERAGE / $initiative_count; } $objective_count++; } $this->viewData['objectives'] = $list; self::populateObjectiveGraph(); }