Beispiel #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     // Validate entries
     // No entries to validate for a CV.
     //var_dump($request);
     //TODO change firstOr*** to ***
     // Create the CV first.
     $cv = $request->user()->cvs()->firstOrCreate(['name' => $request->name]);
     // Update the user's data.
     $request->user()->update(['surname' => $request->surname, 'lastname' => $request->lastname, 'address' => $request->address, 'telephone' => $request->telephone]);
     // Build the subsections first.
     $work = $request->user()->jobs()->firstOrNew(['name' => $request->enterprise, 'location' => $request->enterpriseAddress, 'title' => $request->job_name, 'description' => 'not filled yet', 'start_date' => $request->enterpriseBeginDate, 'end_date' => $request->enterpriseEndDate]);
     $education = $request->user()->educations()->firstOrNew(['name' => $request->school, 'location' => $request->schoolAddress, 'title' => $request->degree, 'description' => 'not filled yet', 'start_date' => $request->degreeBeginDate, 'end_date' => $request->degreeEndDate]);
     $language = $request->user()->languages()->firstOrNew(['name' => $request->language, 'level' => $request->languageLevel, 'creditation' => $request->languageDegree]);
     // New build the sections.
     $workSection = new Section(['type' => 'work']);
     $languageSection = new Section(['type' => 'language']);
     $educationSection = new Section(['type' => 'education']);
     // First attach the sections to the user
     $request->user()->sections()->saveMany([$workSection, $educationSection, $languageSection]);
     // Now attach them to the cv
     $cv->sections()->saveMany([$workSection, $educationSection, $languageSection]);
     // Now attach each section with it's correct subsection.
     $languageSection->language()->save($language);
     $language->save();
     $workSection->job()->save($work);
     $work->save();
     $educationSection->education()->save($education);
     $education->save();
     // Now save the sections.
     $workSection->save();
     $educationSection->save();
     $languageSection->save();
     return redirect('/cvs');
 }
Beispiel #2
0
 public function index(Slider $slider, Blog $blog, Product $shop, Section $section)
 {
     $slides = $slider->getActive();
     $posts = $blog->getActive();
     $products = $shop->getPopular();
     //        dd($products);
     $sections = $section->getSection();
     //        var_dump(\Session::get('product8'));
     return view('pages.index', ['slides' => $slides, 'posts' => $posts, 'products' => $products, 'sections' => $sections]);
 }
Beispiel #3
0
 public function getProduct($slug, Product $product, Section $section)
 {
     $oneProduct = $product->getProduct($slug);
     //        dd($oneProduct);
     $payment = $oneProduct->payment_system;
     $images = $oneProduct->galleries;
     //        dd($images);
     $sections = $section->getSection();
     if ($payment === 0) {
         return view('pages.shop.productWithPayment', ['product' => $oneProduct, 'images' => $images, 'sections' => $sections]);
     }
     return view('pages.shop.product', ['product' => $oneProduct, 'images' => $images, 'sections' => $sections]);
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $post = Post::findOrFail($id);
     $contacts = json_decode($post->phone);
     $section = Section::where('service_id', '1')->where('status', 1)->orderBy('sort_id')->get();
     return view('admin.posts.edit', compact('post', 'contacts', 'section'));
 }
Beispiel #5
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     $sections = [130 => 'Велосипеды шоссе', 131 => 'Велосипеды МТБ', 128 => 'Рамы шоссе', 129 => 'Рамы МТБ', 95 => 'Услуги', 60 => 'Колёса', 61 => 'Вилки и амортизаторы', 62 => 'Сидим и рулим', 63 => 'Крутим', 64 => 'Переключаем', 65 => 'Тормозим', 66 => 'Одежда, обувь и защита', 73 => 'Туристическое снаряжение', 80 => 'Свет и электричество', 70 => 'Aксессуары', 87 => 'Не велосипедное', 69 => 'Меняю', 81 => 'Подарю!', 72 => 'Украли!'];
     foreach ($sections as $id => $title) {
         Section::create(['id' => $id, 'title' => $title]);
     }
 }
 public function index()
 {
     $sections = Section::all();
     if (Auth::user()) {
         $cart = Auth::user()->cart;
     } else {
         $cart = new Collection();
         if (Session::has('cart')) {
             foreach (Session::get('cart') as $item) {
                 $elem = new Cart();
                 $elem->product_id = $item['product_id'];
                 $elem->amount = $item['qty'];
                 if (isset($item['options'])) {
                     $elem->options = $item['options'];
                 }
                 $cart->add($elem);
             }
         }
     }
     $total = 0;
     $options = new Collection();
     foreach ($cart as $item) {
         $total += $item->product->price * $item->amount;
         if ($item->options) {
             $values = explode(',', $item->options);
             foreach ($values as $value) {
                 $options->add(OptionValue::find($value));
             }
         }
     }
     return view('site.cart', compact('sections', 'total', 'cart', 'options'));
 }
Beispiel #7
0
 public function editMyProfile()
 {
     $profile = Auth::user()->profile;
     $contacts = json_decode($profile->phone);
     $section = Section::orderBy('sort_id')->where('status', 1)->get();
     return view('profile.my_profile_edit', compact('profile', 'contacts', 'section'));
 }
 public function registrationForm()
 {
     $sections = Section::lists('name', 'id');
     $departments = Department::lists('name', 'id');
     $password = $this->generatePassword();
     return view('admin.account.create', compact('sections', 'departments', 'password'));
 }
 /**
  * Show the application registration form.
  *
  * @return \Illuminate\Http\Response
  */
 public function showRegistrationForm()
 {
     // Get the list of departments
     $departmentArr = Department::all();
     // Get the list of sections
     $sectionArr = Section::all();
     return view($this->registerView)->with(['departments' => $departmentArr, 'sections' => $sectionArr]);
 }
Beispiel #10
0
 public function create()
 {
     $years = config('student.year_level');
     $cities = config('student.cities');
     $states = config('student.states');
     $sections = Section::get(['id', 'description']);
     return view('students.add', compact(['years', 'sections', 'cities', 'states']));
 }
 public function show($id)
 {
     $user = User::find($id);
     $sections = Section::lists('name', 'id');
     $departments = Department::lists('name', 'id');
     $subjects = $user->type == 'student' ? $user->studentSubjects : $user->teacherSubjects;
     return view('admin.user.show', compact('user', 'sections', 'subjects', 'departments'));
 }
 protected static function newSection($id, $name, $items)
 {
     $section = Section::create(['cv_id' => $id, 'name' => $name]);
     foreach ($items as $item) {
         $item = (object) $item;
         static::newItem($section->id, $item->name, $item->headers, $item->entries);
     }
 }
Beispiel #13
0
 /**
  * Builds section hierarchy
  * @param string sections in string
  * @return int current section id
  */
 public static function parse($string)
 {
     foreach ($sections = explode(" | ", $string) as $index => $sectionName) {
         $parent = $index ? $section->id : 0;
         $section = App\Section::firstOrNew(['name' => $sectionName, 'parent_id' => $parent]);
         $section->save();
     }
     return $section->id;
 }
 public function analyseStudentPerformance($studentId)
 {
     $student = User::find($studentId);
     $studentTeachingSection = TeachingSection::where('users_id', '=', $studentId)->first();
     //        dd($studentTeachingSection);
     $studentSection = Section::find($studentTeachingSection->sections_id);
     $studentArray = array();
     $studentArray['name'] = $student->name;
     $studentArray['realname'] = $student->realname;
     $studentArray['grade'] = $studentSection->grade;
     $studentArray['order'] = $studentSection->order;
     //        a table show all exminations the student has token
     //        show the different table of different subjects.
     $allTranscripts = Transcript::where('users_id', '=', $studentId)->get();
     //        dd($allTranscripts);
     $studentExaminations = array();
     $i = 0;
     foreach ($allTranscripts as $transcript) {
         /*对该成绩单的学生的每次考试的语文,数学,英语三科的排名*/
         $studentExaminations[$i]['chineseRanking'] = Transcript::getStudentSubjectRanking($transcript, 1);
         $studentExaminations[$i]['mathRanking'] = Transcript::getStudentSubjectRanking($transcript, 2);
         $studentExaminations[$i]['englishRanking'] = Transcript::getStudentSubjectRanking($transcript, 3);
         $examination = Examination::find($transcript->examinations_id);
         $studentExaminations[$i]['examination_name'] = $examination->name;
         $studentExaminations[$i]['examination_semester'] = $examination->semester;
         $studentExaminations[$i]['examination_date'] = $examination->date;
         $studentExaminations[$i]['total'] = $transcript->total;
         $studentExaminations[$i]['rank'] = $transcript->rank;
         $subjects = Subject::where('transcripts_id', '=', $transcript->id)->get();
         foreach ($subjects as $subject) {
             $subjectType = $subject->type;
             if ($subjectType == 1) {
                 $studentExaminations[$i]['chinese'] = $subject->score;
             } elseif ($subjectType == 2) {
                 $studentExaminations[$i]['math'] = $subject->score;
             } elseif ($subjectType == 3) {
                 $studentExaminations[$i]['english'] = $subject->score;
             } elseif ($subjectType == 4) {
                 $studentExaminations[$i]['physics'] = $subject->score;
             } elseif ($subjectType == 5) {
                 $studentExaminations[$i]['biology'] = $subject->score;
             } elseif ($subjectType == 6) {
                 $studentExaminations[$i]['chemistry'] = $subject->score;
             } elseif ($subjectType == 7) {
                 $studentExaminations[$i]['history'] = $subject->score;
             } elseif ($subjectType == 8) {
                 $studentExaminations[$i]['politics'] = $subject->score;
             } else {
                 $studentExaminations[$i]['geography'] = $subject->score;
             }
         }
         $i++;
     }
     //dd($studentExaminations);
     return view('scores.analyseStudentPerformance', compact('studentArray', 'studentExaminations'));
 }
Beispiel #15
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('sections')->truncate();
     Section::create(['name' => 'Saint Paul']);
     Section::create(['name' => 'Saint Francis']);
     Section::create(['name' => 'Saint Therese']);
     Section::create(['name' => 'Saint John']);
     Section::create(['name' => 'Saint Peter']);
     Section::create(['name' => 'Saint Luke']);
 }
 /**
  * Bootstrap any application services.
  *
  * @return void
  */
 public function boot()
 {
     //
     if (Schema::hasTable('sections')) {
         $sections = Section::all();
         $pages = Page::all();
         $pagesNew = [];
         $sectionsNew = [];
         view()->share(['sections' => $sections, 'pages' => $pages, 'sectionsNew' => $sectionsNew, 'pagesNew' => $pagesNew]);
     }
 }
Beispiel #17
0
 /**
  * Show the application dashboard.
  *
  * @return \Illuminate\Http\Response
  */
 public function index($name)
 {
     $page = Page::where('name', 'LIKE', $name)->first();
     $section = Section::where('id', 'LIKE', $page->section_id)->first();
     $articles = Article::where('page_id', 'LIKE', $page->id)->orderBy('publish_time', 'desc')->get();
     $articles_attachments = [];
     foreach ($articles as $article) {
         $articles_attachments[$article->id] = Attachment::where('article_id', 'LIKE', $article->id)->get();
     }
     return view('page.index', ['page' => $page, 'section' => $section, 'articles' => $articles, 'articles_attachments' => $articles_attachments]);
 }
 public function destroy($id)
 {
     $section = Section::find($id);
     // have something associated?
     // we have to validate these relationships in a future
     /*if ($units->count() > 0)
           return back()->with('error', 'No es posible eliminar un periodo asociado a unidades.');
       */
     $section->delete();
     return back();
 }
Beispiel #19
0
 public function run()
 {
     DB::table('sections')->delete();
     Section::create(['crn' => 124578, 'course_id' => 1, 'instructor' => "Kamal", 'time' => "1:00 pm - 4:00 pm", 'days' => "M", 'time_code' => 2, 'capacity' => 30, 'description' => "Course 1 Section", 'location' => 'Warrensburg']);
     Section::create(['crn' => 789456, 'course_id' => 1, 'instructor' => "Faja", 'time' => "1:00 pm - 4:00 pm", 'days' => "T", 'time_code' => 2, 'capacity' => 30, 'description' => "Course 1 Section", 'location' => 'Warrensburg']);
     Section::create(['crn' => 456785, 'course_id' => 1, 'instructor' => "Narsimham", 'time' => "1:00 pm - 4:00 pm", 'days' => "W", 'time_code' => 2, 'capacity' => 30, 'description' => "Course 1 Section", 'location' => 'Warrensburg']);
     Section::create(['crn' => 415263, 'course_id' => 2, 'instructor' => "Sam", 'time' => "1:00 pm - 4:00 pm", 'days' => "W", 'time_code' => 2, 'capacity' => 30, 'description' => "Course 2 Section", 'location' => 'Warrensburg']);
     Section::create(['crn' => 458741, 'course_id' => 2, 'instructor' => "Blake", 'time' => "6:00 pm - 9:00 pm", 'days' => "F", 'time_code' => 3, 'capacity' => 30, 'description' => "Course 2 Section", 'location' => 'Warrensburg']);
     Section::create(['crn' => 968574, 'course_id' => 2, 'instructor' => "Prasad", 'time' => "9:00 am - 11:00 am", 'days' => "S", 'time_code' => 1, 'capacity' => 30, 'description' => "Course 2 Section", 'location' => 'Warrensburg']);
     Section::create(['crn' => 968274, 'course_id' => 3, 'instructor' => "Abhijith", 'time' => "9:00 am - 11:00 am", 'days' => "S", 'time_code' => 1, 'capacity' => 30, 'description' => "Course 3 Section", 'location' => 'Warrensburg']);
     Section::create(['crn' => 960574, 'course_id' => 3, 'instructor' => "Abhijith", 'time' => "9:00 am - 11:00 am", 'days' => "F", 'time_code' => 1, 'capacity' => 30, 'description' => "Course 3 Section", 'location' => 'Warrensburg']);
 }
Beispiel #20
0
 public static function drop($uid, $sid)
 {
     $enrollment = Enrollment::where('student_id', '=', $uid)->where('section_id', '=', $sid);
     if ($enrollment->count() <= 0) {
         return "Enrollment does not exist.";
     }
     $enrollment->delete();
     $section = Section::find($sid);
     $section->filled = $section->filled - 1;
     $section->save();
     return true;
 }
Beispiel #21
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Section::create(['description' => 'Saint Francis']);
     Section::create(['description' => 'Saint Paul']);
     Section::create(['description' => 'Saint Therese']);
     Section::create(['description' => 'Saint John']);
     Section::create(['description' => 'Saint Peter']);
     Section::create(['description' => 'Saint Luke']);
     factory(App\User::class)->create(['email' => '*****@*****.**']);
     factory(App\User::class, 10)->create();
     factory(App\Student::class, 180)->create();
 }
 public static function getUserSchoolByUser($user)
 {
     //      $profile= ;
     //       $classId = DB::table('teachingclasses')->where('users_id', $user->id)->value('classes_id');
     //        $schoolId = DB::table('classes')->where('classes_id', $classId)->value('schools_id');
     //        $schoolName = DB::table('schools')->where('id', $schoolId)->value('name');
     $sectionId = User::find($user->id)->teachingSection()->first()->value('sections_id');
     $section = Section::getSectionByUser($user);
     $school = Section::find($sectionId)->school();
     $section = Section::find($sectionId);
     //        $profile = [];
     return $school;
 }
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\Sections\EditSectionRequest $request, $id, StoreFile $storeFile, \App\Section $section)
 {
     if ($request->hasFile('image')) {
         //Creating and moving the file image
         $image_path = $storeFile->move($request->file('image'), 'public/images/sections/', 16);
         //Adding the image file path to the array of request
         $modified_request = array_merge($request->except('image'), ['image' => $image_path]);
     } else {
         $modified_request = $request->except('image');
     }
     //Storing
     $section->findOrFail($id)->update($modified_request);
     //Redirect
     return redirect()->action('Panel\\SectionsController@index');
 }
Beispiel #24
0
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //
     if (App::environment() === 'production') {
         exit('Do not seed in production environment');
     }
     DB::statement('SET FOREIGN_KEY_CHECKS = 0');
     // disable foreign key constraints
     DB::table('sections')->truncate();
     Section::create(['id' => 1, 'name' => 'Lifestyle Habits', 'description' => 'This section focuses on lifestyle and habits of a patient']);
     Section::create(['id' => 2, 'name' => 'Family History', 'description' => 'This section focuses on medical history of family of a patient']);
     Section::create(['id' => 3, 'name' => 'Complaints', 'description' => 'This section deals with recent complaints of pateint']);
     Section::create(['id' => 4, 'name' => 'Clinical Examination', 'description' => 'This section deals with various clinical reports of a patient']);
     DB::statement('SET FOREIGN_KEY_CHECKS = 1');
     // enable foreign key constraints
 }
 public function enroll()
 {
     $section_id = Request::input('id');
     $user = Auth::user();
     $enrollment_count = Enrollment::where('student_id', '=', $user->id)->count();
     if ($enrollment_count > 3) {
         return json_encode(array("status" => "error", "message" => "You have already enrolled in maximum courses. Please contact the advisor"));
     }
     $section = Section::find($section_id);
     if ($section->filled >= $section->capacity) {
         return json_encode(array("status" => "error", "message" => "The section your requested is full. Please pick a diffrent section"));
     }
     $k = Enrollment::enroll($user->id, $section_id);
     file_put_contents("enroll_drop.log", date("F j, Y, g:i a") . " " . $user->student_id . "(" . $user->name . ") enrolled in Section Id: " . $section_id . "\n", FILE_APPEND);
     return json_encode(array("status" => "success", "message" => "Enrollment Successfull"));
 }
 /**
  * Show all students for reports/searching
  *
  * @param StudentSearch $request
  * @return \BladeView|bool|\Illuminate\Contracts\View\Factory|\Illuminate\Http\JsonResponse|\Illuminate\View\View
  */
 public function all(StudentSearch $request)
 {
     if (count($request->query())) {
         if ($request->ajax()) {
             $students = $this->createQuery($request);
             //save to session for printing
             session()->put('students', $request->all());
             return response()->json(['results' => view('reports._results', ['students' => $students])->render(), 'count' => $students->total()], 200);
         }
     }
     //clear session
     session()->forget('students');
     $years = config('student.year_level');
     $cities = config('student.cities');
     $brackets = config('student.brackets');
     $sections = Section::get(['id', 'description']);
     return view('reports.all', compact(['years', 'sections', 'cities', 'brackets']));
 }
 public function students(Request $request)
 {
     $section_id = $request->section;
     $subject_id = $request->subject;
     $students = Section::find($section_id)->students;
     foreach ($students as $i => $student) {
         $studentSubjects = $student->user->studentSubjects;
         $found = false;
         if (count($studentSubjects)) {
             foreach ($studentSubjects as $subject) {
                 if ($subject->subject_id == $subject_id) {
                     $found = true;
                 }
             }
         }
         $student['valid'] = $found;
     }
     return $students->where('valid', true);
 }
Beispiel #28
0
 public function __construct()
 {
     /*Licznik zmian, który zmienia się po 24h od dodania zmiany*/
     $date = Carbon::now();
     $date->modify('-24 hours');
     $formatted_date = $date->format('Y-m-d H:i:s');
     $countchange = Change::where('created_at', '>', $formatted_date)->count();
     /*Licznik graczy Online na serwerze*/
     $countonline = Player::where('online', '=', 1)->count();
     /*Licznik niedoczytanych wiadomości prywatnych*/
     $notread1 = Message::where('to_user_id', \Auth::id())->where('read', 0)->count();
     if (\Auth::check()) {
         Cache::remember('users', 5, function () {
             return User::where('id', \Auth::id())->update(['last_activity' => Carbon::now()]);
         });
     }
     /*Licznik i skrypt usuwający i nadający banicję za 4 ostrzeżenia na stronie*/
     $countcautions = Caution::where('user_id', \Auth::id())->count();
     if (!\Auth::guest() && $countcautions == 4) {
         $user = User::where('id', \Auth::id())->first();
         $g = array(4);
         $user->update(['banned' => 'Zbanowany za 4 ostrzeżenia na stronie']);
         $user->group()->sync($g);
     }
     $deleteCaution = Caution::where('user_id', \Auth::id())->where('created_at', '<=', Carbon::now()->subDays(14));
     $deleteCaution->delete();
     $section = Section::lists('name', 'id');
     $lives = Live::latest('created_at')->take(5)->get();
     if (!\Auth::guest()) {
         $notifications = \Auth::user()->notification()->latest('created_at')->take(10)->get();
         View::share('notifications', $notifications);
     }
     View::share('countchange', $countchange);
     View::share('countonline', $countonline);
     View::share('notread1', $notread1);
     View::share('section', $section);
     View::share('lives', $lives);
     $this->middleware('banned', ['except' => ['auth']]);
 }
 public static function getPageInfo(&$sections, &$cart, &$total)
 {
     $sections = Section::all();
     if (Auth::user()) {
         $cart = Auth::user()->cart;
     } else {
         $cart = new Collection();
         if (Session::has('cart')) {
             foreach (Session::get('cart') as $item) {
                 $elem = new Cart();
                 $elem->product_id = $item['product_id'];
                 $elem->amount = $item['qty'];
                 if (isset($item['options'])) {
                     $elem->options = $item['options'];
                 }
                 $cart->add($elem);
             }
         }
     }
     $total = 0;
     foreach ($cart as $item) {
         $total += $item->product->price * $item->amount;
     }
 }
Beispiel #30
0
 function getAvailableSections()
 {
     $enrollments = Enrollment::where('student_id', '=', $this->id)->get()->toArray();
     $enrollment_ids = array_column($enrollments, 'id');
     $section_ids = array_column($enrollments, 'section_id');
     $sections_enrolled = Section::whereIn('id', $section_ids)->get()->toArray();
     $courses_enrolled = array_column($sections_enrolled, 'course_id');
     $sections_enrolled_timecode = array_column($sections_enrolled, 'time_code');
     $sections_enrolled_days = array_column($sections_enrolled, 'days');
     $sections_enrolled_timeflags = [];
     for ($i = 0; $i < count($sections_enrolled_timecode); $i++) {
         $sections_enrolled_timeflags[] = $sections_enrolled_days[$i] . $sections_enrolled_timecode[$i];
     }
     $sections_available = Section::whereNotIn('course_id', $courses_enrolled)->get()->toArray();
     $sections_available_ids = array_column($sections_available, 'id');
     $vsections_available = Vsection::whereIn('id', $sections_available_ids)->whereRaw('filled < capacity')->whereNotIn('time_flag', $sections_enrolled_timeflags)->get()->toArray();
     // print_r($section_ids);
     // foreach ($enrollments as $e) {
     // 	$enrollment_ids[] = $e->id;
     // }
     // dd($sections_enrolled);
     // dd($vsections_available);
     return $vsections_available;
 }