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; } }
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()); }
public function __($string, $args = array(), $catalogue = 'messages') { foreach ($args as $k => $v) { if ($v instanceof SnsTerm) { $args[$k] = (string) $v; } } if (empty($parsed[$string])) { $this->parsed[$string] = array(); $matches = array(); preg_match_all('/%([a-zA-Z_]+)%/', $string, $matches); array_shift($matches); foreach ($matches as $match) { foreach ($match as $v) { if ($this->terms[$v]) { $term = $this->terms[$v]; if ($this->titleize) { $term = $term->titleize(); } $this->parsed[$string]['%' . $v . '%'] = (string) $term; } } } } return parent::__($string, array_merge($this->parsed[$string], $args), $catalogue); }
/** * 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); }
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()); }
public static function getInstance() { if (!isset(self::$instance)) { $class = __CLASS__; self::$instance = new $class(); } return self::$instance; }
/** * 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); }
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'); }
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')); }
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'); }
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'); }
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()); }
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()); }
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()); }
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'); }
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()); }
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'); }
public function setMessageSource($dirs, $culture = null) { $current = ncFlavorFlavors::getInstance()->current(); $dirs = array_merge($dirs, array(ncFlavorFlavors::getGlobalPath() . DIRECTORY_SEPARATOR . "i18n")); parent::setMessageSource($dirs, $culture); }
public function executeGetListStudent() { $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'); $group_id = $this->getContext()->getUser()->getAttribute('group_id', null, 'bo'); $counseling_id = $this->getRequestParameter('counseling_id'); $counseling = CounselingPeer::retrieveByPk($counseling_id); $year = $this->getRequestParameter('year'); $month = $this->getRequestParameter('month'); $c = new Criteria(); #$c->add(VStuSppPeer::MONTH, $month); #$c->add(VStuSppPeer::YEAR, $year); #$c->addJoin(StudentPeer::ID, VStuSppPeer::PAYER); $c->add(StudentPeer::CLASS_GROUP_ID, $counseling->getClassGroupId()); $c->add(StudentPeer::ACADEMIC_CALENDAR_ID, $counseling->getAcademicCalendarId()); $c->add(StudentPeer::STATUS, Student::STATUS_GRADUATE, Criteria::NOT_EQUAL); $c->add(StudentPeer::STATUS, Student::STATUS_OVERDUE, Criteria::NOT_EQUAL); $this->sortStudent($c); if ($this->getRequest()->hasParameter('filters')) { $filters = $this->getRequestParameter('filters'); if ($filters == 'clear') { $this->filters = null; } else { $defined_filter = false; foreach ($filters as $f) { if (is_array($f)) { if (strlen($f['from']) > 0 || strlen($f['to']) > 0) { $defined_filter = true; break; } } else { if ($f != null && $f != '') { $defined_filter = true; break; } } } if ($defined_filter) { $this->filters = $filters; $this->filterStudent($c, $this->getRequestParameter('filters')); } } } $rpp = $this->getRequestParameter('max_per_page', $this->getUser()->getAttribute('max_per_page', ParamsPeer::retrieveByCode('row_per_page')->getValue(), 'student')); $this->getUser()->setAttribute('max_per_page', $rpp, 'student'); $pager = new sfPropelPager('Student', $rpp); $pager->setCriteria($c); $page = $this->getRequestParameter('page', $this->getUser()->getAttribute('page', 1, 'student')); $this->getUser()->setAttribute('page', $page, 'student'); $pager->setPage($page); $pager->init(); $this->pager = $pager; $actions = array(array('name' => 'filter', 'color' => 'white')); $filter_string = ""; if ($this->filters) { foreach ($this->filters as $key => $val) { $filter_string .= "&filters[{$key}]={$val}"; } $filter_string = preg_replace('/^&/', '', $filter_string); } array_unshift($actions, array('name' => 'Proses', 'type' => 'image', 'options' => array('class' => 'save_button', 'onclick' => "action_type.value=this.value", 'title' => 'Proses'))); array_unshift($actions, array('name' => '_AS_CSV_', 'url' => "student_finance/getListStudentAsCSV?month={$month}&year={$year}&{$filter_string}", 'color' => 'black', 'type' => 'direct')); array_unshift($actions, array('name' => '_AS_PDF_', 'url' => "student_finance/getListStudentAsPDF?month={$month}&year={$year}&{$filter_string}", 'color' => 'black', 'type' => 'direct')); $this->actions = $actions; $this->month = $month; $this->year = $year; $this->counseling = $counseling; $this->subtitle = $counseling->getAcademicCalendar()->toString() . ' # ' . $counseling->getClassGroup()->toString(); $actions2 = array(array('name' => '<span>Jurnal Pembayaran Wakaf</span>', 'url' => 'student_finance/listStudent?counseling_id=' . $counseling->getId(), 'color' => 'sky')); array_unshift($actions2, array('name' => '<span>Jurnal Keuangan Murid</span>', 'url' => 'student_finance/list', 'color' => 'sky')); array_push($actions2, array('name' => '<span>Jurnal Pembayaran Infaq</span>', 'url' => 'student_finance/listInfaq?counseling_id=' . $counseling->getId(), 'color' => 'sky')); array_push($actions2, array('name' => '<span>Jurnal Pembayaran SPP</span>', 'url' => 'student_finance/listSpp?counseling_id=' . $counseling->getId(), 'color' => 'sun', 'type' => 'direct')); array_push($actions2, array('name' => '<span>Jurnal Pembayaran Lain-lain</span>', 'url' => 'student_finance/listElse?counseling_id=' . $counseling->getId(), 'color' => 'sky')); $this->actions2 = $actions2; $this->type = 'add'; }
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')) { $formula = new Formula(); } else { $formula = FormulaPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($formula); } $formula->setId($this->getRequestParameter('id')); $formula->setCode($this->getRequestParameter('code')); $formula->setDetail($this->getRequestParameter('detail')); $formula->save(); return $this->redirect('formula/list'); }
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')) { $payment_model = new PaymentModel(); } else { $payment_model = PaymentModelPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($payment_model); } $payment_model->setId($this->getRequestParameter('id')); $payment_model->setCode($this->getRequestParameter('code')); $payment_model->setName($this->getRequestParameter('name')); $payment_model->setParent($this->getRequestParameter('parent')); $payment_model->setDescription($this->getRequestParameter('description')); $payment_model->save(); return $this->redirect('payment_model/list'); }
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_job_history = new StudentJobHistory(); } else { $student_job_history = StudentJobHistoryPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($student_job_history); } $student_job_history->setId($this->getRequestParameter('id')); $student_job_history->setStudentId($this->getRequestParameter('student_id')); $student_job_history->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id')); $student_job_history->setInstanceId($this->getRequestParameter('instance_id')); if ($this->getRequestParameter('start')) { $student_job_history->setStart($this->getRequestParameter('start')); } if ($this->getRequestParameter('end')) { $student_job_history->setEnd($this->getRequestParameter('end')); } $student_job_history->setGrade($this->getRequestParameter('grade')); $student_job_history->setCitationId($this->getRequestParameter('citation_id')); $student_job_history->save(); return $this->redirect('student_job_history/list?student_id=' . $this->getRequestParameter('student_id')); }
public function getI18N() { if (!$this->i18n && sfConfig::get('sf_i18n')) { $this->i18n = sfI18N::getInstance(); $this->i18n->initialize($this); } return $this->i18n; }
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_achievement_level = new NgAchievementLevel(); } else { $ng_achievement_level = NgAchievementLevelPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($ng_achievement_level); } $ng_achievement_level->setId($this->getRequestParameter('id')); $ng_achievement_level->setCode($this->getRequestParameter('code')); $ng_achievement_level->setName($this->getRequestParameter('detail')); $ng_achievement_level->save(); return $this->redirect('ng_achievement_level/list'); }
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')) { $budget_status = new BudgetStatus(); } else { $budget_status = BudgetStatusPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($budget_status); } $budget_status->setId($this->getRequestParameter('id')); $budget_status->setCode($this->getRequestParameter('code')); $budget_status->setName($this->getRequestParameter('name')); $budget_status->save(); return $this->redirect('budget_status/list'); }
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_leave = new EmployeeLeave(); } else { $employee_leave = EmployeeLeavePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($employee_leave); } $employee_leave->setId($this->getRequestParameter('id')); $employee_leave->setEmployeeId($this->getRequestParameter('employee_id')); if ($this->getRequestParameter('start')) { $employee_leave->setStart($this->getRequestParameter('start')); } if ($this->getRequestParameter('end')) { $employee_leave->setEnd($this->getRequestParameter('end')); } $employee = EmployeePeer::retrieveByPK($this->getRequestParameter('employee_id')); if ($employee) { $cd = new Criteria(); $cd->add(EmployeeDetailPeer::EMPLOYEE_ID, $employee->getId()); $employee_detail = EmployeeDetailPeer::doSelectOne($cd); if ($employee_detail->getEmployeeDivisionId()) { $employee_leave->setEmployeeDivisionId($employee_detail->getEmployeeDivisionId()); } if ($employee->getDepartmentId()) { $employee_leave->setDepartmentId($employee->getDepartmentId()); } } $employee_leave->setCode($this->getRequestParameter('code')); $employee_leave->setEmployeeLevelId($this->getRequestParameter('employee_level_id')); $employee_leave->setLeaveTypeId($this->getRequestParameter('leave_type_id')); $employee_leave->setLeaveLength($this->getRequestParameter('leave_length')); $employee_leave->setDetail($this->getRequestParameter('detail')); $employee_leave->setAddress($this->getRequestParameter('address')); $employee_leave->setStatus($this->getRequestParameter('status')); $employee_leave->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id')); $employee_leave->save(); return $this->redirect('employee_leave/list?employee_id=' . $this->getRequestParameter('employee_id')); }
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')) { $cat_language = new CatLanguage(); } else { $cat_language = CatLanguagePeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($cat_language); } $cat_language->setId($this->getRequestParameter('id')); $cat_language->setCode($this->getRequestParameter('code')); $cat_language->setName($this->getRequestParameter('name')); $cat_language->save(); return $this->redirect('cat_language/list'); }
public function executeUpdate() { $group = $this->getContext()->getUser()->getAttribute('group', null, 'bo'); if ($group != 'root') { $this->forward('default', 'index'); } $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')) { $params = new Params(); } else { $params = ParamsPeer::retrieveByPk($this->getRequestParameter('id')); $this->forward404Unless($params); } $params->setId($this->getRequestParameter('id')); $params->setCode($this->getRequestParameter('code')); $params->setValue($this->getRequestParameter('value')); $params->setDescription($this->getRequestParameter('description')); $params->save(); return $this->redirect('params/list'); }
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'); $employee_id = sfContext::getInstance()->getUser()->getAttribute('user_id', null, 'bo'); $employee = EmployeePeer::retrieveByPK($employee_id); $this->forward404Unless($employee); 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')); if ($this->getRequestParameter('class_group_id')) { $class_agenda->setClassGroupId($this->getRequestParameter('class_group_id')); } else { $cs = CourseSchedulePeer::retrieveByPk($this->getRequestParameter('course_schedule_id')); $this->forward404Unless($cs); $class_agenda->setClassGroupId($cs->getClassGroupId()); } $class_agenda->setDescription($this->getRequestParameter('description')); $class_agenda->save(); #$params = array(); #foreach (explode('&', $this->getRequestParameter('student_list_ser')) as $p) { # $p = explode('=', $p); # $params[rawurldecode($p[0])][] = rawurldecode($p[1]); #} #if (array_key_exists('students', $params)) { # foreach ($params['students'] as $su_id) { # $student_absence = new StudentAbsence(); # # $student_absence->setStudentId($su_id); # $student_absence->setStart($this->getRequestParameter('date')); # $student_absence->setEnd($this->getRequestParameter('date')); # $student_absence->setAcademicCalendarId($class_agenda->getCourseSchedule()->getAcademicCalendarId()); # $student_absence->setClassGroupId($this->getRequestParameter('class_group_id')); # $student_absence->save(); # } #} return $this->redirect('agenda/edit?id=' . $class_agenda->getId()); #return $this->forward('agenda', 'list'); #return $this->forward('agenda', 'edit?id='.$class_agenda->getId()); }
/** * Executes updateTodo action * */ public function executeUpdateTodo() { $this->forward404Unless($this->getUser()->isAuthenticated() && ($this->profile = $this->getUser()->getProfile())); $this->forward404Unless($todo = ToDoPeer::retrieveByUserIdSlug($this->profile->getUserId(), $this->getRequestParameter('todo'), true), 'Todo not found by user_id:slug, [' . $this->profile->getUserId() . ']:[' . $this->getRequestParameter('todo') . ']'); $this->forward404Unless($todo->getOwnerId() == $this->getUser()->getId(), 'Owner doesn\'t match current user'); $todo->setName($this->getRequestParameter('name')); $todo->setDescription($this->getRequestParameter('description')); $todo->setStatus($this->getRequestParameter('status')); if ($this->getRequestParameter('begin')) { list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('begin'), $this->getUser()->getCulture()); $todo->setBegin("{$y}-{$m}-{$d}"); } if ($this->getRequestParameter('finish')) { list($d, $m, $y) = sfI18N::getDateForCulture($this->getRequestParameter('finish'), $this->getUser()->getCulture()); $todo->setFinish("{$y}-{$m}-{$d}"); } $todo->save(); $this->todo = $todo; $this->setTemplate('showTodo'); }