Esempio n. 1
0
 /**
  * @param string $json_column_array
  * @param string $json_argument_array
  * @param string $get_array
  * @param string $css_page_id
  * @param string $css_row_sort_id
  * @param string $entries_per_page
  * @param string $page
  * @param string $sortvalue
  * @param string $sortmethod
  * @return integer
  * @throws BaseUserAccessDeniedException
  */
 public static function list_measuring_unit_categories($json_column_array, $json_argument_array, $get_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     global $user;
     if ($user->is_admin()) {
         $argument_array = json_decode($json_argument_array);
         $list_request = new ListRequest_IO();
         $list_request->set_column_array($json_column_array);
         if (!is_numeric($entries_per_page) or $entries_per_page < 1) {
             $entries_per_page = 20;
         }
         $list_array = Environment_Wrapper::list_measuring_unit_categories($sortvalue, $sortmethod, $page * $entries_per_page - $entries_per_page, $page * $entries_per_page);
         if (is_array($list_array) and count($list_array) >= 1) {
             foreach ($list_array as $key => $value) {
                 if (MeasuringUnitCategory::is_deletable($list_array[$key]['id']) === true) {
                     $list_array[$key]['delete'] = "<a title='delete' style='cursor: pointer;' id='BaseAdminMeasuringUnitCategoryDelete" . $list_array[$key]['id'] . "' class='BaseAdminMeasuringUnitCategoryDelete'><img src='images/icons/delete.png' alt='D' /></a>";
                 } else {
                     $list_array[$key]['delete'] = "";
                 }
             }
         } else {
             $list_request->empty_message("<span class='italic'>No results found!</span>");
         }
         $list_request->set_array($list_array);
         return $list_request->get_page($page);
     } else {
         throw new BaseUserAccessDeniedException();
     }
 }