Ejemplo n.º 1
0
 public static function tab_header()
 {
     $tab_io = new Tab_IO();
     // Main Page
     $paramquery['username'] = $_GET['username'];
     $paramquery['session_id'] = $_GET['session_id'];
     $paramquery['nav'] = "sample";
     $paramquery['run'] = "detail";
     $paramquery['sample_id'] = $_GET['sample_id'];
     $params = http_build_query($paramquery, '', '&');
     unset($paramquery);
     $tab_io->add("main", Language::get_message("SampleGeneralDetailTabMainPage", "general"), $params, false);
     // Parent Item Dialogs
     $module_dialog_array = ModuleDialog::list_dialogs_by_type("parent_item_list");
     if (is_array($module_dialog_array) and count($module_dialog_array) >= 1) {
         foreach ($module_dialog_array as $key => $value) {
             $paramquery['username'] = $_GET['username'];
             $paramquery['session_id'] = $_GET['session_id'];
             $paramquery['nav'] = "sample";
             $paramquery['run'] = "parent_item_list";
             $paramquery['sample_id'] = $_GET['sample_id'];
             $paramquery['dialog'] = $value['internal_name'];
             $params = http_build_query($paramquery, '', '&');
             $tab_io->add("pil_" . $value['internal_name'], Language::get_message($value['language_address'], "dialog"), $params, false);
         }
     }
     // Item Lister Dialogs
     $module_dialog_array = ModuleDialog::list_dialogs_by_type("item_list");
     if (is_array($module_dialog_array) and count($module_dialog_array) >= 1) {
         foreach ($module_dialog_array as $key => $value) {
             $paramquery['username'] = $_GET['username'];
             $paramquery['session_id'] = $_GET['session_id'];
             $paramquery['nav'] = "sample";
             $paramquery['run'] = "item_list";
             $paramquery['sample_id'] = $_GET['sample_id'];
             $paramquery['dialog'] = $value['internal_name'];
             $params = http_build_query($paramquery, '', '&');
             $tab_io->add("il_" . $value['internal_name'], Language::get_message($value['language_address'], "dialog"), $params, false);
         }
     }
     if ($_GET['run'] != "parent_item_list" and $_GET['run'] != "item_list") {
         $tab_io->activate("main");
     } else {
         if ($_GET['run'] == "item_list" and $_GET['dialog']) {
             $tab_io->activate("il_" . $_GET['dialog']);
         } elseif ($_GET['run'] == "parent_item_list" and $_GET['dialog']) {
             $tab_io->activate("pil_" . $_GET['dialog']);
         } else {
             $tab_io->activate("main");
         }
     }
     $tab_io->output();
 }
Ejemplo n.º 2
0
 public static function home()
 {
     $template = new HTMLTemplate("base/admin/home.html");
     $module_dialog_array = ModuleDialog::list_dialogs_by_type("admin_home_box");
     if (is_array($module_dialog_array) and count($module_dialog_array) >= 1) {
         $content = "";
         foreach ($module_dialog_array as $key => $value) {
             require_once $value['class_path'];
             $content .= $value['class']::$value['method']();
         }
         $template->set_var("content", $content);
     } else {
         $template->set_var("content", "");
     }
     $template->output();
 }
Ejemplo n.º 3
0
 public static function create_left_navigation()
 {
     global $session;
     if ($session->is_value("LEFT_NAVIGATION_ACTIVE")) {
         $active_id = $session->read_value("LEFT_NAVIGATION_ACTIVE");
     } else {
         $active_id = "LeftNavigationSymbol0";
     }
     $counter = 0;
     $js_array = array();
     $symbols_array = array();
     $module_dialog_array = ModuleDialog::list_dialogs_by_type("base_left_navigation");
     if (is_array($module_dialog_array) and count($module_dialog_array) >= 1) {
         foreach ($module_dialog_array as $key => $value) {
             if (file_exists($value['class_path'])) {
                 require_once $value['class_path'];
                 if (class_exists($value['class'])) {
                     $js_array[$counter]['ajax_url'] = $value['class']::get_ajax_url();
                     $js_array[$counter]['id'] = "LeftNavigationSymbol" . $key;
                     if ($js_array[$counter]['id'] == $active_id) {
                         $active_js_array['ajax_url'] = $js_array[$counter]['ajax_url'];
                         $active_js_array['id'] = $js_array[$counter]['id'];
                     }
                     $symbols_array[$counter]['icon'] = $value['class']::get_icon();
                     $symbols_array[$counter]['active'] = $value['class']::get_active();
                     $symbols_array[$counter]['id'] = "LeftNavigationSymbol" . $key;
                     $counter++;
                 }
             }
         }
     }
     $template = new HTMLTemplate("base/navigation/left/main.html");
     $template->set_var("symbols", $symbols_array);
     $template->set_var("js", $js_array);
     $template->set_var("active_js_ajax_url", $active_js_array['ajax_url']);
     $template->set_var("active_js_id", $active_js_array['id']);
     $template->output();
 }
Ejemplo n.º 4
0
 public static function home_dialog()
 {
     $template = new HTMLTemplate("data/admin/home_dialog.html");
     $template->set_var("base_dir", System::get_base_directory());
     $template->set_var("system_space", Convert::convert_byte_1024(System::get_system_space()));
     $template->set_var("user_used_space", Convert::convert_byte_1024(DataUserData::get_used_space()));
     $additional_quota_dialog_array = ModuleDialog::list_dialogs_by_type("additional_quota");
     if (is_array($additional_quota_dialog_array) and count($additional_quota_dialog_array) >= 1) {
         $additional_quota_array = array();
         $additional_quota_counter = 0;
         foreach ($additional_quota_dialog_array as $key => $value) {
             if (file_exists($value['class_path'])) {
                 require_once $value['class_path'];
                 $additional_quota_array[$additional_quota_counter]['title'] = Language::get_message($value['language_address'], "dialog");
                 $additional_quota_array[$additional_quota_counter]['value'] = $value['class']::$value['method']();
                 $additional_quota_counter++;
             }
         }
         $template->set_var("additional_quota_array", $additional_quota_array);
     }
     $template->set_var("db_used_space", Convert::convert_byte_1024(System::get_used_database_space()));
     $template->set_var("free_space", Convert::convert_byte_1024(System::get_free_space()));
     return $template->get_string();
 }
Ejemplo n.º 5
0
        $counter++;
    }
    $template->set_var("I_WANT_TO_ARRAY", $content_array);
}
$paramquery = $_GET;
$paramquery['nav'] = "help";
unset($paramquery['nextpage']);
unset($paramquery['sure']);
unset($paramquery['id']);
unset($paramquery['aspect']);
unset($paramquery['sortvalue']);
unset($paramquery['sortby']);
unset($paramquery['page']);
unset($paramquery['pageref']);
unset($paramquery['action']);
unset($paramquery['run']);
$params = http_build_query($paramquery, '', '&');
$template->set_var("GET_HELP", "index.php?" . $params);
// Today Screen
$module_dialog_array = ModuleDialog::list_dialogs_by_type("home_today_box");
if (is_array($module_dialog_array) and count($module_dialog_array) >= 1) {
    $content = "";
    foreach ($module_dialog_array as $key => $value) {
        require_once $value['class_path'];
        $content .= $value['class']::$value['method']();
    }
    $template->set_var("content", $content);
} else {
    $template->set_var("content", "");
}
$template->output();
Ejemplo n.º 6
0
 /**
  * @throws BaseModuleDialogMethodNotFoundException
  * @throws BaseModuleDialogClassNotFoundException
  * @throws BaseModuleDialogFileNotFoundException
  * @throws GroupIDMissingException
  */
 public static function detail()
 {
     if ($_GET['id']) {
         $tab_io = new Tab_IO();
         $paramquery = $_GET;
         unset($paramquery['tab']);
         $params = http_build_query($paramquery, '', '&');
         $tab_io->add("detail", "Group Details", $params, false);
         $paramquery = $_GET;
         $paramquery['tab'] = "users";
         $params = http_build_query($paramquery, '', '&');
         $tab_io->add("users", "Users", $params, false);
         $module_dialog_array = ModuleDialog::list_dialogs_by_type("group_admin_detail");
         if (is_array($module_dialog_array) and count($module_dialog_array) >= 1) {
             foreach ($module_dialog_array as $key => $value) {
                 $paramquery = $_GET;
                 $paramquery['tab'] = "dialog";
                 $paramquery['sub_dialog'] = $value['internal_name'];
                 $params = http_build_query($paramquery, '', '&');
                 $tab_io->add($value['internal_name'], Language::get_message($value['language_address'], "dialog"), $params, false);
             }
         }
         switch ($_GET['tab']) {
             case "users":
                 $tab_io->activate("users");
                 break;
             case "dialog":
                 $tab_io->activate($_GET['sub_dialog']);
                 break;
             default:
                 $tab_io->activate("detail");
                 break;
         }
         $tab_io->output();
         switch ($_GET['tab']) {
             case "users":
                 self::detail_users();
                 break;
             case "dialog":
                 $module_dialog = ModuleDialog::get_by_type_and_internal_name("group_admin_detail", $_GET['sub_dialog']);
                 if (file_exists($module_dialog['class_path'])) {
                     require_once $module_dialog['class_path'];
                     if (class_exists($module_dialog['class'])) {
                         if (method_exists($module_dialog['class'], $module_dialog['method'])) {
                             $module_dialog['class']::$module_dialog['method']($_GET['id']);
                         } else {
                             throw new BaseModuleDialogMethodNotFoundException();
                         }
                     } else {
                         throw new BaseModuleDialogClassNotFoundException();
                     }
                 } else {
                     throw new BaseModuleDialogFileNotFoundException();
                 }
                 break;
             default:
                 self::detail_home();
                 break;
         }
     } else {
         throw new GroupIDMissingException();
     }
 }
Ejemplo n.º 7
0
 /**
  * @throws BaseModuleDialogMethodNotFoundException
  * @throws BaseModuleDialogClassNotFoundException
  * @throws BaseModuleDialogFileNotFoundException
  * @throws BaseModuleDialogNotFoundException
  */
 private static function get_left_standard_navigation()
 {
     $dialog_array = ModuleDialog::list_dialogs_by_type("standard_navigation");
     if (count($dialog_array) == 0) {
         return;
     } elseif (count($dialog_array) == 1) {
         if (file_exists($dialog_array[0]['class_path'])) {
             require_once $dialog_array[0]['class_path'];
             if (class_exists($dialog_array[0]['class'])) {
                 if (method_exists($dialog_array[0]['class'], $dialog_array[0]['method'])) {
                     $dialog_array[0]['class']::$dialog_array[0]['method']();
                 } else {
                     throw new BaseModuleDialogMethodNotFoundException();
                 }
             } else {
                 throw new BaseModuleDialogClassNotFoundException();
             }
         } else {
             throw new BaseModuleDialogFileNotFoundException();
         }
     } else {
         throw new BaseModuleDialogNotFoundException();
     }
 }
Ejemplo n.º 8
0
 /**
  * @todo reactivate schedule after workflow integration
  */
 public static function tab_header()
 {
     if ($_GET['project_id']) {
         $tab_io = new Tab_IO();
         // Main Page
         $paramquery['username'] = $_GET['username'];
         $paramquery['session_id'] = $_GET['session_id'];
         $paramquery['nav'] = "project";
         $paramquery['run'] = "detail";
         $paramquery['project_id'] = $_GET['project_id'];
         $params = http_build_query($paramquery, '', '&');
         unset($paramquery);
         $tab_io->add("main", Language::get_message("ProjectGeneralDetailTabMainPage", "general"), $params, false);
         // Log
         $paramquery['username'] = $_GET['username'];
         $paramquery['session_id'] = $_GET['session_id'];
         $paramquery['nav'] = "project";
         $paramquery['run'] = "log";
         $paramquery['project_id'] = $_GET['project_id'];
         $params = http_build_query($paramquery, '', '&');
         unset($paramquery);
         $tab_io->add("log", Language::get_message("ProjectGeneralDetailTabLog", "general"), $params, false);
         // Structure
         $paramquery['username'] = $_GET['username'];
         $paramquery['session_id'] = $_GET['session_id'];
         $paramquery['nav'] = "project";
         $paramquery['run'] = "structure";
         $paramquery['project_id'] = $_GET['project_id'];
         $params = http_build_query($paramquery, '', '&');
         unset($paramquery);
         $tab_io->add("structure", Language::get_message("ProjectGeneralDetailTabStructure", "general"), $params, false);
         // Schedule
         /*
         $paramquery['username'] 	= $_GET['username'];
         $paramquery['session_id'] 	= $_GET['session_id'];
         $paramquery['nav']			= "project";
         $paramquery['run']			= "schedule";
         $paramquery['project_id']	= $_GET['project_id'];
         $params 					= http_build_query($paramquery,'','&');
         unset($paramquery);
         
         $tab_io->add("schedule", Language::get_message("ProjectGeneralDetailTabSchedule", "general"), $params, false);
         */
         // Item Lister Dialogs
         $module_dialog_array = ModuleDialog::list_dialogs_by_type("item_list");
         if (is_array($module_dialog_array) and count($module_dialog_array) >= 1) {
             foreach ($module_dialog_array as $key => $value) {
                 $paramquery['username'] = $_GET['username'];
                 $paramquery['session_id'] = $_GET['session_id'];
                 $paramquery['nav'] = "project";
                 $paramquery['run'] = "item_list";
                 $paramquery['project_id'] = $_GET['project_id'];
                 $paramquery['dialog'] = $value['internal_name'];
                 $params = http_build_query($paramquery, '', '&');
                 $tab_io->add($value['internal_name'], Language::get_message($value['language_address'], "dialog"), $params, false);
             }
         }
         // Administration
         $project_security = new ProjectSecurity($_GET['project_id']);
         if ($project_security->is_access(2, false) or $project_security->is_access(3, false) or $project_security->is_access(4, false) or $project_security->is_access(5, false) or $project_security->is_access(6, false) or $project_security->is_access(7, false)) {
             $paramquery['username'] = $_GET['username'];
             $paramquery['session_id'] = $_GET['session_id'];
             $paramquery['nav'] = "project";
             $paramquery['run'] = "admin";
             $paramquery['project_id'] = $_GET['project_id'];
             unset($paramquery['dialog']);
             $params = http_build_query($paramquery, '', '&');
             unset($paramquery);
             $tab_io->add("admin", Language::get_message("ProjectGeneralDetailTabAdministration", "general"), $params, false, false);
         }
         if ($_GET['run'] != "item_add" and $_GET['run'] != "item_list") {
             switch ($_GET['run']) {
                 case "log":
                 case "log_detail":
                 case "log_add":
                     $tab_io->activate("log");
                     break;
                 case "structure":
                     $tab_io->activate("structure");
                     break;
                 case "add_task":
                 case "task_delete":
                 case "task_detail":
                 case "schedule":
                 case "show_tasks":
                 case "task_edit_start":
                 case "task_edit_end":
                     $tab_io->activate("schedule");
                     break;
                 case "admin":
                     $tab_io->activate("admin");
                     break;
                 default:
                     if (strpos($_GET['run'], "admin_") === 0) {
                         $tab_io->activate("admin");
                     } else {
                         $tab_io->activate("main");
                     }
                     break;
             }
         } else {
             if ($_GET['run'] == "item_list" and $_GET['dialog']) {
                 $tab_io->activate($_GET['dialog']);
             } else {
                 $tab_io->activate("main");
             }
         }
         $tab_io->output();
     }
 }
Ejemplo n.º 9
0
 public static function navigation()
 {
     $template = new HTMLTemplate("base/admin/navigation/administration.html");
     $paramquery['username'] = $_GET['username'];
     $paramquery['session_id'] = $_GET['session_id'];
     $paramquery['nav'] = "base.admin";
     $paramquery['run'] = "general_admin";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("general_params", $params);
     $paramquery['username'] = $_GET['username'];
     $paramquery['session_id'] = $_GET['session_id'];
     $paramquery['nav'] = "base.admin";
     $paramquery['run'] = "include_admin";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("include_params", $params);
     $paramquery['username'] = $_GET['username'];
     $paramquery['session_id'] = $_GET['session_id'];
     $paramquery['nav'] = "base.admin";
     $paramquery['run'] = "module_admin";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("module_params", $params);
     $paramquery['username'] = $_GET['username'];
     $paramquery['session_id'] = $_GET['session_id'];
     $paramquery['nav'] = "base.admin";
     $paramquery['run'] = "navigation";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("navigation_params", $params);
     $paramquery['username'] = $_GET['username'];
     $paramquery['session_id'] = $_GET['session_id'];
     $paramquery['nav'] = "base.admin";
     $paramquery['run'] = "registry";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("registry_params", $params);
     $paramquery['username'] = $_GET['username'];
     $paramquery['session_id'] = $_GET['session_id'];
     $paramquery['nav'] = "base.admin";
     $paramquery['run'] = "services";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("services_params", $params);
     $paramquery['username'] = $_GET['username'];
     $paramquery['session_id'] = $_GET['session_id'];
     $paramquery['nav'] = "base.admin";
     $paramquery['run'] = "system_log";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("system_log_params", $params);
     $paramquery['username'] = $_GET['username'];
     $paramquery['session_id'] = $_GET['session_id'];
     $paramquery['nav'] = "base.admin";
     $paramquery['run'] = "system_message";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("system_message_params", $params);
     $organisation_admin_navigation_array = array();
     $counter = 0;
     $organisation_dialog_array = ModuleDialog::list_dialogs_by_type("organisation_admin");
     if (is_array($organisation_dialog_array) and count($organisation_dialog_array) >= 1) {
         foreach ($organisation_dialog_array as $key => $value) {
             $paramquery['username'] = $_GET['username'];
             $paramquery['session_id'] = $_GET['session_id'];
             $paramquery['nav'] = "base.admin";
             $paramquery['run'] = "organisation";
             $paramquery['dialog'] = $value['internal_name'];
             $params = http_build_query($paramquery, '', '&');
             require_once $value['class_path'];
             if (method_exists($value['class'], "get_icon")) {
                 if (($icon = $value['class']::get_icon()) != null) {
                     $organisation_admin_navigation_array[$counter]['icon'] = $icon;
                 } else {
                     $organisation_admin_navigation_array[$counter]['icon'] = "blank.png";
                 }
             } else {
                 $organisation_admin_navigation_array[$counter]['icon'] = "blank.png";
             }
             $organisation_admin_navigation_array[$counter]['params'] = $params;
             $organisation_admin_navigation_array[$counter]['title'] = Language::get_message($value['language_address'], "dialog");
             $counter++;
         }
     }
     $template->set_var("organisation_admin", $organisation_admin_navigation_array);
     $module_admin_navigation_array = array();
     $counter = 0;
     $module_dialog_array = ModuleDialog::list_dialogs_by_type("module_admin");
     if (is_array($module_dialog_array) and count($module_dialog_array) >= 1) {
         foreach ($module_dialog_array as $key => $value) {
             $paramquery['username'] = $_GET['username'];
             $paramquery['session_id'] = $_GET['session_id'];
             $paramquery['nav'] = "base.admin";
             $paramquery['run'] = "module";
             $paramquery['dialog'] = $value['internal_name'];
             $params = http_build_query($paramquery, '', '&');
             require_once $value['class_path'];
             if (method_exists($value['class'], "get_icon")) {
                 if (($icon = $value['class']::get_icon()) != null) {
                     $module_admin_navigation_array[$counter]['icon'] = $icon;
                 } else {
                     $module_admin_navigation_array[$counter]['icon'] = "blank.png";
                 }
             } else {
                 $module_admin_navigation_array[$counter]['icon'] = "blank.png";
             }
             $module_admin_navigation_array[$counter]['params'] = $params;
             $module_admin_navigation_array[$counter]['title'] = Language::get_message($value['language_address'], "dialog");
             $counter++;
         }
     }
     $template->set_var("module_admin", $module_admin_navigation_array);
     $template->output();
 }
Ejemplo n.º 10
0
 private static function detail_home()
 {
     global $user;
     $user_id = $_GET['id'];
     $template = new HTMLTemplate("base/user/admin/user/detail.html");
     $current_user = new User($user_id);
     $current_user_regional = new Regional($user_id);
     // General
     if ($user_id == $user->get_user_id()) {
         $template->set_var("change_username", false);
         if ($user_id == 1) {
             $template->set_var("is_not_system", false);
         } else {
             $template->set_var("is_not_system", true);
         }
     } else {
         if ($user_id == 1) {
             $template->set_var("change_username", false);
             $template->set_var("is_not_system", false);
         } else {
             $template->set_var("change_username", true);
             $template->set_var("is_not_system", true);
         }
     }
     $paramquery = $_GET;
     $paramquery['action'] = "rename";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("username", $current_user->get_username());
     $template->set_var("rename_params", $params);
     $template->set_var("fullname", $current_user->get_full_name(false));
     $paramquery = $_GET;
     $paramquery['action'] = "change_mail";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("mail", $current_user->get_profile("mail"));
     $template->set_var("change_mail_params", $params);
     $paramquery = $_GET;
     $paramquery['action'] = "change_password";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("change_password_params", $params);
     // Administrative Settings
     $paramquery = $_GET;
     $paramquery['action'] = "change_boolean_entry";
     $paramquery['aspect'] = "mc_password";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("mc_password_params", $params);
     if ($current_user->get_boolean_user_entry("must_change_password") == true) {
         $template->set_var("mc_password", "yes");
     } else {
         $template->set_var("mc_password", "no");
     }
     $paramquery = $_GET;
     $paramquery['action'] = "change_boolean_entry";
     $paramquery['aspect'] = "cc_password";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("cc_password_params", $params);
     if ($current_user->get_boolean_user_entry("can_change_password") == true) {
         $template->set_var("cc_password", "yes");
     } else {
         $template->set_var("cc_password", "no");
     }
     $paramquery = $_GET;
     $paramquery['action'] = "change_boolean_entry";
     $paramquery['aspect'] = "secure_password";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("secure_password_params", $params);
     if ($current_user->get_boolean_user_entry("secure_password") == true) {
         $template->set_var("secure_password", "yes");
     } else {
         $template->set_var("secure_password", "no");
     }
     $paramquery = $_GET;
     $paramquery['action'] = "change_boolean_entry";
     $paramquery['aspect'] = "block_write";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("block_write_params", $params);
     if ($current_user->get_boolean_user_entry("block_write") == true) {
         $template->set_var("block_write", "yes");
     } else {
         $template->set_var("block_write", "no");
     }
     $paramquery = $_GET;
     $paramquery['action'] = "change_boolean_entry";
     $paramquery['aspect'] = "create_folder";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("create_folder_params", $params);
     if ($current_user->get_boolean_user_entry("create_folder") == true) {
         $template->set_var("create_folder", "yes");
     } else {
         $template->set_var("create_folder", "no");
     }
     $paramquery = $_GET;
     $paramquery['action'] = "change_boolean_entry";
     $paramquery['aspect'] = "user_locked";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("locked_params", $params);
     if ($current_user->get_boolean_user_entry("user_locked") == true) {
         $template->set_var("locked", "yes");
     } else {
         $template->set_var("locked", "no");
     }
     $paramquery = $_GET;
     $paramquery['action'] = "change_boolean_entry";
     $paramquery['aspect'] = "user_inactive";
     $params = http_build_query($paramquery, '', '&');
     $template->set_var("inactive_params", $params);
     if ($current_user->get_boolean_user_entry("user_inactive") == true) {
         $template->set_var("inactive", "yes");
     } else {
         $template->set_var("inactive", "no");
     }
     // Module Settings
     $user_module_settings_dialog_array = ModuleDialog::list_dialogs_by_type("user_module_detail_setting");
     if (is_array($user_module_settings_dialog_array) and count($user_module_settings_dialog_array) >= 1) {
         $module_settings_array = array();
         $module_settings_counter = 0;
         foreach ($user_module_settings_dialog_array as $key => $value) {
             if (file_exists($value['class_path'])) {
                 require_once $value['class_path'];
                 $module_settings_return = $value['class']::$value['method']($user_id);
                 $module_settings_array[$module_settings_counter]['title'] = Language::get_message($value['language_address'], "dialog");
                 $module_settings_array[$module_settings_counter]['value'] = $module_settings_return['value'];
                 $module_settings_array[$module_settings_counter]['params'] = $module_settings_return['params'];
                 $module_settings_counter++;
             }
         }
         $template->set_var("module_settings_array", $module_settings_array);
         $template->set_var("module_settings", true);
     } else {
         $template->set_var("module_settings", false);
     }
     // User Settings
     $paramquery = $_GET;
     $paramquery['action'] = "change_language";
     $params = http_build_query($paramquery, '', '&');
     $language = new Language($current_user_regional->get_language_id());
     $template->set_var("language", $language->get_full_name());
     $template->set_var("language_params", $params);
     $paramquery = $_GET;
     $paramquery['action'] = "change_timezone";
     $params = http_build_query($paramquery, '', '&');
     $timezone = new Timezone($current_user_regional->get_timezone_id());
     $template->set_var("timezone", $timezone->get_name());
     $template->set_var("timezone_params", $params);
     $template->output();
 }
Ejemplo n.º 11
0
 /**
  * Main Controller for reqeusts via index.php
  * @throws BaseModuleControllerClassNotFoundException
  * @throws BaseModuleControllerFileNotFoundException
  */
 public static function io()
 {
     global $session, $user, $transaction;
     $template = new HTMLTemplate("index_header.html");
     if (!isset($GLOBALS['fatal_error'])) {
         $unique_id = uniqid();
         $css_directory = constant("WWW_DIR") . "/css";
         if (file_exists($css_directory)) {
             $css_directory_array = scandir($css_directory);
             if (is_array($css_directory_array)) {
                 $index_css = "";
                 foreach ($css_directory_array as $key => $value) {
                     if (strpos(strrev($value), "ssc.") === 0 and strpos(strrev($value), "ssc.gubed") === false and $value != "main.css") {
                         if (is_file($css_directory . "/" . $value)) {
                             if (constant("AVOID_CSS_CACHE") == true) {
                                 $index_css .= "<link rel='stylesheet' type='text/css' href='css/" . $value . "?" . $unique_id . "' title='Style' />\n";
                             } else {
                                 $index_css .= "<link rel='stylesheet' type='text/css' href='css/" . $value . "' title='Style' />\n";
                             }
                         }
                     }
                 }
             }
             $template->set_var("INDEX_CSS", $index_css);
         }
         $index_js = "";
         $js_lib_directory = constant("WWW_DIR") . "/js/lib";
         if (file_exists($js_lib_directory)) {
             $js_lib_directory_array = scandir($js_lib_directory);
             if (is_array($js_lib_directory_array)) {
                 $index_js = "";
                 foreach ($js_lib_directory_array as $key => $value) {
                     if (strpos(strrev($value), "sj.") === 0) {
                         if (is_file($js_lib_directory . "/" . $value)) {
                             if (constant("AVOID_JS_CACHE") == true) {
                                 $index_js .= "<script type='text/javascript' src='js/lib/" . $value . "?" . $unique_id . "'></script>\n";
                             } else {
                                 $index_js .= "<script type='text/javascript' src='js/lib/" . $value . "'></script>\n";
                             }
                         }
                     }
                 }
             }
         }
         $js_modules_directory = constant("WWW_DIR") . "/js/modules";
         if (file_exists($js_modules_directory)) {
             $js_modules_directory_array = scandir($js_modules_directory);
             if (is_array($js_modules_directory_array)) {
                 foreach ($js_modules_directory_array as $key => $value) {
                     if (strpos(strrev($value), "sj.") === 0) {
                         if (is_file($js_modules_directory . "/" . $value)) {
                             if (constant("AVOID_JS_CACHE") == true) {
                                 $index_js .= "<script type='text/javascript' src='js/modules/" . $value . "?" . $unique_id . "'></script>\n";
                             } else {
                                 $index_js .= "<script type='text/javascript' src='js/modules/" . $value . "'></script>\n";
                             }
                         }
                     }
                 }
             }
         }
         if ($index_js) {
             $template->set_var("INDEX_JS", $index_js);
         } else {
             $template->set_var("INDEX_JS", " ");
         }
     } else {
         $template->set_var("INDEX_CSS", "<link rel=\"stylesheet\" type=\"text/css\" href=\"css/base.css\" title=\"Style\" />\n<link rel=\"stylesheet\" type=\"text/css\" href=\"css/login.css\" title=\"Style\" />");
         $template->set_var("INDEX_JS", "");
     }
     if (!isset($GLOBALS['fatal_error'])) {
         $template->set_var("INDEX_TITLE", Registry::get_value("base_html_title"));
         if (Cron::check() == true) {
             $template->set_var("CRON", true);
         } else {
             $template->set_var("CRON", false);
         }
         $template->output();
         $max_ip_errors = (int) Registry::get_value("base_max_ip_failed_logins");
         if (!is_numeric($max_ip_errors) or $max_ip_errors < 3) {
             $max_ip_errors = 3;
         }
         if (Security::ip_error_count() < $max_ip_errors) {
             $session_valid_array = $session->is_valid();
             if ($session_valid_array[0] === true) {
                 $template = new HTMLTemplate("main_header.html");
                 $sub_menu = array();
                 $module_dialog_array = ModuleDialog::list_dialogs_by_type("base_user_lists");
                 if (is_array($module_dialog_array) and count($module_dialog_array) >= 1) {
                     foreach ($module_dialog_array as $key => $value) {
                         $paramquery['username'] = $_GET['username'];
                         $paramquery['session_id'] = $_GET['session_id'];
                         $paramquery['nav'] = "base";
                         $paramquery['run'] = "base_user_lists";
                         $paramquery['dialog'] = $value['internal_name'];
                         $params = http_build_query($paramquery, '', '&#38;');
                         $temp_array = array();
                         $temp_array['params'] = $params;
                         $temp_array['title'] = Language::get_message($value['language_address'], "dialog");
                         array_push($sub_menu, $temp_array);
                         unset($temp_array);
                     }
                 }
                 $template->set_var("sub_menu", $sub_menu);
                 $my_profile_paramquery['username'] = $_GET['username'];
                 $my_profile_paramquery['session_id'] = $_GET['session_id'];
                 $my_profile_paramquery['nav'] = "base";
                 $my_profile_paramquery['run'] = "user_profile";
                 $my_profile_params = http_build_query($my_profile_paramquery, '', '&#38;');
                 $template->set_var("my_profile_params", $my_profile_params);
                 $system_messages_paramquery['username'] = $_GET['username'];
                 $system_messages_paramquery['session_id'] = $_GET['session_id'];
                 $system_messages_paramquery['nav'] = "base";
                 $system_messages_paramquery['run'] = "sysmsg";
                 $system_messages_params = http_build_query($system_messages_paramquery, '', '&#38;');
                 $template->set_var("system_messages_params", $system_messages_params);
                 $about_paramquery['username'] = $_GET['username'];
                 $about_paramquery['session_id'] = $_GET['session_id'];
                 $about_paramquery['nav'] = "base";
                 $about_paramquery['run'] = "system_info";
                 $about_params = http_build_query($about_paramquery, '', '&#38;');
                 $template->set_var("about_params", $about_params);
                 $template->set_var("username", $user->get_full_name(true));
                 $header_search_paramquery['username'] = $_GET['username'];
                 $header_search_paramquery['session_id'] = $_GET['session_id'];
                 $header_search_paramquery['nav'] = "base.search";
                 $header_search_paramquery['run'] = "header_search";
                 $header_search_paramquery['nextpage'] = "1";
                 $header_search_params = http_build_query($header_search_paramquery, '', '&#38;');
                 $template->set_var("header_search_params", $header_search_params);
                 $template->set_var("header_search_current_module", $_GET['nav']);
                 $template->output();
                 try {
                     // Navigation
                     require_once "base/io/navigation.io.php";
                     Navigation_IO::main();
                     Navigation_IO::left();
                     $template = new HTMLTemplate("content_header.html");
                     $template->output();
                     if ($session->read_value("must_change_password") == true) {
                         require_once "core/modules/base/io/user.io.php";
                         UserIO::change_password_on_login();
                     } else {
                         if ($_GET['nav']) {
                             $module_controller_array = SystemHandler::get_module_controller($_GET['nav']);
                             $module_controller_path = "core/modules/" . $module_controller_array['path'];
                             if (file_exists($module_controller_path)) {
                                 require_once $module_controller_path;
                                 if (class_exists($module_controller_array['class'])) {
                                     $module_controller_array['class']::io_handler($module_controller_array['alias']);
                                 } else {
                                     throw new BaseModuleControllerClassNotFoundException();
                                 }
                             } else {
                                 throw new BaseModuleControllerFileNotFoundException();
                             }
                         } else {
                             include "core/modules/base/io/home.io.php";
                         }
                     }
                 } catch (DatabaseQueryFailedException $e) {
                     $transaction->force_rollback();
                     $error_io = new Error_IO($e);
                     $error_io->display_error();
                 } catch (BaseException $e) {
                     $error_io = new Error_IO($e);
                     $error_io->display_error();
                 }
                 $template = new HTMLTemplate("content_footer.html");
                 $template->output();
                 $template = new HTMLTemplate("main_footer.html");
                 $template->output();
             } else {
                 require_once "base/io/login.io.php";
                 if ($session_valid_array[1] === true) {
                     Login_IO::output(true);
                 } else {
                     Login_IO::output(false);
                 }
             }
         } else {
             Error_IO::security_out_of_box_error("Your IP was blocked by server!");
         }
     } else {
         $template->set_var("INDEX_TITLE", "Open-LIMS");
         $template->output();
         Error_IO::fatal_error($GLOBALS['fatal_error']);
     }
     $template = new HTMLTemplate("index_footer.html");
     $template->output();
 }
Ejemplo n.º 12
0
 /**
  * @return object
  * @throws SampleIDMissingException
  * @throws BaseReportTCPDFClassMissingException
  */
 public static function get_full_report()
 {
     if (class_exists("TCPDF")) {
         if ($_GET['sample_id']) {
             $sample_id = $_GET['sample_id'];
             $sample = new Sample($sample_id);
             $owner = new User($sample->get_owner_id());
             $owner_name = str_replace("&nbsp;", " ", $owner->get_full_name(false));
             $paper_size_info_array = PaperSize::get_standard_size();
             $format = array($paper_size_info_array['width'], $paper_size_info_array['height']);
             if ($paper_size_info_array['width'] >= $paper_size_info_array['height']) {
                 $orientation = "L";
             } else {
                 $orientation = "P";
             }
             $pdf = new SamplePDF($sample_id, $sample->get_name(), $orientation, "mm", $format, true, 'UTF-8', false);
             $pdf->SetCreator(PDF_CREATOR);
             $pdf->SetAuthor('Open-LIMS');
             $pdf->SetTitle('Sample Report');
             $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING);
             $pdf->setHeaderFont(array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
             $pdf->setFooterFont(array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
             $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
             $pdf->SetMargins($paper_size_info_array['margin_left'], $paper_size_info_array['margin_top'] * 3, $paper_size_info_array['margin_right']);
             $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
             $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
             $pdf->SetAutoPageBreak(TRUE, $paper_size_info_array['margin_bottom']);
             $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
             $pdf->setLanguageArray($l);
             $pdf->setFontSubsetting(true);
             $pdf->SetFont('dejavusans', '', 14, '', true);
             $pdf->AddPage();
             $print_sample_id = "S" . str_pad($sample_id, 8, '0', STR_PAD_LEFT);
             $pdf->Write(0, '', '', 0, 'L', true, 0, false, false, 0);
             $pdf->SetFillColor(255, 255, 255);
             $pdf->SetTextColor(0, 0, 0);
             $pdf->MultiCell(90, 0, "ID", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(100, 0, $print_sample_id, 1, '', 1, 1, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(90, 0, "Name", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(100, 0, $sample->get_name(), 1, '', 1, 1, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(90, 0, "Type/Template", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(100, 0, $sample->get_template_name(), 1, '', 1, 1, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(90, 0, "Owner", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(100, 0, $owner_name, 1, '', 1, 1, '', '', true, 0, false, true, 0);
             $pdf->MultiCell(90, 0, "Status", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
             if ($sample->get_availability() == true) {
                 $pdf->MultiCell(100, 0, "available", 1, '', 1, 1, '', '', true, 0, false, true, 0);
             } else {
                 $pdf->MultiCell(100, 0, "not available", 1, '', 1, 1, '', '', true, 0, false, true, 0);
             }
             $pdf->MultiCell(90, 0, "Date/Time", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
             $datetime = new DatetimeHandler($sample->get_datetime());
             $pdf->MultiCell(100, 0, $datetime->get_datetime(false), 1, '', 1, 1, '', '', true, 0, false, true, 0);
             if ($sample->get_manufacturer_id()) {
                 $manufacturer = new Manufacturer($sample->get_manufacturer_id());
                 $pdf->MultiCell(90, 0, "Manufacturer", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
                 $pdf->MultiCell(100, 0, $manufacturer->get_name(), 1, '', 1, 1, '', '', true, 0, false, true, 0);
             }
             if ($sample->get_date_of_expiry()) {
                 $pdf->MultiCell(90, 0, "Date of Expiry", 1, 'L', 1, 0, '', '', true, 0, false, true, 0);
                 $date_of_expiry = new DatetimeHandler($sample->get_date_of_expiry());
                 $pdf->MultiCell(100, 0, $date_of_expiry->get_date(), 1, '', 1, 1, '', '', true, 0, false, true, 0);
             }
             $module_dialog_array = ModuleDialog::list_dialogs_by_type("item_report");
             if (is_array($module_dialog_array) and count($module_dialog_array) >= 1) {
                 foreach ($module_dialog_array as $key => $value) {
                     if (file_exists($value['class_path'])) {
                         require_once $value['class_path'];
                         if (class_exists($value['class'])) {
                             if (method_exists($value['class'], $value['method'])) {
                                 $sql = " SELECT item_id FROM " . constant("SAMPLE_HAS_ITEM_TABLE") . " WHERE sample_id = " . $_GET['sample_id'] . "";
                                 $pdf = $value['class']::$value['method']($sql, $sample->get_item_id(), $pdf);
                             }
                         }
                     }
                 }
             }
             return $pdf;
         } else {
             throw new SampleIDMissingException();
         }
     } else {
         throw new BaseReportTCPDFClassMissingException();
     }
 }