2d3d81ea4ae41da00cd49b59523c40b9b48176b4
[atutor.git] / docs / mods / _core / tool_manager / index.php
1 <?php
2
3 define('AT_INCLUDE_PATH', '../../../include/');
4 require(AT_INCLUDE_PATH.'vitals.inc.php');
5
6 if ((isset($_REQUEST['popup']) && $_REQUEST['popup']) && 
7     (!isset($_REQUEST['framed']) || !$_REQUEST['framed'])) {
8     $popup = TRUE;
9     $framed = FALSE;
10 } elseif (isset($_REQUEST['framed']) && $_REQUEST['framed'] && isset($_REQUEST['popup']) && $_REQUEST['popup']) {
11     $popup = TRUE;
12     $framed = TRUE;
13     $tool_flag = TRUE;
14 } else {
15     $popup = FALSE;
16     $framed = FALSE;
17 }
18
19 $_REQUEST['cid'] = intval($_REQUEST['cid']);    //uses request 'cause after 'saved', the cid will become $_GET.
20
21 $cid = intval($_REQUEST['cid']);
22
23 require(AT_INCLUDE_PATH.'header.inc.php');
24
25
26 $tool_file= AT_INCLUDE_PATH.'../'.$_REQUEST['tool_file'];       // viene prelevato il path del file necessario per prelevare le informazioni relative ai sottocontenuti
27 $tool_list = require($tool_file);                            //si richiede la lista ei contenuti per lo strumento. i contenuti trovati potranno essere inseriti all'interno del materiale didattico come collegamento.
28 ?>
29 <div class="input-form">
30 <fieldset class="group_form"><legend class="group_form"><?php echo _AT('tools_manager'); ?></legend>
31 <br/>
32 <?php echo _AT('tool_man_comment');?>
33 <br/><br/><br/>
34 <?php echo $msg->printFeedbacks();
35
36 $sql = "SELECT forum_id FROM ".TABLE_PREFIX."content_forums_assoc WHERE content_id='$cid'";
37 if(isset($tool_list)) {?>
38 <form name="datagrid" action="<?php AT_INCLUDE_PATH.'../'.$_REQUEST['tool_file'];?>" method="POST">
39     <table class="data" summary="" style="width: 90%" rules="cols">
40         <thead>
41             <tr>
42                 <th scope="col" style="width:5%">&nbsp;</th>
43                 <th scope="col"><?php echo _AT('Title');  ?></th>
44             </tr>
45         </thead>
46         <tbody>
47             <?php foreach($tool_list as $tool) {
48                             $i = $i+1;
49                     $result = mysql_query($sql, $db);
50                     while($row = mysql_fetch_assoc($result)){
51                         if($tool['id'] == $row['forum_id']){
52                             $checked='checked';
53                             break;
54                         } else {
55                             $checked='';
56                         }
57                     }
58                 ?>
59             <tr>
60                 <td valign="top">
61                     <input name="check[]" value="<?php echo $tool['id'];?>" id="<?php echo $i; ?>" type="checkbox" <?php echo $checked;?> />
62                     &nbsp;<?php echo $files;?>
63                 </td>
64                 <td valign="top"><label for="<?php echo $i; ?>"><?php echo $tool['title']; ?></label></td>
65             </tr>
66                 <?php }
67                 $i=0;?>
68         </tbody>
69     </table>
70     <br /><br /><br />
71     <input type="hidden" name="cid" value="<?php echo $cid;?>" />
72     <input type="submit" name="save" value="<?php echo _AT('save');?>" class="button" />
73     
74 </form>
75
76 <?php } ?>
77 </fieldset>
78 </div>
79 <?php require(AT_INCLUDE_PATH.'footer.inc.php'); ?>