2 /****************************************************************************/
\r
4 /****************************************************************************/
\r
5 /* Copyright (c) 2002-2010 */
\r
6 /* Inclusive Design Institute */
\r
7 /* http://atutor.ca */
\r
9 /* This program is free software. You can redistribute it and/or */
\r
10 /* modify it under the terms of the GNU General Public License */
\r
11 /* as published by the Free Software Foundation. */
\r
12 /****************************************************************************/
\r
15 define('AT_INCLUDE_PATH', '../../../../include/');
\r
16 require(AT_INCLUDE_PATH.'vitals.inc.php');
\r
17 require (AT_INCLUDE_PATH.'../mods/_standard/links/lib/links.inc.php');
\r
19 if (!manage_links()) {
\r
20 $msg->addError('ACCESS_DENIED');
\r
21 header('Location: '.AT_BASE_HREF.'mods/_standard/links/index.php');
\r
25 if ((isset($_POST['delete']) || isset($_POST['edit'])) && !isset($_POST['cat_id'])) {
\r
26 $msg->addError('NO_ITEM_SELECTED');
\r
27 } else if (isset($_POST['delete'])) {
\r
28 //check if links are in the cat
\r
29 $sql = "SELECT link_id FROM ".TABLE_PREFIX."links WHERE cat_id=$_POST[cat_id]";
\r
30 $result = mysql_query($sql, $db);
\r
31 if ($row = mysql_fetch_assoc($result)) {
\r
32 $msg->addError('LINK_CAT_NOT_EMPTY');
\r
34 header('Location: categories_delete.php?cat_id='.$_POST['cat_id']);
\r
37 } else if (isset($_POST['edit'])) {
\r
38 header('Location: categories_edit.php?cat_id='.$_POST['cat_id']);
\r
42 require(AT_INCLUDE_PATH.'header.inc.php');
\r
46 <form name="form" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
\r
47 <table summary="" class="data" rules="cols" align="center" style="width: 95%;">
\r
50 <th scope="col"> </th>
\r
51 <th scope="col"><?php echo _AT('name'); ?></th>
\r
52 <th scope="col"><?php echo _AT('parent'); ?></th>
\r
57 $categories = get_link_categories(true, true);
\r
59 if (!empty($categories)) { ?>
\r
63 <div class="row buttons">
\r
64 <input type="submit" name="edit" value="<?php echo _AT('edit'); ?>" /> <input type="submit" name="delete" value="<?php echo _AT('delete'); ?>" />
\r
71 <?php foreach ($categories as $id=>$row) {
\r
73 if (!empty($row['cat_name'])) {
\r
75 $parent_cat_name = '';
\r
76 if ($row['cat_parent']) {
\r
77 $sql_cat = "SELECT name, owner_id, owner_type FROM ".TABLE_PREFIX."links_categories WHERE cat_id=".$row['cat_parent'];
\r
78 $result_cat = mysql_query($sql_cat, $db);
\r
79 $row_cat = mysql_fetch_assoc($result_cat);
\r
80 $parent_cat_name = AT_print($row_cat['name'], 'links_categories.name');
\r
82 if (empty($parent_cat_name)) {
\r
83 $parent_cat_name = get_group_name($row_cat['owner_id']);
\r
86 $parent_cat_name = '<strong>'._AT('none').'</strong>';
\r
89 <tr onmousedown="document.form['m<?php echo $id; ?>'].checked = true;rowselect(this);" id="r_<?php echo $id; ?>">
\r
90 <td width="10"><input type="radio" name="cat_id" value="<?php echo $id; ?>" id="m<?php echo $id; ?>" /></td>
\r
91 <td><label for="m<?php echo $id; ?>"><?php echo AT_print($row['cat_name'], 'members.first_name'); ?></label></td>
\r
92 <td><?php echo $parent_cat_name; ?></td>
\r
102 <td colspan="3"><?php echo _AT('none_found'); ?></td>
\r
110 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>