コード例 #1
0
ファイル: Builder.php プロジェクト: pashakiz/crowdf
 /**
  * Build a social profile object.
  *
  * <code>
  * $options = array(
  *    "social_platform" => "socialcommunity",
  *    "user_id" => 1
  * );
  *
  * $notificationBuilder = new Prism\Integration\Notification\Builder($options);
  * $notificationBuilder->build();
  *
  * $notification = $notificationBuilder->getNotification();
  * </code>
  */
 public function build()
 {
     $type = ArrayHelper::getValue($this->config, "social_platform");
     $userId = ArrayHelper::getValue($this->config, "user_id");
     $url = ArrayHelper::getValue($this->config, "url");
     $image = ArrayHelper::getValue($this->config, "image");
     $title = ArrayHelper::getValue($this->config, "title");
     switch ($type) {
         case "socialcommunity":
             $notification = new SocialCommunity($userId);
             $notification->setUrl($url);
             $notification->setImage($image);
             break;
         case "gamification":
             $notification = new Gamification($userId);
             $notification->setTitle($title);
             $notification->setUrl($url);
             $notification->setImage($image);
             break;
         case "jomsocial":
             // Register JomSocial Router
             if (!class_exists("CRoute")) {
                 \JLoader::register("CRoute", JPATH_SITE . "/components/com_community/libraries/core.php");
             }
             $notification = new JomSocial($userId);
             $notification->setDb(\JFactory::getDbo());
             break;
         case "easysocial":
             $notification = new EasySocial($userId);
             $notification->setDb(\JFactory::getDbo());
             break;
         default:
             $notification = null;
             break;
     }
     $this->notification = $notification;
 }
コード例 #2
0
 /**
  * Build a social profile object.
  *
  * <code>
  * $options = array(
  *    "social_platform" => "socialcommunity",
  *    "user_id" => 1
  * );
  *
  * $notificationBuilder = new Prism\Integration\Notification\Builder($options);
  * $notificationBuilder->build();
  *
  * $notification = $notificationBuilder->getNotification();
  * </code>
  */
 public function build()
 {
     $type = ArrayHelper::getValue($this->config, 'social_platform');
     $userId = ArrayHelper::getValue($this->config, 'user_id');
     $url = ArrayHelper::getValue($this->config, 'url');
     $image = ArrayHelper::getValue($this->config, 'image');
     $title = ArrayHelper::getValue($this->config, 'title');
     switch ($type) {
         case 'socialcommunity':
             $notification = new SocialCommunity($userId);
             $notification->setUrl($url);
             $notification->setImage($image);
             break;
         case 'gamification':
             $notification = new Gamification($userId);
             $notification->setTitle($title);
             $notification->setUrl($url);
             $notification->setImage($image);
             break;
         case 'jomsocial':
             // Register JomSocial Router
             if (!class_exists('CRoute')) {
                 \JLoader::register('CRoute', JPATH_SITE . '/components/com_community/libraries/core.php');
             }
             $notification = new JomSocial($userId);
             $notification->setDb(\JFactory::getDbo());
             break;
         case 'easysocial':
             $notification = new EasySocial($userId);
             $notification->setDb(\JFactory::getDbo());
             break;
         default:
             $notification = null;
             break;
     }
     $this->notification = $notification;
 }