destroy_template(); // Uncomment these lines to delete variables delete_template("lbox1"); delete_template("lbox2"); delete_template("lbox3"); delete_template("rbox1"); delete_template("rbox2"); delete_template("rbox3"); delete_template("main_col1"); delete_template("main_col2"); delete_template("main_col3"); delete_template("header"); delete_template("footer"); delete_template("middle"); delete_template("body"); delete_template("head"); // Now define some content for our templates //insert_template("lbox1","<!-- start of first left hand box -->\n<table width=100% border=1 valign=top>\n<tr>\n<td>\nBox 1\n</td>\n</tr>\n</table>\n<!-- end of first left hand box -->"); //insert_template("lbox2","<!-- start of second left hand box -->\n<table width=100% border=1 valign=top>\n<tr>\n<td>\nBox 2\n</td>\n</tr>\n</table>\n<!-- end of second left hand box -->"); //insert_template("lbox3","<!-- start of third left hand box -->\n<table width=100% border=1 valign=top>\n<tr>\n<td>\nBox 3\n</td>\n</tr>\n</table>\n<!-- end of third left hand box -->"); //insert_template("rbox1","<!-- start of first right hand box -->\n<table width=100% border=1 valign=top>\n<tr>\n<td>\nBox 1\n</td>\n</tr>\n</table>\n<!-- end of first right hand box -->\n"); //insert_template("rbox2","<!-- start of second right hand box -->\n<table width=100% border=1 valign=top>\n<tr>\n<td>\nBox 2\n</td>\n</tr>\n</table>\n<!-- end of second right hand box -->\n"); //insert_template("rbox3","<!-- start of third right hand box -->\n<table width=100% border=1 valign=top>\n<tr>\n<td>\nBox 3\n</td>\n</tr>\n</table>\n<!-- end of third right hand box -->\n"); //insert_template("main_col1","<!-- start of first column -->\n<td width=20%><tpl>lbox1</tpl><tpl>lbox2</tpl><tpl>lbox3</tpl>\n</td>\n<!-- end of first column -->\n"); //insert_template("main_col2","<!-- start of second column -->\n<td>\n<tpl>main_text</tpl>\n</td>\n<!-- end of second column -->\n"); //insert_template("main_col3","<!-- start of first column -->\n<td width=20%><tpl>rbox1</tpl><tpl>rbox2</tpl><tpl>rbox3</tpl>\n</td>\n<!-- end of first column -->\n"); //insert_template("header","<!-- start of header -->\n<tr>\n<td colspan=3>\nHeader\n</td>\n</tr>\n<!-- end of header -->\n"); //insert_template("footer","<!-- start of footer section -->\n<tr>\n<td colspan=3>\nFooter\n</td>\n</tr>\n"); //insert_template("middle","<!-- start of middle section -->\n<tr><tpl>main_col1</tpl><tpl>main_col2</tpl><tpl>main_col3</tpl>\n</tr>\n<!-- end of middle section -->\n"); //insert_template("body","<body>\n<table width=100% border=1><tpl>header</tpl><tpl>middle</tpl><tpl>footer</tpl>\n</table>\n<!-- start of footer text -->\n<center>That's all folks</center>\n<!-- end of footer text -->\n</body>\n"); //insert_template("head","<head>\n<title>This is a dynamic test page with nested tables</title>\n</head>\n");
cancel_edittemplatepage($option); break; case "cancel_templatepages": cancel_templatepages($option); break; case "new_template": new_template($option); break; case "install_template": install_template($option); break; case "default_template": default_template($option); break; case "delete_template": delete_template($option); break; case 'save_templateparams': case 'apply_templateparams': save_templateparam($option); break; /*** * Configuration */ /*** * Configuration */ case "config": $show = JRequest::getCmd('show', ''); config($option, $show); break;
/** * Wrapper for the templates * * @author Patrick Cool <*****@*****.**>, Ghent University, Belgium * @author Julio Montoya. * @version August 2008 * @since Dokeos 1.8.6 */ function handle_templates() { /* Drive-by fix to avoid undefined var warnings, without repeating * isset() combos all over the place. */ $action = isset($_GET['action']) ? $_GET['action'] : "invalid"; if ($action != 'add') { echo '<div class="actions" style="margin-left: 1px;">'; echo '<a href="settings.php?category=Templates&action=add">' . Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '</div>'; } if ($action == 'add' || $action == 'edit' && is_numeric($_GET['id'])) { add_edit_template(); // Add event to the system log. $user_id = api_get_user_id(); $category = $_GET['category']; Event::addEvent(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id); } else { if ($action == 'delete' && is_numeric($_GET['id'])) { delete_template($_GET['id']); // Add event to the system log $user_id = api_get_user_id(); $category = $_GET['category']; Event::addEvent(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id); } display_templates(); } }
/** * Wrapper for the templates * * @author Patrick Cool <*****@*****.**>, Ghent University, Belgium * @author Julio Montoya. * @version August 2008 * @since Dokeos 1.8.6 */ function handle_templates() { $action = isset($_GET['action']) ? $_GET['action'] : null; if ($action != 'add') { echo '<div class="actions" style="margin-left: 1px;">'; echo '<a href="settings.php?category=Templates&action=add">' . Display::return_icon('new_template.png', get_lang('AddTemplate'), '', ICON_SIZE_MEDIUM) . '</a>'; echo '</div>'; } if ($action == 'add' || $action == 'edit' && is_numeric($_GET['id'])) { add_edit_template(); // Add event to the system log. $user_id = api_get_user_id(); $category = $_GET['category']; event_system(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id); } else { if ($action == 'delete' && is_numeric($_GET['id'])) { delete_template($_GET['id']); // Add event to the system log $user_id = api_get_user_id(); $category = $_GET['category']; event_system(LOG_CONFIGURATION_SETTINGS_CHANGE, LOG_CONFIGURATION_SETTINGS_CATEGORY, $category, api_get_utc_datetime(), $user_id); } display_templates(); } }
if ($_SERVER['REQUEST_METHOD'] == 'GET') { //echo 'GET'; foreach ($_GET as $key => $value) { //echo "a GET key is " . $key . "\n"; ${$key} = $value; //echo $key . ' is ' . $value . "\n"; } } } //echo phpinfo(); //echo $action; //die; switch ($action) { //echo 'should get templates'; case 'deletetemplate': delete_template(); break; case 'get_assignments': get_assignments(); break; case 'get_entry_framework': get_survey_display_framework(); break; case 'get_survey': get_survey(); break; case 'savetemplate': save_template(); break; case 'saveresponse': save_response();
/** * wrapper for the templates * * @author Patrick Cool <*****@*****.**>, Ghent University, Belgium * @version August 2008 * @since Dokeos 1.8.6 */ function handle_templates() { if ($_GET['action'] != 'add') { echo "\n<div class=\"actions\" style=\"margin-left:1px\" >"; echo '<a href="settings.php?category=Templates&action=add">' . Display::return_icon('template_add.gif', get_lang('AddTemplate')) . get_lang('AddTemplate') . '</a>'; echo "\n</div>"; } if ($_GET['action'] == 'add' or $_GET['action'] == 'edit' and is_numeric($_GET['id'])) { add_edit_template(); } else { if ($_GET['action'] == 'delete' and is_numeric($_GET['id'])) { delete_template($_GET['id']); } display_templates(); } }
<?php } } /*____________________________________________________________________DELETE_*/ if ($action == 'delete') { $info = get_template_info($_REQUEST['id']); if ($info['deletable'] == 0) { ?> <p class="error">The <i><?php echo $info['templatename']; ?> </i> template is a system template and cannot be deleted.</p> <?php } else { $success = delete_template($_REQUEST['id']); if ($success) { ?> <p class="success">Template <i><?php echo $info['templatename']; ?> </i> deleted successfully.</p> <?php } else { echo '<p class="error">Error deleting template.</p>'; } } } /*_______________________________________________________________DIRECTEMAIL_*/ if ($action == 'directemail') {
if (db_query($query_to_delete_template, $params)) { /* * work out the file path before we start deletion */ $query_to_get_template_type_id = "select template_type_id from {$prefix}templatedetails where template_id = ?"; $params = array($safe_template_id); $row_template_id = db_query_one($query_to_get_template_type_id, $params); $query_to_get_template_type_name = "select template_name, template_framework from " . "{$prefix}originaltemplatesdetails where template_type_id = ? "; $params = array($row_template_id['template_type_id']); $row_template_name = db_query_one($query_to_get_template_type_name, $params); $path = $xerte_toolkits_site->users_file_area_full . $safe_template_id . "-" . $_SESSION['toolkits_logon_username'] . "-" . $row_template_name['template_name']; /* * delete from the file system */ include $xerte_toolkits_site->root_file_path . $xerte_toolkits_site->module_path . $row_template_name['template_framework'] . "/delete_template.php"; delete_template($path . "/"); $query_to_delete_template_attributes = "delete from {$prefix}templatedetails where template_id= ?"; $params = array($safe_template_id); db_query($query_to_delete_template_attributes, $params); $query_to_delete_syndication = "delete from {$prefix}templatesyndication where template_id=?"; $params = array($safe_template_id); db_query($query_to_delete_syndication, $params); $query_to_delete_xml_and_peer = "delete from {$prefix}additional_sharing where template_id=?"; $params = array($safe_template_id); db_query($query_to_delete_xml_and_peer, $params); } else { } } else { echo REMOVE_TEMPLATE_NOT_CREATOR; } } else {
<?php // Load in standard config stuff include "admin/config.php"; // Load in database stuff include "{$site_root}/libs/lib_db.php"; // First say that we wish to use template system include "{$site_root}/libs/lib_templates.php"; // Delete previously defined templates in session file destroy_template(); delete_template("open_middle_row", 0); delete_template("close_middle_row", 0); delete_template("footer", 0); delete_template("separate_middle_row", 0); delete_template("page_bottom", 0); delete_template("header", 0); delete_template("page_top", 0); delete_template("whole_page", 0); echo "Templates deleted";
/* * Settings Page, It's required by WPWSLGeneral Class only. * */ require_once 'class-wpwsl-list-table.php'; if (isset($_GET['action']) && isset($_GET['action2'])) { if ($_GET['action'] == 'delete' || $_GET['action2'] == 'delete') { if (isset($_GET['tpl'])) { foreach ($_GET['tpl'] as $tpl) { delete_template($tpl); } } } } if (isset($_GET['delete'])) { delete_template($_GET['delete']); } function delete_template($id) { if (!is_wp_error(get_post($id))) { wp_delete_post($id, true); } } $args = array('post_type' => 'wpwsl_template', 'posts_per_page' => -1, 'orderby' => 'post_date', 'post_status' => 'any', 'order' => 'ASC'); $raw = get_posts($args); $data = array(); foreach ($raw as $d) { $status = $d->post_status; $tmp_key = trim(get_post_meta($d->ID, '_keyword', TRUE)); $key = $tmp_key; $array_key = explode(',', $tmp_key);