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)));
     }
 }
 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;
 }
 /**
  * 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;
 }
 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');
 }
 /**
  * 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');
         }
     }
 }
Beispiel #6
0
 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);
 }
Beispiel #7
0
 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');
 }
Beispiel #8
0
 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');
 }
 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');
 }
Beispiel #10
0
 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');
 }
 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');
 }
Beispiel #12
0
 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');
 }
Beispiel #13
0
 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');
 }
 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');
 }
Beispiel #15
0
 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');
 }
Beispiel #16
0
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod('post') || $request->isMethod('put'));
     $this->forward404Unless($blog_article = BlogArticlePeer::retrieveByPk($request->getParameter('id')), sprintf('Object blog_article does not exist (%s).', $request->getParameter('id')));
     $this->form = new BlogArticleForm($blog_article);
     $this->processForm($request, $this->form);
     $this->setTemplate('edit');
 }
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($solicitud_carrera = Doctrine_Core::getTable('Solicitud_Carrera')->find(array($request->getParameter('id'))), sprintf('Object solicitud_carrera does not exist (%s).', $request->getParameter('id')));
     $this->form = new Solicitud_CarreraForm($solicitud_carrera);
     $this->processForm($request, $this->form);
     $this->setTemplate('edit');
 }
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($partum_artificium_player = Doctrine::getTable('PartumArtificiumPlayer')->find(array($request->getParameter('id'))), sprintf('Object partum_artificium_player does not exist (%s).', $request->getParameter('id')));
     $this->form = new PartumArtificiumPlayerForm($partum_artificium_player);
     $this->processForm($request, $this->form);
     $this->setTemplate('edit');
 }
Beispiel #19
0
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($area_interesse = Doctrine::getTable('AreaInteresse')->find(array($request->getParameter('id'))), sprintf('Object area_interesse does not exist (%s).', $request->getParameter('id')));
     $this->form = new AreaInteresseForm($area_interesse);
     $this->processForm($request, $this->form);
     $this->setTemplate('edit');
 }
Beispiel #20
0
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($sf_guard_permission = Doctrine_Core::getTable('sfGuardPermission')->find(array($request->getParameter('id'))), sprintf('Object sf_guard_permission does not exist (%s).', $request->getParameter('id')));
     $this->form = new sfGuardPermissionForm($sf_guard_permission);
     $this->processForm($request, $this->form);
     $this->setTemplate('edit');
 }
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($rt_shop_promotion = Doctrine::getTable('rtShopPromotion')->find(array($request->getParameter('id'))), sprintf('Object rt_shop_promotion does not exist (%s).', $request->getParameter('id')));
     $this->form = new rtShopPromotionForm($rt_shop_promotion);
     $this->processForm($request, $this->form);
     $this->setTemplate('edit');
 }
Beispiel #22
0
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($ei_task_assignment = Doctrine_Core::getTable('EiTaskAssignment')->find(array($request->getParameter('task_id'), $request->getParameter('author_id'))), sprintf('Object ei_task_assignment does not exist (%s).', $request->getParameter('task_id'), $request->getParameter('author_id')));
     $this->form = new EiTaskAssignmentForm($ei_task_assignment);
     $this->processForm($request, $this->form);
     $this->setTemplate('edit');
 }
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($activity_type = Doctrine_Core::getTable('ActivityType')->find(array($request->getParameter('activity_type_id'))), sprintf('Object activity_type does not exist (%s).', $request->getParameter('activity_type_id')));
     $this->form = new ActivityTypeForm($activity_type);
     $this->processForm($request, $this->form);
     $this->setTemplate('edit');
 }
Beispiel #24
0
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($transport_load = Doctrine::getTable('TransportLoad')->find(array($request->getParameter('id'))), sprintf('Object transport_load does not exist (%s).', $request->getParameter('id')));
     $this->form = new TransportLoadForm($transport_load);
     $this->processForm($request, $this->form);
     $this->setTemplate('edit');
 }
Beispiel #25
0
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod('post') || $request->isMethod('put'));
     $this->forward404Unless($product = Doctrine::getTable('Product')->find(array($request->getParameter('id'))), sprintf('Object product does not exist (%s).', array($request->getParameter('id'))));
     $this->form = new ProductForm($product);
     $this->processForm($request, $this->form);
     $this->setTemplate('edit');
 }
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($nj_user_profile = Doctrine_Core::getTable('NjUserProfile')->find(array($request->getParameter('id'))), sprintf('Object nj_user_profile does not exist (%s).', $request->getParameter('id')));
     $this->form = new NjUserProfileForm($nj_user_profile);
     $this->processForm($request, $this->form);
     $this->setTemplate('edit');
 }
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($JobeetJob = JobeetJobPeer::retrieveByPk($request->getParameter('id')), sprintf('Object JobeetJob does not exist (%s).', $request->getParameter('id')));
     $this->form = new JobeetJobForm($JobeetJob);
     $this->processForm($request, $this->form);
     $this->setTemplate('edit');
 }
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($book_category = Doctrine_Core::getTable('BookCategory')->find(array($request->getParameter('category_id'))), sprintf('Object book_category does not exist (%s).', $request->getParameter('category_id')));
     $this->form = new BookCategoryForm($book_category);
     $this->processForm($request, $this->form);
     $this->setTemplate('edit');
 }
Beispiel #29
0
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $this->forward404Unless($scss_troop_enrollment = Doctrine_Core::getTable('ScssTroopEnrollment')->find(array($request->getParameter('id'))), sprintf('Object scss_troop_enrollment does not exist (%s).', $request->getParameter('id')));
     $this->form = new ScssTroopEnrollmentForm($scss_troop_enrollment);
     $this->processForm($request, $this->form);
     $this->setTemplate('edit');
 }
 public function executeUpdate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST) || $request->isMethod(sfRequest::PUT));
     $rt_blog_page = $this->getrtBlogPage($request);
     $this->form = new rtBlogPageForm($rt_blog_page);
     $this->processForm($request, $this->form);
     $this->setTemplate('edit');
 }