当前位置: 首页>>代码示例>>PHP>>正文


PHP Widgets::getWidget方法代码示例

本文整理汇总了PHP中Widgets::getWidget方法的典型用法代码示例。如果您正苦于以下问题:PHP Widgets::getWidget方法的具体用法?PHP Widgets::getWidget怎么用?PHP Widgets::getWidget使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Widgets的用法示例。


在下文中一共展示了Widgets::getWidget方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: indexAction

 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;
     }
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:26,代码来源:TagsController.php

示例2: indexAction

 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;
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:33,代码来源:LastcommentsController.php

示例3: indexAction

 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}";
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:29,代码来源:BioController.php

示例4: indexAction

 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');
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:16,代码来源:CustomController.php

示例5: deleteAction

 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);
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:18,代码来源:WidgetsController.php

示例6: indexAction

 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;
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:39,代码来源:LinksController.php

示例7: indexAction

 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');
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:23,代码来源:ArchivesController.php

示例8: indexAction

 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;
 }
开发者ID:kreativmind,项目名称:storytlr,代码行数:23,代码来源:MembersgfcController.php

示例9: indexAction

 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";
 }
开发者ID:vicox,项目名称:storytlr,代码行数:24,代码来源:RsslinkController.php


注:本文中的Widgets::getWidget方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。