From e1f2a5d4e60f431e0a94c998afc026f1136fb26b Mon Sep 17 00:00:00 2001 From: Tim Almdal Date: Thu, 11 Dec 2008 17:20:55 +0000 Subject: 1) Begins the creation of the local import module by adding the administation component to the scaffolding Actions tab. The importing functionality will follow shortly. 2) Defines a routining pattern for module administration controllers. URI's of the form admin/module/method/parameters gets remapped into module_admin/method/parameters. This will result in the lookup of the the controller Module_Admin_Controller --- modules/local_import/helpers/local_import.php | 49 ++++++++++++++++++++++ .../local_import/helpers/local_import_block.php | 30 +++++++++++++ .../helpers/local_import_installer.php | 41 ++++++++++++++++++ 3 files changed, 120 insertions(+) create mode 100644 modules/local_import/helpers/local_import.php create mode 100644 modules/local_import/helpers/local_import_block.php create mode 100644 modules/local_import/helpers/local_import_installer.php (limited to 'modules/local_import/helpers') diff --git a/modules/local_import/helpers/local_import.php b/modules/local_import/helpers/local_import.php new file mode 100644 index 00000000..045201c7 --- /dev/null +++ b/modules/local_import/helpers/local_import.php @@ -0,0 +1,49 @@ +admin) { +// throw new Exception("@todo ACCESS DENIED"); +// } + + $template = new View("local_import_admin.html"); + + $paths = unserialize(module::get_var("local_import", "authorized_paths")); + if (!empty($paths)) { + $template->dir_list = new View("local_import_dir_list.html"); + $template->dir_list->paths = array_keys($paths); + } else { + $template->dir_list = ""; + } + + $template->add_form = self::get_admin_form()->render(); + + return $template; + } + + public static function get_admin_form() { + $form = new Forge("admin/local_import/add_path", "", "post", array("id" => "gLocalImportAdminForm")); + $form->input("path")->label(true); + $form->submit(_("Add")); + + return $form; + } +} diff --git a/modules/local_import/helpers/local_import_block.php b/modules/local_import/helpers/local_import_block.php new file mode 100644 index 00000000..c337af41 --- /dev/null +++ b/modules/local_import/helpers/local_import_block.php @@ -0,0 +1,30 @@ +"; + + return implode("\n", $head); + } +} diff --git a/modules/local_import/helpers/local_import_installer.php b/modules/local_import/helpers/local_import_installer.php new file mode 100644 index 00000000..72f42c97 --- /dev/null +++ b/modules/local_import/helpers/local_import_installer.php @@ -0,0 +1,41 @@ +query("DELETE FROM `vars` WHERE `module_id` = {$module->id};"); + + module::delete("local_import"); + } +} -- cgit v1.2.3