2 /****************************************************************/
4 /****************************************************************/
5 /* Copyright (c) 2002-2008 by Greg Gay & Joel Kronenberg */
6 /* Adaptive Technology Resource Centre / University of Toronto */
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 /****************************************************************/
16 * It provides a link to a resource, which opens such a resource in a new window.
18 * @param $resource: the name of the file.
21 * @author Silvia Mirri
23 function link_name_resource($resource){
24 echo '<a href="'.$resource.'" target="_blank">'.$resource.'</a>';
28 * It provides in the page the appropriated checkbox, in order to allow type resource and type alternative specification.
30 * @param $resource_id: the id of the resource.
31 * @param $alt: it identifies if the resource is a primary or an alternative one.
32 * @param $kind: it identifies the resource type: if the resource is textual or not.
34 * @see $db in include/vitals.inc.php
35 * @author Silvia Mirri
37 function checkbox_types($resource_id, $alt, $kind){
40 $legend = $alt.'_resource_type';
42 echo '<legend>'. _AT($legend).'</legend>';
44 $sql_types = "SELECT * FROM ".TABLE_PREFIX."resource_types";
45 $types = mysql_query($sql_types, $db);
47 $sql_set_types = "SELECT type_id FROM ".TABLE_PREFIX.$alt."_resources_types where ".$alt."_resource_id=".$resource_id;
48 $set_types = mysql_query($sql_set_types, $db);
50 $resource_types = false;
53 if (mysql_num_rows($set_types) > 0){
54 while ($set_type = mysql_fetch_assoc($set_types)) {
55 $resource_types[$j] = $set_type[type_id];
59 else echo '<p class="unsaved">'. _AT('define_resource_type').'</p>';
61 while ($type = mysql_fetch_assoc($types)) {
62 if ((($alt == 'primary')) && ($kind == 'non_textual') && (($type['type'] == 'sign_language')))
65 echo '<input type="checkbox" name="checkbox_'.$type['type'].'_'.$resource_id.'_'.$alt.'" value="'.$type['type'].'_'.$resource_id.'_'.$alt.'" id="'.$type['type'].'_'.$resource_id.'_'.$alt.'"';
67 $m = count($resource_types);
68 for ($j=0; $j < $m; $j++){
69 if (trim($resource_types[$j]) == trim($type[type_id])){
70 echo 'checked="checked"';
75 echo '<label for="'.$type['type'].'_'.$resource_id.'_'.$alt.'">';
76 if ($type['type']=='auditory')
78 if ($type['type']=='visual')
80 if ($type['type']=='textual')
82 if ($type['type']=='sign_language')
83 echo _AT('sign_language');
91 * It provides, for each alternative, a link through which it is possible to delete such an alternative resource declared for a particular original one.
93 * @param $cid: content id.
94 * @param $resource: resource id.
95 * @param $current_tab: the current tab id .
98 * @author Silvia Mirri
100 function delete_alternative($resource, $cid, $current_tab){
101 echo '<a href="'.$_SERVER['PHP_SELF'].'?cid='.$cid. SEP .'tab='.$current_tab . SEP . 'act=delete'. SEP .'id_alt='.$resource[secondary_resource_id].' ">'. _AT('delete').' <strong>'. $resource[secondary_resource].'</strong></a>';