示例#1
0
 public static function getList(&$params)
 {
     // Get the dbo
     $db = JFactory::getDbo();
     // Get an instance of the generic tracks model
     $model = JModelLegacy::getInstance('Sections', 'PlayjoomModel', array('ignore_request' => true));
     // Set application parameters in model
     $app = JFactory::getApplication();
     $appParams = $app->getParams();
     $model->setState('params', $appParams);
     // Set the filters based on the module params
     $model->setState('list.start', 0);
     $model->setState('list.limit', (int) $params->get('count', 5));
     // Access filter
     $access = !JComponentHelper::getParams('com_playjoom')->get('show_noauth', 1);
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $ordering = 'a.access_datetime';
     $dir = 'DESC';
     $model->setState('list.ordering', $ordering);
     $model->setState('list.direction', $dir);
     $items = $model->getItems();
     //create item link
     foreach ($items as &$item) {
         //Check for Trackcontrol
         if (JPluginHelper::isEnabled('playjoom', 'trackcontrol') == false) {
             $item->link = null;
         } else {
             $item->link = JRoute::_('index.php?option=com_playjoom&view=broadcast&id=' . $item->id);
         }
         $item->accessinfo = modLastPlayedHelper::GetTimeInfoList($item->access_datetime, $params, 'access');
     }
     return $items;
 }