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; } }
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; }
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}"; }
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'); }
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); }
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; }
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'); }
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; }
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"; }