Human-readable summary of data that will be sent to moodle.net

@param array $siteinfo result of get_site_info()
@return string
434815
public static function get_stats_summary($siteinfo) {
        $fieldsneedconfirm = self::get_new_registration_fields();
        $summary = html_writer::tag('p', get_string('sendfollowinginfo_help', 'hub')) .
            html_writer::start_tag('ul');

        $mobileservicesenabled = $siteinfo['mobileservicesenabled'] ? get_string('yes') : get_string('no');
        $mobilenotificationsenabled = $siteinfo['mobilenotificationsenabled'] ? get_string('yes') : get_string('no');
        $moodlerelease = $siteinfo['moodlerelease'];
        if (preg_match('/^(\d+\.\d.*?)[\. ]/', $moodlerelease, $matches)) {
            $moodlerelease = $matches[1];
        }
        $senddata = [
            'moodlerelease' => get_string('sitereleasenum', 'hub', $moodlerelease),
            'courses' => get_string('coursesnumber', 'hub', $siteinfo['courses']),
            'users' => get_string('usersnumber', 'hub', $siteinfo['users']),
            'enrolments' => get_string('roleassignmentsnumber', 'hub', $siteinfo['enrolments']),
            'posts' => get_string('postsnumber', 'hub', $siteinfo['posts']),
            'questions' => get_string('questionsnumber', 'hub', $siteinfo['questions']),
            'resources' => get_string('resourcesnumber', 'hub', $siteinfo['resources']),
            'badges' => get_string('badgesnumber', 'hub', $siteinfo['badges']),
            'issuedbadges' => get_string('issuedbadgesnumber', 'hub', $siteinfo['issuedbadges']),
            'participantnumberaverage' => get_string('participantnumberaverage', 'hub',
                format_float($siteinfo['participantnumberaverage'], 2)),
            'modulenumberaverage' => get_string('modulenumberaverage', 'hub',
                format_float($siteinfo['modulenumberaverage'], 2)),
            'mobileservicesenabled' => get_string('mobileservicesenabled', 'hub', $mobileservicesenabled),
            'mobilenotificationsenabled' => get_string('mobilenotificationsenabled', 'hub', $mobilenotificationsenabled),
            'registereduserdevices' => get_string('registereduserdevices', 'hub', $siteinfo['registereduserdevices']),
            'registeredactiveuserdevices' => get_string('registeredactiveuserdevices', 'hub', $siteinfo['registeredactiveuserdevices']),
            'analyticsenabledmodels' => get_string('analyticsenabledmodels', 'hub', $siteinfo['analyticsenabledmodels']),
            'analyticspredictions' => get_string('analyticspredictions', 'hub', $siteinfo['analyticspredictions']),
            'analyticsactions' => get_string('analyticsactions', 'hub', $siteinfo['analyticsactions']),
            'analyticsactionsnotuseful' => get_string('analyticsactionsnotuseful', 'hub', $siteinfo['analyticsactionsnotuseful']),
        ];

        foreach ($senddata as $key => $str) {
            $class = in_array($key, $fieldsneedconfirm) ? ' needsconfirmation mark' : '';
            $summary .= html_writer::tag('li', $str, ['class' => 'site' . $key . $class]);
        }
        $summary .= html_writer::end_tag('ul');
        return $summary;
    }
88166
public function getInfo($msisdn = '')
    {
        try {
            $inputParams = [
                'msisdn' => $msisdn
            ];
            $this->debug->info(__FUNCTION__, 'Input Params: ' . json_encode($inputParams));
            // Sử dụng API: /api/v1/utils/users-get-info.html
            $getInfoUrl       = $this->hostname . $this->config[self::API_GET_INFO]['path'];
            $getInfoToken     = $this->config[self::API_GET_INFO]['token'];
            $getInfoPrefix    = $this->config[self::API_GET_INFO]['prefix'];
            $getInfoSignature = md5($msisdn . $getInfoPrefix . $getInfoToken);
            $getInfoParams    = [
                'msisdn'    => $msisdn,
                'signature' => $getInfoSignature
            ];
            $this->debug->debug(__FUNCTION__, '$getInfoUrl: ' . json_encode($getInfoUrl));
            $this->debug->debug(__FUNCTION__, '$getInfoToken: ' . json_encode($getInfoToken));
            $this->debug->debug(__FUNCTION__, '$getInfoPrefix: ' . json_encode($getInfoPrefix));
            $this->debug->debug(__FUNCTION__, '$getInfoSignature: ' . json_encode($getInfoSignature));
            $this->debug->debug(__FUNCTION__, '$getInfoParams: ' . json_encode($getInfoParams));
            $getInfoRequest = $this->requests->sendRequest($getInfoUrl, $getInfoParams);
            $this->debug->info(__FUNCTION__, '$getInfoRequest: ' . json_encode($getInfoRequest));
            if ($getInfoRequest !== NULL) {
                return json_decode(trim($getInfoRequest));
            } else {
                $this->debug->warning(__FUNCTION__, 'Request Response is Empty');

                return FALSE;
            }
        }
        catch (\Exception $e) {
            $message = 'Error File: ' . $e->getFile() . ' - Line: ' . $e->getLine() . ' - Code: ' . $e->getCode() . ' - Message: ' . $e->getMessage();
            $this->debug->error(__FUNCTION__, $message);

            return NULL;
        }
    }
1038744
public function pageTitle($name = 'default', $language = null, $treeNode = null, Siteroot $siteroot = null)
    {
        $request = $this->requestStack->getCurrentRequest();

        if ($siteroot === null) {
            $siteroot = $request->attributes->get('siterootUrl')->getSiteroot();
        }

        if ($treeNode instanceof ContentTreeContext) {
            $treeNode = $treeNode->getNode();
        }

        if (!($treeNode instanceof TreeNodeInterface)) {
            $treeNode = $request->get('contentDocument');
        }

        if ($language === null) {
            $language = $request->getLocale();
        }

        $title = $this->patternResolver->replace(
            $name,
            $siteroot,
            $treeNode->getTree()->getContent($treeNode),
            $language
        );

        return $title;
    }
753703
public function getInfo()
    {
        if ($this->info === null) {
            $this->info = new \SplFileInfo($this->fullPath);
        }

        return $this->info;
    }
1311065
public function moodlenet_info() {
        if (!$info = \core\hub\registration::get_moodlenet_info()) {
            return '';
        }

        $image = html_writer::div(html_writer::img($info['imgurl'], $info['name']), 'hubimage');

        $namelink = html_writer::link($info['url'], html_writer::tag('h2', $info['name']), array('class' => 'hubtitlelink'));
        $description = clean_param($info['description'], PARAM_TEXT);
        $descriptiontext = html_writer::div(format_text($description, FORMAT_PLAIN), 'hubdescription');

        $additionaldesc = get_string('enrollablecourses', 'block_community') . ': ' . $info['enrollablecourses'] . ' - ' .
            get_string('downloadablecourses', 'block_community') . ': ' . $info['downloadablecourses'];
        $stats = html_writer::div(html_writer::tag('div', $additionaldesc), 'hubstats');

        $text = html_writer::div($descriptiontext . $stats, 'hubtext');

        $imgandtext = html_writer::div($image . $text, 'hubimgandtext');

        $fulldesc = html_writer::div($namelink . $imgandtext, 'hubmainhmtl clearfix');

        return html_writer::div($fulldesc, 'formlisting');
    }
525263
public function getPhpInfo()
    {
        ob_start();
        phpinfo();
        $pinfo = ob_get_contents();
        ob_end_clean();
        $phpinfo = preg_replace('%^.*<body>(.*)</body>.*$%ms', '$1', $pinfo);
        $phpinfo = str_replace('<table',
            '<div class="table-responsive"><table class="table table-condensed table-bordered table-striped table-hover config-php-info-table" ',
            $phpinfo);
        $phpinfo = str_replace('</table>', '</table></div>', $phpinfo);
        $phpinfo = str_replace('<div class="center">', '<div class="phpinfo">', $phpinfo);
        return $phpinfo;
    }
651229
public function getInfo() {
		$info = $this->createInfoset()
			->setName('Response info')
			->setIcon('arrowup');
		
		$this->createTitle($info);
		$this->createContent($info);
		
		return $info;
	}
884389
protected function _getSiteTitle()
    {
        $action = $this->_action();

        $title = $action->getConfig('scaffold.site_title');
        if (!empty($title)) {
            return $title;
        }

        return Configure::read('CrudView.siteTitle');
    }
751232
protected function getHtmlTitleFormatForPage(array $data)
    {
        if (empty($data['page']['title'])) {
            return $data['site']['name'];
        }

        return Str::replace($this->formats['page'], $data);
    }
438790
protected function getInfoPart()
    {
        $part = '{\info'."\r\n";

        foreach ($this->_properties as $key => $value) {
            $value = PHPRtfLite_Utf8::getUnicodeEntities($value, $this->_charset);
            $part .= '{\\' . $key . ' ' . $value . '}'."\r\n";
        }

        $part .= '}'."\r\n";

        return $part;
    }
14547
public function getLimitedSummary( $limit = CoreGlobal::DISPLAY_TEXT_MEDIUM ) {

		$summary = $this->summary;

		if( strlen( $summary ) > $limit ) {

			$summary = substr( $summary, 0, $limit );
		}

		return HtmlPurifier::process( $summary );
	}
470588
public function getSummary()
    {
        $ss = new \stdClass();
        $ss->chunk = $this->itemsPerPage;
        $ss->order = $this->sortByDirection;

        $ss->startAt = $this->start;
        $ss->total = $this->getTotal();

        $ss->startAt = ($ss->startAt < $ss->chunk) ? '0' : $ss->startAt;
        $itc = intval($ss->total / $ss->chunk);
        if ($ss->total == $ss->chunk) {
            $itc = 0;
        }
        $ss->pages = $itc + 1;

        if ($ss->startAt > 0) {
            $ss->current = ($ss->startAt / $ss->chunk) + 1;
        } else {
            $ss->current = '1';
        }

        $ss->previous = ($ss->startAt >= $ss->chunk) ? ($ss->current - 2) * $ss->chunk : -1;
        $ss->next = (($ss->total - $ss->startAt) >= $ss->chunk) ? $ss->current * $ss->chunk : '';
        $ss->last = (($ss->total - $ss->startAt) >= $ss->chunk) ? ($ss->pages - 1) * $ss->chunk : '';
        $ss->currentStart = ($ss->current > 1) ? ((($ss->current - 1) * $ss->chunk) + 1) : '1';
        $ss->currentEnd = ((($ss->current + $ss->chunk) - 1) <= $ss->last) ? ($ss->currentStart + $ss->chunk) - 1 : $ss->total;
        $ss->needsPaging = ($ss->total > $ss->chunk) ? true : false;

        return $ss;
    }
1077080
public function get_course_formatted_summary($course, $options = array()) {
        global $CFG;
        require_once($CFG->libdir. '/filelib.php');
        if (!$course->has_summary()) {
            return '';
        }
        $options = (array)$options;
        $context = context_course::instance($course->id);
        if (!isset($options['context'])) {
            // TODO see MDL-38521
            // option 1 (current), page context - no code required
            // option 2, system context
            // $options['context'] = context_system::instance();
            // option 3, course context:
            // $options['context'] = $context;
            // option 4, course category context:
            // $options['context'] = $context->get_parent_context();
        }
        $summary = file_rewrite_pluginfile_urls($course->summary, 'pluginfile.php', $context->id, 'course', 'summary', null);
        $summary = format_text($summary, $course->summaryformat, $options, $course->id);
        if (!empty($this->searchcriteria['search'])) {
            $summary = highlight($this->searchcriteria['search'], $summary);
        }
        return $summary;
    }
796276
protected function getSiteInfo()
    {
        if ( null === $this->siteInfo )
        {
            $this->siteInfo = $this->getServiceLocator()
                                   ->get( 'SiteInfo' );
        }

        return $this->siteInfo;
    }
250850
public function get_reference_details($reference, $filestatus = 0) {
        if ($this->has_moodle_files()) {
            $fileinfo = null;
            $params = file_storage::unpack_reference($reference, true);
            if (is_array($params)) {
                $context = context::instance_by_id($params['contextid'], IGNORE_MISSING);
                if ($context) {
                    $browser = get_file_browser();
                    $fileinfo = $browser->get_file_info($context, $params['component'], $params['filearea'], $params['itemid'], $params['filepath'], $params['filename']);
                }
            }
            if (empty($fileinfo)) {
                if ($filestatus == 666) {
                    if (is_siteadmin() || ($context && has_capability('moodle/course:managefiles', $context))) {
                        return get_string('lostsource', 'repository',
                                $params['contextid']. '/'. $params['component']. '/'. $params['filearea']. '/'. $params['itemid']. $params['filepath']. $params['filename']);
                    } else {
                        return get_string('lostsource', 'repository', '');
                    }
                }
                return get_string('undisclosedsource', 'repository');
            } else {
                return $fileinfo->get_readable_fullname();
            }
        }
        return '';
    }
175440
public function getAdditionalInformation()
    {
        $site = $this->getSite();

        if (is_null($site)) {
            return 'Invalid site configuration for scheduler please re-create the task!';
        }

        $message = 'Site: ' . $site->getLabel();

        /** @var $indexService \ApacheSolrForTypo3\Solr\Domain\Index\IndexService */
        $indexService = $this->getInitializedIndexService($site);
        $failedItemsCount = $indexService->getFailCount();

        if ($failedItemsCount) {
            $message .= ' Failures: ' . $failedItemsCount;
        }

        $message .= ' / Using webroot: ' . htmlspecialchars($this->getWebRoot());

        return $message;
    }
831156
public function getSiteStats( $config = [] ) {

		$status	= isset( $config[ 'status' ] ) ? $config[ 'status' ] : null;
		$type	= isset( $config[ 'type' ] ) ? $config[ 'type' ] : null;
		$limit	= isset( $config[ 'limit' ] ) ? $config[ 'limit' ] : 0;

		$modelClass	= static::$modelClass;
        $modelTable	= $modelClass::tableName();

        $query = new Query();

        $query->select( [ 'siteId', 'count(id) as total' ] )
			->from( $modelTable );

		// Filter Status
		if( isset( $status ) ) {

			$query->where( "$modelTable.status=:status", [ ':status' => $status ] );
		}

		// Filter Type
		if( isset( $type ) ) {

			$query->andWhere( "$modelTable.type=:type", [ ':type' => $type ] );
		}

		// Limit
		if( $limit > 0 ) {

			$query->limit( $limit );
		}

		// Group and Order
		$query->groupBy( 'siteId' )->orderBy( 'total DESC' );

        return $query->all();
    }