N°3294 - Display and refresh counters in OQL menu entries

This commit is contained in:
Eric
2020-10-27 15:11:30 +01:00
parent 48b3716278
commit 8502fa7721
7 changed files with 484 additions and 378 deletions

View File

@@ -6,7 +6,8 @@
namespace Combodo\iTop\Controller;
use ajax_page;
use AjaxPage;
use ApplicationMenu;
use BulkExport;
use BulkExportException;
use DBObjectSearch;
@@ -18,13 +19,13 @@ use utils;
class AjaxRenderController
{
/**
* @param \ajax_page $oPage
* @param \AjaxPage $oPage
*
* @param bool $bTokenOnly
*
* @throws \Exception
*/
public static function ExportBuild(ajax_page $oPage, bool $bTokenOnly)
public function ExportBuild(AjaxPage $oPage, bool $bTokenOnly)
{
register_shutdown_function(function () {
$aErr = error_get_last();
@@ -113,4 +114,19 @@ class AjaxRenderController
$oPage->add(json_encode($aResult));
}
}
/**
* Get all the menus count
*
* The resulting JSON is added to the page with the format:
* {"code": "done or error", "counts": {"menu_id_1": count1, "menu_id_2": count2...}}
*
* @param \AjaxPage $oPage
*/
public function GetMenusCount(AjaxPage $oPage)
{
$aCounts = ApplicationMenu::GetMenusCount();
$aResult = ['code' => 'done', 'counts' => $aCounts];
$oPage->add(json_encode($aResult));
}
}