public function search_form(moodle_url $formtarget, $searchvalue) { $content = html_writer::start_tag('form', array('class' => 'adminsearchform', 'method' => 'get', 'action' => $formtarget, 'role' => 'search')); $content .= html_writer::start_div('input-group'); $content .= html_writer::empty_tag('input', array('id' => 'adminsearchquery', 'type' => 'text', 'name' => 'query', 'class' => 'form-control', 'placeholder' => s(get_string('searchinsettings', 'admin')), 'value' => s($searchvalue))); $content .= html_writer::start_span('input-group-btn'); $content .= html_writer::tag('button', s(get_string('go')), array('type' => 'button', 'class' => 'btn btn-default')); $content .= html_writer::end_span(); $content .= html_writer::end_div(); $content .= html_writer::end_tag('form'); return $content; }
public function test_end_span() { $this->assertSame('</span>', html_writer::end_span()); }
public function course_search_form($value = '', $format = 'plain') { static $count = 0; $formid = 'coursesearch'; if (++$count > 1) { $formid .= $count; } $inputid = 'coursesearchbox'; $inputsize = 30; if ($format === 'navbar') { $formid = 'coursesearchnavbar'; $inputid = 'navsearchbox'; } $strsearchcourses = get_string("searchcourses"); $searchurl = new moodle_url('/course/search.php'); $form = array('id' => $formid, 'action' => $searchurl, 'method' => 'get', 'class' => "form-inline", 'role' => 'form'); $output = html_writer::start_tag('form', $form); $output .= html_writer::start_div('input-group'); $output .= html_writer::tag('label', $strsearchcourses, array('for' => $inputid, 'class' => 'sr-only')); $search = array('type' => 'text', 'id' => $inputid, 'size' => $inputsize, 'name' => 'search', 'class' => 'form-control', 'value' => s($value), 'placeholder' => $strsearchcourses); $output .= html_writer::empty_tag('input', $search); $button = array('type' => 'submit', 'class' => 'btn btn-default'); $output .= html_writer::start_span('input-group-btn'); $output .= html_writer::tag('button', get_string('go'), $button); $output .= html_writer::end_span(); $output .= html_writer::end_div(); // Close form-group. $output .= html_writer::end_tag('form'); return $output; }
function displaydir($wdir, $files) { // $wdir == / or /a or /a/b/c/d etc @ini_set('memory_limit', '1024M'); global $courseid, $DB, $OUTPUT; global $USER, $CFG, $COURSE; global $choose; global $deptstr, $userstr; require_once $CFG->dirroot . '/blocks/morsle/constants.php'; $course = $COURSE; $user = $USER; // Get the sort parameter if there is one $sort = optional_param('sort', 1, PARAM_INT); $dirlist = array(); $filelist = array(); $dirhref = array(); $filehref = array(); $courseid = $course->id; $coursecontext = context_course::instance($COURSE->id); // separate all the files list into directories and files foreach ($files as $name => $file) { if (is_folder($file)) { $dirlist[$name] = $file; } else { $filelist[$name] = $file; } } // setup variables and strings $strname = get_string("name", 'block_morsle'); $strsize = get_string("size"); $strmodified = get_string("modified"); $straction = get_string("action"); $strmakeafolder = get_string("morslemakecollection", 'block_morsle'); $struploadafile = get_string("uploadafile"); $strselectall = get_string("selectall"); $strselectnone = get_string("deselectall"); $strwithchosenfiles = get_string("withchosenfiles"); $strmovetoanotherfolder = get_string("movetoanotherfolder"); $strlinktocourse = get_string("linktocourse", 'block_morsle'); $strmovefilestohere = get_string("movefilestohere"); $strdeletefromcollection = get_string("deletefromcollection", 'block_morsle'); $strcreateziparchive = get_string("createziparchive"); $strrename = get_string("rename"); $stredit = get_string("edit"); $strunzip = get_string("unzip"); $strlist = get_string("list"); $strrestore = get_string("restore"); $strchoose = get_string("choose"); $strfolder = get_string("folder"); $strfile = get_string("file"); $strdownload = get_string("strdownload", 'block_morsle'); $struploadthisfile = get_string("uploadthisfile"); $struploadandlinkthisfile = get_string("uploadandlinkthisfile", 'block_morsle'); $filesize = 'Varies as to type of document'; $strmaxsize = get_string("maxsize", "", $filesize); $strcancel = get_string("cancel"); $strmodified = get_string("strmodified", 'block_morsle'); //CLAMP #289 set color and background-color to transparent //Kevin Wiliarty 2011-03-08 $padrename = get_string("rename"); $padedit = $padunzip = $padlist = $padrestore = $padchoose = $padfolder = $padfile = $padlink = ''; $attsArr = array($padedit => $stredit, $padunzip => $strunzip, $padlist => $strlist, $padrestore => $strrestore, $padchoose => $strchoose, $padfolder => $strfolder, $padfile => $strfile, $padlink => $strlinktocourse); foreach ($attsArr as $key => $value) { $key = html_writer::div($value . ' ', '', array('style' => 'color:transparent; background-color:transparent; display:inline;')); } /* $padedit = html_writer::div($stredit . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline')); $padunzip = html_writer::div($strunzip . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline')); $padlist = html_writer::div($strlist . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline')); $padrestore = html_writer::div($strrestore . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline')); $padchoose = html_writer::div($strchoose . ' ','', array('style'=>'color: transparent; background-color:transparent; display:inline')); $padfolder = html_writer::div($strfolder . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline;')); $padfile = html_writer::div($strfile . ' ','', array('style'=>'color:transparent; background-color; transparent; display:inline;')); $padlink = html_writer::div($strlinktocourse . ' ','', array('style'=>'color:transparent; background-color:transparent; display:inline;')); */ $gdocsstr = 'Google-Docs-Storage-for-'; // Set sort arguments so that clicking on a column that is already sorted reverses the sort order $sortvalues = array(1, 2, 3); foreach ($sortvalues as &$sortvalue) { if ($sortvalue == $sort) { $sortvalue = -$sortvalue; } } $upload_max_filesize = get_max_upload_file_size($CFG->maxbytes); // beginning of with selected files portion echo html_writer::start_tag('table', array('border' => '0', 'cellspacing' => '2', 'cellpadding' => '2', 'style' => 'min-width: 900px; margin-left:auto; margin-right:auto', 'class' => 'files')); if ($wdir !== '') { echo html_writer::start_tag('tr'); //html_writer::table($table); if (!empty($USER->fileop) and $USER->fileop == "move" and $USER->filesource != $wdir) { echo html_writer::start_tag('td', array('colspan' => '3', 'align' => 'center')); // move files to other folder form echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'paste')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'sesskey', 'value' => $USER->sesskey)); echo html_writer::tag('input', '', array('align' => 'center', 'type' => 'submit', 'value' => $strmovefilestohere)); //echo "<span> --> <b>$wdir</b></span><br />"; echo html_writer::start_span() . '-->' . html_writer::tag('b', $wdir) . html_writer::end_span() . html_writer::end_tag('br'); echo html_writer::end_tag('td'); echo html_writer::start_tag('td'); echo html_writer::end_tag('form'); // cancel moving form echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get', 'align' => 'left')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'cancel')); echo html_writer::tag('input', '', array('type' => 'submit', 'value' => $strcancel, 'style' => 'color:red; margin-left:10px')); echo html_writer::end_tag('form'); echo html_writer::end_tag('td'); } else { if (has_capability('moodle/course:update', $coursecontext) || strpos($wdir, '-write')) { echo html_writer::start_tag('tr', array('style' => 'background-color: #ffddbb;')); echo html_writer::start_tag('td', array('colspan' => '3', 'align' => 'left', 'style' => 'background-color:#ffddbb; padding-left:5px;')); // file upload form // TODO: what if we're in the user or departmental dir? echo html_writer::start_tag('form', array('enctype' => 'multipart/form-data', 'method' => 'post', 'action' => 'morslefiles.php')); echo html_writer::start_span() . ' ' . $struploadafile . ' (' . $strmaxsize . ') ' . html_writer::tag('b', $wdir) . html_writer::end_span() . html_writer::tag('br', ''); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'upload')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'sesskey', 'value' => $USER->sesskey)); if (!isset($coursebytes)) { $coursebytes = 0; } if (!isset($modbytes)) { $modbytes = 0; } $maxbytes = get_max_upload_file_size($CFG->maxbytes, $coursebytes, $modbytes); $str = html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'MAX_FILE_SIZE', 'value' => $maxbytes)) . "\n"; $name = 'userfile'; $str .= html_writer::tag('input', '', array('type' => 'file', 'size' => '50', 'name' => $name, 'alt' => $name, 'style' => 'margin-left: 5px;')) . html_writer::end_tag('br') . "\n"; echo $str; echo html_writer::tag('input', '', array('type' => 'submit', 'name' => 'save', 'value' => $struploadthisfile, 'style' => 'color:green; padding-left:5px;')); echo html_writer::tag('input', '', array('type' => 'submit', 'name' => 'savelink', 'value' => $struploadandlinkthisfile, 'style' => 'color:blue; padding-left:5px;')); echo html_writer::end_tag('form'); echo html_writer::end_tag('td'); echo html_writer::end_tag('tr'); // cancel button div only if not in root morsle directory echo html_writer::start_tag('tr'); echo html_writer::tag('td', '', array('colspan' => '2', 'style' => 'background-color:#ffddbb;')); echo html_writer::start_tag('td', array('style' => 'background-color:#ffddbb; padding-left:5px;', 'colspan' => '1', 'align' => 'right')); echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get', 'align' => 'left')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'cancel')); echo html_writer::tag('input', '', array('type' => 'submit', 'value' => $strcancel, 'align' => 'left', 'style' => 'color:red;')); echo html_writer::end_tag('form'); echo html_writer::end_tag('td'); echo html_writer::end_tag('tr'); echo html_writer::end_tag('tr'); echo html_writer::start_tag('tr'); echo html_writer::start_tag('tr') . html_writer::tag('td', '<br>', array('colspace' => '4')) . html_writer::end_tag('tr'); echo html_writer::start_tag('td', array('style' => 'max-width:50px; white-space:nowrap;', 'colspan' => '2', 'align' => 'left')); //dummy form - alignment only echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get')); echo html_writer::start_tag('fieldset', array('class' => 'invisiblefieldset')); echo html_writer::tag('input', '', array('type' => 'button', 'value' => $strselectall, 'onclick' => 'checkall();', 'style' => 'color:green;')); echo html_writer::tag('input', '', array('type' => 'button', 'value' => $strselectnone, 'onclick' => 'checknone();', 'style' => 'color:red;')); echo html_writer::end_tag('fieldset'); echo html_writer::end_tag('form'); echo html_writer::end_tag('td'); echo html_writer::start_tag('td', array('align' => 'center', 'colspan' => '2')); // makedir form // TODO: program to allow this in user and departmental directory if (strpos($wdir, $deptstr) === false && strpos($wdir, $userstr) === false) { // not a user or departmental folder echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'get')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'action', 'value' => 'makedir')); echo html_writer::tag('input', '', array('type' => 'submit', 'value' => $strmakeafolder)); echo html_writer::end_tag('form'); } echo html_writer::end_tag('td'); echo html_writer::end_tag('tr'); } } } echo html_writer::start_tag('form', array('action' => 'morslefiles.php', 'method' => 'post', 'id' => 'dirform')); echo html_writer::start_div(); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::start_tag('tr'); echo html_writer::start_tag('th', array('class' => 'header', 'scope' => 'col', 'style' => 'max-width:40px;')); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'courseid', 'value' => $courseid)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'choose', 'value' => $choose)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'wdir', 'value' => $wdir)); echo html_writer::tag('input', '', array('type' => 'hidden', 'name' => 'sesskey', 'value' => $USER->sesskey)); // $options = array ("delete" => "$strdeletefromcollection"); // only editing teachers can link items to course page if (has_capability('moodle/course:update', $coursecontext)) { $options['link'] = "{$strlinktocourse}"; } if (!empty($filelist) || !empty($dirlist)) { // echo html_writer::tag('label', "$strwithchosenfiles...", array('for'=>'formactionid')); // echo html_writer::select($options, "$strwithchosenfiles...", '', array(1 => "$strwithchosenfiles...")); echo html_writer::start_div('', array('id' => 'noscriptgo', 'style' => 'display:inline;')); echo html_writer::tag('input', '', array('type' => 'submit', 'value' => get_string('go'))); echo html_writer::script('document.getElementById("noscriptgo").style.display="none"'); echo html_writer::end_div(); } echo html_writer::end_tag('th'); echo html_writer::start_tag('th', array('style' => 'padding-right:120px;', 'class' => 'header name', 'scope' => 'col')) . html_writer::link(qualified_me(), $strname, array('&sort' => '{' . $sortvalues[0] . '}')) . html_writer::end_tag('th'); echo html_writer::start_tag('th', array('class' => 'header date', 'scope' => 'col')) . html_writer::link(qualified_me(), $strmodified, array('&sort' => '{' . $sortvalues[2] . '}')) . html_writer::end_tag('th'); echo html_writer::tag('th', $straction, array('class' => 'header commands', 'scope' => 'col')); echo html_writer::end_tag('tr') . "\n"; // Sort parameter indicates column to sort by, and parity gives the direction switch ($sort) { case 1: $sortcmp = 'return strcasecmp($a[0],$b[0]);'; break; case -1: $sortcmp = 'return strcasecmp($b[0],$a[0]);'; break; case 2: $sortcmp = 'return ($a[1] - $b[1]);'; break; case -2: $sortcmp = 'return ($b[1] - $a[1]);'; break; case 3: $sortcmp = 'return ($a[2] - $b[2]);'; break; case -3: $sortcmp = 'return ($b[2] - $a[2]);'; break; } // Create a 2D array of directories and sort $dirdetails = array(); foreach ($dirlist as $name => $dir) { $dirdetails[$name] = new stdClass(); $dirdetails[$name]->updated = docdate($dir); $dirdetails[$name]->link = $dir->alternateLink; // usort($dirdetails, create_function('$a,$b', $sortcmp)); } // TODO: change to handle cross-listed courses // TODO: this needs to change if we eliminate morsle table if ($wdir === '') { $shortname = is_number(substr($course->shortname, 0, 5)) ? substr($course->shortname, 6) : $course->shortname; // SPLIT INTO DEPARTMENTAL CODES $dept = explode("-", $shortname); $deptpart = defined($dept[0]) ? CONSTANT($dept[0]) : null; $deptstr = $deptpart . $deptstr; $deptaccount = strtolower($deptstr); // only show the user collection if we're in the base folder $dirdetails[$userstr] = new stdClass(); $dirdetails[$userstr]->updated = date('Y-m-d'); $dirdetails[$userstr]->link = 'https://drive.google.com'; // always include departmental directory if exists // check to see if we even have a departmental account for this department but don't show the departmental collection if we're already in it indicated by $wdir if ($is_morsle_dept = $DB->get_record('morsle_active', array('shortname' => $deptaccount)) && has_capability('moodle/course:update', $coursecontext)) { $dirdetails[$deptstr] = new stdClass(); $dirdetails[$deptstr]->updated = date('Y-m-d'); } } // Create a 2D array of files and sort $filedetails = array(); $filetitles = array(); foreach ($filelist as $name => $file) { $filedetails[$name] = new stdClass(); $filedetails[$name]->updated = docdate($file); $filedetails[$name]->link = $file->alternateLink; // $row = array($filename, $filedate); // array_push($filedetails, $row); // usort($filedetails, create_function('$a,$b', $sortcmp)); } // TODO: fix this hack so we're back to being able to sort // ksort($filedetails); // sets the locked in sorting to name // need this in order to look up the link for the file based on doc title (key) /* if (sizeof($filelist) > 0) { $filevalues = array_values($filelist); $filelist = array_combine($filetitles, $filevalues); } */ // $count = 0; // $countdir = 0; $edittext = $padchoose . $padedit . $padunzip . $padlist . $padrestore; if ($wdir !== '') { $pathparts = explode('/', $wdir); array_pop($pathparts); $wdir = implode('/', $pathparts); echo "<tr class=\"folder\">"; print_cell(); print_cell('left', '<a href="morslefiles.php?courseid=' . $courseid . '&wdir=' . $wdir . '&choose=' . $choose . '&name=' . $name . '"><img src="' . $OUTPUT->pix_url('f/folder') . '" class="icon" alt="" /> ' . get_string('parentfolder') . '</a>', 'name'); // print_cell('left', '<a style="padding-left:0px" href="morslefiles.php?courseid='.$courseid.'&wdir='.$wdir.'/&choose='.$choose.'"> '.get_string('parentfolder').'</a>', 'parent'); echo "</tr>"; } if (!empty($dirdetails)) { foreach ($dirdetails as $name => $dir) { echo html_writer::start_tag('tr', array('class' => 'folder')); $filedate = $dir->updated; $filesafe = rawurlencode($name); $filename = $name; $fileurl = $dir->link; // $countdir++; // TODO: fix the parent directory if ($name == '..') { // $fileurl = rawurlencode(dirname($wdir)); print_cell(); // alt attribute intentionally empty to prevent repetition in screen reader //CLAMP #289 change padding-left from 10 to 0px //Kevin Wiliarty 2011-03-08 print_cell('left', '<a style="padding-left:0px" href="morslefiles.php?courseid=' . $courseid . '&wdir=' . $wdir . '/' . $fileurl . '&choose=' . $choose . '"><img src="' . $OUTPUT->pix_url('f/parent.gif') . '" class="icon" alt="" /> ' . get_string('parentfolder') . '</a>', 'name'); print_cell(); print_cell(); print_cell(); /* } else if ($name === $userstr) { // if departmental account or user collection // TODO: need to determine what $wdir is if we're coming in from one of the course subcollections // don't know where this fits in $branchdir = strpos($wdir,'read') !== false || strpos($wdir,'write') !== false || $wdir === '' ? $filesafe : "$wdir/$filesafe"; print_cell(); // alt attribute intentionally empty to prevent repetition in screen reader //CLAMP #289 change padding-left from 10 to 0px //Kevin Wiliarty 2011-03-08 print_cell('left', '<a style="padding-left:0px" href="morslefiles.php?courseid=' . $courseid . '&wdir=' . $wdir . '&choose=' . $choose .'&name=' . $name . '"><img src="'.$OUTPUT->pix_url('f/folder').'" class="icon" alt="" /> '. $name .'</a>', 'name'); // print_cell('left', '<a style="padding-left:0px" href="' . $fileurl . '" target="_blank"><img src="'. $OUTPUT->pix_url("f/folder") .'" class="icon" alt="" /> '. $filename .'</a>'); print_cell("right", $filedate, 'date'); // print_cell(); print_cell(); // print_cell(); } else if ($name === $deptstr){ // TODO: need to determine what $wdir is if we're coming in from one of the course subcollections $branchdir = strpos($wdir,'read') !== false || strpos($wdir,'write') !== false || $wdir === '' ? $filesafe : "$wdir/$filesafe"; print_cell("center", "<input type=\"checkbox\" name=\"dir$countdir\" value=\"$filename\" />", 'checkbox'); // alt attribute intentionally empty to prevent repetition in screen reader //CLAMP #289 change padding-left from 10 to 0px //Kevin Wiliarty 2011-03-08 print_cell('left', '<a style="padding-left:0px" href="morslefiles.php?courseid=' . $courseid . '&wdir=' . $branchdir . '&choose=' . $choose . '&name=' . $name . '"><img src="'.$OUTPUT->pix_url('f/folder').'" class="icon" alt="" /> '. $name .'</a>', 'name'); print_cell("right", $filedate, 'date'); // print_cell(); if (has_capability('moodle/course:update', $coursecontext)) { print_cell("left", "$edittext<a href=\"morslefiles.php?courseid=$courseid&wdir=$branchdir&file=$filename&action=link&type=dir&choose=$choose\">$strlinktocourse</a>", 'commands'); } // print_cell(); */ } else { // not a user or departmental folder print_cell(); // print_cell("center", "<input type=\"checkbox\" name=\"$name\" value=\"$filename\" />", 'checkbox'); // print_cell("left", "<a href=\"morslefiles.php?courseid=$courseid&wdir=$wdir/$filesafe&choose=$choose\"><img src=\"$OUTPUT->pix_url('f/folder')\" class=\"icon\" alt=\"$strfolder\" /> ".$filename."</a>", 'name'); $branchdir = "{$wdir}/{$filesafe}"; // $branchdir = strpos($wdir,'read') !== false || strpos($wdir,'write') !== false || $wdir === '' ? $filesafe : "$wdir/$filesafe"; print_cell('left', '<a href="morslefiles.php?courseid=' . $courseid . '&wdir=' . $branchdir . '&choose=' . $choose . '&name=' . $name . '"><img src="' . $OUTPUT->pix_url('f/folder') . '" class="icon" alt="" /> ' . $filename . '</a>', 'name'); print_cell("right", $filedate, 'date'); // print_cell(); if (has_capability('moodle/course:update', $coursecontext)) { print_cell("left", "{$edittext}<a href=\"morslefiles.php?courseid={$courseid}&wdir={$branchdir}&file={$filename}&action=link&type=dir&choose={$choose}\">{$strlinktocourse}</a>", 'commands'); // print_cell("left", "$edittext<a href=\"morslefiles.php?courseid=$courseid&wdir=$wdir&file=$filename&action=link&type=dir&choose=$choose\">$strlinktocourse</a>", 'commands'); } } echo html_writer::end_tag('tr'); } } $iconchoices = array('excel' => 'download/spreadsheets', 'powerpoint' => 'download/presentations', 'word' => 'download/documents', 'pdf' => 'application/pdf'); if (!empty($filedetails)) { foreach ($filedetails as $name => $file) { if (isset($filelist[$name]->exportLinks)) { $links = array(); $links = array_values($filelist[$name]->exportLinks); $exportlink = $links[0]; } else { $exportlink = $filelist[$name]->alternateLink; } // positively identify the correct icon regardless of filename extension $icon = $filelist[$name]->iconLink; $filename = $name; $fileurl = $file->link; $embedlink = $filelist[$name]->embedLink; $embedsafe = rawurlencode($embedlink); $fileurlsafe = rawurlencode($fileurl); $filedate = $file->updated; $fileid = $filelist[$name]->id; $selectfile = trim($fileurl, "/"); // echo html_writer::start_tag('td', array('class'=>'file')); // echo html_writer::end_tag('td'); print_cell("center", "<input type=\"checkbox\" name=\"file\" value=\"{$filename}\" />", 'checkbox'); //CLAMP #289 change padding-left from 10 to 0px //Kevin Wiliarty 2011-03-08 // echo html_writer::start_tag('td', array('align'=>'left','style'=>'white-space:nowrap; padding-left:0px;','class'=>'name')); print_cell('left', '<a href="' . $fileurl . '" class="morslefile" target="_blank"> <img src="' . $icon . '" class="icon" alt="' . $strfile . '" /> ' . $filename . '</a>', 'name'); // $echovar = '<a href="' . $fileurl . '" target="_blank"> // <img src="' . $OUTPUT->pix_url("f/$icon") . '" class="icon" alt="' . $strfile . '" /> ' . htmlspecialchars($filename) . '</a>'; // echo $echovar; //html_writer::link(qualified_me(), $strname, array('&sort'=>'{'.$sortvalues[0].'}')) //$echovar = html_writer::tag('a', $fileurl, array('target'=>'_blank')) . html_writer::img($OUTPUT->pix_url("f/$icon"), $strfile, array('class'=>'icon')) . ' '.htmlspecialchars($filename) . html_writer::end_tag('a'); //echo $echovar; // echo html_writer::end_tag('td'); print_cell("right", $filedate, 'date'); if (has_capability('moodle/course:update', $coursecontext)) { if (strpos($wdir, $gdocsstr) === 1) { print_cell("left", "{$edittext} <a href=\"morslefiles.php?courseid={$courseid}&wdir={$wdir}/{$fileid}&file={$filename}&name={$filename}&filelink={$fileurl}&action=link&type=file&choose={$choose}\">{$strlinktocourse}</a>", 'commands'); } else { print_cell("left", "{$edittext} <a href=\"morslefiles.php?courseid={$courseid}&wdir={$wdir}&file={$filename}&action=link&type=file&choose={$choose}\">{$strlinktocourse}</a>", 'commands'); } // print_cell('left', '  <a title="' . $name . '" href="embeddoc.php?courseid=$courseid&embedlink=' . $embedsafe . '&name=' . $filename . '"> Embed </a>','embed'); } // print_cell('left', '  <a title="' . strip_tags($strdownload) . ': ' . $name . '" href="' .$CFG->wwwroot // . '/blocks/morsle/docs_export.php?exportlink=' . s($exportlink) . '&shortname=' . $course->shortname . '&title=' . $filename . '" target="_blank"> Download </a>','commands'); print_cell(); print_cell('left', '  <a title="' . $name . '" href="' . s($exportlink) . '" target="_blank"> Download </a>', 'commands'); //print_cell('left', '  <a title="' . $name . '" href="embeddoc.php?"' . s($embedlink) . '" target="_blank"> Embed in a Page resource </a>','commands'); echo html_writer::end_tag('tr'); } } echo html_writer::end_div(); echo html_writer::end_tag('form'); echo html_writer::end_tag('table'); }
protected function render_user_menu(custom_menu $menu) { global $CFG, $USER, $DB, $PAGE; //Elegance add $PAGE; $addusermenu = true; $addlangmenu = true; $addmessagemenu = true; //Elegance add Check for messaging start if (!$CFG->messaging) { $addmessagemenu = false; } else { // Check whether or not the "popup" message output is enabled // This is after we check if messaging is enabled to possibly save a DB query $popup = $DB->get_record('message_processors', array('name' => 'popup')); if (!$popup) { $addmessagemenu = false; } } //Elegance add Check for messaging end if (!isloggedin() || isguestuser()) { $addmessagemenu = false; } if ($addmessagemenu) { $messages = $this->get_user_messages(); $messagecount = 0; foreach ($messages as $message) { if (!$message->from) { // Workaround for issue #103. continue; } $messagecount++; } $messagemenutext = $messagecount . ' '; if ($messagecount == 1) { $messagemenutext .= get_string('message', 'message'); } else { $messagemenutext .= get_string('messages', 'message'); } $messagemenu = $menu->add($messagemenutext, new moodle_url('/message/index.php', array('viewing' => 'recentconversations')), get_string('messages', 'message'), 9999); foreach ($messages as $message) { if (!$message->from) { // Workaround for issue #103. continue; } $senderpicture = new user_picture($message->from); $senderpicture->link = false; $senderpicture = $this->render($senderpicture); $messagecontent = $senderpicture; $messagecontent .= html_writer::start_span('msg-body'); $messagecontent .= html_writer::start_span('msg-title'); $messagecontent .= html_writer::span($message->from->firstname . ': ', 'msg-sender'); $messagecontent .= $message->text; $messagecontent .= html_writer::end_span(); $messagecontent .= html_writer::start_span('msg-time'); $messagecontent .= html_writer::tag('i', '', array('class' => 'icon-time')); $messagecontent .= html_writer::span($message->date); $messagecontent .= html_writer::end_span(); $messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id)); $messagemenu->add($messagecontent, $messageurl, $message->text); } } $langs = get_string_manager()->get_list_of_translations(); if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) { $addlangmenu = false; } if ($addlangmenu) { $language = $menu->add(get_string('language'), new moodle_url('#'), get_string('language'), 10000); foreach ($langs as $langtype => $langname) { $language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname); } } if ($addusermenu) { if (isloggedin()) { $usermenu = $menu->add('<i class="fa fa-user"></i>' . fullname($USER), new moodle_url('#'), fullname($USER), 10001); if (!empty($PAGE->theme->settings->enablemy)) { $usermenu->add('<i class="fa fa-briefcase"></i>' . get_string('mydashboard', 'theme_elegance'), new moodle_url('/my', array('id' => $USER->id)), get_string('mydashboard', 'theme_elegance')); } if (!empty($PAGE->theme->settings->enableprofile)) { $usermenu->add('<i class="fa fa-user"></i>' . get_string('viewprofile'), new moodle_url('/user/profile.php', array('id' => $USER->id)), get_string('viewprofile')); } if (!empty($PAGE->theme->settings->enableeditprofile)) { $usermenu->add('<i class="fa fa-cog"></i>' . get_string('editmyprofile'), new moodle_url('/user/edit.php', array('id' => $USER->id)), get_string('editmyprofile')); } if (!empty($PAGE->theme->settings->enableprivatefiles)) { $usermenu->add('<i class="fa fa-file"></i>' . get_string('privatefiles', 'block_private_files'), new moodle_url('/user/files.php', array('id' => $USER->id)), get_string('privatefiles', 'block_private_files')); } if (!empty($PAGE->theme->settings->enablebadges)) { $usermenu->add('<i class="fa fa-certificate"></i>' . get_string('badges'), new moodle_url('/badges/mybadges.php', array('id' => $USER->id)), get_string('badges')); } if (!empty($PAGE->theme->settings->enablecalendar)) { $usermenu->add('<i class="fa fa-calendar"></i>' . get_string('pluginname', 'block_calendar_month'), new moodle_url('/calendar/view.php', array('id' => $USER->id)), get_string('pluginname', 'block_calendar_month')); } // Add custom links to menu $customlinksnum = empty($PAGE->theme->settings->usermenulinks) ? false : $PAGE->theme->settings->usermenulinks; if ($customlinksnum != 0) { foreach (range(1, $customlinksnum) as $customlinksnumber) { $cli = "customlinkicon{$customlinksnumber}"; $cln = "customlinkname{$customlinksnumber}"; $clu = "customlinkurl{$customlinksnumber}"; if (!empty($PAGE->theme->settings->enablecalendar)) { $usermenu->add('<i class="fa fa-' . $PAGE->theme->settings->{$cli} . '"></i>' . $PAGE->theme->settings->{$cln}, new moodle_url($PAGE->theme->settings->{$clu}, array('id' => $USER->id)), $PAGE->theme->settings->{$cln}); } } } $usermenu->add('<i class="fa fa-lock"></i>' . get_string('logout'), new moodle_url('/login/logout.php', array('sesskey' => sesskey(), 'alt' => 'logout')), get_string('logout')); } else { $usermenu = $menu->add('<i class="fa fa-key"></i>' . get_string('login'), new moodle_url('/login/index.php'), get_string('login'), 10001); } } $content = '<ul class="nav navbar-nav navbar-right">'; foreach ($menu->get_children() as $item) { $content .= $this->render_custom_menu_item($item, 1); } return $content . '</ul>'; }
function scorm_format_toc_for_treeview($user, $scorm, $scoes, $usertracks, $cmid, $toclink=TOCJSLINK, $currentorg='', $attempt='', $play=false, $organizationsco=null, $children=false) { global $CFG; $result = new stdClass(); $result->prerequisites = true; $result->incomplete = true; $result->toc = ''; if (!$children) { $attemptsmade = scorm_get_attempt_count($user->id, $scorm); $result->attemptleft = $scorm->maxattempt == 0 ? 1 : $scorm->maxattempt - $attemptsmade; } if (!$children) { $result->toc = html_writer::start_tag('ul'); if (!$play && !empty($organizationsco)) { $result->toc .= html_writer::start_tag('li').$organizationsco->title.html_writer::end_tag('li'); } } $prevsco = ''; if (!empty($scoes)) { foreach ($scoes as $sco) { $result->toc .= html_writer::start_tag('li'); $scoid = $sco->id; $sco->isvisible = true; if ($sco->isvisible) { $score = ''; if (isset($usertracks[$sco->identifier])) { $viewscore = has_capability('mod/scorm:viewscores', context_module::instance($cmid)); if (isset($usertracks[$sco->identifier]->score_raw) && $viewscore) { if ($usertracks[$sco->identifier]->score_raw != '') { $score = '('.get_string('score', 'scorm').': '.$usertracks[$sco->identifier]->score_raw.')'; } } } if (!empty($sco->prereq)) { if ($sco->id == $scoid) { $result->prerequisites = true; } if (!empty($prevsco) && scorm_version_check($scorm->version, SCORM_13) && !empty($prevsco->hidecontinue)) { if ($sco->scormtype == 'sco') { $result->toc .= html_writer::span($sco->statusicon.' '.format_string($sco->title)); } else { $result->toc .= html_writer::span(' '.format_string($sco->title)); } } else if ($toclink == TOCFULLURL) { $url = $CFG->wwwroot.'/mod/scorm/player.php?'.$sco->url; if (!empty($sco->launch)) { if ($sco->scormtype == 'sco') { $result->toc .= $sco->statusicon.' '; $result->toc .= html_writer::link($url, format_string($sco->title)).$score; } else { $result->toc .= ' '.html_writer::link($url, format_string($sco->title), array('data-scoid' => $sco->id)).$score; } } else { if ($sco->scormtype == 'sco') { $result->toc .= $sco->statusicon.' '.format_string($sco->title).$score; } else { $result->toc .= ' '.format_string($sco->title).$score; } } } else { if (!empty($sco->launch)) { if ($sco->scormtype == 'sco') { $result->toc .= html_writer::tag('a', $sco->statusicon.' '. format_string($sco->title).' '.$score, array('data-scoid' => $sco->id, 'title' => $sco->url)); } else { $result->toc .= html_writer::tag('a', ' '.format_string($sco->title).' '.$score, array('data-scoid' => $sco->id, 'title' => $sco->url)); } } else { if ($sco->scormtype == 'sco') { $result->toc .= html_writer::span($sco->statusicon.' '.format_string($sco->title)); } else { $result->toc .= html_writer::span(' '.format_string($sco->title)); } } } } else { if ($play) { if ($sco->scormtype == 'sco') { $result->toc .= html_writer::span($sco->statusicon.' '.format_string($sco->title)); } else { $result->toc .= ' '.format_string($sco->title).html_writer::end_span(); } } else { if ($sco->scormtype == 'sco') { $result->toc .= $sco->statusicon.' '.format_string($sco->title); } else { $result->toc .= ' '.format_string($sco->title); } } } } else { $result->toc .= " ".format_string($sco->title); } if (!empty($sco->children)) { $result->toc .= html_writer::start_tag('ul'); $childresult = scorm_format_toc_for_treeview($user, $scorm, $sco->children, $usertracks, $cmid, $toclink, $currentorg, $attempt, $play, $organizationsco, true); $result->toc .= $childresult->toc; $result->toc .= html_writer::end_tag('ul'); $result->toc .= html_writer::end_tag('li'); } else { $result->toc .= html_writer::end_tag('li'); } $prevsco = $sco; } $result->incomplete = $sco->incomplete; } if (!$children) { $result->toc .= html_writer::end_tag('ul'); } return $result; }
public function render_social_network($socialnetwork) { if (\theme_essential\toolbox::get_setting($socialnetwork)) { $icon = $socialnetwork; if ($socialnetwork === 'googleplus') { $icon = 'google-plus'; } else { if ($socialnetwork === 'website') { $icon = 'globe'; } else { if ($socialnetwork === 'ios') { $icon = 'apple'; } else { if ($socialnetwork === 'winphone') { $icon = 'windows'; } } } } $socialhtml = html_writer::start_tag('li'); $socialhtml .= html_writer::start_tag('button', array('type' => "button", 'class' => 'socialicon ' . $socialnetwork, 'onclick' => "window.open('" . \theme_essential\toolbox::get_setting($socialnetwork) . "')", 'title' => get_string($socialnetwork, 'theme_essential'))); $socialhtml .= html_writer::start_tag('i', array('class' => 'fa fa-' . $icon)); $socialhtml .= html_writer::end_tag('i'); $socialhtml .= html_writer::start_span('sr-only') . html_writer::end_span(); $socialhtml .= html_writer::end_tag('button'); $socialhtml .= html_writer::end_tag('li'); return $socialhtml; } else { return false; } }
/** * Construct contents of course_overview block * * @param array $courses list of courses in sorted order * @param array $overviews list of course overviews * @return string html to be displayed in course_overview block */ public function course_overview($courses, $overviews) { global $DB; $html = ''; $config = get_config('block_course_overview'); if ($config->showcategories != BLOCKS_COURSE_OVERVIEW_SHOWCATEGORIES_NONE) { global $CFG; require_once $CFG->libdir . '/coursecatlib.php'; } /*echo '<pre>'; print_r($courses);*/ $ismovingcourse = false; $courseordernumber = 0; $maxcourses = count($courses); $userediting = false; // Intialise string/icon etc if user is editing and courses > 1 if ($this->page->user_is_editing() && count($courses) > 1) { $userediting = true; $this->page->requires->js_init_call('M.block_course_overview.add_handles'); // Check if course is moving $ismovingcourse = optional_param('movecourse', FALSE, PARAM_BOOL); $movingcourseid = optional_param('courseid', 0, PARAM_INT); } /** * Indexador das categorias dos cursos * @author Cássio Queiroz <Cruzz> * @date 2015/12/26 */ $catids = array(); foreach ($courses as $key => $course) { $value = $DB->get_record_sql('SELECT id,name FROM {course_categories} WHERE id = ? ', array($course->category)); $catids[] = $value->id . '@' . $value->name; } $firstCat = explode("@", $catids[0]); $catids = array_unique($catids); // Render first movehere icon. if ($ismovingcourse) { // Remove movecourse param from url. $this->page->ensure_param_not_in_url('movecourse'); // Show moving course notice, so user knows what is being moved. $html .= $this->output->box_start('notice'); $a = new stdClass(); $a->fullname = $courses[$movingcourseid]->fullname; $a->cancellink = html_writer::link($this->page->url, get_string('cancel')); $html .= get_string('movingcourse', 'block_course_overview', $a); $html .= $this->output->box_end(); $moveurl = new moodle_url('/blocks/course_overview/move.php', array('sesskey' => sesskey(), 'moveto' => 0, 'courseid' => $movingcourseid)); // Create move icon, so it can be used. $movetofirsticon = html_writer::empty_tag('img', array('src' => $this->output->pix_url('movehere'), 'alt' => get_string('movetofirst', 'block_course_overview', $courses[$movingcourseid]->fullname), 'title' => get_string('movehere'))); $moveurl = html_writer::link($moveurl, $movetofirsticon); $html .= html_writer::tag('div', $moveurl, array('class' => 'movehere')); } // @autor Cássio Queiroz <Cruzz> $html .= html_writer::start_tag('div', array('class' => 'cat_navigation')); $html .= html_writer::start_span('top-level') . 'Meus Cursos' . html_writer::end_span(); $html .= html_writer::start_tag('div', array('class' => 'cat_navs')); $piper = ''; foreach ($catids as $cor) { $name = explode('@', $cor); $html .= $piper . html_writer::start_span('allcat category-' . $name[0]) . $name[1] . html_writer::end_span(); $piper = ' | '; } $html .= html_writer::end_tag('div'); // END cat_navs $html .= html_writer::end_tag('div'); // END cat_navigation foreach ($courses as $key => $course) { // If moving course, then don't show course which needs to be moved. if ($ismovingcourse && $course->id == $movingcourseid) { continue; } $html .= html_writer::start_tag('div', array('class' => 'all cat_' . $course->category)); // @autor Cássio Queiroz <Cruzz> $html .= $this->output->box_start('coursebox', "course-{$course->id}"); $html .= html_writer::start_tag('div', array('class' => 'course_title')); // If user is editing, then add move icons. if ($userediting && !$ismovingcourse) { $moveicon = html_writer::empty_tag('img', array('src' => $this->pix_url('t/move')->out(false), 'alt' => get_string('movecourse', 'block_course_overview', $course->fullname), 'title' => get_string('move'))); $moveurl = new moodle_url($this->page->url, array('sesskey' => sesskey(), 'movecourse' => 1, 'courseid' => $course->id)); $moveurl = html_writer::link($moveurl, $moveicon); $html .= html_writer::tag('div', $moveurl, array('class' => 'move')); } // No need to pass title through s() here as it will be done automatically by html_writer. $attributes = array('title' => $course->fullname); if ($course->id > 0) { if (empty($course->visible)) { $attributes['class'] = 'dimmed'; } $courseurl = new moodle_url('/course/view.php', array('id' => $course->id)); $coursefullname = format_string(get_course_display_name_for_list($course), true, $course->id); $link = html_writer::link($courseurl, $coursefullname, $attributes); $html .= $this->output->heading($link, 2, 'title'); } else { $html .= $this->output->heading(html_writer::link(new moodle_url('/auth/mnet/jump.php', array('hostid' => $course->hostid, 'wantsurl' => '/course/view.php?id=' . $course->remoteid)), format_string($course->shortname, true), $attributes) . ' (' . format_string($course->hostname) . ')', 2, 'title'); } $html .= $this->output->box('', 'flush'); $html .= html_writer::end_tag('div'); // hide-div $html .= html_writer::end_tag('div'); if (!empty($config->showchildren) && $course->id > 0) { // List children here. if ($children = block_course_overview_get_child_shortnames($course->id)) { $html .= html_writer::tag('span', $children, array('class' => 'coursechildren')); } } // If user is moving courses, then down't show overview. if (isset($overviews[$course->id]) && !$ismovingcourse) { $html .= $this->activity_display($course->id, $overviews[$course->id]); } if ($config->showcategories != BLOCKS_COURSE_OVERVIEW_SHOWCATEGORIES_NONE) { // List category parent or categories path here. $currentcategory = coursecat::get($course->category, IGNORE_MISSING); if ($currentcategory !== null) { $html .= html_writer::start_tag('div', array('class' => 'categorypath')); if ($config->showcategories == BLOCKS_COURSE_OVERVIEW_SHOWCATEGORIES_FULL_PATH) { foreach ($currentcategory->get_parents() as $categoryid) { $category = coursecat::get($categoryid, IGNORE_MISSING); if ($category !== null) { $html .= $category->get_formatted_name() . ' / '; } } } $html .= $currentcategory->get_formatted_name(); $html .= html_writer::end_tag('div'); } } $html .= $this->output->box('', 'flush'); $html .= $this->output->box_end(); $courseordernumber++; if ($ismovingcourse) { $moveurl = new moodle_url('/blocks/course_overview/move.php', array('sesskey' => sesskey(), 'moveto' => $courseordernumber, 'courseid' => $movingcourseid)); $a = new stdClass(); $a->movingcoursename = $courses[$movingcourseid]->fullname; $a->currentcoursename = $course->fullname; $movehereicon = html_writer::empty_tag('img', array('src' => $this->output->pix_url('movehere'), 'alt' => get_string('moveafterhere', 'block_course_overview', $a), 'title' => get_string('movehere'))); $moveurl = html_writer::link($moveurl, $movehereicon); $html .= html_writer::tag('div', $moveurl, array('class' => 'movehere')); } } /** * Função jquery para mostrar os cursos de acordo com a categoria * @author Cássio Queiroz <Cruzz> * @date 2015/12/26 */ $html .= '<script type="text/javascript"> $(document).ready(function(){ $(".all").hide(); var last = $(".category-' . $firstCat[0] . '"); $(".cat_' . $firstCat[0] . '").fadeIn(); $(".category-' . $firstCat[0] . '").css("color","orange"); $(".allcat").click(function(){ if(typeof last === "undefined"){ last = $(this); } last.css("color","#656565"); last = $(this); $(".all").hide(); $(this).css("color","orange"); var name = $(this).attr("class").split("-"); $(".cat_"+name[1]).fadeIn(); }); }); </script> '; // Wrap course list in a div and return. return html_writer::tag('div', $html, array('class' => 'course_list')); }
protected function render_user_menu(custom_menu $menu) { global $CFG, $USER, $DB; $addusermenu = true; $addlangmenu = true; $addmessagemenu = false; if (!isloggedin() || isguestuser()) { $addmessagemenu = false; } if ($addmessagemenu) { $messages = $this->get_user_messages(); $messagecount = count($messages); $messagemenu = $menu->add($messagecount . ' ' . get_string('messages', 'message'), new moodle_url('/message/index.php', array('viewing' => 'recentconversations')), get_string('messages', 'message'), 9999); foreach ($messages as $message) { if (!$message->from) { // Workaround for issue #103. continue; } $senderpicture = new user_picture($message->from); $senderpicture->link = false; $senderpicture = $this->render($senderpicture); $messagecontent = $senderpicture; $messagecontent .= html_writer::start_span('msg-body'); $messagecontent .= html_writer::start_span('msg-title'); $messagecontent .= html_writer::span($message->from->firstname . ': ', 'msg-sender'); $messagecontent .= $message->text; $messagecontent .= html_writer::end_span(); $messagecontent .= html_writer::start_span('msg-time'); $messagecontent .= html_writer::tag('i', '', array('class' => 'icon-time')); $messagecontent .= html_writer::span($message->date); $messagecontent .= html_writer::end_span(); $messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id)); $messagemenu->add($messagecontent, $messageurl, $message->state); } } $langs = get_string_manager()->get_list_of_translations(); if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) { $addlangmenu = false; } if ($addlangmenu) { $language = $menu->add(get_string('language'), new moodle_url('#'), get_string('language'), 10000); foreach ($langs as $langtype => $langname) { $language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname); } } if ($addusermenu) { if (isloggedin()) { $usermenu = $menu->add(fullname($USER), new moodle_url('#'), fullname($USER), 10001); $usermenu->add('<span class="glyphicon glyphicon-off"></span>' . get_string('logout'), new moodle_url('/login/logout.php', array('sesskey' => sesskey(), 'alt' => 'logout')), get_string('logout')); $usermenu->add('<span class="glyphicon glyphicon-user"></span>' . get_string('viewprofile'), new moodle_url('/user/profile.php', array('id' => $USER->id)), get_string('viewprofile')); $usermenu->add('<span class="glyphicon glyphicon-cog"></span>' . get_string('editmyprofile'), new moodle_url('/user/edit.php', array('id' => $USER->id)), get_string('editmyprofile')); } } $content = '<ul class="nav navbar-nav navbar-right">'; foreach ($menu->get_children() as $item) { $content .= $this->render_custom_menu_item($item, 1); } return $content . '</ul>'; }
$links[] = html_writer::link(new moodle_url('/mod/booking/teachers.php', array('id' => $id, 'optionid' => $optionid)), get_string('teachers', 'booking'), array()); } if (has_capability('mod/booking:subscribeusers', $context)) { $links[] = html_writer::link(new moodle_url('/mod/booking/subscribeusers.php', array('id' => $cm->id, 'optionid' => $optionid)), get_string('bookotherusers', 'booking'), array()); } $links[] = '<a href="#" id="showHideSearch">' . get_string('search') . '</a>'; if (has_capability('mod/booking:communicate', context_module::instance($cm->id))) { $links[] = html_writer::link(new moodle_url('/mod/booking/report.php', array('id' => $cm->id, 'optionid' => $optionid, 'action' => 'sendpollurlteachers')), get_string('booking:sendpollurltoteachers', 'booking'), array()); } echo implode(" | ", $links); if ($bookingData->option->courseid != 0) { echo '<br>' . html_writer::start_span('') . get_string('associatedcourse', 'booking') . ': ' . html_writer::link(new moodle_url($bookingData->option->courseurl, array()), $bookingData->option->urltitle, array()) . html_writer::end_span() . '<br>'; } $onlyOneURL = new moodle_url('/mod/booking/view.php', array('id' => $id, 'optionid' => $optionid, 'action' => 'showonlyone', 'whichview' => 'showonlyone')); $onlyOneURL->set_anchor('goenrol'); echo '<br>' . html_writer::start_span('') . get_string('onlythisbookingurl', 'booking') . ': ' . html_writer::link($onlyOneURL, $onlyOneURL, array()) . html_writer::end_span() . '<br><br>'; $hidden = ""; foreach ($urlParams as $key => $value) { if (!in_array($key, array('searchName', 'searchSurname', 'searchDate', 'searchFinished'))) { $hidden .= '<input value="' . $value . '" type="hidden" name="' . $key . '">'; } } $row = new html_table_row(array(get_string('searchName', "booking"), '<form>' . $hidden . '<input value="' . $urlParams['searchName'] . '" id="searchName" type="text" name="searchName">', "", "")); $tabledata[] = $row; $rowclasses[] = ""; $row = new html_table_row(array(get_string('searchSurname', "booking"), '<input value="' . $urlParams['searchSurname'] . '" id="searchSurname" type="text" name="searchSurname">', "", "")); $tabledata[] = $row; $rowclasses[] = ""; $row = new html_table_row(array(get_string('searchDate', "booking"), html_writer::checkbox('searchDate', '1', $checked, '', array('id' => 'searchDate')) . html_writer::select_time('days', 'searchDateDay', $timestamp, 5) . ' ' . html_writer::select_time('months', 'searchDateMonth', $timestamp, 5) . ' ' . html_writer::select_time('years', 'searchDateYear', $timestamp, 5), "", "")); $tabledata[] = $row; $rowclasses[] = "";
/** * Adds a simple message menu to the page navbar. */ private function message_menu() { global $USER, $PAGE, $CFG; if (!isloggedin() || isguestuser()) { return false; } // Check to see if messaging is enabled. if (!$CFG->messaging) { return false; } // Changed from $OUTPUT -> bsrender because of bug when selecting this theme // for the first time. $bsrender = $PAGE->get_renderer('theme_elegance', 'core'); $menu = new custom_menu(); $messages = $this->get_user_messages(); $messagecount = 0; foreach ($messages as $message) { if (!$message->from) { // Workaround for issue #103. continue; } $messagecount++; } if ($messagecount == 0) { $messagemenutext = ' <i class="glyphicon glyphicon-inbox"></i>'; } else { $messagemenutext = ' <i class="glyphicon glyphicon-envelope"></i>'; } $messagemenu = $menu->add($messagemenutext, new moodle_url('/message/index.php', array('viewing' => 'recentconversations')), get_string('messages', 'message'), 9999); foreach ($messages as $message) { if (!$message->from) { // Workaround for issue #103. continue; } $senderpicture = new user_picture($message->from); $senderpicture->link = false; $senderpicture = $bsrender->render($senderpicture); $messagecontent = $senderpicture; $messagecontent .= html_writer::start_span('msg-body'); $messagecontent .= html_writer::start_span('msg-title'); $messagecontent .= html_writer::span($message->from->firstname . ': ', 'msg-sender'); $messagecontent .= $message->text; $messagecontent .= html_writer::end_span(); $messagecontent .= html_writer::start_span('msg-time'); $messagecontent .= html_writer::tag('i', '', array('class' => 'icon-time')); $messagecontent .= html_writer::span($message->date); $messagecontent .= html_writer::end_span(); $messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id)); $messagemenu->add($messagecontent, $messageurl, $message->text); } $content = ''; foreach ($menu->get_children() as $item) { $content .= $bsrender->render_custom_menu_item($item, 1); } return $content; }
protected function view_edit_items() { global $OUTPUT; echo $OUTPUT->box_start('generalbox boxwidthwide boxaligncenter'); $currindent = 0; $addatend = true; $focusitem = false; $hasauto = false; $thispage = new moodle_url('/mod/checklist/edit.php', array('id' => $this->cm->id, 'sesskey' => sesskey())); if ($this->additemafter) { $thispage->param('additemafter', $this->additemafter); } if ($this->editdates) { $thispage->param('editdates', 'on'); } if ($itemid = optional_param('itemid', null, PARAM_INT)) { $thispage->param('itemid', $itemid); } if ($this->checklist->autoupdate && $this->checklist->autopopulate) { if ($this->checklist->teacheredit == CHECKLIST_MARKING_STUDENT) { echo '<p>' . get_string('autoupdatewarning_student', 'checklist') . '</p>'; } else { if ($this->checklist->teacheredit == CHECKLIST_MARKING_TEACHER) { echo '<p class="checklistwarning">' . get_string('autoupdatewarning_teacher', 'checklist') . '</p>'; } else { echo '<p class="checklistwarning">' . get_string('autoupdatewarning_both', 'checklist') . '</p>'; } } } echo '<ol class="checklist">'; if ($this->items) { $lastitem = count($this->items); $lastindent = 0; echo html_writer::start_tag('form', array('action' => $thispage->out_omit_querystring(), 'method' => 'post')); echo html_writer::input_hidden_params($thispage); if ($this->checklist->autopopulate) { echo html_writer::empty_tag('input', array('type' => 'submit', 'name' => 'showhideitems', 'value' => get_string('showhidechecked', 'checklist'))); } foreach ($this->items as $item) { while ($item->indent > $currindent) { $currindent++; echo '<ol class="checklist">'; } while ($item->indent < $currindent) { $currindent--; echo '</ol>'; } $itemname = '"item' . $item->id . '"'; $thispage->param('itemid', $item->id); switch ($item->colour) { case 'red': $itemcolour = 'itemred'; $nexticon = 'colour_orange'; break; case 'orange': $itemcolour = 'itemorange'; $nexticon = 'colour_green'; break; case 'green': $itemcolour = 'itemgreen'; $nexticon = 'colour_purple'; break; case 'purple': $itemcolour = 'itempurple'; $nexticon = 'colour_black'; break; default: $itemcolour = 'itemblack'; $nexticon = 'colour_red'; } $autoitem = $this->checklist->autopopulate && $item->moduleid != 0; if ($autoitem) { $autoclass = ' itemauto'; } else { $autoclass = ''; } $hasauto = $hasauto || $item->moduleid != 0; echo '<li>'; echo html_writer::start_span('', array('style' => 'display: inline-block; width: 16px;')); if ($autoitem && $item->hidden != CHECKLIST_HIDDEN_BYMODULE) { echo html_writer::checkbox('items[' . $item->id . ']', $item->id, false, '', array('title' => $item->displaytext)); } echo html_writer::end_span(); if ($item->itemoptional == CHECKLIST_OPTIONAL_YES) { $title = '"' . get_string('optionalitem', 'checklist') . '"'; echo '<a href="' . $thispage->out(true, array('action' => 'makeheading')) . '">'; echo '<img src="' . $OUTPUT->pix_url('empty_box', 'checklist') . '" alt=' . $title . ' title=' . $title . ' /></a> '; $optional = ' class="itemoptional ' . $itemcolour . $autoclass . '" '; } else { if ($item->itemoptional == CHECKLIST_OPTIONAL_HEADING) { if ($item->hidden) { $title = '"' . get_string('headingitem', 'checklist') . '"'; echo '<img src="' . $OUTPUT->pix_url('no_box', 'checklist') . '" alt=' . $title . ' title=' . $title . ' /> '; $optional = ' class="' . $itemcolour . $autoclass . ' itemdisabled"'; } else { $title = '"' . get_string('headingitem', 'checklist') . '"'; if (!$autoitem) { echo '<a href="' . $thispage->out(true, array('action' => 'makerequired')) . '">'; } echo '<img src="' . $OUTPUT->pix_url('no_box', 'checklist') . '" alt=' . $title . ' title=' . $title . ' />'; if (!$autoitem) { echo '</a>'; } echo ' '; $optional = ' class="itemheading ' . $itemcolour . $autoclass . '" '; } } else { if ($item->hidden) { $title = '"' . get_string('requireditem', 'checklist') . '"'; echo '<img src="' . $OUTPUT->pix_url('tick_box', 'checklist') . '" alt=' . $title . ' title=' . $title . ' /> '; $optional = ' class="' . $itemcolour . $autoclass . ' itemdisabled"'; } else { $title = '"' . get_string('requireditem', 'checklist') . '"'; echo '<a href="' . $thispage->out(true, array('action' => 'makeoptional')) . '">'; echo '<img src="' . $OUTPUT->pix_url('tick_box', 'checklist') . '" alt=' . $title . ' title=' . $title . ' /></a> '; $optional = ' class="' . $itemcolour . $autoclass . '"'; } } } if (isset($item->editme)) { echo '<input type="text" size="' . CHECKLIST_TEXT_INPUT_WIDTH . '" name="displaytext" value="' . s($item->displaytext) . '" id="updateitembox" />'; if ($this->editdates) { $this->print_edit_date($item->duetime); } echo '<input type="submit" name="updateitem" value="' . get_string('updateitem', 'checklist') . '" />'; $focusitem = 'updateitembox'; echo '<input type="submit" name="canceledititem" value="' . get_string('canceledititem', 'checklist') . '" />'; $addatend = false; } else { echo '<label for=' . $itemname . $optional . '>' . format_string($item->displaytext) . '</label> '; echo '<a href="' . $thispage->out(true, array('action' => 'nextcolour')) . '">'; $title = '"' . get_string('changetextcolour', 'checklist') . '"'; echo '<img src="' . $OUTPUT->pix_url($nexticon, 'checklist') . '" alt=' . $title . ' title=' . $title . ' /></a>'; if (!$autoitem) { echo '<a href="' . $thispage->out(true, array('action' => 'edititem')) . '">'; $title = '"' . get_string('edititem', 'checklist') . '"'; echo '<img src="' . $OUTPUT->pix_url('/t/edit') . '" alt=' . $title . ' title=' . $title . ' /></a> '; } if (!$autoitem && $item->indent > 0) { echo '<a href="' . $thispage->out(true, array('action' => 'unindentitem')) . '">'; $title = '"' . get_string('unindentitem', 'checklist') . '"'; echo '<img src="' . $OUTPUT->pix_url('/t/left') . '" alt=' . $title . ' title=' . $title . ' /></a>'; } if (!$autoitem && $item->indent < CHECKLIST_MAX_INDENT && $lastindent + 1 > $currindent) { echo '<a href="' . $thispage->out(true, array('action' => 'indentitem')) . '">'; $title = '"' . get_string('indentitem', 'checklist') . '"'; echo '<img src="' . $OUTPUT->pix_url('/t/right') . '" alt=' . $title . ' title=' . $title . ' /></a>'; } echo ' '; // TODO more complex checks to take into account indentation. if (!$autoitem && $item->position > 1) { echo '<a href="' . $thispage->out(true, array('action' => 'moveitemup')) . '">'; $title = '"' . get_string('moveitemup', 'checklist') . '"'; echo '<img src="' . $OUTPUT->pix_url('/t/up') . '" alt=' . $title . ' title=' . $title . ' /></a>'; } if (!$autoitem && $item->position < $lastitem) { echo '<a href="' . $thispage->out(true, array('action' => 'moveitemdown')) . '">'; $title = '"' . get_string('moveitemdown', 'checklist') . '"'; echo '<img src="' . $OUTPUT->pix_url('/t/down') . '" alt=' . $title . ' title=' . $title . ' /></a>'; } if ($autoitem) { if ($item->hidden != CHECKLIST_HIDDEN_BYMODULE) { echo ' <a href="' . $thispage->out(true, array('action' => 'deleteitem')) . '">'; if ($item->hidden == CHECKLIST_HIDDEN_MANUAL) { $title = '"' . get_string('show') . '"'; echo '<img src="' . $OUTPUT->pix_url('/t/show') . '" alt=' . $title . ' title=' . $title . ' /></a>'; } else { $title = '"' . get_string('hide') . '"'; echo '<img src="' . $OUTPUT->pix_url('/t/hide') . '" alt=' . $title . ' title=' . $title . ' /></a>'; } } } else { echo ' <a href="' . $thispage->out(true, array('action' => 'deleteitem')) . '">'; $title = '"' . get_string('deleteitem', 'checklist') . '"'; echo '<img src="' . $OUTPUT->pix_url('/t/delete') . '" alt=' . $title . ' title=' . $title . ' /></a>'; } echo ' <a href="' . $thispage->out(true, array('action' => 'startadditem')) . '">'; $title = '"' . get_string('additemhere', 'checklist') . '"'; echo '<img src="' . $OUTPUT->pix_url('add', 'checklist') . '" alt=' . $title . ' title=' . $title . ' /></a>'; if ($item->duetime) { if ($item->duetime > time()) { echo '<span class="checklist-itemdue"> ' . userdate($item->duetime, get_string('strftimedate')) . '</span>'; } else { echo '<span class="checklist-itemoverdue"> ' . userdate($item->duetime, get_string('strftimedate')) . '</span>'; } } } $thispage->remove_params(array('itemid')); if ($this->additemafter == $item->id) { $addatend = false; echo '<li>'; echo '<input type="hidden" name="position" value="' . ($item->position + 1) . '" />'; echo '<input type="hidden" name="indent" value="' . $item->indent . '" />'; echo '<img src="' . $OUTPUT->pix_url('tick_box', 'checklist') . '" /> '; echo '<input type="text" size="' . CHECKLIST_TEXT_INPUT_WIDTH . '" name="displaytext" value="" id="additembox" />'; if ($this->editdates) { $this->print_edit_date(); } echo '<input type="submit" name="additem" value="' . get_string('additem', 'checklist') . '" />'; echo '<input type="submit" name="canceledititem" value="' . get_string('canceledititem', 'checklist') . '" />'; echo '</li>'; if (!$focusitem) { $focusitem = 'additembox'; } } $lastindent = $currindent; echo '</li>'; } echo html_writer::end_tag('form'); } $thispage->remove_params(array('itemid')); if ($addatend) { echo '<li>'; echo '<form action="' . $thispage->out_omit_querystring() . '" method="post">'; echo html_writer::input_hidden_params($thispage); echo '<input type="hidden" name="action" value="additem" />'; echo '<input type="hidden" name="indent" value="' . $currindent . '" />'; echo '<input type="text" size="' . CHECKLIST_TEXT_INPUT_WIDTH . '" name="displaytext" value="" id="additembox" />'; if ($this->editdates) { $this->print_edit_date(); } echo '<input type="submit" name="additem" value="' . get_string('additem', 'checklist') . '" />'; echo '</form>'; echo '</li>'; if (!$focusitem) { $focusitem = 'additembox'; } } echo '</ol>'; while ($currindent) { $currindent--; echo '</ol>'; } echo '<form action="' . $thispage->out_omit_querystring() . '" method="get">'; echo html_writer::input_hidden_params($thispage, array('sesskey', 'editdates')); if (!$this->editdates) { echo '<input type="hidden" name="editdates" value="on" />'; echo '<input type="submit" value="' . get_string('editdatesstart', 'checklist') . '" />'; } else { echo '<input type="submit" value="' . get_string('editdatesstop', 'checklist') . '" />'; } if (!$this->checklist->autopopulate && $hasauto) { echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />'; echo '<input type="submit" value="' . get_string('removeauto', 'checklist') . '" name="removeauto" />'; } echo '</form>'; if ($focusitem) { echo '<script type="text/javascript">document.getElementById("' . $focusitem . '").focus();</script>'; } echo $OUTPUT->box_end(); }
protected function render_user_menu(custom_menu $menu) { global $CFG, $USER, $DB, $PAGE; $addusermenu = true; $addlangmenu = true; $addmessagemenu = true; if (!isloggedin() || isguestuser()) { $addmessagemenu = false; } if ($addmessagemenu) { $messages = $this->get_user_messages(); $messagecount = count($messages); $messagemenu = $menu->add('<i class="fa fa-envelope-o"></i>' . html_writer::tag('ot', $messagecount), new moodle_url('#'), get_string('messages', 'message'), 9999); foreach ($messages as $message) { if (!$message->from) { continue; } $senderpicture = new user_picture($message->from); $senderpicture->link = false; $senderpicture = $this->render($senderpicture); $messagecontent = $senderpicture; $messagecontent .= html_writer::start_span('msg-body'); $messagecontent .= html_writer::start_span('msg-title'); $messagecontent .= html_writer::span($message->from->firstname . ': ', 'msg-sender'); $messagecontent .= $message->text; $messagecontent .= html_writer::end_span(); $messagecontent .= html_writer::start_span('msg-time'); $messagecontent .= html_writer::tag('i', '', array('class' => 'icon-time')); $messagecontent .= html_writer::span($message->date); $messagecontent .= html_writer::end_span(); $messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id)); $messagemenu->add($messagecontent, $messageurl, $message->state); } } $langs = get_string_manager()->get_list_of_translations(); if (count($langs) < 2 or empty($CFG->langmenu) or $this->page->course != SITEID and !empty($this->page->course->lang)) { $addlangmenu = false; } if ($addlangmenu) { $language = $menu->add(get_string('language'), new moodle_url('#'), get_string('language'), 10000); foreach ($langs as $langtype => $langname) { $language->add($langname, new moodle_url($this->page->url, array('lang' => $langtype)), $langname); } } if ($addusermenu) { if (isloggedin() && !isguestuser()) { $usermenu = $menu->add('<img class="profilepic" src="' . $CFG->wwwroot . '/user/pix.php?file=/' . $USER->id . '/f1.jpg" width="80" height="80" title="' . $USER->firstname . ' ' . $USER->lastname . '" alt="' . $USER->firstname . ' ' . $USER->lastname . '" />' . fullname($USER), new moodle_url('#'), fullname($USER), 10001); if (!empty($PAGE->theme->settings->enablemy)) { $usermenu->add('<i class="fa fa-file"></i>' . get_string('enablemy', 'theme_keats'), new moodle_url('/my', array('id' => $USER->id)), get_string('enablemy', 'theme_keats')); } if (!empty($PAGE->theme->settings->enableprofile)) { $usermenu->add('<i class="fa fa-user"></i>' . get_string('viewprofile'), new moodle_url('/user/profile.php', array('id' => $USER->id)), get_string('viewprofile')); } if (!empty($PAGE->theme->settings->enableeditprofile)) { $usermenu->add('<i class="fa fa-cog"></i>' . get_string('editmyprofile'), new moodle_url('/user/edit.php', array('id' => $USER->id)), get_string('editmyprofile')); } if (!empty($PAGE->theme->settings->enablemessages)) { $usermenu->add('<i class="fa fa-comments"></i>' . get_string('enablemessages', 'theme_keats'), new moodle_url('/message/index.php', array()), get_string('enablemessages', 'theme_keats')); } if (!empty($PAGE->theme->settings->enableprivatefiles)) { $usermenu->add('<i class="fa fa-file"></i>' . get_string('privatefiles', 'block_private_files'), new moodle_url('/user/files.php', array('id' => $USER->id)), get_string('privatefiles', 'block_private_files')); } if (!empty($PAGE->theme->settings->enablebadges)) { $usermenu->add('<i class="fa fa-certificate"></i>' . get_string('badges'), new moodle_url('/badges/mybadges.php', array('id' => $USER->id)), get_string('badges')); } if (!empty($PAGE->theme->settings->enablecalendar)) { $usermenu->add('<i class="fa fa-calendar"></i>' . get_string('pluginname', 'block_calendar_month'), new moodle_url('/calendar/view.php', array('id' => $USER->id)), get_string('pluginname', 'block_calendar_month')); } // Add custom links to menu $customlinksnum = empty($PAGE->theme->settings->usermenulinks) ? false : $PAGE->theme->settings->usermenulinks; if ($customlinksnum != 0) { foreach (range(1, $customlinksnum) as $customlinksnumber) { $cli = "customlinkicon{$customlinksnumber}"; $cln = "customlinkname{$customlinksnumber}"; $clu = "customlinkurl{$customlinksnumber}"; if (!empty($PAGE->theme->settings->enablecalendar)) { $usermenu->add('<i class="fa fa-' . $PAGE->theme->settings->{$cli} . '"></i>' . $PAGE->theme->settings->{$cln}, new moodle_url($PAGE->theme->settings->{$clu}, array('id' => $USER->id)), $PAGE->theme->settings->{$cln}); } } } $usermenu->add('<i class="fa fa-lock"></i>' . get_string('logout'), new moodle_url('/login/logout.php', array('sesskey' => sesskey(), 'loginpage' => '1')), get_string('logout')); } else { echo '<a href="' . $CFG->wwwroot . '/login/index.php">' . get_string('login') . '</a>'; } } $content = '<ul class="nav navbar-nav navbar-right">'; foreach ($menu->get_children() as $item) { $content .= $this->render_custom_menu_item($item, 1); } return $content . '</ul>'; }
private function message_menu() { global $OUTPUT, $USER; $menu = new custom_menu(); $messages = $this->get_user_messages(); $messagecount = 0; foreach ($messages as $message) { if (!$message->from) { // Workaround for issue #103. continue; } $messagecount++; } if ($messagecount == 0) { $messagemenutext = ' <i class="glyphicon glyphicon-inbox"></i>'; } else { $messagemenutext = ' <i class="glyphicon glyphicon-envelope"></i>'; } $messagemenu = $menu->add($messagemenutext, new moodle_url('/message/index.php', array('viewing' => 'recentconversations')), get_string('messages', 'message'), 9999); foreach ($messages as $message) { if (!$message->from) { // Workaround for issue #103. continue; } $senderpicture = new user_picture($message->from); $senderpicture->link = false; $senderpicture = $OUTPUT->render($senderpicture); $messagecontent = $senderpicture; $messagecontent .= html_writer::start_span('msg-body'); $messagecontent .= html_writer::start_span('msg-title'); $messagecontent .= html_writer::span($message->from->firstname . ': ', 'msg-sender'); $messagecontent .= $message->text; $messagecontent .= html_writer::end_span(); $messagecontent .= html_writer::start_span('msg-time'); $messagecontent .= html_writer::tag('i', '', array('class' => 'icon-time')); $messagecontent .= html_writer::span($message->date); $messagecontent .= html_writer::end_span(); $messageurl = new moodle_url('/message/index.php', array('user1' => $USER->id, 'user2' => $message->from->id)); $messagemenu->add($messagecontent, $messageurl, $message->text); } $content = ''; foreach ($menu->get_children() as $item) { $content .= $OUTPUT->render_custom_menu_item($item, 1); } return $content; }
/** * This function is used to generate and display selector form * * @param report_log_renderable $reportlog log report. */ public function report_selector_form(report_log_renderable $reportlog) { echo html_writer::start_tag('form', array('class' => 'logselecform', 'action' => $reportlog->url, 'method' => 'get')); echo html_writer::start_div(); echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'chooselog', 'value' => '1')); echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'showusers', 'value' => $reportlog->showusers)); echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'showcourses', 'value' => $reportlog->showcourses)); $selectedcourseid = empty($reportlog->course) ? 0 : $reportlog->course->id; // Add course selector. $sitecontext = context_system::instance(); $courses = $reportlog->get_course_list(); if (!empty($courses) && $reportlog->showcourses) { echo html_writer::label(get_string('selectacourse'), 'menuid', false, array('class' => 'accesshide')); echo html_writer::select($courses, "id", $selectedcourseid, null); } else { $courses = array(); $courses[$selectedcourseid] = get_course_display_name_for_list($reportlog->course) . (($selectedcourseid == SITEID) ? ' (' . get_string('site') . ') ' : ''); echo html_writer::label(get_string('selectacourse'), 'menuid', false, array('class' => 'accesshide')); echo html_writer::select($courses, "id", $selectedcourseid, false); // Check if user is admin and this came because of limitation on number of courses to show in dropdown. if (has_capability('report/log:view', $sitecontext)) { $a = new stdClass(); $a->url = new moodle_url('/report/log/index.php', array('chooselog' => 0, 'group' => $reportlog->get_selected_group(), 'user' => $reportlog->userid, 'id' => $selectedcourseid, 'date' => $reportlog->date, 'modid' => $reportlog->modid, 'showcourses' => 1, 'showusers' => $reportlog->showusers)); $a->url = $a->url->out(false); print_string('logtoomanycourses', 'moodle', $a); } } // Add group selector. $groups = $reportlog->get_group_list(); if (!empty($groups)) { echo html_writer::label(get_string('selectagroup'), 'menugroup', false, array('class' => 'accesshide')); echo html_writer::select($groups, "group", $reportlog->groupid, get_string("allgroups")); } // Add user selector. $users = $reportlog->get_user_list(); if ($reportlog->showusers) { echo html_writer::label(get_string('selctauser'), 'menuuser', false, array('class' => 'accesshide')); echo html_writer::select($users, "user", $reportlog->userid, get_string("allparticipants")); } else { $users = array(); if (!empty($reportlog->userid)) { $users[$reportlog->userid] = $reportlog->get_selected_user_fullname(); } else { $users[0] = get_string('allparticipants'); } echo html_writer::label(get_string('selctauser'), 'menuuser', false, array('class' => 'accesshide')); echo html_writer::select($users, "user", $reportlog->userid, false); $a = new stdClass(); $a->url = new moodle_url('/report/log/index.php', array('chooselog' => 0, 'group' => $reportlog->get_selected_group(), 'user' => $reportlog->userid, 'id' => $selectedcourseid, 'date' => $reportlog->date, 'modid' => $reportlog->modid, 'showusers' => 1, 'showcourses' => $reportlog->showcourses)); $a->url = $a->url->out(false); echo html_writer::start_span('m-x-1'); print_string('logtoomanyusers', 'moodle', $a); echo html_writer::end_span(); } // Add date selector. $dates = $reportlog->get_date_options(); echo html_writer::label(get_string('date'), 'menudate', false, array('class' => 'accesshide')); echo html_writer::select($dates, "date", $reportlog->date, get_string("alldays")); // Add activity selector. $activities = $reportlog->get_activities_list(); echo html_writer::label(get_string('activities'), 'menumodid', false, array('class' => 'accesshide')); echo html_writer::select($activities, "modid", $reportlog->modid, get_string("allactivities")); // Add actions selector. echo html_writer::label(get_string('actions'), 'menumodaction', false, array('class' => 'accesshide')); echo html_writer::select($reportlog->get_actions(), 'modaction', $reportlog->action, get_string("allactions")); // Add origin. $origin = $reportlog->get_origin_options(); echo html_writer::label(get_string('origin', 'report_log'), 'menuorigin', false, array('class' => 'accesshide')); echo html_writer::select($origin, 'origin', $reportlog->origin, false); // Add edulevel. $edulevel = $reportlog->get_edulevel_options(); echo html_writer::label(get_string('edulevel'), 'menuedulevel', false, array('class' => 'accesshide')); echo html_writer::select($edulevel, 'edulevel', $reportlog->edulevel, false).$this->help_icon('edulevel'); // Add reader option. // If there is some reader available then only show submit button. $readers = $reportlog->get_readers(true); if (!empty($readers)) { if (count($readers) == 1) { $attributes = array('type' => 'hidden', 'name' => 'logreader', 'value' => key($readers)); echo html_writer::empty_tag('input', $attributes); } else { echo html_writer::label(get_string('selectlogreader', 'report_log'), 'menureader', false, array('class' => 'accesshide')); echo html_writer::select($readers, 'logreader', $reportlog->selectedlogreader, false); } echo html_writer::empty_tag('input', array('type' => 'submit', 'value' => get_string('gettheselogs'), 'class' => 'btn btn-secondary')); } echo html_writer::end_div(); echo html_writer::end_tag('form'); }
if (has_capability('mod/booking:communicate', context_module::instance($cm->id))) { echo '<input type="submit" name="sendpollurl" value="' . get_string('booking:sendpollurl', 'booking') . '" />'; echo '<input type="submit" name="sendcustommessage" value="' . get_string('sendcustommessage', 'booking') . '" />'; } if (booking_check_if_teacher($bookingData->option, $USER) || has_capability('mod/booking:updatebooking', context_module::instance($cm->id))) { echo '<input type="submit" name="activitycompletion" value="' . (empty($bookingData->booking->btncacname) ? get_string('confirmactivitycompletion', 'booking') : $bookingData->booking->btncacname) . '" />'; if ($bookingData->option->conectedoption > 0) { echo '<input type="submit" name="booktootherbooking" value="' . get_string('booktootherbooking', 'booking') . '" />'; } } echo '</div>'; echo '</form>'; $onlyOneURL = new moodle_url('/mod/booking/view.php', array('id' => $id, 'optionid' => $optionid, 'action' => 'showonlyone', 'whichview' => 'showonlyone')); $onlyOneURL->set_anchor('goenrol'); echo '<br>' . html_writer::start_span('') . get_string('onlythisbookingurl', 'booking') . ': ' . html_writer::link($onlyOneURL, $onlyOneURL, array()) . html_writer::end_span(); echo '<br>' . html_writer::start_span('') . get_string('pollurl', 'booking') . ': ' . html_writer::link($bookingData->option->pollurl, $bookingData->option->pollurl, array()) . ($bookingData->option->pollsend ? ' ✓' : '') . html_writer::end_span(); $PAGE->requires->js_init_call('M.mod_booking.init'); echo $OUTPUT->footer(); } else { if ($download == "ods" or $download == "xls" && has_capability('mod/booking:downloadresponses', $context)) { if ($action == "all") { $filename = clean_filename("{$course->shortname} " . strip_tags(format_string($bookingData->booking->name, true))); } else { $optionname = $bookingData->option->text; $filename = clean_filename(strip_tags(format_string($optionname, true))); } if ($download == "ods") { require_once "{$CFG->libdir}/odslib.class.php"; $workbook = new MoodleODSWorkbook("-"); $filename .= '.ods'; } else {