public function post_profile($table, $col_name, $type) { $this->object = database::get_instance(); $users = DB::table('users_login')->orderBy('id', 'desc')->first(); $stu_id = $users->user_session; $id = $this->object->view($table, "where_pluck", $col_name, '=', $stu_id, 'id'); $profile_image = $this->object->view($table, "where_pluck", 'id', '=', $id, 'profile_image'); Session::put('table', $table); if (Auth::attempt(array('password' => Input::get('old_pass')))) { if (Input::get('new_pass') == Input::get('pass_confirm')) { $this->add_file = $this->object->upload_file('profile_images', $table, 'upload', 'profile_image', "update", 'id', $id, $profile_image); $val = array('password' => Hash::make(Input::get('new_pass'))); $this->object->update($table, 'id', $id, $val); } else { $return = Redirect::to('profile=' . $type)->with('exists', 'Please Enter Correct new password'); } } else { $return = Redirect::to('profile=' . $type)->with('exists', 'Please Enter Correct Old password'); } if ($this->add_file) { $return = Redirect::to('profile=' . $type)->with('success', 'You successfully Update Your Profile.'); } else { $return = Redirect::to('profile=' . $type)->with('exists', 'Please Select a file'); } return $return; }
public function post_make_notify($type) { $object = database::get_instance(); $data = ['msg' => Input::get('des')]; $table = Input::get('choose'); $col = ''; $count = 0; Session::put("key", $type); $col = 'mail'; $count = DB::table('register_course_section')->where('course_id', '=', Input::get('courses'))->count('student_id'); $array = array(); for ($i = 0; $i < $count; $i++) { if ($object->view("{$table}", 'where_pluck', 'id', '=', $i + 1, $col)) { $array[$i] = $object->view("{$table}", 'where_pluck', 'id', '=', $i + 1, $col); } } Mail::queueOn('mail', 'emails.mailer', $data, function ($message) use($array) { $file = Input::file('upload'); $destinationPath = "/wamp/www/GradeSystem/public/assets/Notify_files"; $filename = str_random(6) . '_' . $file->getClientOriginalName(); $uploadSuccess = $file->move($destinationPath, $filename); $subject = Input::get('subject'); $description = Input::get('des'); if (Session::get("key") == "assignment") { $val = array("course_id" => Input::get('courses'), "teacher_id" => Input::get('teacher_id'), "grade" => Input::get('grade'), "deadline" => Input::get('deadline'), "assignment" => $filename, "assignment_name" => $subject, "description" => $description); $o = database::get_instance(); $o->add("prof_teacher_assignment", $val); } $message->to($array)->subject($subject); $message->attach("{$destinationPath}/{$filename}"); }); return Redirect::to('make_teacher_notify=' . $type)->with('success', 'You Successfully Notify all Your ' . "{$table}"); }
public function save() { $db = database::get_instance(); if (count($this->changed_entries) > 0) { $tmp = array(); $bool = false; foreach ($this->changed_entries as $name) { if ($name == "table") { continue; } if ($name == "{$this->table}_id") { $bool = true; } $value = $this->entries[$name] === 'NULL' || $this->entries[$name] === null ? "NULL" : "'" . $db->escape($this->entries[$name]) . "'"; $tmp[] = "`{$name}` = {$value}"; } if ($bool == false && isset($this->entries["{$this->table}_id"])) { $tmp[] = "`{$this->table}_id` = '" . $db->escape($this->entries["{$this->table}_id"]) . "'"; } $sql = "INSERT INTO `{$this->table}` SET " . implode(",", $tmp) . " ON DUPLICATE\n\t\t\t\t\t\t\tKEY UPDATE " . implode(",", $tmp) . ";"; debug::add_info("(" . __FILE__ . ")<b>" . __CLASS__ . "</b>::" . __FUNCTION__ . "(): \$sql:<br /><pre>{$sql}</pre>"); $result = $db->query($sql); if (!isset($this->entries["{$this->table}_id"])) { $this->entries["{$this->table}_id"] = $db->insert_id(); } $this->reset(); } return; }
public static function delete_entry_by_id($settings_id) { // debug::add_info("(".__FILE__.")<b>".__CLASS__."</b>::".__FUNCTION__."($settings_id) betreten."); $db = database::get_instance(); $settings_id = $db->escape($settings_id); $sql = "\n\t\t\tDELETE FROM `settings` WHERE `settings_id` = {$settings_id};\n\t\t"; return $db->query($sql); }
public static function get_all_entries_ordered() { // debug::add_info("(".__FILE__.")<b>".__CLASS__."</b>::".__FUNCTION__."() betreten."); $db = database::get_instance(); $sql = "\n\t\t\tSELECT r.*, p.awards, p.avatar, p.avatar_mime FROM `ranking2016` r\n LEFT JOIN `player2016` p USING(playername)\n WHERE TRUE\n ORDER by r.crptotal desc;\n\t\t"; //debug::add_info("sql:<br /><pre>$sql</pre>"); return $db->get_objects($sql, __CLASS__); }
public static function get_points_by_player_month($player, $month) { $db = database::get_instance(); $player = $db->escape($player); $month = $db->escape($month); $sql = "\n SELECT sum(points) as points FROM upload2016\n\t\t\tWHERE \n\t\t\tplayername = '{$player}' AND\n\t\t\tmonth = '{$month}'\n GROUP BY playername ORDER BY points DESC;\n\t\t"; //debug::add_info("sql:<br /><pre>$sql</pre>"); return $db->get_assoc($sql); }
public static function remove_by_filter($table, $filter = array()) { $db = database::get_instance(); $query = "\n\t\t\t\tDELETE\n\t\t\t\tFROM\t{$table}\n\t\t\t\tWHERE\tTRUE\n\t\t\t"; foreach ($filter as $field => $value) { $value = $db->escape($value); $option = $value == 'NULL' || is_null($value) ? "(`{$field}` IS NULL OR `{$field}` = '0')" : "`{$field}` = '{$value}'"; $query .= " AND {$option}"; } return $db->query($query); }
public function __construct() { $this->db = database::get_instance(); $this->table = ''; $this->field = '*'; $this->where = ''; $this->order = ''; $this->page_size = 0; $this->page = 1; $this->page_sum = 1; }
public function User_login($table, $col_1, $col_2, $input_1, $input_2, $type) { $input = Input::all(); Session::put('table', $table); $inputs = array($col_1 => $input[$input_1], $col_2 => $input[$input_2]); if (Auth::attempt($inputs)) { $object = database::get_instance(); $val = array('user_session' => $input[$input_1], 'type' => $type); $object->add('users_login', $val); return Redirect::to('/'); } else { return Redirect::to('/')->with('exists', 'Wrong E-Mail Or Password'); } }
@extends('../includes/sidebar') @section('content') <?php /*get the id from session*/ $id = Session::get('update_department'); /*select tha data that id has it*/ $view_department = database::get_instance(); $user = $view_department->view('department', 'where_first', 'id', '=', $id, ''); ?> <div class="row"> <div class="col-md-12"> <div class="panel panel-primary" data-collapsed="0"> <div class="panel-heading"> <div class="panel-title"> <h2>Update department</h2> </div> </div> <div class="panel-body"> <form role="form" class="form-horizontal form-groups-bordered" method="post" enctype="multipart/form-data" action="update_department=<?php echo $id; ?>
<th class="sorting" role="columnheader" tabindex="0" aria-controls="table-1" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending"> Number of course houres </th> <th class="sorting" role="columnheader" tabindex="0" aria-controls="table-1" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending"> Course Type </th> <th class="sorting" role="columnheader" tabindex="0" aria-controls="table-1" rowspan="1" colspan="1" aria-label="CSS grade: activate to sort column ascending"> Action </th> </tr> </thead> <tbody role="alert" aria-live="polite" aria-relevant="all"> <?php $view_course = database::get_instance(); $courses = $view_course->view('course', ' ', ' ', " ", ' ', ''); foreach ($courses as $dep) { $department = $view_course->view('department', "where_first", 'id', '=', "{$dep->department}", ''); ?> <tr class="gradeA odd"> <td class=" "><?php echo $dep->id; ?> </td> <td class=" "><?php echo $dep->name; ?> </td> <td class=" "><?php
public function download_homework($id) { $object = database::get_instance(); $user = $object->view("student_assignment", "where_first", 'id', '=', "{$id}", ''); $name_of_file = $user->student_assignment; $file = public_path() . "/assets/assignment_upload/{$name_of_file}"; $file_name_extension = $name_of_file; return Response::download($file, "{$file_name_extension}"); }
@extends('../includes/sidebar') @section('content') <?php $view = database::get_instance(); $id = Session::get('update_slider'); $user = $view->view('slider', "where_first", 'id', '=', "{$id}", ''); ?> <div class="row"> <div class="col-md-12"> <div class="panel panel-primary" data-collapsed="0"> <div class="panel-heading"> <div class="panel-title"> <h2>Add Image</h2> </div> </div> <div class="panel-body"> <form role="form" class="form-horizontal form-groups-bordered" method="post" enctype="multipart/form-data" action="update_slider=<?php echo $id; ?> "> <div class="fileinput fileinput-new" data-provides="fileinput"><input type="hidden"> <div class="fileinput-new thumbnail" style="width: 1014px;height: 450px;" data-trigger="fileinput">
<div class="panel panel-primary" data-collapsed="0"> <div class="panel-heading"> <div class="panel-title"> <h2>View Uploaded Assignment</h2> </div> </div> <div class="panel-body"> <div class="row"> <?php /*select all fields*/ $view_fields = database::get_instance(); $users = DB::table('users_login')->orderBy('id', 'desc')->first(); $id = $view_fields->view('professor', "where_pluck", 'Mail', '=', $users->user_session, 'id'); $courses = $view_fields->view('prof_course', 'where_get', 'prof_id', '=', $id, '', ''); ?> <div class="form-group"> <label class="col-sm-2 control-label" style=" margin-top: 9px; ">All Courses</label> <div class="col-sm-9">
@extends('../includes/sidebar') @section('content') <?php $users = DB::table('users_login')->orderBy('id', 'desc')->first(); $mail = $users->user_session; $person_type = $users->type; $id = ''; $object = database::get_instance(); $table = ''; if ($person_type == 'Administrator') { $table = 'admin'; $id = $object->view('admin', "where_pluck", 'mail', '=', $mail, 'id'); } elseif ($person_type == 'Professor') { $table = 'professor'; $id = $object->view('professor', "where_pluck", 'Mail', '=', $mail, 'id'); } elseif ($person_type == 'Teacher') { $table = 'teacher'; $id = $object->view('teacher', "where_pluck", 'Mail', '=', $mail, 'id'); } elseif ($person_type == 'Student') { $table = 'students'; $id = $object->view('students', "where_pluck", 'stu_id', '=', $mail, 'id'); } ?> <?php $success = Session::get('success'); ?> @if($success) <div class="alert alert-success"> <center>{{ $success }}</center> </div>
public function upload_solution($id) { $object = database::get_instance(); $users = DB::table('users_login')->orderBy('id', 'desc')->first(); $stu_id = $users->user_session; $student_id = $object->view('students', "where_pluck", 'stu_id', '=', $stu_id, 'id'); $ass_id = Input::get('assignment_id'); $file = Input::file('upload_assignment'); $destinationPath = "/wamp/www/GradeSystem/public/assets/assignment_upload"; $filename = str_random(6) . '_' . $file->getClientOriginalName(); $uploadSuccess = $file->move($destinationPath, $filename); $val = array('student_id' => $student_id, 'assignment_id' => $ass_id, 'student_assignment' => $filename); $object->add('student_assignment', $val); return Redirect::to("view_student_assignment=" . $id)->with('success', 'You successfully upload assignment.'); }
public function __construct() { $this->object = database::get_instance(); }
<?php $users = DB::table('users_login')->orderBy('id', 'desc')->first(); $mail = $users->user_session; $name = database::get_instance(); $prof = $name->view('professor', 'where_pluck', 'Mail', '=', $mail, 'name'); $content = Input::get('des'); $courses = Input::get('courses'); ?> <div class="row"> <div class="col-md-12"> <div class="panel panel-primary" data-collapsed="0"> <div class="panel-heading"> <div class="panel-title"> <h3> By : Dr.{{$prof}}</h3> <h4>Course : {{$name->view('course','where_pluck','id','=',$courses,'name');}}</h4> <hr> </div> </div> <div class="panel-body"> {{$content}} </div> </div> </div> </div> <h2>
public function post_grade_field_for_each_student($course_id) { $object = database::get_instance(); $total = 0; $views2 = DB::table('course_fields')->where('course_id', '=', $course_id)->orderBy('id', 'desc')->distinct("field_id")->groupBy("field_id")->get(); foreach ($views2 as $cor) { if ($cor->field_id == 1) { $val = array("student_id" => Input::get("stu_id"), "Grade_value_field" => Input::get("final"), "course_field_id" => $cor->id); $total += Input::get("final"); $object->add("grade", $val); } else { if ($cor->field_id == 2) { $val = array("student_id" => Input::get("stu_id"), "Grade_value_field" => Input::get("miedterm"), "course_field_id" => $cor->id); $total += Input::get("miedterm"); $object->add("grade", $val); } else { if ($cor->field_id == 3) { $val = array("student_id" => Input::get("stu_id"), "Grade_value_field" => Input::get("project"), "course_field_id" => $cor->id); $total += Input::get("project"); $object->add("grade", $val); } else { if ($cor->field_id == 4) { $val = array("student_id" => Input::get("stu_id"), "Grade_value_field" => Input::get("other"), "course_field_id" => $cor->id); $total += Input::get("other"); $object->add("grade", $val); } else { if ($cor->field_id == 5) { $val = array("student_id" => Input::get("stu_id"), "Grade_value_field" => Input::get("assignment"), "course_field_id" => $cor->id); $total += Input::get("assignment"); $object->add("grade", $val); } } } } } } $val2 = array("course_id" => $course_id, "student_id" => Input::get("stu_id"), "total_grade" => $total); $object->add("student_total_grade", $val2); return Redirect::to("grade_field_for_each_student={$course_id}")->with('success', "You successfully delete Assignment number (Input::get('stu_id'))"); }
<th class="sorting" role="columnheader" tabindex="0" aria-controls="table-1" rowspan="1" colspan="1" aria-label="Browser: activate to sort column ascending"> Date </th> <th data-hide="phone" class="sorting" role="columnheader" tabindex="0" aria-controls="table-1" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending"> Time </th> <th data-hide="phone" class="sorting" role="columnheader" tabindex="0" aria-controls="table-1" rowspan="1" colspan="1" aria-label="Platform(s): activate to sort column ascending"> Action </th> </tr> </thead> <tbody role="alert" aria-live="polite" aria-relevant="all"> <?php $view_admin = database::get_instance(); $deadline = $view_admin->view('deadline', ' ', ' ', " ", ' ', ''); foreach ($deadline as $deadline1) { ?> <tr class="gradeA odd"> <td class=" "><?php echo $deadline1->id; ?> </td> <td class=" "><?php echo $deadline1->date; ?> </td> <td class=" "><?php echo $deadline1->time; ?>
function quote($what) { $db = database::get_instance(); return $db->quote($what); }
<div class="panel-body"> <table class="table table-hover"> <thead> <tr> <th data-hide="phone,tablet">Field name</th> <th data-hide="phone,tablet">Field value</th> <th><center>Actions</center></th> </tr> </thead> <tbody> <?php $view_obj = database::get_instance(); $views2 = DB::table('course_fields')->where('course_id', '=', $course_id)->orderBy('id', 'desc')->distinct("field_id")->groupBy("field_id")->get(); foreach ($views2 as $view2) { $field_name = $view_obj->view('fields', "where_pluck", "id", "=", $view2->field_id, 'name'); ?> <tr class="gradeU"> <td class="center"><?php echo $field_name; ?> </td> <td><?php echo $view2->value; ?> </td>
public function post_update_deadline($id) { $object = database::get_instance(); $val = array('date' => Input::get('date'), 'time' => Input::get('time')); $object->update('deadline', 'id', $id, $val); return Redirect::to('view_deadline')->with('success', 'You Successfully update deadline'); }