Example #1
0
 function getList($params, $module)
 {
     $content = new YtcSobi2Slideshow();
     $content->featured = $params->get('featured', 2);
     $content->showtype = $params->get('showtype', 1);
     $content->category = $params->get('category', 0);
     $content->listIDs = $params->get('itemIds', '');
     $content->limit = $params->get('total', 5);
     $content->sort_order_field = $params->get('sort_order_field', "created");
     $content->type_order = $params->get('sort_order', "DESC");
     $content->thumb_height = $params->get('thumb_height', "150px");
     $content->thumb_width = $params->get('thumb_width', "120px");
     $content->customUrl = $params->get('customUrl', '');
     $content->small_thumb_height = $params->get('small_thumb_height', "0");
     $content->small_thumb_width = $params->get('small_thumb_width', "0");
     $content->web_url = JURI::base();
     $content->max_title = $params->get('limittitle', 25);
     $content->max_main_description = $params->get('limit_description', 25);
     $content->resize_folder = JPATH_CACHE . DS . $module->module . DS . "images";
     $content->url_to_resize = $content->web_url . "cache/" . $module->module . "/images/";
     $content->cropresizeimage = $params->get('cropresizeimage', 1);
     $items = $content->getList();
     return $items;
 }
 function getList()
 {
     global $mainframe;
     $arrCustomUrl = YtcSobi2Slideshow::getArrURL();
     class_exists('sobi2Config') || (require_once _SOBI_CMSROOT . DS . 'components' . DS . 'com_sobi2' . DS . 'config.class.php');
     $user =& JFactory::getUser();
     $aid = $user->get('aid');
     $db =& JFactory::getDBO();
     $jnow =& JFactory::getDate();
     $now = $jnow->toMySQL();
     $nullDate = $db->getNullDate();
     $where = YtcSobi2Slideshow::getCondition();
     $config =& sobi2Config::getInstance();
     $database =& $config->getDb();
     $S_Itemid = $config->sobi2Itemid;
     $catId = sobi2Config::request($_REQUEST, 'catid', 0);
     $now = $config->getTimeAndDate();
     $query = "SELECT si.title, si.itemid, si.icon, si.image,si.last_update, sfd.data_txt  \r\nFROM `#__sobi2_item` si \r\nLEFT JOIN  #__sobi2_fields_data sfd ON sfd.itemid = si.itemid \r\nLEFT JOIN #__sobi2_language sl ON (sl.fieldid = sfd.fieldid AND sl.langKey = 'field_description') \r\nWHERE  `published` = 1 AND (`publish_down` > '{$now}' OR `publish_down` = '{$config->nullDate}') AND sl.fieldid <> ''";
     //$this->sort_order_field = "RAND()";
     if ($this->sort_order_field == 'random') {
         $query .= $where . ' GROUP BY si.itemid ORDER BY rand()';
     } elseif ($this->sort_order_field == 'title') {
         $this->type_order = 'ASC';
         $query .= $where . ' GROUP BY si.itemid  ORDER BY ' . $this->sort_order_field . ' ' . $this->type_order;
     } else {
         $query .= $where . ' GROUP BY si.itemid  ORDER BY ' . $this->sort_order_field . ' ' . $this->type_order;
     }
     $query .= $this->limit ? ' LIMIT ' . $this->limit : '';
     $db->setQuery($query);
     $items = $db->loadObjectlist();
     if (empty($items)) {
         return array();
     }
     foreach ($items as $key => &$item) {
         if (array_key_exists($item->itemid, $arrCustomUrl)) {
             $item->link = $arrCustomUrl[$item->itemid];
             //echo '<pre>'.print_r($item->link);die;
         } else {
             $item->link = "index.php?option=com_sobi2&amp;sobi2Task=sobi2Details&amp;sobi2Id={$item->itemid}&amp;Itemid={$S_Itemid}";
         }
         $myTitle = $config->getSobiStr($item->title);
         $item->date = JHtml::_('date', $item->last_update, JText::_('DATE_FORMAT_LC2'));
         if ($item->image && file_exists("{$config->absolutePath}/images/com_sobi2/clients/{$item->image}")) {
             $item->main_image = "images/com_sobi2/clients/{$item->image}";
         } else {
             $item->main_image = '';
         }
         $item->title = $myTitle;
     }
     $k2items = array();
     foreach ($items as $key => $article) {
         $sobi2 = array();
         $sobi2['itemid'] = $article->itemid;
         $sobi2['title'] = $article->title;
         $sobi2['img'] = $article->main_image;
         $sobi2['content'] = $article->data_txt;
         $sobi2['link'] = $article->link;
         $sobi2items[] = $sobi2;
     }
     $items = $this->update($sobi2items);
     return $items;
 }