Exemplo n.º 1
0
 public function __construct($studentId, $identityId, $gradeId, $schoolId)
 {
     $this->studentId = $studentId;
     $this->identity = Identity::findById($identityId);
     $this->school = School::findById($schoolId);
     $this->grade = Grade::findById($gradeId);
 }
Exemplo n.º 2
0
 /**
  * @before _secure, _school
  */
 public function add()
 {
     $this->setSEO(array("title" => "Add Payment | School"));
     $view = $this->getActionView();
     $grades = \Grade::all(array("organization_id = ?" => $this->organization->id), array("id", "title"));
     $view->set("grades", $grades);
 }
Exemplo n.º 3
0
 protected static function _init()
 {
     $session = Registry::get("session");
     if (!self::$_classroom) {
         if (!$session->get('StudentService:$classroom')) {
             $enrollment = \Enrollment::first(array("user_id = ?" => self::$_student->user_id), array("classroom_id"));
             $c = \Classroom::first(array("id = ?" => $enrollment->classroom_id), array("grade_id", "section", "year", "id", "created"));
             $g = \Grade::first(array("id = ?" => $c->grade_id), array("title", "id"));
             $classroom = array("id" => $c->id, "grade" => $g->title, "grade_id" => $g->id, "section" => $c->section, "year" => $c->year, "created" => $c->created);
             $classroom = ArrayMethods::toObject($classroom);
             $session->set('StudentService:$classroom', $classroom);
         }
         self::$_classroom = $session->get('StudentService:$classroom');
     }
     if (!self::$_courses) {
         if (!$session->get('StudentService:$courses')) {
             $courses = \Course::all(array("grade_id = ?" => self::$_classroom->grade_id));
             $subject = array();
             foreach ($courses as $c) {
                 $subject[$c->id] = $c;
             }
             $session->set('StudentService:$courses', $subject);
         }
         self::$_courses = $session->get('StudentService:$courses');
     }
 }
Exemplo n.º 4
0
 public function actionCreate()
 {
     $model = new Grade();
     //	$this->performAjaxValidation($model, 'product-form');
     if (isset($_POST['Grade'])) {
         $model->setAttributes($_POST['Grade']);
         $relatedData = array('assignments' => $_POST['Grade']['assignments'] === '' ? null : $_POST['Grade']['assignments']);
         if ($model->saveWithRelated($relatedData)) {
             //if model was saved
             echo '<textarea>' . json_encode(array('success' => true, 'id' => $model->primaryKey)) . '</textarea>';
             Yii::app()->end();
         } else {
             echo '<textarea>' . json_encode(array('success' => false)) . '</textarea>';
             Yii::app()->end();
         }
     }
 }
Exemplo n.º 5
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $grade = Grade::find($id);
     if (!is_null($grade)) {
         $grade->delete();
         return json_encode(true);
     } else {
         return json_encode(false);
     }
 }
Exemplo n.º 6
0
 public function GradeTest()
 {
     include APPPATH . 'models\\Helper\\Grade.php';
     //Test 1
     $grade_1 = new Grade('A+');
     $expected_result = true;
     $this->unit->run($grade_1->passed('C+'), $expected_result, 'Grade A- passed course grade of C+.');
     //Test 2
     $grade_1 = new Grade('D+');
     $expected_result = false;
     $this->unit->run($grade_1->passed('C+'), $expected_result, 'Grade D- failed course grade of C+.');
     //Test 3
     $grade_1 = new Grade('');
     $expected_result = true;
     $this->unit->run($grade_1->passed('C+'), $expected_result, 'Empty Grade (Pending Grade), conditional pass.');
     //Test 3
     $grade_1 = new Grade('D-');
     $expected_result = true;
     $this->unit->run($grade_1->passed('D-'), $expected_result, 'Grade D- passed course grade of D-.');
     echo $this->unit->report();
 }
Exemplo n.º 7
0
 /**
  * @before _secure, _school
  */
 public function edit($grade_id)
 {
     $this->setSEO(array("title" => "School | Edit Class"));
     $view = $this->getActionView();
     $grade = \Grade::first(array("id = ?" => $grade_id));
     if (!$grade || $grade->organization_id != $this->organization->id) {
         self::redirect("/school");
     }
     if (RequestMethods::post("action") == "editGrade") {
         $grade->title = RequestMethods::post("title");
         $grade->description = RequestMethods::post("description");
         $grade->save();
         $view->set("success", "Grade edited successfully!");
     }
     $view->set("grade", $grade);
 }
Exemplo n.º 8
0
 protected static function _findClasses($teaches)
 {
     $class_ids = array();
     foreach ($teaches as $t) {
         $class_ids[] = $t->classroom_id;
     }
     $class_ids = array_unique($class_ids);
     $classes = array();
     foreach ($class_ids as $key => $value) {
         $k = \Classroom::first(array("id = ?" => $value));
         $g = \Grade::first(array("id = ?" => $k->grade_id));
         $data = array("id" => $k->id, "grade_id" => $g->id, "grade" => $g->title, "section" => $k->section, "year" => $k->year, "educator_id" => $k->educator_id);
         $classes[$k->id] = ArrayMethods::toObject($data);
     }
     return $classes;
 }
Exemplo n.º 9
0
 /**
  * @before _secure, _teacher
  */
 public function manage($course_id = null)
 {
     $this->setSEO(array("title" => "Manage Your assignments | Teacher"));
     $view = $this->getActionView();
     $where = array("user_id = ?" => $this->user->id);
     $fields = array("title", "created", "course_id", "classroom_id", "deadline", "live", "id");
     $course_id = RequestMethods::post("course", $course_id);
     if ($course_id) {
         $assignments = \Assignment::all(array_merge($where, array("course_id = ?" => $course_id)), $fields);
     } else {
         $assignments = \Assignment::all($where, $fields);
     }
     $results = array();
     $grades = Grade::all(array("organization_id = ?" => $this->organization->id), array("id", "title"));
     $storedGrades = array();
     foreach ($grades as $g) {
         $storedGrades[$g->id] = $g->title;
     }
     $courses = TeacherService::$_courses;
     $classrooms = array();
     $message = Registry::get("session")->get('$redirectMessage');
     if ($message) {
         $view->set("message", $message);
         Registry::get("session")->erase('$redirectMessage');
     }
     $notification = Registry::get("MongoDB")->notifications;
     foreach ($assignments as $a) {
         $course = $courses[$a->course_id];
         $grade = $storedGrades[$course->grade_id];
         if (!isset($classrooms[$a->classroom_id])) {
             $classroom = $classrooms[$a->classroom_id] = \Classroom::first(array("id = ?" => $a->classroom_id), array("section"));
         } else {
             $classroom = $classrooms[$a->classroom_id];
         }
         $record = $notification->findOne(array('sender' => 'user', 'sender_id' => (int) $this->user->id, 'type' => 'assignment', 'type_id' => (int) $a->id));
         if (isset($record)) {
             $notify = false;
         } else {
             $notify = true;
         }
         $data = array("id" => $a->id, "course" => $course->title, "title" => $a->title, "class" => $grade, "notified" => !$notify, "live" => $a->live, "section" => $classroom->section, "deadline" => $a->deadline, "created" => $a->created, "course_id" => $a->course_id, "classroom_id" => $a->classroom_id);
         $data = ArrayMethods::toObject($data);
         $results[] = $data;
     }
     $view->set("assignments", $results)->set("courses", $courses)->set("course_id", $course_id);
 }
Exemplo n.º 10
0
 /**
  * @before _secure, _school
  */
 public function index()
 {
     $this->setSEO(array("title" => "Admin | School | Dashboard"));
     $view = $this->getActionView();
     $counts = array();
     $counts["students"] = Scholar::count(array("organization_id = ?" => $this->organization->id));
     $counts["teachers"] = Educator::count(array("organization_id = ?" => $this->organization->id));
     $counts["classes"] = Grade::count(array("organization_id = ?" => $this->organization->id));
     $counts = ArrayMethods::toObject($counts);
     $session = Registry::get("session");
     $message = $session->get("redirectMessage");
     if ($message) {
         $view->set("message", $message);
         $session->erase("redirectMessage");
     }
     $view->set("counts", $counts);
 }
Exemplo n.º 11
0
 /**
  * @before _secure, _school
  */
 public function edit($subject_id, $grade_id)
 {
     $course = \Course::first(array("id = ?" => $subject_id));
     if (!$course || $course->organization_id != $this->organization->id || $course->grade_id != $grade_id) {
         self::redirect("/school");
     }
     $grade = \Grade::first(array("id = ?" => $grade_id), array("id", "title", "organization_id"));
     $this->setSEO(array("title" => "School | Manage Subjects (Courses)"));
     $view = $this->getActionView();
     if (RequestMethods::post("action") == "editSubject") {
         $course->title = RequestMethods::post("title");
         $course->description = RequestMethods::post("description");
         $course->save();
         $view->set("success", "Subject Updated successfully!!");
     }
     $view->set("course", $course);
     $view->set("grade", $grade);
 }
Exemplo n.º 12
0
 /**
  * @before _secure, _school
  */
 public function marks()
 {
     $this->setSEO(array("title" => "View Marks | School"));
     $view = $this->getActionView();
     $session = Registry::get("session");
     $view->set("results", array());
     $grades = Grade::all(array("organization_id = ?" => $this->organization->id));
     if (RequestMethods::post("action") == "findStudents") {
         $exam = RequestMethods::post("exam");
         preg_match("/(.*);(.*)/", $exam, $matches);
         $exam_type = $matches[1];
         $exam_year = $matches[2];
         $grade = RequestMethods::post("grade");
         $classroom_id = RequestMethods::post("classroom_id");
         /*** Stores courses in an array ***/
         $courses = Course::all(array("grade_id = ?" => $grade), array("id", "title"));
         $setCourses = array();
         foreach ($courses as $c) {
             $setCourses["{$c->id}"] = $c->title;
         }
         /*** Store exams in an array ***/
         $exams = Exam::all(array("type = ?" => $exam_type, "grade_id = ?" => $grade));
         foreach ($exams as $e) {
             $setExams["{$e->id}"] = array("course_id" => $e->course_id);
         }
         /*** Find all students in class and store his details in an array ***/
         $users = Enrollment::all(array("classroom_id = ?" => $classroom_id));
         $results = array();
         foreach ($users as $u) {
             $usr = User::first(array("id = ?" => $u->user_id), array("name"));
             $scholar = Scholar::first(array("user_id = ?" => $u->user_id), array("roll_no"));
             $result = ExamResult::all(array("user_id = ?" => $u->user_id));
             /*** We need to find marks of the all the subject ***/
             $marks = array();
             foreach ($result as $r) {
                 if (!array_key_exists($r->exam_id, $setExams)) {
                     continue;
                 }
                 $c_id = $setExams["{$r->exam_id}"]["course_id"];
                 $marks[] = array("subject" => $setCourses["{$c_id}"], "marks" => $r->marks);
             }
             $results[] = array("name" => $usr->name, "user_id" => $u->user_id, "roll_no" => $scholar->roll_no, "results" => $marks);
         }
         $session->set('Exams\\Marks:$exam', array("type" => $exam_type, "year" => $exam_year, "grade_id" => $grade));
         $session->set('Exams\\Marks:$marks', ArrayMethods::toObject($marks));
         $session->set('Exams\\Marks:$results', ArrayMethods::toObject($results));
     }
     $view->set('exam', $session->get('Exams\\Marks:$exam'))->set("marks", $session->get('Exams\\Marks:$marks'))->set("results", $session->get('Exams\\Marks:$results'))->set("grades", $grades);
 }
Exemplo n.º 13
0
echo $form->labelEx($model, 'signed');
?>
                <?php 
echo $form->checkbox($model, 'signed');
?>
		<?php 
echo $form->error($model, 'signed');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'grade_id');
?>
		<?php 
echo $form->dropDownList($model, 'grade_id', Grade::model()->getOptions());
?>
		<?php 
echo $form->error($model, 'grade_id');
?>
	</div>

	<div class="row">
		<?php 
echo $form->labelEx($model, 'bagged');
?>
		<?php 
echo $form->checkbox($model, 'bagged');
?>
		<?php 
echo $form->error($model, 'bagged');
Exemplo n.º 14
0
 public function CollegeAction()
 {
     $list = \Grade::getCollege();
     $index = new \Index();
     $data = $index->getCollege();
     foreach ($data as $val) {
         $grade = \Grade::getGrade($list, $val);
         $result = $index->updCollege($val['col_id'], $grade);
         if ($result != 200) {
             echo $val['col_id'] . "失败!";
             die;
         }
     }
     echo "大学评分更新成功!";
     die;
 }
Exemplo n.º 15
0
 /**
  * @before _secure, _school
  */
 public function addToClass($user_id)
 {
     $usr = \User::first(array("id = ?" => $user_id), array("id"));
     if (!$usr) {
         self::redirect("/school");
     }
     $this->setSEO(array("title" => "Parent Info | Student | School"));
     $view = $this->getActionView();
     $grades = \Grade::all(array("organization_id = ?" => $this->organization->id), array("id", "title"));
     $enrollment = Enrollment::first(array("user_id = ?" => $user_id));
     if ($enrollment) {
         $view->set("success", "Student has already been added! Response will be updated");
     }
     if (RequestMethods::post("action") == "addToClass") {
         $classroom = Markup::checkValue(RequestMethods::post("classroom"));
         if (!$enrollment) {
             $enrollment = new Enrollment(array());
         }
         $enrollment->user_id = $usr->id;
         $enrollment->classroom_id = $classroom;
         $enrollment->organization_id = $this->organization->id;
         if ($enrollment->validate()) {
             $enrollment->save();
             $view->set("success", "Student successfully added to classroom");
         }
     }
     if ($enrollment) {
         $class = Classroom::first(array("id = ?" => $enrollment->classroom_id), array("id", "grade_id", "section"));
         foreach ($grades as $g) {
             if ($g->id == $class->grade_id) {
                 $grade = $g->id;
                 break;
             }
         }
         $view->set("class", $class);
     }
     if (!isset($grade)) {
         $grade = null;
     }
     $view->set("grade", $grade);
     $view->set("enrollment", $enrollment);
     $view->set("grades", $grades);
 }
    $SUBJECT = 0;
    $STUDENT_ID = 1;
    $NAME = 2;
    $GRADE = 3;
    //SUBJECT
    $subject_code = $objPHPExcel->getActiveSheet()->getCellByColumnAndRow(0, 2)->getValue();
    $subject = Subject::get_by_sql("SELECT * FROM tbl_subjects WHERE code = '" . $subject_code . "'")[0];
    if ($subject) {
        $subject_id = Subject::get_by_sql("SELECT * FROM tbl_subjects WHERE code = '" . $subject_code . "'")[0]->id;
        for ($row = 2; $row <= $highestRow; $row++) {
            $student_id = $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($STUDENT_ID, $row)->getValue();
            $grade = $objPHPExcel->getActiveSheet()->getCellByColumnAndRow($GRADE, $row)->getValue();
            $student = Student::get_by_id($student_id);
            if ($student) {
                $grades = Grade::get_by_sql("SELECT * FROM tbl_student_grades WHERE subject_id = '" . $subject_id . "' AND student_id = " . $student_id)[0];
                if ($grades) {
                    $grades->grade = $grade;
                    $grades->update();
                } else {
                    $newgrades = new Grade();
                    $newgrades->grade = $grade;
                    $newgrades->student_id = $student_id;
                    $newgrades->subject_id = $subject_id;
                    $newgrades->create();
                }
            }
        }
    } else {
        echo "*********SUBJECT CODE NOT FOUND*********";
    }
}
Exemplo n.º 17
0
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Grade the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Grade::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Exemplo n.º 18
0
 public function create()
 {
     // Get grades
     $grades = [];
     foreach (Grade::all() as $i) {
         $grades[] = $i->getValues();
     }
     // Get Schools
     $schools = [];
     foreach (School::all() as $i) {
         $schools[] = $i->getValues();
     }
     include_once 'views/student/create.php';
 }
Exemplo n.º 19
0
 /**
  * Checks if the current student has completed the course.
  *
  * @param $course_id
  * @return bool
  * @throws Exception
  */
 public function is_complete($course_id)
 {
     $passing_grade = $this->course->getPassingGrade($course_id);
     $grades = $this->db->query("\n\t\t\tSELECT\n\t\t\t  registered.grade\n\t\t\tFROM registered\n\t\t\t  INNER JOIN sections\n\t\t\t\tON registered.section_id = sections.id\n\t\t\t  INNER JOIN semesters\n\t\t\t\tON sections.semester_id = semesters.id\n\t\t\tWHERE sections.course_id = '{$course_id}' AND semesters.id < '{$this->semester_id}' AND registered.student_id = '{$this->student_id}'")->result();
     foreach ($grades as $grade) {
         if (!$grade->grade) {
             return TRUE;
         }
         $mark = new Grade($grade->grade);
         if ($mark->passed($passing_grade)) {
         }
         return TRUE;
     }
     return FALSE;
 }
Exemplo n.º 20
0
               @if(Session::has('error-message'))          
                     <div class="alert alert-danger alert-dismissable">
                                    {{Session::get('error-message')}}
                     </div>                     
                @endif
               
                <p>
                  {{ Form::open(array('route' => 'assign-subjects-to-class','method'=>'post')) }}
                                                  
                                    <label>Select class:</label>
                                          <select name="class_id" 
                                                {{ (Input:: old('class_id'))? ' value="'.Input::old('class_id').'"' : ''}}>
                                                    <option value="">----Select a Class to assign Subjects ---</option>
                                                     <?php 
//$products = Stock::where('business_id','=',  $business_id);
$classes = Grade::orderBy('name', 'asc')->get();
?>
                   
                                                        @foreach($classes as $class)
                                                         <option value="{{$class->id}}">Senior {{ $class->name}} </option>
                                                         @endforeach
                                                </select>
                                                
                                      @if($errors->has('class_id'))
                                          <span class="label label-danger">{{ $errors->first('class_id') }}
                                              </span>    
                                                @endif
                                                <br>
                                         
                                            <label>Subjects</label>
                                           <?php 
Exemplo n.º 21
0
 /**
  * @before _secure, _teacher
  */
 public function manageAttendance()
 {
     $this->setSEO(array("title" => "Manage Your Courses | Teacher"));
     $view = $this->getActionView();
     $classroom = Classroom::first(array("educator_id = ?" => $this->educator->id), array("id", "section", "grade_id"));
     $grade = Grade::first(array("id = ?" => $classroom->grade_id), array("title"));
     $service = new Shared\Services\Classroom();
     $response = $service->saveAttendance($classroom);
     if (isset($response["success"])) {
         $view->set("message", "Attendance Saved successfully!!");
     } elseif (isset($response["saved"])) {
         $view->set("message", "Attendance Already saved for today");
     }
     $students = $service->enrollments($classroom, array('table' => 'attendance'));
     $view->set("class", $grade->title . " - " . $classroom->section);
     $view->set("students", $students);
 }
if ($count > 0 && $limit > 0) {
    $total_pages = ceil($count / $limit);
} else {
    $total_pages = 0;
}
if ($page > $total_pages) {
    $page = $total_pages;
}
$start = $limit * $page - $limit;
if ($start < 0) {
    $start = 0;
}
if (!$sidx) {
    $sidx = 1;
}
$grades = Grade::get_by_sql("SELECT * FROM " . T_STUDENT_GRADES . $where . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
header("Content-type: text/xml;charset=utf-8");
$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .= "<rows>";
$s .= "<page>" . $page . "</page>";
$s .= "<total>" . $total_pages . "</total>";
$s .= "<records>" . $count . "</records>";
foreach ($grades as $grade) {
    $student = Student::get_by_id($grade->student_id);
    $s .= "<row id='" . $grade->id . "'>";
    $s .= "<cell></cell>";
    $s .= "<cell>" . $grade->id . "</cell>";
    $s .= "<cell>" . $grade->grade . "</cell>";
    $s .= "<cell>" . $grade->subject_id . "</cell>";
    $s .= "<cell>" . $student->id . "</cell>";
    $s .= "<cell>" . $student->get_full_name() . "</cell>";
Exemplo n.º 23
0
<?php

/**
 * Created by PhpStorm.
 * User: ekobudisusilo
 * Date: 04 /07 /15
 * Time: 19.37
 */
ob_start();
include 'class.Grade.php';
$dari_nilai = htmlspecialchars($_POST['dari_nilai']);
$sampai_nilai = htmlspecialchars($_POST['sampai_nilai']);
$grade = htmlspecialchars($_POST['grade']);
$keterangan = htmlspecialchars($_POST['keterangan']);
$isi = new Grade();
switch ($_GET['p']) {
    case "add":
        $isi->AddGrade($dari_nilai, $sampai_nilai, $grade, $keterangan);
        header('location: ../main.php?m=008');
        break;
    case "edit":
        break;
    case "del":
        $id = $_GET['id'];
        $isi->AddDelete($id);
        header('location: ../main.php?m=008');
        break;
        //default: echo "Not Founds";
}
ob_end_flush();
if (!$session->is_logged_in()) {
    redirect_to("index.php");
}
$id = $_POST['id'];
$subject_id = $_POST['subject_id'];
$student_id = $_POST['student_id'];
$grades = $_POST['grade'];
$operator = $_POST['oper'];
if ($operator == 'add') {
    $rows = Grade::get_by_sql("SELECT * FROM " . T_STUDENT_GRADES . " WHERE " . C_GRADE_SUBJECT_ID . "=" . $subject_id . " AND " . C_GRADE_STUDENT_ID . "=" . $student_id);
    if (count($rows) > 0) {
        die("exists");
    }
    $grade = new Grade();
    $grade->grade = $grades;
    $grade->subject_id = $subject_id;
    $grade->student_id = $student_id;
    $grade->create();
} else {
    if ($operator == 'edit') {
        $grade = Grade::get_by_id($id);
        $grade->grade = $grades;
        $grade->subject_id = $subject_id;
        $grade->student_id = $student_id;
        $grade->update();
    } else {
        if ($operator == 'del') {
            Grade::get_by_id($id)->delete();
        }
    }
}
$subject_ids = $_POST['subject_ids'];
$student_grades = Grade::get_by_sql("SELECT * FROM " . T_STUDENT_GRADES . " WHERE " . C_GRADE_STUDENT_ID . "=" . $student_id);
$student_subjects = array();
foreach ($student_grades as $student_subject) {
    array_push($student_subjects, Subject::get_by_id($student_subject->subject_id));
}
$warnings = "";
foreach ($subject_ids as $id) {
    $thestudent = Student::get_by_id($student_id);
    $thestudent->semester = Subject::get_by_id($id)->semester;
    $thestudent->update();
    if (Grade::exists($id, $student_id)) {
        $newgrade = Grade::get_by_subj_stud($id, $student_id);
        $newgrade->delete();
    }
    $newgrade = new Grade();
    $newgrade->subject_id = $id;
    $newgrade->student_id = $student_id;
    $newgrade->grade = 0;
    $newgrade->create();
    $pre_subject = Subject::get_by_id($id);
    if (!EvaluatedSubject::exists($id, $student_id)) {
        $grade = Grade::get_by_subj_stud($pre_subject->id, $student_id);
        $gradepre = Grade::get_by_subj_stud($pre_subject->prereq_subject_id, $student_id);
        if (has_prerequisite($pre_subject->prereq_subject_id, $student_subjects)) {
            if ($gradepre != null) {
                if (Grade::get_by_subj_stud($pre_subject->prereq_subject_id, $student_id)->grade <= 74) {
                    $warnings .= "Cannot add " . $pre_subject->code . " because it's previous subject:" . Subject::get_by_id($pre_subject->prereq_subject_id)->code . " is failed\n\n";
                } else {
                    $eval_subject = new EvaluatedSubject();
                    $eval_subject->student_id = $student_id;
Exemplo n.º 26
0
 public function cadastrar_grade()
 {
     $msg = null;
     if ($_SERVER['REQUEST_METHOD'] == "POST") {
         try {
             // View::validarFormAntInjection('form_cadastrar_grade');
             $grade = new Grade();
             $grade->set_fk_turma($this->input->post('fk_turma'));
             $grade->set_fk_materia_vin($this->input->post('fk_materia_vin'));
             $grade->set_fk_usuario_professor($this->input->post('fk_usuario_professor'));
             $grade->set_dia_semana($this->input->post('dia_semana'));
             $grade->set_hora_inicio($this->input->post('hora_inicio'));
             $grade->set_hora_fim($this->input->post('hora_fim'));
             $grade->salvar();
             $this->setMsg('<p class="alert ok">Dados gravados com sucesso!</p>');
             $this->listar_grade();
             return false;
         } catch (Exception $e) {
             $msg = '<p class="alert erro">' . $e->getMessage() . '</p>';
         }
     }
     $data = $this->getParametroVisao();
     $data['page'] = 'cadastrar_grade';
     $data['msg'] = $msg;
     $this->load->view($this->load->getUrlTema(), $data);
 }
Exemplo n.º 27
0
 /**
  * Declares an association between this object and a Grade object.
  *
  * @param      Grade $v
  * @return     Periodo The current object (for fluent API support)
  * @throws     PropelException
  */
 public function setGrade(Grade $v = null)
 {
     if ($v === null) {
         $this->setGradeId(NULL);
     } else {
         $this->setGradeId($v->getId());
     }
     $this->aGrade = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Grade object, it will not be re-added.
     if ($v !== null) {
         $v->addPeriodo($this);
     }
     return $this;
 }
    {
        $this->firstName = $fname;
        $this->lastName = $lname;
        $this->phone = $phone;
        $this->score = $score;
    }
    function calculate()
    {
        switch (intval($this->score / 15)) {
            case 3:
                return 'B';
            case 4:
                return 'A';
            case 5:
                return 'E';
            case 6:
                return 'O';
            default:
                return intval($this->score / 10) === 4 ? 'B' : 'D';
        }
    }
}
$firstName = fgets(STDIN);
$lastName = fgets(STDIN);
$phone = intval(fgets(STDIN));
$score = intval(fgets(STDIN));
$stu;
settype($stu, "Student");
$stu = new Grade($firstName, $lastName, $phone, $score);
$stu->display();
print "\nGrade: " . $stu->calculate();
<?php

require_once "../includes/initialize.php";
$student_id = $_GET['student_id'];
$subject_ids2 = $_POST['subject_ids2'];
$message = "success";
foreach ($subject_ids2 as $id) {
    $subject_id = EvaluatedSubject::get_by_id($id)->subject_id;
    $newgrade = Grade::get_by_subj_stud($subject_id, $student_id);
    if ($newgrade != null) {
        $newgrade->delete();
    }
    $object = EvaluatedSubject::get_by_id($id);
    if ($object != null) {
        $object->delete();
    }
}
echo $message;
if ($count > 0 && $limit > 0) {
    $total_pages = ceil($count / $limit);
} else {
    $total_pages = 0;
}
if ($page > $total_pages) {
    $page = $total_pages;
}
$start = $limit * $page - $limit;
if ($start < 0) {
    $start = 0;
}
if (!$sidx) {
    $sidx = 1;
}
$grades = Grade::get_by_sql("SELECT * FROM " . T_STUDENT_GRADES . " WHERE " . C_GRADE_STUDENT_ID . " = " . $student_id . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
header("Content-type: text/xml;charset=utf-8");
$s = "<?xml version='1.0' encoding='utf-8'?>";
$s .= "<rows>";
$s .= "<page>" . $page . "</page>";
$s .= "<total>" . $total_pages . "</total>";
$s .= "<records>" . $count . "</records>";
foreach ($grades as $grade) {
    if (Subject::get_by_id($grade->subject_id)->course_id != $student->course_id) {
        continue;
    }
    if (Subject::get_by_id($grade->subject_id)->semester != $student->semester) {
        //continue;
    }
    $s .= "<row id='" . $grade->id . "'>";
    $s .= "<cell>" . $grade->id . "</cell>";