本文整理汇总了PHP中Sh404sefHelperGeneral::getUserGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP Sh404sefHelperGeneral::getUserGroups方法的具体用法?PHP Sh404sefHelperGeneral::getUserGroups怎么用?PHP Sh404sefHelperGeneral::getUserGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sh404sefHelperGeneral
的用法示例。
在下文中一共展示了Sh404sefHelperGeneral::getUserGroups方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: buildUserLevelsList
/**
* Builds a select list with all possible user levels
*
* Adapted from JCal pro
*
* @param $current
* @param $name
* @param $autoSubmit
* @param $addSelectAll
* @param $selectAllTitle
*/
public static function buildUserLevelsList($current, $name, $autoSubmit = false, $addSelectAll = false, $selectAllTitle = '', $customSubmit = '')
{
// get a list of available user groups
$groups = Sh404sefHelperGeneral::getUserGroups();
// build html options
$data = array();
foreach ($groups as $id => $group) {
$data[] = array('id' => $group, 'title' => $group);
}
// use helper to build html
$list = self::buildSelectList($data, $current, $name, $autoSubmit, $addSelectAll, $selectAllTitle, $customSubmit);
// return list
return $list;
}
示例2: _addCustomVars
protected function _addCustomVars()
{
$this->_formatedResponse->perf = new stdClass();
// prepare time and memory calculation
$field = 'customVarValue' . SH404SEF_ANALYTICS_TIME_CUSTOM_VAR;
$totalPages = 0;
$totalTime = 0;
$totalMemory = 0;
// now iterate over time and memory records
foreach ($this->_rawData['page-creation-time'] as $entry) {
$record = intval($entry->dimension[$field]);
// make it an int, this will remove dev data that had decimals
// sanitize
$record = $record < 3 ? 0 : $record;
// we only calculate averaged on pages we have time and ram data for
if (!empty($record)) {
// separate time and memory
$time = $record >> 4;
// bits 5 and up
$memory = $record & 15;
// bits 1 to 4
// aggregate
$totalPages += $entry->pageviews;
$totalTime += Sh404sefHelperAnalytics::declassifyTime($time) * $entry->pageviews;
$totalMemory += Sh404sefHelperAnalytics::declassifyMemory($memory) * $entry->pageviews;
}
}
// calculate averages time and ram now
$this->_formatedResponse->perf->avgPageCreationTime = empty($totalPages) ? 0 : $totalTime / $totalPages;
$this->_formatedResponse->perf->avgMemoryUsed = empty($totalPages) ? 0 : $totalMemory / $totalPages;
// logged in users handling
$field = 'customVarValue' . SH404SEF_ANALYTICS_USER_CUSTOM_VAR;
$groups = Sh404sefHelperGeneral::getUserGroups();
$loggedInPages = 0;
foreach ($this->_rawData['logged-in-users'] as $entry) {
$userType = urldecode($entry->dimension[$field]);
// if user was logged in, any group, including "Public Frontend"
if (in_array($userType, $groups)) {
// include # of pages
$loggedInPages += $entry->pageviews;
}
}
$this->_formatedResponse->perf->loggedInUserRate = empty($this->_formatedResponse->global->pageviews) ? 0 : $loggedInPages / $this->_formatedResponse->global->pageviews;
}