Return a little form for the user to request to download the full report, including quiz stats and response analysis for
all questions and sub-questions.

@param moodle_url $reporturl the base URL of the report.
@return string HTML.
188504
protected function everything_download_options(moodle_url $reporturl) {
        global $OUTPUT;
        return $OUTPUT->download_dataformat_selector(get_string('downloadeverything', 'quiz_statistics'),
            $reporturl->out_omit_querystring(), 'download', $reporturl->params() + array('everything' => 1));
    }
1276243
public function getReportView($reportUri, $format = 'html') {
        if ($this->isConnected()) {
            //Create an event with default params and pass it to the event listener to process
            $reportViewerEvent = new ReportViewerRequestEvent($format, 1);
            $this->eventDispatcher->dispatch('Mesd.jasperreport.report_viewer_request', $reportViewerEvent);
            if ($reportViewerEvent->isPropagationStopped()) {
                if ($reportViewerEvent->isAsset()) {
                    return $this->getReportAsset($reportViewerEvent->getAssetUri(), $reportViewerEvent->getJSessionId());
                } else {
                    $params = '&page=' . $reportViewerEvent->getReportPage();
                    $format = $reportViewerEvent->getReportFormat();
                }
            } else {
                $params = '&page=1';
            }

            //Create new report object
            $report = new Report($reportUri, $format);

            //Create the builder
            $reportBuilder = new ReportBuilder(
                $this->jasperClient
                , $report
                , $params
                , $this->router->getMatcher()->getContext()->getBaseUrl() . $this->router->getMatcher()->getContext()->getPathInfo() . '?asset=true'
                , 'Fallback'
           );

            return $reportBuilder;
        } else {
            return false;
        }
    }
658743
function ParseUrl($url) {
	    $content = null;

    	$this->Clear();

		$this->url = htmlspecialchars_decode($url);

	    ob_start();
	    if (function_exists('curl_init')) {
		    //curl is the preferred function
		    $crl = curl_init();
		    curl_setopt($crl, CURLOPT_URL, $url);
		    curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
		    curl_setopt($crl, CURLOPT_CONNECTTIMEOUT, 5);
		    curl_setopt($crl, CURLOPT_TIMEOUT, 20);
		    $FileData = curl_exec($crl);
		    $FileInfo = curl_getinfo($crl);
		    curl_close($crl);
		    if ($FileInfo['http_code'] != 200) {
			    throw new \HttpRequestException($FileInfo['http_code'] . ' error for file: ' . $url);
		    }
	    } else {
		    //see if we can use fopen to get file
		    $fopen_check = ini_get('allow_url_fopen');
		    if (!empty($fopen_check)) {
			    $content = file_get_contents($url);
		    } else {
			    throw new \RuntimeException('CURL_DISABLED');
		    }
	    }
	    ob_end_clean();

		if(strlen($content)) {
			$this->modifyContent($content);
			$this->ParseStr($content);
			return true;
		} else {
			return false;
		}
	}
685192
public function fetchContent($url)
    {
        $this->logger->info('Graby is ready to fetch');

        $infos = $this->doFetchContent($url);

        // generate summary
        $infos['summary'] = $this->getExcerpt($infos['html']);

        return $infos;
    }
1208137
function get_content() {

        global $CFG;

        // First check if we have already generated, don't waste cycles
        if ($this->contentgenerated === true) {
            return $this->content;
        }
        $this->content = new stdClass();

        if (get_user_preferences('admin_bookmarks')) {
            require_once($CFG->libdir.'/adminlib.php');
            $adminroot = admin_get_root(false, false);  // settings not required - only pages

            $bookmarks = explode(',', get_user_preferences('admin_bookmarks'));
            /// Accessibility: markup as a list.
            $contents = array();
            foreach($bookmarks as $bookmark) {
                $temp = $adminroot->locate($bookmark);
                if ($temp instanceof admin_settingpage) {
                    $contenturl = new moodle_url('/admin/settings.php', array('section'=>$bookmark));
                    $contentlink = html_writer::link($contenturl, $temp->visiblename);
                    $contents[] = html_writer::tag('li', $contentlink);
                } else if ($temp instanceof admin_externalpage) {
                    $contenturl = new moodle_url($temp->url);
                    $contentlink = html_writer::link($contenturl, $temp->visiblename);
                    $contents[] = html_writer::tag('li', $contentlink);
                } else if ($temp instanceof admin_category) {
                    $contenturl = new moodle_url('/admin/category.php', array('category' => $bookmark));
                    $contentlink = html_writer::link($contenturl, $temp->visiblename);
                    $contents[] = html_writer::tag('li', $contentlink);
                }
            }
            $this->content->text = html_writer::tag('ol', implode('', $contents), array('class' => 'list'));
        } else {
            $bookmarks = array();
        }

        $this->content->footer = '';
        $this->page->settingsnav->initialise();
        $node = $this->page->settingsnav->get('root', navigation_node::TYPE_SITE_ADMIN);
        if (!$node || !$node->contains_active_node()) {
            return $this->content;
        }
        $section = $node->find_active_node()->key;

        if ($section == 'search' || empty($section)){
            // the search page can't be properly bookmarked at present
            $this->content->footer = '';
        } else if (in_array($section, $bookmarks)) {
            $deleteurl = new moodle_url('/blocks/admin_bookmarks/delete.php', array('section'=>$section, 'sesskey'=>sesskey()));
            $this->content->footer =  html_writer::link($deleteurl, get_string('unbookmarkthispage','admin'));
        } else {
            $createurl = new moodle_url('/blocks/admin_bookmarks/create.php', array('section'=>$section, 'sesskey'=>sesskey()));
            $this->content->footer = html_writer::link($createurl, get_string('bookmarkthispage','admin'));
        }

        return $this->content;
    }
467711
public function get_url() {
        $urlparams = [];
        if ($policyid = $this->get_policy_id_filter()) {
            $urlparams['policyid'] = $policyid;
        }
        if ($versionid = $this->get_version_id_filter()) {
            $urlparams['versionid'] = $versionid;
        }
        $i = 0;
        foreach ($this->filtersapplied as $filter) {
            if ($filter[0] != self::FILTER_POLICYID && $filter[0] != self::FILTER_VERSIONID) {
                if ($filter[0] == self::FILTER_SEARCH_STRING) {
                    $urlparams['unified-filters['.($i++).']'] = $filter[1];
                } else {
                    $urlparams['unified-filters['.($i++).']'] = join(':', $filter);
                }
            }
        }
        return new \moodle_url('/admin/tool/policy/acceptances.php', $urlparams);
    }
1100805
protected function magic_get_url() {
        global $FULLME;
        if (is_null($this->_url)) {
            debugging('This page did not call $PAGE->set_url(...). Using '.s($FULLME), DEBUG_DEVELOPER);
            $this->_url = new moodle_url($FULLME);
            // Make sure the guessed URL cannot lead to dangerous redirects.
            $this->_url->remove_params('sesskey');
        }
        return new moodle_url($this->_url); // Return a clone for safety.
    }
615153
public function continue_button($url) {
        if (!($url instanceof moodle_url)) {
            $url = new moodle_url($url);
        }
        $button = new single_button($url, get_string('continue'), 'get', true);
        $button->class = 'continuebutton';

        return $this->render($button);
    }
1052707
public static function GetRemoteXMLDocument($url)
	{
		// THIS FUNCTION IS A CRAP!!!!
		// I NEED REFACTORY THIS!
		$handle = FileUtil::OpenRemoteDocument($url);
		$xmlString = FileUtil::ReadRemoteDocument($handle);

		$search = array ("'&(quot|#34);'i",                 // Replace HTML entities
		                 "'&(amp|#38);'i",
		                 //"'&(lt|#60);'i",
		                 //"'&(gt|#62);'i",
		                 "'&(nbsp|#160);'i",
		                 "'&(iexcl|#161);'i",
		                 "'&(cent|#162);'i",
		                 "'&(pound|#163);'i",
		                 "'&(copy|#169);'i",
		                 "'&aacute;'i",
		                 "'&eacute;'i",
		                 "'&iacute;'i",
		                 "'&oacute;'i",
		                 "'&uacute;'i",
		                 "'&atilde;'i",
		                 "'&ccedil;'i",
		                 "'&#(\d+);'e");                    // evaluate as php

		$replace = array ("\"",
		                  "&",
		                  //"<",
		                  //">",
		                  " ",
		                  chr(161),
		                  chr(162),
		                  chr(163),
		                  chr(169),
		                  "á",
		                  "é",
		                  "í",
		                  "ó",
		                  "ú",
		                  "ã",
		                  "ç",
		                  "chr(\\1)");


		$xmlString = preg_replace($search, $replace, $xmlString);
		//$xmlString = tidy_parse_string($xmlString, array('output-xml' => TRUE), 'UTF8');

		$xmldoc = XmlUtil::CreateXmlDocumentFromStr($xmlString);

		return $xmldoc;
	}
1255662
public function GetDeleteURL($bUseFullUrl = false)
    {
        $aParameter = array(TdbShopArticleReview::URL_PARAM_REVIEW_ID => $this->id);
        $sReportLink = TTools::GetExecuteMethodOnCurrentModuleURL('DeleteReview', $aParameter, $bUseFullUrl);

        return $sReportLink;
    }
710498
public function getPagination($url)
    {
        $gets = null;
        $gets = $this->gets;
        $page = $this->page;
        $gets['pageSize'] = $this->pageSize;
        if ($page > 1) {
            $gets['page'] = 1;
            $newUrl = URLUtil::addParameter($url, $gets);
            $laquo = "<li><a href=\"{$newUrl}\">&laquo;</a></li>";
            $gets['page'] = $page - 1;
            $newUrl = URLUtil::addParameter($url, $gets);
            $left = "<li><a href=\"{$newUrl}\">&lt;</a></li>";
        } else {
            $laquo = "<li class=\"disabled\"><a href='#'>&laquo;</a></li>";
            $left = "<li class=\"disabled\"><a href='#'>&lt;</a></li>";
        }
        if ($page < $this->total) {
            $gets['page'] = $this->total;
            $newUrl = URLUtil::addParameter($url, $gets);
            $raquo = "<li><a href=\"{$newUrl}\">&raquo;</a></li>";
            $gets['page'] = $page + 1;
            $newUrl = URLUtil::addParameter($url, $gets);
            $right = "<li><a href=\"{$newUrl}\">&gt;</a></li>";
        } else {
            $raquo = "<li class=\"disabled\"><a href='#'>&raquo;</a></li>";
            $right = "<li class=\"disabled\"><a href='#'>&gt;</a></li>";
        }

        $otherPages = [];
        $start = 1;
        if ($this->total > 5) {
            $start = $page;
            while (true) {
                if ($start - 2 >= 1 && $start + 2 <= $this->total) {
                    break;
                } else if ($start - 2 <= 1) {
                    $start++;
                } else if ($start + 2 >= $this->total) {
                    $start--;
                }
            }
            $end = $start + 2;
            $start -= 2;
        } else {
            $end = $this->total;
        }
        for ($i = $start; $i <= $end; $i++) {
            if ($page == $i) {
                $otherPages[] = "<li class=\"active\"><a href=\"#\">{$i}</a></li>";
            } else {
                $gets['page'] = $i;
                $newUrl = URLUtil::addParameter($url, $gets);
                $otherPages[] = "<li><a href=\"{$newUrl}\">{$i}</a></li>";
            }
        }

        array_unshift($otherPages, $left);
        array_unshift($otherPages, $laquo);
        array_push($otherPages, $right);
        array_push($otherPages, $raquo);
        $html = '<ul class="pagination">' . join("\n", $otherPages) . '</ul>';
        return $html;
    }
79354
public function get_url() {
        if ($this->courseid) {
            $cat = $this->other['newcategoryid'] . ',' . $this->contextid;
            if ($this->contextlevel == CONTEXT_MODULE) {
                return new \moodle_url('/question/edit.php',
                        ['cmid' => $this->contextinstanceid, 'cat' => $cat, 'lastchanged' => $this->objectid]);
            }
            return new \moodle_url('/question/edit.php',
                    ['courseid' => $this->courseid, 'cat' => $cat, 'lastchanged' => $this->objectid]);
        }
        // Lets try viewing from the frontpage for contexts above course.
        return new \moodle_url('/question/category.php',
                ['courseid' => SITEID, 'edit' => $this->other['newcategoryid'], 'lastchanged' => $this->objectid]);
    }
456875
public function html($url = null)
    {

        $html    = app('html');
        $builder = $this->setName('Module List')
                ->addColumn(['data' => 'id', 'name' => 'id', 'title' => trans('antares/sample_module::datagrid.header.id')])
                ->addColumn(['data' => 'name', 'name' => 'name', 'title' => trans('antares/sample_module::datagrid.header.name'), 'className' => 'bolded']);
        if (!auth()->user()->hasRoles('member')) {
            $builder->addColumn(['data' => 'user_id', 'name' => 'user_id', 'title' => trans('antares/sample_module::datagrid.header.user')]);
        }


        return $builder->addColumn(['data' => 'field_1', 'name' => 'field_1', 'title' => trans('antares/sample_module::datagrid.header.field_1')])
                        ->addColumn(['data' => 'field_2', 'name' => 'field_2', 'title' => trans('antares/sample_module::datagrid.header.field_2')])
                        ->addAction(['name' => 'edit', 'title' => '', 'class' => 'mass-actions dt-actions'])
                        ->ajax(is_null($url) ? handles('antares::sample_module/index') : $url)
                        ->addGroupSelect($this->users(), 2, 1)
                        ->setDeferedData();
    }
33040
public function getShareLink($url, array $options = array())
    {
        $options['url'] = $url;

        return sprintf(self::SHARE_URL, http_build_query($options));
    }
806068
public function question(structure $structure, $slot, \moodle_url $pageurl) {
        $output = '';
        $output .= html_writer::start_tag('div');

        if ($structure->can_be_edited()) {
            $output .= $this->question_move_icon($structure, $slot);
        }

        $output .= html_writer::start_div('mod-indent-outer');
        $output .= html_writer::tag('input', '', array('id' => 'selectquestion-' .
                $structure->get_displayed_number_for_slot($slot), 'name' => 'selectquestion[]',
               'type' => 'checkbox', 'class' => 'select-multiple-checkbox',
               'value' => $structure->get_displayed_number_for_slot($slot)));
        $output .= $this->question_number($structure->get_displayed_number_for_slot($slot));

        // This div is used to indent the content.
        $output .= html_writer::div('', 'mod-indent');

        // Display the link to the question (or do nothing if question has no url).
        if ($structure->get_question_type_for_slot($slot) == 'random') {
            $questionname = $this->random_question($structure, $slot, $pageurl);
        } else {
            $questionname = $this->question_name($structure, $slot, $pageurl);
        }

        // Start the div for the activity title, excluding the edit icons.
        $output .= html_writer::start_div('activityinstance');
        $output .= $questionname;

        // Closing the tag which contains everything but edit icons. Content part of the module should not be part of this.
        $output .= html_writer::end_tag('div'); // .activityinstance.

        // Action icons.
        $questionicons = '';
        $questionicons .= $this->question_preview_icon($structure->get_quiz(), $structure->get_question_in_slot($slot));
        if ($structure->can_be_edited()) {
            $questionicons .= $this->question_remove_icon($structure, $slot, $pageurl);
        }
        $questionicons .= $this->marked_out_of_field($structure, $slot);
        $output .= html_writer::span($questionicons, 'actions'); // Required to add js spinner icon.
        if ($structure->can_be_edited()) {
            $output .= $this->question_dependency_icon($structure, $slot);
        }

        // End of indentation div.
        $output .= html_writer::end_tag('div');
        $output .= html_writer::end_tag('div');

        return $output;
    }
958548
public function createFormUrl($url)
    {
        $urlParts = parse_url($url);

        $scheme = isset($urlParts['scheme']) ? $urlParts['scheme'] : '';
        $user = isset($urlParts['user']) ? $urlParts['user'] : '';
        $password = isset($urlParts['pass']) ? $urlParts['pass'] : '';
        $host = isset($urlParts['host']) ? $urlParts['host'] : '';
        $port = isset($urlParts['port']) ? $urlParts['port'] : null;
        $path = isset($urlParts['path']) ? $urlParts['path'] : '';
        $query = isset($urlParts['query']) ? $urlParts['query'] : '';
        $fragment = isset($urlParts['fragment']) ? $urlParts['fragment'] : '';

        $this->setUri($scheme, $host, $port, $path, $query, $fragment, $user, $password);

        return $this;
    }
943084
public function get_url() {
        if ($this->other['badgetype'] == BADGE_TYPE_COURSE) {
            // Course badge.
            $return = new \moodle_url('/badges/index.php',
                    array('type' => BADGE_TYPE_COURSE, 'id' => $this->other['courseid']));
        } else {
            // Site badge.
            $return = new \moodle_url('/badges/index.php', array('type' => BADGE_TYPE_SITE));
        }
        return $return;
    }