本文整理汇总了PHP中profile_url函数的典型用法代码示例。如果您正苦于以下问题:PHP profile_url函数的具体用法?PHP profile_url怎么用?PHP profile_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了profile_url函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: invitetogroup_submit
function invitetogroup_submit(Pieform $form, $values)
{
global $SESSION, $USER, $group, $user;
group_invite_user($group, $user->id, $USER, isset($values['role']) ? $values['role'] : null);
$SESSION->add_ok_msg(get_string('userinvited', 'group'));
redirect(profile_url($user));
}
示例2: requestfriendship_submit
function requestfriendship_submit(Pieform $form, $values)
{
global $USER, $SESSION, $id, $goto;
$loggedinid = $USER->get('id');
$user = get_record('usr', 'id', $id);
// friend db record
$f = new StdClass();
$f->ctime = db_format_timestamp(time());
// notification info
$n = new StdClass();
$n->url = profile_url($USER, false);
$n->users = array($user->id);
$n->fromuser = $loggedinid;
$lang = get_user_language($user->id);
$displayname = display_name($USER, $user);
$n->strings = new stdClass();
$n->strings->urltext = (object) array('key' => 'Requests');
$f->owner = $id;
$f->requester = $loggedinid;
$f->message = $values['message'];
insert_record('usr_friend_request', $f);
$n->subject = get_string_from_language($lang, 'requestedfriendlistsubject', 'group');
if (isset($values['message']) && !empty($values['message'])) {
$n->message = get_string_from_language($lang, 'requestedfriendlistmessageexplanation', 'group', $displayname) . $values['message'];
} else {
$n->message = get_string_from_language($lang, 'requestedfriendlistinboxmessage', 'group', $displayname);
}
require_once 'activity.php';
activity_occurred('maharamessage', $n);
handle_event('addfriendrequest', array('requester' => $loggedinid, 'owner' => $id));
$SESSION->add_ok_msg(get_string('friendformrequestsuccess', 'group', display_name($id)));
redirect($goto);
}
示例3: render_instance
public static function render_instance(BlockInstance $instance, $editing = false)
{
global $USER;
require_once get_config('docroot') . 'lib/view.php';
$configdata = $instance->get('configdata');
// this will make sure to unserialize it for us
$configdata['viewid'] = $instance->get('view');
$view = new View($configdata['viewid']);
$group = $view->get('group');
$result = '';
$artefactid = isset($configdata['artefactid']) ? $configdata['artefactid'] : null;
if ($artefactid) {
$artefact = $instance->get_artefact_instance($configdata['artefactid']);
if (!file_exists($artefact->get_path())) {
return '';
}
$urlbase = get_config('wwwroot');
// edit view doesn't use subdomains, neither do groups
if (get_config('cleanurls') && get_config('cleanurlusersubdomains') && !$editing && empty($group)) {
$viewauthor = new User();
$viewauthor->find_by_id($view->get('owner'));
$viewauthorurlid = $viewauthor->get('urlid');
if ($urlallowed = !is_null($viewauthorurlid) && strlen($viewauthorurlid)) {
$urlbase = profile_url($viewauthor) . '/';
}
}
// Send the current language to the pdf viewer
$language = current_language();
$language = str_replace('_', '-', substr($language, 0, substr_count($language, '_') > 0 ? 5 : 2));
if ($language != 'en' && !file_exists(get_config('docroot') . 'artefact/file/blocktype/pdf/js/pdfjs/web/locale/' . $language . '/viewer.properties')) {
// In case the language file exists as a string with both lower and upper case, eg fr_FR we test for this
$language = substr($language, 0, 2) . '-' . strtoupper(substr($language, 0, 2));
if (!file_exists(get_config('docroot') . 'artefact/file/blocktype/pdf/js/pdfjs/web/locale/' . $language . '/viewer.properties')) {
// In case we fail to find a language of 5 chars, eg pt_BR (Portugese, Brazil) we try the 'parent' pt (Portugese)
$language = substr($language, 0, 2);
if ($language != 'en' && !file_exists(get_config('docroot') . 'artefact/file/blocktype/pdf/js/pdfjs/web/locale/' . $language . '/viewer.properties')) {
$language = 'en-GB';
}
}
}
$result = '<iframe src="' . $urlbase . 'artefact/file/blocktype/pdf/viewer.php?editing=' . $editing . '&ingroup=' . !empty($group) . '&file=' . $artefactid . '&lang=' . $language . '&view=' . $instance->get('view') . '" width="100%" height="500" frameborder="0"></iframe>';
require_once get_config('docroot') . 'artefact/comment/lib.php';
require_once get_config('docroot') . 'lib/view.php';
$view = new View($configdata['viewid']);
list($commentcount, $comments) = ArtefactTypeComment::get_artefact_comments_for_view($artefact, $view, $instance->get('id'), true, $editing);
}
$smarty = smarty_core();
if ($artefactid) {
$smarty->assign('commentcount', $commentcount);
$smarty->assign('comments', $comments);
}
$smarty->assign('html', $result);
return $smarty->fetch('blocktype:pdf:pdfrender.tpl');
}
示例4: search_user
/**
* Given a query string and limits, return an array of matching users using the
* search plugin defined in config.php
*
* @param string The query string
* @param integer How many results to return
* @param integer What result to start at (0 == first result)
* @return array A data structure containing results looking like ...
* $results = array(
* count => integer, // total number of results
* limit => integer, // how many results are returned
* offset => integer, // starting from which result
* results => array( // the result records
* array(
* id => integer,
* username => string,
* institution => string,
* firstname => string,
* lastname => string,
* preferredname => string,
* email => string,
* ),
* array(
* id => integer,
* username => string,
* institution => string,
* firstname => string,
* lastname => string,
* preferredname => string,
* email => string,
* ),
* array(...),
* ),
* );
*/
function search_user($query_string, $limit, $offset = 0, $data = array())
{
$plugin = get_config('searchplugin');
safe_require('search', $plugin);
$results = call_static_method(generate_class_name('search', $plugin), 'search_user', $query_string, $limit, $offset, $data);
if ($results['data']) {
foreach ($results['data'] as &$result) {
$result['name'] = display_name($result);
$result['url'] = profile_url($result);
}
}
return $results;
}
示例5: do_masquerade
/**
* Notify user (if configured), do the masquerading and emit event. Called when
* no (further) interaction with the admin is needed before the loginas.
*
* @param string $why The masquerading reason (if given) or null.
*/
function do_masquerade($why = null)
{
global $USER, $SESSION;
$id = param_integer('id');
$who = display_name($USER, $id);
$when = format_date(time());
if (get_config('masqueradingnotified')) {
$msg = (object) array('subject' => get_string('masqueradenotificationsubject', 'admin'), 'message' => $why === null ? get_string('masqueradenotificationnoreason', 'admin', $who, $when) : get_string('masqueradenotificationreason', 'admin', $who, $when, $why), 'users' => array($id), 'url' => profile_url($USER, false), 'urltext' => $who);
activity_occurred('maharamessage', $msg);
$SESSION->add_info_msg(get_string('masqueradenotificationdone', 'admin'));
}
$USER->change_identity_to($id);
// Permissions checking is done in here
handle_event('loginas', array('who' => $who, 'when' => $when, 'reason' => $why));
redirect(get_config('wwwroot'));
}
示例6: denyrequest_submit
function denyrequest_submit(Pieform $form, $values)
{
global $USER, $SESSION, $id;
$loggedinid = $USER->get('id');
$user = get_record('usr', 'id', $id);
// friend db record
$f = new StdClass();
$f->ctime = db_format_timestamp(time());
// notification info
$n = new StdClass();
$n->url = profile_url($USER, false);
$n->users = array($user->id);
$n->fromuser = $USER->get('id');
$lang = get_user_language($user->id);
$displayname = display_name($USER, $user);
$n->urltext = $displayname;
delete_records('usr_friend_request', 'owner', $loggedinid, 'requester', $id);
$n->subject = get_string_from_language($lang, 'friendrequestrejectedsubject', 'group');
if (isset($values['reason']) && !empty($values['reason'])) {
$n->message = get_string_from_language($lang, 'friendrequestrejectedmessagereason', 'group', $displayname) . $values['reason'];
} else {
$n->message = get_string_from_language($lang, 'friendrequestrejectedmessage', 'group', $displayname);
}
require_once 'activity.php';
activity_occurred('maharamessage', $n);
handle_event('removefriendrequest', array('owner' => $loggedinid, 'requester' => $id));
$SESSION->add_ok_msg(get_string('friendformrejectsuccess', 'group'));
$offset = param_integer('offset', 0);
switch (param_alpha('returnto', 'myfriends')) {
case 'find':
$goto = 'user/find.php';
break;
case 'view':
$goto = profile_url($user, false);
break;
default:
$goto = 'user/myfriends.php';
break;
}
$goto .= strpos($goto, '?') ? '&offset=' . $offset : '?offset=' . $offset;
$goto = get_config('wwwroot') . $goto;
redirect($goto);
}
示例7: Contacts
public function Contacts()
{
$time = time() - 60 * 2;
$sql = "SELECT t.id_user as id, t.name as name, t.lastname as lastname, a.company as company, a.id_company as idcompany, t.connection,\n IF(t.id_file, t.id_file, a.id_file) as pictureid, IF(t.id_file, f.file, f2.file) as picture, IF(a.id_company = '{$this->MApp->user->company}', 0, 1) as companyu\n FROM {$this->dbglobal}user as t \n LEFT JOIN {$this->dbglobal}company a on t.id_company = a.id_company\n LEFT JOIN {$this->dbglobal}company_relation cr on t.id_company = cr.id_relation\n left join {$this->dbglobal}nz_file f on f.id_file = t.id_file\n left join {$this->dbglobal}nz_file f2 on f2.id_file = a.id_file\n WHERE t.id_user != '{$this->MApp->user->id}' and t.active = '1' and t.valid = '1' and (cr.id_company = '{$this->MApp->user->company}' OR t.id_company = '{$this->MApp->user->company}' )\n ORDER BY companyu, a.company, t.name, t.lastname";
$users = $this->db->query($sql)->result();
foreach ($users as $key => $user) {
$user->status = $this->ContactStatus($user->connection);
unset($users[$key]->companyu);
$user->opened = round($this->session->userdata('udata-user-chat-' . $user->id));
$user->size = round($this->session->userdata('udata-user-chat-' . $user->id . '-size'));
if ($user->pictureid) {
$users[$key]->picture = profile_url($user->pictureid, $user->picture);
} else {
$users[$key]->picture = '';
}
unset($users[$key]->pictureid);
}
return $users;
}
示例8: getRecordDataById
public static function getRecordDataById($type, $id)
{
$sql = 'SELECT p1.id, p1.topic, p1.parent, p1.poster, COALESCE(p1.subject, p2.subject) AS subject, p2.subject,
p1.body, p1.ctime, p1.deleted, p1.sent, p1.path,
u.username, u.preferredname, u.firstname, u.lastname, u.profileicon,
f.title as forumname, f.id as forumid,
g.name as groupname, g.id as groupid
FROM {interaction_forum_post} p1
LEFT JOIN {interaction_forum_post} p2 ON p2.parent IS NULL AND p2.topic = p1.topic
LEFT JOIN {usr} u ON u.id = p1.poster
LEFT JOIN {interaction_forum_topic} ift on p1.topic = ift.id
LEFT JOIN {interaction_instance} f ON ift.forum = f.id AND f.plugin=\'forum\'
LEFT JOIN {group} g ON f.group = g.id
WHERE p1.id = ?';
$record = get_record_sql($sql, array($id));
if (!$record || $record->deleted) {
return false;
}
$record->body = str_replace(array("\r\n", "\n", "\r"), ' ', strip_tags($record->body));
$record->ctime = format_date(strtotime($record->ctime));
$record->authorlink = '<a href="' . profile_url($record->poster) . '" class="forumuser">' . display_name($record->poster, null, true) . '</a>';
return $record;
}
示例9: build_html
public static function build_html(&$data, $onview)
{
global $USER, $THEME;
$candelete = $data->canedit || $USER->get('admin');
$deletedmessage = array();
foreach (ArtefactTypeAnnotationfeedback::deleted_by_types_description() as $k => $v) {
$deletedmessage[$k] = get_string($v, 'artefact.annotation');
}
$authors = array();
$lastcomment = self::last_public_annotation_feedback($data->annotation, $data->view, $data->artefact);
$editableafter = time() - 60 * get_config_plugin('artefact', 'annotation', 'commenteditabletime');
foreach ($data->data as &$item) {
$isadminfeedback = $item->admin == 1 || $item->staff == 1 || $item->feedbackinstitutionadmin == 1 || $item->feedbackinstitutionstaff == 1;
$item->ts = strtotime($item->ctime);
$item->date = format_date($item->ts, 'strftimedatetime');
if ($item->ts < strtotime($item->lastcontentupdate)) {
$item->updated = format_date(strtotime($item->lastcontentupdate), 'strftimedatetime');
}
$item->isauthor = $item->author && $item->author == $USER->get('id');
if ($item->private) {
$item->pubmessage = get_string('annotationfeedbackisprivate', 'artefact.annotation');
}
if (isset($data->showcomment) && $data->showcomment == $item->id) {
$item->highlight = 1;
}
$is_export_preview = param_integer('export', 0);
if ($item->deletedby) {
$item->deletedmessage = $deletedmessage[$item->deletedby];
} else {
if (($candelete || $item->isauthor) && !$is_export_preview && !$isadminfeedback) {
// If the auther was admin/staff and not the owner of the annotation,
// the feedback can't be deleted.
$item->deleteform = pieform(self::delete_annotation_feedback_form($data->annotation, $data->view, $data->artefact, $data->block, $item->id));
}
}
// Comment authors can edit recent comments if they're private or if no one has replied yet.
if (!$item->deletedby && $item->isauthor && !$is_export_preview && ($item->private || $item->id == $lastcomment->id) && $item->ts > $editableafter) {
$item->canedit = 1;
}
// Form to make private comment public, or request that a
// private comment be made public.
if (!$item->deletedby && $item->private && $item->author && $data->owner && ($item->isauthor || $data->isowner)) {
if (empty($item->requestpublic) && $data->isowner || $item->isauthor && $item->requestpublic == 'owner' || $data->isowner && $item->requestpublic == 'author') {
if (!$is_export_preview) {
$item->makepublicform = pieform(self::make_annotation_feedback_public_form($data->annotation, $data->view, $data->artefact, $data->block, $item->id));
}
} else {
if ($item->isauthor && $item->requestpublic == 'author' || $data->isowner && $item->requestpublic == 'owner') {
$item->makepublicrequested = 1;
}
}
} else {
if (!$item->deletedby && $item->private && !$item->author && $data->owner && $data->isowner && $item->requestpublic == 'author' && !$is_export_preview) {
$item->makepublicform = pieform(self::make_annotation_feedback_public_form($data->annotation, $data->view, $data->artefact, $data->block, $item->id));
} else {
if (!$item->deletedby && $item->private && !$data->owner && $item->group && $item->requestpublic == 'author') {
// no owner as comment is on a group view / artefact
if ($item->isauthor) {
$item->makepublicrequested = 1;
} else {
if ($data->artefact && $data->canedit || $data->view && $data->canedit && !$is_export_preview) {
$item->makepublicform = pieform(self::make_annotation_feedback_public_form($data->annotation, $data->view, $data->artefact, $data->block, $item->id));
} else {
$item->makepublicrequested = 1;
}
}
}
}
}
if ($item->author) {
if (isset($authors[$item->author])) {
$item->author = $authors[$item->author];
} else {
$item->author = $authors[$item->author] = (object) array('id' => $item->author, 'username' => $item->username, 'firstname' => $item->firstname, 'lastname' => $item->lastname, 'preferredname' => $item->preferredname, 'email' => $item->email, 'staff' => $item->staff, 'admin' => $item->admin, 'deleted' => $item->deleted, 'profileicon' => $item->profileicon, 'profileurl' => profile_url($item->author));
}
}
}
$extradata = array('annotation' => $data->annotation, 'view' => $data->view, 'artefact' => !empty($data->artefact) ? $data->artefact : '', 'blockid' => $data->block);
$data->jsonscript = 'artefact/annotation/annotations.json.php';
$data->baseurl = get_config('wwwroot') . 'artefact/artefact.php?' . 'artefact=' . $data->annotation . '&view=' . $data->view . (isset($data->block) ? '&block=' . $data->block : '');
$smarty = smarty_core();
$smarty->assign_by_ref('data', $data->data);
$smarty->assign('canedit', $data->canedit);
$smarty->assign('viewid', $data->view);
$smarty->assign('position', $data->position);
$smarty->assign('baseurl', $data->baseurl);
$data->tablerows = $smarty->fetch('artefact:annotation:annotationlist.tpl');
$pagination = build_pagination(array('id' => 'annotationfeedback_pagination_' . $data->block, 'class' => 'center', 'url' => $data->baseurl, 'jsonscript' => $data->jsonscript, 'datatable' => 'annotationfeedbacktable_' . $data->block, 'count' => $data->count, 'limit' => $data->limit, 'offset' => $data->offset, 'forceoffset' => isset($data->forceoffset) ? $data->forceoffset : null, 'resultcounttextsingular' => get_string('annotation', 'artefact.annotation'), 'resultcounttextplural' => get_string('annotations', 'artefact.annotation'), 'extradata' => $extradata));
$data->pagination = $pagination['html'];
$data->pagination_js = $pagination['javascript'];
}
示例10: get_views_and_collections
/**
* Get all views for a (user,group,institution), grouping views
* into their collections. Empty collections not returned.
*
* @param mixed $owner integer userid or array of userids
* @param mixed $group integer groupid or array of groupids
* @param mixed $institution string institution name or array of institution names
* @param string $matchconfig record all matches with given config hash (see set_access)
* @param boolean $includeprofile include profile view
* @param integer $submittedgroup return only views & collections submitted to this group
* @param $string $sort Order to sort by (defaults to 'c.name, v.title')
*
* @return array, array
*/
function get_views_and_collections($owner = null, $group = null, $institution = null, $matchconfig = null, $includeprofile = true, $submittedgroup = null, $sort = null)
{
$excludelocked = $group && group_user_access($group) != 'admin';
// Anonymous public viewing of a group with 'Allow submissions' checked needs to avoid including the dummy root profile page.
if ($owner == '0') {
$includeprofile = false;
}
$sql = "\n SELECT v.id, v.type, v.title, v.accessconf, v.ownerformat, v.startdate, v.stopdate, v.template,\n v.owner, v.group, v.institution, v.urlid, v.submittedgroup, v.submittedhost, " . db_format_tsfield('v.submittedtime', 'submittedtime') . ", v.submittedstatus,\n c.id AS cid, c.name AS cname,\n c.submittedgroup AS csubmitgroup, c.submittedhost AS csubmithost, " . db_format_tsfield('c.submittedtime', 'csubmittime') . ", c.submittedstatus AS csubmitstatus\n FROM {view} v\n LEFT JOIN {collection_view} cv ON v.id = cv.view\n LEFT JOIN {collection} c ON cv.collection = c.id\n WHERE v.type IN ('portfolio'";
$sql .= $includeprofile ? ", 'profile') " : ') ';
$sql .= $excludelocked ? 'AND v.locked != 1 ' : '';
if (is_null($owner) && is_null($group) && is_null($institution)) {
$values = array();
} else {
list($ownersql, $values) = self::multiple_owner_sql((object) array('owner' => $owner, 'group' => $group, 'institution' => $institution));
$sql .= "AND v.{$ownersql} ";
}
if ($submittedgroup) {
$sql .= 'AND v.submittedgroup = ? ';
$values[] = (int) $submittedgroup;
}
if ($sort == null) {
$sql .= 'ORDER BY c.name, v.title';
} else {
$sql .= "ORDER BY {$sort}";
}
$records = get_records_sql_assoc($sql, $values);
$collections = array();
$views = array();
if (!$records) {
return array($collections, $views);
}
self::get_extra_view_info($records, false, false);
foreach ($records as &$r) {
$vid = $r['id'];
$cid = $r['cid'];
$v = array('id' => $vid, 'type' => $r['type'], 'name' => $r['displaytitle'], 'url' => $r['fullurl'], 'startdate' => $r['startdate'], 'stopdate' => $r['stopdate'], 'template' => $r['template'], 'owner' => $r['owner'], 'submittedgroup' => $r['submittedgroup'], 'submittedhost' => $r['submittedhost'], 'submittedtime' => $r['submittedtime'], 'submittedstatus' => $r['submittedstatus']);
if (isset($r['user'])) {
$v['ownername'] = display_name($r['user']);
$v['ownerurl'] = profile_url($r['user']);
}
// If filtering by submitted views, and the view is submitted, but the collection isn't,
// then ignore the collection and return the view by itself.
if ($cid && (!$submittedgroup || $r['csubmitgroup'] == $r['submittedgroup'])) {
if (!isset($collections[$cid])) {
$collections[$cid] = array('id' => $cid, 'name' => $r['cname'], 'url' => $r['fullurl'], 'owner' => $r['owner'], 'group' => $r['group'], 'institution' => $r['institution'], 'submittedgroup' => $r['csubmitgroup'], 'submittedhost' => $r['csubmithost'], 'submittedtime' => $r['csubmittime'], 'submittedstatus' => $r['csubmitstatus'], 'template' => $r['template'], 'views' => array());
if (isset($r['user'])) {
$collections[$cid]['ownername'] = $v['ownername'];
$collections[$cid]['ownerurl'] = $v['ownerurl'];
}
if ($matchconfig && $matchconfig == $r['accessconf']) {
$collections[$cid]['match'] = true;
}
}
$collections[$cid]['views'][$vid] = $v;
} else {
$views[$vid] = $v;
if ($matchconfig && $matchconfig == $r['accessconf']) {
$views[$vid]['match'] = true;
}
}
}
return array($collections, $views);
}
示例11: get_htmlmessage
public function get_htmlmessage($user)
{
$viewtitle = hsc($this->view->get('title'));
$reportername = hsc(display_default_name($this->reporter));
$reporterurl = profile_url($this->reporter);
$ctime = strftime(get_string_from_language($user->lang, 'strftimedaydatetime'), $this->ctime);
$message = hsc($this->message);
if (empty($this->artefact)) {
return get_string_from_language($user->lang, 'objectionablecontentviewhtml', 'activity', $viewtitle, $reportername, $ctime, $message, $this->view->get_url(), $viewtitle, $reporterurl, $reportername);
} else {
return get_string_from_language($user->lang, 'objectionablecontentviewartefacthtml', 'activity', $viewtitle, hsc($this->artefact->get('title')), $reportername, $ctime, $message, $this->view->get_url(), $viewtitle, $reporterurl, $reportername);
}
}
示例12: define
define('PUBLIC', 1);
require dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/init.php';
require_once get_config('docroot') . '/artefact/lib.php';
$fileid = param_integer('file');
$viewid = param_integer('view');
$editing = param_boolean('editing', false);
$ingroup = param_boolean('ingroup', false);
if (!artefact_in_view($fileid, $viewid)) {
throw new AccessDeniedException('');
}
if (!can_view_view($viewid)) {
throw new AccessDeniedException('');
}
$file = artefact_instance_from_id($fileid);
if (!$file instanceof ArtefactTypeFile) {
throw new NotFoundException();
}
$urlbase = get_config('wwwroot');
if (get_config('cleanurls') && get_config('cleanurlusersubdomains') && !$editing && !$ingroup) {
$view = new View($viewid);
$viewauthor = new User();
$viewauthor->find_by_id($view->get('owner'));
$viewauthorurlid = $viewauthor->get('urlid');
if ($urlallowed = !is_null($viewauthorurlid) && strlen($viewauthorurlid)) {
$urlbase = profile_url($viewauthor) . '/';
}
}
$smarty = smarty();
$smarty->assign('url', $urlbase . 'artefact/file/download.php?file=' . $fileid . '&view=' . $viewid);
$smarty->assign('title', $file->get('title'));
$smarty->display('blocktype:pdf:pdf.tpl');
示例13: artefact_get_owner_info
/**
* Given a list of artefact ids, return a name and url for the thing that
* owns each artefact, suitable for display.
*
* @param array $ids list of artefact ids
*
* @return array list of StdClass objects, each containing a name & url property
*/
function artefact_get_owner_info($ids)
{
$data = get_records_sql_assoc('
SELECT
a.id AS aid, a.owner, a.group, a.institution,
u.id, u.username, u.firstname, u.lastname, u.preferredname, u.email, u.urlid,
g.name AS groupname, g.urlid as groupurlid,
i.displayname
FROM
{artefact} a
LEFT JOIN {usr} u ON a.owner = u.id
LEFT JOIN {group} g ON a.group = g.id
LEFT JOIN {institution} i ON a.institution = i.name
WHERE
a.id IN (' . join(',', array_fill(0, count($ids), '?')) . ')', $ids);
$wwwroot = get_config('wwwroot');
foreach ($data as &$d) {
if ($d->institution == 'mahara') {
$name = get_config('sitename');
$url = $wwwroot;
} else {
if ($d->institution) {
$name = $d->displayname;
$url = $wwwroot . 'institution/index.php?institution=' . $d->institution;
} else {
if ($d->group) {
$name = $d->groupname;
$url = group_homepage_url((object) array('id' => $d->group, 'urlid' => $d->groupurlid));
} else {
$name = display_name($d);
$url = profile_url($d);
}
}
}
$d = (object) array('name' => $name, 'url' => $url);
}
return $data;
}
示例14: array
$template->assign_block_vars('switch_no_members', array());
}
// No group members
if ($group_info['group_type'] == GROUP_HIDDEN && !$is_group_member && !$is_moderator) {
$template->assign_block_vars('switch_hidden_group', array());
}
// Pending
if ($is_moderator) {
$modgroup_pending_list = DB()->fetch_rowset("\n\t\t\t\t\tSELECT u.username, u.avatar_ext_id, u.user_rank, u.user_id, u.user_opt, u.user_posts, u.user_regdate, u.user_from, u.user_website, u.user_email\n\t\t\t\t\tFROM " . BB_USER_GROUP . " ug, " . BB_USERS . " u\n\t\t\t\t\tWHERE ug.group_id = {$group_id}\n\t\t\t\t\t\tAND ug.user_pending = 1\n\t\t\t\t\t\tAND u.user_id = ug.user_id\n\t\t\t\t\tORDER BY u.username\n\t\t\t\t\tLIMIT 200\n\t\t\t\t");
$modgroup_pending_count = count($modgroup_pending_list);
}
if ($is_moderator && $modgroup_pending_list) {
foreach ($modgroup_pending_list as $i => $member) {
$user_id = $member['user_id'];
generate_user_info($member, $bb_cfg['default_dateformat'], $is_moderator, $from, $posts, $joined, $pm, $email, $www, $user_time, $avatar);
$row_class = !($i % 2) ? 'row1' : 'row2';
$user_select = '<input type="checkbox" name="member[]" value="' . $user_id . '">';
$template->assign_block_vars('pending', array('ROW_CLASS' => $row_class, 'AVATAR_IMG' => $avatar, 'USER' => profile_url($member), 'FROM' => $from, 'JOINED' => $joined, 'POSTS' => $posts, 'USER_ID' => $user_id, 'PM' => $pm, 'EMAIL' => $email));
}
$template->assign_vars(array('PENDING_USERS' => true));
}
$template->assign_vars(array('MEMBERS' => true));
}
if ($is_moderator) {
$template->assign_block_vars('switch_mod_option', array());
$template->assign_block_vars('switch_add_member', array());
}
}
}
}
print_page('group.tpl');
示例15: get_myskins_data
/**
* Returns data about available skins. Tightly coupled with view/skin.php, which uses it to
* display the skins picker
* @param int $limit
* @param int $offset
* @param string $filter Should be: all, public, user, or site
* @return object
*/
public static function get_myskins_data($limit = 9, $offset = 0, $filter = 'all')
{
global $USER;
$userid = $USER->get('id');
$owner = null;
$favorites = get_field('skin_favorites', 'favorites', 'user', $userid);
$favorites = unserialize($favorites);
if (!is_array($favorites)) {
$favorites = array();
}
$sort = 'title, id';
$cols = 'id, title, description, owner, type, ctime, mtime';
switch ($filter) {
case 'public':
$count = count_records('skin', 'type', 'public');
$skindata = get_records_array('skin', 'type', 'public', $sort, $cols, $offset, $limit);
break;
case 'user':
$count = count_records_select('skin', 'owner = ? and type != ?', array($userid, 'site'));
$skindata = get_records_select_array('skin', 'owner = ? and type != ?', array($userid, 'site'), $sort, $cols, $offset, $limit);
break;
case 'site':
$count = count_records('skin', 'type', 'site');
$skindata = get_records_array('skin', 'type', 'site', $sort, $cols, $offset, $limit);
break;
default:
$count = count_records_select('skin', 'owner = ? or type in (?, ?)', array($userid, 'site', 'public'));
$skindata = get_records_select_array('skin', 'owner = ? or type in (?, ?)', array($userid, 'site', 'public'), $sort, $cols, $offset, $limit);
break;
}
$data = array();
if ($skindata) {
for ($i = 0; $i < count($skindata); $i++) {
$skinobj = new Skin(0, $skindata[$i]);
$index[$skindata[$i]->id] = $i;
$data[$i]['id'] = $skindata[$i]->id;
$data[$i]['title'] = $skindata[$i]->title;
$data[$i]['owner'] = $skindata[$i]->owner;
$data[$i]['type'] = $skindata[$i]->type;
if ($skinobj->can_edit()) {
$data[$i]['removable'] = true;
$data[$i]['editable'] = true;
}
if (in_array($skindata[$i]->id, $favorites)) {
$data[$i]['favorite'] = true;
} else {
$data[$i]['favorite'] = false;
}
$owner = new User();
$owner->find_by_id($skindata[$i]->owner);
$data[$i]['metadata'] = array('displayname' => display_name($owner), 'profileurl' => profile_url($owner), 'description' => nl2br($skindata[$i]->description), 'ctime' => format_date(strtotime($skindata[$i]->ctime)), 'mtime' => format_date(strtotime($skindata[$i]->mtime)));
}
}
return (object) array('data' => $data, 'count' => $count);
}