Пример #1
0
 /**
  * @param string $json_column_array
  * @param string $json_argument_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 string
  * @throws ProjectIDMissingException
  */
 public static function list_project_tasks($json_column_array, $json_argument_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     $argument_array = json_decode($json_argument_array);
     $project_id = $argument_array[1];
     if (is_numeric($project_id)) {
         $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 = Project_Wrapper::list_project_tasks($project_id, $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) {
                 $start_date = new DatetimeHandler($list_array[$key]['start_date']);
                 $end_date = new DatetimeHandler($list_array[$key]['end_date'] . " " . $list_array[$key]['end_time']);
                 $list_array[$key]['start_date'] = $start_date->get_date();
                 $list_array[$key]['end_date'] = $end_date->get_date();
                 $list_array[$key]['end_time'] = $end_date->get_time();
                 if ($list_array[$key]['whole_day'] == "t") {
                     $list_array[$key]['end_time'] = "whole day";
                 }
                 if ($list_array[$key]['is_status_process'] or $list_array[$key]['is_process']) {
                     $project_task = new ProjectTask($list_array[$key]['id']);
                 }
                 if ($list_array[$key]['is_status_process']) {
                     $list_array[$key]['type'] = "Status Rel. Task";
                     $list_array[$key]['name'] = $project_task->get_name();
                 }
                 if ($list_array[$key]['is_process']) {
                     $list_array[$key]['type'] = "Task";
                 }
                 if ($list_array[$key]['is_milestone']) {
                     $list_array[$key]['type'] = "Milestone";
                 } else {
                     $list_array[$key]['progress'] = "<img src='core/images/status_bar.php?length=100&height=15&linecolor=A0A0A0&color=" . $project_task->get_color() . "&value=" . $project_task->get_progress() . "' />";
                 }
                 $paramquery = array();
                 $paramquery['session_id'] = $_GET['session_id'];
                 $paramquery['username'] = $_GET['username'];
                 $paramquery['nav'] = "project";
                 $paramquery['run'] = "task_detail";
                 $paramquery['id'] = $list_array[$key]['id'];
                 $params = http_build_query($paramquery, '', '&#38;');
                 $tmp_name = $list_array[$key]['name'];
                 unset($list_array[$key]['name']);
                 $list_array[$key]['name']['content'] = $tmp_name;
                 $list_array[$key]['name']['link'] = $params;
             }
         } else {
             $list_request->empty_message("<span class='italic'>No Project tasks found!</span>");
         }
         $list_request->set_array($list_array);
         return $list_request->get_page($page);
     } else {
         throw new ProjectIDMissingException();
     }
 }
Пример #2
0
 public static function list_system_messages()
 {
     define(SYSTEM_MESSAGE_ENTRIES_PER_PAGE, 6);
     $system_message_array = SystemMessage::list_entries();
     if (!$_GET['page']) {
         $page = 1;
     } else {
         $page = $_GET['page'];
     }
     $entry_count = count($system_message_array);
     $number_of_pages = ceil($entry_count / SYSTEM_MESSAGE_ENTRIES_PER_PAGE);
     $template = new HTMLTemplate("base/list_system_messages.html");
     if (is_array($system_message_array) and count($system_message_array) >= 1) {
         $template->set_var("no_entry", false);
         $result = array();
         $counter = 0;
         if (count($system_message_array) < $page * SYSTEM_MESSAGE_ENTRIES_PER_PAGE) {
             $max_for = count($system_message_array) % SYSTEM_MESSAGE_ENTRIES_PER_PAGE - 1;
         } else {
             $max_for = SYSTEM_MESSAGE_ENTRIES_PER_PAGE - 1;
         }
         for ($i = 0; $i <= $max_for; $i++) {
             $entry = $page * SYSTEM_MESSAGE_ENTRIES_PER_PAGE + $i - SYSTEM_MESSAGE_ENTRIES_PER_PAGE;
             // Erzeugt Entry-ID
             $value = $system_message_array[$entry];
             $system_message = new SystemMessage($value);
             $user = new User($system_message->get_user_id());
             $datetime_handler = new DatetimeHandler($system_message->get_datetime());
             $content = str_replace("\n", "<br />", $system_message->get_content());
             $content = str_replace("\\", "", $content);
             $result[$counter]['user'] = $user->get_full_name(false);
             $result[$counter]['datetime'] = $datetime_handler->get_date() . " at " . $datetime_handler->get_time();
             $result[$counter]['content'] = $content;
             $counter++;
         }
         $template->set_var("message_array", $result);
     } else {
         $template->set_var("no_entry", true);
     }
     if ($number_of_pages > 1) {
         $template->set_var("page_bar", Common_IO::page_bar($page, $number_of_pages, $_GET));
     } else {
         $template->set_var("page_bar", "");
     }
     $template->output();
 }
Пример #3
0
 /**
  * @param string $get_array
  * @param intger $page
  * @return integer
  * @throws ProjectSecurityAccessDeniedException
  * @throws ProjectIDMissingException
  */
 public static function get_list($get_array, $page)
 {
     global $project_security, $user;
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     if ($_GET['project_id']) {
         if ($project_security->is_access(1, false) == true) {
             $project_log_array = ProjectLog::list_entries_by_project_id($_GET['project_id']);
             if (!$page) {
                 $page = 1;
             }
             $entry_count = count($project_log_array);
             $number_of_pages = ceil($entry_count / constant("PROJECT_LOG_ENTRIES_PER_PAGE"));
             $template = new HTMLTemplate("project/ajax/log.html");
             $template->set_var("get_array", $get_array);
             $template->set_var("page", $page);
             $template->set_var("number_of_pages", $number_of_pages);
             if (is_array($project_log_array) and count($project_log_array) >= 1) {
                 $template->set_var("no_log", false);
                 $result = array();
                 $counter = 0;
                 if (count($project_log_array) < $page * PROJECT_LOG_ENTRIES_PER_PAGE) {
                     $max_for = count($project_log_array) % PROJECT_LOG_ENTRIES_PER_PAGE - 1;
                 } else {
                     $max_for = PROJECT_LOG_ENTRIES_PER_PAGE - 1;
                 }
                 for ($i = 0; $i <= $max_for; $i++) {
                     $entry = $page * PROJECT_LOG_ENTRIES_PER_PAGE + $i - PROJECT_LOG_ENTRIES_PER_PAGE;
                     // Erzeugt Entry-ID
                     $value = $project_log_array[$entry];
                     $project_log = new ProjectLog($value);
                     $user = new User($project_log->get_owner_id());
                     $result[$counter]['id'] = $value;
                     $result[$counter]['show_more'] = false;
                     $datetime_handler = new DatetimeHandler($project_log->get_datetime());
                     $result[$counter]['date'] = $datetime_handler->get_date();
                     $result[$counter]['time'] = $datetime_handler->get_time();
                     $result[$counter]['user'] = $user->get_full_name(false);
                     if (($content = $project_log->get_content()) != null) {
                         $content = str_replace("\n", "<br />", $content);
                         if (strlen($content) > 500) {
                             $content = substr($content, 0, 500) . "...";
                             $result[$counter]['show_more'] = true;
                         }
                         $result[$counter]['content'] = $content;
                     } else {
                         $result[$counter]['content'] = false;
                     }
                     $status_id = $project_log->get_status_id();
                     if ($status_id != null) {
                         $project_status = new ProjectStatus($status_id);
                         $result[$counter]['status'] = $project_status->get_name();
                     } else {
                         $result[$counter]['status'] = false;
                     }
                     if ($project_log->get_important() == true) {
                         $result[$counter]['important'] = true;
                     } else {
                         $result[$counter]['important'] = false;
                     }
                     $item_array = $project_log->list_items();
                     $number_of_items = count($item_array);
                     if ($number_of_items == 0) {
                         $result[$counter]['items'] = false;
                     } else {
                         if ($number_of_items == 1) {
                             $result[$counter]['items'] = $number_of_items . " Item was added";
                         } else {
                             $result[$counter]['items'] = $number_of_items . " Items were added";
                         }
                     }
                     $detail_paramquery = $_GET;
                     $detail_paramquery['run'] = "log_detail";
                     $detail_paramquery['id'] = $value;
                     $detail_params = http_build_query($detail_paramquery, '', '&#38;');
                     $result[$counter]['detail_params'] = $detail_params;
                     if ($user->is_admin()) {
                         $result[$counter]['delete'] = true;
                     } else {
                         $result[$counter]['delete'] = false;
                     }
                     $counter++;
                 }
                 $template->set_var("log_array", $result);
             } else {
                 $template->set_var("no_log", true);
             }
             if ($number_of_pages > 1) {
                 $pagebar = "<div id='ProjectLogActionSelect'></div><div class='ResultNextPageBar' id='ProjectLogPageBar'></div>";
                 $template->set_var("page_bar", $pagebar);
             } else {
                 $template->set_var("page_bar", "");
             }
             $template->output();
         } else {
             throw new ProjectSecurityAccessDeniedException();
         }
     } else {
         throw new ProjectIDMissingException();
     }
 }