public function configure() { $sf_formatter_revisited = new sfWidgetFormSchemaFormatterRevisited($this); $this->getWidgetSchema()->addFormFormatter('Revisited', $sf_formatter_revisited); $this->getWidgetSchema()->setFormFormatterName('Revisited'); unset($this['student_repproved_course_subject_id'], $this["examination_repproved_subject_id"]); $configuration = $this->getObject()->getStudentRepprovedCourseSubject()->getCourseSubjectStudent()->getCourseSubject()->getCareerSubjectSchoolYear()->getConfiguration(); if (!$this->getObject()->getExaminationRepprovedSubject()->canEditCalifications()) { unset($this["is_absent"]); $this->widgetSchema["mark"] = new mtWidgetFormPlain(array('object' => $this->getObject(), 'method' => 'getMarkStrByConfig', "empty_value" => "Is absent", 'method_args' => $configuration, 'add_hidden_input' => false), array('class' => 'mark')); } else { $this->widgetSchema->setHelp("mark", "Enter student's mark or mark him as absent."); if (!$configuration->isNumericalMark()) { $letter_mark = LetterMarkPeer::getLetterMarkByValue((int) $this->getObject()->getMark()); $this->setWidget('mark', new sfWidgetFormPropelChoice(array('model' => 'LetterMark', 'add_empty' => true))); if (!is_null($letter_mark)) { $this->setDefault('mark', $letter_mark->getId()); } $this->setValidator('mark', new sfValidatorPropelChoice(array('model' => 'LetterMark', 'required' => false))); } else { $behavior = SchoolBehaviourFactory::getEvaluatorInstance(); $this->validatorSchema["mark"]->setOption("min", $behavior->getMinimumMark()); $this->validatorSchema["mark"]->setOption("max", $behavior->getMaximumMark()); $this->validatorSchema["mark"]->setMessage("min", "Mark should be at least %min%."); $this->validatorSchema["mark"]->setMessage("max", "Mark should be at most %max%."); } } $this->widgetSchema->setLabel("mark", $this->getObject()->getStudentRepprovedCourseSubject()->getStudent()); $this->validatorSchema->setPostValidator(new sfValidatorCallback(array("callback" => array($this, "validateAbsence")))); }
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."))); } }
public function configure() { $sf_formatter_revisited = new sfWidgetFormSchemaFormatterRevisited($this); $this->getWidgetSchema()->addFormFormatter('Revisited', $sf_formatter_revisited); $this->getWidgetSchema()->setFormFormatterName('Revisited'); $this->setWidget('date', new csWidgetFormDateInput()); $this->getWidget('date')->setLabel(__('Examination date')); $this->setValidator('date', new mtValidatorDateString(array('required' => false))); unset($this['student_repproved_course_subject_id'], $this["examination_repproved_subject_id"]); if (!$this->getObject()->getExaminationRepprovedSubject()->canEditCalifications()) { unset($this["is_absent"]); $this->widgetSchema["mark"] = new mtWidgetFormPlain(array("empty_value" => "Is absent")); $this->widgetSchema["date"] = new mtWidgetFormPlain(array("empty_value" => "-")); $this->getWidget('date')->setLabel(__('Examination date')); } else { $this->widgetSchema->setHelp("mark", "Enter student's mark or mark him as absent."); } $behavior = SchoolBehaviourFactory::getEvaluatorInstance(); $this->validatorSchema["mark"]->setOption("min", $behavior->getMinimumMark()); $this->validatorSchema["mark"]->setOption("max", $behavior->getMaximumMark()); $this->validatorSchema["mark"]->setMessage("min", "Mark should be at least %min%."); $this->validatorSchema["mark"]->setMessage("max", "Mark should be at most %max%."); $this->widgetSchema->setLabel("mark", $this->getObject()->getStudentRepprovedCourseSubject()->getStudent()); $this->validatorSchema->setPostValidator(new sfValidatorCallback(array("callback" => array($this, "validateAbsence")))); }
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 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']); }
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); }
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; }
/** * 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); }
/** * 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); } } } }
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; }
public function executeFinish(sfWebRequest $request, $con = null) { $all_tentative_repproved_students = TentativeRepprovedStudentPeer::doSelectNonDeleted(); $con = is_null($con) ? Propel::getConnection() : $con; try { $con->beginTransaction(); foreach ($all_tentative_repproved_students as $trs) { $student_career_school_year = $trs->getStudentCareerSchoolYear(); $student = $student_career_school_year->getStudent(); SchoolBehaviourFactory::getEvaluatorInstance()->repproveStudent($student, $student_career_school_year, $con); $trs->setIsDeleted(true); $trs->save(); } $con->commit(); } catch (PropelException $e) { $con->rollBack(); } $this->redirect('schoolyear/index'); }
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 "); }
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')))); }
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'); }
public function getColor() { return SchoolBehaviourFactory::getEvaluatorInstance()->getColorForCourseSubjectStudentMark($this); }
public function getForm($object = null) { $class = SchoolBehaviourFactory::getInstance()->getFormFactory()->getCourseForm(); return new $class($object, $this->getFormOptions()); }
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 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); }
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); } } } } }
public function getAvailableStudentsForDivision() { return array_merge($this->getObject()->getStudents(), SchoolBehaviourFactory::getInstance()->getAvailableStudentsForManualExaminationSubject($this->getObject())); }
protected function getMaximumMark() { return SchoolBehaviourFactory::getEvaluatorInstance()->getMaximumMark(); }
public static function setAvailableStudentsForDivision(Division $division) { self::$_students = array_merge($division->getStudents(), SchoolBehaviourFactory::getInstance()->getAvailableStudentsForDivision($division, $filter_by_orientation = true)); }
public function getFormClass() { return SchoolBehaviourFactory::getInstance()->getFormFactory()->getClassroomForm(); }
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)); }
* 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;
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 getMarkStrByConfig($config = null) { if ($this->getIsAbsent()) { return __('A'); } else { if (is_null($config)) { $config = $this->getExaminationSubject()->getCareerSubjectSchoolYear()->getConfiguration(); } if ($this->getMark() != SchoolBehaviourFactory::getEvaluatorInstance()->getMinimumMark()) { if (!is_null($config) && !$config->isNumericalMark()) { $letter_mark = LetterMarkPeer::getLetterMarkByValue($this->getMark()); return $letter_mark->getLetter(); } else { return $this->getMark(); } } } }