/** * @param integer $id * @return string * @throws ProjectLogIDMissingException * @throws ProjectSecurityAccessDeniedException */ public static function get_less($id) { global $project_security; if ($project_security->is_access(3, false) == true) { if (is_numeric($id)) { $return_json_array = array(); $project_log = new ProjectLog($id); if (($content = $project_log->get_content()) != null) { $content = str_replace("\n", "<br />", $content); if (strlen($content) > 500) { $content = substr($content, 0, 500) . "..."; } $return_json_array[0] = $content; } else { $return_json_array[0] = false; } $status_id = $project_log->get_status_id(); if ($status_id != null) { $project_status = new ProjectStatus($status_id); $return_json_array[1] = $project_status->get_name(); } else { $return_json_array[1] = false; } $item_array = $project_log->list_items(); $number_of_items = count($item_array); if ($number_of_items == 0) { $return_json_array[2] = false; } else { if ($number_of_items == 1) { $return_json_array[2] = $number_of_items . " Item was added"; } else { $return_json_array[2] = $number_of_items . " Items were added"; } } $return_json_array[3] = "Show more"; return json_encode($return_json_array); } else { throw new ProjectLogIDMissingException(); } } else { throw new ProjectSecurityAccessDeniedException(); } }