Ejemplo n.º 1
0
 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;
 }
Ejemplo n.º 2
0
 public function executeList(sfWebRequest $request)
 {
     //mixiサーバから値取得
     if ($request->isMethod('get')) {
         $mixi = new MixiAppMobileApi();
         $persistence = $mixi->get(sfConfig::get('sf_opensocial_persistence_api'));
         $mixi_persistence = $persistence->entry->{'mixi.jp:' . MixiAppMobileApi::$ownerId};
         $request->setParameter('to_address', $mixi_persistence->to_address);
         $request->setParameter('to_lon', $mixi_persistence->to_lon);
         $request->setParameter('to_lat', $mixi_persistence->to_lat);
         $request->setParameter('from_address', $mixi_persistence->from_address);
         $request->setParameter('from_lon', $mixi_persistence->from_lon);
         $request->setParameter('from_lat', $mixi_persistence->from_lat);
         $request->setParameter('category', $mixi_persistence->category);
         $request->setParameter('depart_date', array('year' => $mixi_persistence->depart_year, 'month' => $mixi_persistence->depart_month, 'day' => $mixi_persistence->depart_day));
         $request->setParameter('depart_time', array('hour' => $mixi_persistence->depart_hour, 'minute' => $mixi_persistence->depart_min));
     } else {
         if ($request->isMethod('post')) {
             //mixiサーバに値設定
             $depart_date = $this->getRequestParameter('depart_date');
             $depart_time = $this->getRequestParameter('depart_time');
             $mixi = new MixiAppMobileApi();
             $mixi->post(sfConfig::get('sf_opensocial_persistence_api'), array('to_address' => $this->getRequestParameter('to_address'), 'to_lon' => $this->getRequestParameter('to_lon'), 'to_lat' => $this->getRequestParameter('to_lat'), 'from_address' => $this->getRequestParameter('from_address'), 'from_lon' => $this->getRequestParameter('from_lon'), 'from_lat' => $this->getRequestParameter('from_lat'), 'category' => $this->getRequestParameter('category'), 'depart_year' => $depart_date['year'], 'depart_month' => $depart_date['month'], 'depart_day' => $depart_date['day'], 'depart_hour' => $depart_time['hour'], 'depart_min' => $depart_time['minute']));
         }
     }
     //タクトモAPIにアクセス
     $this->form = new SearchDriverForm();
     $b = new sfWebBrowser();
     $this->from_address = $this->getRequestParameter('from_address');
     $this->to_address = $this->getRequestParameter('to_address');
     $this->form->bind($request->getParameterHolder()->getAll());
     if ($this->form->isValid()) {
         $this->display_category = SearchDriverForm::$categories[$this->getRequestParameter('category')];
         $depart_date = $this->getRequestParameter('depart_date');
         $depart_time = $this->getRequestParameter('depart_time');
         $b->post(sfConfig::get('sf_takutomo_search_driver_url'), array('from_address' => $this->getRequestParameter('from_address'), 'from_lat' => $this->getRequestParameter('from_lat'), 'from_lon' => $this->getRequestParameter('from_lon'), 'to_address' => $this->getRequestParameter('to_address'), 'to_lat' => $this->getRequestParameter('to_lat'), 'to_lon' => $this->getRequestParameter('to_lon'), 'depart_date' => $depart_date['year'] . sprintf('%02d', $depart_date['month']) . sprintf('%02d', $depart_date['day']), 'depart_hour' => $depart_time['hour'], 'depart_min' => sprintf('%02d', $depart_time['minute']), 'category' => $this->display_category));
         $xml = new SimpleXMLElement($b->getResponseText());
         //print $b->getResponseText();
         //print((string)$xml->status->code);
         if ((int) $xml->status->code >= 1000) {
             $this->form->getErrorSchema()->addError(new sfValidatorError(new sfValidatorPass(), (string) $xml->status->description));
             $this->setTemplate('index');
         } else {
             //xmlを連想配列に変換
             $options = array('complexType' => 'array');
             // print $b->getResponseText();
             $Unserializer = new XML_Unserializer($options);
             $status = $Unserializer->unserialize($b->getResponseText());
             if ($status === true) {
                 $this->list = $Unserializer->getUnserializedData();
                 //print_r($this->list);
             }
         }
         $this->display_description = (string) $xml->status->description;
     } else {
         $this->setTemplate('index');
         //$this->forward("search_driver", "index");
     }
 }
Ejemplo n.º 3
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $invite_member = $request->getParameter('invite_member');
     if (!empty($invite_member)) {
         $tmp = explode(',', $request->getParameter('invite_member'));
         $mixi = new MixiAppMobileApi();
         $list = array();
         foreach ($tmp as $value) {
             $person = $mixi->get(sfConfig::get('sf_opensocial_friend_search_api') . $value);
             if (!empty($person)) {
                 array_push($list, $person->entry->nickname);
             }
         }
         $this->list = $list;
     }
 }
 /**
  * タクトモ会員登録
  * return boolean
  */
 private function memberRegister()
 {
     $mixi = new MixiAppMobileApi();
     $person = $mixi->get(sfConfig::get('sf_opensocial_person_api') . '?fields=birthday,gender');
     $b = new sfWebBrowser();
     $b->post(sfConfig::get('sf_takutomo_register_by_guid_url'), array('guid' => 'mixi,' . MixiAppMobileApi::$ownerId, 'name' => $person->entry->nickname, 'age' => $this->convertAge($person->entry->birthday), 'gender' => $this->convertGender($person->entry->gender), 'introduction' => ''));
     $xml = new SimpleXMLElement($b->getResponseText());
     $moduleArr = array('index', 'member_register', 'forgot_password');
     if ((int) $xml->status->code >= 1000) {
         /*if(array_search(sfContext::getInstance()->getModuleName(),$moduleArr) === false){
                header("Location:".sfConfig::get('sf_mixi_index_url'));
                exit;
           }*/
         return false;
     }
     return true;
 }
Ejemplo n.º 5
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->form = new LoginForm();
     $agent = $this->getContext()->getRequest()->getAttribute('userAgent');
     //print($agent->isDoCoMo());
     // APIのURLなどの詳細は以下を参照。
     // http://developer.mixi.co.jp/appli/appli_mobile/lets_enjoy_making_mixiappmobile/for_partners
     $personApi = 'http://api.mixi-platform.com/os/0.8/people/@me/@self';
     $persistenceApi = 'http://****************************************';
     $mixi = new MixiAppMobileApi();
     // owner(viewer) データ取得
     //print_r($mixi->get($personApi));
     $person = $mixi->get($personApi);
     if ($request->isMethod('post')) {
         $this->form->bind($request->getParameterHolder()->getAll());
         if ($this->getRequestParameter('login') != '' && $this->form->isValid()) {
             $b = new sfWebBrowser();
             $b->post(sfConfig::get('sf_takutomo_get_profile_myself_url'), array('guid' => 'DEBUG,sample_member_001', 'email' => $this->getRequestParameter('email'), 'password' => $this->getRequestParameter('password')));
             $xml = new SimpleXMLElement($b->getResponseText());
             if ((int) $xml->status->code >= 1000) {
                 $this->form->getErrorSchema()->addError(new sfValidatorError(new sfValidatorPass(), (string) $xml->status->description));
             } else {
                 $this->getUser()->setName((string) $xml->profile->name);
                 $this->getUser()->setEmail((string) $xml->profile->email);
                 $this->getUser()->setPassword((string) $xml->profile->password);
                 $this->getUser()->setAuthenticated(true);
                 //$this->redirect("member", "index");
                 //print('index');
                 $this->forward('member', 'index');
                 $this->redirect('http://pontuyo.net/takutomo/web/member');
                 if ($agent->isDoCoMo()) {
                     $this->redirect('member/index?sid=' + SID);
                 } else {
                     $this->redirect('member/index');
                 }
             }
             $this->display_description = (string) $xml->status->description;
             //$this->display_response = (string)$b->getResponseText();
         }
     }
 }
Ejemplo n.º 6
0
 /**
  * Executes index action
  *
  * @param sfRequest $request A request object
  */
 public function executeIndex(sfWebRequest $request)
 {
     $this->form = new ReserveDriverForm();
     $b = new sfWebBrowser();
     $now = strtotime('+15 minute');
     $depart_date = array('year' => date('Y', $now), 'month' => date('n', $now), 'day' => date('j', $now));
     $depart_time = array('hour' => date('G', $now), 'minute' => (int) date('i', $now));
     $b->post(sfConfig::get('sf_takutomo_get_profile_url'), array('id' => $this->getRequestParameter('driver_id')));
     if ((int) $xml->status->code >= 1000) {
         $this->form->getErrorSchema()->addError(new sfValidatorError(new sfValidatorPass(), (string) $xml->status->description));
     } else {
         //xmlを連想配列に変換
         $options = array('complexType' => 'array');
         $Unserializer = new XML_Unserializer($options);
         $status = $Unserializer->unserialize($b->getResponseText());
         $this->member = $Unserializer->getUnserializedData();
     }
     if ($request->isMethod('get')) {
         $mixi = new MixiAppMobileApi();
         $persistence = $mixi->get(sfConfig::get('sf_opensocial_persistence_api'));
         $mixi_persistence = $persistence->entry->{'mixi.jp:' . MixiAppMobileApi::$ownerId};
         $this->form->setDefault('to_address', $mixi_persistence->to_address);
         $this->form->setDefault('to_lon', $mixi_persistence->to_lon);
         $this->form->setDefault('to_lat', $mixi_persistence->to_lat);
         $this->form->setDefault('from_address', $mixi_persistence->from_address);
         $this->form->setDefault('from_lon', $mixi_persistence->from_lon);
         $this->form->setDefault('from_lat', $mixi_persistence->from_lat);
         $this->form->setDefault('depart_date', $depart_date['year'] . sprintf('%02d', $depart_date['month']) . $depart_date['day']);
         $this->form->setDefault('depart_time', $depart_time['hour'] . sprintf('%02d', $depart_time['minute']));
         $this->form->setDefault('driver_m_id', $request->getParameter('driver_id'));
         $this->form->setDefault('phone', $request->getParameter('phone'));
         $request->setParameter('from_address', $mixi_persistence->from_address);
         $request->setParameter('to_address', $mixi_persistence->to_address);
         $request->setParameter('depart_date', $depart_date['year'] . sprintf('%02d', $depart_date['month']) . $depart_date['day']);
         $request->setParameter('depart_time', $depart_time['hour'] . sprintf('%02d', $depart_time['minute']));
     } else {
         if ($request->isMethod('post')) {
             $this->form->bind($request->getParameterHolder()->getAll());
             if ($this->form->isValid()) {
                 $b->post(sfConfig::get('sf_takutomo_reserve_driver_url'), array('guid' => 'DEBUG,sample_member_001', 'email' => $this->getUser()->getEmail(), 'password' => $this->getUser()->getPassword(), 'from_address' => $this->getRequestParameter('from_address'), 'from_lat' => $this->getRequestParameter('from_lat'), 'from_lon' => $this->getRequestParameter('from_lon'), 'to_address' => $this->getRequestParameter('to_address'), 'to_lat' => $this->getRequestParameter('to_lat'), 'to_lon' => $this->getRequestParameter('to_lon'), 'depart_date' => $this->getRequestParameter('depart_date'), 'depart_hour' => substr($this->getRequestParameter('depart_time'), 0, 2), 'depart_min' => substr($this->getRequestParameter('depart_time'), 2, 2), 'driver_m_id' => $request->getParameter('driver_m_id'), 'phone' => $request->getParameter('phone')));
                 $xml = new SimpleXMLElement($b->getResponseText());
                 //print $b->getResponseText();
                 //print((string)$xml->status->code);
                 if ((int) $xml->status->code >= 1000) {
                     $this->form->getErrorSchema()->addError(new sfValidatorError(new sfValidatorPass(), (string) $xml->status->description));
                 } else {
                     //検索条件をsessionに格納
                     $this->getUser()->setToAddress($this->getRequestParameter('to_address'));
                     $this->getUser()->setToLon($this->getRequestParameter('to_lon'));
                     $this->getUser()->setToLat($this->getRequestParameter('to_lat'));
                     $this->getUser()->setFromAddress($this->getRequestParameter('from_address'));
                     $this->getUser()->setFromLon($this->getRequestParameter('from_lon'));
                     $this->getUser()->setFromLat($this->getRequestParameter('from_lat'));
                     $this->setTemplate('submit');
                 }
                 $this->display_description = (string) $xml->status->description;
                 $this->display_phone = (string) $xml->taxi_data->phone;
             }
         }
     }
 }
Ejemplo n.º 7
0
 public function executeList(sfWebRequest $request)
 {
     $addEvnetFlag = false;
     $this->createDepartDate();
     //mixiサーバから値取得
     if ($request->isMethod('get')) {
         $mixi = new MixiAppMobileApi();
         $persistence = $mixi->get(sfConfig::get('sf_opensocial_persistence_api'));
         $mixi_persistence = $persistence->entry->{'mixi.jp:' . MixiAppMobileApi::$ownerId};
         $request->setParameter('to_address', $mixi_persistence->to_address);
         $request->setParameter('to_lon', $mixi_persistence->to_lon);
         $request->setParameter('to_lat', $mixi_persistence->to_lat);
         $request->setParameter('from_address', $mixi_persistence->from_address);
         $request->setParameter('from_lon', $mixi_persistence->from_lon);
         $request->setParameter('from_lat', $mixi_persistence->from_lat);
         //      $depart_date_min = array('year'=>$mixi_persistence->from_year,
         //            'month'=> $mixi_persistence->from_month,
         //            'day'=> $mixi_persistence->from_day,
         //            'hour'=> $mixi_persistence->from_hour,
         //            'minute'=> $mixi_persistence->from_minute);
         //      $depart_date_max = array('year'=>$mixi_persistence->to_year,
         //            'month'=> $mixi_persistence->to_month,
         //            'day'=> $mixi_persistence->to_day,
         //            'hour'=> $mixi_persistence->to_hour,
         //            'minute'=> $mixi_persistence->to_minute);
         //$request->setParameter('depart_time',array('from' =>$depart_date_min,'to' =>$depart_date_max));
     } else {
         if ($request->isMethod('post')) {
             $depart_time = $this->getRequestParameter('depart_time');
             $mixi = new MixiAppMobileApi();
             $mixi->post(sfConfig::get('sf_opensocial_persistence_api'), array('to_address' => $this->getRequestParameter('to_address'), 'to_lon' => $this->getRequestParameter('to_lon'), 'to_lat' => $this->getRequestParameter('to_lat'), 'from_address' => $this->getRequestParameter('from_address'), 'from_lon' => $this->getRequestParameter('from_lon'), 'from_lat' => $this->getRequestParameter('from_lat')));
             if (!($addEvnetFlag = $this->addEvent($request))) {
                 $this->setTemplate('index');
             }
         }
     }
     //タクトモAPIにアクセス
     $this->form = new SearchEventForm();
     $b = new sfWebBrowser();
     $this->from_address = $this->getRequestParameter('from_address');
     $this->to_address = $this->getRequestParameter('to_address');
     $this->form->bind($request->getParameterHolder()->getAll());
     if ($request->isMethod('post') && $addEvnetFlag && $this->form->isValid() || $request->isMethod('get') && $this->form->isValid()) {
         $depart_time = $this->getRequestParameter('depart_time');
         $b->post(sfConfig::get('sf_takutomo_search_event_url'), array('from_address' => $this->getRequestParameter('from_address'), 'from_lat' => $this->getRequestParameter('from_lat'), 'from_lon' => $this->getRequestParameter('from_lon'), 'to_address' => $this->getRequestParameter('to_address'), 'to_lat' => $this->getRequestParameter('to_lat'), 'to_lon' => $this->getRequestParameter('to_lon'), 'depart_time_min' => $this->depart_date_min['year'] . sprintf('%02d', $this->depart_date_min['month']) . sprintf('%02d', $this->depart_date_min['day']) . sprintf('%02d', $this->depart_date_min['hour']) . sprintf('%02d', $this->depart_date_min['minute']), 'depart_time_max' => $this->depart_date_max['year'] . sprintf('%02d', $this->depart_date_max['month']) . sprintf('%02d', $this->depart_date_max['day']) . sprintf('%02d', $this->depart_date_max['hour']) . sprintf('%02d', $this->depart_date_max['minute'])));
         $xml = new SimpleXMLElement($b->getResponseText());
         //print((string)$xml->status->code);
         if ((int) $xml->status->code >= 1000) {
             $this->form->getErrorSchema()->addError(new sfValidatorError(new sfValidatorPass(), (string) $xml->status->description));
         } else {
             if ((int) $xml->summary->num_of_result < 1) {
                 $this->form->getErrorSchema()->addError(new sfValidatorError(new sfValidatorPass(), '一致する条件がありませんでした。'));
             } else {
                 //検索条件をsessionに格納
                 $this->getUser()->setToAddress($this->getRequestParameter('to_address'));
                 $this->getUser()->setToLon($this->getRequestParameter('to_lon'));
                 $this->getUser()->setToLat($this->getRequestParameter('to_lat'));
                 $this->getUser()->setFromAddress($this->getRequestParameter('from_address'));
                 $this->getUser()->setFromLon($this->getRequestParameter('from_lon'));
                 $this->getUser()->setFromLat($this->getRequestParameter('from_lat'));
                 //xmlを連想配列に変換
                 $options = array('complexType' => 'array');
                 $Unserializer = new XML_Unserializer($options);
                 $status = $Unserializer->unserialize($b->getResponseText());
                 if ($status === true) {
                     $this->list = $Unserializer->getUnserializedData();
                     //print_r($this->list);
                 }
                 $this->setTemplate('list');
             }
         }
         $this->display_description = (string) $xml->status->description;
     } else {
         $this->setTemplate('index');
     }
 }