public static function disable()
 {
     if ($_GET['id']) {
         $paramquery = $_GET;
         unset($paramquery['action']);
         unset($paramquery['id']);
         $params = http_build_query($paramquery, '', '&');
         if (SystemHandler::disable_module($_GET['id'])) {
             Common_IO::step_proceed($params, "Disable", "Operation Successful", null);
         } else {
             Common_IO::step_proceed($params, "Disable", "Operation Failed", null);
         }
     } else {
     }
 }
Beispiel #2
0
 public static function list_system_messages()
 {
     define(SYSTEM_MESSAGE_ENTRIES_PER_PAGE, 6);
     $system_message_array = SystemMessage::list_entries();
     if (!$_GET['page']) {
         $page = 1;
     } else {
         $page = $_GET['page'];
     }
     $entry_count = count($system_message_array);
     $number_of_pages = ceil($entry_count / SYSTEM_MESSAGE_ENTRIES_PER_PAGE);
     $template = new HTMLTemplate("base/list_system_messages.html");
     if (is_array($system_message_array) and count($system_message_array) >= 1) {
         $template->set_var("no_entry", false);
         $result = array();
         $counter = 0;
         if (count($system_message_array) < $page * SYSTEM_MESSAGE_ENTRIES_PER_PAGE) {
             $max_for = count($system_message_array) % SYSTEM_MESSAGE_ENTRIES_PER_PAGE - 1;
         } else {
             $max_for = SYSTEM_MESSAGE_ENTRIES_PER_PAGE - 1;
         }
         for ($i = 0; $i <= $max_for; $i++) {
             $entry = $page * SYSTEM_MESSAGE_ENTRIES_PER_PAGE + $i - SYSTEM_MESSAGE_ENTRIES_PER_PAGE;
             // Erzeugt Entry-ID
             $value = $system_message_array[$entry];
             $system_message = new SystemMessage($value);
             $user = new User($system_message->get_user_id());
             $datetime_handler = new DatetimeHandler($system_message->get_datetime());
             $content = str_replace("\n", "<br />", $system_message->get_content());
             $content = str_replace("\\", "", $content);
             $result[$counter]['user'] = $user->get_full_name(false);
             $result[$counter]['datetime'] = $datetime_handler->get_date() . " at " . $datetime_handler->get_time();
             $result[$counter]['content'] = $content;
             $counter++;
         }
         $template->set_var("message_array", $result);
     } else {
         $template->set_var("no_entry", true);
     }
     if ($number_of_pages > 1) {
         $template->set_var("page_bar", Common_IO::page_bar($page, $number_of_pages, $_GET));
     } else {
         $template->set_var("page_bar", "");
     }
     $template->output();
 }
 /**
  * Replaces <!-- CONTAINER [...] --> in template
  */
 private function replace_containers()
 {
     $number_of_commands = substr_count($this->string, "<!--");
     $start_position = 0;
     for ($i = 1; $i <= $number_of_commands; $i++) {
         $start_position = strpos($this->string, "<!--", $start_position);
         $end_position = strpos($this->string, "-->", $start_position + 1);
         $command = substr($this->string, $start_position + 5, $end_position - $start_position - 6);
         $command_array = explode(" ", $command, 3);
         $command_length = $end_position - $start_position;
         if (trim(strtolower($command_array[0])) == "container") {
             if (trim(strtolower($command_array[1])) == "begin") {
                 $container_begin = str_replace("(", "", $command_array[2]);
                 $container_begin = str_replace("\"", "", $container_begin);
                 $container_begin = str_replace(")", "", $container_begin);
                 $container_begin_array = explode(",", $container_begin);
                 if ($container_begin_array[2]) {
                     $container_begin_string = Common_IO::container_begin($container_begin_array[0], $container_begin_array[1], $container_begin_array[2]);
                 } elseif ($container_begin_array[1]) {
                     $container_begin_string = Common_IO::container_begin($container_begin_array[0], $container_begin_array[1]);
                 } else {
                     $container_begin_string = Common_IO::container_begin($container_begin_array[0]);
                 }
                 $this->string = substr_replace($this->string, $container_begin_string, $start_position, $end_position - $start_position + 3);
                 $container_begin_string_length = strlen($container_begin_string);
                 $pointer_correction = $container_begin_string_length - $command_length;
                 $end_position = $end_position + $pointer_correction;
             } elseif (trim(strtolower($command_array[1])) == "end") {
                 $container_end = str_replace("(", "", $command_array[2]);
                 $container_end = str_replace("\"", "", $container_end);
                 $container_end = str_replace(")", "", $container_end);
                 $container_end_string = Common_IO::container_end();
                 $container_end_string_length = strlen($container_end_string);
                 $this->string = substr_replace($this->string, $container_end_string, $start_position, $end_position - $start_position + 3);
                 $pointer_correction = $container_end_string_length - $command_length;
                 $end_position = $end_position + $pointer_correction;
             }
         }
         $start_position = $end_position + 1;
     }
 }
 /**
  * @throws EquipmentTypeIDMissingException
  */
 public static function change_location()
 {
     if ($_GET['id']) {
         if ($_GET['nextpage'] == 1) {
             $page_1_passed = true;
         } else {
             $page_1_passed = false;
         }
         if ($page_1_passed == false) {
             $template = new HTMLTemplate("equipment/admin/equipment_type/change_location.html");
             $paramquery = $_GET;
             $paramquery['nextpage'] = "1";
             $params = http_build_query($paramquery, '', '&#38;');
             $template->set_var("params", $params);
             $location_array = Location::list_entries();
             $result = array();
             $counter = 1;
             $location = new Location($value);
             $result[0]['value'] = 0;
             $result[0]['content'] = "none";
             foreach ($location_array as $key => $value) {
                 $location = new Location($value);
                 $result[$counter]['value'] = $value;
                 $result[$counter]['content'] = $location->get_name(true);
                 $counter++;
             }
             $template->set_var("option", $result);
             $template->output();
         } else {
             $equipment_type = new EquipmentType($_GET['id']);
             $paramquery = $_GET;
             $paramquery['action'] = "detail";
             unset($paramquery['nextpage']);
             $params = http_build_query($paramquery, '', '&#38;');
             if ($equipment_type->set_location_id($_POST['location'])) {
                 Common_IO::step_proceed($params, "Equipment Type", "Operation Successful", null);
             } else {
                 Common_IO::step_proceed($params, "Equipment Type", "Operation Failed", null);
             }
         }
     } else {
         throw new EquipmentTypeIDMissingException();
     }
 }
Beispiel #5
0
 /**
  * @throws GroupIDMissingException
  */
 public static function rename()
 {
     if ($_GET['id']) {
         $group = new Group($_GET['id']);
         if ($_GET['nextpage'] == 1) {
             if ($_POST['name']) {
                 if (Group::exist_name($_POST['name']) == true) {
                     $page_1_passed = false;
                     $error = "This name is already allocated.";
                 } else {
                     $page_1_passed = true;
                 }
             } else {
                 $page_1_passed = false;
                 $error = "You must enter a name.";
             }
         } elseif ($_GET['nextpage'] > 1) {
             $page_1_passed = true;
         } else {
             $page_1_passed = false;
             $error = "";
         }
         if ($page_1_passed == false) {
             $template = new HTMLTemplate("base/user/admin/group/rename.html");
             $paramquery = $_GET;
             $paramquery['nextpage'] = "1";
             $params = http_build_query($paramquery, '', '&#38;');
             $template->set_var("params", $params);
             $template->set_var("error", $error);
             if ($_POST['username']) {
                 $template->set_var("name", $_POST['name']);
             } else {
                 $template->set_var("name", $group->get_name());
             }
             $template->output();
         } else {
             $paramquery = $_GET;
             $paramquery['action'] = "detail";
             unset($paramquery['nextpage']);
             $params = http_build_query($paramquery, '', '&#38;');
             if ($group->set_name($_POST['name'])) {
                 Common_IO::step_proceed($params, "Rename User", "Operation Successful", null);
             } else {
                 Common_IO::step_proceed($params, "Rename User", "Operation Failed", null);
             }
         }
     } else {
         throw new GroupIDMissingException();
     }
 }
Beispiel #6
0
 /**
  * @throws ProjectIDMissingException
  * @throws ProjectSecurityAccessDeniedException
  */
 public static function quota()
 {
     global $project_security;
     if ($_GET['project_id']) {
         if ($project_security->is_access(7, false) == true) {
             $project_id = $_GET['project_id'];
             $project = new Project($project_id);
             if ($_GET['nextpage'] == 1) {
                 if (is_numeric($_POST['quota'])) {
                     $page_1_passed = true;
                 } else {
                     $page_1_passed = false;
                     $error = "You must enter a value";
                 }
             } else {
                 $page_1_passed = false;
                 $error = "";
             }
             if ($page_1_passed == false) {
                 $template = new HTMLTemplate("project/admin/quota.html");
                 $paramquery = $_GET;
                 $paramquery['nextpage'] = "1";
                 $params = http_build_query($paramquery, '', '&#38;');
                 $template->set_var("params", $params);
                 $template->set_var("error", $error);
                 if ($_POST['name']) {
                     $template->set_var("quota", $_POST['quota']);
                 } else {
                     $template->set_var("quota", trim($project->get_quota()));
                 }
                 $template->output();
             } else {
                 $paramquery = $_GET;
                 unset($paramquery['nextpage']);
                 $paramquery['run'] = "admin";
                 $params = http_build_query($paramquery);
                 if ($project->set_quota($_POST['quota'])) {
                     Common_IO::step_proceed($params, "Change Quota", "Operation Successful", null);
                 } else {
                     Common_IO::step_proceed($params, "Change Quota", "Operation Failed", null);
                 }
             }
         } else {
             throw new ProjectSecurityAccessDeniedException();
         }
     } else {
         throw new ProjectIDMissingException();
     }
 }
Beispiel #7
0
 /**
  * @throws FileIDMissingException
  * @throws FileVersionIDMissingException
  * @throws DataSecurityAccessDeniedException
  */
 public static function delete_version()
 {
     if ($_GET['file_id']) {
         if ($_GET['version']) {
             $file = File::get_instance($_GET['file_id']);
             if ($file->is_delete_access()) {
                 if ($_GET['sure'] != "true") {
                     $template = new HTMLTemplate("data/file_delete_version.html");
                     $paramquery = $_GET;
                     $paramquery['sure'] = "true";
                     $params = http_build_query($paramquery);
                     $template->set_var("yes_params", $params);
                     $paramquery = $_GET;
                     $paramquery['action'] = "file_detail";
                     unset($paramquery['sure']);
                     $params = http_build_query($paramquery);
                     $template->set_var("no_params", $params);
                     $template->output();
                 } else {
                     $file = File::get_instance($_GET['file_id']);
                     if (($return_value = $file->delete_version($_GET['version'])) != 0) {
                         if ($return_value == 1) {
                             $paramquery = $_GET;
                             $paramquery['action'] = "file_detail";
                             unset($paramquery['sure']);
                             unset($paramquery['version']);
                             $params = http_build_query($paramquery);
                         } else {
                             $paramquery = $_GET;
                             unset($paramquery['sure']);
                             unset($paramquery['action']);
                             unset($paramquery['file_id']);
                             $params = http_build_query($paramquery);
                         }
                         Common_IO::step_proceed($params, "Delete File", "Operation Successful", null);
                     } else {
                         $paramquery = $_GET;
                         $paramquery['action'] = "file_detail";
                         unset($paramquery['sure']);
                         $params = http_build_query($paramquery);
                         Common_IO::step_proceed($params, "Delete File", "Operation Failed", null);
                     }
                 }
             } else {
                 throw new DataSecurityAccessDeniedException();
             }
         } else {
             throw new FileVersionIDMissingException();
         }
     } else {
         throw new FileIDMissingException();
     }
 }
 /**
  * @throws SystemMessageIDMissingException
  */
 public static function edit()
 {
     if ($_GET['id']) {
         $system_message = new SystemMessage($_GET['id']);
         if ($_GET['nextpage'] == 1) {
             $page_1_passed = true;
             if (!$_POST['content']) {
                 $page_1_passed = false;
                 $error = "You must enter a text";
             }
         } else {
             $page_1_passed = false;
             $error = "";
         }
         if ($page_1_passed == false) {
             $template = new HTMLTemplate("base/admin/system_message/edit.html");
             $paramquery = $_GET;
             $paramquery['nextpage'] = "1";
             $params = http_build_query($paramquery, '', '&#38;');
             $template->set_var("params", $params);
             if ($error) {
                 $template->set_var("error", $error);
             } else {
                 $template->set_var("error", "");
             }
             $content = str_replace("\\", "", $system_message->get_content());
             if ($_POST['content']) {
                 $template->set_var("content", $_POST['content']);
             } else {
                 $template->set_var("content", $content);
             }
             $template->output();
         } else {
             $paramquery = $_GET;
             unset($paramquery['nextpage']);
             unset($paramquery['action']);
             $params = http_build_query($paramquery);
             if ($system_message->set_content($_POST['content'])) {
                 Common_IO::step_proceed($params, "Add System Message", "Operation Successful", null);
             } else {
                 Common_IO::step_proceed($params, "Add System Message", "Operation Failed", null);
             }
         }
     } else {
         throw new SystemMessageIDMissingException();
     }
 }
Beispiel #9
0
 /**
  * @throws UserIDMissingException
  */
 public static function change_timezone()
 {
     if ($_GET['id']) {
         $user = new User($_GET['id']);
         $regional = new Regional($_GET['id']);
         if ($_GET['nextpage'] == 1) {
             $page_1_passed = true;
         } else {
             $page_1_passed = false;
         }
         if ($page_1_passed == false) {
             $template = new HTMLTemplate("base/user/admin/user/change_timezone.html");
             $paramquery = $_GET;
             $paramquery['nextpage'] = "1";
             $params = http_build_query($paramquery, '', '&#38;');
             $template->set_var("params", $params);
             $timezone_array = Timezone::list_timezones();
             $result = array();
             $counter = 0;
             if (is_array($timezone_array)) {
                 foreach ($timezone_array as $key => $value) {
                     $timezone = new Timezone($value);
                     $result[$counter]['value'] = $value;
                     $result[$counter]['content'] = $timezone->get_name();
                     if ($value == $regional->get_timezone_id()) {
                         $result[$counter]['selected'] = "selected='selected'";
                     } else {
                         $result[$counter]['selected'] = "";
                     }
                     $counter++;
                 }
             }
             $template->set_var("option", $result);
             $template->output();
         } else {
             $paramquery = $_GET;
             $paramquery['action'] = "detail";
             unset($paramquery['nextpage']);
             $params = http_build_query($paramquery, '', '&#38;');
             if ($user->set_timezone_id($_POST['timezone'])) {
                 Common_IO::step_proceed($params, "Change Timezone", "Operation Successful", null);
             } else {
                 Common_IO::step_proceed($params, "Change Timezone", "Operation Failed", null);
             }
         }
     } else {
         throw new UserIDMissingException();
     }
 }
 /**
  * @throws EquipmentCategoryIDMissingException
  */
 public static function edit()
 {
     if ($_GET['id']) {
         $equipment_cat = new EquipmentCat($_GET['id']);
         if ($_GET['nextpage'] == 1) {
             $page_1_passed = true;
             if ($_POST['name']) {
                 if (EquipmentCat::exist_name($_POST['name']) == true and $equipment_cat->get_name() != $_POST['name']) {
                     $page_1_passed = false;
                     $error = "This name already exists";
                 }
             } else {
                 $page_1_passed = false;
                 $error = "You must enter a name";
             }
         } else {
             $page_1_passed = false;
             $error = "";
         }
         if ($page_1_passed == false) {
             $template = new HTMLTemplate("equipment/admin/equipment_cat/edit.html");
             $paramquery = $_GET;
             $paramquery['nextpage'] = "1";
             $params = http_build_query($paramquery, '', '&#38;');
             $template->set_var("params", $params);
             if ($error) {
                 $template->set_var("error", $error);
             } else {
                 $template->set_var("error", "");
             }
             if ($_POST['name']) {
                 $template->set_var("name", $_POST['name']);
             } else {
                 $template->set_var("name", $equipment_cat->get_name());
             }
             $template->output();
         } else {
             $paramquery = $_GET;
             unset($paramquery['nextpage']);
             unset($paramquery['action']);
             $params = http_build_query($paramquery);
             if ($equipment_cat->set_name($_POST['name'])) {
                 Common_IO::step_proceed($params, "Edit Equipment Category", "Operation Successful", null);
             } else {
                 Common_IO::step_proceed($params, "Edit Equipment Category", "Operation Failed", null);
             }
         }
     } else {
         throw new EquipmentCategoryIDMissingException();
     }
 }
Beispiel #11
0
 /**
  * @throws SampleIDMissingException
  * @throws SampleSecurityAccessDeniedException
  * @throws SamplePermissionOrganisationUnitIDMissingException
  */
 public static function ou_permission_delete()
 {
     global $user;
     if ($_GET['sample_id']) {
         if ($_GET['id']) {
             $sample_id = $_GET['sample_id'];
             $sample = new Sample($sample_id);
             $sample_security = new SampleSecurity($sample_id);
             if ($sample->get_owner_id() == $user->get_user_id() or $user->is_admin() == true) {
                 if ($_GET['sure'] != "true") {
                     $template = new HTMLTemplate("sample/int_admin/ou_permission_delete.html");
                     $paramquery = $_GET;
                     $paramquery['sure'] = "true";
                     $params = http_build_query($paramquery);
                     $template->set_var("yes_params", $params);
                     $paramquery = $_GET;
                     unset($paramquery['nextpage']);
                     unset($paramquery['sure']);
                     $paramquery['nav'] = "sample";
                     $paramquery['run'] = "admin_permission_ou";
                     $params = http_build_query($paramquery);
                     $template->set_var("no_params", $params);
                     $template->output();
                 } else {
                     $paramquery = $_GET;
                     unset($paramquery['nextpage']);
                     unset($paramquery['sure']);
                     $paramquery['nav'] = "sample";
                     $paramquery['run'] = "admin_permission_ou";
                     $params = http_build_query($paramquery);
                     $entry_id = $sample_security->get_entry_by_organisation_unit_id($_GET['id']);
                     if ($sample_security->delete_organisation_unit($entry_id)) {
                         Common_IO::step_proceed($params, "Delete Sample", "Operation Successful", null);
                     } else {
                         Common_IO::step_proceed($params, "Delete Sample", "Operation Failed", null);
                     }
                 }
             } else {
                 throw new SampleSecurityAccessDeniedException();
             }
         } else {
             throw new SamplePermissionOrganisationUnitIDMissingException();
         }
     } else {
         throw new SampleIDMissingException();
     }
 }
Beispiel #12
0
 /**
  * @throws SampleIDMissingException
  * @throws SampleSecurityAccessDeniedException
  */
 public static function set_availability()
 {
     global $sample_security;
     if ($_GET['sample_id']) {
         if ($sample_security->is_access(2, false)) {
             if ($_GET['sure'] != "true") {
                 $template = new HTMLTemplate("sample/set_availability.html");
                 $paramquery = $_GET;
                 $paramquery['sure'] = "true";
                 $params = http_build_query($paramquery);
                 $template->set_var("yes_params", $params);
                 $paramquery = $_GET;
                 unset($paramquery['nextpage']);
                 unset($paramquery['id']);
                 $paramquery['run'] = "admin_permission";
                 $params = http_build_query($paramquery);
                 $template->set_var("no_params", $params);
                 $template->output();
             } else {
                 $sample = new Sample($_GET['sample_id']);
                 $paramquery = $_GET;
                 unset($paramquery['nextpage']);
                 unset($paramquery['sure']);
                 $paramquery['run'] = "detail";
                 $params = http_build_query($paramquery);
                 if ($sample->get_availability() == true) {
                     if ($sample->set_availability(false)) {
                         Common_IO::step_proceed($params, "Delete Permission", "Operation Successful", null);
                     } else {
                         Common_IO::step_proceed($params, "Delete Permission", "Operation Failed", null);
                     }
                 } else {
                     if ($sample->set_availability(true)) {
                         Common_IO::step_proceed($params, "Delete Permission", "Operation Successful", null);
                     } else {
                         Common_IO::step_proceed($params, "Delete Permission", "Operation Failed", null);
                     }
                 }
             }
         } else {
             throw new SampleSecurityAccessDeniedException();
         }
     } else {
         throw new SampleIDMissingException();
     }
 }
Beispiel #13
0
 /**
  * @param string $class
  * @return string
  */
 public static function container_end()
 {
     self::$in_container = false;
     return "</div></div>";
 }
 /**
  * @throws SampleTemplateIDMissingException
  */
 public static function delete()
 {
     if ($_GET['id']) {
         if ($_GET['sure'] != "true") {
             $template = new HTMLTemplate("sample/admin/sample_template/delete.html");
             $paramquery = $_GET;
             $paramquery['sure'] = "true";
             $params = http_build_query($paramquery);
             $template->set_var("yes_params", $params);
             $paramquery = $_GET;
             unset($paramquery['sure']);
             unset($paramquery['action']);
             unset($paramquery['id']);
             $params = http_build_query($paramquery, '', '&#38;');
             $template->set_var("no_params", $params);
             $template->output();
         } else {
             $paramquery = $_GET;
             unset($paramquery['sure']);
             unset($paramquery['action']);
             unset($paramquery['id']);
             $params = http_build_query($paramquery, '', '&#38;');
             $sample_template = new SampleTemplate($_GET['id']);
             if ($sample_template->delete()) {
                 Common_IO::step_proceed($params, "Delete Sample Template", "Operation Successful", null);
             } else {
                 Common_IO::step_proceed($params, "Delete Sample Template", "Operation Failed", null);
             }
         }
     } else {
         throw new SampleTemplateIDMissingException();
     }
 }
 /**
  * @throws BaseModuleNavigationIDMissingException
  */
 public static function downwards()
 {
     if ($_GET['id']) {
         $module_navigation = new ModuleNavigation($_GET['id']);
         $paramquery = $_GET;
         unset($paramquery['action']);
         unset($paramquery['id']);
         $params = http_build_query($paramquery, '', '&#38;');
         if ($module_navigation->downwards()) {
             Common_IO::step_proceed($params, "Downwards", "Operation Successful", null);
         } else {
             Common_IO::step_proceed($params, "Downwards", "Operation Failed", null);
         }
     } else {
         throw new BaseModuleNavigationIDMissingException();
     }
 }
Beispiel #16
0
 /**
  * @throws ProjectTaskIDMissingException
  * @throws ProjectSecuriyAccessDeniedException
  */
 public static function edit_end()
 {
     global $project_security;
     if ($_GET['id']) {
         if ($project_security->is_access(3, false) == true) {
             $project_task = new ProjectTask($_GET['id']);
             if (!$_GET['nextpage']) {
                 $template = new HTMLTemplate("project/tasks/edit_end.html");
                 $paramquery = $_GET;
                 $paramquery['nextpage'] = "1";
                 $params = http_build_query($paramquery, '', '&#38;');
                 $template->set_var("params", $params);
                 if ($_POST['enddate']) {
                     $template->set_var("enddate", $_POST['enddate']);
                 } else {
                     $template->set_var("enddate", $project_task->get_end_date());
                 }
                 if ($project_task->get_uf_end_time() != -1) {
                     $time = explode(":", $project_task->get_uf_end_time());
                     if ($_POST['wholeday'] == 1) {
                         $template->set_var("whole_day_checked", "checked");
                     } else {
                         $template->set_var("whole_day_checked", "");
                     }
                     if ($_POST['time1']) {
                         $template->set_var("time1", $_POST['time1']);
                     } else {
                         $template->set_var("time1", $time[0]);
                     }
                     if ($_POST['time2']) {
                         $template->set_var("time2", $_POST['time2']);
                     } else {
                         $template->set_var("time2", $time[1]);
                     }
                 } else {
                     if ($_POST['wholeday'] == 1 or !$_POST['wholeday']) {
                         $template->set_var("whole_day_checked", "checked");
                     } else {
                         $template->set_var("whole_day_checked", "");
                     }
                     if ($_POST['time1']) {
                         $template->set_var("time1", $_POST['time1']);
                     } else {
                         $template->set_var("time1", "");
                     }
                     if ($_POST['time2']) {
                         $template->set_var("time2", $_POST['time2']);
                     } else {
                         $template->set_var("time2", "");
                     }
                 }
                 $template->set_var("error0", "");
                 $template->set_var("error1", "");
                 $template->output();
             } else {
                 $paramquery = $_GET;
                 unset($paramquery['nextpage']);
                 $paramquery['run'] = "task_detail";
                 $params = http_build_query($paramquery, '', '&#38;');
                 if ($_POST['wholeday'] == 1) {
                     $time = null;
                     $whole_day = true;
                 } else {
                     $time = $_POST['time1'] . ":" . $_POST['time2'] . ":00";
                     $whole_day = false;
                 }
                 if ($project_task->set_end($_POST['enddate'], $time, $whole_day)) {
                     Common_IO::step_proceed($params, "Change End Date/Time", "Operation Successful", null);
                 } else {
                     Common_IO::step_proceed($params, "Change End Date/Time", "Operation Failed", null);
                 }
             }
         } else {
             throw new ProjectSecuriyAccessDeniedException();
         }
     } else {
         throw new ProjectTaskIDMissingException();
     }
 }
Beispiel #17
0
 /**
  * @throws UserIDMissingException
  */
 public static function change_quota()
 {
     if ($_GET['id']) {
         $user = new User($_GET['id']);
         $user_data = new DataUserData($_GET['id']);
         if ($_GET['nextpage'] == 1) {
             if (is_numeric($_POST['quota'])) {
                 $page_1_passed = true;
             } else {
                 $page_1_passed = false;
                 $error = "You must enter a valid quota.";
             }
         } elseif ($_GET['nextpage'] > 1) {
             $page_1_passed = true;
         } else {
             $page_1_passed = false;
             $error = "";
         }
         if ($page_1_passed == false) {
             $template = new HTMLTemplate("data/admin/user/change_user_quota.html");
             $paramquery = $_GET;
             $paramquery['nextpage'] = "1";
             $params = http_build_query($paramquery, '', '&#38;');
             $template->set_var("params", $params);
             $template->set_var("error", $error);
             if ($_POST['quota']) {
                 $template->set_var("mail", $_POST['quota']);
             } else {
                 $template->set_var("quota", $user_data->get_quota());
             }
             $template->output();
         } else {
             if ($_GET['retrace']) {
                 $params = http_build_query(Retrace::resolve_retrace_string($_GET['retrace']), '', '&#38;');
             } else {
                 $paramquery['username'] = $_GET['username'];
                 $paramquery['session_id'] = $_GET['session_id'];
                 $paramquery['nav'] = "home";
                 $params = http_build_query($paramquery, '', '&#38;');
             }
             if ($user_data->set_quota($_POST['quota'])) {
                 Common_IO::step_proceed($params, "Change User Quota", "Operation Successful", null);
             } else {
                 Common_IO::step_proceed($params, "Change User Quota", "Operation Failed", null);
             }
         }
     } else {
         throw new UserIDMissingException();
     }
 }
 /**
  * @throws OrganisationUnitIDMissingException
  */
 public static function toogle_visible()
 {
     if ($_GET['id']) {
         $organisation_unit = new OrganisationUnit($_GET['id']);
         $paramquery = $_GET;
         unset($paramquery['action']);
         unset($paramquery['id']);
         $params = http_build_query($paramquery, '', '&#38;');
         if ($organisation_unit->get_hidden() == true) {
             $hidden = false;
         } else {
             $hidden = true;
         }
         if ($organisation_unit->set_hidden($hidden)) {
             Common_IO::step_proceed($params, "Upwards", "Operation Successful", null);
         } else {
             Common_IO::step_proceed($params, "Upwards", "Operation Failed", null);
         }
     } else {
         throw new OrganisationUnitIDMissingException();
     }
 }
 /**
  * @throws ProjectStatusIDMissingException
  */
 public static function edit()
 {
     if ($_GET['id']) {
         $project_status = new ProjectStatus($_GET['id']);
         if ($_GET['nextpage'] == 1) {
             $page_1_passed = true;
             if (!$_POST['name']) {
                 $page_1_passed = false;
                 $error = "You must enter a name";
             }
         } else {
             $page_1_passed = false;
             $error = "";
         }
         if ($page_1_passed == false) {
             $template = new HTMLTemplate("project/admin/project_status/edit.html");
             $paramquery = $_GET;
             $paramquery['nextpage'] = "1";
             $params = http_build_query($paramquery, '', '&#38;');
             $template->set_var("params", $params);
             if ($error) {
                 $template->set_var("error", $error);
             } else {
                 $template->set_var("error", "");
             }
             if ($_POST['name']) {
                 $template->set_var("name", $_POST['name']);
             } else {
                 $template->set_var("name", $project_status->get_name());
             }
             $template->output();
         } else {
             $paramquery = $_GET;
             unset($paramquery['nextpage']);
             unset($paramquery['action']);
             $params = http_build_query($paramquery);
             if ($project_status->set_name($_POST['name'])) {
                 Common_IO::step_proceed($params, "Edit Project Status", "Operation Successful", null);
             } else {
                 Common_IO::step_proceed($params, "Edit Project Status", "Operation Failed", null);
             }
         }
     } else {
         throw new ProjectStatusIDMissingException();
     }
 }
Beispiel #20
0
 public static function get_page_information($results, $pages)
 {
     return Common_IO::results_on_page($results, $pages);
 }
Beispiel #21
0
 public static function change_password_on_login()
 {
     global $user;
     $no_error = false;
     if ($_GET['nextpage'] == 1) {
         $no_error = true;
         if (!$_POST['new_password_1']) {
             $no_error = false;
             $error[1] = "<br /><span class='formError'>this field cannot be empty</span>";
         } else {
             $error[1] = "";
         }
         if (!$_POST['new_password_2']) {
             $no_error = false;
             $error[2] = "<br /><span class='formError'>this field cannot be empty</span>";
         } else {
             $error[2] = "";
         }
         if ($_POST['new_password_1'] and $_POST['new_password_2'] and $_POST['new_password_1'] != $_POST['new_password_2']) {
             $no_error = false;
             $error[2] = "<br /><span class='formError'>the new passwords are not equal</span>";
         } elseif (!$error[2]) {
             $error[2] = "";
         }
     } else {
         $error[0] = "";
         $error[1] = "";
         $error[2] = "";
     }
     if ($no_error == true) {
         $paramquery = array();
         $paramquery['username'] = $_GET['username'];
         $paramquery['session_id'] = $_GET['session_id'];
         $params = http_build_query($paramquery);
         if ($user->set_password_on_login($_POST['new_password_1'])) {
             Common_IO::step_proceed($params, "Change Password Succesful", "Password Changed", null);
         } else {
             Common_IO::step_proceed($params, "Change Password Failed", "Password Changed", null);
         }
     } else {
         $template = new HTMLTemplate("base/user/user_change_password_on_login.html");
         $paramquery = $_GET;
         $paramquery['nextpage'] = 1;
         $params = http_build_query($paramquery);
         $template->set_var("params", $params);
         $template->set_var("error_0", $error[0]);
         $template->set_var("error_1", $error[1]);
         $template->set_var("error_2", $error[2]);
         $template->output();
     }
 }