public function AlbumChart($uri)
 {
     $log = new Logger("./log.txt");
     $request = new ImgRequest($uri);
     if ($request->isMalformed()) {
         $log->logGeneration($request, $hostid, true);
         $log->logString("   ERROR: " . $request->getMalformedString());
         die($request->getMalformedString() . (SITE != '' ? "<br />Please see " . SITE . " for further help" : ""));
     }
     if ($request->getCharttype() == "group") {
         $log->logGeneration($request, $hostid, true);
         $log->logString("   ERROR: Groupcharts disabled");
         die("Groupcharts are no longer supported!");
     }
     $userfeed = new UserFeed($request->getRawusername(), $request);
     $albumlist = new AlbumList();
     $i = 0;
     while (($album = $userfeed->getNextItem()) && $i < $request->getCount()) {
         $albumfeed = new AlbumFeed($album);
         if (!$albumfeed->isValid()) {
             continue;
         }
         $albumlist->addItem($albumfeed->getImageUrl());
         unset($albumfeed);
         $i++;
     }
     $image = new ImgGenerator($albumlist, $request);
     $log->logGeneration($request);
     $output = new Output($image, $request);
     if ($output->getFileExists()) {
         $log->logString("   WARNING: File Existed!");
     }
 }
 public function executeAddFeed()
 {
     sfLoader::loadHelpers('I18N');
     $query = $this->getRequestParameter('q');
     $user_feed = new UserFeed();
     $user_feed->setUserId($this->getUser()->getId());
     $user_feed->setQuery($query);
     $user_feed->save();
     $this->msg = __("User feed is saved with query ':query'.", array(':query' => $query));
     $this->setTemplate('savePreferences');
 }
 /**
  * Get All notifications of a user.
  *
  * @author Kuldeep Dangi <*****@*****.**>
  */
 public function actionGetAllNotifications($userId)
 {
     $model = new Notifications();
     $data = array();
     $notifications = $model->getNotificationByUserId($userId);
     foreach ($notifications as $notification) {
         //print_r($notification); die;
         switch ($notification['type']) {
             case self::NOTIFICATION_TYPE_FOLLOW:
                 $user = Users::model()->findByAttributes(array('user_id' => $notification['byUserId']));
                 if ($user) {
                     $data[] = array('type' => $notification['type'], 'user_id' => $user->user_id, 'username' => $user->username, 'first_name' => $user->firstname, 'last_name' => $user->lastname, 'datetime' => strtotime($notification['created_at']));
                 }
             case self::NOTIFICATION_TYPE_WISHLISTCOMMENT:
                 $user = Users::model()->findByPk($notification['byUserId']);
                 $userFeed = UserFeed::model()->findByPk($notification['notify_comment']);
                 if ($user && $userFeed) {
                     $data[] = array('type' => $notification['type'], 'user_id' => $user->user_id, 'username' => $user->username, 'first_name' => $user->firstname, 'last_name' => $user->lastname, 'datetime' => strtotime($notification['created_at']), 'wishlistId' => $userFeed->user_feed_id, 'wishlistTitle' => $userFeed->comment);
                 }
             case self::NOTIFICATION_TYPE_WISHLISTUPLOAD:
                 $user = Users::model()->findByPk($notification['byUserId']);
                 $userFeed = UserFeed::model()->findByPk($notification['notify_comment']);
                 if ($user && $userFeed) {
                     $data[] = array('type' => $notification['type'], 'user_id' => $user->user_id, 'username' => $user->username, 'first_name' => $user->firstname, 'last_name' => $user->lastname, 'datetime' => strtotime($notification['created_at']), 'noteId' => $notification['notify_extension'], 'wishlistId' => $userFeed->user_feed_id, 'wishlistTitle' => $userFeed->comment);
                 }
         }
     }
     $this->result['success'] = true;
     $this->result['data'] = $data;
     $this->sendResponse($this->result);
 }
Esempio n. 4
0
 /**
  * Load model of a Feed.
  *
  * @author Kuldeep Dangi <*****@*****.**>
  */
 public function loadModel($id)
 {
     $model = UserFeed::model()->findByPk($id);
     return $model;
 }