本文整理汇总了PHP中group_homepage_url函数的典型用法代码示例。如果您正苦于以下问题:PHP group_homepage_url函数的具体用法?PHP group_homepage_url怎么用?PHP group_homepage_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了group_homepage_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addmembers_submit
function addmembers_submit(Pieform $form, $values)
{
global $SESSION, $group, $USER;
if (empty($values['users'])) {
redirect(get_config('wwwroot') . 'group/suggest.php?id=' . GROUP);
}
require_once 'activity.php';
$groupurl = group_homepage_url($group, false);
activity_occurred('maharamessage', array('users' => $values['users'], 'subject' => '', 'message' => '', 'strings' => (object) array('subject' => (object) array('key' => 'suggestgroupnotificationsubject', 'section' => 'group', 'args' => array(display_name($USER))), 'message' => (object) array('key' => 'suggestgroupnotificationmessage', 'section' => 'group', 'args' => array(display_name($USER), hsc($group->name), get_config('sitename')))), 'url' => $groupurl, 'urltext' => hsc($group->name)));
$SESSION->add_ok_msg(get_string('recommendationssent', 'group', count($values['users'])));
redirect(get_config('wwwroot') . $groupurl);
}
示例2: addmembers_submit
function addmembers_submit(Pieform $form, $values)
{
global $SESSION, $group, $USER, $friends;
if (empty($values['users'])) {
redirect(get_config('wwwroot') . 'group/inviteusers.php?id=' . GROUP . ($friends ? '&friends=1' : ''));
}
db_begin();
foreach ($values['users'] as $userid) {
group_invite_user($group, $userid, $USER->get('id'), 'member', true);
}
db_commit();
$SESSION->add_ok_msg(get_string('invitationssent', 'group', count($values['users'])));
if ($friends) {
redirect(group_homepage_url($group));
}
redirect(get_config('wwwroot') . 'group/members.php?id=' . GROUP);
}
示例3: returnto
function returnto()
{
global $view, $collection, $group, $returnto;
// Deteremine the best place to return to
if ($returnto === 'group') {
$goto = group_homepage_url($group, false);
} else {
if ($returnto === 'view') {
if (!empty($collection)) {
$goto = $collection->get_url(false);
} else {
$goto = $view->get_url(false);
}
} else {
$goto = 'view/index.php';
}
}
return $goto;
}
示例4: if
<?php
}?>
<?php if ((is_string($tmp=(isset($this->scope["sbdata"]["groups"]) ? $this->scope["sbdata"]["groups"]:null)) ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp)) {
?>
<li id="groups"><a href="<?php echo (is_string($tmp=$this->scope["WWWROOT"]) ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp);?>group/mygroups.php"><?php echo Dwoo_Plugin_str($this, "mygroups", 'mahara', null, null, null, null, null);?>:</a>
<ul>
<?php
$_fh4_data = (is_string($tmp=(isset($this->scope["sbdata"]["groups"]) ? $this->scope["sbdata"]["groups"]:null)) ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp);
if ($this->isArray($_fh4_data) === true)
{
foreach ($_fh4_data as $this->scope['group'])
{
/* -- foreach start output */
?>
<li><a href="<?php echo group_homepage_url((is_string($tmp=(isset($this->scope["group"]) ? $this->scope["group"] : null)) ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp));?>"><?php echo (is_string($tmp=$this->readVarInto(array ( 1 => array ( 0 => '->', ), 2 => array ( 0 => 'name', ), 3 => array ( 0 => '', 1 => '', ),), $this->scope["group"], false)) ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp);?></a><?php if ((is_string($tmp=$this->readVarInto(array ( 1 => array ( 0 => '->', ), 2 => array ( 0 => 'role', ), 3 => array ( 0 => '', 1 => '', ),), (isset($this->scope["group"]) ? $this->scope["group"]:null), true)) ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp) == 'admin') {
?> (<?php echo Dwoo_Plugin_str($this, 'Admin', 'group', null, null, null, null, null);?>)<?php
}?></li>
<?php
/* -- foreach end output */
}
}?>
</ul>
<span class="tiny"><?php echo (is_string($tmp=$this->scope["sbdata"]["grouplimitstr"]) ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp);?></span>
</li>
<?php
}?>
<?php if ((is_string($tmp=(isset($this->scope["sbdata"]["views"]) ? $this->scope["sbdata"]["views"]:null)) ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp)) {
?>
示例5: get_string
$view->set_edit_nav();
$state = get_string('editcontent', 'view');
if ($view->get('type') == 'profile') {
$profile = true;
$title = get_string('usersprofile', 'mahara', display_name($view->get('owner'), null, true));
define('TITLE', $title);
} else {
if ($view->get('type') == 'dashboard') {
$dashboard = true;
$title = get_string('usersdashboard', 'mahara', display_name($view->get('owner'), null, true));
define('TITLE', $title);
} else {
if ($view->get('type') == 'grouphomepage') {
$title = get_string('grouphomepage', 'view');
if ($view->get('owner') != "0") {
$groupurl = group_homepage_url(get_record('group', 'id', $view->get('group')), false);
}
define('TITLE', $title);
} else {
if ($new) {
define('TITLE', get_string('notitle', 'view'));
} else {
define('TITLE', $view->get('title'));
$editabletitle = true;
}
}
}
}
// Make the default category the first tab if none is set
$category = '';
if (param_exists('c')) {
示例6: array
$ownerformatoptions = array(FORMAT_NAME_FIRSTNAME => sprintf($formatstring, get_string('firstname'), $USER->get('firstname')), FORMAT_NAME_LASTNAME => sprintf($formatstring, get_string('lastname'), $USER->get('lastname')), FORMAT_NAME_FIRSTNAMELASTNAME => sprintf($formatstring, get_string('fullname'), full_name()));
$displayname = display_name($USER);
if ($displayname !== '') {
$ownerformatoptions[FORMAT_NAME_DISPLAYNAME] = sprintf($formatstring, get_string('preferredname'), $displayname);
}
$studentid = (string) get_field('artefact', 'title', 'owner', $USER->get('id'), 'artefacttype', 'studentid');
if ($studentid !== '') {
$ownerformatoptions[FORMAT_NAME_STUDENTID] = sprintf($formatstring, get_string('studentid'), $studentid);
}
// Clean urls are only available for portfolio views owned by groups or users who already
// have their own clean profiles or group homepages.
if ($urlallowed = get_config('cleanurls') && $view->get('type') == 'portfolio' && !$institution) {
if ($group) {
$groupdata = get_record('group', 'id', $group);
if ($urlallowed = !is_null($groupdata->urlid) && strlen($groupdata->urlid)) {
$cleanurlbase = group_homepage_url($groupdata) . '/';
}
} else {
$userurlid = $USER->get('urlid');
if ($urlallowed = !is_null($userurlid) && strlen($userurlid)) {
$cleanurlbase = profile_url($USER) . '/';
}
}
}
$editview = array('name' => 'editview', 'method' => 'post', 'autofocus' => 'title', 'autoselect' => $new ? 'title' : null, 'plugintype' => 'core', 'pluginname' => 'view', 'elements' => array('id' => array('type' => 'hidden', 'value' => $view->get('id')), 'new' => array('type' => 'hidden', 'value' => $new), 'title' => array('type' => 'text', 'title' => get_string('title', 'view'), 'defaultvalue' => $view->get('title'), 'rules' => array('required' => true)), 'urlid' => array('type' => 'text', 'title' => get_string('viewurl', 'view'), 'prehtml' => '<span class="description">' . (isset($cleanurlbase) ? $cleanurlbase : '') . '</span> ', 'description' => get_string('viewurldescription', 'view') . ' ' . get_string('cleanurlallowedcharacters'), 'defaultvalue' => $new ? null : $view->get('urlid'), 'rules' => array('maxlength' => 100, 'regex' => get_config('cleanurlvalidate')), 'ignore' => !$urlallowed || $new), 'description' => array('type' => 'wysiwyg', 'title' => get_string('description', 'view'), 'rows' => 10, 'cols' => 70, 'defaultvalue' => $view->get('description'), 'rules' => array('maxlength' => 65536)), 'tags' => array('type' => 'tags', 'title' => get_string('tags'), 'description' => get_string('tagsdescprofile'), 'defaultvalue' => $view->get('tags'), 'help' => true)));
if ($group) {
$grouproles = $USER->get('grouproles');
if ($grouproles[$group] == 'admin') {
$editview['elements']['locked'] = array('type' => 'switchbox', 'title' => get_string('Locked', 'view'), 'description' => get_string('lockedgroupviewdesc', 'view'), 'defaultvalue' => $view->get('locked'), 'disabled' => $view->get('type') == 'grouphomepage');
}
}
示例7: group_get_menu_tabs
/**
* Returns a datastructure describing the tabs that appear on a group page
*
* @param object $group Database record of group to get tabs for
* @return array
*/
function group_get_menu_tabs()
{
static $menu;
$group = group_current_group();
if (!$group) {
return null;
}
$role = group_user_access($group->id);
$menu = array('info' => array('path' => 'groups/info', 'url' => group_homepage_url($group, false), 'title' => get_string('About', 'group'), 'weight' => 20));
if (group_can_list_members($group, $role)) {
$menu['members'] = array('path' => 'groups/members', 'url' => 'group/members.php?id=' . $group->id, 'title' => get_string('Members', 'group'), 'weight' => 30);
}
if ($interactionplugins = plugins_installed('interaction')) {
foreach ($interactionplugins as $plugin) {
safe_require('interaction', $plugin->name);
$plugin_menu = call_static_method(generate_class_name('interaction', $plugin->name), 'group_menu_items', $group);
$menu = array_merge($menu, $plugin_menu);
}
}
$menu['subnav'] = array('class' => 'group');
$menu['views'] = array('path' => 'groups/views', 'url' => 'view/groupviews.php?group=' . $group->id, 'title' => get_string('Views', 'group'), 'weight' => 50);
$menu['collections'] = array('path' => 'groups/collections', 'url' => 'collection/index.php?group=' . $group->id, 'title' => get_string('Collections', 'group'), 'weight' => 60);
if (group_role_can_edit_views($group, $role)) {
$menu['share'] = array('path' => 'groups/share', 'url' => 'group/shareviews.php?group=' . $group->id, 'title' => get_string('share', 'view'), 'weight' => 70);
}
if ($role) {
safe_require('grouptype', $group->grouptype);
$artefactplugins = call_static_method('GroupType' . $group->grouptype, 'get_group_artefact_plugins');
if ($plugins = plugins_installed('artefact')) {
foreach ($plugins as &$plugin) {
if (!in_array($plugin->name, $artefactplugins)) {
continue;
}
safe_require('artefact', $plugin->name);
$plugin_menu = call_static_method(generate_class_name('artefact', $plugin->name), 'group_tabs', $group->id);
$menu = array_merge($menu, $plugin_menu);
}
}
}
if (group_role_can_access_report($group, $role)) {
$menu['report'] = array('path' => 'groups/report', 'url' => 'group/report.php?group=' . $group->id, 'title' => get_string('report', 'group'), 'weight' => 70);
}
if (defined('MENUITEM')) {
$key = substr(MENUITEM, strlen('groups/'));
if ($key && isset($menu[$key])) {
$menu[$key]['selected'] = true;
}
}
// Sort the menu items by weight
uasort($menu, function ($a, $b) {
// Only items with a "weight" component need to get sorted. Ones without weight can go first.
if (!array_key_exists('weight', $a)) {
return -1;
}
if (!array_key_exists('weight', $b)) {
return 1;
}
$aweight = $a['weight'];
$bweight = $b['weight'];
if ($aweight == $bweight) {
return 0;
}
return $aweight < $bweight ? -1 : 1;
});
return $menu;
}
示例8: get_accesslists
/**
* Get all views & collections for a (user,group), grouped
* by their accesslists as defined by the accessconf column
*
* @param integer $owner
* @param integer $group
*
* @return array
*/
public static function get_accesslists($owner = null, $group = null, $institution = null)
{
require_once 'institution.php';
if (!is_null($owner) && !is_array($owner) && $owner > 0) {
$ownerobj = new User();
$ownerobj->find_by_id($owner);
}
$data = array();
list($data['collections'], $data['views']) = self::get_views_and_collections($owner, $group, $institution);
// Remember one representative viewid in each collection
$viewindex = array();
// Add strings to describe startdate/stopdate access overrides
foreach ($data['collections'] as &$c) {
$view = current($c['views']);
$viewindex[$view['id']] = array('type' => 'collections', 'id' => $c['id']);
$c['access'] = self::access_override_description($view);
$c['viewid'] = $view['id'];
}
foreach ($data['views'] as &$v) {
$viewindex[$v['id']] = array('type' => 'views', 'id' => $v['id']);
$v['access'] = self::access_override_description($v);
$v['viewid'] = $v['id'];
}
if (empty($viewindex)) {
return $data;
}
// Get view_access records, apart from those with visible = 0 (system access records)
$accessgroups = get_records_sql_array('
SELECT va.*, g.grouptype, g.name, g.urlid
FROM {view_access} va LEFT OUTER JOIN {group} g ON (g.id = va.group AND g.deleted = 0)
WHERE va.view IN (' . join(',', array_keys($viewindex)) . ') AND va.visible = 1
ORDER BY va.view, va.accesstype, g.grouptype, va.role, g.name, va.group, va.usr', array());
if (!$accessgroups) {
return $data;
}
if (!function_exists('is_probationary_user')) {
require_once get_config('libroot') . 'antispam.php';
}
foreach ($accessgroups as $access) {
// remove 'Public' from the list if the owner isn't allowed to have them
if ($access->accesstype == 'public' && (get_config('allowpublicviews') != 1 || isset($ownerobj) && !$ownerobj->institution_allows_public_views() || isset($ownerobj) && is_probationary_user($ownerobj->id))) {
continue;
}
$vi = $viewindex[$access->view];
// Just count secret urls.
if ($access->token) {
if (!isset($data[$vi['type']][$vi['id']]['secreturls'])) {
$data[$vi['type']][$vi['id']]['secreturls'] = 0;
}
$data[$vi['type']][$vi['id']]['secreturls']++;
continue;
}
$key = null;
if ($access->usr) {
$access->accesstype = 'user';
$access->id = $access->usr;
} else {
if ($access->group) {
$access->accesstype = 'group';
$access->id = $access->group;
if ($access->role) {
$access->roledisplay = get_string($access->role, 'grouptype.' . $access->grouptype);
}
$access->groupurl = group_homepage_url((object) array('id' => $access->group, 'urlid' => $access->urlid));
} else {
if ($access->institution) {
$access->accesstype = 'institution';
$access->id = $access->institution;
$access->name = institution_display_name($access->institution);
} else {
$key = $access->accesstype;
}
}
}
if ($key) {
if (!isset($data[$vi['type']][$vi['id']]['accessgroups'][$key])) {
$data[$vi['type']][$vi['id']]['accessgroups'][$key] = (array) $access;
}
} else {
$data[$vi['type']][$vi['id']]['accessgroups'][] = (array) $access;
}
}
return $data;
}
示例9: releaseview_submit
function releaseview_submit()
{
global $USER, $SESSION, $view, $collection, $submittedgroup, $releasecollection;
if ($releasecollection) {
if (is_object($submittedgroup) && $submittedgroup->allowarchives) {
$collection->pendingrelease($USER);
$SESSION->add_ok_msg(get_string('collectionreleasedpending', 'group'));
} else {
$collection->release($USER);
$SESSION->add_ok_msg(get_string('collectionreleasedsuccess', 'group'));
}
} else {
if (is_object($submittedgroup) && $submittedgroup->allowarchives) {
$view->pendingrelease($USER);
$SESSION->add_ok_msg(get_string('viewreleasedpending', 'group'));
} else {
$view->release($USER);
$SESSION->add_ok_msg(get_string('viewreleasedsuccess', 'group'));
}
}
if ($submittedgroup) {
// The tutor might not have access to the view any more; send
// them back to the group page.
redirect(group_homepage_url($submittedgroup));
}
redirect($view->get_url());
}
示例10: define
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('MENUITEM', 'groups');
require dirname(dirname(__FILE__)) . '/init.php';
require_once 'pieforms/pieform.php';
require_once 'group.php';
$groupid = param_integer('id');
define('GROUP', $groupid);
$group = get_record_sql("SELECT g.*\n FROM {group} g\n INNER JOIN {group_member} gm ON (gm.group = g.id AND gm.member = ? AND gm.role = 'admin')\n WHERE g.id = ?\n AND g.deleted = 0", array($USER->get('id'), $groupid));
if (!$group) {
throw new AccessDeniedException(get_string('cantdeletegroup', 'group'));
}
define('TITLE', get_string('deletespecifiedgroup', 'group', $group->name));
$form = pieform(array('name' => 'deletegroup', 'renderer' => 'div', 'autofocus' => false, 'method' => 'post', 'elements' => array('submit' => array('type' => 'submitcancel', 'class' => 'btn-default', 'value' => array(get_string('yes'), get_string('no')), 'goto' => group_homepage_url($group)))));
$smarty = smarty();
$smarty->assign('subheading', TITLE);
$smarty->assign('message', get_string('groupconfirmdelete', 'group'));
$smarty->assign('form', $form);
$smarty->display('group/delete.tpl');
function deletegroup_submit(Pieform $form, $values)
{
global $SESSION, $USER, $groupid;
group_delete($groupid);
$SESSION->add_ok_msg(get_string('deletegroup', 'group'));
redirect('/group/mygroups.php');
}
示例11: institution_view_stats_table
function institution_view_stats_table($limit, $offset, &$institutiondata)
{
global $USER;
if ($institutiondata['views'] != 0) {
$count = count_records_select('view', 'id IN (' . join(',', array_fill(0, $institutiondata['views'], '?')) . ') AND type != ?', array_merge($institutiondata['viewids'], array('dashboard')));
} else {
$count = 0;
}
$pagination = build_pagination(array('id' => 'stats_pagination', 'url' => get_config('wwwroot') . 'admin/users/statistics.php?institution=' . $institutiondata['name'] . '&type=views', 'jsonscript' => 'admin/users/statistics.json.php', 'datatable' => 'statistics_table', 'count' => $count, 'limit' => $limit, 'offset' => $offset, 'extradata' => array('institution' => $institutiondata['name']), 'setlimit' => true));
$result = array('count' => $count, 'tablerows' => '', 'pagination' => $pagination['html'], 'pagination_js' => $pagination['javascript']);
if ($count < 1) {
return $result;
}
$viewdata = get_records_sql_assoc("SELECT\n v.id, v.title, v.owner, v.group, v.institution, v.visits, v.type, v.ownerformat, v.urlid\n FROM {view} v\n WHERE v.id IN (" . join(',', array_fill(0, $institutiondata['views'], '?')) . ") AND v.type != ?\n ORDER BY v.visits DESC, v.title, v.id", array_merge($institutiondata['viewids'], array('dashboard')), $offset, $limit);
require_once 'view.php';
require_once 'group.php';
View::get_extra_view_info($viewdata, false, false);
safe_require('artefact', 'comment');
$comments = ArtefactTypeComment::count_comments(array_keys($viewdata));
foreach ($viewdata as &$v) {
$v = (object) $v;
if ($v->owner) {
$v->ownername = display_name($v->user);
$v->ownerurl = profile_url($v->user);
} else {
$v->ownername = $v->sharedby;
if ($v->group) {
$v->ownerurl = group_homepage_url($v->groupdata);
} else {
if ($v->institution && $v->institution != 'mahara') {
$v->ownerurl = get_config('wwwroot') . 'institution/index.php?institution=' . $v->institution;
}
}
}
$v->comments = isset($comments[$v->id]) ? (int) $comments[$v->id]->comments : 0;
}
$csvfields = array('title', 'displaytitle', 'fullurl', 'owner', 'group', 'institution', 'ownername', 'ownerurl', 'visits', 'type', 'comments');
$USER->set_download_file(generate_csv($viewdata, $csvfields), 'viewstatistics.csv', 'text/csv');
$result['csv'] = true;
$smarty = smarty_core();
$smarty->assign('data', $viewdata);
$smarty->assign('offset', $offset);
$result['tablerows'] = $smarty->fetch('admin/viewstats.tpl');
return $result;
}
示例12: addmember_submit
function addmember_submit(Pieform $form, $values)
{
global $USER, $SESSION, $userid;
$group = get_record('group', 'id', $values['group']);
$ctitle = $group->name;
$adduser = get_record('usr', 'id', $userid);
try {
group_add_user($values['group'], $userid, 'member');
$lang = get_user_language($userid);
require_once get_config('libroot') . 'activity.php';
activity_occurred('maharamessage', array('users' => array($userid), 'subject' => get_string_from_language($lang, 'addedtogroupsubject', 'group'), 'message' => get_string_from_language($lang, 'addedtogroupmessage', 'group', display_name($USER, $adduser), $ctitle), 'url' => group_homepage_url($group, false), 'urltext' => $ctitle));
$SESSION->add_ok_msg(get_string('useradded', 'group'));
} catch (SQLException $e) {
$SESSION->add_error_msg(get_string('adduserfailed', 'group'));
}
redirect(profile_url($adduser));
}
示例13: generate
/**
* Generate sitemap(s) and an index
*
* @return bool
*/
public function generate()
{
// check that the sitemaps directory exists and create it if it doesn't
check_dir_exists($this->directory, true);
// this is used by PluginInteractionForum::get_active_topics
$USER = new User();
// create a new sitemap
$this->create_sitemap();
// get a list of public groups
$publicgroups = get_records_select_array('group', 'public = 1 AND deleted = 0');
if (!empty($publicgroups)) {
foreach ($publicgroups as $group) {
if (isset($group->mtime) && $this->check_date($group->mtime)) {
// each group gets a url entry
$groupurl = group_homepage_url($group);
$groupurl = utf8_encode(htmlspecialchars($groupurl, ENT_QUOTES, 'UTF-8'));
$grouplastmod = format_date(strtotime($group->mtime), 'strftimew3cdate');
$this->add_url($groupurl, $grouplastmod);
}
// build a list of forums in each public group
$forums = get_forum_list($group->id);
$forumids = array();
foreach ($forums as $forum) {
$forumids[] = $forum->id;
}
// active topics within the specified forums (public only)
$activetopics = PluginInteractionForum::get_active_topics(0, 0, 0, $forumids);
foreach ($activetopics['data'] as $topic) {
if (isset($topic->mtime) && $this->check_date($topic->mtime) || isset($topic->ctime) && $this->check_date($topic->ctime)) {
$forumurl = get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $topic->id;
$forumurl = utf8_encode(htmlspecialchars($forumurl, ENT_QUOTES, 'UTF-8'));
// mtime will be set if the last post has been edited
if (isset($topic->mtime) && strtotime($topic->mtime) !== FALSE) {
$forumlastmod = format_date(strtotime($topic->mtime), 'strftimew3cdate');
} else {
$forumlastmod = format_date(strtotime($topic->ctime), 'strftimew3cdate');
}
$this->add_url($forumurl, $forumlastmod);
}
}
}
}
// views shared with the public
// grouphomepage type views are handled above
$types = array('portfolio');
$views = View::view_search(null, null, null, null, null, 0, true, null, $types);
if (!empty($views->data)) {
foreach ($views->data as $view) {
if (isset($view['mtime']) && $this->check_date($view['mtime'])) {
$viewurl = utf8_encode(htmlspecialchars($view['fullurl'], ENT_QUOTES, 'UTF-8'));
$viewlastmod = format_date(strtotime($view['mtime']), 'strftimew3cdate');
$this->add_url($viewurl, $viewlastmod);
}
}
}
// add the urlset and print the xml out
// only if the urlset has any children
if ($this->currenturlset->hasChildNodes()) {
$this->save_sitemap(true);
}
return true;
}
示例14: foreach
foreach ($blocks as $b) {
if (!isset($data[$b->artefact]->views)) {
$data[$b->artefact]->views = array();
}
if (!isset($data[$b->artefact]->views[$b->view])) {
$data[$b->artefact]->views[$b->view] = array('view' => $b->view, 'viewtitle' => $b->viewtitle, 'fullurl' => $viewdata[$b->view]['fullurl']);
// Add the view owner's name if it's not the same as the note owner. This will either
// be a group artefact inside an individual's view, or it's an institution/site artefact.
if (!empty($params['group']) && $b->owner || !empty($params['institution']) && $params['institution'] != $b->institution) {
if ($b->owner) {
$ownername = display_default_name($viewdata[$b->view]['user']);
$ownerurl = profile_url($viewdata[$b->view]['user']);
} else {
if ($b->group) {
$ownername = $viewdata[$b->view]['groupdata']['name'];
$ownerurl = group_homepage_url($viewdata[$b->view]['groupdata']);
} else {
if ($b->institution == 'mahara') {
$ownername = get_config('sitename');
} else {
$ownername = $b->institutionname;
$ownerurl = get_config('wwwroot') . 'institution/index.php?institution=' . $b->institution;
}
}
}
$data[$b->artefact]->views[$b->view]['ownername'] = $ownername;
$data[$b->artefact]->views[$b->view]['ownerurl'] = $ownerurl;
}
}
if (!isset($data[$b->artefact]->blocks)) {
$data[$b->artefact]->blocks = array();
示例15: switch
$page = 1;
}
$offset = ($page - 1) * $limit;
switch ($type) {
case 'friend':
$data = search_user($query, $limit, $offset, array('exclude' => $USER->get('id'), 'friends' => true));
break;
case 'user':
$data = search_user($query, $limit, $offset, array('exclude' => $USER->get('id')));
break;
case 'group':
require_once 'group.php';
$data = search_group($query, $limit, $offset, '');
$roles = get_records_array('grouptype_roles');
$data['roles'] = array();
foreach ($roles as $r) {
$data['roles'][$r->grouptype][] = array('name' => $r->role, 'display' => get_string($r->role, 'grouptype.' . $r->grouptype));
}
foreach ($data['data'] as &$r) {
$r->url = group_homepage_url($r);
}
break;
default:
$data = search_user($query, $limit, $offset, array('exclude' => $USER->get('id'), 'friends' => true));
break;
}
$more = $data['count'] > $limit * $page;
$data['error'] = false;
$data['message'] = '';
$data['more'] = $more;
json_reply(false, $data);