本文整理汇总了PHP中param_variable函数的典型用法代码示例。如果您正苦于以下问题:PHP param_variable函数的具体用法?PHP param_variable怎么用?PHP param_variable使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了param_variable函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: handleredirect
/**
* Handle requests to the redirect URL.
*
* @return mixed Determined by loginflow.
*/
public function handleredirect()
{
$state = param_variable('state', null);
$promptlogin = (bool) param_variable('promptlogin', 0);
if (!empty($state)) {
// Response from OP.
$this->handleauthresponse($_REQUEST);
} else {
// Initial login request.
$this->initiateauthrequest($promptlogin, array('forceflow' => 'authcode'));
}
}
开发者ID:remotelearner,项目名称:mahara-auth_oidc,代码行数:17,代码来源:authcode.php
示例2: delete_all_notifications_submit
function delete_all_notifications_submit()
{
global $USER, $SESSION;
$userid = $USER->get('id');
$type = param_variable('type', 'all');
$typesql = '';
if ($type != 'all') {
// Treat as comma-separated list of activity type names
$types = explode(',', preg_replace('/[^a-z,]+/', '', $type));
if ($types) {
$typesql = ' at.name IN (' . join(',', array_map('db_quote', $types)) . ')';
if (in_array('adminmessages', $types)) {
$typesql = '(' . $typesql . ' OR at.admin = 1)';
}
$typesql = ' AND ' . $typesql;
}
}
$from = "\n FROM {notification_internal_activity} a\n JOIN {activity_type} at ON a.type = at.id\n WHERE a.usr = ? {$typesql}";
$values = array($userid);
db_begin();
$count = 0;
$records = get_records_sql_array('SELECT a.id ' . $from, $values);
if ($records) {
$count = sizeof($records);
$ids = array();
foreach ($records as $row) {
$ids[] = $row->id;
}
// Remove parent pointers to messages we're about to delete
execute_sql('
UPDATE {notification_internal_activity}
SET parent = NULL
WHERE parent IN (
' . join(',', array_map('db_quote', $ids)) . '
)');
// delete
execute_sql('
DELETE FROM {notification_internal_activity}
WHERE id IN (
' . join(',', array_map('db_quote', $ids)) . '
)');
// The update_unread_delete db trigger on notification_internal_activity
// will update the unread column on the usr table.
}
db_commit();
$SESSION->add_ok_msg(get_string('deletednotifications1', 'activity', $count));
safe_require('module', 'multirecipientnotification');
if (PluginModuleMultirecipientnotification::is_active()) {
redirect(get_config('wwwroot') . 'module/multirecipientnotification/inbox.php?type=' . $type);
} else {
redirect(get_config('wwwroot') . 'account/activity/index.php?type=' . $type);
}
}
开发者ID:patkira,项目名称:mahara,代码行数:53,代码来源:index.php
示例3: render_instance
public static function render_instance(BlockInstance $instance, $editing = false)
{
global $USER;
if ($editing) {
$smarty = smarty_core();
$smarty->assign('editing', get_string('ineditordescription1', 'blocktype.comment/comment'));
$html = $smarty->fetch('blocktype:comment:comment.tpl');
return $html;
}
// Feedback list pagination requires limit/offset params
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$showcomment = param_integer('showcomment', null);
// Create the "make feedback private form" now if it's been submitted
if (param_variable('make_public_submit', null)) {
pieform(ArtefactTypeComment::make_public_form(param_integer('comment')));
} else {
if (param_variable('delete_comment_submit_x', null)) {
pieform(ArtefactTypeComment::delete_comment_form(param_integer('comment')));
}
}
$view = new View($instance->get('view'));
$submittedgroup = (int) $view->get('submittedgroup');
if ($USER->is_logged_in() && $submittedgroup && group_user_can_assess_submitted_views($submittedgroup, $USER->get('id'))) {
$releaseform = true;
} else {
$releaseform = false;
}
// If the view has comments turned off, tutors can still leave
// comments if the view is submitted to their group.
if (!empty($releaseform) || $view->user_comments_allowed($USER)) {
$addfeedbackpopup = true;
}
safe_require('artefact', 'comment');
$commentoptions = ArtefactTypeComment::get_comment_options();
$commentoptions->limit = $limit;
$commentoptions->offset = $offset;
$commentoptions->showcomment = $showcomment;
$commentoptions->view = $instance->get_view();
$feedback = ArtefactTypeComment::get_comments($commentoptions);
$smarty = smarty_core();
$smarty->assign('feedback', $feedback);
if (isset($addfeedbackpopup)) {
$smarty->assign('enablecomments', 1);
$smarty->assign('addfeedbackpopup', $addfeedbackpopup);
}
$html = $smarty->fetch('blocktype:comment:comment.tpl');
return $html;
}
开发者ID:kienv,项目名称:mahara,代码行数:49,代码来源:lib.php
示例4: search_submit
function search_submit(Pieform $form, $values)
{
// Convert (query,type) parameters from form to (query,tag)
global $queryparams, $tag, $query, $share;
if (isset($queryparams['query'])) {
unset($queryparams['query']);
$query = null;
}
if (isset($queryparams['tag'])) {
unset($queryparams['tag']);
$tag = null;
}
if (isset($values['query']) && $values['query'] != '') {
if ($values['type'] == 'tagsonly') {
$queryparams['tag'] = $tag = $values['query'];
} else {
$queryparams['query'] = $query = $values['query'];
}
}
$share = $queryparams['share'] = param_variable('share', array());
}
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:21,代码来源:sharedviews.php
示例5: render_instance
public static function render_instance(BlockInstance $instance, $editing = false)
{
require_once get_config('docroot') . 'artefact/lib.php';
global $USER;
$smarty = smarty_core();
$filter = param_alpha('filter', 'canjoin');
$query = param_variable('query', '');
// check that the filter is valid, if not default to 'all'
if (in_array($filter, array('member', 'notmember', 'canjoin'))) {
$type = $filter;
} else {
// all or some other text
$filter = 'all';
$type = 'all';
}
$filter_elements = array();
$filter_elements['query'] = array('title' => get_string('search'), 'defaultvalue' => $query);
$filter_elements['filter'] = array('title' => get_string('filter'), 'options' => array('canjoin' => get_string('groupsicanjoin', 'group'), 'notmember' => get_string('groupsnotin', 'group'), 'member' => get_string('groupsimin', 'group'), 'all' => get_string('allgroups', 'group')), 'defaultvalue' => $filter);
$filter_elements['search'] = array('type' => 'submit', 'value' => get_string('search'));
$smarty->assign('filter_elements', $filter_elements);
return $smarty->fetch('blocktype:eselmasearchgroup:content.tpl');
}
开发者ID:vohung96,项目名称:mahara,代码行数:22,代码来源:lib.php
示例6: pieform_element_filebrowser_changefolder
function pieform_element_filebrowser_changefolder(Pieform $form, $element, $folder)
{
$owner = $ownerid = $group = $institution = $user = null;
$prefix = $form->get_name() . '_' . $element['name'];
if (isset($element['tabs'])) {
if ($owner = param_variable($prefix . '_owner', null)) {
if ($owner == 'site') {
$owner = 'institution';
$institution = $ownerid = 'mahara';
} else {
if ($ownerid = param_variable($prefix . '_ownerid', null)) {
if ($owner == 'group') {
$group = (int) $ownerid;
} else {
if ($owner == 'institution') {
$institution = $ownerid;
} else {
if ($owner == 'user') {
$user = true;
}
}
}
}
}
}
}
// If changing to a group folder, check whether the user can edit it
if ($g = $owner ? $group : $form->get_property('group')) {
if (!pieform_element_filebrowser_view_group_folder($g, $folder)) {
return array('error' => true, 'message' => get_string('cannotviewfolder', 'artefact.file'));
}
$editgroupfolder = pieform_element_filebrowser_edit_group_folder($g, $folder);
}
return array('error' => false, 'changedfolder' => true, 'folder' => $folder, 'disableedit' => isset($editgroupfolder) && $editgroupfolder == false, 'newlist' => pieform_element_filebrowser_build_filelist($form, $element, $folder, null, $user, $group, $institution), 'newpath' => pieform_element_filebrowser_build_path($form, $element, $folder, $owner, $ownerid));
}
开发者ID:rboyatt,项目名称:mahara,代码行数:35,代码来源:filebrowser.php
示例7: define
* @subpackage artefact-blog
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL
* @copyright (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
*
*/
define('INTERNAL', 1);
define('JSON', 1);
define('PUBLIC', 1);
require dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php';
safe_require('artefact', 'blog');
json_headers();
$id = param_integer('id');
$limit = param_integer('limit', ArtefactTypeBlog::pagination);
$offset = param_integer('offset', 0);
$options = json_decode(param_variable('options'));
$viewid = isset($options->viewid) ? $options->viewid : null;
if ($viewid) {
if (!can_view_view($viewid)) {
throw new AccessDeniedException();
}
} else {
if (!$USER->is_logged_in()) {
throw new AccessDeniedException();
}
if (!$viewid && get_field('artefact', 'owner', 'id', $id) != $USER->get('id')) {
throw new AccessDeniedException();
}
}
list($count, $data) = ArtefactTypeBlogPost::render_posts(FORMAT_ARTEFACT_RENDERFULL, $options, $id, $limit, $offset);
if (!$count) {
开发者ID:Br3nda,项目名称:mahara,代码行数:31,代码来源:blog_renderfull.json.php
示例8: get_data
protected static function get_data($groupid)
{
global $USER;
if (!defined('GROUP')) {
define('GROUP', $groupid);
}
// get the currently requested group
$group = group_current_group();
$group->ctime = strftime(get_string('strftimedate'), $group->ctime);
// if the user isn't logged in an the group isn't public don't show anything
if (!is_logged_in() && !$group->public) {
throw new AccessDeniedException();
}
// find the group administrators
$group->admins = get_column_sql("SELECT \"member\"\n FROM {group_member}\n WHERE \"group\" = ?\n AND \"role\" = 'admin'", array($group->id));
$role = group_user_access($group->id);
$group->role = $role;
// logged in user can do stuff
if (is_logged_in()) {
$afterjoin = param_variable('next', 'view');
if ($role) {
if ($role == 'admin') {
$group->membershiptype = 'admin';
$group->requests = count_records('group_member_request', 'group', $group->id);
} else {
$group->membershiptype = 'member';
}
$group->canleave = group_user_can_leave($group->id);
} else {
if ($group->jointype == 'invite' and $invite = get_record('group_member_invite', 'group', $group->id, 'member', $USER->get('id'))) {
$group->membershiptype = 'invite';
$group->invite = group_get_accept_form('invite', $group->id, $afterjoin);
} else {
if ($group->jointype == 'request' and $request = get_record('group_member_request', 'group', $group->id, 'member', $USER->get('id'))) {
$group->membershiptype = 'request';
} else {
if ($group->jointype == 'open') {
$group->groupjoin = group_get_join_form('joingroup', $group->id, $afterjoin);
}
}
}
}
}
$group->settingsdescription = group_display_settings($group);
if (get_config('allowgroupcategories')) {
$group->categorytitle = $group->category ? get_field('group_category', 'title', 'id', $group->category) : '';
}
$filecounts = ArtefactTypeFileBase::count_user_files(null, $group->id, null);
return array('group' => $group, 'filecounts' => $filecounts);
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:50,代码来源:lib.php
示例9: define
/**
*
* @package mahara
* @subpackage module-multirecipientnotification
* @author David Ballhausen, Tobias Zeuch
* @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('JSON', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once dirname(__FILE__) . '/lib/multirecipientnotification.php';
require_once get_config('docroot') . '/lib/searchlib.php';
global $USER;
$request = param_variable('q');
$page = param_integer('page');
if ($page < 1) {
$page = 1;
}
$usersperpage = 10;
$more = true;
$tmpuser = array();
while ($more && count($tmpuser) < $usersperpage) {
$users = search_user($request, $usersperpage, $usersperpage * ($page - 1));
$more = $users['count'] > $usersperpage * $page;
if (!$users['data']) {
$users['data'] = array();
}
foreach ($users['data'] as $user) {
if (count($tmpuser) >= $usersperpage) {
开发者ID:sarahjcotton,项目名称:mahara,代码行数:31,代码来源:sendmessage.json.php
示例10: get_users_data
/**
* used by user/myfriends.php and user/find.php to get the data (including pieforms etc) for display
* @param $userlist the ids separated by commas
* @return array containing the users in the order from $userlist
*/
function get_users_data($userlist, $getviews = true)
{
global $USER;
// $userlist is only used by build_userlist_html() in this file and is sanitised there
$sql = 'SELECT u.id, u.username, u.preferredname, u.firstname, u.lastname, u.admin, u.staff, u.deleted,
u.profileicon, u.email,
0 AS pending, ap.value AS hidenamepref,
COALESCE((SELECT ap.value FROM {usr_account_preference} ap WHERE ap.usr = u.id AND ap.field = \'messages\'), \'allow\') AS messages,
COALESCE((SELECT ap.value FROM {usr_account_preference} ap WHERE ap.usr = u.id AND ap.field = \'friendscontrol\'), \'auth\') AS friendscontrol,
(SELECT 1 FROM {usr_friend} WHERE ((usr1 = ? AND usr2 = u.id) OR (usr2 = ? AND usr1 = u.id))) AS friend,
(SELECT 1 FROM {usr_friend_request} fr WHERE fr.requester = ? AND fr.owner = u.id) AS requestedfriendship,
(SELECT title FROM {artefact} WHERE artefacttype = \'introduction\' AND owner = u.id) AS introduction,
NULL AS message
FROM {usr} u
LEFT JOIN {usr_account_preference} ap ON (u.id = ap.usr AND ap.field = \'hiderealname\')
WHERE u.id IN (' . $userlist . ')
UNION
SELECT u.id, u.username, u.preferredname, u.firstname, u.lastname, u.admin, u.staff, u.deleted,
u.profileicon, u.email,
1 AS pending, ap.value AS hidenamepref,
COALESCE((SELECT ap.value FROM {usr_account_preference} ap WHERE ap.usr = u.id AND ap.field = \'messages\'), \'allow\') AS messages,
NULL AS friendscontrol,
NULL AS friend,
NULL AS requestedfriendship,
(SELECT title FROM {artefact} WHERE artefacttype = \'introduction\' AND owner = u.id) AS introduction,
message
FROM {usr} u
LEFT JOIN {usr_account_preference} ap ON (u.id = ap.usr AND ap.field = \'hiderealname\')
JOIN {usr_friend_request} fr ON fr.requester = u.id
WHERE fr.owner = ?
AND u.id IN (' . $userlist . ')';
$userid = $USER->get('id');
$data = get_records_sql_assoc($sql, array($userid, $userid, $userid, $userid));
$allowhidename = get_config('userscanhiderealnames');
$showusername = get_config('searchusernames');
foreach ($data as &$record) {
$record->messages = $record->messages == 'allow' || $record->friend && $record->messages == 'friends' || $USER->get('admin') ? 1 : 0;
$record->institutions = get_institution_string_for_user($record->id);
$record->display_name = display_name($record, null, false, !$allowhidename || !$record->hidenamepref, $showusername);
}
if (!$data || !$getviews || !($views = get_views(array_keys($data), null, null))) {
$views = array();
}
if ($getviews) {
$viewcount = array_map('count', $views);
// since php is so special and inconsistent, we can't use array_map for this because it breaks the top level indexes.
$cleanviews = array();
foreach ($views as $userindex => $viewarray) {
$cleanviews[$userindex] = array_slice($viewarray, 0, 5);
// Don't reveal any more about the view than necessary
foreach ($cleanviews as $userviews) {
foreach ($userviews as &$view) {
foreach (array_keys(get_object_vars($view)) as $key) {
if ($key != 'id' && $key != 'title') {
unset($view->{$key});
}
}
}
}
}
}
foreach ($data as $friend) {
if ($getviews && isset($cleanviews[$friend->id])) {
$friend->views = $cleanviews[$friend->id];
}
if ($friend->pending) {
$friend->accept = pieform(array('name' => 'acceptfriend' . $friend->id, 'successcallback' => 'acceptfriend_submit', 'renderer' => 'div', 'autofocus' => 'false', 'elements' => array('submit' => array('type' => 'submit', 'value' => get_string('approverequest', 'group')), 'id' => array('type' => 'hidden', 'value' => $friend->id))));
}
if (!$friend->friend && !$friend->pending && !$friend->requestedfriendship && $friend->friendscontrol == 'auto') {
$friend->makefriend = pieform(array('name' => 'addfriend' . $friend->id, 'successcallback' => 'addfriend_submit', 'renderer' => 'div', 'autofocus' => 'false', 'elements' => array('submit' => array('type' => 'submit', 'value' => get_string('addtofriendslist', 'group')), 'id' => array('type' => 'hidden', 'value' => $friend->id), 'query' => array('type' => 'hidden', 'value' => param_variable('query', '')), 'offset' => array('type' => 'hidden', 'value' => param_integer('offset', 0)))));
}
}
$order = explode(',', $userlist);
$ordereddata = array();
foreach ($order as $id) {
if (isset($data[$id])) {
$ordereddata[] = $data[$id];
}
}
return $ordereddata;
}
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:86,代码来源:user.php
示例11: param_integer
$markasread = param_integer('markasread', 0);
$delete = param_integer('delete', 0);
if ($readone) {
if ('notification_internal_activity' === $table) {
set_field($table, 'read', 1, 'id', $readone, 'usr', $USER->get('id'));
} else {
if ('artefact_multirecipient_notification' === $table) {
mark_as_read_mr(array($readone), $USER->get('id'));
}
}
$unread = $USER->add_unread(-1);
$data = array('newunreadcount' => $unread, 'newimage' => $THEME->get_url($unread ? 'images/newmail.png' : 'images/message.png'));
json_reply(false, array('data' => $data));
}
require_once get_config('libroot') . 'activity.php';
$type = param_variable('type', 'all');
$limit = param_integer('limit', 10);
$offset = param_integer('offset', 0);
$message = false;
if ($markasread) {
$ids = array();
$m = array();
foreach ($_GET as $k => $v) {
if (preg_match('/^unread\\-([a-zA-Z_]+)\\-(\\d+)$/', $k, $m)) {
$table = $m[1];
$ids[$table][] = $m[2];
}
}
foreach ($ids as $table => $idspertable) {
if ($idspertable) {
if ('artefact_multirecipient_notification' === $table) {
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:indexin.json.php
示例12: define
* @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('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'collection');
define('SECTION_PAGE', 'views');
require dirname(dirname(__FILE__)) . '/init.php';
require_once 'pieforms/pieform.php';
require_once 'collection.php';
require_once 'view.php';
$id = param_integer('id');
// view addition/displayorder values
$view = param_integer('view', 0);
$direction = param_variable('direction', '');
$collection = new Collection($id);
if (!$USER->can_edit_collection($collection)) {
throw new AccessDeniedException(get_string('canteditcollection', 'collection'));
}
$sesskey = $USER->get('sesskey');
$inlinejs = '';
if ($accesschanged = $SESSION->get('pageaccesschanged')) {
$alertstr = get_string('viewsaddedaccesschanged', 'collection');
foreach ($accesschanged as $viewid) {
$changedview = new View($viewid);
$alertstr .= " " . json_encode($changedview->get('title')) . ",";
}
$alertstr = substr($alertstr, 0, -1) . '.';
$alertstr = get_string('viewsaddedtocollection1', 'collection', $SESSION->get('pagesadded')) . ' ' . $alertstr;
$inlinejs = <<<EOF
开发者ID:sarahjcotton,项目名称:mahara,代码行数:31,代码来源:views.php
示例13: param_variable
$remove = param_variable('removeuser', null);
$member = param_integer('member', null);
if ($remove && $member) {
// Create the remove user pieform for the user that's being removed.
// The form's submit function will be called as soon as the form
// is generated.
//
// We do this now because the user could be on the 2nd page of
// results, so their remove form might never get generated on
// this page. And also because generating the rest of the page
// would be a waste of time -- the submit function just redirects
// back here.
group_get_removeuser_form($member, $group->id);
}
// Search related stuff for member pager
$query = trim(param_variable('query', ''));
// pagination params
$setlimit = true;
//Enable choosing page size; list of page sizes has been predefined in function build_pagination()
$offset = param_integer('offset', 0);
$limit = param_integer('limit', 10);
// Sort options index and list of sort options
// ORDER BY statements defined in group_user_search function need to be matched
$sortoptions = array('adminfirst' => get_string('adminfirst'), 'nameatoz' => get_string('nameatoz'), 'nameztoa' => get_string('nameztoa'), 'firstjoined' => get_string('firstjoined'), 'lastjoined' => get_string('lastjoined'));
$sortoptionidx = param_alpha('sortoption', 'adminfirst');
if ($membershiptype == 'request') {
array_shift($sortoptions);
$sortoptionidx = param_alpha('sortoption', 'nameatoz');
}
$results = get_group_user_search_results($group->id, $query, $offset, $limit, $membershiptype, null, null, $sortoptionidx);
list($html, $pagination, $count, $offset, $membershiptype) = group_get_membersearch_data($results, $group->id, $query, $membershiptype, $setlimit, $sortoptionidx);
开发者ID:agwells,项目名称:Mahara-1,代码行数:31,代码来源:members.php
示例14: define
* @package mahara
* @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.
*
*/
// NOTE: this JSON script is used by the 'viewacl' element. It could probably
// be moved elsewhere without harm if necessary (e.g. if the 'viewacl' element
// was used in more places
define('INTERNAL', 1);
define('JSON', 1);
require dirname(dirname(__FILE__)) . '/init.php';
require_once 'searchlib.php';
$type = param_variable('type');
$query = param_variable('query', '');
$page = param_integer('page');
$limit = 10;
if ($page < 1) {
$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';
开发者ID:sarahjcotton,项目名称:mahara,代码行数:31,代码来源:access.json.php
示例15: param_alphanumext
$sp = param_alphanumext('as', 'default-sp');
if (!in_array($sp, SimpleSAML_Auth_Source::getSources())) {
$sp = 'default-sp';
}
$as = new SimpleSAML_Auth_Simple($sp);
// Check the SimpleSAMLphp config is compatible
$saml_config = SimpleSAML_Configuration::getInstance();
$session_handler = $saml_config->getString('session.handler', false);
$store_type = $saml_config->getString('store.type', false);
if ($store_type == 'phpsession' || $session_handler == 'phpsession' || empty($store_type) && empty($session_handler)) {
throw new AuthInstanceException(get_string('errorbadssphp', 'auth.saml'));
}
// what is the session like?
$valid_saml_session = $saml_session->isValid($sp);
// figure out what the returnto URL should be
$wantsurl = param_variable("wantsurl", false);
if (!$wantsurl) {
if (isset($_SESSION['wantsurl'])) {
$wantsurl = $_SESSION['wantsurl'];
} else {
if (!$saml_session->getIdP()) {
$wantsurl = array_key_exists('HTTP_REFERER', $_SERVER) ? $_SERVER['HTTP_REFERER'] : $CFG->wwwroot;
} else {
$wantsurl = $CFG->wwwroot;
}
}
}
// taken from Moodle clean_param - make sure the wantsurl is correctly formed
include_once 'validateurlsyntax.php';
if (!validateUrlSyntax($wantsurl, 's?H?S?F?E?u-P-a?I?p?f?q?r?')) {
$wantsurl = $CFG->wwwroot;
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:index.php
示例16: define
*
* @package mahara
* @subpackage admin
* @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('ADMIN', 1);
define('INSTALLER', 1);
define('JSON', 1);
require dirname(dirname(__FILE__)) . '/init.php';
require get_config('libroot') . 'upgrade.php';
require get_config('docroot') . 'local/install.php';
$name = param_variable('name');
$install = $name == 'firstcoredata' || $name == 'lastcoredata' || $name == 'localpreinst' || $name == 'localpostinst';
if (!$install) {
$upgrade = check_upgrades($name);
if (!empty($upgrade) && empty($upgrade->disablelogin)) {
auth_setup();
}
}
raise_time_limit(120);
raise_memory_limit('256M');
$data = array('key' => $name);
if ($install) {
if (!get_config('installed')) {
if ($name == 'localpreinst' || $name == 'localpostinst') {
$fun = $name;
$data['localdata'] = true;
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:31,代码来源:upgrade.json.php
示例17: views_by_owner
public static function views_by_owner($group = null, $institution = null)
{
global $USER;
// Pagination configuration
$setlimit = true;
$limit = param_integer('limit', 0);
$userlimit = get_account_preference($USER->get('id'), 'viewsperpage');
if ($limit > 0 && $limit != $userlimit) {
$USER->set_account_preference('viewsperpage', $limit);
} else {
$limit = $userlimit;
}
$offset = param_integer('offset', 0);
// load default page order from user settings as default and overwrite, if changed
$usersettingorderby = get_account_preference($USER->get('id'), 'orderpagesby');
$orderby = param_variable('orderby', $usersettingorderby);
if ($usersettingorderby !== $orderby) {
set_account_preference($USER->get('id'), 'orderpagesby', $orderby);
}
$query = param_variable('query', null);
$tag = param_variable('tag', null);
$searchoptions = array('titleanddescription' => get_string('titleanddescription', 'view'), 'tagsonly' => get_string('tagsonly', 'view'));
if (!empty($tag)) {
$searchtype = 'tagsonly';
$searchdefault = $tag;
$query = null;
} else {
$searchtype = 'titleanddescription';
$searchdefault = $query;
}
$searchform = array('name' => 'searchviews', 'checkdirtychange' => false, 'class' => 'with-heading form-inline', 'elements' => array('searchwithin' => array('type' => 'fieldset', 'class' => 'dropdown-group js-dropdown-group', 'elements' => array('query' => array('type' => 'text', 'title' => get_string('search') . ': ', 'class' => 'with-dropdown js-with-dropdown', 'defaultvalue' => $searchdefault), 'type' => array('title' => get_string('searchwithin') . ': ', 'class' => 'dropdown-connect js-dropdown-connect searchviews-type', 'type' => 'select', 'options' => $searchoptions, 'defaultvalue' => $searchtype))), 'setlimit' => array('type' => 'hidden', 'value' => $setlimit), 'orderbygroup' => array('type' => 'fieldset', 'class' => 'input-group', 'elements' => array('orderby' => array('type' => 'select', 'class' => 'input-small', 'title' => get_string('sortby'), 'options' => array('atoz' => get_string('defaultsort', 'view'), 'latestcreated' => get_string('latestcreated', 'view'), 'latestmodified' => get_string('latestmodified', 'view'), 'latestviewed' => get_string('latestviewed', 'view'), 'mostvisited' => get_string('mostvisited', 'view'), 'mostcomments' => get_string('mostcomments', 'view')), 'defaultvalue' => $orderby), 'submit' => array('type' => 'button', 'usebuttontag' => true, 'class' => 'btn-primary input-group-btn no-label', 'value' => get_string('search'))))));
if ($group) {
$searchform['elements']['group'] = array('type' => 'hidden', 'name' => 'group', 'value' => $group);
} else {
if ($institution) {
$searchform['elements']['institution'] = array('type' => 'hidden', 'name' => 'institution', 'value' => $institution);
}
}
$searchform = pieform($searchform);
$data = self::get_myviews_data($limit, $offset, $query, $tag, $group, $institution, $orderby);
$url = self::get_myviews_url($group, $institution, $query, $tag, $orderby);
$pagination = build_pagination(array('url' => $url, 'count' => $data->count, 'limit' => $limit, 'setlimit' => $setlimit, 'offset' => $offset, 'jumplinks' => 6, 'numbersincludeprevnext' => 2));
return array($searchform, $data, $pagination);
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:44,代码来源:view.php
示例18: build_configure_form
/**
* Builds the configuration pieform for this blockinstance
*
* @return array Array with two keys: 'html' for raw html, 'javascript' for
* javascript to run, 'css' for dynamic css to add to header
*/
public function build_configure_form($new = false)
{
static $renderedform;
if (!empty($renderedform)) {
return $renderedform;
}
safe_require('blocktype', $this->get('blocktype'));
$blocktypeclass = generate_class_name('blocktype', $this->get('blocktype'));
$elements = call_static_method($blocktypeclass, 'instance_config_form', $this, $this->get_view()->get('template'));
// Block types may specify a method to generate a default title for a block
$hasdefault = method_exists($blocktypeclass, 'get_instance_title');
$title = $this->get('title');
$configdata = $this->get('configdata');
$retractable = isset($configdata['retractable']) ? $configdata['retractable'] : false;
$retractedonload = isset($configdata['retractedonload']) ? $configdata['retractedonload'] : $retractable;
if (call_static_method($blocktypeclass, 'override_instance_title', $this)) {
$titleelement = array('type' => 'hidden', 'value' => $title);
} else {
$titleelement = array('type' => 'text', 'title' => get_string('blocktitle', 'view'), 'description' => $hasdefault ? get_string('defaulttitledescription', 'blocktype.' . blocktype_name_to_namespaced($this->get('blocktype'))) : null, 'defaultvalue' => $title, 'rules' => array('maxlength' => 255), 'hidewhenempty' => $hasdefault, 'expandtext' => get_string('setblocktitle'));
}
$elements = array_merge(array('title' => $titleelement, 'blockconfig' => array('type' => 'hidden', 'value' => $this->get('id')), 'id' => array('type' => 'hidden', 'value' => $this->get('view')), 'change' => array('type' => 'hidden', 'value' => 1), 'new' => array('type' => 'hidden', 'value' => $new)), $elements, array('retractable' => array('type' => 'select', 'title' => get_string('retractable', 'view'), 'description' => get_string('retractabledescription', 'view'), 'options' => array(BlockInstance::RETRACTABLE_NO => get_string('no'), BlockInstance::RETRACTABLE_YES => get_string('yes'), BlockInstance::RETRACTABLE_RETRACTED => get_string('retractedonload', 'view')), 'defaultvalue' => $retractable + $retractedonload)));
if ($new) {
$cancel = get_string('remove');
$elements['removeoncancel'] = array('type' => 'hidden', 'value' => 1);
$elements['sure'] = array('type' => 'hidden', 'value' => 1);
} else {
$cancel = get_string('cancel');
}
// Add submit/cancel buttons
$elements['action_configureblockinstance_id_' . $this->get('id')] = array('type' => 'submitcancel', 'class' => 'btn-default', 'value' => array(get_string('save'), $cancel), 'goto' => View::make_base_url());
$configdirs = array(get_config('libroot') . 'form/');
if ($this->get('artefactplugin')) {
$configdirs[] = get_config('docroot') . 'artefact/' . $this->get('artefactplugin') . '/form/';
}
$form = array('name' => 'instconf', 'renderer' => 'div', 'validatecallback' => array(generate_class_name('blocktype', $this->get('blocktype')), 'instance_config_validate'), 'successcallback' => array($this, 'instance_config_store'), 'jsform' => true, 'jssuccesscallback' => 'blockConfigSuccess', 'jserrorcallback' => 'blockConfigError', 'elements' => $elements, 'viewgroup' => $this->get_view()->get('group'), 'group' => $this->get_view()->get('group'), 'viewinstitution' => $this->get_view()->get('institution'), 'institution' => $this->get_view()->get('institution'), 'configdirs' => $configdirs, 'plugintype' => 'blocktype', 'pluginname' => $this->get('blocktype'));
if (param_variable('action_acsearch_id_' . $this->get('id'), false)) {
$form['validate'] = false;
}
require_once 'pieforms/pieform.php';
$pieform = new Pieform($form);
if ($pieform->is_submitted()) {
global $SESSION;
$SESSION->add_error_msg(get_string('errorprocessingform'));
}
$html = $pieform->build();
// We probably need a new version of $pieform->build() that separates out the js
// Temporary evil hack:
if (preg_match('/<script type="(text|application)\\/javascript">(new Pieform\\(.*\\);)<\\/script>/', $html, $matches)) {
$js = "var pf_{$form['name']} = " . $matches[2] . "pf_{$form['name']}.init();";
} else {
$js = '';
}
// We need to load any javascript required for the pieform. We do this
// by checking for an api function that has been added especially for
// the purpose, but that is not part of Pieforms. Maybe one day later
// it will be though
foreach ($elements as $key => $element) {
$element['name'] = $key;
$function = 'pieform_element_' . $element['type'] . '_views_js';
if (is_callable($function)) {
$js .= call_user_func_array($function, array($pieform, $element));
}
}
$configjs = call_static_method($blocktypeclass, 'get_instance_config_javascript', $this);
if (is_array($configjs)) {
$js .= $this->get_get_javascript_javascript($configjs);
} else {
if (is_string($configjs)) {
$js .= $configjs;
}
}
// We need to load any dynamic css required for the pieform. We do this
// by checking for an api function that has been added especially for
// the purpose, but that is not part of Pieforms. Maybe one day later
// it will be though
$css = array();
foreach ($elements as $key => $element) {
$element['name'] = $key;
$function = 'pieform_element_' . $element['type'] . '_views_css';
if (is_callable($function)) {
$css[] = call_user_func_array($function, array($pieform, $element));
}
}
$renderedform = array('html' => $html, 'javascript' => $js, 'css' => $css);
return $renderedform;
}
开发者ID:sarahjcotton,项目名称:mahara,代码行数:92,代码来源:lib.php
示例19: define
/**
*
* @package mahara
* @subpackage admin
* @author Richard Mansfield
* @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('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'configusers');
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once get_config('docroot') . 'lib/antispam.php';
define('TITLE', get_string('bulkactions', 'admin'));
$userids = array_map('intval', param_variable('users'));
$ph = $userids;
$institutionsql = '';
if (!$USER->get('admin')) {
// Filter the users by the admin's institutions
$institutions = array_values($USER->get('admininstitutions'));
$ph = array_merge($ph, $institutions);
$institutionsql = '
AND id IN (
SELECT usr FROM {usr_institution} WHERE institution IN (' . join(',', array_fill(0, count($institutions), '?')) . ')
)';
}
$users = get_records_sql_assoc('
SELECT
u.id, u.username, u.email, u.firstname, u.lastname, u.suspendedcusr, u.authinstance, u.studentid,
u.preferredname, CHAR_LENGTH(u
|
请发表评论