Пример #1
13
 public function destroy($id)
 {
     $issues = Issue::where('registration_id', '=', $id)->delete();
     $placements = Placement::where('registration_id', '=', $id)->delete();
     $receivables = Receivable::where('registration_id', '=', $id)->get();
     foreach ($receivables as $receivable) {
         $installments = Installment::where('receivable_id', '=', $receivable->id)->get();
         foreach ($installments as $installment) {
             $earnings = Earning::where('earnable_type', '=', 'Installment')->where('earnable_id', '=', $installment->id)->get();
             foreach ($earnings as $earning) {
                 $earning->delete();
             }
             $installment->delete();
         }
         $earnings = Earning::where('earnable_type', '=', 'Receivable')->where('earnable_id', '=', $receivable->id)->delete();
         $reductions = Reduction::where('receivable_id', '=', $receivable->id)->delete();
         $receivable->delete();
     }
     Registration::destroy($id);
     Session::flash('message', 'Sukses membatalkan Pendaftaran!, Semua Data terkait pendaftaran ini telah dihapus!');
 }
 public function show($id)
 {
     try {
         $iteration = Iterations::findOrFail($id);
         $iterations = Iterations::where('projectid', '=', $iteration->projectid)->get();
         $project = Project::findOrFail($iteration->projectid);
         $issues = Issue::where('iterationid', '=', $id)->get();
         //$issues = $iteration->issues;
         $countIssues = sizeof($issues);
         $categories = Category::all();
         $idCategory = 0;
         $totalPoints = $issues->sum('points');
         $materiales = Material::all();
         $personal = PersonalType::all();
         $team = Teams::where('projectid', '=', $project->id)->get()->first();
         $members = DB::table('memberof')->where('teamid', '=', $team->id)->get();
         $hasmembers = sizeof($members) > 0 ? true : false;
         $users = array();
         foreach ($members as $member) {
             $users[] = User::findOrFail($member->usersid);
             echo $hasmembers;
         }
         $this->layout->content = View::make('layouts.iterations.show')->with('iteration', $iteration)->with('iterations', $iterations)->with('issues', $issues)->with('categories', $categories)->with('idCategory', $idCategory)->with('countIssues', $countIssues)->with('totalPoints', $totalPoints)->with('project', $project)->with('materiales', $materiales)->with('personal', $personal)->with('hasmembers', $hasmembers)->with('members', $members)->with('users', $users)->with('message', '');
     } catch (Illuminate\Database\Eloquent\ModelNotFoundException $e) {
         return Redirect::to('/projects/')->with('message', 'Error al crear la iteración');
     }
 }
Пример #3
0
 public function studentPerGenerationFilter($id)
 {
     $generation_id = $id;
     $generation = Generation::find($generation_id);
     $generations = Generation::all();
     $issues = Issue::where('project_id', '=', Auth::user()->curr_project_id)->where('generation_id', '=', $generation_id)->get();
     $menu = 'report';
     return View::make('reports.studentpergeneration', compact('generations', 'generation', 'issues', 'menu'));
 }
 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($string)
 {
     $book_list = Books::select('book_id', 'title', 'author', 'description', 'category_id')->where('title', 'like', '%' . $string . '%')->orWhere('author', 'like', '%' . $string . '%')->orderBy('book_id');
     $book_list = $book_list->get();
     foreach ($book_list as $book) {
         $conditions = array('book_id' => $book->book_id, 'available_status' => 1);
         $count = Issue::where($conditions)->count();
         $book->avaliability = $count > 0 ? true : false;
     }
     return $book_list;
 }
Пример #5
0
 public function suggestIssue($course_id)
 {
     $course = Course::find($course_id);
     $program = Program::find($course->program->id);
     $year = date('y');
     $month = date('m');
     $counter = Issue::where('project_id', '=', Auth::user()->curr_project_id)->count();
     $counter += 1;
     $issue = substr($program->name, 0, 1) . $year . $month . str_pad($counter, 5, "0", STR_PAD_LEFT);
     return Response::json(array('issue' => $issue));
 }
Пример #6
0
 public function newIssue()
 {
     $issue_name = Input::get('issue_name');
     $already_created = Issue::where('issue_name', 'like', '%' . $issue_name . '%');
     $return = array('1' => '1', '2' => '2');
     if (!($already_created->count() > 0)) {
         if (isset($issue_name)) {
             $issue = Issue::create(array('issue_name' => $issue_name, 'created_by' => Auth::user()->id));
             $issue->save();
             return null;
         }
     } else {
         return Response::json(array('issue_name' => $already_created->first()->issue_name));
     }
     //return Response::json($return);
 }
Пример #7
0
 public function showDashboard()
 {
     $menu = '';
     $_301 = Issue::where('generation_id', '=', 1)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
     $_201 = Issue::where('generation_id', '=', 2)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
     $_101 = Issue::where('generation_id', '=', 3)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
     $_302 = Issue::where('generation_id', '=', 4)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
     $_202 = Issue::where('generation_id', '=', 5)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
     $_102 = Issue::where('generation_id', '=', 6)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
     $_603 = Issue::where('generation_id', '=', 7)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
     $_503 = Issue::where('generation_id', '=', 8)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
     $_403 = Issue::where('generation_id', '=', 9)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->count();
     $last_month_registrations = Registration::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where(DB::raw('month(registration_date)'), '<>', date('m'))->where(DB::raw('year(registration_date)'), '=', date('Y'))->count();
     $curr_month_registrations = Registration::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where(DB::raw('month(registration_date)'), '=', date('m'))->where(DB::raw('year(registration_date)'), '=', date('Y'))->count();
     $movement_registrations = Registration::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 10)->count();
     $curr_active_students = Placement::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('active', '=', 1)->count();
     $curr_do_students = Resign::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 13)->count();
     $curr_resign_students = Resign::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 14)->count();
     $curr_relocate_students = Resign::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('classification_id', '=', 15)->count();
     $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
     return View::make('dashboard.home', compact('_301', '_201', '_101', '_302', '_202', '_102', '_603', '_503', '_403', 'last_month_registrations', 'curr_month_registrations', 'movement_registrations', 'curr_active_students', 'curr_do_students', 'curr_resign_students', 'curr_relocate_students', 'courses', 'menu'));
 }
Пример #8
0
 public function search()
 {
     $search_term = Input::get('search_term');
     if (isset($search_term) && $search_term != '') {
         $search_query = '%' . $search_term . '%';
         $politicians = Politician::where('full_name', 'like', $search_query)->orWhere('party', 'like', $search_query)->orWhere('state', 'like', $search_query)->orWhere('city', 'like', $search_query)->orWhere('office', 'like', $search_query)->orWhere('sex', 'like', $search_query)->orWhere('bio', 'like', $search_query)->orWhere('district', 'like', $search_query)->get();
         if ($politicians->count() == 0) {
             $politicians = null;
         }
         $users = User::where('username', 'like', $search_query)->orWhere('first_name', 'like', $search_query)->orWhere('last_name', 'like', $search_query)->orWhere('email', 'like', $search_query)->orWhere('party', 'like', $search_query)->orWhere('state', 'like', $search_query)->orWhere('city', 'like', $search_query)->get();
         if ($users->count() == 0) {
             $users = null;
         }
         $issue = Issue::where('issue_name', '=', $search_term)->first();
         //don't want to repeat same articles in issue and in news.
         //don't want to do unnescesarry google news calls either
         //either news or issues
         if ($issue == null) {
             $news = $this->gNews($search_term);
         } else {
             $news = null;
         }
         $found = !($issue == null && $politicians == null && $news == null && $users == null);
         $user_id = Auth::check() ? Auth::user()->id : 0;
         //we're saving search attempts for study later. who searches and wether results are given.
         $search = Search::create(array('search_term' => $search_term, 'found' => $found, 'user_id' => $user_id));
         $search->save();
     } else {
         $politicians = null;
         $issue = null;
         $news = null;
         $users = null;
     }
     return View::make('results')->with('politicians', $politicians)->with('news', $news)->with('users', $users)->with('issue', $issue);
 }
Пример #9
0
 public function searchIssues($id)
 {
     $iteration = Iterations::findOrFail($id);
     $aux = Issue::where('iterationid', '=', $id)->get();
     return $aux;
 }
Пример #10
0
 public function index()
 {
     $issues = Issue::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->orderBy('generation_id', 'asc')->get();
     $menu = 'student';
     return View::make('students.index', compact('issues', 'menu'));
 }
 public function iterationSummary2($id)
 {
     $iteration = Iterations::findOrFail($id);
     $issues = Issue::where('iterationid', '=', $iteration->id)->get();
     $tasksId = array();
     foreach ($issues as $issue) {
         $tasksId[] = $issue->id;
     }
     $tasks = Task::whereIn('issueid', $tasksId)->get();
     $countTODO = 0;
     $countDOING = 0;
     $countDONE = 0;
     foreach ($tasks as $task) {
         switch ($task->scrumid) {
             case 1:
                 $countTODO++;
                 break;
             case 2:
                 $countDOING++;
                 break;
             case 3:
                 $countDONE++;
                 break;
         }
     }
 }