/** * @param string $id * @return string * @throws BaseUserAccessDeniedException * @throws BaseEnvironmentPaperSizeIDMissingException */ public static function get_paper_size($id) { global $user; if ($user->is_admin()) { if (is_numeric($id)) { $paper_size = new PaperSize($id); $return_array = array(); $return_array[0] = $paper_size->get_base(); $return_array[1] = $paper_size->get_name(); $return_array[2] = $paper_size->get_width(); $return_array[3] = $paper_size->get_height(); $return_array[4] = $paper_size->get_margin_left(); $return_array[5] = $paper_size->get_margin_right(); $return_array[6] = $paper_size->get_margin_top(); $return_array[7] = $paper_size->get_margin_bottom(); return json_encode($return_array); } else { throw new BaseEnvironmentPaperSizeIDMissingException(); } } else { throw new BaseUserAccessDeniedException(); } }