Exemplo n.º 1
0
 * List of all pages in course
 *
 * @package    mod
 * @subpackage page
 * @copyright  1999 onwards Martin Dougiamas (http://dougiamas.com)
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
 */
require '../../config.php';
require_once $CFG->dirroot . '/blocks/morsle/morslelib.php';
$id = required_param('courseid', PARAM_INT);
// course id
$embedlink = required_param('embedlink', PARAM_URL);
$type = 'file';
$name = required_param('name', PARAM_ALPHA);
$modtype = 'page';
link_to_gdoc($name, $embedlink, $type, $modtype);
$course = $DB->get_record('course', array('id' => $id), '*', MUST_EXIST);
require_course_login($course, true);
$PAGE->set_pagelayout('incourse');
// Trigger instances list viewed event.
$event = \mod_page\event\instances_list_viewed::create(array('context' => context_course::instance($course->id)));
$event->trigger();
$strpage = get_string('modulename', 'page');
$strpages = get_string('modulenameplural', 'page');
$strname = get_string('name');
$strintro = get_string('moduleintro');
$strlastmodified = get_string('lastmodified');
$PAGE->set_url('/mod/page/index.php', array('id' => $course->id));
$PAGE->set_title($course->shortname . ': ' . $strpages);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add($strpages);
Exemplo n.º 2
0
         $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'));
 // get ready to display the list of resources again
 clearfilelist();
 $files = morsle_get_files($morsle, $wdir, $collectionid);