Exemple #1
0
 /**
  * @param string $action
  * @return string
  */
 public static function get_data_browser_link_html_and_button_handler($action)
 {
     global $regional;
     $html;
     $html_caption;
     $button_handler;
     $button_handler_caption;
     $template;
     $paramquery = $_GET;
     unset($paramquery['run']);
     switch ($action) {
         case "parameter_delete":
             if (isset($_POST['sure'])) {
                 self::delete($_POST['parameter_id']);
             } else {
                 $template = new HTMLTemplate("data/parameter_delete_window.html");
                 $button_handler_template = new JSTemplate("data/js/parameter_delete_window.js");
                 $button_handler_template->set_var("session_id", $_GET['session_id']);
                 $button_handler_template->set_var("parameter_id", $_POST['parameter_id']);
                 $button_handler = $button_handler_template->get_string();
                 $button_handler_caption = "Delete";
                 $html_caption = "Delete Parameter";
                 $html = $template->get_string();
             }
             break;
         case "permission":
             require_once "data.ajax.php";
             if (isset($_POST['permissions'])) {
                 $success = DataAjax::change_permission(json_decode($_POST['permissions']), "Parameter");
                 return $success;
             } else {
                 $permission = DataAjax::permission_window();
                 $button_handler_template = new JSTemplate("data/js/parameter_permission_window.js");
                 $button_handler_template->set_var("session_id", $_GET['session_id']);
                 $button_handler_template->set_var("parameter_id", $_POST['parameter_id']);
                 $button_handler = $button_handler_template->get_string();
                 $button_handler_caption = "Change";
                 $html_caption = "Change permission";
                 $html = $permission;
             }
             break;
     }
     $array = array("content" => $html, "content_caption" => $html_caption, "handler" => $button_handler, "handler_caption" => $button_handler_caption);
     return json_encode($array);
 }
Exemple #2
0
 /**
  * @param string $folder_id
  * @return string
  * @throws DataSecurityAccessDeniedException
  */
 public static function add_file($folder_id)
 {
     $parent_folder = Folder::get_instance($folder_id);
     if ($parent_folder->is_write_access()) {
         $paramquery = array();
         $unique_id = uniqid();
         $paramquery['session_id'] = $_GET['session_id'];
         $paramquery['folder_id'] = $folder_id;
         $paramquery['unique_id'] = $unique_id;
         $params = http_build_query($paramquery);
         $template = new HTMLTemplate("data/file_upload_window.html");
         $template->set_var("params", $params);
         $template->set_var("unique_id", $unique_id);
         $template->set_var("session_id", $_GET['session_id']);
         $button_handler_template = new JSTemplate("data/js/file_upload_window.js");
         $button_handler = $button_handler_template->get_string();
         $button_handler_caption = "Add";
         $html_caption = "Add File";
         $html = $template->get_string();
         $additional_script_template = new JSTemplate("data/js/file_upload_window_additional.js");
         $additional_script_template->set_var("session_id", $_GET['session_id']);
         $additional_script_template->set_var("unique_id", $unique_id);
         $additional_script = $additional_script_template->get_string();
         $array = array("content" => $html, "content_caption" => $html_caption, "handler" => $button_handler, "handler_caption" => $button_handler_caption, "additional_script" => $additional_script);
         return json_encode($array);
     } else {
         throw new DataSecurityAccessDeniedException();
     }
 }
Exemple #3
0
 /**
  * @return string
  */
 public static function start_test()
 {
     $template = new HTMLTemplate("base/batch/start_test_window.html");
     $array['content_caption'] = "Start Test Batch(es)";
     $array['height'] = 200;
     $array['width'] = 400;
     $array['continue_caption'] = "Start";
     $array['cancel_caption'] = "Cancel";
     $array['content'] = $template->get_string();
     $array['container'] = "#BaseBatchTestStartWindow";
     $continue_handler_template = new JSTemplate("base/batch/js/start_test.js");
     $continue_handler_template->set_var("session_id", $_GET['session_id']);
     $array['continue_handler'] = $continue_handler_template->get_string();
     return json_encode($array);
 }
 /**
  * @param string $get_array
  * @return string
  * @throws ProjectIDMissingException
  */
 public static function cancel($get_array)
 {
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     if ($_GET['project_id']) {
         $project = new Project($_GET['project_id']);
         if ($project->get_current_status_id() == 0) {
             $template = new HTMLTemplate("project/admin/reactivate_window.html");
             $array['content_caption'] = "Reactivate Project";
             $array['height'] = 200;
             $array['width'] = 400;
             $process_name = "reactivating";
         } else {
             $template = new HTMLTemplate("project/admin/cancel_window.html");
             $array['content_caption'] = "Cancel Project";
             $array['height'] = 430;
             $array['width'] = 400;
             $process_name = "canceling";
         }
         $array['continue_caption'] = "Yes";
         $array['cancel_caption'] = "No";
         $array['content'] = $template->get_string();
         $array['container'] = "#ProjectCancelWindow";
         $continue_handler_template = new JSTemplate("project/admin/js/cancel_continue_handler.js");
         $continue_handler_template->set_var("session_id", $_GET['session_id']);
         $continue_handler_template->set_var("get_array", $get_array);
         $array['continue_handler'] = $continue_handler_template->get_string();
         return json_encode($array);
     } else {
         throw new ProjectIDMissingException();
     }
 }
Exemple #5
0
 /**
  * @param string $get_array
  * @return string
  * @throws SampleIDMissingException
  */
 public static function delete($get_array)
 {
     global $user;
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     if ($_GET['sample_id']) {
         $project = new Sample($_GET['sample_id']);
         $template = new HTMLTemplate("sample/int_admin/delete_window.html");
         $array['continue_caption'] = "Yes";
         $array['cancel_caption'] = "No";
         $array['content_caption'] = "Delete Sample";
         $array['height'] = 200;
         $array['width'] = 400;
         $array['content'] = $template->get_string();
         $array['container'] = "#SampleDeleteWindow";
         $continue_handler_template = new JSTemplate("sample/int_admin/js/delete_continue_handler.js");
         $continue_handler_template->set_var("username", $_GET['username']);
         $continue_handler_template->set_var("session_id", $_GET['session_id']);
         $continue_handler_template->set_var("get_array", $get_array);
         $array['continue_handler'] = $continue_handler_template->get_string();
         return json_encode($array);
     } else {
         throw new SampleIDMissingException();
     }
 }
Exemple #6
0
 /**
  * @param string $action
  * @return string
  */
 public static function get_data_browser_link_html_and_button_handler($action)
 {
     $html;
     $html_caption;
     $button_handler;
     $button_handler_caption;
     $template;
     $paramquery = $_GET;
     unset($paramquery['run']);
     switch ($action) {
         case "folder_add":
             if (isset($_POST['folder_name'])) {
                 return self::add_folder($_POST['folder_id'], $_POST['folder_name']);
             } else {
                 $button_handler_template = new JSTemplate("data/js/folder_add_window.js");
                 $button_handler_template->set_var("session_id", $_GET['session_id']);
                 $button_handler_template->set_var("folder_id", $_POST['folder_id']);
                 $button_handler = $button_handler_template->get_string();
                 $button_handler_caption = "Add";
                 $html_caption = "Add Folder";
                 $template = new HTMLTemplate("data/folder_add_window.html");
                 $html = $template->get_string();
             }
             break;
         case "folder_delete":
             if (isset($_POST['sure'])) {
                 return self::delete_folder($_POST['folder_id']);
             } else {
                 $paramquery['sure'] = "true";
                 $paramquery['nextpage'] = "1";
                 $params = http_build_query($paramquery);
                 $template = new HTMLTemplate("data/folder_delete_window.html");
                 $template->set_var("params", $params);
                 $button_handler_template = new JSTemplate("data/js/folder_delete_window.js");
                 $button_handler_template->set_var("session_id", $_GET['session_id']);
                 $button_handler_template->set_var("folder_id", $_POST['folder_id']);
                 $button_handler = $button_handler_template->get_string();
                 $button_handler_caption = "Delete";
                 $html_caption = "Delete Folder";
                 $html = $template->get_string();
             }
             break;
         case "folder_rename":
             if (isset($_POST['folder_name'])) {
                 return self::rename_folder($_POST['folder_id'], $_POST['folder_name']);
             } else {
                 $template = new HTMLTemplate("data/folder_rename_window.html");
                 $button_handler_template = new JSTemplate("data/js/folder_rename_window.js");
                 $button_handler_template->set_var("session_id", $_GET['session_id']);
                 $button_handler_template->set_var("folder_id", $_POST['folder_id']);
                 $button_handler = $button_handler_template->get_string();
                 $button_handler_caption = "Rename";
                 $html_caption = "Rename Folder";
                 $html = $template->get_string();
             }
             break;
         case "permission":
             require_once "data.ajax.php";
             if (isset($_POST['permissions'])) {
                 $success = DataAjax::change_permission(json_decode($_POST['permissions']), "Folder");
                 return $success;
             } else {
                 $permission = DataAjax::permission_window();
                 $button_handler_template = new JSTemplate("data/js/folder_permission_window.js");
                 $button_handler_template->set_var("session_id", $_GET['session_id']);
                 $button_handler_template->set_var("folder_id", $_POST['folder_id']);
                 $button_handler = $button_handler_template->get_string();
                 $button_handler_caption = "Change";
                 $html_caption = "Change permission";
                 $html = $permission;
             }
             break;
     }
     $array = array("content" => $html, "content_caption" => $html_caption, "handler" => $button_handler, "handler_caption" => $button_handler_caption);
     return json_encode($array);
 }
Exemple #7
0
 /**
  * @param string $get_array
  * @param string $type_array
  * @return string
  * @throws ItemTypeRequiredException
  */
 public static function add_as_item_window($get_array, $type_array, $folder_id)
 {
     global $regional;
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     if ($type_array) {
         $type_array = unserialize($type_array);
     }
     if (is_array($type_array) and count($type_array) == 1) {
         if (is_numeric($folder_id)) {
             $type_id = $type_array[0];
             $template = new HTMLTemplate("data/value_add_item_window.html");
             if ($_GET['parent'] and is_numeric($_GET['parent_id'])) {
                 $array['container'] = "#ValueItemAddWindow" . $_GET['parent_key'] . "-" . $_GET['parent_id'] . "-" . $_GET['key'];
             } else {
                 $array['container'] = "#ValueItemAddWindow" . $_GET['key'];
             }
             require_once "core/modules/data/io/value_form.io.php";
             $value_form_io = new ValueFormIO(null, $type_id, $folder_id);
             $value_form_io->set_field_class("DataValueAddValues");
             $template->set_var("value", $value_form_io->get_content());
             $array['continue_caption'] = "Add";
             $array['cancel_caption'] = "Cancel";
             $array['content_caption'] = "Add Values";
             $array['height'] = 350;
             $array['width'] = 400;
             $array['content'] = $template->get_string();
             $continue_handler_template = new JSTemplate("data/js/value_add_item_window.js");
             $continue_handler_template->set_var("session_id", $_GET['session_id']);
             $continue_handler_template->set_var("type_id", $type_id);
             $continue_handler_template->set_var("folder_id", $folder_id);
             $continue_handler_template->set_var("get_array", $get_array);
             $continue_handler_template->set_var("container_id", $array['container']);
             $array['continue_handler'] = $continue_handler_template->get_string();
             $script_template = new JSTemplate("data/js/value_add_item_window_onclick.js");
             $script_template->set_var("decimal_separator", $regional->get_decimal_separator());
             $script_template->set_var("thousand_separator", $regional->get_thousand_separator());
             $array['open_handler'] = $script_template->get_string();
             return json_encode($array);
         } else {
             throw new FolderIDMissingException();
         }
     } else {
         throw new ItemTypeRequiredException();
     }
 }
 /**
  * @param string $id
  * @return string
  * @throws BaseRegistyIDMissingException
  */
 public static function edit($id)
 {
     if (is_numeric($id)) {
         $registry = new Registry($id);
         $template = new HTMLTemplate("base/admin/base_registry/edit_window.html");
         $template->set_var("value", $registry->get_registry_value());
         $template->set_var("id", $id);
         $array['content_caption'] = "Edit Entry";
         $array['height'] = 170;
         $array['width'] = 400;
         $array['continue_caption'] = "Save";
         $array['cancel_caption'] = "Cancel";
         $array['content'] = $template->get_string();
         $array['container'] = "#BaseAdminRegistryEditWindow";
         $continue_handler_template = new JSTemplate("base/admin/base_registry/js/edit.js");
         $continue_handler_template->set_var("session_id", $_GET['session_id']);
         $array['continue_handler'] = $continue_handler_template->get_string();
         return json_encode($array);
     } else {
         throw new BaseRegistryIDMissingException();
     }
 }
Exemple #9
0
 /**
  * @param string $get_array
  * @param string $type_array
  * @param string $category_array
  * @return string
  */
 public static function add_as_item_window($get_array, $type_array, $category_array)
 {
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     if ($type_array) {
         $type_array = unserialize($type_array);
     }
     if ($category_array) {
         $category_array = unserialize($category_array);
     }
     $template = new HTMLTemplate("equipment/add_item_window.html");
     $equipment_array = EquipmentType::list_entries();
     $result = array();
     $hit_array = array();
     $counter = 0;
     if (is_array($type_array) and count($type_array) >= 1) {
         if (is_array($equipment_array) and count($equipment_array) >= 1) {
             foreach ($equipment_array as $key => $value) {
                 if (in_array($value, $type_array) or $value <= 3) {
                     $equipment_type = new EquipmentType($value);
                     $result[$counter]['value'] = $value;
                     $result[$counter]['disabled'] = "";
                     $result[$counter]['content'] = $equipment_type->get_name() . " (" . $equipment_type->get_cat_name() . ")";
                     $counter++;
                     array_push($hit_array, $value);
                 }
             }
         }
         if (is_array($category_array) and count($category_array) >= 1) {
             foreach ($category_array as $key => $value) {
                 $equipment_cat_array = EquipmentType::list_entries_by_cat_id($value);
                 if (is_array($equipment_cat_array) and count($equipment_cat_array) >= 1) {
                     foreach ($equipment_cat_array as $key => $value) {
                         if (!in_array($value, $hit_array)) {
                             $equipment_type = new EquipmentType($value);
                             $result[$counter]['value'] = $value;
                             $result[$counter]['disabled'] = "";
                             $result[$counter]['content'] = $equipment_type->get_name() . " (" . $equipment_type->get_cat_name() . ")";
                             $counter++;
                             array_push($hit_array, $value);
                         }
                     }
                 }
             }
         }
     } else {
         if (is_array($category_array) and count($category_array) >= 1) {
             foreach ($category_array as $key => $value) {
                 $equipment_cat_array = EquipmentType::list_entries_by_cat_id($value);
                 if (is_array($equipment_cat_array) and count($equipment_cat_array) >= 1) {
                     if (!in_array(1, $equipment_cat_array)) {
                         $equipment_cat_array[] = 1;
                     }
                     if (!in_array(2, $equipment_cat_array)) {
                         $equipment_cat_array[] = 2;
                     }
                     if (!in_array(3, $equipment_cat_array)) {
                         $equipment_cat_array[] = 3;
                     }
                     foreach ($equipment_cat_array as $key => $value) {
                         if (!in_array($value, $hit_array)) {
                             $equipment_type = new EquipmentType($value);
                             $result[$counter]['value'] = $value;
                             $result[$counter]['disabled'] = "";
                             $result[$counter]['content'] = $equipment_type->get_name() . " (" . $equipment_type->get_cat_name() . ")";
                             $counter++;
                             array_push($hit_array, $value);
                         }
                     }
                 }
             }
         } else {
             if (is_array($equipment_array) and count($equipment_array) >= 1) {
                 foreach ($equipment_array as $key => $value) {
                     $equipment_type = new EquipmentType($value);
                     $result[$counter]['value'] = $value;
                     $result[$counter]['disabled'] = "";
                     $result[$counter]['content'] = $equipment_type->get_name() . " (" . $equipment_type->get_cat_name() . ")";
                     $counter++;
                 }
             }
         }
     }
     if ($counter == 0) {
         $result[0]['value'] = "0";
         $result[0]['disabled'] = "disabled='disabled'";
         $result[0]['content'] = "NO EQUIPMENT FOUND!";
     }
     $template->set_var("select", $result);
     if ($_GET['parent'] and is_numeric($_GET['parent_id'])) {
         $array['container'] = "#EquipmentItemAddWindow" . $_GET['parent_key'] . "-" . $_GET['parent_id'] . "-" . $_GET['key'];
         $container_value_select = "EquipmentItemAddValueField" . $_GET['parent_key'] . "-" . $_GET['parent_id'] . "-" . $_GET['key'];
     } else {
         $array['container'] = "#EquipmentItemAddWindow" . $_GET['key'];
         $container_value_select = "EquipmentItemAddValueField" . $_GET['key'];
     }
     $template->set_var("container_value_select_id", $container_value_select);
     $array['continue_caption'] = "Add";
     $array['cancel_caption'] = "Cancel";
     $array['content_caption'] = "Add Equipment";
     $array['height'] = 350;
     $array['width'] = 400;
     $array['content'] = $template->get_string();
     $continue_handler_template = new JSTemplate("equipment/js/add_item_window.js");
     $continue_handler_template->set_var("session_id", $_GET['session_id']);
     $continue_handler_template->set_var("get_array", $get_array);
     $continue_handler_template->set_var("container_id", $array['container']);
     $continue_handler_template->set_var("container_value_select_id", $container_value_select);
     $array['continue_handler'] = $continue_handler_template->get_string();
     return json_encode($array);
 }
Exemple #10
0
 /**
  * @param string $get_array
  * @return string
  */
 public static function create($get_array)
 {
     if ($get_array) {
         $_GET = unserialize($get_array);
     }
     if ($_GET['project_id']) {
         $project = new Project($_GET['project_id']);
         $template = new HTMLTemplate("project/log_create_window.html");
         $array['content_caption'] = "Create New Log Entry";
         $array['height'] = 430;
         $array['width'] = 400;
         $array['continue_caption'] = "Create";
         $array['cancel_caption'] = "Cancel";
         $array['content'] = $template->get_string();
         $array['container'] = "#ProjectLogCreateWindow";
         $continue_handler_template = new JSTemplate("project/js/log_create.js");
         $continue_handler_template->set_var("session_id", $_GET['session_id']);
         $continue_handler_template->set_var("get_array", $get_array);
         $array['continue_handler'] = $continue_handler_template->get_string();
         return json_encode($array);
     }
 }