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

Commit

Permalink
Version 1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Schlegel committed Sep 26, 2014
1 parent 88ba197 commit 8fc0c87
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 8 deletions.
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ Features
* Erweiterung von Meta-Tags möglich (siehe `rex_asd_news::replaceSeoTags()`)
* SEO42 Image Manager Urls möglich
* On/Off Schaltung von News
* News ab einer bestimmten Anzahl zu archivieren
* fertige Module via Knopfdruck installieren

Update 1.2.0
------------
* Unter Einstellungen => ab welcher Newsanzahl die News in das Archiv landen
* Modul "ASD News - Archiv" hinzugefügt
* Modul "ASD News - Alle News" hinzugefügt
* Extension _ASD_NEWS_GENERATE_URL_ hinzugefügt (`$news->getUrl()`)
* Methode `$news->getRubricName()` hinzugefügt
* `rex_asd_news::getAllNews($clang = null)` - Ausgabe aller News
* `rex_asd_news::getArchiveNews()` - Ausgabe des Archivs
* `$news->getUrl($params = array())` - `$params` kann nun `clang` & `article-id` beinhalten
* `$pager->setArchive($archive = false)` - Newsanzahl für Archiv berücksichtigen
* `$pager->getButtons()` Ausgabe der next/prev Buttons
* Bugfix "call unstatic method`getDefaultWhere` & `generateWhere` static"


Update 1.1.0
------------
Expand All @@ -32,6 +49,12 @@ PHP Methoden
* Mehrere News
```$news = rex_asd_news::getNewsByIds(array(1, 2, 3, 4));```

* Alle News
```$news = rex_asd_news::getAllNews();```

* Archivierte News
```$news = rex_asd_news::getArchiveNews();```

* Mehrere News von einer Kategorie
```$news = rex_asd_news::getNewsByCategory((int)$catId);```

Expand All @@ -44,9 +67,15 @@ PHP Methoden
* URL bekommen
```$url = $news->getUrl($params = array());```

* PublishDate bekommen als DateTime Objekt*
* Rubriknamen bekommen
```$url = $news->getRubricName();```

* PublishDate bekommen als DateTime Objekt
```$date = $news->getPublishDate();```

* Überprüfen ob News online
```if($news->isOnline())```

* Monatname bekommen
```$monthName = $news->getMonthName($lang = '_de');```

Expand Down
5 changes: 5 additions & 0 deletions classes/rex_asd_news.php
Original file line number Diff line number Diff line change
Expand Up @@ -374,13 +374,18 @@ public static function getNewsById($newsId, $clang = null)
}

/**
* @param int|null $clang
* @return array
*/
public static function getAllNews($clang = null)
{
return self::getByWhere(array(), $clang);
}

/**
* @param int|null $clang
* @return array
*/
public static function getArchiveNews($clang = null)
{
global $REX;
Expand Down
2 changes: 1 addition & 1 deletion config.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

// register addon
$REX['ADDON']['name']['asd_news'] = 'News';
$REX['ADDON']['version']['asd_news'] = '1.1.1 DEV';
$REX['ADDON']['version']['asd_news'] = '1.2';
$REX['ADDON']['author']['asd_news'] = 'ArtStudioDESIGN';
$REX['ADDON']['supportpage']['asd_news'] = 'http://redaxo.org/forum/';
$REX['ADDON']['perm']['asd_news'] = 'asd_news[]';
Expand Down
2 changes: 1 addition & 1 deletion data/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
"max-per-page": 5,
"published-lang": "all",
"include-css": true,
"min-archive": 10
"min-archive": 15
}
6 changes: 3 additions & 3 deletions pages/news.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@
<a href="' . $list->getParsedUrl(array('func' => 'unpublish', 'id' => '###id###')) . '">
<img src="../' . $REX['MEDIA_ADDON_DIR'] . '/asd_news/unpublished.svg"
width="20" height="20" style="vertical-align: middle; margin-left: 5px"
onclick="return confirm(\''.$I18N->msg('asd_news_really_unpublish').'\');">
onclick="return confirm(\'' . $I18N->msg('asd_news_really_unpublish') . '\');">
</a>';

if ($publishedAt->getTimestamp() == -62169987600 || $publishedAt->getTimestamp() === false) {
Expand Down Expand Up @@ -181,8 +181,8 @@

if ($func == 'add' || $func == 'edit') {

if(rex_asd_news::$SEO_URL_CONTROL) {
foreach(array('REX_FORM_SAVED', 'REX_FORM_DELETED') as $extension) {
if (rex_asd_news::$SEO_URL_CONTROL) {
foreach (array('REX_FORM_SAVED', 'REX_FORM_DELETED') as $extension) {
rex_register_extension($extension, 'url_generate::generatePathFile');
}
}
Expand Down
5 changes: 3 additions & 2 deletions update.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@

$REX['ADDON']['update']['asd_news'] = 1;

$config = $REX['ADDON']['asd_news']['config'];
$configFile = rex_path::addonData('asd_news', 'config.json');
$config = json_decode(file_get_contents($configFile), true);

if(!isset($config['min-archive'])) {
$config['min-archive'] = 15;
file_put_contents($REX['ADDON']['asd_news']['configFile'], json_encode($config));
file_put_contents($configFile, json_encode($config));
}

?>

0 comments on commit 8fc0c87

Please sign in to comment.