Skip to content
This repository has been archived by the owner on Jul 15, 2020. It is now read-only.

Commit

Permalink
add $news->getRubricName()
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Schlegel committed Sep 26, 2014
1 parent 1ba2798 commit 88ba197
Showing 1 changed file with 26 additions and 1 deletion.
27 changes: 26 additions & 1 deletion classes/rex_asd_news.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,37 @@ public function getUrl(array $params = array())
return url_generate::getUrlById($REX['TABLE_PREFIX'] . 'asd_news', $this->getValue('id'));
}

$art_id = $params['art-id'];
$art_id = $params['article-id'];
$clang = $params['clang'];

unset($params['article-id'], $params['clang']);

return rex_getUrl($art_id, $clang, $params);
}

/**
* return string
*/
public function getRubricName() {
static $rubrics = array();

if(empty($rubrics)) {
global $REX;

$sql = new rex_sql();
$sql->setQuery('SELECT * FROM `' . $REX['TABLE_PREFIX'] . 'asd_news_category`');
for($i = 1; $i <= $sql->getRows(); $i++) {
$rubrics[$sql->getValue('id')] = $sql->getValue('name');

$sql->next();
}

}

return $rubrics[$this->getValue('category')];

}

/**
* is the news online?
*
Expand Down

0 comments on commit 88ba197

Please sign in to comment.