예제 #1
0
파일: Student.php 프로젝트: sheyooo/testify
 public function addAssessmenth($teacher_id)
 {
     $conn = Connection::getInstance("write");
     $school = new School($this->school_id);
     $command = "INSERT INTO assessment (student_id, class_id, teacher_id, term_id, year)\n                    VALUES({$this->id}, {$this->class_id}, {$teacher_id}, {$school->getCurrentTermID()},'{$school->getCurrentSession()}')";
     return $conn->execInsert($command);
 }
예제 #2
0
 public function getStudentsIDof($year, $term_id)
 {
     $conn = Connection::getInstance("read");
     $school = new School($this->school_id);
     if ($year == $school->getCurrentSession()) {
         return $this->getStudentsID();
     } else {
         $command = "SELECT DISTINCT student_id FROM assessment\n\t\t\t\t\t\t\tWHERE year = '{$year}'\n\t\t\t\t\t\t\tAND term_id = {$term_id}\n\t\t\t\t\t\t\tAND class_id = {$this->id}";
         $result = $conn->execObject($command);
         if (mysqli_num_rows($result)) {
             $ids = null;
             while ($row = mysqli_fetch_assoc($result)) {
                 $ids[] = $row['student_id'];
             }
             return $ids;
         } else {
             return false;
         }
     }
 }