tagging as ATutor 1.5.4-release
[atutor.git] / include / html / editor_tabs / properties.inc.php
1 <?php
2 /****************************************************************/
3 /* ATutor                                                                                                               */
4 /****************************************************************/
5 /* Copyright (c) 2002-2006 by Greg Gay & Joel Kronenberg        */
6 /* Adaptive Technology Resource Centre / University of Toronto  */
7 /* http://atutor.ca                                                                                             */
8 /*                                                              */
9 /* This program is free software. You can redistribute it and/or*/
10 /* modify it under the terms of the GNU General Public License  */
11 /* as published by the Free Software Foundation.                                */
12 /****************************************************************/
13 // $Id$
14
15 if (!defined('AT_INCLUDE_PATH')) { exit; }
16
17 ?>
18         <div class="row">
19                 <?php echo _AT('release_date');  ?><br />
20                 <?php if ($_POST['day']) { ?>
21                         <?php
22                                 $today_day   = $_POST['day'];
23                                 $today_mon   = $_POST['month'];
24                                 $today_year  = $_POST['year'];
25
26                                 $today_hour  = $_POST['hour'];
27                                 $today_min   = $_POST['min'];           
28                 }?>
29                 <?php require(AT_INCLUDE_PATH.'html/release_date.inc.php');     ?>
30                 <?php echo _AT('applies_to_all_sub_pages'); ?>
31         </div>
32
33         <div class="row">
34                 <label for="keys"><?php echo _AT('keywords'); ?></label><br />
35                 <textarea name="keywords" class="formfield" cols="73" rows="2" id="keys"><?php echo ContentManager::cleanOutput($_POST['keywords']); ?></textarea>
36         </div>
37
38         <div class="row">
39                 <input type="hidden" name="button_1" value="-1" />
40                 <?php
41                         if ($contentManager->getNumSections() > (1 - (bool)(!$cid))) {
42                                 echo '<p>' 
43                                         , _AT('editor_properties_instructions', 
44                                                 '<img src="'.$_base_path.'images/after.gif" alt="'._AT('after_topic', '').'" title="'._AT('after_topic', '').'" />', 
45                                                 '<img src="'.$_base_path.'images/before.gif" alt="'._AT('before_topic', '').'" title="'._AT('before_topic', '').'" />',
46                                                 '<img src="'.$_base_path.'images/child_of.gif" alt="'._AT('child_of', '').'" title="'._AT('child_of', '').'"  />')
47                                         , '</p>';
48
49                                 echo '<p>' , _AT('editor_properties_insturctions_related') , '</p>';
50                         }
51
52                         $old_pid = $_POST['pid'];
53                         $old_ordering = $_POST['ordering'];
54
55                         if (isset($_POST['move'])) {
56                                 $arr = explode('_', key($_POST['move']), 2);
57                                 $new_pid = $_POST['new_pid'] = $arr[0];
58                                 $new_ordering = $_POST['new_ordering'] = $arr[1];
59                         } else {
60                                 $new_pid = $_POST['new_pid'];
61                                 $new_ordering = $_POST['new_ordering'];
62                         }
63
64                         echo '<input type="hidden" name="new_ordering" value="'.$new_ordering.'" />';
65                         echo '<input type="hidden" name="new_pid" value="'.$new_pid.'" />';
66
67                         ?><br />
68                         <table border="0">
69                         <tr>
70                                 <th colspan="2"><?php echo _AT('move'); ?></th>
71                                 <th><?php echo _AT('related_topics'); ?></th>
72                         </tr>
73                         <tr>
74                                 <td>&nbsp;</td>
75                                 <td>&nbsp;</td>
76                                 <td><?php echo _AT('home'); ?></td>
77                         </tr>
78                         <?php
79
80                                 $content_menu = $contentManager->_menu;
81                                 if ($cid == 0) {
82                                         $old_ordering = count($contentManager->getContent($pid))+1;
83                                         $old_pid = 0;
84
85                                         $current = array('content_id' => -1,
86                                                                         'ordering' => $old_ordering,
87                                                                         'title' => $_POST['title']);
88
89                                         $content_menu[$old_pid][] = $current;
90                                 }
91
92                                 if (($old_pid != $new_pid) || ($old_ordering != $new_ordering) || ($cid == 0)) {
93
94                                         $children = $content_menu[$old_pid];
95
96                                         $children_current = array($children[$old_ordering-1]);
97                                         unset($content_menu[$old_pid][$old_ordering-1]);
98
99                                         if ($old_pid != $new_pid) {
100                                                 $num_children = count($content_menu[$old_pid]);
101                                                 $i = 1;
102                                                 foreach($content_menu[$old_pid] as $id => $child) {
103                                                         $content_menu[$old_pid][$id]['ordering'] = $i;
104                                                         $i++;
105                                                 }
106                                         }
107
108                                         $children = $content_menu[$new_pid];
109                                         if (!isset($children)) {
110                                                 $children = array();
111                                         }
112                                 
113                                         $children_above = array_slice($children, 0, $new_ordering-1);
114
115                                         $children_below = array_slice($children, $new_ordering-1);
116
117                                         $content_menu[$new_pid] = array_merge($children_above, $children_current, $children_below);
118
119                                         $i=1;
120                                         foreach($content_menu[$new_pid] as $id => $child) {
121                                                 $content_menu[$new_pid][$id]['ordering'] = $i;
122                                                 $i++;
123                                         }
124                         
125                                 }
126
127                                 $contentManager->printMoveMenu($content_menu, 0, 0, '', array());
128
129                 ?></table>
130         </div>