Exemplo n.º 1
0
 public static function getValue($id, $fieldname)
 {
     $text = CCK_Article::getText($id);
     $res = CCK_Content::getValue($text, $fieldname);
     return $res;
 }
Exemplo n.º 2
0
 /**
  * @param      $id
  *
  * @param bool $raw return the raw object not the RokSprocket_Item
  *
  * @return stdClass|RokSprocket_Item
  * @throws RokSprocket_Exception
  */
 public function getArticleInfo($id, $raw = false)
 {
     require_once JPath::clean(JPATH_SITE . '/libraries/cck/content/content.php');
     /** @var $filer_processor RokCommon_Filter_IProcessor */
     $filer_processor = $this->getFilterProcessor();
     $filer_processor->process(array('id' => array($id)));
     $query = $filer_processor->getQuery();
     $db = JFactory::getDbo();
     $db->setQuery($query);
     $db->query();
     if ($error = $db->getErrorMsg()) {
         throw new RokSprocket_Exception($error);
     }
     $ret = $db->loadObject();
     if ($raw) {
         //if its Seblod we have to do a match to get the introtext and full text
         $introtext = CCK_Content::getValue($ret->introtext, 'introtext');
         $fulltext = CCK_Content::getValue($ret->introtext, 'fulltext');
         if ($introtext || $fulltext) {
             $ret->preview = $this->_cleanPreview($introtext . $fulltext);
         } else {
             $ret->preview = $this->_cleanPreview($ret->introtext . $ret->fulltext);
         }
         $ret->editUrl = $this->getArticleEditUrl($id);
         return $ret;
     } else {
         $item = $this->convertRawToItem($ret);
         $item->editUrl = $this->getArticleEditUrl($id);
         $item->preview = $this->_cleanPreview($item->getText());
         return $item;
     }
 }