本文整理汇总了PHP中get_institution_selector函数的典型用法代码示例。如果您正苦于以下问题:PHP get_institution_selector函数的具体用法?PHP get_institution_selector怎么用?PHP get_institution_selector使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_institution_selector函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: editsitepage_validate
function editsitepage_validate(Pieform $form, $values)
{
$allowedinstitutions = get_institution_selector(false);
if (array_search($values['pageinstitution'], array_flip($allowedinstitutions['options'])) === false) {
$form->set_error(null, get_string('staticpageinstitutionbad', 'admin', $values['pageinstitution']));
}
}
示例2: define
define('TITLE', get_string('uploadgroupmemberscsv', 'admin'));
require_once 'pieforms/pieform.php';
require_once get_config('libroot') . 'group.php';
require_once get_config('libroot') . 'institution.php';
safe_require('artefact', 'internal');
raise_memory_limit("512M");
// Turn on autodetecting of line endings, so mac newlines (\r) will work
ini_set('auto_detect_line_endings', 1);
$FORMAT = array();
$ALLOWEDKEYS = array('shortname', 'username', 'role');
$MANDATORYFIELDS = array('shortname', 'username', 'role');
$MEMBERS = array();
// Store the members
$GROUPS = array();
// Map gid to group shortnames
$form = array('name' => 'uploadcsv', 'elements' => array('institution' => get_institution_selector(), 'file' => array('type' => 'file', 'title' => get_string('csvfile', 'admin'), 'description' => get_string('groupmemberscsvfiledescription', 'admin'), 'accept' => '.csv, text/csv, application/csv, text/comma-separated-values', 'rules' => array('required' => true)), 'progress_meter_token' => array('type' => 'hidden', 'value' => 'uploadgroupmemberscsv', 'readonly' => TRUE), 'submit' => array('type' => 'submit', 'value' => get_string('uploadgroupmemberscsv', 'admin'))));
/**
* The CSV file is parsed here so validation errors can be returned to the
* user. The data from a successful parsing is stored in the <var>$CVSDATA</var>
* array so it can be accessed by the submit function
*
* @param Pieform $form The form to validate
* @param array $values The values submitted
*/
function uploadcsv_validate(Pieform $form, $values)
{
global $CSVDATA, $ALLOWEDKEYS, $MANDATORYFIELDS, $FORMAT, $USER, $UPDATES, $MEMBERS, $GROUPS;
// Don't even start attempting to parse if there are previous errors
if ($form->has_errors()) {
return;
}
示例3: institution_selector_for_page
function institution_selector_for_page($institution, $page)
{
require_once 'pieforms/pieform.php';
$institutionelement = get_institution_selector(false);
if (empty($institutionelement)) {
return array('institution' => false, 'institutionselector' => null, 'institutionselectorjs' => '');
}
global $USER;
if (empty($institution) || !$USER->can_edit_institution($institution)) {
$institution = empty($institutionelement['value']) ? $institutionelement['defaultvalue'] : $institutionelement['value'];
} else {
$institutionelement['defaultvalue'] = $institution;
}
$institutionselector = pieform(array('name' => 'institutionselect', 'elements' => array('institution' => $institutionelement)));
$js = <<<EOF
function reloadUsers() {
var inst = '';
if (\$('institutionselect_institution')) {
inst = '?institution='+\$('institutionselect_institution').value;
}
window.location.href = '{$page}'+inst;
}
addLoadEvent(function() {
if (\$('institutionselect_institution')) {
connect(\$('institutionselect_institution'), 'onchange', reloadUsers);
}
});
EOF;
return array('institution' => $institution, 'institutionselector' => $institutionselector, 'institutionselectorjs' => $js);
}
示例4: define
*
*/
define('INTERNAL', 1);
define('INSTITUTIONALADMIN', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
define('TITLE', get_string('pendingregistrations', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'pendingregistrations');
define('MENUITEM', 'manageinstitutions/pendingregistrations');
require_once 'pieforms/pieform.php';
require_once 'institution.php';
if (!is_logged_in()) {
throw new AccessDeniedException();
}
$institutionelement = get_institution_selector();
if (empty($institutionelement)) {
$smarty = smarty();
$smarty->display('admin/users/noinstitutions.tpl');
exit;
}
$institution = param_alphanum('institution', null);
if (!$institution || !$USER->can_edit_institution($institution)) {
$institution = empty($institutionelement['value']) ? $institutionelement['defaultvalue'] : $institutionelement['value'];
} else {
if (!empty($institution)) {
$institutionelement['defaultvalue'] = $institution;
}
}
$institutionselector = pieform(array('name' => 'usertypeselect', 'class' => 'form-inline', 'elements' => array('institution' => $institutionelement)));
$pending = get_records_sql_array('
示例5: param_alphanum
}
$institution = param_alphanum('institution', false);
if (!$institution || !$USER->can_edit_institution($institution)) {
$institution = empty($institutionelement['value']) ? $institutionelement['defaultvalue'] : $institutionelement['value'];
} else {
if (!empty($institution)) {
$institutionelement['defaultvalue'] = $institution;
}
}
// Show either requesters, members, or nonmembers on the left hand side
$usertype = param_alpha('usertype', 'requesters');
$usertypeselectorelements = array('usertype' => array('type' => 'select', 'title' => get_string('userstodisplay', 'admin'), 'options' => array('requesters' => get_string('institutionusersrequesters', 'admin'), 'nonmembers' => get_string('institutionusersnonmembers', 'admin'), 'lastinstitution' => get_string('institutionuserslastinstitution', 'admin'), 'members' => get_string('institutionusersmembers', 'admin'), 'invited' => get_string('institutionusersinvited', 'admin')), 'defaultvalue' => $usertype));
if ($usertype == 'lastinstitution') {
// Change intitution dropdown to show possible last insitutions
$lastinstitution = param_alphanum('lastinstitution', false);
$usertypeselectorelements['lastinstitution'] = get_institution_selector(false, true);
$usertypeselectorelements['lastinstitution']['title'] = get_string('lastinstitution', 'admin');
if ($lastinstitution) {
$usertypeselectorelements['lastinstitution']['defaultvalue'] = $lastinstitution;
} else {
$lastinstitution = $usertypeselectorelements['lastinstitution']['defaultvalue'];
}
}
$usertypeselector = pieform(array('name' => 'usertypeselect', 'checkdirtychange' => false, 'elements' => $usertypeselectorelements));
if ($usertype == 'requesters') {
// LHS shows users who have requested membership, RHS shows users to be added
$userlistelement = array('title' => get_string('addnewmembers', 'admin'), 'lefttitle' => get_string('usersrequested', 'admin'), 'righttitle' => get_string('userstoaddorreject', 'admin'), 'searchparams' => array('requested' => 1));
$submittext = get_string('addmembers', 'admin');
} else {
if ($usertype == 'members') {
// LHS shows institution members, RHS shows users to be removed
示例6: define
*/
define('INTERNAL', 1);
define('INSTITUTIONALADMIN', 1);
define('MENUITEM', 'manageinstitutions/progressbar');
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'progressbar');
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once 'pieforms/pieform.php';
require_once 'institution.php';
define('TITLE', get_string('progressbar', 'admin'));
define('DEFAULTPAGE', 'home');
if (!is_logged_in()) {
throw new AccessDeniedException();
}
$institutionelement = get_institution_selector(true, false, true, false);
if (empty($institutionelement)) {
$smarty = smarty();
$smarty->display('admin/users/noinstitutions.tpl');
exit;
}
$institution = param_alphanum('institution', false);
if (!$institution || !$USER->can_edit_institution($institution, true)) {
$institution = empty($institutionelement['value']) ? $institutionelement['defaultvalue'] : $institutionelement['value'];
} else {
if (!empty($institution)) {
$institutionelement['defaultvalue'] = $institution;
}
}
$institutionselector = pieform(array('name' => 'progressbarselect', 'class' => 'form-inline', 'elements' => array('institution' => $institutionelement)));
// Selected artefacts that count towards completing progress bar
示例7: institution_selector_for_page
function institution_selector_for_page($institution, $page)
{
// Special case: $institution == 1 <-> any institution
if ($institution == 1) {
$institution = '';
}
require_once 'pieforms/pieform.php';
$institutionelement = get_institution_selector(false);
if (empty($institutionelement)) {
return array('institution' => false, 'institutionselector' => null, 'institutionselectorjs' => '');
}
global $USER;
if (empty($institution) || !$USER->can_edit_institution($institution)) {
$institution = empty($institutionelement['value']) ? $institutionelement['defaultvalue'] : $institutionelement['value'];
} else {
$institutionelement['defaultvalue'] = $institution;
}
$institutionselector = pieform(array('name' => 'institutionselect', 'class' => 'last form-inline pull-right', 'checkdirtychange' => false, 'elements' => array('institution' => $institutionelement)));
$page = json_encode($page);
$js = <<<EOF
function reloadUsers() {
var urlstr = {$page};
var inst = '';
if (\$('institutionselect_institution')) {
inst = 'institution='+\$('institutionselect_institution').value;
if (urlstr.indexOf('?') > 0) {
urlstr = urlstr + '&' + inst;
}
else {
urlstr = urlstr + '?' + inst;
}
}
window.location.href = urlstr;
}
addLoadEvent(function() {
if (\$('institutionselect_institution')) {
connect(\$('institutionselect_institution'), 'onchange', reloadUsers);
}
});
EOF;
return array('institution' => $institution, 'institutionselector' => $institutionselector, 'institutionselectorjs' => $js);
}
示例8: safe_require
safe_require('artefact', 'internal');
raise_memory_limit("512M");
// Turn on autodetecting of line endings, so mac newlines (\r) will work
ini_set('auto_detect_line_endings', 1);
$FORMAT = array();
$ALLOWEDKEYS = array('shortname', 'displayname', 'description', 'open', 'controlled', 'request', 'roles', 'public', 'submitpages', 'allowarchives', 'editroles', 'hidden', 'hidemembers', 'hidemembersfrommembers', 'invitefriends', 'suggestfriends');
if ($USER->get('admin')) {
$ALLOWEDKEYS[] = 'usersautoadded';
$ALLOWEDKEYS[] = 'quota';
}
$MANDATORYFIELDS = array('shortname', 'displayname', 'roles');
$UPDATES = array();
// During validation, remember which group already exist
$GROUPTYPES = group_get_grouptype_options();
$EDITROLES = group_get_editroles_options();
$form = array('name' => 'uploadcsv', 'elements' => array('institution' => get_institution_selector(), 'file' => array('type' => 'file', 'title' => get_string('csvfile', 'admin'), 'description' => get_string('groupcsvfiledescription', 'admin'), 'accept' => '.csv, text/csv, application/csv, text/comma-separated-values', 'rules' => array('required' => true)), 'updategroups' => array('type' => 'checkbox', 'title' => get_string('updategroups', 'admin'), 'description' => get_string('updategroupsdescription', 'admin'), 'defaultvalue' => false), 'submit' => array('type' => 'submit', 'value' => get_string('uploadgroupcsv', 'admin'))));
/**
* The CSV file is parsed here so validation errors can be returned to the
* user. The data from a successful parsing is stored in the <var>$CVSDATA</var>
* array so it can be accessed by the submit function
*
* @param Pieform $form The form to validate
* @param array $values The values submitted
*/
function uploadcsv_validate(Pieform $form, $values)
{
global $CSVDATA, $ALLOWEDKEYS, $MANDATORYFIELDS, $GROUPTYPES, $FORMAT, $USER, $UPDATES, $EDITROLES;
// Don't even start attempting to parse if there are previous errors
if ($form->has_errors()) {
return;
}
示例9: dirname
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require get_config('libroot') . 'registration.php';
require_once 'institution.php';
if (!is_logged_in()) {
throw new AccessDeniedException();
}
$institution = param_alphanum('institution', null);
$notallowed = false;
if (!empty($institution)) {
$staffstats = get_config('staffstats');
if (!$USER->get('admin') && !$USER->is_institutional_admin($institution) && (!$USER->is_institutional_staff($institution) || $USER->is_institutional_staff($institution) && empty($staffstats))) {
$notallowed = true;
}
}
if (!$notallowed) {
$institutionelement = get_institution_selector(true, false, true, get_config('staffstats'));
}
if (empty($institutionelement) || $notallowed) {
$smarty = smarty();
$smarty->assign('CANCREATEINST', $USER->get('admin'));
$smarty->display('admin/users/noinstitutionsstats.tpl');
exit;
}
if (!$institution || !$USER->can_edit_institution($institution, true)) {
$institution = empty($institutionelement['value']) ? $institutionelement['defaultvalue'] : $institutionelement['value'];
} else {
if (!empty($institution)) {
$institutionelement['defaultvalue'] = $institution;
}
}
$institutionselector = pieform(array('name' => 'usertypeselect', 'elements' => array('institution' => $institutionelement)));
示例10: get_config
require_once get_config('libroot') . 'institution.php';
safe_require('artefact', 'internal');
// Turn on autodetecting of line endings, so mac newlines (\r) will work
ini_set('auto_detect_line_endings', 1);
$FORMAT = array();
$ALLOWEDKEYS = array('shortname', 'displayname', 'description', 'open', 'controlled', 'request', 'roles', 'public', 'submitpages', 'allowarchives', 'editroles', 'hidden', 'hidemembers', 'hidemembersfrommembers', 'invitefriends', 'suggestfriends');
if ($USER->get('admin')) {
$ALLOWEDKEYS[] = 'usersautoadded';
$ALLOWEDKEYS[] = 'quota';
}
$MANDATORYFIELDS = array('shortname', 'displayname', 'roles');
$UPDATES = array();
// During validation, remember which group already exist
$GROUPTYPES = group_get_grouptype_options();
$EDITROLES = group_get_editroles_options();
$form = array('name' => 'uploadcsv', 'elements' => array('institution' => get_institution_selector(), 'file' => array('type' => 'file', 'title' => get_string('csvfile', 'admin'), 'description' => get_string('groupcsvfiledescription', 'admin'), 'accept' => '.csv, text/csv, application/csv, text/comma-separated-values', 'rules' => array('required' => true)), 'updategroups' => array('type' => 'switchbox', 'class' => 'last', 'title' => get_string('updategroups', 'admin'), 'description' => get_string('updategroupsdescription1', 'admin'), 'defaultvalue' => false), 'progress_meter_token' => array('type' => 'hidden', 'value' => 'uploadgroupscsv', 'readonly' => TRUE), 'submit' => array('type' => 'submit', 'class' => 'btn-primary', 'value' => get_string('uploadgroupcsv', 'admin'))));
/**
* The CSV file is parsed here so validation errors can be returned to the
* user. The data from a successful parsing is stored in the <var>$CVSDATA</var>
* array so it can be accessed by the submit function
*
* @param Pieform $form The form to validate
* @param array $values The values submitted
*/
function uploadcsv_validate(Pieform $form, $values)
{
global $CSVDATA, $ALLOWEDKEYS, $MANDATORYFIELDS, $GROUPTYPES, $FORMAT, $USER, $UPDATES, $EDITROLES;
// Don't even start attempting to parse if there are previous errors
if ($form->has_errors()) {
return;
}
示例11: define
* @copyright (C) 2006-2008 Catalyst IT Ltd http://catalyst.net.nz
*
*/
// NOTE: This script is VERY SIMILAR to the adminusers.php script, a bug fixed
// here might need to be fixed there too.
define('INTERNAL', 1);
define('INSTITUTIONALADMIN', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
define('TITLE', get_string('adminusers', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'institutionusers');
define('MENUITEM', 'manageinstitutions/institutionusers');
require_once 'pieforms/pieform.php';
require_once 'institution.php';
$institutionelement = get_institution_selector(false);
$smarty = smarty();
if (empty($institutionelement)) {
$smarty->display('admin/users/noinstitutions.tpl');
exit;
}
$institution = param_alphanum('institution', false);
if (!$institution || !$USER->can_edit_institution($institution)) {
$institution = empty($institutionelement['value']) ? $institutionelement['defaultvalue'] : $institutionelement['value'];
} else {
if (!empty($institution)) {
$institutionelement['defaultvalue'] = $institution;
}
}
// Show either requesters, members, or nonmembers on the left hand side
$usertype = param_alpha('usertype', 'requesters');