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