private function retieveInfoFromFacebook() { $fb_uid = $this->getFbId(); if ($fb_uid) { $ret = sfFacebook::getFacebookApi()->users_getInfo(array($fb_uid), array('name', 'first_name', 'last_name', 'pic_small')); $this->fbInfoArray = $ret[0]; $this->isSet = true; $this->setAttribute('user_info', $ret[0]); $this->setAttribute('has_facebook_info', true); } $this->fbInfoArray = $this->getAttribute('user_info'); return $this->fbInfoArray; }
protected function execute($arguments = array(), $options = array()) { // initialize the database connection $databaseManager = new sfDatabaseManager($this->configuration); $connection = $databaseManager->getDatabase($options['connection'] ? $options['connection'] : null)->getConnection(); $one_line_story_templates = array(); $one_line_story_templates[] = '{*actor*} got a {*score*} score on his <a href="http://apps.facebook.com/symfony-quiz">Symfony quiz</a> ! Try to beat {*actor*} : take the <a href="http://apps.facebook.com/symfony-quiz">quiz</a> !'; $short_story_templates = array(); $short_story_templates[] = array('template_title' => '{*actor*} got a {*score*} score on his <a href="http://apps.facebook.com/symfony-quiz">Symfony quiz</a> !', 'template_body' => 'Test your symfony skills, know how good you are and try to beat {*actor*} : take the <a href="http://apps.facebook.com/symfony-quiz">quiz</a> !'); $full_story_template = null; $action_links = array(); $action_links[] = array('text' => 'Take the quiz directly', 'href' => 'http://apps.facebook.com/symfony-quiz/questions/createTest'); $action_links[] = array('text' => 'Go to the quiz homepage', 'href' => 'http://apps.facebook.com/symfony-quiz'); echo sfFacebook::getFacebookApi()->feed_registerTemplateBundle($one_line_story_templates, $short_story_templates, null, $action_links); }
function run_facebook_register_feed($task, $args) { if (!count($args)) { throw new Exception('You must provide an application.'); } $app = $args[0]; define('SF_ROOT_DIR', sfConfig::get('sf_root_dir')); define('SF_APP', $app); require_once SF_ROOT_DIR . DIRECTORY_SEPARATOR . 'apps' . DIRECTORY_SEPARATOR . SF_APP . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'config.php'; $one_line_story_templates = array(); $one_line_story_templates[] = '{*actor*} va voir le match {*match*} au bar {*bar*} {*date*} !'; $short_story_templates = array(); $short_story_templates[] = array('template_title' => '{*actor*} va voir le match {*match*} au bar {*bar*}!', 'template_body' => '{*actor*} va supporter {*team*} au bar {*bar*} {*date*}.'); $full_story_template = null; $action_links = array(); $action_links[] = array('text' => 'Trouve des bars qui diffusent le match {*match*}', 'href' => 'http://www.allomatch.com/{*match-path*}'); $action_links[] = array('text' => 'Plus d\'infos sur le bar {*bar*}', 'href' => 'http://www.allomatch.com/{*bar-path*}'); echo sfFacebook::getFacebookApi()->feed_registerTemplateBundle($one_line_story_templates, $short_story_templates, null, $action_links); }
public function executeImport(sfWebRequest $request) { $users_infos = sfFacebook::getFacebookApi()->users_getInfo(array(sfFacebook::getAnyFacebookUid()), array('pic', 'email', 'email_hashes', 'name')); $form = new RegistrationFacebookForm(array(), array(), false); $bind = $this->mapToBindArray($users_infos[0]); if (!($user = Doctrine::getTable('PublicUser')->findOneByEmail($users_infos[0]['email']))) { $form->bind($bind, array()); if ($form->isValid()) { $user = $form->save(); } else { $schema = $form->getErrorSchema(); foreach ($schema as $index => $err) { echo $index . " " . $err; } } } $this->getUser()->authAs($user); $this->redirect($this->getComponent('linker', 'localizedHomepage')); return sfView::NONE; }
/** * Gets information about the user * * @param array $fields * @return array */ public function getInfos($fields) { $users_infos = sfFacebook::getFacebookApi()->users_getInfo(array($this->getCurrentFacebookUid()), $fields); return reset($users_infos); }