function testConstructor() { $test_project = new Project("03-12-14", "Address", null, "Food Delivery", 10, 13, 5, "malcom1234567890+Malcom+Jones", 18, "hiya"); echo "Testing mm_dd_yy" . '</br>'; if ($test_project->get_mm_dd_yy() == "03-12-14") { echo 'mm_dd_yy test succeeded </br>'; } else { echo 'mm_dd_yy test failed </br>'; } if ($test_project->get_name() == "Food Delivery") { echo 'name test succeeded </br>'; } else { echo 'name test failed </br>'; } if ($test_project->get_start_time() == 10) { echo 'start time test succeeded </br>'; } else { echo 'start time test failed </br>'; } if ($test_project->get_end_time() == 13) { echo 'end time test succeeded </br>'; } else { echo 'end time test failed </br>'; } if ($test_project->get_vacancies() == 5) { echo 'vacancies test succeeded </br>'; } else { echo 'vacancies test failed </br>'; } if ($test_project->get_persons() == "malcom1234567890+Malcom+Jones") { echo 'persons test succeeded </br>'; } else { echo 'persons test failed </br>'; } }
/** * @throws ProjectIDMissingException * @throws ProjectSecurityAccessDeniedException */ public static function move() { global $project_security, $user; if ($_GET['project_id']) { $project = new Project($_GET['project_id']); if ($user->get_user_id() == $project->get_owner_id() or $project_security->is_access(7, false) == true) { if ($_GET['nextpage'] == 1) { if (is_numeric($_POST['type'])) { $page_1_passed = true; } else { $page_1_passed = false; $error = "You must make a selection."; } } elseif ($_GET['nextpage'] > 1) { $page_1_passed = true; } else { $page_1_passed = false; $error = ""; } if ($page_1_passed == false) { $template = new HTMLTemplate("project/admin/move_page_1.html"); $paramquery = $_GET; $paramquery['nextpage'] = "1"; $params = http_build_query($paramquery, '', '&'); $template->set_var("params", $params); $template->set_var("error", $error); $template->output(); } else { if ($_POST['type'] == 1) { if ($_GET['nextpage'] == 2) { if (is_numeric($_POST['ou'])) { $page_2_passed = true; } else { $page_2_passed = false; $error = "You must select an organisation unit."; } } elseif ($_GET['nextpage'] > 3) { $page_2_passed = true; } else { $page_2_passed = false; $error = ""; } if ($page_2_passed == false) { $template = new HTMLTemplate("project/admin/move_page_2_ou.html"); $paramquery = $_GET; $paramquery['nextpage'] = "2"; $params = http_build_query($paramquery, '', '&'); $template->set_var("params", $params); $template->set_var("error", $error); $organisation_unit_array = OrganisationUnit::list_entries(); $result = array(); $counter = 0; foreach ($organisation_unit_array as $key => $value) { $organisation_unit = new OrganisationUnit($value); $result[$counter]['value'] = $value; $result[$counter]['content'] = $organisation_unit->get_name(); $counter++; } $template->set_var("option", $result); $template->set_var("type", $_POST['type']); $template->output(); } else { $project = new Project($_GET['project_id']); $paramquery = $_GET; unset($paramquery['nextpage']); $paramquery['run'] = "admin"; $params = http_build_query($paramquery); if ($project->move_to_organisation_unit($_POST['ou'])) { Common_IO::step_proceed($params, "Move Project", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Move Project", "Operation Failed", null); } } } else { if ($_GET['nextpage'] == 2) { if (is_numeric($_POST['project'])) { $page_2_passed = true; } else { $page_2_passed = false; $error = "You must select a project."; } } elseif ($_GET['nextpage'] > 3) { $page_2_passed = true; } else { $page_2_passed = false; $error = ""; } if ($page_2_passed == false) { $template = new HTMLTemplate("project/admin/move_page_2_project.html"); $paramquery = $_GET; $paramquery['nextpage'] = "2"; $params = http_build_query($paramquery, '', '&'); $template->set_var("params", $params); $template->set_var("error", $error); $result = array(); $counter = 0; $project = new Project(null); $project_array = $project->get_project_tree(); foreach ($project_array as $key => $value) { $project = new Project($value['id']); for ($i = 1; $i <= $value['layer']; $i++) { $pre_content .= " "; } $result[$counter]['value'] = $value['id']; $result[$counter]['content'] = $pre_content . "" . $project->get_name(); $counter++; unset($pre_content); } if (!$result) { $result[$counter]['value'] = "0"; $result[$counter]['content'] = "NO PROJECT FOUND!"; } $template->set_var("option", $result); $template->set_var("type", $_POST['type']); $template->output(); } else { $project = new Project($_GET['project_id']); $paramquery = $_GET; unset($paramquery['nextpage']); $paramquery['run'] = "admin"; $params = http_build_query($paramquery); if ($project->move_to_project($_POST['project'])) { Common_IO::step_proceed($params, "Move Project", "Operation Successful", null); } else { Common_IO::step_proceed($params, "Move Project", "Operation Failed", null); } } } } } else { throw new ProjectSecurityAccessDeniedException(); } } else { throw new ProjectIDMissingException(); } }
/** * @param string $get_array * @return string * @throws ProjectSecurityAccessDeniedException * @throws ProjectIDMissingException */ public static function get_project_admin_menu($get_array) { global $user; if ($get_array) { $_GET = unserialize($get_array); } if ($_GET['project_id']) { $project = new Project($_GET['project_id']); $project_security = new ProjectSecurity($_GET['project_id']); $project_owner = new User($project->get_owner_id()); $organisation_unit_id = $project->get_organisation_unit_id(); $parent_project_id = $project->get_project_toid(); if ($user->get_user_id() == $project->get_owner_id() or $project_security->is_access(2, false) == true or $project_security->is_access(3, false) == true or $project_security->is_access(4, false) == true or $project_security->is_access(5, false) == true or $project_security->is_access(6, false) == true or $project_security->is_access(7, false) == true) { if ($organisation_unit_id) { $organisation_unit = new OrganisationUnit($organisation_unit_id); $parent = $organisation_unit->get_name(); $parent_type = "Organisation Unit"; } else { $parent_project = new Project($parent_project_id); $parent = $parent_project->get_name(); $parent_type = "Project"; } $template = new HTMLTemplate("project/ajax/admin/menu.html"); $template->set_var("name", $project->get_name()); $template->set_var("owner", $project_owner->get_full_name(false)); $template->set_var("parent", $parent); $template->set_var("parent_type", $parent_type); if ($user->is_admin()) { $template->set_var("admin", true); } else { $template->set_var("admin", false); } if ($project_security->is_access(7, false) == true or $project->get_owner_id() == $user->get_user_id()) { $template->set_var("owner_permission", true); } else { $template->set_var("owner_permission", false); } if ($project_security->is_access(6, false) == true) { $template->set_var("delete", true); } else { $template->set_var("delete", false); } if ($project_security->is_access(3, false) == true) { $template->set_var("write", true); } else { $template->set_var("write", false); } if ($project->get_current_status_id() == 0) { $template->set_var("project_canceled", true); } else { $template->set_var("project_canceled", false); } if ($project->get_deleted() == true) { $template->set_var("project_deleted", true); } else { $template->set_var("project_deleted", false); } if ($project->get_quota() == 0) { $template->set_var("quota", "unlimited"); } else { $template->set_var("quota", Convert::convert_byte_1024($project->get_quota())); } $permission_paramquery = $_GET; $permission_paramquery['run'] = "admin_permission"; unset($permission_paramquery['nextpage']); unset($permission_paramquery['sure']); $permission_params = http_build_query($permission_paramquery, '', '&'); $template->set_var("permission_params", $permission_params); $rename_paramquery = $_GET; $rename_paramquery['run'] = "admin_rename"; unset($rename_paramquery['nextpage']); unset($rename_paramquery['sure']); $rename_params = http_build_query($rename_paramquery, '', '&'); $template->set_var("rename_params", $rename_params); $chown_paramquery = $_GET; $chown_paramquery['run'] = "admin_chown"; unset($chown_paramquery['nextpage']); unset($chown_paramquery['sure']); $chown_params = http_build_query($chown_paramquery, '', '&'); $template->set_var("chown_params", $chown_params); $move_paramquery = $_GET; $move_paramquery['run'] = "admin_move"; unset($move_paramquery['nextpage']); unset($move_paramquery['sure']); $move_params = http_build_query($move_paramquery, '', '&'); $template->set_var("move_params", $move_params); $chquota_paramquery = $_GET; $chquota_paramquery['run'] = "admin_quota"; unset($chquota_paramquery['nextpage']); unset($chquota_paramquery['sure']); $chquota_params = http_build_query($chquota_paramquery, '', '&'); $template->set_var("chquota_params", $chquota_params); return $template->get_string(); } else { throw new ProjectSecurityAccessDeniedException(); } } else { throw new ProjectIDMissingException(); } }
/** * @todo search on read-only projects */ public static function search() { global $user, $session; if ($_GET['nextpage']) { if ($_GET['sortvalue'] and $_GET['sortmethod']) { if ($_GET['nextpage'] == "2" and $_POST['string']) { $string = $_POST['string']; $item_type_array = $session->read_value("SEARCH_DATA_ITEM_TYPE"); $project_id_array = $session->read_value("SEARCH_DATA_PROJECT_ID"); } else { $string = $session->read_value("SEARCH_DATA_STRING"); $item_type_array = $session->read_value("SEARCH_DATA_ITEM_TYPE"); $project_id_array = $session->read_value("SEARCH_DATA_PROJECT_ID"); } } else { if ($_GET['page']) { $string = $session->read_value("SEARCH_DATA_STRING"); $item_type_array = $session->read_value("SEARCH_DATA_ITEM_TYPE"); $project_id_array = $session->read_value("SEARCH_DATA_PROJECT_ID"); } else { if ($_GET['nextpage'] == "1") { $string = $_POST['string']; $session->delete_value("SEARCH_DATA_STRING"); $session->delete_value("SEARCH_DATA_ITEM_TYPE"); $session->delete_value("SEARCH_DATA_PROJECT_ID"); } else { $string = $_POST['string']; $item_type_array = $session->read_value("SEARCH_DATA_ITEM_TYPE"); $project_id_array = $session->read_value("SEARCH_DATA_PROJECT_ID"); } } } $no_error = true; } else { $no_error = false; } if ($no_error == false) { $template = new HTMLTemplate("project/search/data_search.html"); $template->set_var("error", ""); $paramquery = $_GET; unset($paramquery['page']); $paramquery['nextpage'] = "1"; $params = http_build_query($paramquery, '', '&'); $template->set_var("params", $params); $result = array(); $counter = 0; $project_array = Project::list_user_related_projects($user->get_user_id(), false); if (is_array($project_array) and count($project_array) >= 1) { foreach ($project_array as $key => $value) { $project = new Project($value); $organisation_unit = new OrganisationUnit($project->get_organisation_unit_id()); $result[$counter]['value'] = $value; $result[$counter]['content'] = $project->get_name() . " (" . $organisation_unit->get_name() . ")"; $result[$counter]['selected'] = ""; $counter++; } } $template->set_var("project_array", $result); $result = array(); $counter = 0; $item_type_array = Item::list_types(); if (is_array($item_type_array)) { foreach ($item_type_array as $key => $value) { if (class_exists($value)) { if ($value::get_sql_select_array($key) != null) { $result[$counter]['title'] = $value::get_generic_name($key, null); $result[$counter]['name'] = "item-" . $key; $result[$counter]['value'] = $key; $result[$counter]['checked'] = "checked='checked'"; $counter++; } } } } $template->set_var("item_type_array", $result); $template->output(); } else { if (!$project_id_array) { if ($_POST['project_id'] == 0) { $project_id_array = array(); $tmp_id_array = Project::list_user_related_projects($user->get_user_id(), false); if (is_array($tmp_id_array) and count($tmp_id_array) >= 1) { foreach ($tmp_id_array as $key => $value) { array_push($project_id_array, $value); } } } else { $project_id_array = array(); $project_id_array[0] = $_POST['project_id']; $project = new Project($_POST['project_id']); $search_name = $project->get_name(); } } else { if (count($project_id_array) == 1) { $project = new Project($project_id_array[0]); $search_name = $project->get_name(); } else { $search_name = "All"; } } if (!$item_type_array) { $item_type_array = array(); foreach ($_POST as $key => $value) { if (strpos($key, "item-") === 0) { array_push($item_type_array, $value); } } if (!$item_type_array) { $tmp_item_type_array = Item::list_types(); foreach ($tmp_item_type_array as $key => $value) { if (class_exists($value)) { if ($value::get_sql_select_array($key) != null) { array_push($item_type_array, $key); } } } } } $session->write_value("SEARCH_DATA_STRING", $string, true); $session->write_value("SEARCH_DATA_ITEM_TYPE", $item_type_array, true); $session->write_value("SEARCH_DATA_PROJECT_ID", $project_id_array, true); $argument_array = array(); $argument_array[0][0] = "string"; $argument_array[0][1] = $string; $argument_array[1][0] = "project_id_array"; $argument_array[1][1] = $project_id_array; $argument_array[2][0] = "item_type_array"; $argument_array[2][1] = $item_type_array; $list = new List_IO("ProjectDataSearch", "ajax.php?nav=project", "search_project_data_list_projects", "search_project_data_count_projects", $argument_array, "ProjectDataSearch"); $list->add_column("", "symbol", false, "16px"); $list->add_column(Language::get_message("ProjectGeneralListColumnName", "general"), "name", true, null); $list->add_column(Language::get_message("ProjectGeneralListColumnType", "general"), "type", false, null); $list->add_column(Language::get_message("ProjectGeneralListColumnDateTime", "general"), "datetime", true, null); $list->add_column(Language::get_message("ProjectGeneralListColumnProject", "general"), "project_name", true, null); $template = new HTMLTemplate("project/search/data_search_result.html"); $paramquery = $_GET; $paramquery['nextpage'] = "2"; $params = http_build_query($paramquery, '', '&'); $template->set_var("params", $params); $template->set_var("string", $string); $template->set_var("list", $list->get_list()); $template->output(); } }
/** * @param integer $page * @return string * @throws BaseAssistantRequestedPageNotExistsException */ public static function get_content($page) { global $session, $user; switch ($page) { case "0": $template = new HTMLTemplate("project/new_project_page_0.html"); return $template->get_string(); break; case "1": $template = new HTMLTemplate("project/new_project_page_1.html"); if ($session->read_value("PROJECT_TYPE") == 1 or $session->read_value("PROJECT_TYPE") == 2) { $project_organ_unit = $session->read_value("PROJECT_ORGANISATION_UNIT"); $template->set_var("organunit", true); $result = array(); $counter = 0; $organisation_unit_array = OrganisationUnit::list_entries(); if (is_array($organisation_unit_array) and count($organisation_unit_array) >= 1) { foreach ($organisation_unit_array as $key => $value) { $organisation_unit = new OrganisationUnit($value); if ($organisation_unit->is_permission($user->get_user_id()) and $organisation_unit->get_stores_data() == true) { $result[$counter]['value'] = $value; $result[$counter]['content'] = $organisation_unit->get_name(); if ($project_organ_unit == $value) { $result[$counter]['selected'] = "selected"; } else { $result[$counter]['selected'] = ""; } $result[$counter]['disabled'] = ""; $counter++; } } } if (!$result) { $result[$counter]['value'] = "0"; $result[$counter]['content'] = "NO ORGANISATION UNIT FOUND!"; $result[$counter]['selected'] = ""; $result[$counter]['disabled'] = "disabled='disabled'"; } $template->set_var("option", $result); } else { $project_toid = $session->read_value("PROJECT_TOID"); $template->set_var("organunit", false); $result = array(); $counter = 0; $project = new Project(null); $project_array = $project->get_project_tree(); if (is_array($project_array) and count($project_array) >= 1) { foreach ($project_array as $key => $value) { $project = new Project($value['id']); for ($i = 1; $i <= $value['layer']; $i++) { $pre_content .= " "; } $result[$counter]['value'] = $value['id']; $result[$counter]['content'] = $pre_content . "" . $project->get_name(); if ($project_toid == $value['id']) { $result[$counter]['selected'] = "selected"; } else { $result[$counter]['selected'] = ""; } $result[$counter]['disabled'] = ""; $counter++; unset($pre_content); } } else { $result[$counter]['value'] = "0"; $result[$counter]['content'] = "NO PROJECT FOUND!"; $result[$counter]['selected'] = ""; $result[$counter]['disabled'] = "disabled='disabled'"; } $template->set_var("option", $result); } return $template->get_string(); break; case "2": $project_name = $session->read_value("PROJECT_NAME"); $project_desc = $session->read_value("PROJECT_DESCRIPTION"); $template = new HTMLTemplate("project/new_project_page_2.html"); if ($project_name) { $template->set_var("project_name", $project_name); } else { $template->set_var("project_name", ""); } if ($project_desc) { $template->set_var("project_description", $project_desc); } else { $template->set_var("project_description", ""); } return $template->get_string(); break; case "3": $project_template = $session->read_value("PROJECT_TEMPLATE"); $template = new HTMLTemplate("project/new_project_page_3.html"); $result = array(); $counter = 0; $project_template_array = ProjectTemplateCat::list_entries(); if (is_array($project_template_array)) { foreach ($project_template_array as $key => $value) { $project_template_cat = new ProjectTemplateCat($value); $result[$counter]['value'] = "0"; $result[$counter]['content'] = $project_template_cat->get_name(); $result[$counter]['selected'] = ""; $result[$counter]['disabled'] = "disabled='disabled'"; $counter++; $project_template_sub_array = ProjectTemplate::list_entries_by_cat_id($value); if (is_array($project_template_sub_array)) { foreach ($project_template_sub_array as $sub_key => $sub_value) { $project_sub_template = new ProjectTemplate($sub_value); if (($session->read_value("PROJECT_TYPE") == 1 or $session->read_value("PROJECT_TYPE") == 3) and $project_sub_template->get_parent_template() == false) { $result[$counter]['value'] = $sub_value; $result[$counter]['content'] = " " . $project_sub_template->get_name(); if ($project_template == $sub_value) { $result[$counter]['selected'] = "selected"; } else { $result[$counter]['selected'] = ""; } $result[$counter]['disabled'] = ""; $counter++; } elseif (($session->read_value("PROJECT_TYPE") == 2 or $session->read_value("PROJECT_TYPE") == 4) and $project_sub_template->get_parent_template() == true) { $result[$counter]['value'] = $sub_value; $result[$counter]['content'] = " " . $project_sub_template->get_name(); if ($project_template == $sub_value) { $result[$counter]['selected'] = "selected"; } else { $result[$counter]['selected'] = ""; } $result[$counter]['disabled'] = ""; $counter++; } } } unset($project_template_sub_array); } } else { $result[$counter]['value'] = "0"; $result[$counter]['content'] = "NO TEMPLATES FOUND!"; $result[$counter]['selected'] = ""; $result[$counter]['disabled'] = "disabled='disabled'"; } $template->set_var("option", $result); return $template->get_string(); break; case "4": $project_template = $session->read_value("PROJECT_TEMPLATE"); $project_template_data_type = $session->read_value("PROJECT_TEMPLATE_DATA_TYPE"); $project_template_data_array = $session->read_value("PROJECT_TEMPLATE_DATA_ARRAY"); $project_template_obj = new ProjectTemplate($project_template); $required_array = $project_template_obj->get_required_requirements(); if (is_array($required_array) and count($required_array) >= 1) { $value_type_id = 0; $sample_count = 0; $is_value = false; $is_sample = false; foreach ($required_array as $key => $value) { if ($value['xml_element'] == "item") { if ($value['type'] == "value") { $is_value = true; } } if ($value['xml_element'] == "type" and !$value['close'] and $is_value == true) { $value_type_id = $value['id']; } } if ($is_value == true) { $template = new HTMLTemplate("project/new_project_page_4_value.html"); require_once "core/modules/data/io/value_form.io.php"; $value_form_io = new ValueFormIO(null, $value_type_id, null, $project_template_data_array); $value_form_io->set_field_class("ProjectCreateAssistantField"); $template->set_var("content", $value_form_io->get_content()); $template->set_var("project_template_data_type_id", $value_type_id); return $template->get_string(); } else { $template = new HTMLTemplate("project/new_project_page_4_error.html"); return $template->get_string(); } } else { $template = new HTMLTemplate("project/new_project_page_4_error.html"); return $template->get_string(); } break; case "5": $template = new HTMLTemplate("project/new_project_page_5.html"); $project_template = new ProjectTemplate($session->read_value("PROJECT_TEMPLATE")); $template->set_var("project_name", $session->read_value("PROJECT_NAME")); $template->set_var("project_template", $project_template->get_name()); $template->set_var("project_description", $session->read_value("PROJECT_DESCRIPTION")); $template->set_var("content", ""); return $template->get_string(); break; default: throw new BaseAssistantRequestedPageNotExistsException(); break; } }
/** * @throws ProjectIDMissingException * @throws ProjectSecuriyAccessDeniedException */ public static function structure() { global $project_security; if ($_GET['project_id']) { if ($project_security->is_access(1, false) == true) { $project = new Project($_GET['project_id']); $project_structure_array = $project->get_project_tree(); $template = new HTMLTemplate("project/structure.html"); if (is_array($project_structure_array) and count($project_structure_array) >= 1) { $result = array(); $counter = 0; foreach ($project_structure_array as $key => $value) { $project = new Project($value['id']); $project_security = new ProjectSecurity($value['id']); $project_owner = new User($project->get_owner_id()); $paramquery['username'] = $_GET['username']; $paramquery['session_id'] = $_GET['session_id']; $paramquery['nav'] = "project"; $paramquery['run'] = "detail"; $paramquery['project_id'] = $value['id']; $params = http_build_query($paramquery, '', '&'); $result[$counter]['link'] = $params; $result[$counter]['name'] = $project->get_name(); $result[$counter]['status'] = $project->get_current_status_name(); $result[$counter]['template'] = $project->get_template_name(); $result[$counter]['owner'] = $project_owner->get_full_name(false); $involved_array = $project_security->list_involved_users(); if (is_array($involved_array) and count($involved_array) >= 1) { foreach ($involved_array as $involved_key => $involved_value) { $involved_user = new User($involved_value); if ($result[$counter]['involved'] == "") { $result[$counter]['involved'] = $involved_user->get_full_name(false); } else { $result[$counter]['involved'] .= ", " . $involved_user->get_full_name(false); } } } else { $result[$counter]['involved'] = ""; } $subproject_paramquery = $_GET; $subproject_paramquery['run'] = "new_subproject"; $subproject_paramquery['id'] = $value['id']; unset($subproject_paramquery['nextpage']); $subproject_params = http_build_query($subproject_paramquery, '', '&'); $result[$counter]['add_subproject'] = $subproject_params; $result[$counter]['padding'] = $value['layer']; $counter++; } $template->set_var("structure", $result); } $template->output(); } else { throw new ProjectSecurityAccessDeniedException(); } } else { throw new ProjectIDMissingException(); } }
/** * Creates a new Project Folder including Folder * @param integer $project_id * @return integer */ public function create($project_id, $base_folder_id) { if (is_numeric($project_id)) { $project = new Project($project_id); // Folder if ($base_folder_id == null) { $project_folder_id = constant("PROJECT_FOLDER_ID"); } else { $project_folder_id = $base_folder_id; } $folder = new Folder($project_folder_id); $path = new Path($folder->get_path()); $path->add_element($project_id); if (($folder_id = parent::create($project->get_name(), $project_folder_id, $path->get_path_string(), $project->get_owner_id(), null)) != null) { $project_has_folder_access = new ProjectHasFolder_Access(null); if ($project_has_folder_access->create($project_id, $folder_id) == null) { return null; } // Virtual Folder $project_folder_create_event = new ProjectFolderCreateEvent($folder_id); $event_handler = new EventHandler($project_folder_create_event); if ($event_handler->get_success() == false) { $this->delete(); return false; } else { return $folder_id; } } else { return null; } } else { return null; } }
/** * @see ProjectTaskInterface::list_upcoming_tasks() * @return array * @todo tasks ending today * @todo tasks ending this week * @todo tasks ending next 30 days */ public static function list_upcoming_tasks() { global $user; $upcoming_task_array = array(); $over_time_task_array = Project_Wrapper_Access::list_not_finished_over_time_project_tasks_by_user_id($user->get_user_id(), date("Y-m-d H:i:s")); if (is_array($over_time_task_array) and count($over_time_task_array) >= 1) { foreach ($over_time_task_array as $key => $value) { $project_task = new ProjectTask($value); $project = new Project($project_task->get_project_id()); if ($project_task->get_uf_end_time() == -1) { $end_task_datetime = new DatetimeHandler($project_task->get_end_date() . " 23:59:59"); } else { $end_task_datetime = new DatetimeHandler($project_task->get_end_date() . " " . $project_task->get_uf_end_time()); } if ($project_task->get_over_time() == true) { $temp_array = array(); $temp_array['project_id'] = $project_task->get_project_id(); $temp_array['project_name'] = $project->get_name(); $temp_array['task_name'] = $project_task->get_name(); $temp_array['end_date'] = $end_task_datetime->get_formatted_string("d/m/Y"); $temp_array['status'] = 1; array_push($upcoming_task_array, $temp_array); unset($temp_array); } else { if ($project_task->get_progress() < 100) { $temp_array = array(); $temp_array['project_id'] = $project_task->get_project_id(); $temp_array['project_name'] = $project->get_name(); $temp_array['task_name'] = $project_task->get_name(); $temp_array['end_date'] = $end_task_datetime->get_formatted_string("d/m/Y"); $temp_array['status'] = 1; array_push($upcoming_task_array, $temp_array); unset($temp_array); $project_task->set_over_time(true); } else { $project_task->set_finished(true); } } } } return $upcoming_task_array; }
/** * @param integer $id */ public static function get_children($id) { if (is_numeric($id)) { $return_array = array(); $project = new Project($id); $project_array = $project->list_project_related_projects(); if (is_array($project_array) and count($project_array) >= 1) { $counter = 0; foreach ($project_array as $key => $value) { $project = new Project($value); $return_array[$counter][0] = -1; $return_array[$counter][1] = $value; $return_array[$counter][2] = $project->get_name(); $return_array[$counter][3] = "project.png"; $return_array[$counter][4] = true; // Permission $return_array[$counter][5] = true; $paramquery['username'] = $_GET['username']; $paramquery['session_id'] = $_GET['session_id']; $paramquery['nav'] = "project"; $paramquery['run'] = "detail"; $paramquery['project_id'] = $value; $params = http_build_query($paramquery, '', '&'); $return_array[$counter][6] = $params; //link $return_array[$counter][7] = false; //open $counter++; } echo json_encode($return_array); } } }