forked from ZwiiCMS-Team/ZwiiCMS
liste les modules en json
This commit is contained in:
parent
5bcb36c23d
commit
7dc0b4caf8
@ -37,7 +37,8 @@ class download extends common {
|
|||||||
'statsDeleteAll' => self::GROUP_MODERATOR,
|
'statsDeleteAll' => self::GROUP_MODERATOR,
|
||||||
'index' => self::GROUP_VISITOR,
|
'index' => self::GROUP_VISITOR,
|
||||||
'rss' => self::GROUP_VISITOR,
|
'rss' => self::GROUP_VISITOR,
|
||||||
'downloadFile' => self::GROUP_VISITOR
|
'downloadFile' => self::GROUP_VISITOR,
|
||||||
|
'list' =>self::GROUP_VISITOR
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $items = [];
|
public static $items = [];
|
||||||
@ -904,4 +905,25 @@ class download extends common {
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/***
|
||||||
|
* Retourne une chaîne json contenant la liste des téléchargements disponibles
|
||||||
|
*/
|
||||||
|
public function list() {
|
||||||
|
$itemIdsPublishedOns = helper::arrayCollumn($this->getData(['module', $this->getUrl(0),'items']), 'publishedOn', 'SORT_DESC');
|
||||||
|
$itemIdsStates = helper::arrayCollumn($this->getData(['module', $this->getUrl(0), 'items']), 'state', 'SORT_DESC');
|
||||||
|
$itemIds = [];
|
||||||
|
foreach($itemIdsPublishedOns as $itemId => $itemPublishedOn) {
|
||||||
|
if($itemPublishedOn <= time() AND $itemIdsStates[$itemId]) {
|
||||||
|
$itemIds[] = $itemId;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach ($itemIds as $key) {
|
||||||
|
self::$items[$key] = $this->getData(['module', $this->getUrl(0), 'items', $key]);
|
||||||
|
}
|
||||||
|
$this->addOutput([
|
||||||
|
'display' => self::DISPLAY_JSON,
|
||||||
|
'content' => self::$items
|
||||||
|
]);
|
||||||
|
}
|
||||||
}
|
}
|
1
module/download/view/list/list.php
Normal file
1
module/download/view/list/list.php
Normal file
@ -0,0 +1 @@
|
|||||||
|
<!-- rien -->
|
Loading…
x
Reference in New Issue
Block a user