, main programmer * @author Rene Haentjens, severalcontributions (see RH) * @author Roan Embrechts, virtual course support * @author Patrick Cool Dokeos Config Settings (AWACS) Refactoring tool introduction folders download file / folder (download icon) same action on multiple documents extended feedback * @package dokeos.dropbox ============================================================================== */ /* ============================================================================== INIT SECTION ============================================================================== */ //name of langfile // name of the language file that needs to be included $language_file = "dropbox"; //this var disables the link in the breadcrumps on top of the page //$noPHP_SELF = TRUE; // including the basic Dokeos initialisation file require("../inc/global.inc.php"); // the dropbox configuration parameters include_once('dropbox_config.inc.php'); // the dropbox sanity files (adds a new table and some new fields) include_once('dropbox_sanity.inc.php'); // the dropbox file that contains additional functions include_once('dropbox_functions.inc.php'); // protecting the script api_protect_course_script(); /* ----------------------------------------------------------- Libraries ----------------------------------------------------------- */ require_once(api_get_path(LIBRARY_PATH)."/debug.lib.inc.php"); require_once(api_get_path(LIBRARY_PATH) . "/course.lib.php"); require_once(api_get_path(LIBRARY_PATH) . "/groupmanager.lib.php"); // including the library for the sortable table require_once(api_get_path(LIBRARY_PATH).'/tablesort.lib.php'); // including the library for the dropbox require_once( "dropbox_class.inc.php"); // including the library to do the tracking require_once(api_get_path(LIBRARY_PATH).'/events.lib.inc.php'); // including some libraries that are also used in the documents tool require_once('../document/document.inc.php'); // we use a function build_document_icon_tag require_once(api_get_path(LIBRARY_PATH).'/fileDisplay.lib.php'); // the function choose_image is used require_once(api_get_path(LIBRARY_PATH).'/document.lib.php'); /* ----------------------------------------------------------- Virtual course support ----------------------------------------------------------- */ $user_id = api_get_user_id(); $course_code = $_course['sysCode']; $course_info = Database::get_course_info($course_code); $is_course_member = CourseManager::is_user_subscribed_in_real_or_linked_course($user_id, $course_info); /* ----------------------------------------------------------- Object Initialisation ----------------------------------------------------------- */ // we need this here because the javascript to re-upload the file needs an array // off all the documents that have already been sent. // @todo consider moving the javascripts in a function that displays the javascripts // only when it is needed. if ($_GET['action']=='add') { $dropbox_person = new Dropbox_Person( $_user['user_id'], $is_courseAdmin, $is_courseTutor); } /* ----------------------------------------------------------- create javascript and htmlHeaders // RH: Mailing: new function confirmsend ----------------------------------------------------------- */ $javascript = ""; $htmlHeadXtra[] = $javascript; $htmlHeadXtra[] = ""; api_session_register('javascript'); $htmlHeadXtra[] = ' '; $checked_files=false; if (!$_GET['view'] OR $_GET['view']=='received') { $part='received'; } elseif ($_GET['view']='sent') { $part='sent'; } else { header ('location: index.php?view='.$_GET['view'].'&error=Error'); } if ($_POST['actions']=='download' and !$_POST['store_feedback']) { foreach ($_POST as $key=>$value) { if (strstr($key,$part.'_')) { $checked_files=true; $checked_file_ids[]=$value; } } if ($checked_files==false) { header ('location: index.php?view='.$_GET['view'].'&error=CheckAtLeastOneFile'); exit; } else { handle_multiple_actions(); exit; } } /* ============================================================================== HEADER & TITLE ============================================================================== */ $nameTools = dropbox_lang("dropbox", "noDLTT"); if ($origin != 'learnpath') { Display::display_header($nameTools,"Dropbox"); } else // if we come from the learning path we have to include the stylesheet and the required javascripts manually. { echo ''; echo $javascript; } api_display_tool_title(); /* * ======================================== * AUTHORISATION SECTION * ======================================== * Prevents access of all users that are not course members */ if(! $is_allowed_in_course || ! $is_courseMember) { debug ($_SESSION); api_not_allowed(); if ($origin != 'learnpath') { Display::display_footer(); } exit(); } /** * ======================================== *       SANITY CHECK * ======================================== * @todo This has to be moved to the install / update script */ if (mysql_query("SELECT * FROM `".$dropbox_cnf['tbl_category']."`")==false) { $sql="CREATE TABLE `".$dropbox_cnf['tbl_category']."` ( `cat_id` int(11) NOT NULL auto_increment, `cat_name` text NOT NULL, `received` enum('0','1') NOT NULL default '0', `sent` enum('0','1') NOT NULL default '0', `user_id` int(11) NOT NULL default '0', PRIMARY KEY (`cat_id`) );"; api_sql_query($sql); } if (mysql_query("SELECT cat_id FROM `".$dropbox_cnf["fileTbl"]."`")==false) { $sql="ALTER TABLE `".$dropbox_cnf["fileTbl"]."` ADD `cat_id` int(11) NOT NULL default '0'"; api_sql_query($sql); } ?>