blog (development code)
[moodle.git] / blog / tags.html
1 <?php
2 print_heading(get_string('tagsmanagement','blog'));
3 ?>
5 <table>
6     <tr>
7         <td width="50%">Official Tags</td>
8         <td width="50%">User Defined Tags</td>
9     </tr>
10     
11     <tr>
12         <td>
13             <form action="tags.php" method="POST">
14             <?php if (isadmin()){ ?>
15             <select name="tags[]" multiple="multiple" size="8">
16             <?php
17                 $otags = get_records_sql('SELECT * from '.$CFG->prefix.'tags WHERE type=\'official\' ORDER by text ASC');
18                 foreach ($otags as $otag) {
19                     echo '<option value="'.$otag->id.'">'.$otag->text.'</option>';
20                 }
21             ?>
22             </select>
23             <input type="hidden" name="mode" value="delete" />
24             <br />
25             <input type="submit" value="delete" />
26             <?php }
27                 else {
28                     $otags = get_records_sql('SELECT * from '.$CFG->prefix.'tags WHERE type=\'official\' ORDER by text ASC');
29                     foreach ($otags as $otag) {
30                         echo '<br />'.$otag->text;
31                     }
32                 }
33             ?>
34             </form>
35         </td>
36         
37         <td>
38             <form action="tags.php" method="POST">
39             <select name="tags[]" multiple="multiple" size="8">
40             <?php
41                 $ptags1 = get_records_sql('SELECT * from '.$CFG->prefix.'tags WHERE type=\'personal\' AND userid = '.$USER->id.' ORDER by text ASC');
42                 $ptags2 = get_records_sql('SELECT * from '.$CFG->prefix.'tags WHERE type=\'personal\' AND userid <> '.$USER->id.' ORDER by text ASC');;
43                 $ptags = array_merge($ptags1, $ptags2);
44                 foreach ($ptags as $ptag) {
45                     echo '<option value="'.$ptag->id.'">'.$ptag->text.'</option>';
46                 }
47             ?>
48             </select>
49             <input type="hidden" name="mode" value="delete" />
50             <br />
51             <input type="submit" value="delete" />
52             </form>
53         </td>
54     </tr>
55     
56     <tr>
57         <td>
58             <?php if (isadmin()) { ?>
59             <form action="tags.php" method="POST">
60             Add Official:<br/>
61             <input type="text" name="otag" />
62             <input type="submit" value="add" />
63             <input type="hidden" name="mode" value="addofficial" />
64             </form>
65             <?php }?>
66         </td>
67         
68         <td>
69             <form action="tags.php" method="POST">
70             Add Personal:<br/>
71             <input type="text" name="ptag" />
72             <input type="submit" value="add" />
73             <input type="hidden" name="mode" value="addpersonal" />
74             </form>
75         </td>
76     </tr>
77     
78 </table>
80 <p align="center">
81     <a href="#" onclick="window.close()">close this window</a>
82 </p>