コード例 #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;
 }
コード例 #2
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;
     }
 }
コード例 #3
0
 /**
  * タクトモ会員登録
  * 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;
 }
コード例 #4
0
 static function init()
 {
     if (isset($_GET['opensocial_app_id'])) {
         self::$appId = $_GET['opensocial_app_id'];
     }
     if (isset($_GET['opensocial_owner_id'])) {
         self::$ownerId = $_GET['opensocial_owner_id'];
     }
     self::$consumer = new OAuthConsumer(self::$consumerKey, self::$consumerSecret, null);
 }
コード例 #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();
         }
     }
 }
コード例 #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;
             }
         }
     }
 }
コード例 #7
0
 public function executeToSubmit(sfWebRequest $request)
 {
     $mixi = new MixiAppMobileApi();
     $mixi->post(sfConfig::get('sf_opensocial_persistence_api'), array('to_address' => $request->getParameter('address'), 'to_lon' => $request->getParameter('lon'), 'to_lat' => $request->getParameter('lat')));
     header("Location: " . sfConfig::get('sf_mixi_search_event_url'));
     exit;
 }