本文整理汇总了PHP中sfI18N::initialize方法的典型用法代码示例。如果您正苦于以下问题:PHP sfI18N::initialize方法的具体用法?PHP sfI18N::initialize怎么用?PHP sfI18N::initialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfI18N
的用法示例。
在下文中一共展示了sfI18N::initialize方法的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;
}
}
示例2: initialize
public function initialize(sfApplicationConfiguration $configuration, sfCache $cache = null, $options = array())
{
parent::initialize($configuration, $cache, $options);
$application = sfConfig::get('sf_app');
if ($application == 'pc_backend') {
$application = 'pc_frontend';
}
$this->terms = Doctrine::getTable('SnsTerm');
$this->terms->configure($this->culture, $application);
}
示例3: 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');
$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());
}
示例4: 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')) {
$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');
}
示例5: 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_i18n = $this->getRequestParameter('action_type');
if ($action_type == $action_i18n || !$this->getRequestParameter('id')) {
$expenditure_journal = new ExpenditureJournal();
} else {
$expenditure_journal = ExpenditureJournalPeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($expenditure_journal);
}
$expenditure_journal->setId($this->getRequestParameter('id'));
$expenditure_journal->setAcademicCalendarId($this->getRequestParameter('academic_calendar_id'));
$expenditure_journal->setAmount($this->getRequestParameter('amount'));
//$expenditure_journal->setPaid($this->getRequestParameter('paid'));
//$expenditure_journal->setReceivable($this->getRequestParameter('amount')-$this->getRequestParameter('paid'));
//$expenditure_journal->setBiayaDesc($this->getRequestParameter('biaya_desc'));
$expenditure_journal->setPaidAt($this->getRequestParameter('paid_at'));
$expenditure_journal->setStatus($this->getRequestParameter('status'));
$expenditure_journal->setBudget($this->getRequestParameter('budget'));
$expenditure_journal->save();
return $this->redirect('expenditure_journal/list');
}
示例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')) {
$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');
}
示例7: 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')) {
$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');
}
示例8: executeUpdate
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');
}
示例9: initialize
public function initialize(sfApplicationConfiguration $configuration, sfCache $cache = null, $options = array())
{
parent::initialize($configuration, $cache, $options);
$this->terms = Doctrine::getTable('SnsTerm');
$this->terms->configure($this->culture, sfConfig::get('sf_app'));
}
示例10: 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');
}
示例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');
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'));
}
示例12: executeUpdateSchedule
public function executeUpdateSchedule()
{
$schedule = SchedulePeer::retrieveByPk($this->getRequestParameter('schedule_id'));
$this->schedule = $schedule;
$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')) {
$cs_detail = new ScheduleDetail();
} else {
$cs_detail = ScheduleDetailPeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($cs_detail);
}
$cs_detail->setId($this->getRequestParameter('id'));
$cs_detail->setScheduleId($schedule->getId());
$cs_detail->setDay($this->getRequestParameter('day'));
$cs_detail->setClassSessionId($this->getRequestParameter('class_session_id'));
$cs_detail->setLocationId($this->getRequestParameter('location_id'));
$cs_detail->save();
return $this->redirect('extracurricular/edit?id=' . $schedule->getId());
}
示例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');
$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());
}
示例14: 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');
$params = array();
foreach (explode('&', $this->getRequestParameter('month_list_ser')) as $p) {
$p = explode('=', $p);
$params[rawurldecode($p[0])][] = rawurldecode($p[1]);
}
if (array_key_exists('months', $params)) {
foreach ($params['months'] as $month_id) {
$payment_student = new PaymentJournal();
$student = StudentPeer::retrieveByPK($this->getRequestParameter('student_id'));
$c = new Criteria();
$c->add(StudentTypePeer::STUDENT_ID, $student->getId());
$stu_type = StudentTypePeer::doSelectOne($c);
$cr = new Criteria();
$cton1 = $cr->getNewCriterion(AcademicCostPeer::PAYER_TYPE_ID, $stu_type->getPayerTypeId(), Criteria::IN);
$cton2 = $cr->getNewCriterion(AcademicCostPeer::ACADEMIC_PROCESS_ID, 2, Criteria::IN);
$cton3 = $cr->getNewCriterion(AcademicCostPeer::ACADEMIC_CALENDAR_ID, $student->getAcademicCalendarId(), Criteria::IN);
$cton4 = $cr->getNewCriterion(AcademicCostPeer::ACADEMIC_CALENDAR_ID, $student->getAcademicCalendar()->getParent(), Criteria::IN);
$cton3->addOr($cton4);
$cton2->addAnd($cton3);
$cton1->addAnd($cton2);
$cr->add($cton1);
$ac_cost = AcademicCostPeer::doSelectOne($cr);
$payment_student->setPayer($this->getRequestParameter('student_id'));
$payment_student->setAcademicCostId($ac_cost->getId());
$payment_student->setAcademicProcessId($ac_cost->getAcademicProcessId());
$payment_student->setAmount($ac_cost->getAmount());
$payment_student->setPaid($ac_cost->getAmount());
$payment_student->setReceivable($ac_cost->getAmount() - $ac_cost->getAmount());
$payment_student->setPaidAt($this->getRequestParameter('paid_at'));
$payment_student->setPayerType(PaymentJournal::PAYER_TYPE_STUDENT);
$payment_student->setPaymentModelId($this->getRequestParameter('payment_model_id'));
$payment_student->setYear($this->getRequestParameter('year'));
$payment_student->setMonth($month_id);
$payment_student->setStatus('S');
$payment_student->save();
$amount_changed = $ac_cost->getAmount();
if ($amount_changed != 0) {
$ph = new PaymentHistory();
$ph->setPaymentJournal($payment_student);
$ph->setAmount($amount_changed);
$ph->save();
}
}
}
return $this->redirect('payment_student/list');
#return $this->forward('payment_student', 'preview?student_id='.$this->getRequestParameter('student_id').'&paid_at='.$this->getRequestParameter('paid_at').'&payment_model_id='.$this->getRequestParameter('payment_model_id').'&year='.$this->getRequestParameter('year'));
#return $this->redirect('payment_student/preview?student_id='.$this->getRequestParameter('student_id').'&paid_at='.$this->getRequestParameter('paid_at').'&payment_model_id='.$this->getRequestParameter('payment_model_id').'&year='.$this->getRequestParameter('year'));
#return $this->redirect('payment_student/list',
# 'before'=>"window.open('".$this->getController()->genUrl('/payment_student/printForm').
# "?student_id='+$('student_id').value+'&paid_at='+$('paid_at').value+'&payment_model_id='+$('payment_model_id').value+'&year='+$('year').value,
# 'link',
# 'height=480,width=640,toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,directories=no,status=no'
# )")
}
示例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')) {
$counseling_spec = new CounselingSpec();
} else {
$counseling_spec = CounselingSpecPeer::retrieveByPk($this->getRequestParameter('id'));
$this->forward404Unless($counseling_spec);
}
$counseling_spec->setId($this->getRequestParameter('id'));
$counseling_spec->setCode($this->getRequestParameter('code'));
$counseling_spec->setParent($this->getRequestParameter('parent'));
$counseling_spec->setDescription($this->getRequestParameter('description'));
$counseling_spec->save();
return $this->redirect('counseling_spec/list');
}