public function show($id) { $student = Issue::with('placements', 'placement', 'receivable.installments', 'educations', 'education', 'earnings', 'punishments', 'returnments', 'presences', 'points', 'retrievals', 'timelines', 'masteries')->find($id); $periods = Teach::with(array('presences' => function ($q) use($id) { $q->where('issue_id', '=', $id); }))->select(DB::raw('month(course_date) as months'), DB::raw('year(course_date) as years'))->groupBy(DB::raw('month(course_date)'))->get(); $presences = array(); foreach ($periods as $period) { $presences[] = array('month' => $period->months, 'year' => $period->years, 'presences' => $this->countPresences($id, $period->months, $period->years), 'presents' => $this->countPresents($id, $period->months, $period->years), 'absents' => $this->countAbsents($id, $period->months, $period->years), 'sicks' => $this->countSicks($id, $period->months, $period->years), 'permits' => $this->countPermits($id, $period->months, $period->years)); } $points = array(); foreach ($student->points as $point) { if ($point->pointable_type == 'Activity') { $points[] = array('date' => $point->pointable->agenda, 'event' => $point->pointable->name, 'point' => $point->point, 'lowest' => $this->getLowest($point->pointable_id), 'highest' => $this->getHighest($point->pointable_id)); } } $handbooks = Handbook::where('project_id', '=', Auth::user()->curr_project_id)->where('generation_id', '=', $student->generation_id)->get(); $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get(); $discounts = Discount::all(); $promotions = Promotion::where('project_id', '=', Auth::user()->curr_project_id)->get(); $vouchers = Voucher::where('project_id', '=', Auth::user()->curr_project_id)->get(); $charges = Charge::where('project_id', '=', Auth::user()->curr_project_id)->get(); $menu = 'student'; return View::make('students.show', compact('student', 'handbooks', 'courses', 'discounts', 'promotions', 'vouchers', 'charges', 'presences', 'points', 'menu')); }
public function index() { $quizzes = Quiz::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get(); $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get(); $menu = 'academic'; return View::make('quizzes.index', compact('quizzes', 'courses', 'menu')); }
public function edit($id) { $movement = Movement::findOrFail($id); $courses = Course::where('location_id', '=', Auth::user()->location_id)->get(); $employees = Employee::all(); $menu = 'student'; return View::make('movements.edit', compact('movement', 'courses', 'employees', 'menu')); }
public function create() { $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get(); $employees = Employee::where('location_id', '=', Auth::user()->location_id)->get(); $classifications = Classification::where('category', '=', 'Resign')->get(); $menu = 'student'; return View::make('resigns.create', compact('courses', 'classifications', 'employees', 'menu')); }
public function filter($date) { $curr_date = $date; $teaches = Teach::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('course_date', '=', $curr_date)->get(); $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get(); $menu = 'academic'; return View::make('presences.index', compact('teaches', 'courses', 'curr_date', 'menu')); }
public function show($id) { $activity = Activity::find($id); $participations = Participation::with('issue', 'employee')->where('activity_id', '=', $id)->get(); $menu = 'academic'; $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get(); return View::make('participations.show', compact('activity', 'participations', 'courses', 'menu')); }
public function getLastIdCourse($id_course) { $id_course = (int) ($id_course / 1000000) * 1000000; $course = Course::where('id', '>', $id_course)->where('id', '<', $id_course + 100)->orderBy('id', 'desc')->first(); if (is_null($course)) { return $id_course; } else { return $course->id; } }
public function create() { $menu = 'registration'; $generations = Generation::all(); $classifications = Classification::where('category', '=', 'Registration')->get(); $locations = Location::where('id', '<>', Auth::user()->location_id)->get(); $employees = Employee::all(); $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('availability', '=', 1)->where('active', '=', 1)->get(); $discounts = Discount::all(); $promotions = Promotion::all(); $vouchers = Voucher::all(); $charges = Charge::all(); $partners = Partner::where('location_id', '=', Auth::user()->location_id)->get(); return View::make('registrations.create', compact('classifications', 'locations', 'employees', 'generations', 'courses', 'charges', 'discounts', 'promotions', 'vouchers', 'partners', 'menu')); }
public function index() { $subjects = Subject::all(); $menu = 'academic'; $statistics = array(); foreach ($subjects as $subject) { $total_a = Mastery::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('subject_id', '=', $subject->id)->where('mastery', '=', 'A')->groupBy('issue_id')->count(); $total_b = Mastery::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('subject_id', '=', $subject->id)->where('mastery', '=', 'B')->groupBy('issue_id')->count(); $total_c = Mastery::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('subject_id', '=', $subject->id)->where('mastery', '=', 'C')->groupBy('issue_id')->count(); $total_d = Mastery::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('subject_id', '=', $subject->id)->where('mastery', '=', 'D')->groupBy('issue_id')->count(); $total_e = Mastery::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('subject_id', '=', $subject->id)->where('mastery', '=', 'E')->groupBy('issue_id')->count(); $statistics[] = array('id' => $subject->id, 'name' => $subject->name, 'a' => $total_a, 'b' => $total_b, 'c' => $total_c, 'd' => $total_d, 'e' => $total_e); } $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get(); return View::make('masteries.index', compact('statistics', 'courses', 'menu')); }
public function products($courseId) { if (isset($courseId)) { $products = Product::where('status', '=', 'active')->where('course_id', $courseId)->get(); if (isset($products)) { $cart = Session::get('cart'); if ($cart) { foreach ($products as $product) { $product->added = 'n'; foreach ($cart as $cartItem) { if ($cartItem['productId'] == $product->id) { $product->added = 'y'; break; } } } } else { $arProducts = array(); foreach ($products as $product) { $product->added = 'n'; } } $course = Course::where('id', $courseId)->with('institute')->first(); if (isset($course)) { $subjects = Product::where('course_id', $courseId)->select('subject')->groupBy('subject')->get(); if (isset($subjects) && count($subjects) > 0) { return View::make('product.list')->with('found', true)->with('products', $products)->with('subjects', $subjects->toArray())->with('course', $course); } else { return View::make('product.list')->with('found', false)->with('course', $course); } } else { return Redirect::to('/'); } } else { return View::make('product.list')->with('found', false)->with('course', $course); } } else { return Redirect::to('/'); } }
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')); }
public function english_language() { $pageTitle = "English Language | excellence in the training & consultancy services in UK "; $data = Course::where('type', 'english-language')->latest('id')->get(); return View::make('pages.english_language', compact('pageTitle', 'data')); }
/** * get full course list with user enroll info * * @param string $email * @return Response */ public static function getCourses($idUser) { $app = \Slim\Slim::getInstance(); if (!User::find($idUser)) { $app->response->setStatus(400); return "User does not exist"; } $courses = Course::where('isPublished', 1)->get(); foreach ($courses as &$value) { unset($value->isPublished); $enrollment = User::find($idUser)->enrollment()->where('course_id', $value->id)->first(); unset($enrollment->user_id); unset($enrollment->course_id); $value->enrollment = $enrollment; $value->saved = MyCourses::where('user_id', $idUser)->where('course_id', $value->id)->count(); //$value->info = Course::find($value->idCourse); } return json_encode($courses); }
public function getProgram($id) { $program = Course::where('id', '=', $id)->get(); return json_encode($program); }
<a class="navbar-brand" href="{{ URL::to('') }}">{{ Config::get('app.projectname') }}</a> </div> <div class="collapse navbar-collapse" id="appnav"> <ul class="nav navbar-nav"> @if(Auth::check()) <li><a href="{{ URL::to('') }}">Home</a></li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">My Courses <span class="fa fa-angle-down"></span></a> <ul class="dropdown-menu" role="menu"> <?php $mycourses = unserialize(Auth::user()->courseids); ?> @forelse($mycourses as $course) <?php $courseinfo = Course::where('uid', '=', $course)->first(); ?> <li><a href="{{ URL::to('c/' . $course) }}">{{ $course }}: {{ $courseinfo->name }}</a></li> @empty <li><a><i>No Courses Found!</i></a></li> @endforelse </ul> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">My Groups <span class="fa fa-angle-down"></span></a> <ul class="dropdown-menu" role="menu"> <?php $allgroups = Group::all(); ?> @forelse($allgroups as $g) <?php
public function loadEnrollmentDetails() { $sessionId = Input::get('sessionId', ''); //if $sessionId is '' then its from employee, so show him his records // Log::info("Starting Laravel Logs..."); // Log::info("Session ID :" . $sessionId); $enroll_array = array(); if ($sessionId == '') { $enrolls = Enroll::with('sessions')->where('status', '!=', 'Approved')->where('user_id', '=', $this->getUserId())->orderBy('id', 'DESC')->take(20)->get(); foreach ($enrolls as $enroll) { $session = Sassion::where('id', '=', $enroll['sassion_id'])->first(array('sassion_name', 'due_date', 'schedule_date', 'delivery_method', 'capacity')); $enroll['sassion_name'] = $session['sassion_name']; $enroll['due_date'] = $session['due_date']; $enroll['capacity'] = $session['capacity']; // $enroll['enrolled'] = 2; //$session['capacity']; $enroll['schedule_date'] = $session['schedule_date']; $enroll['delivery_method'] = $session['delivery_method']; $course = Course::where('id', '=', $enroll['course_id'])->first(array('course_name')); $enroll['course_name'] = $course['course_name']; $user = User::where('id', '=', $enroll['user_id'])->first(array('first_name', 'last_name')); $enroll['user_name'] = $user['first_name'] . ' ' . $user['last_name']; $enroll_array[] = $enroll; } } else { $enrolls = Enroll::with('sessions')->where('status', '!=', 'Approved')->where('sassion_id', '=', $sessionId)->orderBy('id', 'DESC')->take(20)->get(); //TODO here we should check, if he is a manager, but not HR, Admin, then we should load the records //currosponding to its sub-ordinates only. //TODO optimize query, make relation ship so we can avoid executing multiple queries. $session = Sassion::where('id', '=', $sessionId)->first(array('sassion_name', 'due_date', 'schedule_date', 'delivery_method', 'capacity')); foreach ($enrolls as $enroll) { // $each = array_merge($enroll); $enroll['sassion_name'] = $session['sassion_name']; $enroll['due_date'] = $session['due_date']; $enroll['capacity'] = $session['capacity']; $enroll['schedule_date'] = $session['schedule_date']; $enroll['delivery_method'] = $session['delivery_method']; $course = Course::where('id', '=', $enroll['course_id'])->first(array('course_name')); $enroll['course_name'] = $course['course_name']; $user = User::where('id', '=', $enroll['user_id'])->first(array('first_name', 'last_name')); $enroll['user_name'] = $user['first_name'] . ' ' . $user['last_name']; $enroll_array[] = $enroll; } } return Response::jsend('success', $enroll_array); }
public function getSearchCourses($key) { if (isset($key)) { $courses = Course::where('name', 'like', '%' . $key . '%')->get(); if (isset($courses)) { return json_encode(array('message' => 'found', 'courses' => $courses->toArray())); } else { return json_encode(array('message' => 'empty')); } } else { return json_encode(array('message' => 'invalid')); } }
public function listCourses($status, $page) { $adminId = Session::get('admin_id'); if (!isset($adminId)) { return json_encode(array('message' => 'not logged')); } $institute_id = Session::get('institute_id'); if (isset($institute_id)) { $courses = Course::where('institute_id', '=', $institute_id)->where('status', '=', $status)->get(); if (isset($courses) && count($courses) > 0) { return json_encode(array('message' => 'found', 'courses' => $courses->toArray())); } else { return json_encode(array('message' => 'empty')); } } else { return json_encode(array('message' => 'invalid')); } }
public function recapCourse() { $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->get(); $periods = DB::table('registrations')->select(DB::raw('month(registration_date) as months'), DB::raw('year(registration_date) as years'))->groupBy(DB::raw('month(registration_date)'))->get(); $courselists = array(); foreach ($courses as $course) { $statistics = array(); foreach ($periods as $period) { $count = Course::with(array('placements', 'placements.issues.registration'))->join('placements', 'placements.course_id', '=', 'courses.id')->join('issues', 'issues.id', '=', 'placements.issue_id')->join('registrations', 'registrations.id', '=', 'issues.registration_id')->where(DB::raw('month(registrations.registration_date)'), '=', $period->months)->where(DB::raw('year(registrations.registration_date)'), '=', $period->years)->where('courses.id', '=', $course->id)->count(); $statistics[] = array('count' => $count); } $courselists[] = array('id' => $course->id, 'name' => $course->name, 'statistics' => $statistics); } $menu = 'report'; return View::make('reports.recapcourse', compact('periods', 'courselists', 'menu')); }
public function actionPublicCoures($idCourse, $status) { if (Course::where('id', $idCourse)->update(array('status' => $status))) { return Redirect::back()->with('notify', 'Chuyển trạng thái khóa học thành công'); } else { return Redirect::back()->with('error', 'Có lỗi trong quá trình xử lý'); } }
/** * @api {get} /store/courses Get Available Courses for Sale * @apiName Get Available Courses for Sale * @apiGroup Course * @apiDescription Returns a collection of items that can be shown in the store. * <p>Return item with one purchase option.</p> * <p>Return the sale's option with the longest length. </p> * * @apiSuccessExample {json} Success-Response: * HTTP/1.1 200 OK * [ * { * "id": 1, * "code": "Membership", * "name": "Ignitor Labs: Membership", * "pak": "Ignitor Labs Membership", * "manufacturer": "Ignitor Labs", * "shortDescription": null, * "description": null, * "note": null, * "isPublished": 1, * "time": null, * "type": "membership", * "safety": -1, * "html5": 0, * "video": null, * "price": "795", * "idSale": 9, * "thumbnail": "http://localhost:9090/ignitor-api/courses/thumbnail/1" * } * ] */ public static function getStore() { $courses = Course::where('isPublished', 1)->get(); foreach ($courses as &$value) { $price = Price::where('course_id', $value->id)->orderBy('length')->first(); //priority if ($price) { $value['price'] = $price->price; $value['idSale'] = $price->id; } } return $courses->toJson(); }
public function signup_to_course($course_id) { $this->output->set_content_type('application/json'); $output = new stdClass(); $output->status = FALSE; $output->message = ''; $output->content = ''; $this->_transaction_isolation(); $this->db->trans_begin(); $student = new Student(); $student->get_by_id($this->usermanager->get_student_id()); $course = new Course(); $course->where('hide_in_lists', 0); $course->get_by_id($course_id); if ($course->exists()) { if ($course->is_subscription_allowed()) { if ($student->participant->where_related($course)->count() == 0) { if ($course->auto_accept_students == 1) { $participants = new Participant(); $participants->where_related_course($course); $participants->where('allowed', 1); $participants_count = $participants->count(); if ($participants_count >= (int) $course->capacity) { $output->message = $this->lang->line('courses_message_course_is_full'); $output->status = FALSE; $this->db->trans_rollback(); } else { $participant = new Participant(); $participant->allowed = 1; $participant->save(array($student, $course)); $this->db->trans_commit(); $output->message = sprintf($this->lang->line('courses_message_signed_up_for_course_approved'), $this->lang->text($course->name)); $this->parser->assign('course', $course); $output->content = $this->parser->parse('frontend/courses/single_course.tpl', array(), TRUE); $output->status = TRUE; $this->_action_success(); } } else { $participant = new Participant(); $participant->allowed = 0; $participant->save(array($student, $course)); $this->db->trans_commit(); $output->message = sprintf($this->lang->line('courses_message_signed_up_for_course'), $this->lang->text($course->name)); $this->parser->assign('course', $course); $output->content = $this->parser->parse('frontend/courses/single_course.tpl', array(), TRUE); $output->status = TRUE; $this->_action_success(); } } else { $output->message = $this->lang->line('courses_message_already_in_course_or_waiting_for_approwal'); $this->db->trans_rollback(); } } else { $output->message = $this->lang->line('courses_message_subscription_disallowed'); $this->db->trans_rollback(); } } else { $output->message = $this->lang->line('courses_message_course_not_found'); $this->db->trans_rollback(); } $this->output->set_output(json_encode($output)); }
<div class="col-lg-10"> <div class="row-fluid"> <div class="col-lg-6"> <div class="panel panel-primary"> <div class="panel-heading"> <div class="panel-title">My Workgroups</div> </div> <div class="panel-body"> <p class="lead">My Courses</p> <table class="table table-condensed"> <?php $mycourses = unserialize(Auth::user()->courseids); ?> @forelse($mycourses as $courseid) <?php $course = Course::where('uid', '=', $courseid)->first(); ?> <tr><td><a href="{{ URL::to('c/' . $courseid) }}">{{ $courseid }}: {{ $course->name }}</a></td></tr> @empty <tr><td><i>You do not belong to any course groups! Please contact your instructor to add you to the course group.</i></td></tr> @endforelse </table> <hr> <p class="lead">My Groups</p> <table class="table table-condensed"> <?php $allgroups = Group::all(); ?> @forelse($allgroups as $g) <?php $gmembers = unserialize($g->members);
public function loadCourses($generation) { $courses = Course::where('generation_id', '=', $generation)->where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->where('availability', '=', 1)->get(); return $courses->toJson(); }
public function english_language() { $pageTitle = "English Language "; $course_type = Course::course_type(); $data = Course::where('type', 'english-language')->latest('id')->get(); return View::make('admin.course.index', compact('data', 'pageTitle', 'course_type')); }