/**
  * @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 string
  * @throws BaseUserAccessDeniedException
  */
 public static function list_methods($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()) {
         if ($get_array) {
             $_GET = unserialize($get_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 = Data_Wrapper::list_parameter_methods($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) {
                 $list_array[$key]['edit'] = "<a title='edit' style='cursor: pointer;' id='DataParameterAdminMethodEditButton" . $list_array[$key]['id'] . "' class='DataParameterAdminMethodEditButton'><img src='images/icons/edit.png' alt='D' /></a>";
                 if (ParameterMethod::is_deletable($list_array[$key]['id']) === true) {
                     $list_array[$key]['delete'] = "<a title='delete' style='cursor: pointer;' id='DataParameterAdminMethodDeleteButton" . $list_array[$key]['id'] . "' class='DataParameterAdminMethodDeleteButton'><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();
     }
 }
Ejemplo n.º 2
0
 public static function list_templates($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()) {
         if ($get_array) {
             $_GET = unserialize($get_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 = Sample_Wrapper::list_sample_templates($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) {
                 $paramquery = $_GET;
                 $paramquery['id'] = $list_array[$key]['id'];
                 $paramquery['action'] = "delete";
                 unset($paramquery['sortvalue']);
                 unset($paramquery['sortmethod']);
                 unset($paramquery['nextpage']);
                 $params = http_build_query($paramquery, '', '&#38;');
                 $list_array[$key]['delete']['link'] = $params;
                 $list_array[$key]['delete']['content'] = "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();
     }
 }
Ejemplo n.º 3
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 string
  * @throws BaseUserAccessDeniedException
  */
 public static function list_registry($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()) {
         if ($get_array) {
             $_GET = unserialize($get_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 = System_Wrapper::list_base_registry($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) {
                 $list_array[$key]['icon'] = "<img src='images/icons/registry.png' alt='' style='border: 0;' />";
                 $list_array[$key]['edit'] = "<a href='#'><img src='images/icons/edit.png' alt='E' style='border: 0;' /></a>";
             }
         } 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();
     }
 }
Ejemplo n.º 4
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 string
  * @throws BaseUserAccessDeniedException
  */
 public static function list_users($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()) {
         if ($get_array) {
             $_GET = unserialize($get_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 = User_Wrapper::list_users($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) {
                 $user = new User($list_array[$key]['id']);
                 $paramquery = $_GET;
                 $paramquery['action'] = "detail";
                 $paramquery['id'] = $list_array[$key]['id'];
                 $params = http_build_query($paramquery, '', '&#38;');
                 $list_array[$key]['symbol']['link'] = $params;
                 $list_array[$key]['symbol']['content'] = "<img src='images/icons/user.png' alt='' style='border: 0;' />";
                 unset($list_array[$key]['username']);
                 $list_array[$key]['username']['link'] = $params;
                 $list_array[$key]['username']['content'] = $user->get_username();
                 $list_array[$key]['fullname'] = $user->get_full_name(false);
                 $list_array[$key]['groups'] = Group::get_number_of_groups_by_user_id($list_array[$key]['id']);
                 $paramquery = $_GET;
                 $paramquery['action'] = "delete";
                 $paramquery['id'] = $list_array[$key]['id'];
                 $params = http_build_query($paramquery, '', '&#38;');
                 if ($list_array[$key]['id'] == 1) {
                     $list_array[$key]['delete'] = "<img src='images/icons/delete_user_na.png' alt='' style='border: 0;' />";
                 } else {
                     $list_array[$key]['delete']['link'] = $params;
                     $list_array[$key]['delete']['content'] = "<img src='images/icons/delete_user.png' alt='' style='border: 0;' />";
                 }
             }
         } else {
             $list_request->empty_message("<span class='italic'>No users found!</span>");
         }
         $list_request->set_array($list_array);
         return $list_request->get_page($page);
     } else {
         throw new BaseUserAccessDeniedException();
     }
 }
Ejemplo n.º 5
0
 /**
  * @param string $json_column_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 string
  * @throws BaseUserAccessDeniedException
  */
 public static function list_modules($json_column_array, $get_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     global $user;
     if ($user->is_admin()) {
         if ($get_array) {
             $_GET = unserialize($get_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 = System_Wrapper::list_base_module($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 ($list_array[$key]['name'] != "base") {
                     $paramquery = $_GET;
                     $paramquery['id'] = $list_array[$key]['id'];
                     $paramquery['action'] = "disable";
                     unset($paramquery['sortvalue']);
                     unset($paramquery['sortmethod']);
                     unset($paramquery['nextpage']);
                     $params = http_build_query($paramquery, '', '&#38;');
                     $list_array[$key]['disable']['link'] = $params;
                     if ($list_array[$key]['disabled'] == 't') {
                         $list_array[$key]['disable']['content'] = "<img src='images/icons/grey_point.png' alt='hide' style='border: 0;' />";
                     } else {
                         $list_array[$key]['disable']['content'] = "<img src='images/icons/green_point.png' alt='hide' style='border: 0;' />";
                     }
                 } else {
                     $list_array[$key]['disable'] = "<img src='images/icons/green_point.png' alt='hide' style='border: 0;' />";
                 }
             }
         } 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();
     }
 }
Ejemplo n.º 6
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 BaseAjaxArgumentMissingException
  */
 public static function list_projects($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);
     if (is_array($argument_array)) {
         $name = $argument_array[0][1];
         $template_array = $argument_array[1][1];
         $organisation_unit_array = $argument_array[2][1];
         $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_search_projects_without_subprojects($name, $template_array, $organisation_unit_array, $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) {
                 $list_array[$key]['symbol'] = "<img src='images/icons/project.png' alt='N' border='0' />";
                 $datetime_handler = new DatetimeHandler($list_array[$key]['datetime']);
                 $list_array[$key]['datetime'] = $datetime_handler->get_datetime(false);
                 $proejct_paramquery = array();
                 $project_paramquery['username'] = $_GET['username'];
                 $project_paramquery['session_id'] = $_GET['session_id'];
                 $project_paramquery['nav'] = "project";
                 $project_paramquery['run'] = "detail";
                 $project_paramquery['project_id'] = $value['id'];
                 $project_params = http_build_query($project_paramquery, '', '&#38;');
                 $tmp_project_name = $list_array[$key]['name'];
                 unset($list_array[$key]['name']);
                 $list_array[$key]['name']['content'] = $tmp_project_name;
                 $list_array[$key]['name']['link'] = $project_params;
             }
         } 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 BaseAjaxArgumentMissingException();
     }
 }
Ejemplo n.º 7
0
 /**
  * @param string $json_column_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 BaseUserAccessDeniedException
  */
 public static function list_includes($json_column_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     global $user;
     if ($user->is_admin()) {
         $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 = System_Wrapper::list_base_include($sortvalue, $sortmethod, $page * $entries_per_page - $entries_per_page, $page * $entries_per_page);
         if (is_array($list_array) and count($list_array) >= 1) {
             $today_end = new DatetimeHandler(date("Y-m-d") . " 23:59:59");
             foreach ($list_array as $key => $value) {
             }
         } else {
             $list_request->empty_message("<span class='italic'>No includes found!</span>");
             // Hmm, when this message appears, something went wrong.
         }
         $list_request->set_array($list_array);
         return $list_request->get_page($page);
     } else {
         throw new BaseUserAccessDeniedException();
     }
 }
Ejemplo n.º 8
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 string
  * @throws BaseUserAccessDeniedException
  * @throws BaseAjaxArgumentMissingException
  */
 public static function list_system_log($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()) {
         if ($get_array) {
             $_GET = unserialize($get_array);
         }
         $argument_array = json_decode($json_argument_array);
         if (is_array($argument_array)) {
             $type_id = $argument_array[1];
             $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 = SystemFE_Wrapper::list_system_log($type_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) {
                     $datetime_handler = new DatetimeHandler($list_array[$key]['datetime']);
                     $list_array[$key]['datetime'] = $datetime_handler->get_datetime(false);
                     $paramquery = $_GET;
                     $paramquery['id'] = $list_array[$key]['id'];
                     $paramquery['action'] = "detail";
                     unset($paramquery['sortvalue']);
                     unset($paramquery['sortmethod']);
                     unset($paramquery['nextpage']);
                     $params = http_build_query($paramquery, '', '&#38;');
                     $tmp_datetime = $list_array[$key]['datetime'];
                     unset($list_array[$key]['datetime']);
                     $list_array[$key]['datetime']['link'] = $params;
                     $list_array[$key]['datetime']['content'] = $tmp_datetime;
                     $paramquery = $_GET;
                     $paramquery['id'] = $list_array[$key]['ip'];
                     $paramquery['action'] = "ip_info";
                     unset($paramquery['sortvalue']);
                     unset($paramquery['sortmethod']);
                     unset($paramquery['nextpage']);
                     $params = http_build_query($paramquery, '', '&#38;');
                     $tmp_ip = $list_array[$key]['ip'];
                     unset($list_array[$key]['ip']);
                     $list_array[$key]['ip']['link'] = $params;
                     $list_array[$key]['ip']['content'] = $tmp_ip;
                 }
             } 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 BaseAjaxArgumentMissingException();
         }
     } else {
         throw new BaseUserAccessDeniedException();
     }
 }
Ejemplo n.º 9
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 string
  * @throws FolderIDMissingException
  */
 public static function list_data_browser($json_column_array, $json_argument_array, $get_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     if ($json_argument_array) {
         $argument_array = json_decode($json_argument_array);
     }
     $folder_id = $argument_array[0][1];
     $virtual_folder_id = $argument_array[1][1];
     if (!$folder_id and !$virtual_folder_id) {
         $data_path = new DataPath(null, null);
         $folder_id = $data_path->get_folder_id();
     }
     if (is_numeric($folder_id) or is_numeric($virtual_folder_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 = DataBrowser::get_data_browser_array($folder_id, $virtual_folder_id, $sortvalue, $sortmethod, $page * $entries_per_page - $entries_per_page, $page * $entries_per_page);
         if ($folder_id) {
             $data_path = new DataPath($folder_id, null);
         } elseif ($virtual_folder_id) {
             $data_path = new DataPath(null, $virtual_folder_id);
         } else {
             $data_path = new DataPath(null, null);
         }
         if ($folder_id != 1 or $virtual_folder_id != null) {
             if ($data_path->get_previous_entry_virtual() == true) {
                 $paramquery = $_GET;
                 $paramquery['vfolder_id'] = $data_path->get_previous_entry_id();
                 unset($paramquery['folder_id']);
                 unset($paramquery['nextpage']);
                 unset($paramquery['page']);
                 $params = http_build_query($paramquery, '', '&#38;');
             } else {
                 $paramquery = $_GET;
                 $paramquery['folder_id'] = $data_path->get_previous_entry_id();
                 unset($paramquery['nextpage']);
                 unset($paramquery['vfolder_id']);
                 unset($paramquery['page']);
                 $params = http_build_query($paramquery, '', '&#38;');
             }
             $first_line_array['symbol']['link'] = $params;
             $first_line_array['symbol']['content'] = "<img src='images/icons/parent_folder.png' alt='' style='border:0;' />";
             $first_line_array['name']['link'] = $params;
             $first_line_array['name']['content'] = Language::get_message("DataGeneralTitleParentFolder", "general");
             $first_line_array['type'] = Language::get_message("DataGeneralDataTypeParentFolder", "general");
             $first_line_array['version'] = "";
             $first_line_array['datetime'] = "";
             $first_line_array['size'] = "";
             $first_line_array['owner'] = "";
             $first_line_array['permission'] = "";
             $list_request->add_first_line($first_line_array, "DataBrowserParentFolderRow");
         }
         if (is_array($list_array) and count($list_array) >= 1) {
             foreach ($list_array as $key => $value) {
                 // Common
                 $datetime_handler = new DatetimeHandler($list_array[$key]['datetime']);
                 $list_array[$key]['datetime'] = $datetime_handler->get_datetime(false);
                 if ($list_array[$key]['owner_id']) {
                     $user = new User($list_array[$key]['owner_id']);
                 } else {
                     $user = new User(1);
                 }
                 $list_array[$key]['owner'] = $user->get_full_name(true);
                 // Special
                 if ($list_array[$key]['file_id']) {
                     $file = File::get_instance($list_array[$key]['file_id']);
                     if ($file->is_read_access() == true) {
                         $paramquery = $_GET;
                         $paramquery['nav'] = $_GET['nav'];
                         $paramquery['file_id'] = $list_array[$key]['file_id'];
                         $paramquery['action'] = "file_detail";
                         $params = http_build_query($paramquery, '', '&#38;');
                         $list_array[$key]['symbol']['link'] = $params;
                         $list_array[$key]['symbol']['content'] = "<img src='" . $file->get_icon() . "' alt='' style='border:0;' />";
                         $tmp_name = $list_array[$key]['name'];
                         unset($list_array[$key]['name']);
                         $list_array[$key]['name']['content'] = $tmp_name;
                         $list_array[$key]['name']['link'] = $params;
                         $list_array[$key]['name']['class'] = "DataBrowserIsFile";
                     } else {
                         $list_array[$key]['symbol'] = "<img src='core/images/denied_overlay.php?image=" . $file->get_icon() . "' alt='' border='0' />";
                     }
                     $list_array[$key]['type'] = Language::get_message("DataGeneralDataTypeFile", "general");
                     $list_array[$key]['version'] = $file->get_version();
                     $list_array[$key]['size'] = Convert::convert_byte_1024($list_array[$key]['size']);
                     $list_array[$key]['permission'] = $file->get_permission_string();
                     if ($file->is_delete_access()) {
                         $list_array[$key]['delete_checkbox'] = "<input type='checkbox' class='DataBrowserDeleteCheckbox' value='' name=''></input>";
                     } else {
                         $list_array[$key]['delete_checkbox'] = "<input type='checkbox' class='DataBrowserDeleteCheckbox' value='' name='' disabled='disabled'></input>";
                     }
                 } elseif ($list_array[$key]['value_id']) {
                     $value = Value::get_instance($list_array[$key]['value_id']);
                     if ($value->is_read_access() == true) {
                         $paramquery = $_GET;
                         $paramquery['nav'] = $_GET['nav'];
                         $paramquery['value_id'] = $list_array[$key]['value_id'];
                         $paramquery['action'] = "value_detail";
                         $params = http_build_query($paramquery, '', '&#38;');
                         $list_array[$key]['symbol']['link'] = $params;
                         $list_array[$key]['symbol']['content'] = "<img src='images/fileicons/16/unknown.png' alt='' style='border:0;' />";
                         $tmp_name = $list_array[$key]['name'];
                         unset($list_array[$key]['name']);
                         $list_array[$key]['name']['content'] = $tmp_name;
                         $list_array[$key]['name']['link'] = $params;
                         $list_array[$key]['name']['class'] = "DataBrowserIsValue";
                     } else {
                         $list_array[$key]['symbol'] = "<img src='core/images/denied_overlay.php?image=images/fileicons/16/unknown.png' alt='' border='0' />";
                     }
                     $list_array[$key]['type'] = Language::get_message("DataGeneralDataTypeValue", "general");
                     $list_array[$key]['version'] = $value->get_version();
                     $list_array[$key]['permission'] = $value->get_permission_string();
                     if ($value->is_delete_access()) {
                         $list_array[$key]['delete_checkbox'] = "<input type='checkbox' class='DataBrowserDeleteCheckbox' value='' name=''></input>";
                     } else {
                         $list_array[$key]['delete_checkbox'] = "<input type='checkbox' class='DataBrowserDeleteCheckbox' value='' name='' disabled='disabled'></input>";
                     }
                 } elseif ($list_array[$key]['parameter_id']) {
                     $parameter = ParameterTemplateParameter::get_instance($list_array[$key]['parameter_id']);
                     if ($parameter->is_read_access() == true) {
                         $paramquery = $_GET;
                         $paramquery['nav'] = $_GET['nav'];
                         $paramquery['parameter_id'] = $list_array[$key]['parameter_id'];
                         $paramquery['action'] = "parameter_detail";
                         $params = http_build_query($paramquery, '', '&#38;');
                         $list_array[$key]['symbol']['link'] = $params;
                         $list_array[$key]['symbol']['content'] = "<img src='images/fileicons/16/unknown.png' alt='' style='border:0;' />";
                         $tmp_name = $list_array[$key]['name'];
                         unset($list_array[$key]['name']);
                         $list_array[$key]['name']['content'] = $tmp_name;
                         $list_array[$key]['name']['link'] = $params;
                         $list_array[$key]['name']['class'] = "DataBrowserIsParameter";
                     } else {
                         $list_array[$key]['symbol'] = "<img src='core/images/denied_overlay.php?image=images/fileicons/16/unknown.png' alt='' border='0' />";
                     }
                     $list_array[$key]['type'] = Language::get_message("DataGeneralDataTypeParameter", "general");
                     $list_array[$key]['version'] = $parameter->get_version();
                     $list_array[$key]['permission'] = $parameter->get_permission_string();
                     if ($parameter->is_delete_access()) {
                         $list_array[$key]['delete_checkbox'] = "<input type='checkbox' class='DataBrowserDeleteCheckbox' value='' name=''></input>";
                     } else {
                         $list_array[$key]['delete_checkbox'] = "<input type='checkbox' class='DataBrowserDeleteCheckbox' value='' name='' disabled='disabled'></input>";
                     }
                 } elseif ($list_array[$key]['folder_id']) {
                     $sub_folder = Folder::get_instance($list_array[$key]['folder_id']);
                     if ($sub_folder->is_read_access() == true) {
                         $paramquery = $_GET;
                         $paramquery['folder_id'] = $list_array[$key]['folder_id'];
                         unset($paramquery['nextpage']);
                         unset($paramquery['vfolder_id']);
                         unset($paramquery['page']);
                         $params = http_build_query($paramquery, '', '&#38;');
                         $list_array[$key]['symbol']['content'] = "<img src='images/icons/folder.png' alt='' style='border:0;' />";
                         $list_array[$key]['symbol']['link'] = $params;
                         $tmp_name = $list_array[$key]['name'];
                         unset($list_array[$key]['name']);
                         $list_array[$key]['name']['content'] = $tmp_name;
                         $list_array[$key]['name']['link'] = $params;
                         $list_array[$key]['name']['class'] = "DataBrowserIsFolder";
                     } else {
                         $list_array[$key]['symbol'] = "<img src='core/images/denied_overlay.php?image=images/icons/folder.png' alt='' border='0' />";
                     }
                     $list_array[$key]['type'] = Language::get_message("DataGeneralDataTypeFolder", "general");
                     $list_array[$key]['permission'] = $sub_folder->get_permission_string();
                     if ($sub_folder->is_delete_access()) {
                         $list_array[$key]['delete_checkbox'] = "<input type='checkbox' class='DataBrowserDeleteCheckbox' value='' name=''></input>";
                     } else {
                         $list_array[$key]['delete_checkbox'] = "<input type='checkbox' class='DataBrowserDeleteCheckbox' value='' name='' disabled='disabled'></input>";
                     }
                 } elseif ($list_array[$key]['virtual_folder_id']) {
                     $paramquery = $_GET;
                     $paramquery['vfolder_id'] = $list_array[$key]['virtual_folder_id'];
                     unset($paramquery['nextpage']);
                     $params = http_build_query($paramquery, '', '&#38;');
                     $list_array[$key]['symbol']['content'] = "<img src='images/icons/virtual_folder.png' alt='' style='border:0;' />";
                     $list_array[$key]['symbol']['link'] = $params;
                     $tmp_name = $list_array[$key]['name'];
                     unset($list_array[$key]['name']);
                     $list_array[$key]['name']['content'] = $tmp_name;
                     $list_array[$key]['name']['link'] = $params;
                     $list_array[$key]['name']['class'] = "DataBrowserIsVirtualFolder";
                     $list_array[$key]['type'] = Language::get_message("DataGeneralDataTypeVirtualFolder", "general");
                     $list_array[$key]['permission'] = "automatic";
                     $list_array[$key]['delete_checkbox'] = "<input type='checkbox' class='DataBrowserDeleteCheckbox' value='' name='' disabled='disabled'></input>";
                 }
             }
         } 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 FolderIDMissingException();
     }
 }
Ejemplo n.º 10
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 string
  * @throws SampleIDMissingException
  * @throws SampleSecurityAccessDeniedException
  */
 public static function list_organisation_unit_permissions($json_column_array, $json_argument_array, $get_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     global $user;
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     $argument_array = json_decode($json_argument_array);
     $sample_id = $argument_array[1];
     if (is_numeric($sample_id)) {
         $sample = new Sample($sample_id);
         if ($sample->get_owner_id() == $user->get_user_id() or $user->is_admin() == true) {
             $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 = Sample_Wrapper::list_sample_organisation_units($sample_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) {
                     $list_array[$key]['symbol'] = "<img src='images/icons/organisation_unit.png' alt='' style='border:0;' />";
                     if ($list_array[$key]['organisation_unit_id']) {
                         $organisation_unit = new OrganisationUnit($list_array[$key]['organisation_unit_id']);
                     } else {
                         $organisation_unit = new OrganisationUnit(1);
                     }
                     $list_array[$key]['name'] = $organisation_unit->get_name();
                     $delete_paramquery = $_GET;
                     $delete_paramquery['run'] = "admin_permission_ou_delete";
                     $delete_paramquery['id'] = $list_array[$key]['organisation_unit_id'];
                     unset($delete_paramquery['sure']);
                     $delete_params = http_build_query($delete_paramquery, '', '&#38;');
                     $list_array[$key]['delete']['link'] = $delete_params;
                     $list_array[$key]['delete']['content'] = "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 SampleSecurityAccessDeniedException();
         }
     } else {
         throw new SampleIDMissingException();
     }
 }
Ejemplo n.º 11
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 SampleSecurityAccessDeniedException
  * @throws SampleIDMissingException
  */
 public static function list_location_history($json_column_array, $json_argument_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     global $sample_security;
     $argument_array = json_decode($json_argument_array);
     $sample_id = $argument_array[1];
     if (is_numeric($sample_id)) {
         if ($sample_security->is_access(1, false)) {
             $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 = Sample_Wrapper::list_sample_locations($sample_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) {
                     $list_array[$key]['symbol'] = "<img src='images/icons/sample.png' alt='' style='border:0;' />";
                     $datetime_handler = new DatetimeHandler($list_array[$key]['datetime']);
                     $list_array[$key]['datetime'] = $datetime_handler->get_datetime(false);
                     if ($list_array[$key]['user']) {
                         $user = new User($list_array[$key]['user']);
                     } else {
                         $user = new User(1);
                     }
                     $list_array[$key]['user'] = $user->get_full_name(false);
                 }
             } 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 SampleSecurityAccessDeniedException();
         }
     } else {
         throw new SampleIDMissingException();
     }
 }
Ejemplo n.º 12
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 ItemIDMissingException
  */
 public static function list_projects_by_item_id($json_column_array, $json_argument_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     global $user;
     $argument_array = json_decode($json_argument_array);
     $item_id = $argument_array[0][1];
     if (is_numeric($item_id)) {
         $list_request = new ListRequest_IO();
         if (!is_numeric($entries_per_page) or $entries_per_page < 1) {
             $entries_per_page = 20;
         }
         if ($argument_array[2][1] == true) {
             $list_array = Project_Wrapper::list_projects_by_item_id($item_id, $user->is_admin(), $sortvalue, $sortmethod, $page * $entries_per_page - $entries_per_page, $page * $entries_per_page);
         } else {
             $list_array = Project_Wrapper::list_projects_by_item_id($item_id, $user->is_admin(), $sortvalue, $sortmethod, 0, null);
         }
         $list_request->set_column_array($json_column_array);
         if (is_array($list_array) and count($list_array) >= 1) {
             foreach ($list_array as $key => $value) {
                 $tmp_name = trim($list_array[$key]['name']);
                 unset($list_array[$key]['name']);
                 $list_array[$key]['name']['label'] = $tmp_name;
                 $list_array[$key]['name']['content'] = $tmp_name;
                 $tmp_template = trim($list_array[$key]['template']);
                 unset($list_array[$key]['template']);
                 $list_array[$key]['template']['label'] = $tmp_template;
                 $list_array[$key]['template']['content'] = $tmp_template;
                 $tmp_status = trim($list_array[$key]['status']);
                 unset($list_array[$key]['status']);
                 $list_array[$key]['status']['label'] = $tmp_status;
                 $list_array[$key]['status']['content'] = $tmp_status;
                 if ($list_array[$key]['deleted'] == "t") {
                     $list_array[$key]['name']['content'] = "<span class='crossed'>" . $list_array[$key]['name']['content'] . "</span>";
                     $list_array[$key]['template']['content'] = "<span class='crossed'>" . $list_array[$key]['template']['content'] . "</span>";
                     $list_array[$key]['status']['content'] = "<span class='crossed'>" . $list_array[$key]['status']['content'] . "</span>";
                 }
                 if ($argument_array[1][1] == true) {
                     $column_array = json_decode($json_column_array);
                     if (is_array($column_array) and count($column_array) >= 1) {
                         foreach ($column_array as $row_key => $row_value) {
                             if ($row_value[1] == "checkbox") {
                                 if ($row_value[4]) {
                                     $checkbox_class = $row_value[4];
                                     break;
                                 }
                             }
                         }
                     }
                     if ($checkbox_class) {
                         $list_array[$key]['checkbox'] = "<input type='checkbox' name='parent-project-" . $list_array[$key]['id'] . "' value='1' class='" . $checkbox_class . "' />";
                     } else {
                         $list_array[$key]['checkbox'] = "<input type='checkbox' name='parent-project-" . $list_array[$key]['id'] . "' value='1' />";
                     }
                     $list_array[$key]['symbol'] = "<img src='images/icons/project.png' alt='' style='border:0;' />";
                 } else {
                     $project_id = $list_array[$key]['id'];
                     $project_security = new ProjectSecurity($project_id);
                     if ($project_security->is_access(1, false)) {
                         $paramquery = array();
                         $paramquery['username'] = $_GET['username'];
                         $paramquery['session_id'] = $_GET['session_id'];
                         $paramquery['nav'] = "project";
                         $paramquery['run'] = "detail";
                         $paramquery['project_id'] = $project_id;
                         $params = http_build_query($paramquery, '', '&#38;');
                         $list_array[$key]['symbol']['link'] = $params;
                         $list_array[$key]['symbol']['content'] = "<img src='images/icons/project.png' alt='' style='border:0;' />";
                         $list_array[$key]['name']['link'] = $params;
                     } else {
                         $list_array[$key]['symbol'] = "<img src='core/images/denied_overlay.php?image=images/icons/project.png' alt='N' border='0' />";
                     }
                 }
                 $datetime_handler = new DatetimeHandler($list_array[$key]['datetime']);
                 $list_array[$key]['datetime'] = $datetime_handler->get_datetime(false);
                 if ($list_array[$key]['owner']) {
                     $user = new User($list_array[$key]['owner']);
                 } else {
                     $user = new User(1);
                 }
                 $list_array[$key]['owner'] = $user->get_full_name(true);
             }
         } else {
             $list_request->empty_message("<span class='italic'>No Projects found!</span>");
         }
         $list_request->set_array($list_array);
         return $list_request->get_page($page);
     } else {
         throw new ItemIDMissingException();
     }
 }
Ejemplo n.º 13
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 BaseAjaxArgumentMissingException
  */
 public static function list_samples($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);
     if (is_array($argument_array)) {
         $name = $argument_array[0][1];
         $organisation_unit_array = $argument_array[1][1];
         $template_array = $argument_array[2][1];
         $in_id = $argument_array[3][1];
         $in_name = $argument_array[4][1];
         $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 = Sample_Wrapper::list_sample_search($name, $organisation_unit_array, $template_array, $in_id, $in_name, $sortvalue, $sortmethod, $page * $entries_per_page - $entries_per_page, $page * $entries_per_page);
         if (is_array($list_array) and count($list_array) >= 1) {
             $today_end = new DatetimeHandler(date("Y-m-d") . " 23:59:59");
             foreach ($list_array as $key => $value) {
                 $datetime_handler = new DatetimeHandler($list_array[$key]['datetime']);
                 $list_array[$key]['datetime'] = $datetime_handler->get_datetime(false);
                 if ($list_array[$key]['av'] == "f") {
                     $list_array[$key]['av'] = "<img src='images/icons/grey_point.png' alt='' />";
                 } else {
                     if ($list_array[$key]['date_of_expiry'] and $list_array[$key]['expiry_warning']) {
                         $date_of_expiry = new DatetimeHandler($list_array[$key]['date_of_expiry'] . " 23:59:59");
                         $warning_day = clone $date_of_expiry;
                         $warning_day->sub_day($list_array[$key]['expiry_warning']);
                         if ($date_of_expiry->distance($today_end) > 0) {
                             $list_array[$key]['av'] = "<img src='images/icons/red_point.png' alt='' />";
                         } else {
                             if ($warning_day->distance($today_end) > 0) {
                                 $list_array[$key]['av'] = "<img src='images/icons/yellow_point.png' alt='' />";
                             } else {
                                 $list_array[$key]['av'] = "<img src='images/icons/green_point.png' alt='' />";
                             }
                         }
                     } else {
                         $list_array[$key]['av'] = "<img src='images/icons/green_point.png' alt='' />";
                     }
                 }
                 $sample_id = $list_array[$key]['id'];
                 $sample_security = new SampleSecurity($sample_id);
                 if ($sample_security->is_access(1, false)) {
                     $paramquery = array();
                     $paramquery['username'] = $_GET['username'];
                     $paramquery['session_id'] = $_GET['session_id'];
                     $paramquery['nav'] = "sample";
                     $paramquery['run'] = "detail";
                     $paramquery['sample_id'] = $sample_id;
                     $params = http_build_query($paramquery, '', '&#38;');
                     $list_array[$key]['symbol']['link'] = $params;
                     $list_array[$key]['symbol']['content'] = "<img src='images/icons/sample.png' alt='' style='border:0;' />";
                     unset($list_array[$key]['id']);
                     $list_array[$key]['id']['link'] = $params;
                     $list_array[$key]['id']['content'] = "S" . str_pad($sample_id, 8, '0', STR_PAD_LEFT);
                     $sample_name = $list_array[$key]['name'];
                     unset($list_array[$key]['name']);
                     $list_array[$key]['name']['link'] = $params;
                     $list_array[$key]['name']['content'] = $sample_name;
                 } else {
                     $list_array[$key]['symbol'] = "<img src='core/images/denied_overlay.php?image=images/icons/sample.png' alt='N' border='0' />";
                     $list_array[$key]['id'] = "S" . str_pad($sample_id, 8, '0', STR_PAD_LEFT);
                 }
             }
         } 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 BaseAjaxArgumentMissingException();
     }
 }
Ejemplo n.º 14
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 string
  */
 public static function list_batches($json_column_array, $json_argument_array, $get_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     $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;
     }
     $datetime_handler_end = new DatetimeHandler();
     $datetime_handler_end->sub_day(7);
     $datetime_handler_create = new DatetimeHandler();
     $datetime_handler_create->sub_day(30);
     $list_array = Batch_Wrapper::list_batches($datetime_handler_create->get_formatted_string("Y-m-d H:i:s"), $datetime_handler_end->get_formatted_string("Y-m-d H:i:s"), $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) {
             $datetime_handler = new DatetimeHandler($list_array[$key]['created_at']);
             $list_array[$key]['created_at'] = $datetime_handler->get_datetime(false);
             $user = new User($list_array[$key]['user_id']);
             $list_array[$key]['user'] = $user->get_full_name(true);
             switch ($list_array[$key]['status']) {
                 case "0":
                     $list_array[$key]['symbol'] = "<img src='images/icons/job_queue.png' alt='' />";
                     $list_array[$key]['status'] = "created";
                     break;
                 case "1":
                     $list_array[$key]['symbol'] = "<img src='images/icons/job_queue.png' alt='' />";
                     $list_array[$key]['status'] = "in queue";
                     break;
                 case "2":
                     $list_array[$key]['symbol'] = "<img src='images/icons/job_running.png' alt='' />";
                     $list_array[$key]['status'] = "running";
                     break;
                 case "3":
                     $list_array[$key]['symbol'] = "<img src='images/icons/job_finished.png' alt='' />";
                     $list_array[$key]['status'] = "finished";
                     break;
                 case "4":
                     $list_array[$key]['symbol'] = "<img src='images/icons/job_error.png' alt='' />";
                     $list_array[$key]['status'] = "error";
                     break;
                 default:
                     $list_array[$key]['symbol'] = "<img src='images/icons/job_unknown.png' alt='' />";
                     $list_array[$key]['status'] = "unknow status";
                     break;
             }
         }
     } else {
         $list_request->empty_message("<span class='italic'>No Batches in the last 7 days</span>");
     }
     $list_request->set_array($list_array);
     return $list_request->get_page($page);
 }
Ejemplo n.º 15
0
 /**
  * @param integer $page
  * @param string $sortvalue
  * @param string $sortmethod
  */
 public static function list_manufacturers($json_column_array, $argument_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     global $user;
     $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 = Manufacturer_Wrapper::list_manufacturers($sortvalue, $sortmethod, $page * $entries_per_page - $entries_per_page, $page * $entries_per_page);
     if (is_array($list_array) and count($list_array) >= 1) {
         if ($user->is_admin() == true) {
             $is_admin = true;
         } else {
             $is_admin = false;
         }
         foreach ($list_array as $key => $value) {
             $list_array[$key]['symbol'] = "<img src='images/icons/manufacturer.png' alt='' />";
             $user = new User($list_array[$key]['user_id']);
             $list_array[$key]['user'] = $user->get_full_name(false);
             if ($is_admin == true) {
                 $list_array[$key]['delete'] = "<a href='#' class='ManufacturerListDelete' id='ManufacturerListDelete" . $list_array[$key]['id'] . "'><img src='images/icons/delete.png' alt='' style='border: 0;' /></a>";
             }
         }
     } else {
         $list_request->empty_message("<span class='italic'>No results found!</span>");
     }
     $list_request->set_array($list_array);
     return $list_request->get_page($page);
 }
 /**
  * @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 string
  * @throws BaseUserAccessDeniedException
  */
 public static function list_templates($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()) {
         if ($get_array) {
             $_GET = unserialize($get_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 = Data_Wrapper::list_parameter_templates($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) {
                 $paramquery = $_GET;
                 $paramquery['id'] = $list_array[$key]['id'];
                 $paramquery['action'] = "edit";
                 unset($paramquery['sortvalue']);
                 unset($paramquery['sortmethod']);
                 unset($paramquery['nextpage']);
                 $params = http_build_query($paramquery, '', '&#38;');
                 $name = $list_array[$key]['name'];
                 unset($list_array[$key]['name']);
                 $list_array[$key]['name']['link'] = $params;
                 $list_array[$key]['name']['content'] = $name;
                 $internal_name = $list_array[$key]['internal_name'];
                 unset($list_array[$key]['internal_name']);
                 $list_array[$key]['internal_name']['link'] = $params;
                 $list_array[$key]['internal_name']['content'] = $internal_name;
                 $user = new User($list_array[$key]['created_by']);
                 $list_array[$key]['created_by'] = $user->get_full_name(true);
                 $datetime_handler = new DatetimeHandler($list_array[$key]['datetime']);
                 $list_array[$key]['datetime'] = $datetime_handler->get_datetime(false);
                 if (ParameterTemplate::is_deletable($list_array[$key]['id']) === true) {
                     $list_array[$key]['delete'] = "<a title='delete' style='cursor: pointer;' id='DataParameterTemplateDeleteButton" . $list_array[$key]['id'] . "' class='DataParameterTemplateDeleteButton'><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();
     }
 }
Ejemplo n.º 17
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 string
  * @throws BaseUserAccessDeniedException
  */
 public static function list_paper_sizes($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()) {
         $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_paper_sizes($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) {
                 $list_array[$key]['symbol'] = "<img src='images/icons/text.png' alt='' />";
                 if ($value['standard'] == 't') {
                     $list_array[$key]['name'] = $list_array[$key]['name'] . " <img src='images/icons/status_ok.png' alt='Standard' />";
                 }
                 $list_array[$key]['width'] = $list_array[$key]['width'] . " mm";
                 $list_array[$key]['height'] = $list_array[$key]['height'] . " mm";
                 $list_array[$key]['margin_left'] = $list_array[$key]['margin_left'] . " mm";
                 $list_array[$key]['margin_right'] = $list_array[$key]['margin_right'] . " mm";
                 $list_array[$key]['margin_top'] = $list_array[$key]['margin_top'] . " mm";
                 $list_array[$key]['margin_bottom'] = $list_array[$key]['margin_bottom'] . " mm";
                 $list_array[$key]['edit'] = "<a href='#' class='BaseAdminPaperSizeEdit' id='BaseAdminPaperSizeEdit" . $list_array[$key]['id'] . "'><img src='images/icons/edit.png' alt='' style='border: 0;' /></a>";
                 if ($value['base'] == 'f') {
                     $list_array[$key]['delete'] = "<a href='#' class='BaseAdminPaperSizeDelete' id='BaseAdminPaperSizeDelete" . $list_array[$key]['id'] . "'><img src='images/icons/delete.png' alt='' style='border: 0;' /></a>";
                 }
             }
         } 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();
     }
 }
Ejemplo n.º 18
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();
     }
 }
Ejemplo n.º 19
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 $page
  * @param string $sortvalue
  * @param string $sortmethod
  * @return string
  */
 public static function list_organisation_unit_related_equipment($json_column_array, $json_argument_array, $get_array, $css_page_id, $css_row_sort_id, $page, $sortvalue, $sortmethod)
 {
     $argument_array = json_decode($json_argument_array);
     $organisation_unit_id = $argument_array[1];
     if (is_numeric($organisation_unit_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 = Equipment_Wrapper::list_organisation_unit_equipments($organisation_unit_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) {
                 $paramquery = $_GET;
                 $paramquery['action'] = "detail";
                 $paramquery['id'] = $list_array[$key]['id'];
                 $params = http_build_query($paramquery, '', '&#38;');
                 $list_array[$key]['symbol']['link'] = $params;
                 $list_array[$key]['symbol']['content'] = "<img src='images/icons/equipment.png' alt='N' border='0' />";
                 if ($list_array[$key]['organisation_unit_id'] != $_GET['ou_id']) {
                     $equipment_name = $list_array[$key]['name'];
                     unset($list_array[$key]['name']);
                     $list_array[$key]['name']['link'] = $params;
                     $list_array[$key]['name']['content'] = $equipment_name . " (CH)";
                 } else {
                     $equipment_name = $list_array[$key]['name'];
                     unset($list_array[$key]['name']);
                     $list_array[$key]['name']['link'] = $params;
                     $list_array[$key]['name']['content'] = $equipment_name;
                 }
             }
         } else {
             $list_request->empty_message("<span class='italic'>No results found!</span>");
         }
         $list_request->set_array($list_array);
         return $list_request->get_page($page);
     }
 }
Ejemplo n.º 20
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 BaseAjaxArgumentMissingException
  */
 public static function list_groups($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);
     if (is_array($argument_array)) {
         $string = $argument_array[1];
         $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 = User_Wrapper::list_search_groups($string, $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) {
                 $list_array[$key]['symbol'] = "<img src='images/icons/groups.png' alt='N' border='0' />";
                 $group_paramquery = array();
                 $group_paramquery['username'] = $_GET['username'];
                 $group_paramquery['session_id'] = $_GET['session_id'];
                 $group_paramquery['nav'] = "search";
                 $group_paramquery['run'] = "common_dialog";
                 $group_paramquery['dialog'] = "group_detail";
                 $group_paramquery['id'] = $value['id'];
                 $group_params = http_build_query($group_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'] = $group_params;
             }
         } 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 BaseAjaxArgumentMissingException();
     }
 }
Ejemplo n.º 21
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 ProjectSecurityAccessDeniedException
  * @throws ProjectIDMissingException
  */
 public static function list_project_permissions($json_column_array, $json_argument_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     global $user, $project_security;
     $argument_array = json_decode($json_argument_array);
     $project_id = $argument_array[1];
     if (is_numeric($project_id)) {
         $project = new Project($project_id);
         $project_permission_array = ProjectPermission::list_entries_by_project_id($project_id);
         if ($user->get_user_id() == $project->get_owner_id() or $project_security->is_access(2, false) == true or $project_security->is_access(4, false) == true or $project_security->is_access(7, false) == true) {
             $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_permissions($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) {
                 $project = new Project($project_id);
                 $project_security = new ProjectSecurity($project_id);
                 foreach ($list_array as $key => $value) {
                     $list_array[$key]['symbol'] = "<img src='images/icons/permissions.png' alt='N' border='0' />";
                     $project_permission = ProjectPermission::get_instance($list_array[$key]['id']);
                     $user_id = $project_permission->get_user_id();
                     $group_id = $project_permission->get_group_id();
                     $organ_unit_id = $project_permission->get_organisation_unit_id();
                     if ($user_id) {
                         $permission_user = new User($user_id);
                         $list_array[$key]['name'] = $permission_user->get_username();
                         $list_array[$key]['type'] = "user";
                         $list_array[$key]['fullname'] = $permission_user->get_full_name(false);
                     } elseif ($group_id) {
                         $list_array[$key]['type'] = "group";
                     } else {
                         $list_array[$key]['type'] = "organisation unit";
                     }
                     if ($project_permission->get_owner_id() == null) {
                         $list_array[$key]['createdby'] = "system";
                     } else {
                         $created_by = new User($project_permission->get_owner_id());
                         $list_array[$key]['createdby'] = $created_by->get_username();
                     }
                     $permission_array = $project_permission->get_permission_array();
                     if ($project_security->is_access(2, false) or $project->get_owner_id() == $user->get_user_id()) {
                         if ($permission_array['read'] == true) {
                             $list_array[$key]['re'] = "<img src='images/icons/permission_ok_active.png' alt='' />";
                         } else {
                             $list_array[$key]['re'] = "<img src='images/icons/permission_denied_active.png' alt='' />";
                         }
                     } else {
                         if ($permission_array['read'] == true) {
                             $list_array[$key]['re'] = "<img src='images/icons/permission_ok_active_na.png' alt='' />";
                         } else {
                             $list_array[$key]['re'] = "<img src='images/icons/permission_denied_active_na.png' alt='' />";
                         }
                     }
                     if ($project_security->is_access(7, false) or $project->get_owner_id() == $user->get_user_id()) {
                         if ($permission_array['set_readable'] == true) {
                             $list_array[$key]['sr'] = "<img src='images/icons/permission_ok_active.png' alt='' />";
                         } else {
                             $list_array[$key]['sr'] = "<img src='images/icons/permission_denied_active.png' alt='' />";
                         }
                     } else {
                         if ($permission_array['set_readable'] == true) {
                             $list_array[$key]['sr'] = "<img src='images/icons/permission_ok_active_na.png' alt='' />";
                         } else {
                             $list_array[$key]['sr'] = "<img src='images/icons/permission_denied_active_na.png' alt='' />";
                         }
                     }
                     if ($project_security->is_access(4, false) or $project->get_owner_id() == $user->get_user_id()) {
                         if ($permission_array['write'] == true) {
                             $list_array[$key]['wr'] = "<img src='images/icons/permission_ok_active.png' alt='' />";
                         } else {
                             $list_array[$key]['wr'] = "<img src='images/icons/permission_denied_active.png' alt='' />";
                         }
                     } else {
                         if ($permission_array['write'] == true) {
                             $list_array[$key]['wr'] = "<img src='images/icons/permission_ok_active_na.png' alt='' />";
                         } else {
                             $list_array[$key]['wr'] = "<img src='images/icons/permission_denied_active_na.png' alt='' />";
                         }
                     }
                     if ($project_security->is_access(7, false) or $project->get_owner_id() == $user->get_user_id()) {
                         if ($permission_array['set_writeable'] == true) {
                             $list_array[$key]['sw'] = "<img src='images/icons/permission_ok_active.png' alt='' />";
                         } else {
                             $list_array[$key]['sw'] = "<img src='images/icons/permission_denied_active.png' alt='' />";
                         }
                     } else {
                         if ($permission_array['set_writeable'] == true) {
                             $list_array[$key]['sw'] = "<img src='images/icons/permission_ok_active_na.png' alt='' />";
                         } else {
                             $list_array[$key]['sw'] = "<img src='images/icons/permission_denied_active_na.png' alt='' />";
                         }
                     }
                     if ($project_security->is_access(7, false)) {
                         if ($permission_array['reactivate'] == true) {
                             $list_array[$key]['ra'] = "<img src='images/icons/permission_ok_active.png' alt='' />";
                         } else {
                             $list_array[$key]['ra'] = "<img src='images/icons/permission_denied_active.png' alt='' />";
                         }
                         if ($permission_array['delete'] == true) {
                             $list_array[$key]['de'] = "<img src='images/icons/permission_ok_active.png' alt='' />";
                         } else {
                             $list_array[$key]['de'] = "<img src='images/icons/permission_denied_active.png' alt='' />";
                         }
                         if ($permission_array['set_permissions'] == true) {
                             $list_array[$key]['sp'] = "<img src='images/icons/permission_ok_active.png' alt='' />";
                         } else {
                             $list_array[$key]['sp'] = "<img src='images/icons/permission_denied_active.png' alt='' />";
                         }
                     } else {
                         if ($permission_array['reactivate'] == true) {
                             $list_array[$key]['ra'] = "<img src='images/icons/permission_ok_active_na.png' alt='' />";
                         } else {
                             $list_array[$key]['ra'] = "<img src='images/icons/permission_denied_active_na.png' alt='' />";
                         }
                         if ($permission_array['delete'] == true) {
                             $list_array[$key]['de'] = "<img src='images/icons/permission_ok_active_na.png' alt='' />";
                         } else {
                             $list_array[$key]['de'] = "<img src='images/icons/permission_denied_active_na.png' alt='' />";
                         }
                         if ($permission_array['set_permissions'] == true) {
                             $list_array[$key]['sp'] = "<img src='images/icons/permission_ok_active_na.png' alt='' />";
                         } else {
                             $list_array[$key]['sp'] = "<img src='images/icons/permission_denied_active_na.png' alt='' />";
                         }
                     }
                     $edit_paramquery = array();
                     $edit_paramquery['username'] = $_GET['username'];
                     $edit_paramquery['session_id'] = $_GET['session_id'];
                     $edit_paramquery['nav'] = "project";
                     $edit_paramquery['run'] = "admin_permission_edit";
                     $edit_paramquery['project_id'] = $project_id;
                     $edit_paramquery['id'] = $list_array[$key]['id'];
                     $edit_params = http_build_query($edit_paramquery, '', '&#38;');
                     $list_array[$key]['e']['link'] = $edit_params;
                     $list_array[$key]['e']['content'] = "E";
                     if ($project_permission->get_intention() == null) {
                         $delete_paramquery = array();
                         $delete_paramquery['username'] = $_GET['username'];
                         $delete_paramquery['session_id'] = $_GET['session_id'];
                         $delete_paramquery['nav'] = "project";
                         $delete_paramquery['run'] = "admin_permission_delete";
                         $delete_paramquery['project_id'] = $project_id;
                         $delete_paramquery['id'] = $list_array[$key]['id'];
                         $delete_params = http_build_query($delete_paramquery, '', '&#38;');
                         $list_array[$key]['d']['link'] = $delete_params;
                         $list_array[$key]['d']['content'] = "D";
                     } else {
                         $list_array[$key]['d']['content'] = "";
                     }
                 }
             } else {
                 $list_request->empty_message("<span class='italic'>No permissions found!</span>");
             }
             $list_request->set_array($list_array);
             return $list_request->get_page($page);
         } else {
             throw new ProjectSecurityAccessDeniedException();
         }
     } else {
         throw new ProjectIDMissingException();
     }
 }
Ejemplo n.º 22
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 BaseAjaxArgumentMissingException
  */
 public static function list_data($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);
     if (is_array($argument_array)) {
         $folder_id = $argument_array[0][1];
         $name = $argument_array[1][1];
         $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 = Data_Wrapper::list_search_ffv($folder_id, $name, $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) {
                 $datetime_handler = new DatetimeHandler($list_array[$key]['datetime']);
                 $list_array[$key]['datetime'] = $datetime_handler->get_datetime(false);
                 $owner = new User($value['owner']);
                 $list_array[$key]['owner'] = $owner->get_full_name(true);
                 if (is_numeric($value['file_id'])) {
                     $file = File::get_instance($value['file_id']);
                     $paramquery = $_GET;
                     $paramquery['nav'] = "data";
                     $paramquery['action'] = "file_detail";
                     $paramquery['file_id'] = $value['file_id'];
                     unset($paramquery['sortvalue']);
                     unset($paramquery['sortmethod']);
                     unset($paramquery['nextpage']);
                     $params = http_build_query($paramquery, '', '&#38;');
                     $tmp_name = $value['name'];
                     unset($list_array[$key]['name']);
                     $list_array[$key]['name']['content'] = $tmp_name;
                     if ($file->is_read_access() == true) {
                         $list_array[$key]['symbol']['link'] = $params;
                         $list_array[$key]['symbol']['content'] = "<img src='" . File::get_icon_by_name($value['name']) . "' alt='' style='border:0;' />";
                         $list_array[$key]['name']['link'] = $params;
                     } else {
                         $list_array[$key]['symbol']['link'] = "";
                         $list_array[$key]['symbol']['content'] = "<img src='core/images/denied_overlay.php?image=" . File::get_icon_by_name($value['name']) . "' alt='' border='0' />";
                         $list_array[$key]['name']['link'] = "";
                     }
                     $list_array[$key]['type'] = "File";
                     $list_array[$key]['version'] = $file->get_version();
                     $list_array[$key]['size'] = Convert::convert_byte_1024($file->get_size());
                     $list_array[$key]['permission'] = $file->get_permission_string();
                 }
                 if (is_numeric($value['value_id'])) {
                     $value_obj = Value::get_instance($value['value_id']);
                     $paramquery = $_GET;
                     $paramquery['nav'] = "data";
                     $paramquery['action'] = "value_detail";
                     $paramquery['value_id'] = $value['value_id'];
                     unset($paramquery['sortvalue']);
                     unset($paramquery['sortmethod']);
                     unset($paramquery['nextpage']);
                     $params = http_build_query($paramquery, '', '&#38;');
                     $tmp_name = $value['name'];
                     unset($list_array[$key]['name']);
                     $list_array[$key]['name']['content'] = $tmp_name;
                     if ($value_obj->is_read_access() == true) {
                         $list_array[$key]['symbol']['link'] = $params;
                         $list_array[$key]['symbol']['content'] = "<img src='images/fileicons/16/unknown.png' alt='' style='border: 0;'>";
                         $list_array[$key]['name']['link'] = $params;
                     } else {
                         $list_array[$key]['symbol']['link'] = "";
                         $list_array[$key]['symbol']['content'] = "<img src='core/images/denied_overlay.php?image=images/fileicons/16/unknown.png' alt='' border='0' />";
                         $list_array[$key]['name']['link'] = "";
                     }
                     $list_array[$key]['type'] = "Value";
                     $list_array[$key]['version'] = $value_obj->get_version();
                     $list_array[$key]['permission'] = $value_obj->get_permission_string();
                 }
                 if (is_numeric($value['folder_id'])) {
                     $folder = Folder::get_instance($value['folder_id']);
                     $paramquery = $_GET;
                     $paramquery['nav'] = "data";
                     $paramquery['folder_id'] = $value['folder_id'];
                     unset($paramquery['run']);
                     unset($paramquery['sortvalue']);
                     unset($paramquery['sortmethod']);
                     unset($paramquery['nextpage']);
                     $params = http_build_query($paramquery, '', '&#38;');
                     $tmp_name = $value['name'];
                     unset($list_array[$key]['name']);
                     $list_array[$key]['name']['content'] = $tmp_name;
                     if ($folder->is_read_access() == true) {
                         $list_array[$key]['symbol']['link'] = $params;
                         $list_array[$key]['symbol']['content'] = "<img src='images/icons/folder.png' alt='' style='border: 0;'>";
                         $list_array[$key]['name']['link'] = $params;
                     } else {
                         $list_array[$key]['symbol']['link'] = "";
                         $list_array[$key]['symbol']['content'] = "<img src='core/images/denied_overlay.php?image=images/icons/folder.png' alt='' border='0' />";
                         $list_array[$key]['name']['link'] = "";
                     }
                     $list_array[$key]['type'] = "Folder";
                     $list_array[$key]['permission'] = $folder->get_permission_string();
                 }
             }
         } 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 BaseAjaxArgumentMissingException();
     }
 }
Ejemplo n.º 23
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 string
  * @throws BaseUserAccessDeniedException
  */
 public static function list_service($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()) {
         if ($get_array) {
             $_GET = unserialize($get_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 = System_Wrapper::list_base_service($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) {
                 $list_array[$key]['icon'] = "<img src='images/icons/service.png' alt='' style='border: 0;' />";
                 switch ($list_array[$key]['status']) {
                     case "0":
                         $list_array[$key]['status'] = "Stopped";
                         $list_array[$key]['start'] = "<a href='#' class='BaseAdminServiceStartButton' id='BaseAdminServiceStartButton" . $list_array[$key]['id'] . "'><img src='images/icons/service_start.png' alt='E' style='border: 0;' /></a>";
                         $list_array[$key]['stop'] = "<a href='#'><img src='images/icons/service_stop_d.png' alt='E' style='border: 0;' /></a>";
                         break;
                     case "1":
                         $service = new Service($list_array[$key]['id']);
                         if ($service->is_responding() == false) {
                             $list_array[$key]['status'] = "Not Responing (Not Running?)";
                             $list_array[$key]['start'] = "<a href='#' class='BaseAdminServiceStartButton' id='BaseAdminServiceStartButton" . $list_array[$key]['id'] . "'><img src='images/icons/service_start.png' alt='E' style='border: 0;' /></a>";
                             $list_array[$key]['stop'] = "<a href='#' class='BaseAdminServiceStopButton' id='BaseAdminServiceStopButton" . $list_array[$key]['id'] . "'><img src='images/icons/service_stop.png' alt='E' style='border: 0;' /></a>";
                         } else {
                             $list_array[$key]['status'] = "Running";
                             $list_array[$key]['start'] = "<a href='#'><img src='images/icons/service_start_d.png' alt='E' style='border: 0;' /></a>";
                             $list_array[$key]['stop'] = "<a href='#' class='BaseAdminServiceStopButton' id='BaseAdminServiceStopButton" . $list_array[$key]['id'] . "'><img src='images/icons/service_stop.png' alt='E' style='border: 0;' /></a>";
                         }
                         break;
                     case "2":
                         $service = new Service($list_array[$key]['id']);
                         if ($service->is_responding() == false) {
                             $list_array[$key]['status'] = "Stopping (Not Responing)";
                             $list_array[$key]['start'] = "<a href='#'><img src='images/icons/service_start_d.png' alt='E' style='border: 0;' /></a>";
                             $list_array[$key]['stop'] = "<a href='#' class='BaseAdminServiceStopButton' id='BaseAdminServiceStopButton" . $list_array[$key]['id'] . "'><img src='images/icons/service_stop.png' alt='E' style='border: 0;' /></a>";
                         } else {
                             $list_array[$key]['status'] = "Stopping";
                             $list_array[$key]['start'] = "<a href='#'><img src='images/icons/service_start_d.png' alt='E' style='border: 0;' /></a>";
                             $list_array[$key]['stop'] = "<a href='#'><img src='images/icons/service_stop_d.png' alt='E' style='border: 0;' /></a>";
                         }
                         break;
                     case "3":
                         $service = new Service($list_array[$key]['id']);
                         if ($service->is_responding() == false) {
                             $list_array[$key]['status'] = "Stopping (Not Responing)";
                             $list_array[$key]['start'] = "<a href='#'><img src='images/icons/service_start_d.png' alt='E' style='border: 0;' /></a>";
                             $list_array[$key]['stop'] = "<a href='#' class='BaseAdminServiceStopButton' id='BaseAdminServiceStopButton" . $list_array[$key]['id'] . "'><img src='images/icons/service_stop.png' alt='E' style='border: 0;' /></a>";
                         } else {
                             $list_array[$key]['status'] = "Stopping (Hard)";
                             $list_array[$key]['start'] = "<a href='#'><img src='images/icons/service_start_d.png' alt='E' style='border: 0;' /></a>";
                             $list_array[$key]['stop'] = "<a href='#'><img src='images/icons/service_stop_d.png' alt='E' style='border: 0;' /></a>";
                         }
                         break;
                     case "4":
                         $list_array[$key]['status'] = "Error";
                         $list_array[$key]['start'] = "<a href='#' class='BaseAdminServiceStartButton' id='BaseAdminServiceStartButton" . $list_array[$key]['id'] . "'><img src='images/icons/service_start.png' alt='E' style='border: 0;' /></a>";
                         $list_array[$key]['stop'] = "<a href='#'><img src='images/icons/service_stop_d.png' alt='E' style='border: 0;' /></a>";
                         break;
                     default:
                         $list_array[$key]['status'] = "Unknown Status";
                         $list_array[$key]['start'] = "<a href='#' class='BaseAdminServiceStartButton' id='BaseAdminServiceStartButton" . $list_array[$key]['id'] . "'><img src='images/icons/service_start.png' alt='E' style='border: 0;' /></a>";
                         $list_array[$key]['stop'] = "<a href='#' class='BaseAdminServiceStopButton' id='BaseAdminServiceStopButton" . $list_array[$key]['id'] . "'><img src='images/icons/service_stop.png' alt='E' style='border: 0;' /></a>";
                         break;
                 }
             }
         } 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();
     }
 }
Ejemplo n.º 24
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 BaseAjaxArgumentMissingException
  */
 public static function list_items($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);
     if (is_array($argument_array)) {
         $string = $argument_array[0][1];
         $item_type_array = $argument_array[1][1];
         $language_id = $argument_array[2][1];
         $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 = Item_Wrapper::list_fulltext_search($string, $item_type_array, $language_id, $sortvalue, $sortmethod, $page * $entries_per_page - $entries_per_page, $page * $entries_per_page);
         if (is_array($list_array) and count($list_array) >= 1) {
             $item_type_array = Item::list_types();
             foreach ($list_array as $key => $value) {
                 $datetime_handler = new DatetimeHandler($list_array[$key]['datetime']);
                 $list_array[$key]['datetime'] = $datetime_handler->get_datetime(false);
                 $sample_paramquery = array();
                 $sample_paramquery['username'] = $_GET['username'];
                 $sample_paramquery['session_id'] = $_GET['session_id'];
                 $sample_paramquery['nav'] = "sample";
                 $sample_paramquery['run'] = "detail";
                 $sample_paramquery['sample_id'] = $value['sample_id'];
                 $sample_params = http_build_query($sample_paramquery, '', '&#38;');
                 $tmp_sample_name = $list_array[$key]['sample_name'];
                 unset($list_array[$key]['sample_name']);
                 $list_array[$key]['sample_name']['content'] = $tmp_sample_name;
                 $list_array[$key]['sample_name']['link'] = $sample_params;
                 if (is_array($item_type_array) and count($item_type_array) >= 1) {
                     foreach ($item_type_array as $item_key => $item_value) {
                         if ($value[$item_key . "_id"] != null) {
                             $list_array[$key]['type'] = $item_value::get_generic_name($item_key, null);
                             $tmp_item_name = $list_array[$key]['name'];
                             unset($list_array[$key]['name']);
                             $list_array[$key]['name']['content'] = $tmp_item_name;
                             $list_array[$key]['name']['link'] = $item_value::get_generic_link($item_key, $value[$item_key . "_id"]);
                             $list_array[$key]['symbol']['content'] = $item_value::get_generic_symbol($item_key, $value[$item_key . "_id"]);
                             $list_array[$key]['symbol']['link'] = $item_value::get_generic_link($item_key, $value[$item_key . "_id"]);
                         }
                     }
                 }
             }
         } 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 BaseAjaxArgumentMissingException();
     }
 }
Ejemplo n.º 25
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 string
  * @throws UserIDMissingException
  */
 public static function list_organisation_units_by_user_id($json_column_array, $json_argument_array, $get_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     $argument_array = json_decode($json_argument_array);
     $user_id = $argument_array[1];
     if (is_numeric($user_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 = OrganisationUnit_Wrapper::list_organisation_units_by_user_id($user_id, $sortvalue, $sortmethod, $page * $entries_per_page - $entries_per_page, $page * $entries_per_page);
         if (is_array($list_array) and count($list_array) >= 1) {
             $module_link_array = ModuleLink::list_links_by_type("ou_navigation");
             foreach ($list_array as $key => $value) {
                 $paramquery['username'] = $_GET['username'];
                 $paramquery['session_id'] = $_GET['session_id'];
                 if (is_array($module_link_array[0]['array']) and count($module_link_array[0]['array']) >= 1) {
                     foreach ($module_link_array[0]['array'] as $array_key => $array_value) {
                         if ($array_value == "%OU_ID%") {
                             $paramquery['ou_id'] = $list_array[$key]['id'];
                         } else {
                             $paramquery[$array_key] = $array_value;
                         }
                     }
                 }
                 $params = http_build_query($paramquery, '', '&#38;');
                 $tmp_symbol = $list_array[$key]['symbol'];
                 unset($list_array[$key]['symbol']);
                 $list_array[$key]['symbol']['link'] = $params;
                 $list_array[$key]['symbol']['content'] = "<img src='images/icons/" . $tmp_symbol . "' alt='N' border='0' />";
                 $tmp_name = $list_array[$key]['name'];
                 unset($list_array[$key]['name']);
                 $list_array[$key]['name']['link'] = $params;
                 $list_array[$key]['name']['content'] = $tmp_name;
                 if ($list_array[$key]['is_member']) {
                     $my_status_string = "Member";
                 }
                 if ($list_array[$key]['is_owner']) {
                     if ($my_status_string) {
                         $my_status_string .= ", Owner";
                     } else {
                         $my_status_string = "Owner";
                     }
                 }
                 if ($list_array[$key]['is_leader']) {
                     if ($my_status_string) {
                         $my_status_string .= ", Leader";
                     } else {
                         $my_status_string = "Leader";
                     }
                 }
                 if ($list_array[$key]['is_quality_manager']) {
                     if ($my_status_string) {
                         $my_status_string .= ", Quality Manager";
                     } else {
                         $my_status_string = "Quality Manager";
                     }
                 }
                 $list_array[$key]['mystatus'] = $my_status_string;
             }
         } else {
             $list_request->empty_message("<span class='italic'>No Organisation Unit found!</span>");
         }
         $list_request->set_array($list_array);
         return $list_request->get_page($page);
     } else {
         throw new UserIDMissingException();
     }
 }
Ejemplo n.º 26
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 string
  * @throws DataSecurityAccessDeniedException
  * @throws FileIDMissingException
  */
 public static function list_versions($json_column_array, $json_argument_array, $get_array, $css_page_id, $css_row_sort_id, $entries_per_page, $page, $sortvalue, $sortmethod)
 {
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     $argument_array = json_decode($json_argument_array);
     $file_id = $argument_array[1];
     if (is_numeric($file_id)) {
         $file = File::get_instance($file_id);
         if ($file->is_read_access()) {
             $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 = Data_Wrapper::list_file_versions($file_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) {
                     $file_version = clone $file;
                     $file_version->open_internal_revision($value['internal_revision']);
                     $paramquery = $_GET;
                     $paramquery['action'] = "file_detail";
                     $paramquery['version'] = $list_array[$key]['internal_revision'];
                     $params = http_build_query($paramquery, '', '&#38;');
                     $list_array[$key]['symbol']['link'] = $params;
                     $list_array[$key]['symbol']['content'] = "<img src='" . $file_version->get_icon() . "' alt='' style='border:0;' />";
                     $tmp_name = $list_array[$key]['name'];
                     unset($list_array[$key]['name']);
                     $list_array[$key]['name']['link'] = $params;
                     $list_array[$key]['name']['content'] = $tmp_name;
                     $datetime_handler = new DatetimeHandler($list_array[$key]['datetime']);
                     $list_array[$key]['datetime'] = $datetime_handler->get_datetime(false);
                     $user = new User($list_array[$key]['owner_id']);
                     $list_array[$key]['user'] = $user->get_full_name(false);
                     if ($file_version->is_current() == true) {
                         $list_array[$key]['version'] = $file_version->get_version() . " <span class='italic'>current</span>";
                     } else {
                         $list_array[$key]['version'] = $file_version->get_version();
                     }
                 }
             } 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 DataSecurityAccessDeniedException();
         }
     } else {
         throw new FileIDMissingException();
     }
 }
 /**
  * @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 string
  * @throws BaseUserAccessDeniedException
  * @throws OrganisationUnitIDMissingException
  */
 public static function list_groups($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()) {
         if ($get_array) {
             $_GET = unserialize($get_array);
         }
         $argument_array = json_decode($json_argument_array);
         $organisation_unit_id = $argument_array[1];
         if (is_numeric($organisation_unit_id)) {
             $type_id = $argument_array[1];
             $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 = OrganisationUnit_Wrapper::list_organisation_unit_groups($organisation_unit_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) {
                     $group = new Group($value['id']);
                     $list_array[$key]['symbol'] = "<img src='images/icons/groups.png' alt='' />";
                     $list_array[$key]['groupname'] = $group->get_name();
                     $list_array[$key]['delete'] = "<a href='#' class='OrganisationUnitAdminListDelete' id='OrganisationUnitAdminListDelete" . $list_array[$key]['id'] . "'><img src='images/icons/delete.png' alt='' style='border: 0;' /></a>";
                 }
             } 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 OrganisationUnitIDMissingException();
         }
     } else {
         throw new BaseUserAccessDeniedException();
     }
 }