/** * 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(); } }
/** * 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 * @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(); } }