Ejemplo n.º 1
0
 /**
  * @desc Edit Department
  * @Edit function Open Edit From view
  * @param Department $department (get department data from provider route model binding $router->model)
  * @param Specialty $specialty for parent specialty list
  * @param Subject $subject for parent subject list
  **/
 public function edit(Department $department, Specialty $specialty, Subject $subject)
 {
     $subjects = $subject->pluck('name', 'id')->toArray();
     $menu = $department->menu()->get();
     $specialties = $specialty->get();
     return view('academystructure::departments.edit', compact('department', 'menu', 'specialties', 'subjects'));
 }
Ejemplo n.º 2
0
 public function edit($announcement_id)
 {
     $announcement = Announcement::with('years', 'specialities', 'classrooms', 'students')->findOrFail($announcement_id);
     $specialty_id = Specialty::pluck('name', 'id');
     $year_id = Year::pluck('name', 'id');
     $classroom_id = Classroom::pluck('code', 'id');
     $student_id = Student::pluck('username', 'id');
     return view('announcements::edit', compact('announcement', 'specialty_id', 'year_id', 'classroom_id', 'student_id'));
 }
Ejemplo n.º 3
0
 public function form(RegistrationPeriod $PeriodModel, Country $CountryModel, Specialty $Specialty, Registration $Registration, RegistrationType $type)
 {
     $registration = $Registration->with('degrees', 'contactcountry', 'contactcity', 'contactcity.states', 'birthcountry', 'nationalitycity', 'jobcountry', 'jobcountry.cities')->find(registrar()->id);
     $specialties = $Specialty->pluck('name', 'id')->toArray();
     $registration_types = $type->pluck('title', 'id')->toArray();
     $countries = $CountryModel->all();
     $countries_list = ["" => ""] + $countries->pluck('name', 'id')->toArray();
     $codes_list = ["" => ""] + $countries->pluck('calling_code', 'id')->toArray();
     $stay_types = config('registration.stay_types');
     $social_status = ["" => ""] + config('registration.social_status');
     $social_job_status = ["" => "", 'unemployed' => 'بدون عمل', 'employed' => 'أعمل', 'retired' => 'متقاعد'];
     $years_list = ["" => ""] + array_combine(range(date("Y") - 80, date('Y')), range(date("Y") - 80, date('Y')));
     $computer_skills = ["" => "", 'very_low' => 'ضعيف جدا', 'low' => 'ضعيف', 'good' => 'جيد', 'great' => 'جيد جدا', 'excellent' => 'ممتاز'];
     $social_job_types = ["" => "", 'government' => 'عام', 'private' => 'خاص', 'free' => 'حر'];
     $social_jobs = ["" => "", 'unemployed' => 'بدون عمل', 'employed' => 'أعمل', 'retired' => 'متقاعد'];
     $references = ["" => "", 'iiswebsite' => 'موقع كلية العلوم الشرعية', 'iisewebsite' => 'موقع مركز التعليم عن بعد', 'iisfriend' => 'صديق يدرس بالكلية', 'iisefriend' => 'صديق يدرس بمركز التعليم عن بعد', 'other' => 'أخرى'];
     return view('registration::registrar.form', compact('registration', 'specialties', 'registration_types', 'period', 'years_list', 'countries', 'stay_types', 'countries_list', 'references', 'computer_skills', 'codes_list', 'social_job_types', 'social_status', 'social_jobs'));
 }
Ejemplo n.º 4
0
 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     //Faculty
     Faculty::created(function ($faculty) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Academystructure_Faculty', 'reference_id' => $faculty->id]);
     });
     Faculty::updated(function ($faculty) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Academystructure_Faculty', 'reference_id' => $faculty->id]);
     });
     Faculty::deleted(function ($faculty) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Academystructure_Faculty', 'reference_id' => $faculty->id]);
     });
     //Year
     Year::created(function ($year) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Academystructure_Year', 'reference_id' => $year->id]);
     });
     Year::updated(function ($year) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Academystructure_Year', 'reference_id' => $year->id]);
     });
     Year::deleted(function ($year) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Academystructure_Year', 'reference_id' => $year->id]);
     });
     //Term
     Term::created(function ($term) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Academystructure_term', 'reference_id' => $term->id]);
     });
     Term::updated(function ($term) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Academystructure_term', 'reference_id' => $term->id]);
     });
     Term::deleted(function ($term) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Academystructure_term', 'reference_id' => $term->id]);
     });
     //Department
     Department::created(function ($department) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Academystructure_department', 'reference_id' => $department->id]);
     });
     Department::updated(function ($department) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Academystructure_department', 'reference_id' => $department->id]);
     });
     Department::deleted(function ($department) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Academystructure_department', 'reference_id' => $department->id]);
     });
     //Specailty
     Specialty::created(function ($specialty) {
         UserLog::create(['operation' => 'create', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Academystructure_specialty', 'reference_id' => $specialty->id]);
     });
     Specialty::updated(function ($specialty) {
         UserLog::create(['operation' => 'update', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Academystructure_specialty', 'reference_id' => $specialty->id]);
     });
     Specialty::deleted(function ($specialty) {
         UserLog::create(['operation' => 'delete', 'user_id' => user() ? user()->id : NULL, 'reference_key' => 'Academystructure_specialty', 'reference_id' => $specialty->id]);
     });
 }
Ejemplo n.º 5
0
 public function subjectexam(Request $request)
 {
     $subjects = Subject::lists('name', 'id')->toArray();
     $semesters = Semester::select(\DB::raw('CONCAT(academycycle_semesters.name , "-", academycycle_years.name) as name , academycycle_semesters.id as id'))->join('academycycle_years', 'academycycle_years.id', '=', 'academycycle_semesters.academycycle_year_id')->pluck('name', 'id')->toArray();
     $year_term = Year::join('academystructure_terms', 'academystructure_years.id', '=', 'academystructure_terms.year_id')->join('academystructure_departments', 'academystructure_terms.id', '=', 'academystructure_departments.term_id')->select(\DB::raw('CONCAT(academystructure_years.name, "-", academystructure_terms.name) as name,
                                     GROUP_CONCAT(DISTINCT(academystructure_departments.subject_ids)) as sid'))->groupBy('academystructure_terms.name', 'academystructure_years.name')->get()->toArray();
     $year_term_options;
     foreach ($year_term as $key => &$aa) {
         $a = implode(',', array_unique(array_merge(json_decode(str_replace('],[', ',', $aa['sid']), TRUE))));
         $year_term_options[$a] = $aa['name'];
     }
     $spec_id = Specialty::join('academystructure_departments', 'academystructure_departments.spec_id', '=', 'academystructure_specialties.id')->select(\DB::raw('academystructure_specialties.name as name,
                                     GROUP_CONCAT(DISTINCT(academystructure_departments.id)) as sid'))->groupBy('academystructure_departments.spec_id')->pluck('name', 'sid')->toArray();
     $types = config('exams.types');
     $filter_semester_id = 0;
     if (request('exam_semester')) {
         $filter_semester_id = request('exam_semester');
     } else {
         $filter_semester_id = semester()->id;
     }
     if (request('spec_id')) {
         $search_spec_id = explode(',', request('spec_id'));
         $statistics = Exam::with(['subject', 'results' => function ($q) use($search_spec_id) {
             $q->whereHas('student', function ($query) use($search_spec_id) {
                 $query->whereIn('students.academystructure_department_id', $search_spec_id);
             });
         }])->where('active', 1)->where('semester_id', $filter_semester_id)->where('finish_at', '=<', date("Y/m/d H:i:s"));
         $subject_students = Subject::select('id')->withCount(['students' => function ($q) use($filter_semester_id, $search_spec_id) {
             $q->where('semester_id', $filter_semester_id);
             $q->where('students.state', 'active');
             $q->where('student_subjects.state', 'study');
             $q->whereIn('students.academystructure_department_id', $search_spec_id);
         }])->pluck('students_count', 'id')->toArray();
     } else {
         $statistics = Exam::with(['subject', 'results'])->where('active', 1)->where('semester_id', $filter_semester_id)->where('finish_at', '<', date("Y/m/d H:i:s"));
         $subject_students = Subject::select('id')->withCount(['students' => function ($q) use($filter_semester_id) {
             $q->where('semester_id', $filter_semester_id);
             $q->where('students.state', 'active');
             $q->where('student_subjects.state', 'study');
         }])->pluck('students_count', 'id')->toArray();
     }
     if (request('exam_year_term')) {
         $statistics->whereIn('subject_id', explode(',', request('exam_year_term')));
     }
     if (request('exam_subject')) {
         $statistics->where('subject_id', request('exam_subject'));
     }
     if (request('exam_type')) {
         $statistics->where('type', request('exam_type'));
     }
     $statistics = $statistics->get();
     return view('exams::reports.subjectexam', compact('subjects', 'semesters', 'year_term_options', 'types', 'statistics', 'subject_students', 'spec_id'));
 }
Ejemplo n.º 6
0
    public function index(Request $request)
    {
        $per_page = request('per_page', 20);
        $students = $this->prepQuery($request->all());
        $students = $students->paginate($per_page);
        $students->appends($request->except('page'));
        $year_term = Year::join('academystructure_terms', 'academystructure_years.id', '=', 'academystructure_terms.year_id')->select(\DB::raw('CONCAT(academystructure_years.name, "-", academystructure_terms.name) as name,
										academystructure_terms.id as tid'))->groupBy('academystructure_terms.name', 'academystructure_years.name')->orderBy('academystructure_terms.id')->pluck('name', 'tid')->toArray();
        $spec_id = Specialty::pluck('name', 'id')->toArray();
        $county = Country::pluck('name', 'id')->toArray();
        $city = City::pluck('name', 'id')->toArray();
        // return $students->pluck('sps');
        return view('students::students.index', compact('students', 'year_term', 'spec_id', 'county', 'city'));
    }
Ejemplo n.º 7
0
 public function index()
 {
     $specialities = Specialty::selectRaw('asp.id, asp.name, asp.short_description, asp.description, GROUP_CONCAT(adp.subject_ids) as subject_ids, COUNT(adt.id) as terms, COUNT(DISTINCT ady.id) as years')->leftJoin('academystructure_departments as adp', 'adp.spec_id', '=', 'asp.id')->leftJoin('academystructure_terms as adt', 'adt.id', '=', 'adp.term_id')->leftJoin('academystructure_years as ady', 'ady.id', '=', 'adt.year_id')->from('academystructure_specialties as asp')->groupBy('asp.id')->with('departments')->get();
     foreach ($specialities as $specialty) {
         $subject_ids = explode(",", preg_replace(['/\\[/', "/\\]/", '/"/', "/'/"], "", $specialty->subject_ids));
         $specialty->hours = Subject::whereIn('id', $subject_ids)->sum('hour');
         foreach ($specialty->departments as $department) {
             $subject_ids = explode(",", preg_replace(['/\\[/', "/\\]/", '/"/', "/'/"], "", $department->subject_ids));
             $department->subjects = Subject::whereIn('id', $subject_ids)->get();
         }
     }
     $specialities->makeHidden(['subject_ids']);
     return response()->json($specialities, 200, [], JSON_NUMERIC_CHECK);
 }
Ejemplo n.º 8
0
 public function apply(RegistrationPeriod $PeriodModel, Country $CountryModel, Specialty $Specialty, RegistrationType $type)
 {
     $period = $PeriodModel->orderBy('id', 'desc')->with('year')->current()->first();
     if (!$period) {
         return redirect()->route('welcome');
     }
     $specialties = $Specialty->lists('name', 'id');
     $registration_types = $type->lists('title', 'id')->toArray();
     $countries = $CountryModel->all();
     $countries_list = ["" => ""] + $countries->lists('name', 'id')->toArray();
     $codes_list = ["" => ""] + $countries->lists('calling_code', 'id')->toArray();
     $stay_types = config('registration.stay_types');
     $social_status = ["" => ""] + config('registration.social_status');
     $social_job_status = ["" => "", 'unemployed' => 'بدون عمل', 'employed' => 'أعمل', 'retired' => 'متقاعد'];
     $years_list = ["" => ""] + array_combine(range(date("Y") - 80, date('Y')), range(date("Y") - 80, date('Y')));
     $computer_skills = ["" => "", 'excellent' => 'ممتاز', 'great' => 'جيد جدا', 'very_low' => 'ضعيف جدا', 'low' => 'ضعيف', 'good' => 'جيد'];
     $social_job_types = ["" => "", 'government' => 'عام', 'private' => 'خاص', 'free' => 'حر'];
     $social_jobs = ["" => "", 'unemployed' => 'بدون عمل', 'employed' => 'أعمل', 'retired' => 'متقاعد'];
     $references = ["" => "", 'iiswebsite' => 'موقع كلية العلوم الشرعية', 'iisewebsite' => 'موقع مركز التعليم عن بعد', 'iisfriend' => 'صديق يدرس بالكلية', 'iisefriend' => 'صديق يدرس بمركز التعليم عن بعد', 'other' => 'أخرى'];
     $period = $PeriodModel->orderBy('id', 'desc')->with('year')->where(function ($sql) {
         $sql->where('start_at', '<=', date('Y-m-d'))->where('finish_at', '>=', date('Y-m-d'));
     })->first();
     return view('registration::registrar.apply', compact('years_list', 'specialties', 'registration_types', 'period', 'countries', 'stay_types', 'countries_list', 'references', 'computer_skills', 'codes_list', 'social_job_types', 'social_status', 'social_jobs'));
 }
Ejemplo n.º 9
0
 public function store(RegisterRequest $request, Registration $registration, RegistrationPeriod $PeriodModel, RegistrationStep $StepModel)
 {
     $input = $request->all();
     $period = $PeriodModel->current()->first();
     $registration->fill($input);
     if (!$request->has('academystructure_specialty_id')) {
         if ($specialty = Specialty::where('code', 'G')->first()) {
             $registration->academystructure_specialty_id = $specialty->id;
         } else {
             $registration->academystructure_specialty_id = NULL;
         }
     }
     $step = $StepModel->verifyEmail()->first();
     if (($reason = $this->canApply($input)) !== true) {
         $message = '';
         switch ($reason) {
             case 'ACTIVE':
                 $message = 'الرقم المدني الذي تحاول التسجيل به، مستخدم من طرف طالب منتظم.';
                 break;
             case 'DELAYED':
                 $message = 'الرقم المدني الذي تحاول التسجيل به، مستخدم من طرف طالب مؤجل.';
                 break;
         }
         return redirect()->back()->with('error', $message);
     }
     $username = daress_generate_username();
     $registration->username = $username;
     $registration->password = bcrypt(!empty($registration->contact_mobile) ? $registration->contact_mobile : mt_rand(6, 10));
     $registration->registration_period_id = $period->id;
     $registration->registration_step_id = $step->id;
     $registration->passeport_country_id = !empty($input['passeport_country_id']) ? $input['passeport_country_id'] : null;
     if ($registration->save()) {
         /** check for extra degrees an dstore them */
         $this->saveExtraDegrees($input, $registration->id);
         /** end check for extra degrees */
         event(new RegistrationCreated($registration));
         event(new RegistrationEmailChanged($registration));
         event(new RegistrationUpdated($registration));
         event(new RegistrationStepChanged($registration, ['comment' => 'تفعيل البريد الإلكتروني']));
         $message = 'أحسنت ـ تم ارسال رسالة الى بريدك الالكتروني تحتوي على المعلومات التي تحتاجها من أجل الولوج لبوابة المتقدم.';
         return view('registration::registrar.signup_success', compact('message'));
     } else {
         return redirect()->back()->with('error', 'لم يتم تسجيل طلبك ، المرجو التواصل مع الدعم الفني للمزيد من المعلومات');
     }
 }
 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     Model::unguard();
     DB::statement('SET FOREIGN_KEY_CHECKS=0;');
     if (Department::count()) {
         return;
     }
     Year::truncate();
     Department::truncate();
     Faculty::truncate();
     Specialty::truncate();
     Term::truncate();
     $specialties = [['name' => 'العلوم الشرعية', 'type' => 'dep', 'code' => 'G'], ['name' => 'الفقه و علومه', 'type' => 'bac', 'code' => 'O'], ['name' => 'الدراسات الاسلامية', 'type' => 'bac', 'code' => 'I']];
     foreach ($specialties as $s) {
         Specialty::create($s);
     }
     $structure = [['name' => 'كلية العلوم الشرعية', 'years' => [['name' => 'السنة الأولى', 'terms' => [['name' => 'الفصل الأول', 'departments' => [['subject_ids' => json_encode([1, 2, 3, 4, 5, 6]), 'spec_id' => 1], ['subject_ids' => json_encode([1, 2, 3, 4, 5, 6]), 'spec_id' => 2], ['subject_ids' => json_encode([1, 2, 3, 4, 5, 6]), 'spec_id' => 3]]], ['name' => 'الفصل الثاني', 'departments' => [['subject_ids' => json_encode([12, 11, 10, 14, 9, 8]), 'spec_id' => 1], ['subject_ids' => json_encode([12, 11, 10, 14, 9, 8]), 'spec_id' => 2], ['subject_ids' => json_encode([12, 11, 10, 14, 9, 8]), 'spec_id' => 3]]]]], ['name' => 'السنة الثانية', 'terms' => [['name' => 'الفصل الثالث', 'departments' => [['subject_ids' => json_encode([15, 16, 17, 18, 19, 20, 21]), 'spec_id' => 1], ['subject_ids' => json_encode([15, 16, 17, 18, 19, 20, 21]), 'spec_id' => 2], ['subject_ids' => json_encode([15, 16, 17, 18, 19, 20, 21]), 'spec_id' => 3]]], ['name' => 'الفصل الرابع', 'departments' => [['subject_ids' => json_encode([22, 23, 24, 29, 26, 27, 29]), 'spec_id' => 1], ['subject_ids' => json_encode([22, 23, 24, 29, 26, 27, 29]), 'spec_id' => 2], ['subject_ids' => json_encode([22, 23, 24, 29, 26, 27, 29]), 'spec_id' => 3]]]]], ['name' => 'السنة الثالثة', 'terms' => [['name' => 'الفصل الخامس', 'departments' => [['subject_ids' => json_encode([31, 32, 33, 34, 30, 35, 36, 39]), 'spec_id' => 2], ['subject_ids' => json_encode([32, 33, 30, 34, 37, 36, 39]), 'spec_id' => 3], ['subject_ids' => json_encode([33, 37]), 'spec_id' => 1]]], ['name' => 'الفصل السادس', 'departments' => [['subject_ids' => json_encode([41, 42, 43, 44, 45, 46, 47, 52]), 'spec_id' => 2], ['subject_ids' => json_encode([31, 50, 46, 47, 48, 49, 51, 52]), 'spec_id' => 3]]]]], ['name' => 'السنة الرابعة', 'terms' => [['name' => 'الفصل السابع', 'departments' => [['subject_ids' => json_encode([53, 54, 55, 56, 57, 58, 59, 77]), 'spec_id' => 2], ['subject_ids' => json_encode([55, 59, 60, 67, 68, 69, 75, 77]), 'spec_id' => 3]]], ['name' => 'الفصل الثامن', 'departments' => [['subject_ids' => json_encode([58, 61, 62, 63, 64, 65, 76, 78]), 'spec_id' => 2], ['subject_ids' => json_encode([58, 66, 70, 71, 72, 73, 74, 78]), 'spec_id' => 3]]]]]]]];
     $last_1_id = null;
     $last_2_id = null;
     $last_3_id = null;
     foreach ($structure as $f) {
         $faculty = Faculty::create(['name' => $f['name']]);
         foreach ($f['years'] as $y) {
             $year = Year::create(['name' => $y['name'], 'faculty_id' => $faculty->id]);
             foreach ($y['terms'] as $t) {
                 $term = Term::create(['year_id' => $year->id, 'name' => $t['name']]);
                 foreach ($t['departments'] as $d) {
                     $department = Department::create(['spec_id' => $d['spec_id'], 'subject_ids' => $d['subject_ids'], 'parent_id' => ${'last_' . $d['spec_id'] . '_id'}, 'term_id' => $term->id]);
                     if ($d['spec_id'] == 1) {
                         $last_1_id = $department->id;
                     } elseif ($d['spec_id'] == 2) {
                         $last_2_id = $department->id;
                     } elseif ($d['spec_id'] == 3) {
                         $last_3_id = $department->id;
                     }
                 }
             }
         }
     }
 }
Ejemplo n.º 11
0
    public function report(Request $request)
    {
        # code...
        $per_page = request('per_page', 20);
        $students = $this->prepQuery($request->all());
        $students = $students->paginate($per_page);
        $students->appends($request->except('page'));
        $year_term = Year::join('academystructure_terms', 'academystructure_years.id', '=', 'academystructure_terms.year_id')->select(\DB::raw('CONCAT(academystructure_years.name, "-", academystructure_terms.name) as name,
										academystructure_terms.id as tid'))->groupBy('academystructure_terms.name', 'academystructure_years.name')->orderBy('academystructure_terms.id')->pluck('name', 'tid')->toArray();
        $spec_id = Specialty::pluck('name', 'id')->toArray();
        $exam_center_id = ExamCenter::pluck('name', 'id')->toArray();
        // return $students->pluck('sps');
        return view('exams::centers.report', compact('students', 'year_term', 'spec_id', 'exam_center_id'));
    }
Ejemplo n.º 12
0
 /**
  * @desc Delete specialty
  * @param Specialty $specialty (get specialty data from provider route model binding $router->model lisner)
  * @delete Function delete specialty 
  * @redirct to specialty index
  **/
 public function delete(Specialty $specialty)
 {
     $specialty->delete();
     return redirect()->route('as.specialties.index');
 }
Ejemplo n.º 13
0
 public function export(Request $request)
 {
     Excel::create('registrations', function ($excel) {
         $excel->sheet('registrations', function ($sheet) {
             $steps = RegistrationStep::pluck('name', 'id')->toArray();
             $specialties = Specialty::pluck('name', 'id')->toArray();
             $type = RegistrationType::pluck('title', 'id')->toArray();
             $genders = config('registration.genders');
             $countries = Country::pluck('name', 'id')->toArray();
             $cities = City::pluck('name', 'id')->toArray();
             $states = State::pluck('name', 'id')->toArray();
             $years = AcademycycleYear::pluck('name', 'id')->toArray();
             $registration_periods = RegistrationPeriod::pluck('name', 'id')->toArray();
             $registrations = $this->prepQuery(request()->all())->get();
             $sheet->loadView('registration::registrations.export', compact('registration_periods', 'registrations', 'steps', 'countries', 'years', 'specialties', 'type', 'genders', 'cities', 'states'));
         })->download('xlsx');
     });
 }
Ejemplo n.º 14
0
 public function pass(Request $request)
 {
     $steps = Step::pluck('name', 'id')->toArray();
     $periods = Period::pluck('name', 'id')->toArray();
     $current_period = Period::current()->first();
     $registration_count = Registration::orderBy('id', 'desc');
     $registration_gender = Registration::groupBy('gender');
     $registration_specialty = Registration::groupBy('academystructure_specialty_id');
     $registration_country = Registration::groupBy('contact_country_id');
     $registration_step = Registration::groupBy('registration_step_id');
     if (request('step_id')) {
         $registration_count->whereHas('histories', function ($query) {
             $query->where('registration_step_id', '=', request('step_id'));
         });
         $registration_gender->whereHas('histories', function ($query) {
             $query->where('registration_step_id', '=', request('step_id'));
         });
         $registration_specialty->whereHas('histories', function ($query) {
             $query->where('registration_step_id', '=', request('step_id'));
         });
         $registration_country->whereHas('histories', function ($query) {
             $query->where('registration_step_id', '=', request('step_id'));
         });
         $registration_step->whereHas('histories', function ($query) {
             $query->where('registration_step_id', '=', request('step_id'));
         });
     }
     if (request('period_id')) {
         $registration_count->where('registration_period_id', request('period_id'));
         $registration_gender->where('registration_period_id', request('period_id'));
         $registration_specialty->where('registration_period_id', request('period_id'));
         $registration_country->where('registration_period_id', request('period_id'));
         $registration_step->where('registration_period_id', request('period_id'));
     }
     $registration_count = $registration_count->count();
     $registration_gender = $registration_gender->select('gender', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray();
     $registration_specialty = $registration_specialty->select('academystructure_specialty_id as specialty', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray();
     $registration_country = $registration_country->select('contact_country_id as country', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray();
     $registration_step = $registration_step->select('registration_step_id as step', DB::raw('count(*) as total'))->orderBy('total', 'desc')->get()->toArray();
     $steps = Step::pluck('name', 'id')->toArray();
     $periods = Period::pluck('name', 'id')->toArray();
     $current_period = Period::current()->first();
     $specialties = Specialty::pluck('name', 'id')->toArray();
     $countries = Country::pluck('name', 'id')->toArray();
     return view('registration::reports.pass', compact('steps', 'periods', 'current_period', 'specialties', 'countries', 'registration_gender', 'registration_specialty', 'registration_country', 'registration_step', 'registration_count'));
 }
Ejemplo n.º 15
0
 /**
  * @desc Delete specialty
  * @param Specialty $specialty (get specialty data from provider route model binding $router->model lisner)
  * @delete Function delete specialty
  * @redirct to specialty index
  **/
 public function delete(Specialty $specialty)
 {
     $specialty->delete();
     return redirect()->route('as.specialties.index')->with('success', trans('academystructure::specialties.delete_success'));
 }
Ejemplo n.º 16
0
 public function store(RegisterRequest $request)
 {
     $error = 0;
     $message = '';
     $period = Period::current()->first();
     if (!$period) {
         $error = 1;
         $message = 'لا يوجد فترة تسجيل حاليا';
         return response()->json(compact('error', 'message'), 200, [], JSON_NUMERIC_CHECK);
     }
     $input = $request->all();
     $registration = new Registration();
     $registration->fill(array_filter($input));
     if (!$request->has('academystructure_specialty_id') || empty($request->input('academystructure_specialty_id'))) {
         if ($specialty = Specialty::where('code', 'G')->first()) {
             $registration->academystructure_specialty_id = $specialty->id;
         } else {
             $registration->academystructure_specialty_id = 1;
         }
     }
     $step = RegistrationStep::verifyEmail()->first();
     if (($reason = $this->canApply($input)) !== true) {
         $error = 1;
         switch ($reason) {
             case 'ACTIVE':
                 $message = 'الرقم المدني الذي تحاول التسجيل به، مستخدم من طرف طالب منتظم.';
                 break;
             case 'DELAYED':
                 $message = 'الرقم المدني الذي تحاول التسجيل به، مستخدم من طرف طالب مؤجل.';
                 break;
             case 'NO_DEGREES':
                 $message = 'لم تقم بادخال بيانات الشهادة';
                 break;
             case 'NO_SPECIALITY':
                 $message = 'لم تقم باختيار تخصص المرجو اعادة اختيار تخصص.';
                 break;
         }
         return response()->json(compact('error', 'message'), 200, [], JSON_NUMERIC_CHECK);
     }
     $password = !empty($registration->password) ? $registration->password : mt_rand(6, 10);
     $username = daress_generate_username();
     $registration->username = $username;
     $registration->password = bcrypt($password);
     $registration->registration_period_id = $period->id;
     $registration->registration_step_id = $step ? $step->id : NULL;
     $registration->passeport_country_id = !empty($input['passeport_country_id']) ? $input['passeport_country_id'] : null;
     if (!$registration->save()) {
         $error = 1;
         $message = 'لم يتم تسجيل طلبك المرجو اعادة المحاولة لاحقا.';
     } else {
         $registration->generateCode();
         /** check for extra degrees an dstore them */
         foreach ($input['degrees'] as $degree) {
             $registration->degrees()->create($degree);
         }
         foreach ($input['files'] as $file) {
             $file = RegistrationFile::find($file['id']);
             $file->update(['registration_id' => $registration->id]);
         }
         /** end check for extra degrees */
         event(new RegistrationCreated($registration));
         event(new RegistrationEmailChanged($registration, ['password' => $password]));
         event(new RegistrationUpdated($registration));
         event(new RegistrationStepChanged($registration, ['password' => $password, 'comment' => 'تفعيل البريد الإلكتروني']));
     }
     if ($error == 1) {
         return response()->json(compact('error', 'message'), 200, [], JSON_NUMERIC_CHECK);
     }
     $message = 'أحسنت ـ تم ارسال رسالة الى بريدك الالكتروني تحتوي على المعلومات التي تحتاجها من أجل الولوج لبوابة المتقدم.';
     $token = Auth::guard('api_registration')->generateTokenById($registration->id);
     return response()->json(compact('token'), 200, [], JSON_NUMERIC_CHECK);
 }
Ejemplo n.º 17
0
 public function test(Request $request)
 {
     ClassroomSessionExcuse::truncate();
     ClassroomSessionAttendance::where('student_id', 10001)->update(['valid' => 0]);
     exit;
     $student_id = 4796;
     $order_dir = in_array($request->input('order_dir'), ['ASC', 'DESC']) ? $request->input('order_dir') : 'ASC';
     $exams = Exam::select('exams.type', 'exams.start_at', 'exams.finish_at', 'exams.name', 'exams.id')->join('subject_subjects as subsub', 'subsub.id', '=', 'exams.subject_id')->join('student_subjects as stusub', function ($j) use($student_id) {
         $j->on('stusub.subject_id', '=', 'subsub.id')->where('stusub.student_id', '=', $student_id)->where('stusub.state', '=', 'study');
     })->where(function ($query) use($request, $student_id) {
         $query->orWhereIn('exams.type', ['midterm', 'remidterm'])->orWhereRaw('exams.id IN (SELECT ce.exam_id FROM classrooms_exam as ce
                             JOIN classrooms as c ON c.id = ce.classroom_id
                             JOIN classroom_students as cs ON cs.classroom_id = c.id
                                 AND cs.student_id = ' . $student_id . '
                             WHERE exam_id = exams.id GROUP BY ce.id)');
         if ($request->has('finalExam')) {
             $query->orWhereIn('exams.type', ['final', 'summer', 'refinal']);
         }
     })->where('exams.semester_id', semester()->id)->where('finish_at', '>=', date('Y-m-d H:i:s'))->groupBy('exams.id')->orderBy('exams.start_at', $order_dir)->with(['questions' => function ($w) {
         $w->select('questionbank_questions.id', 'questionbank_questions.question', 'questionbank_questions.type');
         if (false) {
             $w->orderByRaw('RAND()');
         } else {
             $w->orderBy('questionbank_questions.type', 'DESC');
         }
     }, 'questions.choices' => function ($w) {
         $w->select('questionbank_choices.id', 'questionbank_choices.question_id', 'questionbank_choices.choice', 'questionbank_choices.istrue');
     }])->get();
     return $exams;
     exit;
     $specialities = Specialty::selectRaw('asp.id, asp.name, asp.short_description, asp.description, GROUP_CONCAT(adp.subject_ids) as subject_ids, COUNT(adt.id) as terms, COUNT(DISTINCT ady.id) as years')->leftJoin('academystructure_departments as adp', 'adp.spec_id', '=', 'asp.id')->leftJoin('academystructure_terms as adt', 'adt.id', '=', 'adp.term_id')->leftJoin('academystructure_years as ady', 'ady.id', '=', 'adt.year_id')->from('academystructure_specialties as asp')->groupBy('asp.id')->with('departments')->get();
     foreach ($specialities as $specialty) {
         $subject_ids = explode(",", preg_replace(['/\\[/', "/\\]/"], "", $specialty->subject_ids));
         $specialty->hours = Subject::whereIn('id', $subject_ids)->sum('hour');
         foreach ($specialty->departments as $department) {
             $subject_ids = explode(",", preg_replace(['/\\[/', "/\\]/", '/"/', "/'/"], "", $department->subject_ids));
             // var_dump($subject_ids);
             $department->subjects = Subject::whereIn('id', $subject_ids)->get();
         }
     }
     $specialities->makeHidden(['subject_ids']);
     return $specialities;
     exit;
     $status_ping_url = \App::environment('local') ? 'http://46.40.236.186:9090/DARES/public/classrooms/classrooms/status_ping' : route('classrooms.sessions.status-ping');
     $WiziqApi = new WiziqApi();
     try {
         $wiziqclassroom = WiziqClassroom::build("test", new DateTime("2016-08-10 23:55:00"))->withPresenter(20, "test teacher")->withAttendeeLimit(config("classrooms.attendee_limit"))->withReturnUrl('https://el-css.edu.om')->withDuration(10)->withExtendDuration(0)->withStatusPingUrl($status_ping_url)->withTimeZone("Asia/Muscat")->withLanguageCultureName("ar-SA")->withCreateRecording(true);
         $response = $WiziqApi->create($wiziqclassroom);
         \Log::info($response);
         exit(var_dump($response));
         $data = ['wiziq_id' => $response['class_id'], 'recording_link' => $response['recording_url'], 'presenter_link' => $response['presenter_url']];
         /** add attendees to virtual classroom */
         Log::info($response);
         if ($session->fill($data)->save() && $response) {
             $error = $this->createStudentsSessions($classroom->students, $session);
         }
     } catch (\mikemix\Wiziq\Common\Api\Exception\CallException $e) {
         $error = 1;
     } catch (\mikemix\Wiziq\Common\Http\Exception\InvalidResponseException $e) {
         $error = 1;
     } catch (\PDOException $e) {
         $error = 1;
     }
     if ($error == 0) {
         event(new VirtualClassroomsCreated());
     } else {
         $session->wiziq_status = 'error';
         $session->save();
     }
 }
Ejemplo n.º 18
0
 public function specialty()
 {
     return Specialty::selectRaw('COUNT(adt.id) as terms, COUNT(DISTINCT ady.id) as years')->leftJoin('academystructure_departments as adp', 'adp.spec_id', '=', 'asp.id')->leftJoin('academystructure_terms as adt', 'adt.id', '=', 'adp.term_id')->leftJoin('academystructure_years as ady', 'ady.id', '=', 'adt.year_id')->from('academystructure_specialties as asp')->groupBy('asp.id')->where('asp.id', 1)->first();
 }
Ejemplo n.º 19
0
 /**
  * Handle the event.
  *
  * @param  RegistrationStepChanged  $event
  * @return void
  */
 public function handle($event)
 {
     $registration = $event->registration;
     $extra = $event->extra;
     $registration->load('step', 'step.notes', 'period', 'period.year', 'type', 'speciality');
     $step = $registration->step;
     $password = isset($extra['password']) ? $extra['password'] : '';
     if (empty($step->email_template)) {
         return true;
     }
     $notes = [];
     $comment = '';
     if (isset($extra['comment'])) {
         $comment = $extra['comment'];
     }
     if (isset($extra['notes'])) {
         $notes = $extra['notes'];
     }
     /**
      * get next semester
      */
     $firstday = '';
     $semester = semester();
     //Semester::where('id', semester()->id)->orderBy('academycycle_semesters.id', 'ASC')->first();
     if ($semester) {
         $firstday = $semester->start_at;
     }
     /**
      * get subejcts for registrar
      */
     $hours = 0;
     $fees = 0;
     if ($registration->academystructure_specialty_id) {
         $department = Department::where('spec_id', $registration->academystructure_specialty_id)->where(function ($w) {
             $w->orWhere('parent_id', 0);
             $w->orWhereNull('parent_id');
         })->first();
         $equation_subjects_ids = RegistrationEquationSubject::whereNotNull('subject_id')->where('status', 'accepted')->whereHas('equation', function ($w) use($registration) {
             $w->where('registration_id', $registration->id);
         })->pluck('subject_id')->toArray();
         $subject_ids = $department ? json_decode($department->subject_ids, TRUE) : [];
         $subject_ids = array_diff($subject_ids, $equation_subjects_ids);
         $subjects = Subject::select('name', 'hour')->whereIn('id', $subject_ids)->get();
         $hours = $subjects->sum('hour');
         $study_fee = FinancialInvoiceItem::where('slug', 'study_fee')->first();
         $fees = $hours * ($registration->subject_fee > 0 ? $registration->subject_fee : $study_fee->amount);
     }
     $years = 0;
     if ($registration->academystructure_specialty_id) {
         $years = Specialty::selectRaw('COUNT(adt.id) as terms, COUNT(DISTINCT ady.id) as years')->leftJoin('academystructure_departments as adp', 'adp.spec_id', '=', 'asp.id')->leftJoin('academystructure_terms as adt', 'adt.id', '=', 'adp.term_id')->leftJoin('academystructure_years as ady', 'ady.id', '=', 'adt.year_id')->from('academystructure_specialties as asp')->groupBy('asp.id')->where('asp.id', $registration->academystructure_specialty_id)->first()->years;
     }
     /**
      * end get registrar subjects
      */
     $notes_html = '';
     if ($notes = RegistrationStepNote::whereIn('id', $notes)->pluck('content')->toArray()) {
         $notes_html = '<ul><li>' . implode('</li><li>', $notes) . '</li></ul>';
     }
     /*
      *   calculate first term fees
      */
     /*
      *   end fees calculations
      */
     $template = str_replace(['{reg_portal}', '{debit}', '{name}', '{code}', '{mobile}', '{username}', '{year}', '{nid}', '{shortname}', '{specialty}', '{today}', '{hours}', '{firstday}', '{notes}', '{years}', '{fees}', '{comment}', '{password}'], [env('REGSITRAR_EMAIL_EMAIL_VERIFIED_REDIRECT'), $registration->debit, $registration->fullname, $registration->code, $registration->contact_mobile, $registration->username, $registration->period->year->name, $registration->national_id, $registration->shortname, $registration->speciality ? $registration->speciality->name : '', date('Y-m-d'), $hours, $firstday, $notes_html, $years, $fees, $comment, $password], $step->email_template);
     $data = ['fullname' => $registration->fullname, 'template' => $template, 'verification_token' => $registration->verification_token];
     $view = 'email_step';
     if ($step->verify_email == 1) {
         $view = 'email_verification_token';
     }
     if (!empty($registration)) {
         $payload = ['data' => $data, 'send_to' => $registration->contact_email, 'send_to_name' => $registration->fullname, 'subject' => $registration->step->name, 'view' => $view];
         $job = new SendRegistrationStepChangedEmail($payload);
         $this->dispatch($job);
     }
 }