Пример #1
0
 function getObjectInfo($id, $language = null)
 {
     $db = JFactory::getDBO();
     $query = "SELECT i.itemid as id, i.title, i.owner" . " FROM #__sobi2_item as i" . " WHERE i.itemid = " . $id;
     $db->setQuery($query);
     $row = $db->loadObject();
     $info = new JCommentsObjectInfo();
     if (!empty($row)) {
         $configFile = JPATH_SITE . '/components/com_sobi2/config.class.php';
         if (is_file($configFile)) {
             require_once $configFile;
             $config = sobi2Config::getInstance();
             $info->title = self::getSobiStr($row->title);
             $info->access = NULL;
             $info->userid = $row->owner;
             $info->link = sobi2Config::sef('index.php?option=com_sobi2&sobi2Task=sobi2Details&sobi2Id=' . $id . '&Itemid=' . $config->sobi2Itemid);
         }
     }
     return $info;
 }
Пример #2
0
 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;
 }