/** * Store a newly created resource in storage. * * @return Response */ public function store() { $faculties = new Faculty(); $faculties->faculty_code = Input::get('faculty_code'); $faculties->faculty_name = Input::get('faculty_name'); $faculties->save(); Session::flash('message', 'You have successfully added faculty'); return Redirect::to('dashboard/admin/faculties'); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { // $faculty = Faculty::all(); $data = array('faculties' => $faculty, 'name' => 'hrishikesh', 'age' => 26); return view('faculty.list', $data); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $courses = Course::find($id); $programStudies = ProgramStudy::lists('name', 'id'); $faculties = Faculty::lists('faculty_name', 'faculty_code'); $studies = Study::lists('study_name', 'id'); return view('dashboard.admin.course.edit', ['course' => $courses, 'programStudy' => $programStudies, 'faculty' => $faculties, 'study' => $studies]); }
/** * Bootstrap any application services. * * @return void */ public function boot() { Validator::extend('future', function ($attribute, $value, $parameters) { return Carbon::parse($value)->isFuture(); }); view()->composer('includes.public.svmenu', function ($view) { $view->with('faculties', Faculty::all()); }); }
/** * Run the database seeds. * * @return void */ public function run() { Model::unguard(); DB::table('faculty')->delete(); $faculties = array(['faculty_name' => 'Faculty of engineering'], ['faculty_name' => 'Faculty of computer science and IT']); foreach ($faculties as $faculty) { Faculty::create($faculty); } }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $students = Student::find($id); $faculties = Faculty::lists('faculty_name', 'faculty_code'); $studies = Study::lists('study_name', 'id'); $programStudies = ProgramStudy::lists('name', 'id'); $academicRegistrations = AcademicRegistration::lists('academic_year', 'id'); $religions = Religion::lists('name', 'id'); return view('dashboard.admin.student.edit', ['student' => $students, 'faculty' => $faculties, 'study' => $studies, 'programStudy' => $programStudies, 'academicRegistration' => $academicRegistrations, 'religion' => $religions]); }
/** * Get the validation rules that apply to the request. * * @return array */ public function rules() { $faculty = Faculty::find($this->faculties); switch ($this->method()) { case 'GET': case 'DELETE': return []; case 'POST': return ['department_id' => 'required', 'last_name' => 'required|max:254', 'first_name' => 'required|max:254', 'max_units' => 'integer|max:120', 'type' => 'required|in:full-time,part-time']; case 'PUT': case 'PATCH': return ['department_id' => 'required', 'last_name' => 'required|max:254', 'first_name' => 'required|max:254', 'max_units' => 'integer|max:120', 'type' => 'required|in:full-time,part-time']; default: break; } }
$mail->setHTMLBody("Hi {$name},<br/>You have successfully registered for C-SCAN 2016. Your registration ID is " . $regid . ". The confirmation regarding the same will be done via email on or before 1st February.<br/>For more details and updates, please visit our <a href='http://www.cscan.org.in'>website</a>.<br/><br/>Thank you.<br/><br/>Yours Sincerely,<br/>Organising Team,<br/>C-SCAN 2016."); $mailer->send($mail); } else { $error = ERROR_DB; } } else { $error = ERROR_INVALID; } } else { if ($_POST['type'] == "faculty") { $rules = array('college' => 'required|integer', 'name' => 'required', 'email' => 'required|email', 'phone' => 'required|numeric|digits_between:10,15', 'designation' => 'required', 'interest' => 'required', 'gender' => 'required', 'food' => 'required'); $validator = $factory->make($_POST, $rules, $messages); if ($validator->passes()) { $num = Faculty::where('college', $_POST['college'])->count(); $_POST['regid'] = $num + 1; if ($v = Faculty::create($_POST)) { $regid = $v->colg->abbr . "F" . str_pad($_POST['regid'], 3, '0', STR_PAD_LEFT); $name = $_POST['name']; $mail->setHTMLBody("Hi {$name},<br/>You have successfully registered for C-SCAN 2016. Your registration id is " . $regid . ". The confirmation regarding the same will be done via email on or before 1st February.<br/>For more details and updates, please visit our <a href='http://www.cscan.org.in'>website</a>.<br/><br/>Thank you.<br/>Yours Sincerely,<br/>Organising Team,<br/>C-SCAN 2016."); $mailer->send($mail); } else { $error = ERROR_DB; } } else { $error = ERROR_INVALID; } } } } } include_once './header.php';
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $faculty = Faculty::findOrFail($id); $faculty->delete(); Flash::Success('Faculty Deleted successfully.'); return redirect()->route('faculty.index'); }
/** * Show the application dashboard. * * @return \Illuminate\Http\Response */ public function index() { $_schedule_masters = Master::orderBy('id', 'desc')->lists('name', 'id'); $master_id = array_keys(head($_schedule_masters))[0]; $data_pie = DB::select('SELECT da.code, count(sc.id) total_class FROM ( SELECT isc.* FROM schedules isc GROUP BY isc.section_key ) sc INNER JOIN semesters se ON sc.semester_id = se.id INNER JOIN plans pl ON se.plan_id = pl.id INNER JOIN curriculums cu ON pl.curriculum_id = cu.id INNER JOIN courses co ON pl.course_id = co.id INNER JOIN departments da ON co.department_id = da.id WHERE sc.master_id = ' . $master_id . ' GROUP BY da.id'); $data_query = DB::select('SELECT count(sc.id) total FROM ( SELECT isc.* FROM schedules isc GROUP BY isc.room_id ) sc WHERE sc.master_id = ' . $master_id); $data_room = []; if ($data_query) { $data_room['used'] = $data_query[0]->total; $data_room['total'] = \App\Room::count(); } $data_query = DB::select('SELECT count(sc.id) total FROM ( SELECT isc.* FROM schedules isc WHERE not faculty_id is null GROUP BY isc.faculty_id ) sc WHERE sc.master_id = ' . $master_id); $data_faculty = []; if ($data_query) { $data_faculty['used'] = $data_query[0]->total; $data_faculty['total'] = \App\Faculty::count(); } $data_query = DB::select('SELECT count(sc.id) total FROM ( SELECT isc.* FROM schedules isc INNER JOIN semesters se ON isc.semester_id = se.id INNER JOIN plans pl ON se.plan_id = pl.id INNER JOIN curriculums cu ON pl.curriculum_id = cu.id INNER JOIN courses co ON pl.course_id = co.id GROUP BY co.id ) sc WHERE sc.master_id = ' . $master_id); $data_course = []; if ($data_query) { $data_course['used'] = $data_query[0]->total; $data_course['total'] = \App\Course::count(); } $data_query = DB::select('SELECT count(sc.id) total FROM ( SELECT isc.* FROM schedules isc WHERE faculty_id is null OR room_id is null GROUP BY isc.key ) sc WHERE sc.master_id = ' . $master_id); $data_unallocated = []; if ($data_query) { $data_unallocated['used'] = $data_query[0]->total; $data_query = DB::select('SELECT count(sc.id) total FROM ( SELECT isc.* FROM schedules isc GROUP BY isc.key ) sc WHERE sc.master_id = ' . $master_id); $data_unallocated['total'] = $data_query[0]->total; } return view('dashboard.index', compact('data_pie', 'data_room', 'data_faculty', 'data_course', 'data_unallocated')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $faculty = Faculty::findOrFail($id); $faculty->delete(); \Flash::success('Faculteit verwijderd'); return redirect('admin/faculties'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $faculties = Faculty::orderBy('name')->lists('name', 'id'); $department = Department::findOrFail($id); return view('department.edit', compact('department', 'faculties')); }
/** * Store a csv created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function import(Request $request) { if ($request->file('csv-file')->isValid()) { $csv_file = $request->file('csv-file'); if ("text/csv" == $csv_file->getClientMimeType()) { $dest_path = storage_path('temp'); $file_name = time() . '_' . str_replace(" ", "_", $csv_file->getClientOriginalName()); $csv_file->move($dest_path, $file_name); $fname = $dest_path . '/' . $file_name; $file = fopen($fname, "r"); $flash_message = []; $flash_error = 0; while (!feof($file)) { $tmp_data = fgetcsv($file); $item['department_id'] = !empty($tmp_data[0]) ? $tmp_data[0] : ''; $department = Department::where('code', '=', $item['department_id'])->first(); if ($department) { $item['department_id'] = $department->id; } $item['last_name'] = !empty($tmp_data[1]) ? $tmp_data[1] : ''; $item['first_name'] = !empty($tmp_data[2]) ? $tmp_data[2] : ''; $item['max_units'] = !empty($tmp_data[3]) ? $tmp_data[3] : ''; $item['type'] = !empty($tmp_data[4]) ? strtolower($tmp_data[4]) : ''; $v = Validator::make($item, ['department_id' => 'required|integer|min:1', 'last_name' => 'required|max:254', 'first_name' => 'required|max:254', 'max_units' => 'integer|max:120', 'type' => 'required|in:full-time,part-time']); if (!$v->fails()) { Faculty::create($item); $flash_message['success'][] = $item['last_name'] . ', ' . $item['first_name']; } else { $flash_error++; $flash_message['error'] = $flash_error; } } \Session::flash('flash_message', $flash_message); fclose($file); chmod($fname, 0777); unlink($fname); } } return redirect('/faculties'); }
/** * Show the form for editing the specified resource. * * @param int $id * @return \Illuminate\Http\Response */ public function edit($id) { $association = Association::findOrFail($id); $faculties = Faculty::lists('title', 'id'); return view('pages.admin.associations.edit', compact('faculties', 'association')); }
/** * Display a listings of schedule of the faculty. * * @return \Illuminate\Http\Response */ public function view_faculty($master_id = null, $faculty_id = null) { $faculty = array(); $faculty_id_connector = ' = '; if (empty($faculty_id)) { $faculty_id = 'null'; $faculty_id_connector = ' is '; } else { $faculty = Faculty::findOrFail($faculty_id); } $_schedules = DB::select('SELECT sc.`key`, sc.section_name, da.code department_code, co.code course_code, su.code subject_code, su.name subject_name, su.units, ro.code room_code, sc.time_day, sc.time_from, sc.time_to, sc.feature_id FROM schedules sc INNER JOIN subjects su ON sc.subject_id = su.id INNER JOIN rooms ro ON sc.room_id = ro.id INNER JOIN semesters se ON sc.semester_id = se.id INNER JOIN plans pl ON se.plan_id = pl.id INNER JOIN courses co ON pl.course_id = co.id INNER JOIN departments da ON co.department_id = da.id WHERE sc.master_id = ' . $master_id . ' AND sc.faculty_id ' . $faculty_id_connector . $faculty_id . ' ORDER BY sc.time_day, sc.time_from'); $schedules = $_schedules; return view('schedules.view_faculty', compact('schedules', 'faculty', 'master_id', 'faculty_id')); }
/** * Show the form for creating a new resource. * * @return Response */ public function create() { $faculties = Faculty::lists('faculty_name', 'faculty_code'); return view('dashboard.admin.study.create', ['faculty' => $faculties]); }
/** * Show the form for editing the specified resource. * * @param int $id * @return Response */ public function edit($id) { $studies = Study::find($id); $faculties = Faculty::lists('faculty_name', 'faculty_code'); return view('dashboard.admin.study.edit', ['study' => $studies, 'faculty' => $faculties]); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { $faculties = Faculty::where('faculty_code', $id)->delete(); Session::flash('message', 'You have successfully deleted faculty'); return Redirect::to('dashboard/admin/faculties'); }