, main programmer * @author René Haentjens, severalcontributions * @author Roan Embrechts, virtual course support * @author Patrick Cool Chamilo Config Settings (AWACS) Refactoring tool introduction folders download file / folder (download icon) same action on multiple documents extended feedback * @package chamilo.dropbox */ /** * Code */ /* INIT SECTION */ use \ChamiloSession as Session; $language_file = array('dropbox', 'document'); // This var disables the link in the breadcrumbs on top of the page //$noPHP_SELF = true; // including the basic Chamilo initialisation file require '../inc/global.inc.php'; $current_course_tool = TOOL_DROPBOX; // the dropbox configuration parameters require_once 'dropbox_config.inc.php'; // the dropbox sanity files (adds a new table and some new fields) //require_once 'dropbox_sanity.inc.php'; // the dropbox file that contains additional functions require_once 'dropbox_functions.inc.php'; // protecting the script api_protect_course_script(); /* Libraries */ // including the library for the dropbox require_once 'dropbox_class.inc.php'; // including some libraries that are also used in the documents tool require_once api_get_path(SYS_CODE_PATH).'document/document.inc.php'; // we use a function build_document_icon_tag /* Virtual course support */ $user_id = api_get_user_id(); $course_code = api_get_course_id(); $courseId = api_get_course_int_id(); $course_info = api_get_course_info($course_code); $session_id = api_get_session_id(); if (empty($session_id)) { $is_course_member = CourseManager::is_user_subscribed_in_course($user_id, $courseId, false); } else { $is_course_member = CourseManager::is_user_subscribed_in_course($user_id, $courseId, true, $session_id); } /* 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 (isset($_GET['action']) && $_GET['action'] == 'add') { $dropbox_person = new Dropbox_Person($_user['user_id'], api_is_course_admin(), $is_courseTutor); } else { $dropbox_person = null; } /* Create javascript and htmlHeaders */ $javascript = ""; $htmlHeadXtra[] = $javascript; $htmlHeadXtra[] = ""; Session::write('javascript',$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'); exit; } if (($_POST['action'] == 'download_received' || $_POST['action'] == 'download_sent') and !$_POST['store_feedback']) { $checked_file_ids = $_POST['id']; if (!is_array($checked_file_ids) || count($checked_file_ids) == 0) { header ('location: index.php?view='.$_GET['view'].'&error=CheckAtLeastOneFile'); } else { handle_multiple_actions(); } exit; } /* * AUTHORISATION SECTION * Prevents access of all users that are not course members */ if ((!$is_course_member) && !api_is_allowed_to_edit(null, true)) { if ($origin != 'learnpath') { api_not_allowed(true);//print headers/footers } else { api_not_allowed(); } exit(); } /* BREADCRUMBS */ if ($_GET['view'] == 'received') { $interbreadcrumb[] = array('url' => '../dropbox/index.php', 'name' => get_lang('Dropbox', '')); $nameTools = get_lang('ReceivedFiles'); if ($_GET['action'] == 'addreceivedcategory') { $interbreadcrumb[] = array('url' => '../dropbox/index.php?view=received', 'name' => get_lang('ReceivedFiles')); $nameTools = get_lang('AddNewCategory'); } } if ($_GET['view'] == 'sent' OR empty($_GET['view'])) { $interbreadcrumb[] = array('url' => '../dropbox/index.php', 'name' => get_lang('Dropbox', '')); $nameTools = get_lang('SentFiles'); if ($_GET['action'] == 'addsentcategory') { $interbreadcrumb[] = array('url' => '../dropbox/index.php?view=sent', 'name' => get_lang('SentFiles')); $nameTools = get_lang('AddNewCategory'); } if ($_GET['action'] == 'add') { $interbreadcrumb[] = array ('url' => '../dropbox/index.php?view=sent', 'name' => get_lang('SentFiles')); $nameTools = get_lang('UploadNewFile'); } } /* HEADER & TITLE */ 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($nameTools);