Example #1
0
/****************************************************************************/
/* ATutor																	*/
/****************************************************************************/
/* Copyright (c) 2002-2010                                                  */
/* Inclusive Design Institute                                               */
/* http://atutor.ca															*/
/*																			*/
/* This program is free software. You can redistribute it and/or			*/
/* modify it under the terms of the GNU General Public License				*/
/* as published by the Free Software Foundation.							*/
/****************************************************************************/
// $Id$
define('AT_INCLUDE_PATH', '../../../../include/');
require AT_INCLUDE_PATH . 'vitals.inc.php';
require AT_INCLUDE_PATH . '../mods/_standard/links/lib/links.inc.php';
if (!manage_links()) {
    $msg->addError('ACCESS_DENIED');
    header('Location: ' . AT_BASE_HREF . 'mods/_standard/links/index.php');
    exit;
}
if ((isset($_POST['delete']) || isset($_POST['edit'])) && !isset($_POST['cat_id'])) {
    $msg->addError('NO_ITEM_SELECTED');
} else {
    if (isset($_POST['delete'])) {
        $result = queryDB('SELECT link_id FROM %slinks WHERE cat_id=%d', array(TABLE_PREFIX, $_POST['cat_id']));
        if (!empty($result)) {
            $msg->addError('LINK_CAT_NOT_EMPTY');
        } else {
            header('Location: categories_delete.php?cat_id=' . $_POST['cat_id']);
            exit;
        }
</label><br />
		<?php 
if ($categories) {
    ?>
			<select name="cat_parent_id" id="category_parent">
			<?php 
    if ($pcat_id) {
        $current_cat_id = $pcat_id;
        $exclude = false;
        /* don't exclude the children */
    } else {
        $current_cat_id = $cat_id;
        $exclude = true;
        /* exclude the children */
    }
    $auth = manage_links();
    if ($auth == LINK_CAT_AUTH_ALL) {
        echo '<option value="0"></option>';
    }
    select_link_categories($categories, 0, $current_cat_id, $exclude, 0, TRUE);
    ?>
			</select>
		<?php 
} else {
    echo _AT('cats_no_categories');
}
?>
	</div>

	<div class="row buttons">
		<input type="submit" name="submit" value="<?php