예제 #1
0
 public function showDashboard()
 {
     $data = [];
     $loginid = Session::get('user')->id;
     $collegeid = Session::get('user')->collegeid;
     $flag = Session::get('user')->flag;
     $tb = "";
     if ($flag == 1) {
         $tb = "Admin";
     } else {
         if ($flag == 2) {
             $tb = "Teacher";
         } else {
             if ($flag == 3) {
                 $tb = "Student";
             } else {
                 $tb = "Staff";
             }
         }
     }
     $dt = $tb::where('loginid', '=', $loginid)->first();
     $data['name'] = $dt->name;
     $data['pic'] = $dt->profilepic;
     $data['id'] = $loginid;
     //Cards value
     $data['students'] = Student::where('collegeid', '=', $collegeid)->count();
     $data['teachers'] = Teacher::where('collegeid', '=', $collegeid)->count();
     $data['subjects'] = Subject::where('collegeid', '=', $collegeid)->count();
     $data['parents'] = $data['students'] * 2;
     return View::make('pages.dashboard', array('data' => $data, 'flag' => $flag));
 }
예제 #2
0
 public function feedback()
 {
     $writer = Student::where('auth', '=', Input::get('auth'))->first();
     $feedClass = Input::get('class');
     $commit = Input::get('commit');
     $system = Input::get('system');
     $feedback = new Feedback();
     $feedback->feedClass = $feedClass;
     $feedback->commit = $commit;
     $feedback->stu_id = $writer->id;
     $feedback->system = $system;
     $feedback->checked = 0;
     $feedback->save();
     return "suc";
 }
 public function index()
 {
     $id = Auth::id();
     $student = Student::where('id_user', '=', $id)->get()->first();
     $teacher = Teacher::where('id_user', '=', $id)->get()->first();
     if (isset($student)) {
         return View::make('users.hello', compact('student'));
         //
     } else {
         if (isset($teacher)) {
             return View::make('users.hello', compact('teacher'));
             //
         }
     }
 }
예제 #4
0
 public function forumIdWrite($id)
 {
     $json = Input::get('json');
     $data = json_decode($json);
     $writer = Student::where('auth', '=', $data->auth)->first();
     $sn = Topic::max('sn') + 1;
     $body = base64_decode($data->body);
     $topics = Topic::find($id);
     $topics->sn = $sn;
     $topics->save();
     $commit = new Commit();
     $commit->stu_id = $writer->id;
     $commit->topic_id = $id;
     $commit->body = $body;
     $commit->day = date("Y/m/d");
     $commit->save();
     return "suc";
 }
예제 #5
0
 public function showCalendar($wingman_id, $student_id)
 {
     $this->setGroup();
     $city = Wingman::find($wingman_id)->city()->first();
     $volunteers = Group::where('name', $this->asvGroupName)->first()->volunteer()->where('city_id', '=', $city->id)->where('status', '=', 1)->where('user_type', '=', 'volunteer')->groupby('id')->get();
     //return $volunteers;
     $subjects = Wingman::find($wingman_id)->city()->first()->subject()->get();
     $wingman_modules = WingmanModule::all();
     /*$calendarEvents = DB::table('propel_calendarEvents as P')->select('P.id','P.type as title','P.start_time as start','P.end_time as end')->where('student_id','=',$student_id)->get();
      */
     $calendarEvents = DB::table('propel_calendarEvents as P')->leftJoin('propel_cancelledCalendarEvents as Q', 'P.id', '=', 'Q.calendar_event_id')->leftJoin('propel_wingmanTimes as R', 'R.calendar_event_id', '=', 'P.id')->leftJoin('propel_volunteerTimes as S', 'S.calendar_event_id', '=', 'P.id')->leftJoin('User as T', 'T.id', '=', 'S.volunteer_id')->leftJoin('User as U', 'U.id', '=', 'R.wingman_id')->leftJoin('propel_wingmanModules as V', 'V.id', '=', 'R.wingman_module_id')->leftJoin('propel_subjects as W', 'W.id', '=', 'S.subject_id')->select('P.id', 'P.type as title', 'P.start_time as start', 'P.end_time as end', 'P.status', 'Q.reason as reason', 'Q.comment as comment', 'U.name as wingman_name', 'T.name as volunteer_name', 'S.volunteer_id as volunteer_id', 'R.wingman_id as wingman_id', 'V.id as module_id', 'W.id as subject_id', 'V.name as module_name', 'W.name as subject_name')->where('student_id', '=', $student_id)->get();
     foreach ($calendarEvents as $calendarEvent) {
         $calendarEvent->title = str_replace('_', ' ', $calendarEvent->title);
         $calendarEvent->title = ucwords($calendarEvent->title);
         $calendarEvent->reason = str_replace('_', ' ', $calendarEvent->reason);
         $calendarEvent->reason = ucwords($calendarEvent->reason);
     }
     $calendarEvents = json_encode($calendarEvents);
     $student_name = Student::where('id', '=', $student_id)->first();
     $GLOBALS['student_id'] = $student_id;
     return View::make('calendar.calendar-view')->with('volunteers', $volunteers)->with('subjects', $subjects)->with('wingman_modules', $wingman_modules)->with('student_id', $student_id)->with('wingman_id', $wingman_id)->with('calendarEvents', $calendarEvents)->with('student_name', $student_name->name);
 }
 public function postGuardar()
 {
     $bandera = false;
     $id = Input::get('idQues');
     $ans = Input::get('res');
     $answers = Answer::all();
     $question = Question::find($id);
     $cantidad = Question::count();
     foreach ($answers as $a) {
         if ($a->id_question == $id) {
             $bandera = true;
             $answer = $a;
             break;
         }
     }
     if (!$bandera) {
         $answer = new Answer();
         $answer->id_question = $id;
         $ids = Auth::id();
         $student = Student::where('id_user', '=', $ids)->get()->first();
         $answer->id_student = $student->id;
         $answer->answer = $ans;
         $answer->result = QuestionsController::verifyAnswer($question, $ans);
         $answer->save();
     } else {
         $answer->result = QuestionsController::verifyAnswer($question, $ans);
         $answer->answer = $ans;
         $answer->save();
     }
     if ($cantidad == $id) {
         return Redirect::to('questions/exam?endTest=yes');
         //"holi ".$id." ".$ans;
     } else {
         if ($cantidad > $id) {
             return Redirect::to('questions/exam?numberQIn=' . ++$id);
         }
     }
 }
 /**
  * Run the migrations.
  *
  * @return void
  */
 public function up()
 {
     Schema::table('studentdropouts', function (Blueprint $table) {
         //
         /*Add data to include Applied Physics (programid = 117) and batch 2011 and 2012
         		1. Get all students from 2011 and 2012 who is taking applied physics
         		2. Remove students who shifted out
         		3. If batch 2011 and has no studentterm in 2012 and 2013 then add student to studentdropouts table
         		4. If batch 2012 and has no studentterm in 2013 then add student to studentdropouts table
         		*/
         $program = Program::where('programid', 117)->first();
         $shiftees = Studentshift::where('program1id', $program->programid)->lists('studentid');
         $min = 201100000;
         $max = 201300000;
         $studentids = Studentterm::select('studentid')->where('studentid', '>', $min)->where('studentid', '<', $max)->whereNotIn('studentid', $shiftees)->where('programid', $program->programid)->groupBy('studentid')->lists('studentid');
         foreach ($studentids as $studentid) {
             $student = Student::where('studentid', $studentid)->first();
             if ($student->studentid < 201200000) {
                 //batch 2011
                 $stayed = $student->studentterms()->where('year', 2012)->orWhere('year', 2013)->count();
             } else {
                 //batch 2012
                 $stayed = $student->studentterms()->where('year', 2013)->count();
             }
             if ($stayed === 0) {
                 //insert to studentdropout
                 $semcount = $student->studentterms()->where('programid', $program->programid)->whereRaw('CAST(aysem AS TEXT) NOT LIKE \'%3\'')->count();
                 $newDropout = new Studentdropout();
                 $newDropout->studentid = $student->studentid;
                 $newDropout->programid = $program->programid;
                 $newDropout->lastprogramid = $program->programid;
                 $newDropout->collegeid = $program->department->college->unitid;
                 $newDropout->semesters = $semcount;
                 $newDropout->save();
             }
         }
     });
 }
예제 #8
0
 public static function search($search_text, $search_state, $search_level)
 {
     $first_filter = Student::where('names', 'LIKE', "%{$search_text}%")->orWhere('lastname', 'LIKE', "%{$search_text}%")->whereNull('deleted_at');
     //if($search_state=='T') return $first_filter;
     $students = $first_filter->get();
     $second_filter = [];
     foreach ($students as $student) {
         $enrollment = $student->getCurrentEnrollment();
         if ($enrollment) {
             if ($search_state == 'T' || $search_state == $enrollment->state) {
                 if ($search_level == '0' || $search_level == $enrollment->level_id) {
                     $second_filter[] = $student->id;
                 }
             }
         } else {
             if ($search_state == 'T' || $search_state == 'N') {
                 if ($search_level == '0' || $search_level == $student->getLevelToEnroll()->id) {
                     $second_filter[] = $student->id;
                 }
             }
         }
     }
     return Student::whereIn('id', $second_filter);
 }
예제 #9
0
 public function get($id)
 {
     $user = \Student::where('id', '=', $id)->first();
     //$user = $this->model->where('id', '=', $id)->first();
     return $user->name;
 }
예제 #10
0
파일: routes.php 프로젝트: nu1ww/ls-rewamp
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the Closure to execute when that URI is requested.
|
*/
Route::get('/', 'UsersController@login');
Route::get('/login', 'UsersController@login');
Route::post('/login', 'UsersController@authenticate');
Route::get('logs', '\\Rap2hpoutre\\LaravelLogViewer\\LogViewerController@index');
//  Route::get('/modules/marks-input/create','ModulesController@markInputCreate');
Route::get('/test', function () {
    $x = Student::where('san', '=', 'khpsh001')->first();
    return $x->id;
});
Route::get('/teststudents', 'StudentsController@teststudents');
//  Route::post('/modules/marks-input/create','ModulesController@saveMarkInputs');
Route::group(array('before' => 'members_auth'), function () {
    Route::post('/modules/supervisor-allocation', 'ModuleSupervisorAllocationsController@assign_supervisor');
    //Route::post('/modules/supervisor-allocation','ModuleMarkerAllocationsController@assign_marker');
    Route::get('/testpage', function () {
        return View::make('test');
    });
    Route::get('/logout', 'UsersController@logout');
    Route::get('/help', 'UsersController@logout');
    Route::get('students/create/checkSanAvailability', 'StudentsController@checkSanAvailability');
    Route::get('students/create/information_source/dropdown', 'StudentsController@information_source_dropdown');
    Route::get('students/create/intakes/dropdown', 'StudentsController@intakes_dropdown');
예제 #11
0
 public function getAllActive()
 {
     return Student::where('is_active', '=', 1)->with('secondary', 'secondary.grade', 'secondary.school', 'secondary.schoolboard')->orderBy('last_name')->remember(60)->get();
 }
 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     $rules = ['regiNo' => 'required', 'fname' => 'required', 'lname' => 'required', 'gender' => 'required', 'religion' => 'required', 'bloodgroup' => 'required', 'nationality' => 'required', 'dob' => 'required', 'session' => 'required', 'class' => 'required', 'section' => 'required', 'rollNo' => 'required', 'shift' => 'required', 'photo' => 'required|mimes:jpeg,jpg,png', 'fatherName' => 'required', 'fatherCellNo' => 'required', 'motherName' => 'required', 'motherCellNo' => 'required', 'presentAddress' => 'required', 'parmanentAddress' => 'required'];
     $validator = \Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('/student/create')->withErrors($validator);
     } else {
         $fileName = Input::get('regiNo') . '.' . Input::file('photo')->getClientOriginalExtension();
         $student = new Student();
         $student->regiNo = Input::get('regiNo');
         $student->firstName = Input::get('fname');
         $student->middleName = Input::get('mname');
         $student->lastName = Input::get('lname');
         $student->gender = Input::get('gender');
         $student->religion = Input::get('religion');
         $student->bloodgroup = Input::get('bloodgroup');
         $student->nationality = Input::get('nationality');
         $student->dob = Input::get('dob');
         $student->session = trim(Input::get('session'));
         $student->class = Input::get('class');
         $student->section = Input::get('section');
         $student->group = Input::get('group');
         $student->rollNo = Input::get('rollNo');
         $student->shift = Input::get('shift');
         $student->photo = $fileName;
         $student->nationality = Input::get('nationality');
         $student->extraActivity = Input::get('extraActivity');
         $student->remarks = Input::get('remarks');
         $student->fatherName = Input::get('fatherName');
         $student->fatherCellNo = Input::get('fatherCellNo');
         $student->motherName = Input::get('motherName');
         $student->motherCellNo = Input::get('motherCellNo');
         $student->localGuardian = Input::get('localGuardian');
         $student->localGuardianCell = Input::get('localGuardianCell');
         $student->presentAddress = Input::get('presentAddress');
         $student->parmanentAddress = Input::get('parmanentAddress');
         $student->isActive = "Yes";
         $hasStudent = Student::where('regiNo', '=', Input::get('regiNo'))->where('class', '=', Input::get('class'))->first();
         if ($hasStudent) {
             $messages = $validator->errors();
             $messages->add('Duplicate!', 'Student already exits with this registration no.');
             return Redirect::to('/student/create')->withErrors($messages)->withInput();
         } else {
             $student->save();
             Input::file('photo')->move(base_path() . '/public/images', $fileName);
             return Redirect::to('/student/create')->with("success", "Student Admited Succesfully.");
         }
     }
 }
예제 #13
0
 public function findMemberInformation()
 {
     if (Request::ajax()) {
         $student = Student::where('email', Input::get('email'))->first();
         return Response::json($student);
     }
 }
예제 #14
0
파일: filters.php 프로젝트: danncsc/DaanX
| The "guest" filter is the counterpart of the authentication filters as
| it simply checks that the current user is not logged in. A redirect
| response will be issued if they are, which you may freely change.
|
*/
Route::filter('guest', function () {
    if (Auth::check()) {
        return Redirect::to('/');
    }
});
/*
|--------------------------------------------------------------------------
| CSRF Protection Filter
|--------------------------------------------------------------------------
|
| The CSRF filter is responsible for protecting your application against
| cross-site request forgery attacks. If this special token in a user
| session does not match the one given in this request, we'll bail.
|
*/
Route::filter('csrf', function () {
    if (Session::token() !== Input::get('_token')) {
        throw new Illuminate\Session\TokenMismatchException();
    }
});
Route::filter('stu_login', function () {
    $auth = Input::get("auth");
    if (Student::where("auth", "=", $auth)->count() == 0) {
        return "Not User";
    }
});
 public function postEditVoter()
 {
     //verify the user input
     $validator = Validator::make(Input::all(), array('Faculty' => '', 'Residence' => ''));
     if ($validator->fails()) {
         return Redirect::route('admin-view-voters-get')->with('globalerror', 'Please Try Again');
     } else {
         $voter_id = Input::get('Voter_ID');
         $voter = Student::where('id', '=', $voter_id)->first();
         $faculty = Input::get('Faculty');
         $residence = Input::get('Residence');
         $voter->Faculty = $faculty;
         $voter->Redidence = $residence;
         if ($voter->save()) {
             return Redirect::route('admin-view-voters-get')->with('globalsuccess', 'Voter Details have been edited');
         }
     }
 }
예제 #16
0
 public function hardFilterStudents($name)
 {
     $students = Student::where('name', 'like', "%{$name}%")->take(5)->get();
     return $students->toJson();
 }
예제 #17
0
 public function checkSanAvailability()
 {
     $clanCount = Student::where('san', '=', Input::get('option'))->count();
     if ($clanCount == 0) {
         return 'Available';
     } else {
         return 'Not Available';
     }
 }
예제 #18
0
 public function saveMarkInputs()
 {
     if (0 == Input::get('element')) {
         return '0 element';
     }
     $ls_student_number = Input::get('ls_student_number');
     $element = Input::get('element');
     //$student_module_marks = DB::table('student_module_marks_input')->select('*')->where('ls_student_number','=',$ls_student_number)->where('element','=',$element)->get();
     $student_module_marks = StudentModuleMarksInput::where('ls_student_number', '=', $ls_student_number)->where('element', '=', $element)->orderBy('id', 'desc')->first();
     //return $student_module_marks;
     // if($student_module_marks == '') {
     //return Input::get();
     $student_module_marks_input = new StudentModuleMarksInput();
     $student_module_marks_input->ls_student_number = Input::get('ls_student_number');
     $student_module_marks_input->san = Student::where('ls_student_number', '=', Input::get('ls_student_number'))->orderBy('id', 'desc')->first()->san;
     $student_module_marks_input->test = Input::get('test');
     $student_module_marks_input->test_remark = Input::get('test_remark');
     $student_module_marks_input->course = Input::get('course');
     $student_module_marks_input->course_remark = Input::get('course_remark');
     $student_module_marks_input->retake = Input::get('retake');
     $student_module_marks_input->retake_remark = Input::get('retake_remark');
     $student_module_marks_input->element = Input::get('element');
     $student_module_marks_input->comments = Input::get('comments');
     $student_module_marks_input->created_by = Sentry::getUser()->id;
     if ($student_module_marks_input->save()) {
         return 'Added';
     } else {
         return 'error';
     }
     /*}else{
                 $student_module_marks_input = StudentModuleMarksInput::find($student_module_marks->id);
     
                 $student_module_marks_input->ls_student_number = Input::get('ls_student_number');
                 $student_module_marks_input->san = Student::where('ls_student_number','=',Input::get('ls_student_number'))->orderBy('id', 'desc')->first()->san;
                 $student_module_marks_input->test = Input::get('test');
                 $student_module_marks_input->test_remark = Input::get('test_remark');
                 $student_module_marks_input->course = Input::get('course');
                 $student_module_marks_input->course_remark = Input::get('course_remark');
                 $student_module_marks_input->retake = Input::get('retake');
                 $student_module_marks_input->retake_remark = Input::get('retake_remark');
                 $student_module_marks_input->element = Input::get('element');
                 $student_module_marks_input->comments = Input::get('comments');
                 $student_module_marks_input->created_by = Sentry::getUser()->id;
     
     
                 if ($student_module_marks_input->save()) {
                     return 'Added';
                 } else {
                     return 'error';
                 }
             }*/
 }
예제 #19
0
 public function import_single_line()
 {
     $this->output->set_content_type('application/json');
     $firstname = $this->input->post('firstname');
     $lastname = $this->input->post('lastname');
     $fullname = $this->input->post('fullname');
     $email = $this->input->post('email');
     $options = $this->input->post('options');
     $this->parser->assign('firstname', $firstname);
     $this->parser->assign('lastname', $lastname);
     $this->parser->assign('fullname', $fullname);
     $this->parser->assign('email', $email);
     if ((trim($firstname) != '' && trim($lastname) != '' || trim($fullname) != '') && trim($email) != '') {
         $student_fullname = trim($fullname) != '' ? trim($fullname) : trim($firstname) . ' ' . trim($lastname);
         $this->_transaction_isolation();
         $this->db->trans_begin();
         $student = new Student();
         $student->where('email', trim($email));
         $student->get();
         if ($student->exists()) {
             if ($student->fullname != $student_fullname) {
                 $student->fullname = $student_fullname;
                 $student->save();
                 $this->db->trans_commit();
             } else {
                 $this->db->trans_rollback();
             }
             $this->parser->assign('error_message', 'lang:admin_students_csv_import_error_message_student_exists');
         } else {
             $this->load->library('form_validation');
             if ($this->form_validation->valid_email(trim($email))) {
                 $student->email = trim($email);
                 $student->fullname = $student_fullname;
                 $password = '';
                 if ($options['password_type'] == 'default') {
                     $password = $this->config->item('student_import_default_password');
                 } elseif ($options['password_type'] == 'random') {
                     $password = md5(base64_encode(rand(0, 99999999999) . time() . $student->fullname . $student->email) . $this->config->item('encryption_key'));
                     $password = substr($password, 0, rand(6, 20));
                 }
                 $student->password = $password != '' ? sha1($password) : '';
                 $student->language = $this->config->item('language');
                 if ($student->save()) {
                     $this->parser->assign('password', $password);
                     $this->db->trans_commit();
                     $this->parser->assign('success_message', 'lang:admin_students_csv_import_successfully_imported');
                     if ((bool) $options['send_mail']) {
                         if ($password == '') {
                             $this->_transaction_isolation();
                             $this->db->trans_begin();
                             $student->generate_random_password_token();
                             $this->db->trans_commit();
                         }
                         $this->_init_language_for_student($student);
                         $this->load->library('email');
                         $this->email->from_system();
                         $this->email->to($student->email);
                         $this->email->subject($this->lang->line('admin_students_csv_import_email_subject'));
                         $this->email->build_message_body('file:emails/backend/students/csv_import_email.tpl', array('student' => $student, 'password' => $password));
                         $sent = $this->email->send();
                         $this->_init_language_for_teacher();
                         if ($sent) {
                             $this->parser->assign('email_success_message', 'lang:admin_students_csv_import_email_sent_successfully');
                         } else {
                             $this->parser->assign('email_error_message', 'lang:admin_students_csv_import_email_sent_failed');
                         }
                     }
                 } else {
                     $this->db->trans_rollback();
                     $this->parser->assign('error_message', 'lang:admin_students_csv_import_error_message_student_save_error');
                 }
             } else {
                 $this->db->trans_rollback();
                 $this->parser->assign('error_message', 'lang:admin_students_csv_import_error_message_student_email_invalid');
             }
         }
         if ($student->exists()) {
             $this->parser->assign('student_id', $student->id);
             if (intval($options['assign_to_course']) > 0) {
                 $this->_transaction_isolation();
                 $this->db->trans_begin();
                 $course = new Course();
                 $course->get_by_id(intval($options['assign_to_course']));
                 if ($course->exists()) {
                     $participant = new Participant();
                     $participant->where_related('student', 'id', $student->id);
                     $participant->where_related('course', 'id', $course->id);
                     $participant->get();
                     if (!$participant->exists()) {
                         $participant->allowed = 0;
                         if ($participant->save(array('student' => $student, 'course' => $course))) {
                             $this->db->trans_commit();
                             $this->parser->assign('course_assignment_success_message', 'lang:admin_students_csv_import_successfully_added_course_participation');
                             $this->db->trans_begin();
                             $course = new Course();
                             $course->get_by_id(intval($options['assign_to_course']));
                             $participant->allowed = 1;
                             $participant->save();
                             $participants = new Participant();
                             $participants->where_related($course);
                             $participants->where('allowed', 1);
                             $participants_count = $participants->count();
                             if ($participants_count <= $course->capacity) {
                                 $this->db->trans_commit();
                                 $this->parser->assign('course_assignment_approwal_success_message', 'lang:admin_students_csv_import_successfully_added_course_participation_approwal');
                             } else {
                                 $this->db->trans_rollback();
                                 $this->parser->assign('course_assignment_approwal_error_message', 'lang:admin_students_csv_import_error_message_added_course_participation_approwal');
                             }
                         } else {
                             $this->db->trans_rollback();
                             $this->parser->assign('course_assignment_error_message', 'lang:admin_students_csv_import_error_message_participation_save_failed');
                         }
                     } else {
                         $this->db->trans_rollback();
                         $this->parser->assign('course_assignment_error_message', 'lang:admin_students_csv_import_error_message_already_in_course');
                     }
                 } else {
                     $this->db->trans_rollback();
                     $this->parser->assign('course_assignment_error_message', 'lang:admin_students_csv_import_error_message_course_not_found');
                 }
             }
         }
     } else {
         $this->parser->assign('error_message', 'lang:admin_students_csv_import_error_message_nothing_to_import');
     }
     $html = $this->parser->parse('backend/students/import_single_line.tpl', array(), TRUE);
     $this->output->set_output(json_encode($html));
 }
예제 #20
0
 public function showFeedback($wingman_id, $student_id)
 {
     $student = Student::where('id', '=', $student_id)->first();
     $entries = DB::table('propel_wingmanJournals as A')->join('User as B', 'B.id', '=', 'A.wingman_id')->select('A.id as id', 'A.on_date as on_date', 'B.name as wingman_name', 'A.title as title')->distinct()->where('A.student_id', '=', $student_id)->where('A.type', '=', 'child_feedback')->get();
     return View::make('feedback/child_feedback')->with('entries', $entries)->with('student', $student);
 }
예제 #21
0
 /**
  * Performs student account authentification and returns boolean information about success.
  * @param string $eamil student account e-mail address.
  * @param string $password student account password in plain text form.
  * @return boolean TRUE, if student authentification is successful, FALSE otherwise (i.e. bad e-mail of password).
  */
 public function authenticate_student_login($email, $password)
 {
     $student = new Student();
     $student->where('email', $email);
     $student->where('password', sha1($password));
     $student->get();
     if ($student->exists()) {
         $userdata = $student->to_array();
         unset($userdata['password']);
         unset($userdata['created']);
         unset($userdata['updated']);
         $this->CI->session->set_userdata(SESSION_AUTH_LOGIN_STUDENT, $userdata);
         $this->validate_student_login_verification(TRUE);
         $log = new Log();
         $log->add_student_login_log($this->CI->lang->line('students_login_successful_log_message'), NULL, $this->get_student_id());
         return TRUE;
     } else {
         $this->validate_student_login_verification(FALSE);
         $this->add_login_failed_record($email, self::ACCOUNT_TYPE_STUDENT);
         return FALSE;
     }
 }
예제 #22
0
 public function _validate_old_password($str, $student_id)
 {
     $student = new Student();
     $student->where('password', sha1($str));
     $student->get_by_id(intval($student_id));
     return $student->exists();
 }
 public function writeimg()
 {
     /*$myPublicFolder = public_path();
     		$savePath = $myPublicFolder."/photo";
     		$path = $savePath."/filename.txt";
     		File::put($path , "1111");
     		return $path; */
     $data = Input::all();
     $img = $data['imgdata'];
     $student_id = $data['student_id'];
     $img = str_replace('data:image/png;base64,', '', $img);
     $img = str_replace(' ', '+', $img);
     $imgdat = base64_decode($img);
     $myPublicFolder = public_path();
     $savePath = $myPublicFolder . "/photo";
     $path = $savePath . "/{$student_id}.png";
     File::delete($path);
     File::put($path, $imgdat);
     $last_add = Student::orderby('id', 'desc')->first();
     Student::where('student_id', '=', $student_id)->update(array('pic' => "{$student_id}.png"));
     return View::make('finish', array('imgid' => Student::where('student_id', '=', $student_id)->firstOrFail()->group));
 }
예제 #24
0
 private function inject_students($task_set_id)
 {
     $task_set = new Task_set();
     $task_set->get_by_id($task_set_id);
     $task_set_permissions = new Task_set_permission();
     $task_set_permissions->where_related($task_set);
     $task_set_permissions->where('enabled', 1);
     $task_set_permissions->get_iterated();
     $data = array('' => '');
     if ($task_set->exists()) {
         $students = new Student();
         $students->where_related('participant', 'allowed', 1);
         $students->where_related('participant/course/task_set', 'id', intval($task_set_id));
         if ($task_set_permissions->result_count() == 0) {
             if (!is_null($task_set->group_id)) {
                 $students->where_related('participant/group', 'id', intval($task_set->group_id));
             }
         } else {
             $group_ids = array();
             foreach ($task_set_permissions as $task_set_permission) {
                 $group_ids[] = (int) $task_set_permission->group_id;
             }
             $students->where_in_related('participant/group', 'id', $group_ids);
         }
         $students->include_related('participant/group', 'name', 'group');
         $students->where('students.id = `students`.`id` AND NOT EXISTS (SELECT * FROM `solutions` WHERE `solutions`.`student_id` = `students`.`id` AND `solutions`.`task_set_id` = ' . intval($task_set_id) . ')');
         $students->group_by('id');
         $students->order_by_related_with_constant('participant/group', 'name', 'asc');
         $students->order_by_as_fullname('fullname', 'asc');
         $students->order_by('email', 'asc');
         $students->get_iterated();
         foreach ($students as $student) {
             $data[is_null($student->group_name) ? 'lang:admin_solutions_student_selection_not_in_group' : $student->group_name][$student->id] = $student->fullname . ' (' . $student->email . ')';
         }
     }
     $this->parser->assign('students', $data);
 }