Example #1
0
 public function getCourseSyllabusDisciplines($courseId)
 {
     $this->load->model('discipline_model');
     $syllabus = new Syllabus();
     $foundSyllabus = $syllabus->getCourseSyllabus($courseId);
     if (sizeof($foundSyllabus) > 0) {
         $syllabusId = $foundSyllabus['id_syllabus'];
         $disciplines = $this->discipline_model->getCourseSyllabusDisciplines($syllabusId);
     } else {
         $disciplines = FALSE;
     }
     return $disciplines;
 }
 public function set_assoc_array(array $arr, $id_present = false)
 {
     // Initialize Success Variable
     $suc = parent::set_assoc_array($arr, $id_present);
     //echo "<br>Teaches<br>";
     $suc['teaches_id'] = true;
     // Is ID Present
     if ($id_present && isset($arr['teaches_id']) && ctype_digit($arr['teaches_id'])) {
         $this->teaches_id = $arr['teaches_id'];
         $arr = (array) self::fill($this->teaches_id);
         //var_dump($arr);
         $suc = parent::set_assoc_array($arr, $id_present);
         $suc['teaches_id'] = true;
     }
     // Validation
     if (isset($arr['faculty_id']) && ctype_digit($arr['faculty_id'])) {
         $this->faculty_id = $arr['faculty_id'];
         $suc['faculty_id'] = true;
     }
     if (isset($arr['syllabus_id']) && ctype_digit($arr['syllabus_id'])) {
         $this->syllabus_id = $arr['syllabus_id'];
         $suc['syllabus_id'] = true;
     }
     $suc['type'] = true;
     if (isset($arr['type']) && intval($arr['type']) === 1) {
         $this->type = intval($arr['type']);
     }
     return $suc;
 }
 /**
  * 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 the ID of the model to be loaded
  */
 public function loadModel($id)
 {
     $model = Syllabus::model()->findByPk((int) $id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #4
0
 public function secretary_courseSyllabus()
 {
     $semester = new Semester();
     $currentSemester = $semester->getCurrentSemester();
     // Get the current user id
     $logged_user_data = $this->session->userdata("current_user");
     $currentUser = $logged_user_data['user']['id'];
     // Get the courses of the secretary
     $course = new Course();
     $courses = $course->getCoursesOfSecretary($currentUser);
     if ($courses !== FALSE) {
         $syllabus = new Syllabus();
         $coursesSyllabus = array();
         foreach ($courses as $course) {
             $coursesSyllabus[$course['course_name']] = $syllabus->getCourseSyllabus($course['id_course']);
         }
     } else {
         $coursesSyllabus = FALSE;
     }
     $data = array('current_semester' => $currentSemester, 'courses' => $courses, 'syllabus' => $coursesSyllabus);
     loadTemplateSafelyByPermission(PermissionConstants::COURSE_SYLLABUS_PERMISSION, 'usuario/secretary_course_syllabus', $data);
 }
Example #5
0
function displayDisciplinesToSyllabus($syllabusId, $allDisciplines, $courseId)
{
    echo "<h4>Lista de disciplinas:</h4>";
    echo "<div class=\"box-body table-responsive no-padding\">";
    echo "<table class=\"table table-bordered table-hover\">";
    echo "<tbody>";
    echo "<tr>";
    echo "<th class=\"text-center\">Código: </th>";
    echo "<th class=\"text-center\">Sigla</th>";
    echo "<th class=\"text-center\">Disciplina</th>";
    echo "<th class=\"text-center\">Créditos</th>";
    echo "<th class=\"text-center\">Ações</th>";
    echo "</tr>";
    if ($allDisciplines !== FALSE) {
        foreach ($allDisciplines as $discipline) {
            $syllabus = new Syllabus();
            $disciplineAlreadyExistsInSyllabus = $syllabus->disciplineExistsInSyllabus($discipline['discipline_code'], $syllabusId);
            echo "<tr>";
            echo "<td>";
            echo $discipline['discipline_code'];
            echo "</td>";
            echo "<td>";
            echo $discipline['name_abbreviation'];
            echo "</td>";
            echo "<td>";
            echo $discipline['discipline_name'];
            echo "</td>";
            echo "<td>";
            echo $discipline['credits'];
            echo "</td>";
            echo "<td>";
            if ($disciplineAlreadyExistsInSyllabus) {
                echo anchor("syllabus/removeDisciplineFromSyllabus/{$syllabusId}/{$discipline['discipline_code']}/{$courseId}", "Remover disciplina", "class='btn btn-danger'");
            } else {
                echo anchor("syllabus/addDisciplineToSyllabus/{$syllabusId}/{$discipline['discipline_code']}/{$courseId}", "Adicionar disciplina", "class='btn btn-primary'");
            }
            echo "</td>";
            echo "</tr>";
        }
    } else {
        echo "<tr>";
        echo "<td colspan=5>";
        echo "<div class=\"callout callout-warning\">";
        echo "<h4>Não há disciplinas cadastradas no momento.</h4>";
        echo "</div>";
        echo "</td>";
        echo "</tr>";
    }
    echo "</tbody>";
    echo "</table>";
    echo "</div>";
}