Exemple #1
0
                 notice_yesno(get_string('deletecheckfiles'), 'index.php', 'index.php', $optionsyes, $optionsno, 'post', 'get');
             } else {
                 notify(get_string('warningblockingdelete', 'resource'));
                 $options = array('id' => $id, 'wdir' => $wdir, 'action' => 'cancel', 'choose' => $choose);
                 # HU, CS Repository plugin support
                 print_continue("index.php?id={$id}&wdir={$wdir}&action=cancel&choose={$choose}" . $repository->get_arg());
             }
         } else {
             displaydir($wdir);
         }
         html_footer();
     }
     break;
 case "move":
     html_header($course, $wdir);
     if ($count = setfilelist($_POST) and confirm_sesskey()) {
         $USER->fileop = $action;
         $USER->filesource = $wdir;
         echo "<p class=\"centerpara\">";
         print_string("selectednowmove", "moodle", $count);
         echo "</p>";
     }
     displaydir($wdir);
     html_footer();
     break;
 case "paste":
     html_header($course, $wdir);
     if (isset($USER->fileop) and $USER->fileop == "move" and confirm_sesskey()) {
         foreach ($USER->filelist as $file) {
             $shortfile = basename($file);
             $oldfile = $basedir . '/' . $file;
Exemple #2
0
 case "zip":
     if (!empty($name) and confirm_sesskey()) {
         html_header($course, $wdir);
         $name = clean_filename($name);
         $files = array();
         foreach ($USER->filelist as $file) {
             $files[] = "{$basedir}/{$file}";
         }
         if (!zip_files($files, "{$basedir}/{$wdir}/{$name}")) {
             print_error("zipfileserror", "error");
         }
         clearfilelist();
         displaydir($wdir);
     } else {
         html_header($course, $wdir, "form.name");
         if (setfilelist($_POST)) {
             echo "<p align=\"center\">" . get_string("youareabouttocreatezip") . ":</p>";
             print_simple_box_start("center");
             printfilelist($USER->filelist);
             print_simple_box_end();
             echo "<br />";
             echo "<p align=\"center\">" . get_string("whattocallzip");
             echo "<table border=\"0\">\n<tr>\n<td>\n";
             echo "<form action=\"coursefiles.php\" method=\"post\" name=\"form\">\n";
             echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n";
             echo " <input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />\n";
             echo " <input type=\"hidden\" name=\"action\" value=\"zip\" />\n";
             echo " <input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />\n";
             echo " <INPUT type=\"text\" name=\"name\" size=\"35\" value=\"new.zip\" />\n";
             echo " <input type=\"submit\" value=\"" . get_string("createziparchive") . "\" />";
             echo "</form>\n";
 if (strpos($wdir, $gdocsstr) === 1) {
     if (link_to_gdoc($name, $filelink)) {
         $path = explode("/", $wdir);
         $fileid = $path[2];
         add_file_tocollection($morsle, $fileid, $readfolderid);
         $wdir = '/' . $path[1];
     }
 } else {
     if ($savelink) {
         $_POST['file1'] = $_FILES['userfile']['name'];
     }
     if (empty($_POST)) {
         $_POST['file1'] = $file;
     }
     $files = morsle_get_files($morsle, $wdir, $collectionid);
     setfilelist($_POST, $wdir, $owner, $files, $type);
     if (!empty($USER->filelist)) {
         foreach ($USER->filelist as $name => $value) {
             if (!link_to_gdoc($name, $value->link, $value->type)) {
                 print_error("gdocslinkerror", "error");
             } elseif (strpos($wdir, $deptstr) !== false || strpos($wdir, $userstr) !== false) {
                 // need to share resource with course user account
                 $acl_base_feed = 'https://docs.google.com/feeds/default/private/full/' . $value->id . '/acl';
                 assign_file_permissions($courseowner, 'writer', $owner, $acl_base_feed);
                 // need to place anything from departmental or instructors resources into the read-only collection so students can see them
                 add_file_tocollection($morsle, $readfolderid, $value->id);
             }
         }
     }
 }
 notify(get_string('linkedfile', 'block_morsle'));