当前位置: 首页>>代码示例>>PHP>>正文


PHP sfI18N类代码示例

本文整理汇总了PHP中sfI18N的典型用法代码示例。如果您正苦于以下问题:PHP sfI18N类的具体用法?PHP sfI18N怎么用?PHP sfI18N使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了sfI18N类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getDayString

 public function getDayString()
 {
     $context = sfContext::getInstance();
     $i18n = new sfI18N();
     $i18n->initialize($context);
     $i18n->setCulture($context->getUser()->getCulture());
     switch ($this->getDay()) {
         case '1':
             return $i18n->globalMessageFormat->format('_DAY_MONDAY_');
             break;
         case '2':
             return $i18n->globalMessageFormat->format('_DAY_TUESDAY_');
             break;
         case '3':
             return $i18n->globalMessageFormat->format('_DAY_WEDNESDAY_');
             break;
         case '4':
             return $i18n->globalMessageFormat->format('_DAY_THURSDAY_');
             break;
         case '5':
             return $i18n->globalMessageFormat->format('_DAY_FRIDAY_');
             break;
         case '6':
             return $i18n->globalMessageFormat->format('_DAY_SATURDAY_');
             break;
         case '7':
             return $i18n->globalMessageFormat->format('_DAY_SUNDAY_');
             break;
         default:
             return '-';
             break;
     }
 }
开发者ID:taryono,项目名称:school,代码行数:33,代码来源:CourseSchedule.php

示例2: executeUpdate

 public function executeUpdate()
 {
     if (!$this->getRequestParameter('id')) {
         $campus = new Campus();
     } else {
         $campus = CampusPeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($campus);
     }
     $campus->setId($this->getRequestParameter('id'));
     $campus->setUuid($this->getRequestParameter('uuid'));
     $campus->setName($this->getRequestParameter('name'));
     $campus->setAddress($this->getRequestParameter('address'));
     $campus->setCity($this->getRequestParameter('city'));
     $campus->setState($this->getRequestParameter('state'));
     $campus->setZip($this->getRequestParameter('zip'));
     $campus->setUrl($this->getRequestParameter('url'));
     $campus->setPhone($this->getRequestParameter('phone'));
     $campus->setEmail($this->getRequestParameter('email'));
     $campus->setSlug($this->getRequestParameter('slug'));
     $campus->setVersion($this->getRequestParameter('version'));
     if ($this->getRequestParameter('deleted_at')) {
         list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('deleted_at'), $this->getUser()->getCulture());
         $campus->setDeletedAt("{$y}-{$m}-{$d}");
     }
     $campus->save();
     return $this->redirect('campus/show?id=' . $campus->getId());
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:27,代码来源:actions.class.php

示例3: executeSearch

 /**
  * search asset
  * @param sfWebRequest $request
  */
 public function executeSearch(sfWebRequest $request)
 {
     $this->form = new sfAssetFormFilter();
     $this->form->bind($request->getParameter($this->form->getName()));
     $this->filterform = new sfAssetFormFilter();
     // We keep the search params in the session for easier pagination
     if ($request->hasParameter('search_params')) {
         $search_params = $request->getParameter('search_params');
         if (isset($search_params['created_at']['from']) && $search_params['created_at']['from'] !== '') {
             $search_params['created_at']['from'] = sfI18N::getTimestampForCulture($search_params['created_at']['from'], $this->getUser()->getCulture());
         }
         if (isset($search_params['created_at']['to']) && $search_params['created_at']['to'] !== '') {
             $search_params['created_at']['to'] = sfI18N::getTimestampForCulture($search_params['created_at']['to'], $this->getUser()->getCulture());
         }
         $this->getUser()->getAttributeHolder()->removeNamespace('sf_admin/sf_asset/search_params');
         $this->getUser()->getAttributeHolder()->add($search_params, 'sf_admin/sf_asset/search_params');
     }
     $this->search_params = $this->getUser()->getAttributeHolder()->getAll('sf_admin/sf_asset/search_params');
     if ($this->form->isValid()) {
         $c = $this->processSearch($this->form->getValues(), $request);
     } else {
         $c = new Criteria();
     }
     $pager = new sfPropelPager('sfAsset', sfConfig::get('app_sfAssetsLibrary_search_pager_size', 20));
     $pager->setCriteria($c);
     $pager->setPage($request->getParameter('page', 1));
     $pager->setPeerMethod('doSelectJoinsfAssetFolder');
     $pager->init();
     $this->pager = $pager;
     $this->removeLayoutIfPopup($request);
 }
开发者ID:BGCX261,项目名称:zrobtotak-svn-to-git,代码行数:35,代码来源:BasesfAssetActions.class.php

示例4: executeUpdate

 public function executeUpdate()
 {
     $task = TaskPeer::retrieveByUuid($this->getRequestParameter('task'));
     $this->forward404Unless($task);
     $this->forward404Unless($task->isAuthorized($this->getUser()->getId()), 'User not authorized to edit tasks for this project');
     $project = $task->getProject();
     $task->setName($this->getRequestParameter('name'));
     $task->setDescription($this->getRequestParameter('description'));
     if ($this->getRequestParameter('begin')) {
         list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('begin'), $this->getUser()->getCulture());
         $task->setBegin("{$y}-{$m}-{$d}");
     }
     if ($this->getRequestParameter('finish')) {
         list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('finish'), $this->getUser()->getCulture());
         $task->setFinish("{$y}-{$m}-{$d}");
     }
     $task->setStatus($this->getRequestParameter('status', sfConfig::get('app_task_status_open')));
     $task->setPriority($this->getRequestParameter('priority'));
     $task->clearUsers();
     $user = sfGuardUserProfilePeer::retrieveByUuid($this->getRequestParameter('task_user'));
     $task->addUser($user->getUserId());
     $task->save();
     $this->task = $task;
     $this->project = $project;
     $this->setTemplate('show');
     return $this->redirect('project/showTask?tab=tasks&task=' . $task->getUuid());
 }
开发者ID:sgrove,项目名称:cothinker,代码行数:27,代码来源:actions.class.php

示例5: executeSearch

 /**
  * search asset
  * @param sfWebRequest $request
  */
 public function executeSearch(sfWebRequest $request)
 {
     $this->form = new sfAssetFormFilter();
     $this->form->bind($request->getParameter($this->form->getName()));
     $this->filterform = new sfAssetFormFilter();
     // We keep the search params in the session for easier pagination
     if ($request->hasParameter('search_params')) {
         $searchParams = $request->getParameter('search_params');
         if (isset($searchParams['created_at']['from']) && $searchParams['created_at']['from'] !== '') {
             $searchParams['created_at']['from'] = sfI18N::getTimestampForCulture($searchParams['created_at']['from'], $this->getUser()->getCulture());
         }
         if (isset($searchParams['created_at']['to']) && $searchParams['created_at']['to'] !== '') {
             $searchParams['created_at']['to'] = sfI18N::getTimestampForCulture($searchParams['created_at']['to'], $this->getUser()->getCulture());
         }
         $this->getUser()->getAttributeHolder()->removeNamespace('sf_admin/sf_asset/search_params');
         $this->getUser()->getAttributeHolder()->add($searchParams, 'sf_admin/sf_asset/search_params');
     }
     $this->search_params = $this->getUser()->getAttributeHolder()->getAll('sf_admin/sf_asset/search_params');
     $sort = $this->processSort($request);
     $params = $this->form->isValid() ? $this->form->getValues() : array();
     $this->pager = $this->assetProvider->getPager($params, $sort, $request->getParameter('page', 1), sfConfig::get('app_sfAssetsLibrary_search_pager_size', 20));
     $this->removeLayoutIfPopup($request);
 }
开发者ID:joanteixi,项目名称:sfAssetsLibraryPlugin,代码行数:27,代码来源:BasesfAssetActions.class.php

示例6: executeUpdate

 public function executeUpdate()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $class_course = new ClassCourse();
         $class_course->setClassGroupId($this->getRequestParameter('class_group_id'));
         $class_course->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
         $class_course->setStatus(3);
         $class_course->save();
         $academic_calendar_id = $this->getRequestParameter('academic_calendar_id');
         $academic_calendar = AcademicCalendarPeer::retrieveByPK($academic_calendar_id);
         $this->forward404Unless($academic_calendar);
         $class_group_id = $this->getRequestParameter('class_group_id');
         $class_group = ClassGroupPeer::retrieveByPK($class_group_id);
         $this->forward404Unless($class_group);
         $c = new Criteria();
         $c->add(StudentPeer::CLASS_GROUP_ID, $class_group_id);
         $students = StudentPeer::doSelect($c);
         foreach ($students as $student) {
             $c = new Criteria();
             $c->add(VCourseSchedulePeer::CLASS_GROUP_ID, $class_group_id);
             $c->add(VCourseSchedulePeer::ACADEMIC_CALENDAR_ID, $academic_calendar_id);
             $courses = VCourseSchedulePeer::doSelect($c);
             foreach ($courses as $course) {
                 $student_course = new StudentCourse();
                 $student_course->setStudentId($student->getId());
                 $student_course->setSubjectAccalId($course->getSubjectAccalId());
                 $student_course->setClassGroupId($course->getClassGroupId());
                 $student_course->setStatus(3);
                 $student_course->save();
             }
         }
     } else {
         $class_course = ClassCoursePeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($class_course);
         $class_course->setId($this->getRequestParameter('id'));
         $class_course->setClassGroupId($this->getRequestParameter('class_group_id'));
         $class_course->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
         $class_course->setStatus(3);
         $class_course->save();
         $academic_calendar_id = $this->getRequestParameter('academic_calendar_id');
         $class_group_id = $this->getRequestParameter('class_group_id');
         $c = new Criteria();
         $c->add(StudentPeer::CLASS_GROUP_ID, $class_group_id);
         $students = StudentPeer::doSelect($c);
         foreach ($students as $student) {
             $c = new Criteria();
             $c->add(VCourseSchedulePeer::CLASS_GROUP_ID, $class_group_id);
             $c->add(VCourseSchedulePeer::ACADEMIC_CALENDAR_ID, $academic_calendar_id);
             $courses = VCourseSchedulePeer::doSelect($c);
             foreach ($courses as $course) {
                 $c = new Critaria();
                 $c->add(StudenCoursePeer::STUDENT_ID, $student->getId());
                 $stu_courses = StudentCoursePeer::doSelect($c);
                 foreach ($stu_courses as $stu_courses) {
                     $student_course = StudentCoursePeer::retrieveByPk($stu_courses->getId());
                     $student_course->setStudentId($student->getId());
                     $student_course->setSubjectAccalId($course->getSubjectAccalId());
                     $student_course->setClassGroupId($course->getClassGroupId());
                     $student_course->setStatus(3);
                     $student_course->save();
                 }
             }
         }
     }
     return $this->redirect('subject_plan/list');
 }
开发者ID:taryono,项目名称:school,代码行数:71,代码来源:actions.class.php

示例7: executeSave

 public function executeSave()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $class_agenda = new ClassAgenda();
     } else {
         $class_agenda = ClassAgendaPeer::retrieveByPk($this->getRequestParameter('id'));
         #$this->forward404Unless($class_agenda);
     }
     $class_agenda->setId($this->getRequestParameter('id'));
     $class_agenda->setCourseScheduleId($this->getRequestParameter('course_schedule_id'));
     $class_agenda->setDetail($this->getRequestParameter('detail'));
     if ($this->getRequestParameter('date')) {
         $class_agenda->setDate($this->getRequestParameter('date'));
     }
     $class_agenda->setStatus($this->getRequestParameter('status'));
     $class_agenda->setSubjectGradingId($this->getRequestParameter('subject_grading_id'));
     $class_agenda->setMeetingPoint($this->getRequestParameter('meeting_point'));
     $class_agenda->setActionType($this->getRequestParameter('action_type'));
     $class_agenda->setDay($this->getRequestParameter('day'));
     $class_agenda->save();
     if ($this->hasRequestParameter('file') && $this->getRequestParameter('file') != '' && $this->getRequestParameter('file') != null) {
         $fileName = $this->getRequestParameter('file');
         $ca_file = new ClassAgendaFile();
         $ca_file->setClassAgenda($class_agenda);
         $ca_file->setFile($fileName);
         $ca_file->save();
     }
     if ($this->hasRequestParameter('file_1') && $this->getRequestParameter('file_1') != '' && $this->getRequestParameter('file_1') != null) {
         $fileName = $this->getRequestParameter('file_1');
         $ca_file = new ClassAgendaFile();
         $ca_file->setClassAgenda($class_agenda);
         $ca_file->setFile($fileName);
         $ca_file->save();
     }
     if ($this->hasRequestParameter('file_2') && $this->getRequestParameter('file_2') != '' && $this->getRequestParameter('file_2') != null) {
         $fileName = $this->getRequestParameter('file_2');
         $ca_file = new ClassAgendaFile();
         $ca_file->setClassAgenda($class_agenda);
         $ca_file->setFile($fileName);
         $ca_file->save();
     }
     if ($this->hasRequestParameter('file_3') && $this->getRequestParameter('file_3') != '' && $this->getRequestParameter('file_3') != null) {
         $fileName = $this->getRequestParameter('file_3');
         $ca_file = new ClassAgendaFile();
         $ca_file->setClassAgenda($class_agenda);
         $ca_file->setFile($fileName);
         $ca_file->save();
     }
     if ($this->hasRequestParameter('file_4') && $this->getRequestParameter('file_4') != '' && $this->getRequestParameter('file_4') != null) {
         $fileName = $this->getRequestParameter('file_4');
         $ca_file = new ClassAgendaFile();
         $ca_file->setClassAgenda($class_agenda);
         $ca_file->setFile($fileName);
         $ca_file->save();
     }
     if ($this->hasRequestParameter('file_5') && $this->getRequestParameter('file_5') != '' && $this->getRequestParameter('file_5') != null) {
         $fileName = $this->getRequestParameter('file_5');
         $ca_file = new ClassAgendaFile();
         $ca_file->setClassAgenda($class_agenda);
         $ca_file->setFile($fileName);
         $ca_file->save();
     }
     return $this->redirect('class_agenda/list?id=' . $this->getRequestParameter('course_schedule_id'));
 }
开发者ID:taryono,项目名称:school,代码行数:69,代码来源:actions.class.php

示例8: executeUpdate

 public function executeUpdate()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $subject = new Subject();
     } else {
         $subject = SubjectPeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($subject);
     }
     $subject->setId($this->getRequestParameter('id'));
     $subject->setCode($this->getRequestParameter('code'));
     $subject->setName($this->getRequestParameter('name'));
     $subject->setCredit($this->getRequestParameter('credit'));
     $subject->setDescription($this->getRequestParameter('description'));
     $subject->setSubjectGroupId($this->getRequestParameter('subject_group_id'));
     $subject->setDepartmentId($this->getRequestParameter('department_id'));
     $subject->save();
     return $this->redirect('subject/list');
 }
开发者ID:taryono,项目名称:school,代码行数:23,代码来源:actions.class.php

示例9: executeUpdate

 public function executeUpdate()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $student = new Student();
     } else {
         $student = StudentPeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($student);
     }
     $student->setId($this->getRequestParameter('id'));
     $student->setCode($this->getRequestParameter('code'));
     $student->setName($this->getRequestParameter('name'));
     $student->setCurriculumId($this->getRequestParameter('curriculum_id'));
     $student->setClassGroupId($this->getRequestParameter('class_group_id'));
     $student->setClassName($this->getRequestParameter('class_name'));
     $student->setTestApplicantId($this->getRequestParameter('test_applicant_id'));
     $student->setStudentDetailId($this->getRequestParameter('student_detail_id'));
     $student->setStatus($this->getRequestParameter('status'));
     $student->save();
     return $this->redirect('alumni/list');
 }
开发者ID:taryono,项目名称:school,代码行数:25,代码来源:actions.class.php

示例10: executeUpdateParent

 public function executeUpdateParent()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     $counseling_id = $this->getRequestParameter('counseling_id');
     $counseling = CounselingPeer::retrieveByPK($counseling_id);
     $this->forward404Unless($counseling);
     $accal_id = $this->getRequestParameter('academic_calendar_id');
     $academic_calendar = AcademicCalendarPeer::retrieveByPK($accal_id);
     $this->forward404Unless($academic_calendar);
     $student_detail = StudentDetailPeer::retrieveByPk($this->getRequestParameter('student_detail_id'));
     $this->forward404Unless($student_detail);
     $student_detail->setFather($this->getRequestParameter('father'));
     $student_detail->setMother($this->getRequestParameter('mother'));
     $student_detail->save();
     $student = StudentPeer::retrieveByPk($this->getRequestParameter('id'));
     $this->forward404Unless($student);
     $father = StudentParentsPeer::retrieveByPK($this->getRequestParameter('father_id'));
     if ($father == null) {
         $father = new StudentParents();
     }
     $father->setId($this->getRequestParameter('father_id'));
     $father->setStudent($student);
     $father->setRelation(StudentParents::RELATION_FATHER);
     $father->setName($this->getRequestParameter('father'));
     $father->setPob($this->getRequestParameter('father_pob'));
     if ($this->getRequestParameter('father_dob')) {
         $father->setDob($this->getRequestParameter('father_dob'));
     }
     $father->setReligionId($this->getRequestParameter('religion_father'));
     $father->setCountryId($this->getRequestParameter('father_country'));
     $father->setDegreeId($this->getRequestParameter('degree_father'));
     $father->setJob($this->getRequestParameter('father_job'));
     $father->setNoteDetail($this->getRequestParameter('father_notedetail'));
     $father->setMonthlyRevenue($this->getRequestParameter('father_revenue'));
     $father->setOfficePhone($this->getRequestParameter('father_officephone'));
     $father->setEmail($this->getRequestParameter('father_email'));
     $father->setAddress($this->getRequestParameter('father_address'));
     $father->setCellphone($this->getRequestParameter('father_cellphone'));
     $father->save();
     $mother = StudentParentsPeer::retrieveByPK($this->getRequestParameter('mother_id'));
     if ($mother == null) {
         $mother = new StudentParents();
     }
     $mother->setId($this->getRequestParameter('mother_id'));
     $mother->setStudent($student);
     $mother->setRelation(StudentParents::RELATION_MOTHER);
     $mother->setName($this->getRequestParameter('mother'));
     $mother->setPob($this->getRequestParameter('mother_pob'));
     if ($this->getRequestParameter('mother_dob')) {
         $mother->setDob($this->getRequestParameter('mother_dob'));
     }
     $mother->setReligionId($this->getRequestParameter('religion_mother'));
     $mother->setCountryId($this->getRequestParameter('mother_country'));
     $mother->setDegreeId($this->getRequestParameter('degree_mother'));
     $mother->setJob($this->getRequestParameter('mother_job'));
     $mother->setNoteDetail($this->getRequestParameter('mother_notedetail'));
     $mother->setMonthlyRevenue($this->getRequestParameter('mother_revenue'));
     $mother->setOfficePhone($this->getRequestParameter('mother_officephone'));
     $mother->setEmail($this->getRequestParameter('mother_email'));
     $mother->setAddress($this->getRequestParameter('mother_address'));
     $mother->setCellphone($this->getRequestParameter('mother_cellphone'));
     $mother->save();
     return $this->redirect('counseling_sd/listStudent?accal_id=' . $academic_calendar->getId() . '&counseling_id=' . $counseling->getId());
 }
开发者ID:taryono,项目名称:school,代码行数:68,代码来源:actions.class.php

示例11: executeUpdate

 public function executeUpdate()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     $student = StudentPeer::retrieveByPK($this->getRequestParameter('student_id'));
     $this->forward404Unless($student);
     $this->student = $student;
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $student_leave = new StudentLeave();
         $student_leave->setStatus(StudentLeave::STATUS_PROPOSED);
     } else {
         $student_leave = StudentLeavePeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($student_leave);
         $student_leave->setStatus(StudentLeave::STATUS_CANCELED);
     }
     $student_leave->setId($this->getRequestParameter('id'));
     $student_leave->setStudentId($this->getRequestParameter('student_id'));
     $student_leave->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
     $student_leave->save();
     $stu = $student_leave->getStudent();
     if ($student_leave->getStatus() == StudentLeave::STATUS_ACTIVE) {
         // add payment journal
         $job = JobPeer::retrieveByCode($this->getModuleName());
         $academic_process = $job->getAcademicProcess();
         $c = new Criteria();
         $c->add(AcademicCostPeer::ACADEMIC_PROCESS_ID, $academic_process->getId());
         $c->add(AcademicCostPeer::ACADEMIC_CALENDAR_ID, $student_leave->getAcademicCalendarId());
         $costs = AcademicCostPeer::doSelect($c);
         foreach ($costs as $c) {
             $pj = new PaymentJournal();
             $pj->setPayer($stu->getId());
             $pj->setAcademicCost($c);
             $pj->setJob($job);
             $pj->setAmount($c->getAmount());
             $pj->setPaid($c->getAmount());
             $pj->setReceivable(0);
             $pj->setAcademicProcess($academic_process);
             $pj->setPayerType(PaymentJournal::PAYER_TYPE_STUDENT);
             $pj->save();
             $ph = new PaymentHistory();
             $ph->setPaymentJournal($pj);
             $ph->setAmount($c->getAmount());
             $ph->save();
         }
         // set student status
         $stu->setStatus(Student::STATUS_INACTIVE);
         $stu->save();
         // cancelled all student course
         $c = new Criteria();
         $c->add(StudentCoursePeer::STUDENT_ID, $stu->getId());
         $c->add(StudentCoursePeer::STATUS, array(StudentCourse::STATUS_PLANNED, StudentCourse::STATUS_APPROVED, StudentCourse::STATUS_ACTIVE), Criteria::IN);
         $scs = StudentCoursePeer::doSelect($c);
         foreach ($scs as $sc) {
             $sc->setStatus(StudentCourse::STATUS_CANCELED);
             $sc->save();
         }
     } elseif ($student_leave->getStatus() == StudentLeave::STATUS_DONE) {
         $stu->setStatus(Student::STATUS_ACTIVE);
         $stu->save();
     }
     return $this->redirect('student_leave_s/list?student_id=' . $student->getId());
 }
开发者ID:taryono,项目名称:school,代码行数:65,代码来源:actions.class.php

示例12: executeSave

 public function executeSave()
 {
     $curr_id = $this->getRequestParameter('curr_id');
     $curr = CurriculumPeer::retrieveByPK($curr_id);
     $this->forward404Unless($curr);
     $this->curr = $curr;
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     $params = array();
     foreach (explode('&', $this->getRequestParameter('subject_list_ser')) as $p) {
         $p = explode('=', $p);
         $params[rawurldecode($p[0])][] = rawurldecode($p[1]);
     }
     if (array_key_exists('subjects', $params)) {
         foreach ($params['subjects'] as $su_id) {
             $subject_curr = new SubjectCurr();
             $subject_curr->setSubjectId($su_id);
             $subject_curr->setCurriculumId($this->getRequestParameter('curriculum_id'));
             $subject_curr->save();
         }
     }
     return $this->redirect('subject_curr/list?curr_id=' . $curr->getId());
 }
开发者ID:taryono,项目名称:school,代码行数:26,代码来源:actions.class.php

示例13: executeUpdate

 public function executeUpdate()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $member_type = new MemberType();
     } else {
         $member_type = MemberTypePeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($member_type);
     }
     $member_type->setId($this->getRequestParameter('id'));
     $member_type->setMemberTemplateId($this->getRequestParameter('member_template_id'));
     $member_type->setCode($this->getRequestParameter('code'));
     $member_type->setDescription($this->getRequestParameter('description'));
     $member_type->save();
     $member_type->updateMemberAcl($this->getRequestParameter('member_job'), $this->getRequestParameter('member_acl'));
     return $this->redirect('member_type/list');
 }
开发者ID:taryono,项目名称:school,代码行数:21,代码来源:actions.class.php

示例14: executeUpdate

 public function executeUpdate()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $employee_detail = new EmployeeDetail();
     } else {
         $employee_detail = EmployeeDetailPeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($employee_detail);
     }
     $employee_detail->setId($this->getRequestParameter('id'));
     $employee_detail->setEmployeeId($this->getRequestParameter('employee_id'));
     if ($this->getRequestParameter('date_in')) {
         $employee_detail->setDateIn($this->getRequestParameter('date_in'));
     }
     if ($this->getRequestParameter('date_out')) {
         $employee_detail->setDateOut($this->getRequestParameter('date_out'));
     }
     $employee_detail->setNickname($this->getRequestParameter('nickname'));
     $employee_detail->setSex($this->getRequestParameter('sex'));
     $employee_detail->setPob($this->getRequestParameter('pob'));
     if ($this->getRequestParameter('dob')) {
         $employee_detail->setDob($this->getRequestParameter('dob'));
     }
     $employee_detail->setReligionId($this->getRequestParameter('religion_id'));
     $employee_detail->setNationality($this->getRequestParameter('nationality'));
     $employee_detail->setStatusInFamily($this->getRequestParameter('status_in_family'));
     $employee_detail->setMotherLanguage($this->getRequestParameter('mother_language'));
     $employee_detail->setHobby($this->getRequestParameter('hobby'));
     $employee_detail->setAddress($this->getRequestParameter('address'));
     $employee_detail->setPhone($this->getRequestParameter('phone'));
     $employee_detail->setResidenceStatus($this->getRequestParameter('residence_status'));
     $employee_detail->setVehicle($this->getRequestParameter('vehicle'));
     $employee_detail->setWorkplaceDistance($this->getRequestParameter('workplace_distance'));
     $employee_detail->setLastEducation($this->getRequestParameter('last_education'));
     $employee_detail->setGraduationYear($this->getRequestParameter('graduation_year'));
     $employee_detail->setCertificateNumber($this->getRequestParameter('certificate_number'));
     $employee_detail->setFaculty($this->getRequestParameter('faculty'));
     $employee_detail->setProgram($this->getRequestParameter('program'));
     $employee_detail->setMayor($this->getRequestParameter('mayor'));
     $employee_detail->setTeachingLicense($this->getRequestParameter('teaching_license'));
     $employee_detail->setMaritalStatus($this->getRequestParameter('marital_status'));
     $employee_detail->setSpouseName($this->getRequestParameter('spouse_name'));
     $employee_detail->setBloodType($this->getRequestParameter('blood_type'));
     $employee_detail->setSpousePob($this->getRequestParameter('spouse_pob'));
     if ($this->getRequestParameter('spouse_dob')) {
         $employee_detail->setSpouseDob($this->getRequestParameter('spouse_dob'));
     }
     $employee_detail->setSpouseEducation($this->getRequestParameter('spouse_education'));
     $employee_detail->setSpouseReligionId($this->getRequestParameter('spouse_religion_id'));
     $employee_detail->setNumberOfChild($this->getRequestParameter('number_of_child'));
     $employee_detail->setChild1Name($this->getRequestParameter('child1_name'));
     $employee_detail->setChild2Name($this->getRequestParameter('child2_name'));
     $employee_detail->setTall($this->getRequestParameter('tall'));
     $employee_detail->setWeight($this->getRequestParameter('weight'));
     $employee_detail->setIllness($this->getRequestParameter('illness'));
     $employee_detail->save();
     // save photo
     $photo_dir = sfConfig::get('sf_data_dir') . DIRECTORY_SEPARATOR . 'photos' . DIRECTORY_SEPARATOR;
     if ($this->hasRequestParameter('photoFile') && $this->getRequestParameter('photoFile') != '' && $this->getRequestParameter('photoFile') != null) {
         // get photo content
         $photo_file = $photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile');
         $content = file_get_contents($photo_file);
         $im = imagecreatefromstring($content);
         list($w, $h) = getimagesize($photo_file);
         // generate photo
         $photo = imagecreatetruecolor(150, 195);
         imagecopyresized($photo, $im, 0, 0, 0, 0, 150, 195, $w, $h);
         // generate thumbnail
         $thumb = imagecreatetruecolor(100, 130);
         imagecopyresized($thumb, $im, 0, 0, 0, 0, 100, 130, $w, $h);
         // get photo record
         $c = new Criteria();
         $c->add(EmployeePhotoPeer::EMPLOYEE_ID, $employee_detail->getEmployeeId());
         $employee_photo = EmployeePhotoPeer::doSelectOne($c);
         if ($employee_photo == null) {
             $employee_photo = new EmployeePhoto();
             $employee_photo->setEmployee($employee_detail->getEmployee());
         }
         // save photo
         imagepng($photo, $photo_file);
         $employee_photo->setPhoto(base64_encode(file_get_contents($photo_file)));
         imagepng($thumb, $photo_file);
         $employee_photo->setThumbnail(base64_encode(file_get_contents($photo_file)));
         $employee_photo->save();
         unlink($photo_dir . 'tmp' . DIRECTORY_SEPARATOR . $this->getRequestParameter('photoFile'));
     }
     return $this->redirect('employee_detail/show?employee_id=' . $employee_detail->getEmployeeId());
 }
开发者ID:taryono,项目名称:school,代码行数:92,代码来源:actions.class.php

示例15: executeUpdate

 public function executeUpdate()
 {
     $i18n = new sfI18N();
     $i18n->initialize($this->getContext());
     $i18n->setCulture($this->getUser()->getCulture());
     $action_i18n = $i18n->globalMessageFormat->format('save as new');
     $action_type = $this->getRequestParameter('action_type');
     if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
         $ng_applicant_category = new NgApplicantCategory();
     } else {
         $ng_applicant_category = NgApplicantCategoryPeer::retrieveByPk($this->getRequestParameter('id'));
         $this->forward404Unless($ng_applicant_category);
     }
     $ng_applicant_category->setId($this->getRequestParameter('id'));
     $ng_applicant_category->setName($this->getRequestParameter('name'));
     $ng_applicant_category->setDetail($this->getRequestParameter('detail'));
     $ng_applicant_category->save();
     return $this->redirect('ng_applicant_category/list');
 }
开发者ID:taryono,项目名称:school,代码行数:19,代码来源:actions.class.php


注:本文中的sfI18N类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。