public function configureDay($day)
 {
     $prefix_name = "day_{$day}";
     //bloques
     for ($i = 1; $i <= $this->getBlocksPerCourseSubjectDay(); $i++) {
         //$js_id = "course_subject_day_{$this->getObject()->getDay()}";
         $course_subject_day = CourseSubjectDayPeer::retrieveOrCreateByDayAndBlockAndCourseSubjectId($day, $i, $this->getObject()->getId());
         $block_name = $prefix_name . "_block_" . $i;
         $js_id = "manage_course_subject_days_day_" . $day . "_block_" . $i;
         $name = $block_name . "_enable";
         $this->setWidget($name, new sfWidgetFormInputCheckbox());
         $this->setValidator($name, new sfValidatorBoolean());
         $this->setDefault($name, !$course_subject_day->isNew());
         $this->getWidget($name)->setLabel('Habilitar (bloque ' . $i . ')');
         $this->getWidget($name)->setAttribute("onchange", "course_subject_day_form_on_click_handler('{$js_id}')");
         $start_name = $block_name . "_starts_at";
         $this->setWidget($start_name, new sfWidgetFormTime(array('hours' => SchoolBehaviourFactory::getInstance()->getHoursArrayForSubjectWeekday(), 'minutes' => SchoolBehaviourFactory::getInstance()->getMinutesArrayForSubjectWeekday()), array('disable' => $course_subject_day->isNew())));
         $this->setDefault($start_name, $course_subject_day->getStartsAt());
         $this->getWidgetSchema()->setLabel($start_name, 'Start');
         $this->setValidator($start_name, new sfValidatorTime(array('required' => false)));
         $end_name = $block_name . "_ends_at";
         $this->setWidget($end_name, new sfWidgetFormTime(array('hours' => SchoolBehaviourFactory::getInstance()->getHoursArrayForSubjectWeekday(), 'minutes' => SchoolBehaviourFactory::getInstance()->getMinutesArrayForSubjectWeekday()), array('disable' => $course_subject_day->isNew())));
         $this->getWidgetSchema()->setLabel($end_name, 'End');
         $this->setDefault($end_name, $course_subject_day->getEndsAt());
         $this->setValidator($end_name, new sfValidatorTime(array('required' => false)));
         $name = $block_name . "_classroom_id";
         $this->setWidget($name, new sfWidgetFormPropelChoice(array('model' => 'Classroom', 'add_empty' => true), array('disable' => $course_subject_day->isNew())));
         $this->setValidator($name, new sfValidatorPropelChoice(array('model' => 'Classroom', 'column' => 'id', 'required' => false)));
         $this->getWidget($name)->setLabel('Classroom');
         $this->setDefault($name, $course_subject_day->getClassroomId());
         //post validators
         $this->mergePostValidator(new sfValidatorSchemaCompare($start_name, sfValidatorSchemaCompare::LESS_THAN_EQUAL, $end_name, array(), array("invalid" => "La hora de comienzo debe ser menor a la de fin.")));
     }
 }
Пример #2
0
 public function getCourseTypeString()
 {
     if ($this->getCourseType()) {
         $choices = SchoolBehaviourFactory::getInstance()->getCourseTypeChoices();
         return $choices[$this->getCourseType()];
     }
     return '';
 }
 public function configure()
 {
     parent::configure();
     $course_type_choices = SchoolBehaviourFactory::getInstance()->getCourseTypeChoices();
     $this->setWidget('course_type', new sfWidgetFormChoice(array('choices' => $course_type_choices, 'expanded' => true)));
     $this->setValidator('course_type', new sfValidatorChoice(array('choices' => array_keys($course_type_choices), 'required' => true)));
     $this->setDefault('course_type', SchoolBehaviourFactory::getInstance()->getDefaultCourseType());
     $this->widgetSchema->setHelp('course_type', 'Determina la cantidad de notas de un alumno dentro de la cursada y el método de evaluación.');
     unset($this['max_disciplinary_sanctions'], $this["max_previous"]);
 }
 public function renderCourseSubjectHeader($configurations)
 {
     $row = array('');
     foreach ($configurations as $configuration) {
         for ($i = 1; $i <= $configuration->getCourseMarks(); $i++) {
             $row[] = array('size' => BaseReportRenderer::FONT_SIZE_NORMAL, 'style' => BaseReportRenderer::STYLE_CENTERED, 'content' => SchoolBehaviourFactory::getInstance()->getMarkNameByNumberAndCourseType($i, $configuration->getCourseType()));
         }
         $row[] = 'Prom.';
     }
     $this->renderRow($row);
 }
 public function configure()
 {
     parent::configure();
     $course_type_choices = SchoolBehaviourFactory::getInstance()->getCourseTypeChoices();
     $this->setWidget('course_type', new sfWidgetFormChoice(array('choices' => $course_type_choices, 'expanded' => true)));
     $this->setValidator('course_type', new sfValidatorChoice(array('choices' => array_keys($course_type_choices), 'required' => true)));
     $this->setDefault('course_type', SchoolBehaviourFactory::getInstance()->getDefaultCourseType());
     $this->getWidgetSchema('attendance_type')->setHelp('attendance_type', 'Se define el tipo de asistencia que tendrán las materias. Si se cambia de "por materia" a "por día", se perderán los valores de los cursos existentes.');
     $this->widgetSchema->setHelp('course_type', 'Determina la cantidad de notas de un alumno dentro de la cursada y el método de evaluación.');
     unset($this["course_required"], $this["final_examination_required"], $this['course_examination_count'], $this['evaluation_method']);
 }
Пример #6
0
 /**
  * Don't call parent::doSave($con) we have to use Propelconnection to safely get nextFileNumber
  * @param <type> $con
  */
 protected function doSave($con = null)
 {
     if (is_null($con)) {
         $con = $this->getConnection();
     }
     $this->updateObject();
     $start_year = $this->getValue("start_year");
     SchoolBehaviourFactory::getInstance()->setStudentFileNumberForCareer($this->getObject(), $con);
     $this->object->save($con);
     SchoolBehaviourFactory::getInstance()->createStudentCareerSubjectAlloweds($this->object, $start_year, $con);
     // embedded forms
     $this->saveEmbeddedForms($con);
 }
Пример #7
0
 protected function getForms($course_subjects, $is_pathway)
 {
     $forms = array();
     foreach ($course_subjects as $course_subject) {
         if ($is_pathway) {
             $form_name = SchoolBehaviourFactory::getInstance()->getFormFactory()->getCourseSubjectPathwayMarksForm();
         } else {
             $form_name = SchoolBehaviourFactory::getInstance()->getFormFactory()->getCourseSubjectMarksForm();
         }
         $forms[$course_subject->getId()] = new $form_name($course_subject);
     }
     return $forms;
 }
 /**
  * Adds the reference for the ExaminationRepprovedSubject to StudentExaminationRepprovedSubjects.
  * If student is withdrawn then it does not add the reference.
  *
  * @param ExaminationRepprovedSubject $examination_repproved_subject
  * @param PropelPDO $con
  */
 public function updateStudentExaminationRepprovedSubjects($examination_repproved_subject, PropelPDO $con)
 {
     if ($examination_repproved_subject->isNew()) {
         $student_repproved_course_subjects = SchoolBehaviourFactory::getInstance()->getAvailableStudentsForExaminationRepprovedSubject($examination_repproved_subject);
         foreach ($student_repproved_course_subjects as $student_repproved_course_subject) {
             $student = $student_repproved_course_subject->getCourseSubjectStudent()->getStudent();
             $scsys = StudentCareerSchoolYearPeer::retrieveCareerSchoolYearForStudentAndYear($student, SchoolYearPeer::retrieveCurrent());
             if (!empty($scsys) && $scsys[0]->getStatus() != StudentCareerSchoolYearStatus::WITHDRAWN) {
                 $student_examination_repproved_subject = new StudentExaminationRepprovedSubject();
                 $student_examination_repproved_subject->setStudentRepprovedCourseSubjectId($student_repproved_course_subject->getId());
                 $examination_repproved_subject->addStudentExaminationRepprovedSubject($student_examination_repproved_subject);
             }
         }
     }
 }
Пример #9
0
 public function getForms(ExaminationRepprovedSubject $examination_repproved_subject)
 {
     $forms = array();
     //agrego el orden alfabetico para el listado de alumnos.
     $criteria = new Criteria(ExaminationRepprovedSubjectPeer::DATABASE_NAME);
     $criteria->addJoin(StudentExaminationRepprovedSubjectPeer::STUDENT_REPPROVED_COURSE_SUBJECT_ID, StudentRepprovedCourseSubjectPeer::ID);
     $criteria->addJoin(StudentRepprovedCourseSubjectPeer::COURSE_SUBJECT_STUDENT_ID, CourseSubjectStudentPeer::ID);
     $criteria->addJoin(CourseSubjectStudentPeer::STUDENT_ID, StudentPeer::ID);
     $criteria->addJoin(StudentPeer::PERSON_ID, PersonPeer::ID);
     $criteria->addAscendingOrderByColumn(PersonPeer::LASTNAME);
     foreach ($examination_repproved_subject->getStudentExaminationRepprovedSubjects($criteria) as $student_examination_repproved_subject) {
         $form_name = SchoolBehaviourFactory::getInstance()->getFormFactory()->getStudentExaminationRepprovedSubjectForm();
         $form = new $form_name($student_examination_repproved_subject);
         $form->getWidgetSchema()->setNameFormat("student_examination_repproved_subject_{$student_examination_repproved_subject->getId()}[%s]");
         $forms[$student_examination_repproved_subject->getId()] = $form;
     }
     return $forms;
 }
Пример #10
0
function WeekCalendar($name, $json_events)
{
    _WeekCalendar_common();
    $first_day = SchoolBehaviourFactory::getInstance()->getFirstCourseSubjectWeekday();
    $days_to_show = SchoolBehaviourFactory::getInstance()->getLastCourseSubjectWeekday() - SchoolBehaviourFactory::getInstance()->getFirstCourseSubjectWeekday() + 1;
    $day_names_to_sort = CourseSubjectDay::geti18Names();
    $order = array(7, 1, 2, 3, 4, 5, 6, 7);
    foreach ($order as $index) {
        $day_names[] = $day_names_to_sort[$index];
    }
    $day_names = json_encode($day_names);
    $hours = SchoolBehaviourFactory::getInstance()->getHoursArrayForSubjectWeekday();
    ksort($hours, SORT_NUMERIC);
    $start_hour = array_shift($hours);
    $end_hour = count($hours) > 0 ? array_pop($hours) : $start_hour;
    if (++$end_hour > 24) {
        $end_hour--;
    }
    return '<div id="' . $name . '"></div>' . javascript_tag("\n   jQuery(document).ready(function() {\n    jQuery('#{$name}').weekCalendar({\n        readonly: true,\n        overlapEventsSeparate: true,\n        timeSeparator: ' - ',\n        timeslotsPerHour: 4,\n        buttons: false,\n        firstDayOfWeek: {$first_day},\n        daysToShow: {$days_to_show},\n        height: function(\$calendar){\n          return jQuery(window).height() - jQuery(\"h1\").outerHeight();\n        },\n        longDays: {$day_names} ,\n        headerShowDay: false,\n        highlightToday: false,\n        use24Hour: true,\n        businessHours: {start: {$start_hour}, end: {$end_hour}, limitDisplay: true},\n        data: { events: {$json_events} },\n\n    });\n   });\n ");
}
Пример #11
0
 public function executeIndex(sfWebRequest $request)
 {
     if ($request->getParameter('ids')) {
         $this->forward('attendance_justification', 'justificate');
     }
     $filter_class = SchoolBehaviourFactory::getInstance()->getFormFactory()->getAttendanceJustificationFormFilter();
     $this->form = new $filter_class($this->getFilterCriteria());
     $this->has_subject_attendance = SchoolBehaviourFactory::getInstance()->hasSubjectAttendance();
     if ($request->isMethod('POST')) {
         $params = $request->getParameter('attendance_justification');
         $this->form->bind($params);
         if ($this->form->isValid()) {
             $this->setFilterCriteria($this->form->getValues());
             $criteria = $this->buildCriteria();
             $this->student_attendances = StudentAttendancePeer::doSelect($criteria);
         }
     } else {
         $criteria = $this->buildCriteria();
         $this->student_attendances = StudentAttendancePeer::doSelect($criteria);
     }
 }
 public function configure()
 {
     $student_id = $this->getOption('student_id');
     $this->student = StudentPeer::retrieveByPK($student_id);
     $this->career_school_year_id = $this->getOption('career_school_year_id');
     $this->course_subject_id = $this->getOption('course_subject_id');
     $this->division_id = $this->getOption('division_id');
     $sf_formatter_attendance_week = new sfWidgetFormSchemaFormatterAttendanceWeek($this->getWidgetSchema());
     $this->getWidgetSchema()->addFormFormatter("AttendanceWeek", $sf_formatter_attendance_week);
     $this->getWidgetSchema()->setFormFormatterName('AttendanceWeek');
     $day = $this->getOption('day');
     $this->widgetSchema->setNameFormat('attendance_' . $student_id . '][%s]');
     #student
     $this->setWidget("student_id", new sfWidgetFormInputHidden());
     $this->setValidator("student_id", new sfValidatorPropelChoice(array("model" => "Student", "required" => true)));
     $this->setWidget("student", new mtWidgetFormPlain(array('object' => $this->student)));
     $sf_user = sfContext::getInstance()->getUser();
     if ($sf_user->isPreceptor()) {
         $limit = SchoolBehaviourFactory::getInstance()->getDaysForMultipleAttendanceForm();
     } else {
         $limit = BaseSchoolBehaviour::DAYS_FOR_MULTIPLE_ATTENDANCE_FORM;
     }
     for ($i = 0; $i <= $limit; $i++) {
         $day_i = date('Y-m-d', strtotime($day . '-' . $i . 'day ago'));
         $student_attendance = StudentAttendancePeer::retrieveOrCreateByDateAndStudent($day_i, $this->student, $this->getOption('course_subject_id'));
         if ($student_attendance) {
             $this->setDefault("value_" . $i, $student_attendance->getAbsenceTypeId());
         }
         $this->setWidget("value_" . $i, $this->getAttendanceWidget());
         #$this->getWidget('value_'.$i)->setLabel($day_i);
         $this->setValidator("value_" . $i, $this->getAttendanceValidator());
     }
     #sumarle 7 dias al dia antes de mandarlo a la funcion
     //    $total_absenses = $this->student->getAmountStudentAttendanceUntilDay( strtotime($day . '+ 7 day a go'));
     //    $this->setWidget("total", new mtWidgetFormPartial(array('module'=>'student_attendance','partial'=>'total_absens','form'=>$this,'parameters'=>array('total'=>$total_absenses )) ));
     $this->setDefault("student_id", $student_id);
     $this->disableCSRFProtection();
     $this->setWidget('period', new mtWidgetFormPartial(array('module' => 'student_attendance', 'partial' => 'totalAbsences', 'form' => $this, 'parameters' => array('career_school_year_id' => $this->career_school_year_id, 'course_subject_id' => null, 'student' => $this->student, 'day' => $day))));
     $this->getWidgetSchema()->moveField('period', sfWidgetFormSchema::LAST);
 }
 public function configure()
 {
     unset($this['is_closed']);
     // agrego esto porque hay unas funciones que buscan al periodo por su nombre. Ver si
     // se pueden mejorar dichas funciones. - están en Student.php, lineas 607 y 624 aprox.
     // se hace este if por si viene por el editar, para que carge los periodos padres de su carrera solamente.
     if (!is_null($this->object->getCareerSchoolYear())) {
         $this->setParentWidget($this->object->getCareerSchoolYear()->getId());
     }
     $this->getWidgetSchema()->setHelp('name', 'Ingrese: Primer Trimestre, Segundo Trimestre, Tercer Trimestre, Primer Cuatrimestre, Segundo Cuatrimestre, Primer Bimestre o Segundo Bimestre');
     $this->setWidget('career_school_year_id', new sfWidgetFormInputHidden());
     $this->getWidget('career_school_year_period_id')->setLabel('Parent');
     $this->getWidgetSchema()->setHelp('career_school_year_period_id', 'Periodo padre contenedor, seleccionar solo cuando es un periodo bimestral');
     $this->setWidget('start_at', new csWidgetFormDateInput());
     $this->setValidator('start_at', new mtValidatorDateString());
     $this->setWidget('end_at', new csWidgetFormDateInput());
     $this->setValidator('end_at', new mtValidatorDateString());
     $course_type_choices = SchoolBehaviourFactory::getInstance()->getCourseTypeChoices();
     $this->setWidget('course_type', new sfWidgetFormChoice(array('choices' => $course_type_choices)));
     $this->setValidator('course_type', new sfValidatorChoice(array('choices' => array_keys($course_type_choices), 'required' => true)));
     $this->validatorSchema->setPostValidator(new sfValidatorCallback(array('callback' => array($this, 'checkParent'))));
 }
Пример #14
0
 public function configure()
 {
     //Widgets Configuration
     $c = new Criteria();
     $c->addAscendingOrderByColumn('name');
     $c->add(StatePeer::COUNTRY_ID, Country::ARGENTINA);
     $related_class = $this->getOption('related_class');
     if (empty($related_class)) {
         throw new LogicException(get_class($this) . ": Can't be used without related_class option setted. SEE README of this classs!");
     }
     $this->widgetSchema['state_id'] = new sfWidgetFormPropelChoice(array('model' => 'State', 'add_empty' => true, 'criteria' => $c));
     $c = new Criteria();
     $c->addAscendingOrderByColumn('name');
     $widget_birth_department = new sfWidgetFormPropelChoice(array('model' => 'Department', 'add_empty' => true, 'criteria' => $c));
     $this->widgetSchema['department_id'] = new dcWidgetAjaxDependencePropel(array('related_column' => 'state_id', 'dependant_widget' => $widget_birth_department, 'observe_widget_id' => $related_class . 'address_state_id', 'message_with_no_value' => 'Seleccione primero la provincia'));
     $c = new Criteria();
     $c->addAscendingOrderByColumn('name');
     $widget_birth_city = new sfWidgetFormPropelChoice(array('model' => 'City', 'add_empty' => true, 'criteria' => $c));
     $this->widgetSchema['city_id'] = new dcWidgetAjaxDependencePropel(array('related_column' => 'department_id', 'dependant_widget' => $widget_birth_city, 'observe_widget_id' => $related_class . 'address_department_id', 'message_with_no_value' => 'Seleccione primero el partido'));
     //Configuración de widgets
     $this->setDefault('state_id', SchoolBehaviourFactory::getInstance()->getDefaultStateId());
     $this->getWidgetSchema()->setLabel('state_id', 'State');
     $this->getWidgetSchema()->setLabel('city_id', 'City');
 }
Пример #15
0
 public function getShortFreeLabel()
 {
     return SchoolBehaviourFactory::getInstance()->getShortFreeLabel($this);
 }
 /**
  * Gets the filter form class name
  *
  * @return string The filter form class name associated with this generator
  */
 public function getFilterFormClass()
 {
     return SchoolBehaviourFactory::getInstance()->getFormFactory()->getStudentFormFilter();
 }
Пример #17
0
      <?php 
    $school_year = $division->getSchoolYear();
    ?>
      <?php 
    $course_subject_students = $student->getCourseSubjectStudentsForSchoolYear($school_year);
    ?>

      <?php 
    include_partial('course_subject_quaterly', array('student' => $student, 'course_subject_students' => $course_subject_students, 'periods' => $periods, 'has_attendance_for_subject' => false, 'student_career_school_year' => $student_career_school_year));
    ?>
      <?php 
    $examination_repproveds = $student->getStudentRepprovedCourseSubjectForSchoolYear(SchoolYearPeer::retrieveLastYearSchoolYear($division->getCareerSchoolYear()->getSchoolYear()));
    ?>
      <?php 
    $has_to_show_repproveds = SchoolBehaviourFactory::getInstance()->showReportCardRepproveds() && !empty($examination_repproveds);
    ?>

      <div class="footer" style="width: 100%">
        <?php 
    include_partial('footer', array('student' => $student, 'division' => $division));
    ?>
      </div>
    </div>

    <div class="report-content">
      <?php 
    if ($has_to_show_repproveds) {
        ?>
        <hr class="hr_break">
        <?php 
Пример #18
0
if (sfConfig::get('app_testing')) {
    ?>
        <div style="position:absolute; left: 300px; top: 0px; font-size:14px; ">
          <div style="margin: 4px; width: 200px; background-color: yellow; border: solid 1px red; color: red; padding:4px; text-align: center; "> Versión de prueba </div>
        </div>
      <?php 
}
?>

      <div id="menu-div">
        <div class="content">
          <?php 
if ($sf_user->isAuthenticated()) {
    ?>
            <?php 
    $menu = pmJSCookMenu::createFromYaml(SchoolBehaviourFactory::getInstance()->getMenuYaml());
    ?>
            <?php 
    echo $menu->render();
    ?>
          <?php 
}
?>
          <div class="search-content">
            <form action="<?php 
echo url_for('search');
?>
" method="post">
              <input type="text" name="query" id="query"/>
              <input type="submit" value="<?php 
echo __('Search');
 public function getForm($object = null)
 {
     $class = SchoolBehaviourFactory::getInstance()->getFormFactory()->getCourseForm();
     return new $class($object, $this->getFormOptions());
 }
 public function process()
 {
     $this->student_career_school_years = $this->get_student()->getStudentCareerSchoolYears();
     //Deberia recorrer todos los "scsy" y recuperar por c/año las materias
     $this->init();
     $avg_mark_for_year = array();
     foreach ($this->student_career_school_years as $scsy) {
         //Si no repitio el año lo muestro en el analitico - Ver que pasa cuando se cambia de escuela y repite el ultimo año
         //Siempre tomo el año "Aprobado" y "Cursando"
         if ($scsy->getStatus() == 1) {
             $year_in_career = $scsy->getYear();
             $this->add_year_in_career($year_in_career);
             $career_school_year = $scsy->getCareerSchoolYear();
             $school_year = $career_school_year->getSchoolYear();
             $approved = StudentApprovedCareerSubjectPeer::retrieveByStudentAndSchoolYear($this->get_student(), $school_year);
             $csss = SchoolBehaviourFactory::getInstance()->getCourseSubjectStudentsForAnalytics($this->get_student(), $school_year);
             foreach ($csss as $css) {
                 if (!isset($this->objects[$year_in_career])) {
                     // Inicialización por año
                     $this->set_year_status($year_in_career, self::YEAR_COMPLETE);
                     $avg_mark_for_year[$year_in_career]['sum'] = 0;
                     $avg_mark_for_year[$year_in_career]['count'] = 0;
                 }
                 if ($this->subject_is_averageable($css)) {
                     $avg_mark_for_year[$year_in_career]['sum'] += $css->getMark();
                     $avg_mark_for_year[$year_in_career]['count'] += $css->getMark(false) ? 1 : 0;
                     if (!$css->getMark(false)) {
                         // No tiene nota -> el curso está incompleto
                         $this->set_year_status($year_in_career, self::YEAR_INCOMPLETE);
                         $this->add_missing_subject($css);
                     }
                 }
                 $this->add_subject_to_year($year_in_career, $css);
                 $this->check_last_exam_date($css->getApprovedDate(false));
             }
             // Cálculo del promedio por año
             foreach ($this->objects as $year => $data) {
                 $this->process_year_average($year, $avg_mark_for_year[$year]['sum'], $avg_mark_for_year[$year]['count']);
             }
             $this->process_total_average($avg_mark_for_year);
         } else {
             if ($scsy->getStatus() == 0) {
                 //recupero en año en curso
                 $year_in_career = $scsy->getYear();
                 $this->add_year_in_career($year_in_career);
                 $career_school_year = $scsy->getCareerSchoolYear();
                 $school_year = $career_school_year->getSchoolYear();
                 $csss = SchoolBehaviourFactory::getInstance()->getCourseSubjectStudentsForAnalytics($this->get_student(), $school_year);
                 foreach ($csss as $css) {
                     // No tiene nota -> el curso está incompleto
                     $this->set_year_status($year_in_career, self::YEAR_INCOMPLETE);
                     $this->add_subject_to_year($year_in_career, $css);
                 }
             }
         }
     }
 }
Пример #21
0
 public function configure()
 {
     //Fields remove
     unset($this['user_id']);
     unset($this['address_id']);
     unset($this['is_active']);
     sfContext::getInstance()->getConfiguration()->loadHelpers(array('Asset', 'Tag', 'Url'));
     //identification type
     $this->setWidget('identification_type', new sfWidgetFormSelect(array('choices' => BaseCustomOptionsHolder::getInstance('IdentificationType')->getOptions())));
     $this->setValidator('identification_type', new sfValidatorChoice(array('choices' => BaseCustomOptionsHolder::getInstance('IdentificationType')->getKeys(), 'required' => false)));
     //birthday
     $this->setWidget('birthdate', new csWidgetFormDateInput(array('change_year' => true, 'change_month' => true)));
     $this->getWidget('birthdate')->setOption('year_range', date('Y') - 80 . ':' . date('Y'));
     $this->setValidator('birthdate', new mtValidatorDateString(array('required' => false)));
     //email
     $this->setValidator('email', new sfValidatorEmail(array('required' => false)));
     //identification number
     //$this->setValidator('identification_number', new sfValidatorNumber(array('required'=>false)));
     //Birth country, state and city widgets
     $c = new Criteria();
     $c->addAscendingOrderByColumn('name');
     $this->setWidget('birth_country', new sfWidgetFormPropelchoice(array('model' => 'Country', 'add_empty' => true, 'criteria' => $c)));
     $this->setDefault('birth_country', SchoolBehaviourFactory::getInstance()->getDefaultCountryId());
     $widget_birth_state = new sfWidgetFormPropelChoice(array('model' => 'State', 'add_empty' => true));
     #This string is necesary to assemble the id needed for the html object
     $related_class = $this->getOption('related_class');
     if (empty($related_class)) {
         throw new LogicException(get_class($this) . ": Can't be used without related_class option setted. SEE README of this classs!");
     }
     $embed_str = $this->getOption('embed_as', '');
     $embed_str = empty($embed_str) ? '' : "{$embed_str}-";
     $related_class .= '_' . $embed_str;
     $this->setWidget('birth_state', new dcWidgetAjaxDependencePropel(array('related_column' => 'country_id', 'dependant_widget' => $widget_birth_state, 'observe_widget_id' => $related_class . 'birth_country', 'message_with_no_value' => __('Select a country first'))));
     $this->setDefault('birth_state', SchoolBehaviourFactory::getInstance()->getDefaultStateId());
     $c = new Criteria();
     $c->addAscendingOrderByColumn('name');
     $widget_birth_department = new sfWidgetFormPropelChoice(array('model' => 'Department', 'add_empty' => true, 'criteria' => $c));
     $this->setWidget('birth_department', new dcWidgetAjaxDependencePropel(array('related_column' => 'state_id', 'dependant_widget' => $widget_birth_department, 'observe_widget_id' => $related_class . 'birth_state', 'message_with_no_value' => __('Select a state first'))));
     $c = new Criteria();
     $c->addAscendingOrderByColumn('name');
     $widget_birth_city = new sfWidgetFormPropelChoice(array('model' => 'City', 'add_empty' => true, 'criteria' => $c));
     $this->setWidget('birth_city', new dcWidgetAjaxDependencePropel(array('related_column' => 'department_id', 'dependant_widget' => $widget_birth_city, 'observe_widget_id' => $related_class . 'birth_department', 'message_with_no_value' => __('Select a department first'))));
     $this->setDefault('birth_city', SchoolBehaviourFactory::getInstance()->getDefaultCityId());
     //field sex widget and validator
     $this->setWidget('sex', new sfWidgetFormSelect(array('choices' => BaseCustomOptionsHolder::getInstance('SexType')->getOptions())));
     $this->setValidator('sex', new sfValidatorChoice(array('choices' => BaseCustomOptionsHolder::getInstance('SexType')->getKeys())));
     //widgets and validators for username and password
     if ($this->getObject()->getsfGuardUser()) {
         $this->setWidget('username', new sfWidgetFormReadOnly(array('plain' => false, 'value_callback' => array($this->getObject()->getsfGuardUser(), 'getUsername'))));
         $this->setValidator('username', new sfValidatorPass());
     } else {
         $this->setWidget('username', new sfWidgetFormInput());
         $this->setValidator('username', new sfValidatorString(array('min_length' => 4, 'max_length' => 128, 'required' => false), array('min_length' => __('Username must be at least 4 characters long'), 'max_length' => __('Username must be at most 128 characters long'))));
         $this->getWidgetSchema()->setHelp('username', __('if blank no username will be assigned'));
     }
     $this->setWidget('password', new sfWidgetFormInputPassword());
     $this->setWidget('password_again', new sfWidgetFormInputPassword());
     $this->setValidator('password', new sfGuardSecurePasswordValidator(array('required' => false)));
     $this->setValidator('password_again', new sfGuardSecurePasswordValidator(array('required' => false)));
     $this->setWidget('photo', new sfWidgetFormInputFile());
     $this->setValidator('photo', new sfValidatorFile(array('path' => Person::getPhotoDirectory(), 'max_size' => '2097152', 'mime_types' => 'web_images', 'required' => false, 'validated_file_class' => 'sfCustomValidatedFile')));
     if ($this->getObject()->getPhoto()) {
         $this->setWidget('current_photo', new mtWidgetFormPartial(array('module' => 'personal', 'partial' => 'downloable_photo', 'form' => $this)));
         $this->setValidator('current_photo', new sfValidatorPass(array('required' => false)));
         $this->setWidget('delete_photo', new sfWidgetFormInputCheckbox());
         $this->setValidator('delete_photo', new sfValidatorBoolean(array('required' => false)));
     }
     $this->getWidgetSchema()->setHelp('photo', 'The file must be of the following types: jpeg, jpg, gif, png.');
     $this->getValidatorSchema()->setPostValidator(new sfValidatorAnd(array(new sfValidatorPropelUnique(array('model' => 'sfGuardUser', 'field' => array($embed_str . 'username'), 'column' => array('username')), array('invalid' => __('There is another user with the same username'))), new sfValidatorCallback(array('callback' => array($this, 'checkUsername'), 'arguments' => array('username' => $embed_str . 'username', 'password' => $embed_str . 'password')), array('invalid' => 'If username is set, then password must be setted')), new sfValidatorSchemaCompare($embed_str . 'password', sfValidatorSchemaCompare::EQUAL, $embed_str . 'password_again', array(), array('invalid' => __('Password missmatch'))), new sfValidatorPropelUnique(array('model' => 'Person', 'primary_key' => 'person-id', 'field' => array($embed_str . 'identification_type', $embed_str . 'identification_number'), 'column' => array('identification_type', 'identification_number')), array('invalid' => __('There is another user with the same identification number'))))));
     //ADDRESS FORM
     $address = $this->getObject()->getAddress();
     if (is_null($address)) {
         $address = new Address();
         $this->getObject()->setAddress($address);
     }
     $addressForm = new AddressForm($address, array('related_class' => $related_class));
     $this->embedForm('address', $addressForm);
 }
Пример #22
0
 * This file is part of Kimkëlen.
 *
 * Kimkëlen is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License v2.0 as published by
 * the Free Software Foundation.
 *
 * Kimkëlen is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with Kimkëlen.  If not, see <http://www.gnu.org/licenses/gpl-2.0.html>.
 */
$examination_repproveds = $student->getStudentRepprovedCourseSubjectForSchoolYear(SchoolYearPeer::retrieveLastYearSchoolYear($division->getCareerSchoolYear()->getSchoolYear()));
$has_to_show_repproveds = SchoolBehaviourFactory::getInstance()->showReportCardRepproveds() && !empty($examination_repproveds) && $student->checkIfRepprovedAreNotApproved($examination_repproveds);
?>
<div class="colsleft">
  <?php 
if ($division->hasCourseType(CourseType::TRIMESTER)) {
    ?>
    <?php 
    $periods = CareerSchoolYearPeriodPeer::getTrimesterPeriodsSchoolYear($division->getCareerSchoolYearId());
    ?>
    <?php 
    if ($division->hasAttendanceForDay()) {
        ?>
      <?php 
        include_partial('trimester_attendance_for_day', array('student' => $student, 'periods' => $periods, 'division' => $division, 'has_to_show_repproveds' => $has_to_show_repproveds));
        ?>
    <?php 
 public static function setAvailableStudentsForDivision(Division $division)
 {
     self::$_students = array_merge($division->getStudents(), SchoolBehaviourFactory::getInstance()->getAvailableStudentsForDivision($division, $filter_by_orientation = true));
 }
Пример #24
0
 * You should have received a copy of the GNU General Public License
 * along with Kimkëlen.  If not, see <http://www.gnu.org/licenses/gpl-2.0.html>.
 */
?>
<div class="report-header">
  <div>
    <div class="logo"><?php 
echo image_tag("kimkelen_logo.png", array('absolute' => true));
?>
</div>
    <div class="logo_fvet"><?php 
echo image_tag("escudo_pelle.jpg", array('absolute' => true));
?>
</div>
    <div class="school-name"><?php 
echo SchoolBehaviourFactory::getInstance()->getSchoolName();
?>
</div>
    <div class="school-name"><?php 
echo __('Universidad de Buenos Aires');
?>
</div>
  </div>

  <div class="header_row">
    <div class="title"><?php 
echo __('Alumno/a');
?>
: </div>
    <div class="name"><?php 
echo $student;
 /**
  * Event listener function that should be registered to
  * 'admin.build_criteria' event in order to add some
  * personalized criteria restrictions.
  *
  * @param sfEvent $event
  * @param Criteria $criteria
  */
 static function applyRestrictions(sfEvent $event, $criteria)
 {
     $user = sfContext::getInstance()->getUser();
     if ($event->getSubject() instanceof schoolyearActions) {
         // Restrictions for schoolyear module
         // $criteria->add(...);
     } elseif ($event->getSubject() instanceof career_subjectActions) {
         // Restrictions for careersubject module
         if ($user->getReferenceFor('career')) {
             $criteria->add(CareerSubjectPeer::CAREER_ID, $user->getReferenceFor('career'));
             CareerSubjectPeer::OrderByYearAndName($criteria);
         }
     } elseif ($event->getSubject() instanceof career_subject_optionActions) {
         // Restrictions for careersubject module
         if ($user->getReferenceFor('career')) {
             $criteria->add(CareerSubjectPeer::IS_OPTION, true);
             $criteria->add(CareerSubjectPeer::CAREER_ID, $user->getReferenceFor('career'));
         }
     } elseif ($event->getSubject() instanceof career_school_yearActions) {
         if ($school_year_id = $user->getReferenceFor('schoolyear')) {
             $criteria->add(CareerSchoolYearPeer::SCHOOL_YEAR_ID, $school_year_id);
         }
     } elseif ($event->getSubject() instanceof career_subject_school_yearActions) {
         if ($career_school_year_id = $user->getReferenceFor('career_school_year')) {
             $criteria->add(CareerSubjectSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $career_school_year_id);
             $criteria->add(CareerSubjectPeer::IS_OPTION, false);
             $criteria->addJoin(CareerSubjectPeer::ID, CareerSubjectSchoolYearPeer::CAREER_SUBJECT_ID);
             CareerSubjectSchoolYearPeer::sorted($criteria);
         }
     } elseif ($event->getSubject() instanceof optional_school_yearActions) {
         if ($career_school_year_id = $user->getReferenceFor('career_school_year')) {
             $criteria->add(CareerSubjectSchoolYearPeer::CAREER_SCHOOL_YEAR_ID, $career_school_year_id);
             $criteria->add(CareerSubjectPeer::HAS_OPTIONS, true);
             $criteria->addJoin(CareerSubjectPeer::ID, CareerSubjectSchoolYearPeer::CAREER_SUBJECT_ID);
         }
     } elseif ($event->getSubject() instanceof division_courseActions) {
         if ($division_id = $user->getReferenceFor('division')) {
             $criterion = $criteria->getNewCriterion(CoursePeer::DIVISION_ID, $division_id);
             $criterion->addOr($criteria->getNewCriterion(CoursePeer::RELATED_DIVISION_ID, $division_id));
             $criteria->add($criterion);
         }
         if ($user->isPreceptor()) {
             self::addCoursePreceptorCriteria($criteria, $user);
         }
         if ($user->isTeacher()) {
             self::addCourseTeacherCriteria($criteria, $user);
         }
         $criteria->setDistinct();
     } elseif ($event->getSubject() instanceof divisionActions) {
         DivisionPeer::sorted($criteria);
         if ($user->isPreceptor()) {
             self::addDivisionPreceptorCriteria($criteria, $user);
         } elseif ($user->isTeacher()) {
             self::addDivisionTeacherCriteria($criteria, $user);
         } elseif ($user->isHeadPreceptor()) {
             self::addDivisionHeadPersonalCriteria($criteria, $user);
         }
     } else {
         if ($event->getSubject() instanceof shared_studentActions) {
             $reference_array = sfContext::getInstance()->getUser()->getReferenceFor("shared_student");
             $peer = $reference_array["peer"];
             $fk = $reference_array["fk"];
             if (isset($reference_array["object_id"])) {
                 $object_id = $reference_array["object_id"];
             } else {
                 $object_ids = $reference_array["object_ids"];
             }
             $criteria->addJoin(constant("{$peer}::STUDENT_ID"), StudentPeer::ID);
             $criteria->addGroupByColumn(StudentPeer::ID);
             if (isset($object_id)) {
                 $criteria->add(constant("{$peer}::{$fk}"), $object_id);
             } else {
                 $criteria->add(constant("{$peer}::{$fk}"), $object_ids, Criteria::IN);
             }
             $criteria->addJoin(StudentPeer::PERSON_ID, PersonPeer::ID);
             $criteria->add(PersonPeer::IS_ACTIVE, true);
         } else {
             if ($event->getSubject() instanceof examinationActions || $event->getSubject() instanceof manual_examinationActions) {
                 $school_year_id = sfContext::getInstance()->getUser()->getReferenceFor("schoolyear");
                 $criteria->add(ExaminationPeer::SCHOOL_YEAR_ID, $school_year_id);
                 if ($user->isTeacher()) {
                     $criteria->addJoin(ExaminationPeer::ID, ExaminationSubjectPeer::EXAMINATION_ID);
                     $criteria->addJoin(ExaminationSubjectPeer::ID, ExaminationSubjectTeacherPeer::EXAMINATION_SUBJECT_ID);
                     $criteria->addJoin(ExaminationSubjectTeacherPeer::TEACHER_ID, TeacherPeer::ID);
                     $criteria->addJoin(TeacherPeer::PERSON_ID, PersonPeer::ID);
                     $criteria->add(PersonPeer::IS_ACTIVE, true);
                     $criteria->add(PersonPeer::USER_ID, $user->getGuardUser()->getId());
                 }
             } else {
                 if ($event->getSubject() instanceof examination_subjectActions) {
                     $examination_id = sfContext::getInstance()->getUser()->getReferenceFor("examination");
                     $criteria->add(ExaminationSubjectPeer::EXAMINATION_ID, $examination_id);
                     $criteria->addJoin(CareerSubjectSchoolYearPeer::ID, ExaminationSubjectPeer::CAREER_SUBJECT_SCHOOL_YEAR_ID);
                     $criteria->addJoin(CareerSubjectPeer::ID, CareerSubjectSchoolYearPeer::CAREER_SUBJECT_ID);
                     $criteria->addAscendingOrderByColumn(CareerSubjectPeer::YEAR);
                     if ($user->isTeacher()) {
                         $criteria->addJoin(ExaminationSubjectPeer::ID, ExaminationSubjectTeacherPeer::EXAMINATION_SUBJECT_ID);
                         $criteria->addJoin(ExaminationSubjectTeacherPeer::TEACHER_ID, TeacherPeer::ID);
                         $criteria->addJoin(TeacherPeer::PERSON_ID, PersonPeer::ID);
                         $criteria->add(PersonPeer::IS_ACTIVE, true);
                         $criteria->add(PersonPeer::USER_ID, $user->getGuardUser()->getId());
                     }
                 } else {
                     if ($event->getSubject() instanceof manual_examination_subjectActions) {
                         $examination_id = sfContext::getInstance()->getUser()->getReferenceFor("manual_examination");
                         $criteria->add(ExaminationSubjectPeer::EXAMINATION_ID, $examination_id);
                         if ($user->isTeacher()) {
                             $criteria->addJoin(ExaminationSubjectPeer::ID, ExaminationSubjectTeacherPeer::EXAMINATION_SUBJECT_ID);
                             $criteria->addJoin(ExaminationSubjectTeacherPeer::TEACHER_ID, TeacherPeer::ID);
                             $criteria->addJoin(TeacherPeer::PERSON_ID, PersonPeer::ID);
                             $criteria->add(PersonPeer::IS_ACTIVE, true);
                             $criteria->add(PersonPeer::USER_ID, $user->getGuardUser()->getId());
                         }
                     } elseif ($event->getSubject() instanceof examination_repprovedActions) {
                         $school_year_id = sfContext::getInstance()->getUser()->getReferenceFor("schoolyear");
                         $criteria->add(ExaminationRepprovedPeer::SCHOOL_YEAR_ID, $school_year_id);
                         if ($user->isTeacher()) {
                             $criteria->addJoin(ExaminationRepprovedPeer::ID, ExaminationRepprovedSubjectPeer::EXAMINATION_REPPROVED_ID);
                             $criteria->addJoin(ExaminationRepprovedSubjectPeer::ID, ExaminationRepprovedSubjectTeacherPeer::EXAMINATION_REPPROVED_SUBJECT_ID);
                             $criteria->addJoin(ExaminationRepprovedSubjectTeacherPeer::TEACHER_ID, TeacherPeer::ID);
                             $criteria->addJoin(TeacherPeer::PERSON_ID, PersonPeer::ID);
                             $criteria->add(PersonPeer::IS_ACTIVE, true);
                             $criteria->add(PersonPeer::USER_ID, $user->getGuardUser()->getId());
                         }
                     } elseif ($event->getSubject() instanceof examination_repproved_subjectActions) {
                         $examination_repproved_id = sfContext::getInstance()->getUser()->getReferenceFor("examination_repproved");
                         $criteria->add(ExaminationRepprovedSubjectPeer::EXAMINATION_REPPROVED_ID, $examination_repproved_id);
                         ExaminationRepprovedSubjectPeer::sortedBySubject($criteria);
                         if ($user->isTeacher()) {
                             $criteria->addJoin(ExaminationRepprovedSubjectPeer::ID, ExaminationRepprovedSubjectTeacherPeer::EXAMINATION_REPPROVED_SUBJECT_ID);
                             $criteria->addJoin(ExaminationRepprovedSubjectTeacherPeer::TEACHER_ID, TeacherPeer::ID);
                             $criteria->addJoin(TeacherPeer::PERSON_ID, PersonPeer::ID);
                             $criteria->add(PersonPeer::IS_ACTIVE, true);
                             $criteria->add(PersonPeer::USER_ID, $user->getGuardUser()->getId());
                         }
                     } else {
                         if ($event->getSubject() instanceof courseActions) {
                             $school_year = SchoolYearPeer::retrieveCurrent();
                             $criteria->add(CoursePeer::DIVISION_ID, null, Criteria::ISNULL);
                             $criteria->add(CoursePeer::SCHOOL_YEAR_ID, $school_year->getId());
                             if ($user->isPreceptor()) {
                                 PersonalPeer::joinWithCourse($criteria, $user->getGuardUser()->getId());
                             }
                             if ($user->isTeacher()) {
                                 $criteria->addJoin(CoursePeer::ID, CourseSubjectPeer::COURSE_ID);
                                 $criteria->addJoin(CourseSubjectPeer::ID, CourseSubjectTeacherPeer::COURSE_SUBJECT_ID);
                                 $criteria->addJoin(CourseSubjectTeacherPeer::TEACHER_ID, TeacherPeer::ID);
                                 $criteria->addJoin(TeacherPeer::PERSON_ID, PersonPeer::ID);
                                 $criteria->add(PersonPeer::IS_ACTIVE, true);
                                 $criteria->add(PersonPeer::USER_ID, $user->getGuardUser()->getId());
                                 $criteria->setDistinct();
                             }
                         } else {
                             if ($event->getSubject() instanceof commissionActions) {
                                 /*
                                 $school_year = SchoolYearPeer::retrieveCurrent();
                                 $criteria->add(CoursePeer::SCHOOL_YEAR_ID, $school_year->getId());
                                 */
                                 CoursePeer::sorted($criteria);
                                 $criteria->add(CoursePeer::DIVISION_ID, null, Criteria::ISNULL);
                                 $criteria->add(CoursePeer::IS_PATHWAY, false);
                                 if ($user->isPreceptor()) {
                                     PersonalPeer::joinWithCourse($criteria, $user->getGuardUser()->getId());
                                 } elseif ($user->isTeacher()) {
                                     TeacherPeer::joinWithCourses($criteria, $user->getGuardUser()->getId(), true);
                                 }
                                 if ($user->isHeadPreceptor()) {
                                     self::addCommissionHeadPreceptorCriteria($criteria, $user);
                                 }
                             } else {
                                 if ($event->getSubject() instanceof final_examinationActions) {
                                     $school_year_id = sfContext::getInstance()->getUser()->getReferenceFor("schoolyear");
                                     $criteria->add(FinalExaminationPeer::SCHOOL_YEAR_ID, $school_year_id);
                                 } else {
                                     if ($event->getSubject() instanceof final_examination_subjectActions) {
                                         $final_examination_id = sfContext::getInstance()->getUser()->getReferenceFor("final_examination");
                                         $criteria->add(FinalExaminationSubjectPeer::FINAL_EXAMINATION_ID, $final_examination_id);
                                         if ($user->isTeacher()) {
                                             $criteria->addJoin(FinalExaminationSubjectTeacherPeer::TEACHER_ID, TeacherPeer::ID);
                                             $criteria->addJoin(TeacherPeer::PERSON_ID, PersonPeer::ID);
                                             $criteria->add(PersonPeer::IS_ACTIVE, true);
                                             $criteria->add(PersonPeer::USER_ID, $user->getGuardUser()->getId());
                                         }
                                     } else {
                                         if ($event->getSubject() instanceof equivalenceActions) {
                                             $student_id = sfContext::getInstance()->getUser()->getReferenceFor("student");
                                             $criteria->add(StudentCareerSchoolYearPeer::STUDENT_ID, $student_id);
                                         } else {
                                             if ($event->getSubject() instanceof sub_orientationActions) {
                                                 $orientation_id = sfContext::getInstance()->getUser()->getReferenceFor("orientation");
                                                 $criteria->add(SubOrientationPeer::ORIENTATION_ID, $orientation_id);
                                             } else {
                                                 if ($event->getSubject() instanceof student_reincorporationActions) {
                                                     $student_id = sfContext::getInstance()->getUser()->getReferenceFor("student");
                                                     if (is_null($student_id)) {
                                                         $student_id = $user->getAttribute('student_id');
                                                     }
                                                     $criteria->add(StudentReincorporationPeer::STUDENT_ID, $student_id);
                                                     $criteria->addJoin(StudentReincorporationPeer::CAREER_SCHOOL_YEAR_PERIOD_ID, CareerSchoolYearPeriodPeer::ID);
                                                     $criteria->addJoin(CareerSchoolYearPeriodPeer::CAREER_SCHOOL_YEAR_ID, CareerSchoolYearPeer::ID);
                                                     $criteria->add(CareerSchoolYearPeer::SCHOOL_YEAR_ID, SchoolYearPeer::retrieveCurrent()->getId());
                                                 } elseif ($event->getSubject() instanceof shared_course_subjectActions) {
                                                     $teacher_id = sfContext::getInstance()->getUser()->getReferenceFor("teacher");
                                                     $criteria->addJoin(CourseSubjectPeer::ID, CourseSubjectTeacherPeer::COURSE_SUBJECT_ID);
                                                     $criteria->addJoin(CourseSubjectTeacherPeer::TEACHER_ID, $teacher_id);
                                                     $criteria->setDistinct();
                                                 } elseif ($event->getSubject() instanceof personalActions) {
                                                     $criteria->add(PersonalPeer::PERSONAL_TYPE, PersonalType::PRECEPTOR);
                                                 } elseif ($event->getSubject() instanceof head_personalActions) {
                                                     $criteria->add(PersonalPeer::PERSONAL_TYPE, PersonalType::HEAD_PRECEPTOR);
                                                 } elseif ($event->getSubject() instanceof student_officeActions) {
                                                     $criteria->add(PersonalPeer::PERSONAL_TYPE, PersonalType::STUDENTS_OFFICE);
                                                 } elseif ($event->getSubject() instanceof studentActions) {
                                                     if ($user->isPreceptor()) {
                                                         SchoolBehaviourFactory::getInstance()->joinPreceptorWithStudents($criteria, $user->getGuardUser()->getId());
                                                     } elseif ($user->isTeacher()) {
                                                         TeacherPeer::joinWithStudents($criteria, $user->getGuardUser()->getId());
                                                     }
                                                     if ($user->isHeadPreceptor()) {
                                                         $criteria->addJoin(DivisionStudentPeer::STUDENT_ID, StudentPeer::ID);
                                                         $criteria->addJoin(DivisionStudentPeer::DIVISION_ID, DivisionPeer::ID);
                                                         self::addDivisionHeadPersonalCriteria($criteria, $user);
                                                     }
                                                 } elseif ($event->getSubject() instanceof licenseActions) {
                                                     if (!is_null(sfContext::getInstance()->getUser()->getReferenceFor("teacher"))) {
                                                         $person_id = TeacherPeer::retrieveByPK(sfContext::getInstance()->getUser()->getReferenceFor("teacher"))->getPersonId();
                                                     } else {
                                                         $person_id = PersonalPeer::retrieveByPK(sfContext::getInstance()->getUser()->getReferenceFor("personal"))->getPersonId();
                                                     }
                                                     $criteria->add(LicensePeer::PERSON_ID, $person_id);
                                                 } elseif ($event->getSubject() instanceof teacherActions) {
                                                     $criteria->setDistinct();
                                                 } else {
                                                     if ($event->getSubject() instanceof career_school_year_periodActions) {
                                                         $career_school_year_id = sfContext::getInstance()->getUser()->getReferenceFor("career_school_year");
                                                         $criteria->add(CareerSchoolYearPeriodPeer::CAREER_SCHOOL_YEAR_ID, $career_school_year_id);
                                                     } else {
                                                         if ($event->getSubject() instanceof student_freeActions) {
                                                             $student_id = sfContext::getInstance()->getUser()->getReferenceFor("student");
                                                             if (is_null($student_id)) {
                                                                 $student_id = $user->getAttribute('student_id');
                                                             }
                                                             $criteria->add(StudentFreePeer::STUDENT_ID, $student_id);
                                                         } else {
                                                             if ($event->getSubject() instanceof course_subject_student_examinationActions) {
                                                                 $examination_subject_id = sfContext::getInstance()->getUser()->getReferenceFor("examination_subject");
                                                                 $criteria->add(CourseSubjectStudentExaminationPeer::EXAMINATION_SUBJECT_ID, $examination_subject_id);
                                                             } else {
                                                                 if ($event->getSubject() instanceof student_examination_repproved_subjectActions) {
                                                                     $examination_repproved_subject_id = sfContext::getInstance()->getUser()->getReferenceFor("examination_repproved_subject");
                                                                     $criteria->add(StudentExaminationRepprovedSubjectPeer::EXAMINATION_REPPROVED_SUBJECT_ID, $examination_repproved_subject_id);
                                                                 } else {
                                                                     if ($event->getSubject() instanceof pathway_commissionActions) {
                                                                         $criteria->add(CoursePeer::IS_PATHWAY, true);
                                                                     }
                                                                 }
                                                             }
                                                         }
                                                     }
                                                 }
                                             }
                                         }
                                     }
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     return $criteria;
 }
 public static function setAvailableStudents(ExaminationRepprovedSubject $examination_repproved_subject)
 {
     self::$_students_repproved_course_subject = array_merge($examination_repproved_subject->getStudents(), SchoolBehaviourFactory::getInstance()->getAvailableStudentsForExaminationRepprovedSubject($examination_repproved_subject));
 }
Пример #27
0
        <?php 
    echo __(CourseType::getInstance('CourseType')->getStringFor($course_type));
    ?>
      </th>
    <tr>

    <tr>
      <th id="subject"><?php 
    echo __("Subject");
    ?>
</th>
      <?php 
    for ($i = 1; $i <= $marks; $i++) {
        ?>
        <th><?php 
        echo __(SchoolBehaviourFactory::getInstance()->getMarkTitle($i, $course_type), array('%number%' => $i));
        ?>
</th>
      <?php 
    }
    ?>
      <th><?php 
    echo __("Course Average");
    ?>
</th>
      <th><?php 
    echo __("Course Status");
    ?>
</th>

      <?php 
 public function getAvailableStudentsForDivision()
 {
     return array_merge($this->getObject()->getStudents(), SchoolBehaviourFactory::getInstance()->getAvailableStudentsForManualExaminationSubject($this->getObject()));
 }
Пример #29
0
 public function executeUpdateConfiguration(sfWebRequest $request)
 {
     $this->career_school_year = CareerSchoolYearPeer::retrieveByPK($request->getParameter('id'));
     if (null === $this->career_school_year) {
         $this->getUser()->setFlash('error', 'Debe seleccionar una carrera para editar su configuracion');
         $this->redirect('@career_school_year');
     }
     $subject_configuration = $this->career_school_year->getSubjectConfiguration();
     $this->career_school_year->setSubjectConfiguration($subject_configuration);
     $form_name = SchoolBehaviourFactory::getInstance()->getFormFactory()->getCareerSchoolYearConfigurationForm();
     $this->form = new $form_name($subject_configuration);
     $this->form->bind($request->getParameter($this->form->getName()), $request->getFiles($this->form->getName()));
     if ($this->form->isValid()) {
         $notice = $this->getProcessFormNotice($this->form->getObject()->isNew());
         $subject_configuration = $this->form->save();
         $this->getUser()->setFlash('notice', $notice);
     } else {
         $this->setProcessFormErrorFlash();
     }
     $this->setTemplate('configuration');
 }
 public function getFormClass()
 {
     return SchoolBehaviourFactory::getInstance()->getFormFactory()->getClassroomForm();
 }