Exemple #1
0
 public function addCurriculum(Curriculum $l)
 {
     $this->collCurriculums[] = $l;
     $l->setDepartment($this);
 }
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;
}
$curriculums = Curriculum::get_by_sql("SELECT * FROM " . T_CURRICULUMS . " 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 ($curriculums as $curriculum) {
    $s .= "<row id='" . $curriculum->id . "'>";
    $s .= "<cell></cell>";
    $s .= "<cell>" . $curriculum->id . "</cell>";
    $s .= "<cell>" . $curriculum->curriculum . "</cell>";
    $s .= "</row>";
}
$s .= "</rows>";
echo $s;
$datos = array();
$rs = array();
if (isset($_POST["resumen_perfil_profesional"]) && isset($_POST["resumen_perfil_academico"]) && isset($_POST["resumen_perfil_laboral"]) && isset($_POST["resumen_perfil_cursos"]) && ($_POST["resumen_perfil_profesional"] != "" && $_POST["resumen_perfil_academico"] != "" && $_POST["resumen_perfil_laboral"])) {
    $datos[0] = $_POST["resumen_perfil_profesional"];
    $datos[1] = $_POST["resumen_perfil_academico"];
    $datos[2] = $_POST["resumen_perfil_laboral"];
    $datos[3] = $_POST["resumen_perfil_cursos"];
    $datos[4] = $_POST["id_cur"];
    if ($datos[4] == '') {
        $datos[4] = 0;
    }
} else {
    $mensaje[0] = "campos_blancos";
    die(json_encode($mensaje));
}
$obj_curriculum = new Curriculum();
$rs = $obj_curriculum->cargar_curriculum($datos[4], $datos[0], $datos[1], $datos[2], $datos[3]);
//die(json_encode($rs));
if ($rs == "error") {
    die(json_encode("error_bd"));
} else {
    $mensaje[0] = "registro_exitoso";
    $mensaje[1] = $rs[0][0];
    /////////////////////////////////////////////////--AUDITORIA--///////////////////////////////////////
    $auditoria_cur = new auditoria("Curriculum", "Actualizacion de curriculum");
    $auditoria = $auditoria_cur->registrar_auditoria();
    if ($auditoria == false) {
        $mensaje[0] = 'error_auditoria';
        die(json_encode($mensaje));
    }
    /////////////////////////////////////////////////////////////////////////////////////////////////////
<?php

require_once "../includes/initialize.php";
global $session;
if (!$session->is_logged_in()) {
    redirect_to("index.php");
}
if ($_POST['oper'] == 'add') {
    $curriculum = new Curriculum();
    $curriculum->curriculum = $_POST['curriculum'];
    $curriculum->create();
} else {
    if ($_POST['oper'] == 'edit') {
        $curriculum = Curriculum::get_by_id($_POST['id']);
        $curriculum->curriculum = $_POST['curriculum'];
        $curriculum->update();
    } else {
        if ($_POST['oper'] == 'del') {
            Curriculum::get_by_id($_POST['id'])->delete();
        }
    }
}
<?php

require_once "../includes/initialize.php";
global $session;
if (!$session->is_logged_in()) {
    redirect_to("index.php");
}
$curriculumlist = Curriculum::get_all();
$curriculums = "";
foreach ($curriculumlist as $curriculum) {
    $curriculums .= $curriculum->id . ":" . $curriculum->curriculum . ";";
}
?>
<script type="text/javascript">
  $(function(){
    $("#grid_courses").jqGrid({
        url:'courses_xml.php',
        datatype: 'xml',
        mtype: 'GET',
        colNames:['ACTION','ID','CODE', 'DESCRIPTION','CURRICULUM NAME','CURRICULUM ID'],
        colModel :[ 
          {name:'act',index:'act', width:50,sortable:false},
          {name:'id', index:'id', align:'left', width:20, sortable:true, editable:false, hidden:true}, 
          {name:'code', index:'code', align:'left', width:50, sortable:true, editable:true}, 
          {name:'description', index:'description', width:70, align:'left', sortable:true, editable:true}, 
          {name:'curriculum', index:'curriculum', width:50, align:'left', sortable:true, editable:false},
          {name:'curriculum_id', index:'curriculum_id', width:50, align:'left', sortable:true, editable:true, viewable: true, edittype:'select', hidden:true, editrules: {edithidden:true}}
        ],
        width: 1400,
        height: 270,
        pager: '#nav_courses',
<?php

session_start();
require "../modelos/modelo.curriculum.php";
$mensaje = array();
$datos = array();
$rs = array();
$obj_curriculum = new Curriculum();
$rs = $obj_curriculum->consultar_curriculum();
die(json_encode($rs));
    $start = 0;
}
if (!$sidx) {
    $sidx = 1;
}
$courses = Course::get_by_sql("SELECT * FROM " . T_COURSES . " ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
if (isset($_GET['searchString']) && isset($_GET['searchField'])) {
    $searchString = $_GET['searchString'];
    $searchField = $_GET['searchField'];
    $courses = Course::get_by_sql("SELECT * FROM " . T_COURSES . " WHERE " . $searchField . " LIKE '%" . $searchString . "%' ORDER BY {$sidx} {$sord} LIMIT {$start} , {$limit}");
} else {
    $courses = Course::get_by_sql("SELECT * FROM " . T_COURSES . " 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 ($courses as $course) {
    $s .= "<row id='" . $course->id . "'>";
    $s .= "<cell></cell>";
    $s .= "<cell>" . $course->id . "</cell>";
    $s .= "<cell>" . $course->code . "</cell>";
    $s .= "<cell>" . $course->description . "</cell>";
    $s .= "<cell>" . Curriculum::get_by_id($course->curriculum_id)->curriculum . "</cell>";
    $s .= "<cell>" . $course->curriculum_id . "</cell>";
    $s .= "</row>";
}
$s .= "</rows>";
echo $s;
}
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 ($subjects as $subjectobject) {
    $subject = $subjectobject;
    if ($isteacher) {
        $subject = Subject::get_by_id($subjectobject->subject_id);
    }
    $s .= "<row id='" . $subject->id . "'>";
    $s .= "<cell></cell>";
    $s .= "<cell>" . $subject->id . "</cell>";
    $s .= "<cell>" . $subject->code . "</cell>";
    $s .= "<cell>" . $subject->description . "</cell>";
    $s .= "<cell>" . $subject->units . "</cell>";
    $subject_code = $subject->prereq_subject_id == 0 ? "NONE" : Subject::get_by_id($subject->prereq_subject_id)->code;
    $s .= "<cell>" . $subject_code . "</cell>";
    $s .= "<cell>" . Course::get_by_id($subject->course_id)->code . "</cell>";
    $s .= "<cell>" . $subject->year . "</cell>";
    $s .= "<cell>" . $subject->semester . "</cell>";
    $failed_grades = Grade::get_by_sql("SELECT * FROM " . T_STUDENT_GRADES . " WHERE " . C_GRADE_SUBJECT_ID . "=" . $subject->id . " AND grade < 75");
    $s .= "<cell>" . count($failed_grades) . "</cell>";
    $s .= "<cell>" . Curriculum::get_by_id($subject->curriculum_id)->curriculum . "</cell>";
    $s .= "<cell>" . $subject->curriculum_id . "</cell>";
    $s .= "</row>";
}
$s .= "</rows>";
echo $s;
				<td>CODE</td>
				<td>DESCRIPTION</td>
				<td>UNITS</td>
				<td>PREREQUISITE</td>
				<td>COURSE</td>
				<td>YEAR</td>
				<td>SEMESTER</td>
				<td>CURRICULUM</td>
			</tr>
		</thead>
		<?php 
$subjects = Subject::getByCurriculum($curriculumid);
if (count($subjects) > 0) {
    foreach ($subjects as $subject) {
        $course = Course::get_by_id($subject->course_id);
        $curriculum = Curriculum::get_by_id($subject->curriculum_id);
        if ($subject->prereq_subject_id != "") {
            $prerequisitesubject = Subject::get_by_id($subject->prereq_subject_id);
            if (!$prerequisitesubject) {
                $prerequisitesubject = new Subject();
                $prerequisitesubject->code = "NONE";
            }
        } else {
            $prerequisitesubject = new Subject();
            $prerequisitesubject->code = "NONE";
        }
        if ($subject->semester == 1) {
            $subject->semester = "First";
        } else {
            if ($subject->semester == 2) {
                $subject->semester = "Second";