本文整理汇总了PHP中SchoolBehaviourFactory::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP SchoolBehaviourFactory::getInstance方法的具体用法?PHP SchoolBehaviourFactory::getInstance怎么用?PHP SchoolBehaviourFactory::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SchoolBehaviourFactory
的用法示例。
在下文中一共展示了SchoolBehaviourFactory::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: configureDay
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: getCourseTypeString
public function getCourseTypeString()
{
if ($this->getCourseType()) {
$choices = SchoolBehaviourFactory::getInstance()->getCourseTypeChoices();
return $choices[$this->getCourseType()];
}
return '';
}
示例3: configure
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"]);
}
示例4: renderCourseSubjectHeader
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);
}
示例5: configure
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: doSave
/**
* 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: getForms
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;
}
示例8: updateStudentExaminationRepprovedSubjects
/**
* 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: getForms
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: WeekCalendar
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: executeIndex
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);
}
}
示例12: configure
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);
}
示例13: configure
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: configure
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: getShortFreeLabel
public function getShortFreeLabel()
{
return SchoolBehaviourFactory::getInstance()->getShortFreeLabel($this);
}