本文整理汇总了PHP中pieform函数的典型用法代码示例。如果您正苦于以下问题:PHP pieform函数的具体用法?PHP pieform怎么用?PHP pieform使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pieform函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_upload_form
function print_upload_form()
{
$form = pieform(array('name' => 'import', 'method' => 'post', 'plugintype ' => 'core', 'pluginname' => 'import', 'elements' => array('leap2afile' => array('type' => 'file', 'title' => get_string('uploadleap2afile', 'admin'), 'rules' => array('required' => true)), 'submit' => array('type' => 'submit', 'value' => get_string('Import', 'import')))));
$smarty = smarty();
$smarty->assign('PAGEHEADING', get_string('importyourportfolio', 'import'));
$smarty->assign('pagedescription', get_string('importportfoliodescription', 'import'));
$smarty->assign('form', $form);
$smarty->display('form.tpl');
}
示例2: 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;
}
示例3: render_instance
public static function render_instance(BlockInstance $instance, $editing = false)
{
global $USER, $exporter;
$userid = $instance->get_view()->get('owner');
if (!$userid) {
// 'My Friends' doesn't make sense for group/site views
return '';
}
$limit = isset($exporter) ? false : MAXFRIENDDISPLAY;
$friends = get_friends($userid, $limit, 0);
if ($friends['count']) {
self::build_myfriends_html($friends, $userid, $instance);
} else {
$friends = false;
}
$smarty = smarty_core();
$smarty->assign('friends', $friends);
$smarty->assign('searchingforfriends', array('<a href="' . get_config('wwwroot') . 'user/find.php">', '</a>'));
// If the user has no friends, try and display something useful, such
// as a 'request friendship' button
if (!$friends) {
$loggedinid = $USER->get('id');
$is_friend = is_friend($userid, $loggedinid);
if ($is_friend) {
$relationship = 'existingfriend';
} else {
if (record_exists('usr_friend_request', 'requester', $loggedinid, 'owner', $userid)) {
$relationship = 'requestedfriendship';
} else {
$relationship = 'none';
$friendscontrol = get_account_preference($userid, 'friendscontrol');
if ($friendscontrol == 'auto') {
require_once 'pieforms/pieform.php';
$newfriendform = pieform(array('name' => 'myfriends_addfriend', 'successcallback' => 'addfriend_submit', 'autofocus' => false, 'renderer' => 'div', 'elements' => array('add' => array('type' => 'button', 'usebuttontag' => true, 'class' => 'btn-default', 'value' => '<span class="icon icon-user-plus icon-lg prs"></span>' . get_string('addtomyfriends', 'group')), 'id' => array('type' => 'hidden', 'value' => $userid))));
$smarty->assign('newfriendform', $newfriendform);
}
$smarty->assign('friendscontrol', $friendscontrol);
}
}
$smarty->assign('relationship', $relationship);
}
$smarty->assign('loggedin', is_logged_in());
$smarty->assign('lookingatownpage', $USER->get('id') == $userid);
$smarty->assign('USERID', $userid);
return $smarty->fetch('blocktype:myfriends:myfriends.tpl');
}
示例4: register_site
/**
* @return string that is the registation form
* @ingroup Registration
*/
function register_site()
{
$strfield = get_string('Field', 'admin');
$strvalue = get_string('Value', 'admin');
$info = <<<EOF
<table>
<tr>
<th>{$strfield}</th>
<th>{$strvalue}</th>
</tr>
EOF;
$data = registration_data();
foreach ($data as $key => $val) {
$info .= '<tr><td>' . hsc($key) . '</td><td>' . hsc($val) . "</td></tr>\n";
}
$info .= '</table>';
$form = array('name' => 'register', 'autofocus' => false, 'elements' => array('whatsent' => array('type' => 'fieldset', 'legend' => get_string('datathatwillbesent', 'admin'), 'collapsible' => true, 'collapsed' => true, 'elements' => array('info' => array('type' => 'markup', 'value' => $info))), 'sendweeklyupdates' => array('type' => 'checkbox', 'title' => get_string('sendweeklyupdates', 'admin'), 'defaultvalue' => true), 'register' => array('type' => 'submit', 'value' => get_string('Register', 'admin'))));
return pieform($form);
}
示例5: register_site
/**
* @return string that is the registation form
* @ingroup Registration
*/
function register_site()
{
$strfield = get_string('Field', 'admin');
$strvalue = get_string('Value', 'admin');
$info = <<<EOF
<table class="table table-striped table-bordered" id="register-table">
<thead>
<tr>
<th>{$strfield}</th>
<th>{$strvalue}</th>
</tr>
</thead>
<tbody>
EOF;
$data = registration_data();
foreach ($data as $key => $val) {
$info .= '<tr><th>' . hsc($key) . '</th><td>' . hsc($val) . "</td></tr>\n";
}
$info .= '</tbody></table>';
$form = array('name' => 'register', 'autofocus' => false, 'elements' => array('whatsent' => array('type' => 'fieldset', 'legend' => get_string('datathatwillbesent', 'admin'), 'collapsible' => true, 'collapsed' => true, 'class' => 'last', 'elements' => array('info' => array('type' => 'markup', 'value' => $info))), 'sendweeklyupdates' => array('type' => 'switchbox', 'title' => get_string('sendweeklyupdates', 'admin'), 'defaultvalue' => true), 'register' => array('type' => 'submitcancel', 'class' => 'btn-primary', 'value' => array(get_string('Register', 'admin'), get_string('cancel', 'mahara')))));
return pieform($form);
}
示例6: 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('MENUITEM', 'managegroups/categories');
require dirname(dirname(dirname(__FILE__))) . '/init.php';
define('TITLE', get_string('groupcategories', 'admin'));
$optionform = pieform(array('name' => 'groupcategories', 'renderer' => 'div', 'class' => '', 'plugintype' => 'core', 'pluginname' => 'admin', 'elements' => array('allowgroupcategories' => array('class' => 'with-label-widthauto', 'type' => 'switchbox', 'title' => get_string('enablegroupcategories', 'admin'), 'defaultvalue' => get_config('allowgroupcategories')), 'submit' => array('class' => 'btn-primary', 'type' => 'submit', 'value' => get_string('submit')))));
function groupcategories_submit(Pieform $form, $values)
{
set_config('allowgroupcategories', (int) $values['allowgroupcategories']);
redirect(get_config('wwwroot') . 'admin/groups/groupcategories.php');
}
$strings = array('edit', 'delete', 'update', 'cancel', 'add', 'name', 'unknownerror');
$adminstrings = array('confirmdeletecategory', 'deletefailed', 'addnewgroupcategory');
$argumentstrings = array('editspecific', 'deletespecific');
foreach ($strings as $string) {
$getstring[$string] = json_encode(get_string($string));
}
foreach ($adminstrings as $string) {
$getstring[$string] = json_encode(get_string($string, 'admin'));
}
foreach ($argumentstrings as $string) {
示例7: ArtefactNotFoundException
$artefact->commit();
}
} else {
throw new ArtefactNotFoundException(get_string('cannotfindcreateartefact', 'artefact.resume'));
}
}
if ($artefact->get('owner') != $USER->get('id')) {
throw new AccessDeniedException(get_string('notartefactowner', 'error'));
}
$folder = param_integer('folder', 0);
$browse = (int) param_variable('browse', 0);
$highlight = null;
if ($file = param_integer('file', 0)) {
$highlight = array($file);
}
$form = pieform(array('name' => 'editgoalsandskills', 'method' => 'post', 'jsform' => true, 'newiframeonsubmit' => true, 'jssuccesscallback' => 'editgoalsandskills_callback', 'jserrorcallback' => 'editgoalsandskills_callback', 'plugintype' => 'artefact', 'pluginname' => 'resume', 'configdirs' => array(get_config('libroot') . 'form/', get_config('docroot') . 'artefact/file/form/'), 'elements' => array('description' => array('type' => 'wysiwyg', 'title' => get_string('description', 'artefact.resume'), 'rows' => 20, 'cols' => 65, 'defaultvalue' => $artefact->get('description'), 'rules' => array('maxlength' => 65536)), 'filebrowser' => array('type' => 'filebrowser', 'title' => get_string('attachments', 'artefact.blog'), 'folder' => $folder, 'highlight' => $highlight, 'browse' => $browse, 'page' => get_config('wwwroot') . 'artefact/resume/editgoalsandskills.php?id=' . $artefact->get('id') . '&browse=1', 'browsehelp' => 'browsemyfiles', 'config' => array('upload' => true, 'uploadagreement' => get_config_plugin('artefact', 'file', 'uploadagreement'), 'resizeonuploaduseroption' => get_config_plugin('artefact', 'file', 'resizeonuploaduseroption'), 'resizeonuploaduserdefault' => $USER->get_account_preference('resizeonuploaduserdefault'), 'createfolder' => false, 'edit' => false, 'select' => true), 'defaultvalue' => $artefact->attachment_id_list(), 'selectlistcallback' => 'artefact_get_records_by_id', 'selectcallback' => 'add_resume_attachment', 'unselectcallback' => 'delete_resume_attachment'), 'artefacttype' => array('type' => 'hidden', 'value' => $artefact->get('artefacttype')), 'submitform' => array('type' => 'submitcancel', 'class' => 'btn-success', 'value' => array(get_string('save'), get_string('cancel')), 'goto' => get_config('wwwroot') . 'artefact/resume/goalsandskills.php'))));
/*
* Javascript specific to this page. Creates the list of files
* attached to the resume goals or skills.
*/
$wwwroot = get_config('wwwroot');
$noimagesmessage = json_encode(get_string('noimageshavebeenattachedtothispost', 'artefact.blog'));
$javascript = <<<EOF
function editgoalsandskills_callback(form, data) {
editgoalsandskills_filebrowser.callback(form, data);
};
EOF;
$smarty = smarty(array(), array(), array(), array('tinymceconfig' => '
plugins: "tooltoggle,textcolor,link,imagebrowser,table,emoticons,spellchecker,paste,code,fullscreen,directionality,searchreplace,nonbreaking,charmap",
image_filebrowser: "editgoalsandskills_filebrowser",
', 'sideblocks' => array(array('name' => 'quota', 'weight' => -10, 'data' => array()))));
示例8: array
GROUP BY 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12', array(0, $postid));
if (!$post) {
throw new NotFoundException(get_string('cantfindpost', 'interaction.forum', $postid));
}
$membership = user_can_access_forum((int) $post->forum);
$moderator = (bool) ($membership & INTERACTION_FORUM_MOD);
if (!$moderator || $post->group && !group_within_edit_window($post->group)) {
throw new AccessDeniedException(get_string('cantdeletepost', 'interaction.forum'));
}
if (!$post->parent) {
throw new AccessDeniedException(get_string('cantdeletethispost', 'interaction.forum'));
}
define('GROUP', $post->group);
define('TITLE', $post->topicsubject . ' - ' . get_string('deletepost', 'interaction.forum'));
$post->ctime = relative_date(get_string('strftimerecentfullrelative', 'interaction.forum'), get_string('strftimerecentfull'), $post->ctime);
$form = pieform(array('name' => 'deletepost', 'renderer' => 'div', 'autofocus' => false, 'elements' => array('title' => array('value' => get_string('deletepostsure', 'interaction.forum')), 'submit' => array('type' => 'submitcancel', 'class' => 'btn-success', 'value' => array(get_string('yes'), get_string('no')), 'goto' => get_config('wwwroot') . 'interaction/forum/topic.php?id=' . $post->topic . '&post=' . $postid), 'post' => array('type' => 'hidden', 'value' => $postid), 'topic' => array('type' => 'hidden', 'value' => $post->topic), 'parent' => array('type' => 'hidden', 'value' => $post->parent))));
function deletepost_submit(Pieform $form, $values)
{
global $SESSION, $USER;
$objectionable = get_record_sql("SELECT fp.id\n FROM {interaction_forum_post} fp\n JOIN {objectionable} o\n ON (o.objecttype = 'forum' AND o.objectid = fp.id)\n WHERE fp.id = ?\n AND o.resolvedby IS NULL\n AND o.resolvedtime IS NULL", array($values['post']));
if ($objectionable !== false) {
// Trigger activity.
$data = new StdClass();
$data->postid = $values['post'];
$data->message = '';
$data->reporter = $USER->get('id');
$data->ctime = time();
$data->event = DELETE_OBJECTIONABLE_POST;
activity_occurred('reportpost', $data, 'interaction', 'forum');
}
update_record('interaction_forum_post', array('deleted' => 1), array('id' => $values['post']));
示例9: auth_generate_login_form
/**
* Generates the login form for the sideblock.
*
* {@internal{Not sure why this form definition doesn't use
* auth_get_login_form, but keep that in mind when making changes.}}
*/
function auth_generate_login_form()
{
global $SESSION;
require_once 'pieforms/pieform.php';
if (!get_config('installed')) {
return;
} else {
if ($SESSION->loginform) {
return get_login_form_js($SESSION->loginform->build());
}
}
$elements = auth_get_login_form_elements();
$loginform = get_login_form_js(pieform(array('name' => 'login', 'renderer' => 'div', 'submit' => false, 'plugintype' => 'auth', 'pluginname' => 'internal', 'autofocus' => false, 'elements' => $elements)));
return $loginform;
}
示例10: strpos
break;
default:
$goto = 'user/myfriends.php';
}
$goto .= strpos($goto, '?') ? '&offset=' . $offset : '?offset=' . $offset;
$goto = get_config('wwwroot') . $goto;
if (is_friend($id, $USER->get('id'))) {
$SESSION->add_ok_msg(get_string('alreadyfriends', 'group', display_name($id)));
redirect($goto);
} else {
if (get_friend_request($id, $USER->get('id'))) {
$SESSION->add_info_msg(get_string('friendshipalreadyrequestedowner', 'group', display_name($id)));
redirect(get_config('wwwroot') . 'user/myfriends.php?filter=pending');
}
}
$form = pieform(array('name' => 'requestfriendship', 'autofocus' => false, 'elements' => array('message' => array('type' => 'textarea', 'title' => get_string('messageoptional'), 'labelescaped' => true, 'cols' => 50, 'rows' => 4, 'rules' => array('required' => true, 'maxlength' => 255)), 'submit' => array('class' => 'btn-default', 'type' => 'submitcancel', 'value' => array(get_string('requestfriendship', 'group'), get_string('cancel')), 'goto' => $goto))));
$smarty = smarty();
$smarty->assign('PAGEHEADING', TITLE);
$smarty->assign('form', $form);
$smarty->assign('user', $user);
$smarty->display('user/requestfriendship.tpl');
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();
示例11: array
}
// Only site admins can add institutions; institutional admins must invite
if ($USER->get('admin') && (get_config('usersallowedmultipleinstitutions') || count($user->institutions) == 0)) {
$options = array();
foreach ($allinstitutions as $i) {
if (!$user->in_institution($i->name) && $i->name != 'mahara') {
$options[$i->name] = $i->displayname;
}
}
if (!empty($options)) {
$elements['addinstitutionheader'] = array('type' => 'markup', 'value' => '<tr><td colspan="2"><h4>' . get_string('addusertoinstitution', 'admin') . '</h4></td></tr>');
$elements['addinstitution'] = array('type' => 'select', 'title' => get_string('institution'), 'options' => $options);
$elements['add'] = array('type' => 'submit', 'value' => get_string('addusertoinstitution', 'admin'));
}
}
$institutionform = pieform(array('name' => 'edituser_institution', 'renderer' => 'table', 'plugintype' => 'core', 'pluginname' => 'admin', 'elements' => $elements));
function edituser_institution_validate(Pieform $form, $values)
{
$user = new User();
if (!$user->find_by_id($values['id'])) {
return false;
}
global $USER;
$userinstitutions = $user->get('institutions');
if (isset($values['add']) && $USER->get('admin') && (empty($userinstitutions) || get_config('usersallowedmultipleinstitutions'))) {
// check if the institution is full
require_once get_config('docroot') . 'lib/institution.php';
$institution = new Institution($values['addinstitution']);
if ($institution->isFull()) {
$institution->send_admin_institution_is_full_message();
$form->set_error(null, get_string('institutionmaxusersexceeded', 'admin'));
示例12: extension_loaded
$opensslext = extension_loaded('openssl');
$curlext = extension_loaded('curl');
$xmlrpcext = extension_loaded('xmlrpc');
if (!$opensslext || !$curlext || !$xmlrpcext) {
$smarty = smarty();
$missingextensions = array();
!$opensslext && ($missingextensions[] = 'openssl');
!$curlext && ($missingextensions[] = 'curl');
!$xmlrpcext && ($missingextensions[] = 'xmlrpc');
$smarty->assign('missingextensions', $missingextensions);
$smarty->display('admin/site/networking.tpl');
exit;
}
$openssl = OpenSslRepo::singleton();
$yesno = array(true => get_string('yes'), false => get_string('no'));
$networkingform = pieform(array('name' => 'networkingform', 'jsform' => true, 'elements' => array('wwwroot' => array('type' => 'html', 'title' => get_string('wwwroot', 'admin'), 'description' => get_string('wwwrootdescription', 'admin'), 'value' => get_config('wwwroot')), 'pubkey' => array('type' => 'html', 'title' => get_string('publickey', 'admin'), 'description' => get_string('publickeydescription2', 'admin', 365), 'value' => '<pre style="font-size: 0.7em">' . $openssl->certificate . '</pre>'), 'expires' => array('type' => 'html', 'title' => get_string('publickeyexpires', 'admin'), 'value' => format_date($openssl->expires)), 'enablenetworking' => array('type' => 'select', 'title' => get_string('enablenetworking', 'admin'), 'description' => get_string('enablenetworkingdescription', 'admin'), 'defaultvalue' => get_config('enablenetworking'), 'options' => $yesno), 'promiscuousmode' => array('type' => 'select', 'title' => get_string('promiscuousmode', 'admin'), 'description' => get_string('promiscuousmodedescription', 'admin'), 'defaultvalue' => get_config('promiscuousmode'), 'options' => $yesno), 'proxyfieldset' => array('type' => 'fieldset', 'legend' => get_string('proxysettings', 'admin'), 'elements' => array('proxyaddress' => array('type' => 'text', 'title' => get_string('proxyaddress', 'admin'), 'description' => get_string('proxyaddressdescription', 'admin'), 'defaultvalue' => get_config('proxyaddress')), 'proxyauthmodel' => array('type' => 'select', 'title' => get_string('proxyauthmodel', 'admin'), 'description' => get_string('proxyauthmodeldescription', 'admin'), 'defaultvalue' => get_config('proxyauthmodel'), 'options' => array('' => 'None', 'basic' => 'Basic (NCSA)')), 'proxyauthcredentials' => array('type' => 'text', 'title' => get_string('proxyauthcredentials', 'admin'), 'description' => get_string('proxyauthcredentialsdescription', 'admin'), 'defaultvalue' => get_config('proxyauthcredentials')))), 'submit' => array('type' => 'submit', 'value' => get_string('savechanges', 'admin')))));
function networkingform_fail(Pieform $form)
{
$form->reply(PIEFORM_ERR, array('message' => get_string('enablenetworkingfailed', 'admin'), 'goto' => '/admin/site/networking.php'));
}
function networkingform_submit(Pieform $form, $values)
{
$reply = '';
if (get_config('enablenetworking') != $values['enablenetworking']) {
if (!set_config('enablenetworking', $values['enablenetworking'])) {
networkingform_fail($form);
} else {
if (empty($values['enablenetworking'])) {
$reply .= get_string('networkingdisabled', 'admin');
} else {
$reply .= get_string('networkingenabled', 'admin');
示例13: get_record
$user = get_record('usr', 'id', $userid, 'deleted', 0);
if (!$user) {
throw new UserNotFoundException(get_string('usernotfound', 'group', $userid));
}
$role = group_user_access($groupid);
if ($role != 'admin' && !group_user_can_assess_submitted_views($group->id, $USER->get('id'))) {
if (!$group->invitefriends || !is_friend($user->id, $USER->get('id'))) {
throw new AccessDeniedException(get_string('cannotinvitetogroup', 'group'));
}
}
if (record_exists('group_member', 'group', $groupid, 'member', $userid) || record_exists('group_member_invite', 'group', $groupid, 'member', $userid)) {
throw new UserException(get_string('useralreadyinvitedtogroup', 'group'));
}
define('TITLE', get_string('invitemembertogroup', 'group', display_name($userid), $group->name));
$roles = group_get_role_info($groupid);
foreach ($roles as $k => &$v) {
$v = $v->display;
}
safe_require('grouptype', $group->grouptype);
$form = pieform(array('name' => 'invitetogroup', 'autofocus' => false, 'method' => 'post', 'elements' => array('reason' => array('type' => 'textarea', 'cols' => 50, 'rows' => 4, 'title' => get_string('reason')), 'role' => array('type' => 'select', 'options' => $roles, 'title' => get_string('Role', 'group'), 'defaultvalue' => call_static_method('GroupType' . $group->grouptype, 'default_role'), 'ignore' => $role != 'admin'), 'submit' => array('type' => 'submitcancel', 'value' => array(get_string('invite', 'group'), get_string('cancel')), 'goto' => profile_url($user)))));
$smarty = smarty();
$smarty->assign('subheading', TITLE);
$smarty->assign('form', $form);
$smarty->display('group/invite.tpl');
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));
}
示例14: pieform
}
}
// Suspend users
$suspendform = pieform(array('name' => 'suspend', 'class' => 'bulkactionform', 'renderer' => 'oneline', 'elements' => array('users' => $userelement, 'reason' => array('type' => 'text', 'title' => get_string('suspendedreason', 'admin') . ': '), 'suspend' => array('type' => 'submit', 'value' => get_string('Suspend', 'admin')))));
// Change authentication method
$changeauthform = null;
if (count($options) > 1) {
$changeauthform = pieform(array('name' => 'changeauth', 'class' => 'bulkactionform', 'renderer' => 'oneline', 'dieaftersubmit' => false, 'elements' => array('users' => $userelement, 'title' => array('type' => 'html', 'class' => 'bulkaction-title', 'value' => get_string('changeauthmethod', 'admin') . ': '), 'authinstance' => array('type' => 'select', 'options' => $options, 'defaultvalue' => $default), 'changeauth' => array('type' => 'submit', 'value' => get_string('submit')))));
}
// Set probation points
$probationform = null;
if (is_using_probation()) {
$probationform = pieform(array('name' => 'probation', 'class' => 'bulkactionform', 'renderer' => 'oneline', 'elements' => array('users' => $userelement, 'probationpoints' => array('type' => 'select', 'title' => get_string('probationbulksetspamprobation', 'admin') . ': ', 'options' => probation_form_options(), 'defaultvalue' => '0'), 'setprobation' => array('type' => 'submit', 'confirm' => get_string('probationbulkconfirm', 'admin'), 'value' => get_string('probationbulkset', 'admin')))));
}
// Delete users
$deleteform = pieform(array('name' => 'delete', 'class' => 'bulkactionform delete', 'renderer' => 'oneline', 'elements' => array('users' => $userelement, 'title' => array('type' => 'html', 'class' => 'bulkaction-title', 'value' => get_string('deleteusers', 'admin') . ': '), 'delete' => array('type' => 'submit', 'confirm' => get_string('confirmdeleteusers', 'admin'), 'value' => get_string('delete')))));
$smarty = smarty();
$smarty->assign('PAGEHEADING', TITLE);
$smarty->assign('users', $users);
$smarty->assign('changeauthform', $changeauthform);
$smarty->assign('suspendform', $suspendform);
$smarty->assign('deleteform', $deleteform);
$smarty->assign('probationform', $probationform);
$smarty->display('admin/users/bulk.tpl');
function changeauth_validate(Pieform $form, $values)
{
global $userids, $SESSION;
// Make sure all users are members of the institution that
// this authinstance belongs to.
$authobj = AuthFactory::create($values['authinstance']);
if ($authobj->institution != 'mahara') {
示例15: array
}
}
}
}
$elements = array('firstname' => array('type' => 'text', 'title' => get_string('firstname'), 'rules' => array('required' => true), 'class' => 'form-control text'), 'lastname' => array('type' => 'text', 'title' => get_string('lastname'), 'rules' => array('required' => true), 'class' => 'form-control text'), 'email' => array('type' => 'text', 'title' => get_string('email'), 'rules' => array('required' => true), 'class' => 'form-control text'), 'leap2afile' => array('type' => 'file', 'class' => 'leap2aupload', 'title' => ''), 'username' => array('type' => 'text', 'title' => get_string('username'), 'rules' => array('required' => true, 'maxlength' => 236)), 'password' => array('type' => 'password', 'title' => get_string('password'), 'rules' => array('required' => true)), 'staff' => array('type' => 'switchbox', 'title' => get_string('sitestaff', 'admin'), 'ignore' => !$USER->get('admin')), 'admin' => array('type' => 'switchbox', 'title' => get_string('siteadmin', 'admin'), 'ignore' => !$USER->get('admin')), 'quota' => array('type' => 'bytes', 'title' => get_string('filequota1', 'admin'), 'rules' => array('integer' => true, 'minvalue' => 0), 'defaultvalue' => get_config_plugin('artefact', 'file', 'defaultquota')), 'authinstance' => array('type' => 'select', 'title' => get_string('institution'), 'options' => $options, 'defaultvalue' => 1, 'rules' => array('required' => true), 'ignore' => !$authinstancecount), 'institutionadmin' => array('type' => 'switchbox', 'class' => 'last', 'title' => get_string('institutionadministrator', 'admin'), 'ignore' => !$authinstancecount), 'submit' => array('type' => 'submit', 'value' => get_string('createuser', 'admin'), 'class' => 'btn-success btn-lg btn-block mtm'));
if (!$USER->get('admin')) {
unset($elements['authinstance']['defaultvalue']);
}
if (!($USER->get('admin') || get_config_plugin('artefact', 'file', 'institutionaloverride'))) {
$elements['quota'] = array('type' => 'text', 'disabled' => true, 'title' => get_string('filequota1', 'admin'), 'description' => get_string('filequotadescription', 'admin'), 'value' => display_size(get_config_plugin('artefact', 'file', 'defaultquota')));
}
// Add general account options
$prefs = (object) expected_account_preferences();
$elements = array_merge($elements, general_account_prefs_form_elements($prefs));
unset($prefs);
$form = pieform(array('name' => 'adduser', 'class' => 'panel panel-default panel-body pts', 'autofocus' => false, 'template' => 'adduser.php', 'templatedir' => pieform_template_dir('adduser.php'), 'plugintype' => 'core', 'pluginname' => 'admin', 'class' => 'form-condensed', 'elements' => $elements));
function adduser_validate(Pieform $form, $values)
{
global $USER, $TRANSPORTER;
$authobj = AuthFactory::create($values['authinstance']);
$institution = $authobj->institution;
// Institutional admins can only set their own institutions' authinstances
if (!$USER->get('admin') && !$USER->is_institutional_admin($authobj->institution)) {
$form->set_error('authinstance', get_string('notadminforinstitution', 'admin'));
return;
}
$institution = new Institution($authobj->institution);
// Don't exceed max user accounts for the institution
if ($institution->isFull()) {
$institution->send_admin_institution_is_full_message();
$form->set_error('authinstance', get_string('institutionmaxusersexceeded', 'admin'));