예제 #1
0
 public static function getContentList(&$params)
 {
     // Get an instance of the generic articles model
     $model = JModel::getInstance('Articles', 'ContentModel', 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));
     $model->setState('filter.published', 1);
     $model->setState('filter.featured', $params->get('featured', "show"));
     // Access filter
     $access = !JComponentHelper::getParams('com_content')->get('show_noauth');
     $authorised = JAccess::getAuthorisedViewLevels(JFactory::getUser()->get('id'));
     $model->setState('filter.access', $access);
     // Category filter
     $model->setState('filter.category_id', $params->get('categoryId', array()));
     // Filter by language
     $model->setState('filter.language', $app->getLanguageFilter());
     // Ordering
     $ordering = $params->get('ordering', 'a.ordering');
     $model->setState('list.ordering', $ordering);
     if (trim($ordering) == 'rand()') {
         $model->setState('list.direction', '');
     } else {
         $model->setState('list.direction', $params->get('sort_order', "ASC"));
     }
     $items = $model->getItems();
     foreach ($items as &$item) {
         $item->content = $params->get('show_img') == '0' || $params->get('reformat_content') == '1' ? modKlixoArticlesSliderHelper::stripTags($item->introtext) : $item->introtext;
         $item->slug = $item->id . ':' . $item->alias;
         $item->catslug = $item->catid . ':' . $item->category_alias;
         if ($access || in_array($item->access, $authorised)) {
             // We know that user has the privilege to view the article
             $item->link = JRoute::_(ContentHelperRoute::getArticleRoute($item->slug, $item->catslug));
         } else {
             $item->link = JRoute::_('index.php?option=com_users&view=login');
         }
         if (!isset($item->sub_title)) {
             $item->sub_title = modKlixoArticlesSliderHelper::cutStr($item->title, $params->get('limittitle', 25));
         }
         if (!isset($item->sub_content)) {
             if ($params->get('reformat_content') == 1) {
                 $item->sub_content = modKlixoArticlesSliderHelper::cutStr($item->content, $params->get('limit_description'));
             } else {
                 $item->sub_content = $item->content;
             }
         }
     }
     return $items;
 }
예제 #2
0
if ($browserName == 'msie' && $browserVersion == 6) {
    $widthIe = 3;
}
if (!defined('KLIXO_ARTICLES_SLIDER')) {
    define('KLIXO_ARTICLES_SLIDER', 1);
    if ($jquery) {
        JHTML::script('jquery-1.8.3.min.js', JURI::base() . '/modules/' . $module->module . '/assets/');
    }
    /* Add css */
    JHTML::stylesheet('style.css', JURI::base() . '/modules/' . $module->module . '/assets/');
    $crapIE6 = false;
    if ($browserName == 'msie' && $browserVersion == 6) {
        JHTML::stylesheet('ie6.css', JURI::base() . '/modules/' . $module->module . '/assets/');
        $crapIE6 = true;
        /*if ($jquery) {
              JHTML::script('jquery.pngFix.js', JURI::base() . '/modules/' . $module->module . '/assets/');
          }*/
    } else {
        if ($browserName == 'msie' && $browserVersion == 7) {
            JHTML::stylesheet('ie7.css', JURI::base() . '/modules/' . $module->module . '/assets/');
            $currentBrowser = IE7;
        }
    }
    JHTML::script('jquery.cycle.all.js', JURI::base() . '/modules/' . $module->module . '/assets/');
}
$GLOBALS["module"] = $module;
$items = modKlixoArticlesSliderHelper::getContentList($params);
$themePath = JModuleHelper::getLayoutPath('mod_klixo_articles_slider');
if (file_exists($themePath)) {
    require $themePath;
}