コード例 #1
0
 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title ? $title : "Tag cloud";
     // Get the archives
     $db_tags = new Tags(array(Stuffpress_Db_Table::USER => $widget['user_id']));
     if ($tags = $db_tags->getTopTags(20)) {
         $max = $tags[0]['count'];
         $min = $tags[count($tags) - 1]['count'];
         sort($tags);
         $this->view->tags = $tags;
         $this->view->max = $max;
         $this->view->min = $min;
     }
 }
コード例 #2
0
 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get the last comments
     $comments = new Comments(array(Stuffpress_Db_Table::USER => $widget['user_id']));
     $mycomments = $comments->getLastComments();
     $data = new Data();
     // Prepare the comments for output
     foreach ($mycomments as &$comment) {
         $time = strtotime($comment['timestamp']);
         $item = $data->getItem($comment['source_id'], $comment['item_id']);
         $comment['item'] = $item;
         $comment['when'] = Stuffpress_Date::ago($time, "j M y");
         $comment['comment'] = str_replace("\n", " ", $comment['comment']);
         if (strlen($comment['comment']) > 50) {
             $comment['comment'] = mb_substr($comment['comment'], 0, 47) . "...";
         }
     }
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title ? $title : "Latest comments";
     // Prepare the view for rendering
     $this->view->comments = $mycomments;
 }
コード例 #3
0
 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get the user
     $users = new Users();
     $user = $users->getUser($widget['user_id']);
     // Get all sources configured for that user
     $properties = new Properties(array(Properties::KEY => $user->id));
     // Get the bio data
     // User profile
     $this->view->username = $user->username;
     $this->view->first_name = $properties->getProperty('first_name');
     $this->view->last_name = $properties->getProperty('last_name');
     $this->view->bio = $properties->getProperty('bio');
     $this->view->location = $properties->getProperty('location');
     $this->view->avatar = $properties->getProperty('avatar_image');
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title ? $title : "About {$user->username}";
 }
コード例 #4
0
 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $this->view->title = $properties->getProperty('title');
     $this->view->content = $properties->getProperty('content');
 }
コード例 #5
0
 public function deleteAction()
 {
     // Get, check and setup the parameters
     $widget_id = $this->getRequest()->getParam("id");
     // Do we own the widget ?
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Unknown widget with id {$widget_id}");
     }
     if ($widget['user_id'] != $this->_application->user->id) {
         throw new Stuffpress_AccessDeniedException("Not the owner of widget {$widget_id}");
     }
     $widgets->deleteWidget($widget_id);
     // Delete the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $properties->deleteAllProperties();
     return $this->_helper->json->sendJson(false);
 }
コード例 #6
0
 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get all sources configured for that user
     $sources = new Sources(array(Stuffpress_Db_Table::USER => $widget['user_id']));
     $mysources = $sources->getSources();
     // If sources are configured, get the links for each source
     $links = array();
     if ($mysources) {
         foreach ($mysources as $source) {
             if (!($source['public'] && $source['enabled'])) {
                 continue;
             }
             if ($source['service'] == 'stuffpress') {
                 continue;
             }
             $model = SourceModel::newInstance($source['service']);
             $model->setSource($source);
             $link['prefix'] = $model->getServicePrefix();
             $link['url'] = $model->getServiceURL();
             $link['name'] = $model->getTitle();
             $links[] = $link;
         }
     }
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title ? $title : "My 2.0 Life";
     // Prepare the view for rendering
     $this->view->links = $links;
 }
コード例 #7
0
 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title ? $title : "Archives";
     // Get the archives
     $data = new Data(array(Stuffpress_Db_Table::USER => $widget['user_id']));
     $archives = $data->getItemsPerMonth();
     // Prepare the view for rendering
     $this->view->archives = $archives;
     // Add the required javascript
     $this->view->headScript()->appendFile('js/accordion/init.js');
 }
コード例 #8
0
 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get the user
     $users = new Users();
     $user = $users->getUser($widget['user_id']);
     // Get all sources configured for that user
     $properties = new Properties(array(Properties::KEY => $user->id));
     // Get the friendconnect data
     $this->view->googlefc = $properties->getProperty('googlefc');
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title;
 }
コード例 #9
0
ファイル: RsslinkController.php プロジェクト: vicox/storytlr
 public function indexAction()
 {
     // Get, check and setup the parameters
     if (!($widget_id = $this->getRequest()->getParam("id"))) {
         throw new Stuffpress_Exception("No widget id provided to the widget controller");
     }
     // Verify if the requested widget exist and get its data
     $widgets = new Widgets();
     if (!($widget = $widgets->getWidget($widget_id))) {
         throw new Stuffpress_Exception("Invalid widget id");
     }
     // Get the basename
     $host = trim(Zend_Registry::get("host"), '/');
     // Get the user
     $users = new Users();
     $user = $users->getUser($widget['user_id']);
     $username = $user->username;
     // Get the widget properties
     $properties = new WidgetsProperties(array(Properties::KEY => $widget_id));
     $title = $properties->getProperty('title');
     $this->view->title = $title ? $title : "Subscribe to my lifestream";
     // RSS Link
     $this->view->feed = "http://{$host}/rss/feed.xml";
 }