/**
  * This action provides the user features to manage widget categories in the portal. 
  */
 public function index()
 {
     // Session message handling for category addition/edition/deletion.
     if (isset($_SESSION['message'])) {
         $message = $_SESSION['message'];
         $isError = $_SESSION['isError'];
         unset($_SESSION['message']);
         unset($_SESSION['isError']);
     }
     // Security check.
     if (!Auth::isAuth() && (Auth::isAdmin() || Auth::isGod())) {
         DefaultFC::redirection('users/index?ref=admin');
     }
     // Determine if the view must allow the user to manage widgets.
     $widgetManagement = false;
     if (Auth::isAdmin() || Auth::isGod()) {
         $widgetManagement = true;
     }
     $categories = Categories::retrieveCategories('raw');
     $partial = 'categories';
     require DefaultFC::getView('admin.tpl');
 }
 private function buildCategoryList()
 {
     return Categories::retrieveCategories('raw');
 }
 /**
  * This action, acting as a service, should be requested through  an XML HTTP REQUEST in order to
  * retrieve a list of the Widget categories contained in the persistant data of the application.
  *
  * The output format is JSON and the result is simply written in the XML HTTP RESPONSE.
  * TODO The getCategories action seems to be never used in any case. Verify it, and delete it is useless.
  */
 public function getCategories()
 {
     if (!Auth::isAuth()) {
         throw new ServiceException(MwwException::ACTION, 'getCategories', ServiceException::SERV_AUTH);
     }
     $categories = Categories::retrieveCategories('json', $withEmpty = true);
     echo $categories;
 }