本文整理汇总了PHP中sfWebRequest::isMethod方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWebRequest::isMethod方法的具体用法?PHP sfWebRequest::isMethod怎么用?PHP sfWebRequest::isMethod使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfWebRequest
的用法示例。
在下文中一共展示了sfWebRequest::isMethod方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeQuery
public function executeQuery(sfWebRequest $request)
{
if ($request->isXmlHttpRequest()) {
if ($request->isMethod(sfRequest::GET)) {
$startDate = $request->getGetParameter('startDate');
$endDate = $request->getGetParameter('endDate');
$page = $request->getGetParameter('page');
$start = $request->getGetParameter('start');
$limit = $request->getGetParameter('limit');
$this->convertParamToDateTime($startDate);
$this->convertParamToDateTime($endDate);
$result = Doctrine_Core::getTable('Appointment')->getBetween($startDate, $endDate);
$response = $this->buildResponse($result, "Loading Record");
} else {
if ($request->isMethod(sfRequest::POST)) {
$form_data = json_decode(file_get_contents('php://input'));
$location = $form_data->loc;
$title = $form_data->title;
$notes = $form_data->notes;
$url = $form_data->url;
$reminder = $form_data->rem;
$cid = $form_data->cid;
$startDate = str_replace('T', ' ', $form_data->start);
$endDate = str_replace('T', ' ', $form_data->end);
$this->convertParamToDateTime($startDate, 'Y-m-d H:i:s');
$this->convertParamToDateTime($endDate, 'Y-m-d H:i:s');
$a = new Appointment();
$a->fromArray(array('coach_id' => 1, 'client_id' => 1, 'calendar_type_id' => $cid, 'scheduled' => $startDate, 'started_at' => $startDate, 'finished_at' => $endDate, 'title' => $title, 'location' => $location, 'notes' => $notes, 'web_link' => $url, 'reminder' => $reminder));
$a->save();
$response = $this->buildResponse($a, "Creating Record");
} else {
if ($request->isMethod(sfRequest::PUT)) {
$form_data = json_decode(file_get_contents('php://input'));
$location = $form_data->loc;
$title = $form_data->title;
$notes = $form_data->notes;
$url = $form_data->url;
$reminder = $form_data->rem;
$cid = $form_data->cid;
$startDate = str_replace('T', ' ', $form_data->start);
$endDate = str_replace('T', ' ', $form_data->end);
$this->convertParamToDateTime($startDate, 'Y-m-d H:i:s');
$this->convertParamToDateTime($endDate, 'Y-m-d H:i:s');
$a = Doctrine_Core::getTable('Appointment')->find(array($request->getParameter('id')));
$a->fromArray(array('coach_id' => 1, 'client_id' => 1, 'calendar_type_id' => $cid, 'scheduled' => $startDate, 'started_at' => $startDate, 'finished_at' => $endDate, 'title' => $title, 'location' => $location, 'notes' => $notes, 'web_link' => $url, 'reminder' => $reminder));
$a->save();
$response = $this->buildResponse($a, "Updating Record");
} else {
if ($request->isMethod(sfRequest::DELETE)) {
$app = Doctrine_Core::getTable('Appointment')->find(array($request->getParameter('id')));
$app->delete();
$response = array('success' => true, 'message' => 'Destroyed Record', 'data' => array());
}
}
}
}
sfConfig::set('sf_web_debug', false);
return $this->renderPartial('global/ajax', array('ajax' => json_encode($response)));
}
}
示例2: executeIndex
public function executeIndex(sfWebRequest $request)
{
if ($this->memberExist()) {
$this->setTemplate('exist');
return sfView::SUCCESS;
}
$this->form = new MemberForm();
if ($request->isMethod('get')) {
$mixi = new MixiAppMobileApi();
$person = $mixi->get(sfConfig::get('sf_opensocial_person_api') . '?fields=birthday,gender');
$this->form->setDefault('name', $person->entry->nickname);
$this->form->setDefault('gender', $this->convertGender($person->entry->gender));
$this->form->setDefault('age', $this->convertAge($person->entry->birthday));
}
if ($request->isMethod('post')) {
$this->form->bind($request->getParameterHolder()->getAll());
if ($this->getRequestParameter('adjustment') == '' && $this->form->isValid()) {
$this->display_gender = MemberForm::$sexs[$this->getRequestParameter('gender')];
//var_dump(MemberForm::$sexs[$this->getRequestParameter('gender')]);
//$this->display_form = MemberForm::$sexs[$this->getRequestParameter('gender')];
$this->form->freeze();
$this->setTemplate('confirm');
}
}
return sfView::SUCCESS;
}
示例3: executeCreate
/**
* Display comment form incase of validation issues
*
* @param sfWebRequest $request
*/
public function executeCreate(sfWebRequest $request)
{
$this->rating_enabled = $request->hasParameter('rating_enabled') ? $request->getParameter('rating_enabled') : false;
$form = $this->getForm($this->rating_enabled);
if ($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT)) {
$form->bind($request->getParameter($form->getName()));
if ($form->isValid()) {
if (sfConfig::get('app_rt_comment_moderation', false)) {
$form->save();
$this->notifyAdministrator($form->getObject());
} else {
$form->getObject()->setIsActive(true);
$form->save();
$routes = $this->getContext()->getRouting()->getRoutes();
$route_name = Doctrine_Inflector::tableize($form->getObject()->getModel()) . '_show';
if (isset($routes[$route_name])) {
$target_object = $form->getObject()->getObject();
$cache_class = $form->getObject()->getModel() . 'CacheToolkit';
if (class_exists($cache_class)) {
call_user_func($cache_class . '::clearCache', $target_object);
}
$this->redirect($this->getContext()->getRouting()->generate($route_name, $target_object));
}
}
$this->redirect(sprintf('rtComment/saved?model=%s&model_id=%s', $form->getObject()->getModel(), $form->getObject()->getModelId()));
} else {
$this->getUser()->setFlash('default_error', true, false);
}
}
$this->form = $form;
}
示例4: executeUpdate
public function executeUpdate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod('post') || $request->isMethod('put'));
$this->forward404Unless($course = CoursePeer::retrieveByPk($request->getParameter('id')), sprintf('Object course does not exist (%s).', $request->getParameter('id')));
$values = array('edit' => 'true');
$this->form = new CourseForm($course, $values);
$c = new Criteria();
$c->add(CourseDetailPeer::COURSE_ID, $request->getParameter('id'));
$courseDetail = CourseDetailPeer::doSelectOne($c);
if ($courseDetail !== null) {
$this->form2 = new CourseDetailForm($courseDetail);
} else {
$this->form2 = new CourseDetailForm(new CourseDetail());
}
$c2 = new Criteria();
$c2->add(CourseDetailPeer::COURSE_ID, $request->getParameter('id'));
$courseDisAssoc = CourseDisciplineAssociationPeer::doSelectOne($c2);
if ($courseDisAssoc !== null) {
$this->form3 = new CourseDisciplineAssociationForm($courseDisAssoc);
} else {
$this->form3 = new CourseDisciplineAssociationForm(new CourseDisciplineAssociation());
}
$this->submitForm($request, $this->form, $this->form2, $this->form3);
//at this point the save has failed
$c = new Criteria();
//$c->addSelectColumn(CoursePeer::ID);
$this->course_list = $this->getCourselist($c);
$this->setTemplate('index');
}
示例5: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
$this->form = new ProfileForm();
$this->getProFileMySelf();
$this->getProfile($this->profileMySelf['profile']['m_id']);
if ($request->isMethod('get')) {
foreach ($this->profile as $value) {
if ($value['m_id']) {
$this->form->setDefault('name', $value['name']);
$this->form->setDefault('age', str_replace("代", "", $value['age']));
$this->form->setDefault('gender', $this->convertGender($value['gender']));
$this->form->setDefault('introduction', $value['introduction']);
$this->form->setDefault('from1', $value['from1']);
$this->form->setDefault('from2', $value['from2']);
$this->form->setDefault('from3', $value['from3']);
$this->form->setDefault('from4', $value['from4']);
$this->form->setDefault('from5', $value['from5']);
$this->form->setDefault('to1', $value['to1']);
$this->form->setDefault('to2', $value['to2']);
$this->form->setDefault('to3', $value['to3']);
$this->form->setDefault('to4', $value['to4']);
$this->form->setDefault('to5', $value['to5']);
}
}
}
if ($request->isMethod('post')) {
$this->form->bind($request->getParameterHolder()->getAll());
if ($this->form->isValid()) {
$this->updateProfile($request);
}
if ($this->form->isValid()) {
$this->setTemplate('submit');
}
}
}
示例6: executeUpdate
public function executeUpdate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
$this->forward404Unless($dp = Doctrine::getTable('Dp')->find(array($request->getParameter('id'))), sprintf('Object dp does not exist (%s).', $request->getParameter('id')));
$this->form = new DpForm($dp);
$this->processForm($request, $this->form);
}
示例7: executeUpdate
public function executeUpdate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
$this->forward404Unless($ei_subject_author_history = Doctrine_Core::getTable('EiSubjectAuthorHistory')->find(array($request->getParameter('subject_id'), $request->getParameter('new_author'), $request->getParameter('date'))), sprintf('Object ei_subject_author_history does not exist (%s).', $request->getParameter('subject_id'), $request->getParameter('new_author'), $request->getParameter('date')));
$this->form = new EiSubjectAuthorHistoryForm($ei_subject_author_history);
$this->processForm($request, $this->form);
$this->setTemplate('edit');
}
示例8: executeUpdate
public function executeUpdate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
$this->forward404Unless($mensagem = Doctrine::getTable('Mensagem')->find(array($request->getParameter('id'))), sprintf('Object mensagem does not exist (%s).', $request->getParameter('id')));
$this->form = $this->getUser()->hasCredential('aluno') ? new MensagemAlunoForm($mensagem) : new MensagemProfessorForm($mensagem);
$this->processForm($request, $this->form);
$this->setTemplate('edit');
}
示例9: executeUpdate
public function executeUpdate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
$this->forward404Unless($encuestado_sanciones = Doctrine::getTable('EncuestadoSanciones')->find(array($request->getParameter('id'))), sprintf('Object encuestado_sanciones does not exist (%s).', $request->getParameter('id')));
$this->form = new EncuestadoSancionesForm($encuestado_sanciones);
$this->processForm($request, $this->form);
$this->setTemplate('edit');
}
示例10: executeUpdate
public function executeUpdate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
$this->forward404Unless($blog_post = Doctrine::getTable('BlogPost')->find(array($request->getParameter('id'))), sprintf('Object blog_post does not exist (%s).', $request->getParameter('id')));
$this->form = new BlogPostForm($blog_post);
$this->processForm($request, $this->form);
$this->setTemplate('edit');
}
示例11: executeUpdate
public function executeUpdate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
$this->forward404Unless($vehiculo = Doctrine_Core::getTable('vehiculo')->find(array($request->getParameter('id'))), sprintf('Object vehiculo does not exist (%s).', $request->getParameter('id')));
$this->form = new vehiculoForm($vehiculo);
$this->processForm($request, $this->form);
$this->setTemplate('edit');
}
示例12: executeUpdate
public function executeUpdate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod('post') || $request->isMethod('put'));
$this->forward404Unless($contact_request = ContactRequestPeer::retrieveByPk($request->getParameter('id')), sprintf('Object contact_request does not exist (%s).', $request->getParameter('id')));
$this->form = new ContactRequestForm($contact_request);
$this->processForm($request, $this->form);
$this->setTemplate('edit');
}
示例13: executeUpdate
public function executeUpdate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
$this->forward404Unless($miembro_celula = Doctrine_Core::getTable('MiembroCelula')->find(array($request->getParameter('id'))), sprintf('Object miembro_celula does not exist (%s).', $request->getParameter('id')));
$this->form = new MiembroCelulaForm($miembro_celula);
$this->processForm($request, $this->form);
$this->setTemplate('edit');
}
示例14: executeEstadosModificar
public function executeEstadosModificar(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod('post') || $request->isMethod('put'));
$this->forward404Unless($estado = Doctrine_Core::getTable('Estado')->find($request->getParameter('id')), sprintf('Object estado does not exist (%s).', $request->getParameter('id')));
$this->form = new EstadoForm($estado);
$this->processForm($request, $this->form);
$this->setTemplate('estadosEditar');
}
示例15: executeUpdate
public function executeUpdate(sfWebRequest $request)
{
$this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
$this->forward404Unless($profile = Doctrine_Core::getTable('profile')->findOneByUsername($this->getUser()->getAttribute('username')));
$this->form = new profileForm($profile);
$this->processForm($request, $this->form, $profile);
$this->setTemplate('edit');
}