dokeos-dropbox
[ class tree: dokeos-dropbox ] [ index: dokeos-dropbox ] [ all elements ]

Source for file index.php

Documentation is available at index.php

  1. <?php // $Id: index.php,v 1.46 2005/09/26 10:20:25 pcool Exp $
  2. /*
  3. ==============================================================================
  4.     Dokeos - elearning and course management software
  5.  
  6.     Copyright (c) 2006-2008 Dokeos S.A.
  7.     Copyright (c) 2006 Ghent University (UGent)
  8.     Copyright (c) various contributors
  9.  
  10.     For a full list of contributors, see "credits.txt".
  11.     The full license can be read in "license.txt".
  12.  
  13.     This program is free software; you can redistribute it and/or
  14.     modify it under the terms of the GNU General Public License
  15.     as published by the Free Software Foundation; either version 2
  16.     of the License, or (at your option) any later version.
  17.  
  18.     See the GNU General Public License for more details.
  19.  
  20.     Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  21.     Mail: info@dokeos.com
  22. ==============================================================================
  23. */
  24. /**
  25. ==============================================================================
  26.  * @desc The dropbox is a personal (peer to peer) file exchange module that allows
  27.  *  you to send documents to a certain (group of) users.
  28.  *
  29.  * @version 1.3
  30.  *
  31.  * @author Jan Bols <jan@ivpv.UGent.be>, main programmer, initial version
  32.  * @author Ren� Haentjens <rene.haentjens@UGent.be>, several contributions  (see RH)
  33.  * @author Roan Embrechts, virtual course support
  34.  * @author Patrick Cool <patrick.cool@UGent.be>, Ghent University (see history version 1.3)
  35.  *
  36.  * @package dokeos.dropbox
  37.  *
  38.  * @todo complete refactoring. Currently there are about at least 3 sql queries needed for every individual dropbox document.
  39.  *             first we find all the documents that were sent (resp. received) by the user
  40.  *             then for every individual document the user(s)information who received (resp. sent) the document is searched
  41.  *             then for every individual document the feedback is retrieved
  42.  * @todo     the implementation of the dropbox categories could (on the database level) have been done more elegantly by storing the category
  43.  *             in the dropbox_person table because this table stores the relationship between the files (sent OR received) and the users
  44. ==============================================================================
  45.  */
  46.  
  47. /**
  48. ==============================================================================
  49.                     HISTORY
  50. ==============================================================================
  51. Version 1.1
  52. ------------
  53. - dropbox_init1.inc.php: changed include statements to require statements. This way if a file is not found, it stops the execution of a script instead of continuing with warnings.
  54. - dropbox_init1.inc.php: the include files "claro_init_global.inc.php" & "debug.lib.inc.php" are first checked for their existence before including them. If they don't exist, in the .../include dir, they get loaded from the .../inc dir. This change is necessary because the UCL changed the include dir to inc.
  55. - dropbox_init1.inc.php: the databasetable name in the variable $dropbox_cnf["introTbl"] is chnged from "introduction" to "tool_intro"
  56. - install.php: after submit, checks if the database uses accueil or tool_list as a tablename
  57. - index.php: removed the behaviour of only the teachers that are allowed to delete entries
  58. - index.php: added field "lastUploadDate" in table dropbox_file to store information about last update when resubmiting a file
  59. - dropbox.inc.php: added $lang["lastUpdated"]
  60. - index.php: entries in received list show when file was last updated if it is updated
  61. - index.php: entries in sent list show when file was last resent if it was resent
  62. - dropbox_submit.php: add a unique id to every uploaded file
  63. - index.php: add POST-variable to the upload form with overwrite data when user decides to overwrite the previous sent file with new file
  64. - dropbox_submit.php: add sanity checks on POST['overwrite'] data
  65. - index.php: remove title field in upload form
  66. - dropbox_submit.php: remove use of POST['title'] variable
  67. - dropbox_init1.inc.php: added $dropbox_cnf["version"] variable
  68. - dropbox_class.inc.php: add $this->lastUploadDate to Dropbox_work class
  69. - dropbox.inc.php: added $lang['emptyTable']
  70. - index.php: if the received or sent list is empty, a message is displayed
  71. - dropbox_download.php: the $file var is set equal to the title-field of the filetable. So not constructed anymore by substracting the username from the filename
  72. - index.php: add check to see if column lastUploadDate exists in filetable
  73. - index.php: moved javascripts from dropbox_init2.inc.php to index.php
  74. - index.php: when specifying an uploadfile in the form, a checkbox allowing the user to overwrite a previously sent file is shown when the specified file has the same name as a previously uploaded file of that user.
  75. - index.php: assign all the metadata (author, description, date, recipient, sender) of an entry in a list to the class="dropbox_detail" and add css to html-header
  76. - index.php: assign all dates of entries in list to the class="dropbox_date" and add CSS
  77. - index.php: assign all persons in entries of list to the class="dropbox_person" and add CSS
  78. - dropbox.inc.php: added $lang['dropbox_version'] to indicate the lates version. This must be equal to the $dropbox_cnf['version'] variable.
  79. - dropbox_init1.inc.php: if the newest lang file isn't loaded by claro_init_global.inc.php from the .../lang dir it will be loaded locally from the .../plugin/dropbox/ dir. This way an administrator must not install the dropbox.inc.php in the .../lang/english dir, but he can leave it in the local .../plugin/dropbox/ dir. However if you want to present multiple language translations of the file you must still put the file in the /lang/ dir, because there is no language management system inside the .../plugin/dropbox dir.
  80. - mime.inc.php: created this file. It contains an array $mimetype with all the mimetypes that are used by dropbox_download.php to give hinst to the browser during download about content
  81. - dropbox_download.php: remove https specific headers because they're not necessary
  82. - dropbox_download.php: use application/octet-stream as the default mime and inline as the default Content-Disposition
  83. - dropbox.inc.php: add lang vars for "order by" action
  84. - dropbox_class.inc.php: add methods orderSentWork, orderReceivedWork en _cmpWork and propery _orderBy to class Dropbox_person to take care of sorting
  85. - index.php: add selectionlist to headers of sent/received lists to select "order by" and add code to keep selected value in sessionvar.
  86. - index.php: moved part of a <a> hyperlink to previous line to remove the underlined space between symbol and title of a work entry in the sent/received list
  87. - index.php: add filesize info in sent/received lists
  88. - dropbox_submit.php: resubmit prevention only for GET action, because it gives some annoying behaviour in POST situation: white screen in IE6
  89.  
  90. Version 1.2
  91. -----------
  92. - adapted entire dropbox tool so it can be used as a default tool in Dokeos 1.5
  93. - index.php: add event registration to log use of tool in stats tables
  94. - index.php: upload form checks for correct user selection and file specification before uploading the script
  95. - dropbox_init1.inc.php: added dropbox_cnf["allowOverwrite"] to allow or disallow overwriting of files
  96. - index.php: author name textbox is automatically filled in
  97. - mailing functionality (see RH comments in code)
  98. - allowStudentToStudent and allowJustUpload options (id.)
  99. - help in separate window (id.)
  100.  
  101. Version 1.3 (Patrick Cool)
  102. --------------------------
  103. - sortable table
  104. - categories
  105. - fixing a security hole
  106. - tabs (which can be disabled: see $dropbox_cnf['sent_received_tabs'])
  107. - same action on multiple documents ([zip]download, move, delete)
  108. - consistency with the docuements tool (open/download file, icons of documents, ...)
  109. - zip download of complete folder
  110.  
  111. Version 1.4 (Yannick Warnier)
  112. -----------------------------
  113. - removed all self-built database tables names
  114. ==============================================================================
  115.  */
  116.  
  117. /*
  118. ==============================================================================
  119.         INIT SECTION
  120. ==============================================================================
  121. */
  122. // the file that contains all the initialisation stuff (and includes all the configuration stuff)
  123. require_once"dropbox_init.inc.php");
  124.  
  125. // get the last time the user accessed the tool
  126. if ($_SESSION['last_access'][$_course['id']][TOOL_DROPBOX]=='')
  127. {
  128.     $last_access=get_last_tool_access(TOOL_DROPBOX,$_course['code'],$_user['user_id']);
  129.     $_SESSION['last_access'][$_course['id']][TOOL_DROPBOX]=$last_access;
  130. }
  131. else
  132. {
  133.     $last_access=$_SESSION['last_access'][$_course['id']][TOOL_DROPBOX];
  134. }
  135.  
  136. // do the tracking
  137.  
  138. //this var is used to give a unique value to every page request. This is to prevent resubmiting data
  139. $dropbox_unid md5uniqidrand)true));
  140.  
  141. /*
  142. ==============================================================================
  143.         DISPLAY SECTION
  144. ==============================================================================
  145. */
  146.  
  147. // Tool introduction text
  148.  
  149.  
  150. /*
  151. -----------------------------------------------------------
  152.     ACTIONS: add a dropbox file, add a dropbox category.
  153. -----------------------------------------------------------
  154. */
  155.  
  156. // *** display the form for adding a new dropbox item. ***
  157. if ($_GET['action']=="add")
  158. {
  159.     display_add_form();
  160. }
  161.  
  162. if ($_POST['submitWork'])
  163. {
  164.     $check Security::check_token();
  165.     if($check)
  166.     {
  167.         //include_once('dropbox_submit.php');
  168.     }
  169. }
  170.  
  171.  
  172. // *** display the form for adding a category ***
  173. if ($_GET['action']=="addreceivedcategory" or $_GET['action']=="addsentcategory")
  174. {
  175.     display_addcategory_form($_POST['category_name']);
  176. }
  177.  
  178. // *** editing a category: displaying the form ***
  179. if ($_GET['action']=='editcategory' and isset($_GET['id']))
  180. {
  181.     if (!$_POST)
  182.     {
  183.         display_addcategory_form('',$_GET['id']);
  184.     }
  185. }
  186.  
  187. // *** storing a new or edited category ***
  188. if ($_POST['StoreCategory'])
  189. {
  190. }
  191.  
  192. // *** Move a File ***
  193. if (($_GET['action']=='movesent' OR $_GET['action']=='movereceived'AND isset($_GET['move_id']))
  194. {
  195.     display_move_form(str_replace('move','',$_GET['action'])$_GET['move_id']get_dropbox_categories(str_replace('move','',$_GET['action'])));
  196. }
  197. if ($_POST['do_move'])
  198. {
  199.     Display :: display_normal_message(store_move($_POST['id']$_POST['move_target']$_POST['part']));
  200. }
  201.  
  202. // *** Delete a file ***
  203. if (($_GET['action']=='deletereceivedfile' OR $_GET['action']=='deletesentfile'AND isset($_GET['id']AND is_numeric($_GET['id']))
  204. {
  205.     $dropboxfile=new Dropbox_Person$_user['user_id']$is_courseAdmin$is_courseTutor);
  206.     if ($_GET['action']=='deletereceivedfile')
  207.     {
  208.         $dropboxfile->deleteReceivedWork($_GET['id']);
  209.         $message=get_lang('ReceivedFileDeleted');
  210.     }
  211.     if ($_GET['action']=='deletesentfile')
  212.     {
  213.         $dropboxfile->deleteSentWork($_GET['id']);
  214.         $message=get_lang('SentFileDeleted');
  215.     }
  216.     Display :: display_normal_message($message);
  217. }
  218.  
  219. // *** Delete a category ***
  220. if (($_GET['action']=='deletereceivedcategory' OR $_GET['action']=='deletesentcategory'AND isset($_GET['id']AND is_numeric($_GET['id']))
  221. {
  222.     $message=delete_category($_GET['action']$_GET['id']);
  223. }
  224.  
  225. // *** Do an action on multiple files ***
  226. // only the download has is handled separately in dropbox_init_inc.php because this has to be done before the headers are sent
  227. // (which also happens in dropbox_init.inc.php
  228.  
  229. if (!isset($_POST['feedback']&& ($_POST['action'== 'delete_received' OR $_POST['action'== 'download_received' OR $_POST['action'== 'delete_sent' OR $_POST['action'== 'download_sent'))
  230. {
  231.     $display_message=handle_multiple_actions();
  232.     Display :: display_normal_message($display_message);
  233. }
  234.  
  235. // *** Store Feedback ***
  236. if ($_POST['feedback'])
  237. {
  238.     $display_message store_feedback();
  239.     Display :: display_normal_message($display_message);
  240. }
  241.  
  242.  
  243. // *** Error Message ***
  244. if (isset($_GET['error']AND !empty($_GET['error']))
  245. {
  246.     Display :: display_normal_message(get_lang($_GET['error']));
  247. }
  248.  
  249.  
  250.  
  251. if ($_GET['action']!="add")
  252. {
  253. // getting all the categories in the dropbox for the given user
  254. $dropbox_categories=get_dropbox_categories();
  255. // creating the arrays with the categories for the received files and for the sent files
  256. foreach ($dropbox_categories as $category)
  257. {
  258.     if ($category['received']=='1')
  259.     {
  260.         $dropbox_received_category[]=$category;
  261.     }
  262.     if ($category['sent']=='1')
  263.     {
  264.         $dropbox_sent_category[]=$category;
  265.     }
  266. }
  267.  
  268.  
  269. /*
  270. -----------------------------------------------------------
  271.     THE MENU TABS
  272. -----------------------------------------------------------
  273. */
  274. if ($dropbox_cnf['sent_received_tabs'])
  275. {
  276. ?>
  277. <div id="tabbed_menu">
  278.     <ul id="tabbed_menu_tabs">
  279.         <li><a href="index.php?<?php echo api_get_cidreq();?>&view=received" <?php if (!$_GET['view'OR $_GET['view']=='received'){echo 'class="active"';}?> ><?php echo get_lang('ReceivedFiles')?></a></li>
  280.         <li><a href="index.php?<?php echo api_get_cidreq();?>&view=sent" <?php if ($_GET['view']=='sent'){echo 'class="active"';}?>><?php echo get_lang('SentFiles')?></a></li>
  281.     </ul>
  282. </div>
  283. <?php
  284. }
  285.  
  286. /*
  287. -----------------------------------------------------------
  288.     RECEIVED FILES
  289. -----------------------------------------------------------
  290. */
  291. if (!$_GET['view'OR $_GET['view']=='received' OR $dropbox_cnf['sent_received_tabs']==false)
  292. {
  293.     //echo '<h3>'.get_lang('ReceivedFiles').'</h3>';
  294.  
  295.     // This is for the categories
  296.     if (isset($_GET['view_received_category']AND $_GET['view_received_category']<>'')
  297.     {
  298.         $view_dropbox_category_received=$_GET['view_received_category'];
  299.     }
  300.     else
  301.     {
  302.         $view_dropbox_category_received=0;
  303.     }
  304.  
  305.  
  306.     /* *** Menu Received *** */
  307.     if ($view_dropbox_category_received<>0)
  308.     {
  309.         echo get_lang('CurrentlySeeing').': <strong>'.$dropbox_categories[$view_dropbox_category_received]['cat_name'].'</strong><br />';
  310.         echo '<img src="../img/folder_up.gif" alt="'.get_lang('up').'" align="absmiddle" /><a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category=0&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'">'.get_lang('Root')."</a>\n";
  311.     }
  312.     echo '<a href="'.api_get_self().'?'.api_get_cidreq().'&action=addreceivedcategory"><img src="../img/folder_new.gif" align=\"absmiddle\"/> '.get_lang('AddNewCategory').'</a>';
  313.  
  314.  
  315.     // object initialisation
  316.     $dropbox_person new Dropbox_Person$_user['user_id']$is_courseAdmin$is_courseTutor)// note: are the $is_courseAdmin and $is_courseTutor parameters needed????
  317.  
  318.     // constructing the array that contains the total number of feedback messages per document.
  319.     $number_feedback=get_total_number_feedback();
  320.  
  321.     // sorting and paging options
  322.     $sorting_options array();
  323.     $paging_options array();
  324.  
  325.     // the headers of the sortable tables
  326.     $column_header=array();
  327.     $column_header[array('',false,'');
  328.     $column_header[array(get_lang('Type'),true,'style="width:40px"');
  329.     $column_header[array(get_lang('ReceivedTitle')TRUE'');
  330.     $column_header[array(get_lang('Size')TRUE'');
  331.     $column_header[array(get_lang('Authors')TRUE'');    
  332.     $column_header[array(get_lang('LastResent')true);
  333.     $column_header[array(get_lang('Modify')FALSE'''nowrap style="text-align: right"');
  334.     $column_header[array('RealDate'true);
  335.     
  336.         
  337.     // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide 
  338.     $column_show[]=1;
  339.     $column_show[]=1;
  340.     $column_show[]=1;
  341.     $column_show[]=1;
  342.     $column_show[]=1;
  343.     $column_show[]=1;
  344.     $column_show[]=1;
  345.     $column_show[]=0;
  346.     
  347.     // Here we change the way how the colums are going to be sort
  348.     // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate 
  349.     // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48"
  350.     
  351.     $column_order[]=1;
  352.     $column_order[]=2;
  353.     $column_order[]=3;
  354.     $column_order[]=4;
  355.     $column_order[]=7;       
  356.     $column_order[]=6;
  357.     $column_order[]=7;
  358.     $column_order[]=8;
  359.     
  360.     
  361.     
  362.     // the content of the sortable table = the received files
  363.     foreach $dropbox_person -> receivedWork as $dropbox_file)
  364.     {
  365.         $dropbox_file_data=array();
  366.         if ($view_dropbox_category_received==$dropbox_file->category// we only display the files that are in the category that we are in.
  367.         {
  368.             $dropbox_file_data[]=$dropbox_file->id;
  369.             
  370.             if (!is_array($_SESSION['_seen'][$_course['id']][TOOL_DROPBOX]))
  371.             {            
  372.                 $_SESSION['_seen'][$_course['id']][TOOL_DROPBOXarray();
  373.             }
  374.             
  375.             // new icon
  376.             $new_icon='';
  377.             if ($dropbox_file->last_upload_date $last_access AND !in_array($dropbox_file->id,$_SESSION['_seen'][$_course['id']][TOOL_DROPBOX]))
  378.             {
  379.                 $new_icon='&nbsp;<img src="../img/new.gif" align="absmiddle" alt="'.get_lang('New').'" />';
  380.             }
  381.             
  382.             
  383.             $dropbox_file_data[]=build_document_icon_tag('file',$dropbox_file->title);
  384.             $dropbox_file_data[]='<a href="dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&amp;action=download"><img src="../img/filesave.gif" style="float:right;" alt="'.get_lang('Save').'"/></a><a href="dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'.$dropbox_file->title.'</a>'.$new_icon.'<br>'.$dropbox_file->description;
  385.             $dropbox_file_data[]=ceil(($dropbox_file->filesize)/1024).' '.get_lang('kB');
  386.             $dropbox_file_data[]=$dropbox_file->author;
  387.             //$dropbox_file_data[]=$dropbox_file->description;
  388.                         
  389.             $dropbox_file_data[]=date_to_str_ago($dropbox_file->last_upload_date).'<br><span class="dropbox_date">'.$dropbox_file->last_upload_date.'</span>';
  390.             
  391.             $action_icons=check_number_feedback($dropbox_file->id$number_feedback).' '.get_lang('Feedback').'
  392.                                     <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=viewfeedback&amp;id='.$dropbox_file->id.'"><img src="../img/comment_bubble.gif" alt="'.get_lang('Comment').'" align="absmiddle" /></a>
  393.                                     <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=movereceived&amp;move_id='.$dropbox_file->id.'"><img src="../img/deplacer_fichier.gif" alt="'.get_lang('Move').'" align="absmiddle"/></a>
  394.                                     <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=deletereceivedfile&amp;id='.$dropbox_file->id.'" onclick="return confirmation(\''.$dropbox_file->title.'\');"><img src="../img/delete.gif" alt="'.get_lang('Delete').'" align="absmiddle" /></a>';
  395.             //$action_icons='        <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;action=movereceived&amp;move_id='.$dropbox_file->id.'"><img src="../img/deplacer.gif"  alt="'.get_lang('Move').'"/></a>
  396.             //                        <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;action=deletereceivedfile&amp;id='.$dropbox_file->id.'" onclick="return confirmation(\''.$dropbox_file->title.'\');"><img src="../img/delete.gif"  alt="'.get_lang('Delete').'"/></a>';
  397.             // this is a hack to have an additional row in a sortable table
  398.             
  399.             if($_GET['action']=='viewfeedback' AND isset($_GET['id']and is_numeric($_GET['id']AND $dropbox_file->id==$_GET['id'])
  400.             {
  401.                 $action_icons.="</td></tr>\n"// ending the normal row of the sortable table
  402.                 $action_icons.='<tr><td colspan="2"><a href="index.php?"'.api_get_cidreq().'&view_received_category='.$_GET['view_received_category']."&amp;view_sent_category=".$_GET['view_sent_category']."&amp;view=".$_GET['view']."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td>\n</tr>\n";
  403.             }
  404.             $dropbox_file_data[]=$action_icons;
  405.             $action_icons='';
  406.             
  407.             $dropbox_file_data[]=$dropbox_file->last_upload_date;//date
  408.             
  409.             $dropbox_data_recieved[]=$dropbox_file_data;        
  410.         }
  411.     }
  412.     
  413.     
  414.  
  415.     // the content of the sortable table = the categories (if we are not in the root)
  416.     if ($view_dropbox_category_received==0)
  417.     {
  418.         foreach ($dropbox_categories as $category// note: this can probably be shortened since the categories for the received files are already in the $dropbox_received_category array;
  419.         {
  420.             $dropbox_category_data=array();
  421.             if ($category['received']=='1')
  422.             {
  423.                 $dropbox_category_data[]=''// this is where the checkbox icon for the files appear
  424.                 // the icon of the category
  425.                 $dropbox_category_data[]=build_document_icon_tag('folder',$category['cat_name']);
  426.                 $dropbox_category_data[]='<a href="dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&amp;action=downloadcategory&amp;sent_received=received"><img width="16" height="16" src="../img/folder_zip.gif" style="float:right;" alt="'.get_lang('Save').'"/></a><a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$category['cat_id'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'">'.$category['cat_name'].'</a>';
  427.                 $dropbox_category_data[]='';
  428.                 $dropbox_category_data[]='';
  429.                 $dropbox_category_data[]='';
  430.                 $dropbox_category_data[]='<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=editcategory&amp;id='.$category['cat_id'].'"><img src="../img/edit.gif" alt="'.get_lang('Edit').'" /></a>
  431.                                           <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=deletereceivedcategory&amp;id='.$category['cat_id'].'" onclick="return confirmation(\''.$category['cat_name'].'\');"><img src="../img/delete.gif" alt="'.get_lang('Delete').'" /></a>';
  432.             }
  433.             if (is_array($dropbox_category_data&& count($dropbox_category_data)>0)
  434.             {
  435.                 $dropbox_data_recieved[]=$dropbox_category_data;
  436.             }
  437.         }
  438.     }
  439.     
  440.     // Displaying the table
  441.     $additional_get_parameters=array('view'=>$_GET['view']'view_received_category'=>$_GET['view_received_category'],'view_sent_category'=>$_GET['view_sent_category']);    
  442.     Display::display_sortable_config_table($column_header$dropbox_data_recieved$sorting_options$paging_options$additional_get_parameters,$column_show,$column_orderarray ('delete_received' => get_lang('Delete'),'download_received'=>get_lang('Download')));
  443. }
  444.  
  445.  
  446. /*
  447. -----------------------------------------------------------
  448.     SENT FILES
  449. -----------------------------------------------------------
  450. */
  451. if ($_GET['view']=='sent' OR $dropbox_cnf['sent_received_tabs']==false)
  452. {
  453.     //echo '<h3>'.get_lang('SentFiles').'</h3>';
  454.  
  455.     // This is for the categories
  456.     if (isset($_GET['view_sent_category']AND $_GET['view_sent_category']<>'')
  457.     {
  458.         $view_dropbox_category_sent=$_GET['view_sent_category'];
  459.     }
  460.     else
  461.     {
  462.         $view_dropbox_category_sent=0;
  463.     }
  464.  
  465.     /* *** Menu Sent *** */
  466.     if ($view_dropbox_category_sent<>0)
  467.     {
  468.         echo get_lang('CurrentlySeeing').': <strong>'.$dropbox_categories[$view_dropbox_category_sent]['cat_name'].'</strong><br />';
  469.         echo '<img src="../img/folder_up.gif" alt="'.get_lang('Up').'" align="absmiddle" /><a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category=0&amp;view='.$_GET['view'].'">'.get_lang('Root')."</a>\n";
  470.     }
  471.     echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$_GET['view']."&amp;action=add\"><img src=\"../img/submit_file.gif\" align=\"absmiddle\"/> ".get_lang('UploadNewFile')."</a>&nbsp;\n";
  472.     echo "<a href=\"".api_get_self()."?".api_get_cidreq()."&view=".$_GET['view']."&amp;action=addsentcategory\"><img src=\"../img/folder_new.gif\" align=\"absmiddle\" /> ".get_lang('AddNewCategory')."</a>\n";
  473.  
  474.     //echo '<form name="sent_files" method="post" action="'.api_get_self().'?view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'">';
  475.  
  476.     // object initialisation
  477.     $dropbox_person new Dropbox_Person$_user['user_id']$is_courseAdmin$is_courseTutor);
  478.  
  479.     // constructing the array that contains the total number of feedback messages per document.
  480.     $number_feedback=get_total_number_feedback();
  481.  
  482.     // sorting and paging options
  483.     $sorting_options array();
  484.     $paging_options array();
  485.  
  486.     // the headers of the sortable tables
  487.     $column_header=array();
  488.     
  489.     $column_header[array('',false,'');
  490.     $column_header[array(get_lang('Type'),true,'style="width:40px"','style="text-align:center"');
  491.     $column_header[array(get_lang('SentTitle')TRUE'');
  492.     $column_header[array(get_lang('Size')TRUE'');
  493.     $column_header[array(get_lang('SentTo')TRUE'');        
  494.     $column_header[array(get_lang('LastResent')TRUE'');
  495.     $column_header[array(get_lang('Modify')FALSE'''nowrap style="text-align: right"');
  496.     $column_header[array('RealDate'FALSE);
  497.     
  498.     $column_show=array();
  499.     $column_order=array();
  500.     
  501.     // An array with the setting of the columns -> 1: columns that we will show, 0:columns that will be hide 
  502.     $column_show[]=1;
  503.     $column_show[]=1;
  504.     $column_show[]=1;
  505.     $column_show[]=1;
  506.     $column_show[]=1;
  507.     $column_show[]=1;
  508.     $column_show[]=1;
  509.     $column_show[]=0;
  510.     
  511.     // Here we change the way how the colums are going to be sort
  512.     // in this case the the column of LastResent ( 4th element in $column_header) we will be order like the column RealDate 
  513.     // because in the column RealDate we have the days in a correct format "2008-03-12 10:35:48"
  514.     
  515.     $column_order[]=1;
  516.     $column_order[]=2;
  517.     $column_order[]=3;
  518.     $column_order[]=4;
  519.     $column_order[]=7;       
  520.     $column_order[]=6;
  521.     $column_order[]=7;
  522.     $column_order[]=8;
  523.     
  524.     // the content of the sortable table = the received files
  525.     foreach $dropbox_person -> sentWork as $dropbox_file)
  526.     {
  527.         $dropbox_file_data=array();
  528.  
  529.         if ($view_dropbox_category_sent==$dropbox_file->category)
  530.         {
  531.             $dropbox_file_data[]=$dropbox_file->id;
  532.             $dropbox_file_data[]=build_document_icon_tag('file',$dropbox_file->title);
  533.             $dropbox_file_data[]='<a href="dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'&amp;action=download"><img src="../img/filesave.gif" style="float:right;" alt="'.get_lang('Save').'" /></a><a href="dropbox_download.php?'.api_get_cidreq().'&id='.$dropbox_file->id.'">'.$dropbox_file->title.'</a><br>'.$dropbox_file->description;
  534.             $dropbox_file_data[]=ceil(($dropbox_file->filesize)/1024).' '.get_lang('kB');
  535.             foreach ($dropbox_file->recipients as $recipient)
  536.             {
  537.                 $receivers_celldata=display_user_link($recipient['user_id']$recipient['name']).', '.$receivers_celldata;
  538.             }
  539.             $dropbox_file_data[]=$receivers_celldata;                    
  540.             $dropbox_file_data[]=date_to_str_ago($dropbox_file->last_upload_date).'<br><span class="dropbox_date">'.$dropbox_file->last_upload_date.'</span>';
  541.             
  542.             //$dropbox_file_data[]=$dropbox_file->author;            
  543.             $receivers_celldata='';
  544.             $action_icons=check_number_feedback($dropbox_file->id$number_feedback).' '.get_lang('Feedback').'
  545.                                     <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=viewfeedback&amp;id='.$dropbox_file->id.'"><img src="../img/comment_bubble.gif" alt="'.get_lang('Comment').'" align="absmiddle" /></a>
  546.                                     <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=movesent&amp;move_id='.$dropbox_file->id.'"><img src="../img/deplacer_fichier.gif" alt="'.get_lang('Move').'" align="absmiddle"/></a>
  547.                                     <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=deletesentfile&amp;id='.$dropbox_file->id.'" onclick="return confirmation(\''.$dropbox_file->title.'\');"><img src="../img/delete.gif" alt="'.get_lang('Delete').'" align="absmiddle" /></a>';
  548.             // this is a hack to have an additional row in a sortable table
  549.             if($_GET['action']=='viewfeedback' AND isset($_GET['id']and is_numeric($_GET['id']AND $dropbox_file->id==$_GET['id'])
  550.             {
  551.                 $action_icons.="</td></tr>\n"// ending the normal row of the sortable table
  552.                 $action_icons.="<tr>\n\t<td colspan=\"2\"><a href=\"index.php?".api_get_cidreq()."&view_received_category=".$_GET['view_received_category']."&amp;view_sent_category=".$_GET['view_sent_category']."&amp;view=".$_GET['view']."\">".get_lang('CloseFeedback')."</a></td><td colspan=\"7\">".feedback($dropbox_file->feedback2)."</td>\n</tr>\n";
  553.  
  554.             }
  555.             $dropbox_file_data[]=$action_icons;            
  556.             $dropbox_file_data[]=$dropbox_file->last_upload_date;            
  557.             $action_icons='';
  558.             $dropbox_data_sent[]=$dropbox_file_data;
  559.  
  560.         }
  561.     }
  562.  
  563.     // the content of the sortable table = the categories (if we are not in the root)
  564.     if ($view_dropbox_category_sent==0)
  565.     {
  566.         foreach ($dropbox_categories as $category)
  567.         {
  568.             $dropbox_category_data=array();
  569.             if ($category['sent']=='1')
  570.             {
  571.                 $dropbox_category_data[]=''// this is where the checkbox icon for the files appear
  572.                 $dropbox_category_data[]=build_document_icon_tag('folder',$category['cat_name']);
  573.                 $dropbox_category_data[]='<a href="dropbox_download.php?'.api_get_cidreq().'&cat_id='.$category['cat_id'].'&amp;action=downloadcategory&amp;sent_received=sent"><img width="16" height="16" src="../img/folder_zip.gif" style="float:right;" alt="'.get_lang('Save').'" /></a><a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$category['cat_id'].'&amp;view='.$_GET['view'].'">'.$category['cat_name'].'</a>';
  574.                 //$dropbox_category_data[]=''; 
  575.                 $dropbox_category_data[]='';
  576.                 //$dropbox_category_data[]='';
  577.                 $dropbox_category_data[]='';
  578.                 $dropbox_category_data[]='';
  579.                 $dropbox_category_data[]='<a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=editcategory&id='.$category['cat_id'].'"><img src="../img/edit.gif" alt="'.get_lang('Edit').'"/></a>
  580.                                           <a href="'.api_get_self().'?'.api_get_cidreq().'&view_received_category='.$_GET['view_received_category'].'&amp;view_sent_category='.$_GET['view_sent_category'].'&amp;view='.$_GET['view'].'&amp;action=deletesentcategory&amp;id='.$category['cat_id'].'" onclick="return confirmation(\''.$category['cat_name'].'\');"><img src="../img/delete.gif" alt="'.get_lang('Delete').'" /></a>';
  581.             }
  582.             if (is_array($dropbox_category_data&& count($dropbox_category_data)>0)
  583.             {
  584.                 $dropbox_data_sent[]=$dropbox_category_data;
  585.             }
  586.         }
  587.     }
  588.     // Displaying the table
  589.     $additional_get_parameters=array('view'=>$_GET['view']'view_received_category'=>$_GET['view_received_category'],'view_sent_category'=>$_GET['view_sent_category']);
  590.     Display::display_sortable_config_table($column_header$dropbox_data_sent$sorting_options$paging_options$additional_get_parameters,$column_show,$column_orderarray ('delete_received' => get_lang('Delete'),'download_received'=>get_lang('Download')));
  591. }
  592. }
  593. ?>

Documentation generated on Thu, 12 Jun 2008 13:50:10 -0500 by phpDocumentor 1.4.1