remove old readme
[atutor.git] / mods / _standard / file_storage / sublinks.php
1 <?php
2
3 if (!defined('AT_INCLUDE_PATH')) { exit; }
4
5 global $db;
6
7 $file_limit = 3;                //Numero massimo dei possibili sottocontenuti visualizzabili nella home-page
8
9 $sql = "SELECT file_id, file_name, description FROM ".TABLE_PREFIX."files WHERE owner_id=$_SESSION[course_id] ORDER BY date DESC LIMIT $file_limit";
10 $result = mysql_query($sql, $db);
11
12 if (mysql_num_rows($result) > 0) {
13         while ($row = mysql_fetch_assoc($result)) {
14                 if($row['description'] !=""){
15                         $filetext = $row['description'];
16                 }else{
17                         $filetext = $row['file_name'];
18                 }
19
20                 $list[] = '<a href="'.url_rewrite('mods/_standard/file_storage/index.php?download=1'.SEP.'files[]='. $row['file_id'], AT_PRETTY_URL_IS_HEADER).'"'.
21                           (strlen($filetext) > SUBLINK_TEXT_LEN ? ' title="'.AT_print($filetext, 'input.text').'"' : '') .'>'. 
22                           AT_print(validate_length($filetext, SUBLINK_TEXT_LEN, VALIDATE_LENGTH_FOR_DISPLAY), 'input.text') .'</a>';
23         }
24         return $list;   
25 } else {
26         return 0;
27 }
28
29 ?>