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'); }
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; }
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'); }
/** * @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); }
/** * @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); }
/** * * @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) {
$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()))));
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']));
/** * 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; }
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();
} // 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'));
$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');
$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)); }
} } // 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') {
} } } } $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'));
// Currently site files don't work properly with site skins. And since site files are the only files that would make // sense with site skins, we're going to just hide background images entirely for site skins for the time being. if (!$designsiteskin) { $elements['skinbg']['elements'] = array_merge($elements['skinbg']['elements'], array('body_background_image' => array('type' => 'filebrowser', 'title' => get_string('bodybgimage', 'skin'), 'folder' => isset($folder) ? $folder : 0, 'highlight' => $highlight, 'browse' => isset($folder) ? 1 : 0, 'filters' => array('artefacttype' => array('image', 'profileicon')), 'page' => get_config('wwwroot') . 'skin/design.php?id=' . $id . '&fs=skinbg', 'config' => array('upload' => false, '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, 'selectone' => true), 'defaultvalue' => !empty($viewskin['body_background_image']) ? array(intval($viewskin['body_background_image'])) : array(), 'selectlistcallback' => 'artefact_get_records_by_id'), 'body_background_repeat' => array('type' => 'select', 'title' => get_string('backgroundrepeat', 'skin'), 'defaultvalue' => !empty($viewskin['body_background_repeat']) ? intval($viewskin['body_background_repeat']) : 4, 'options' => array(Skin::BACKGROUND_REPEAT_NO => get_string('backgroundrepeatno', 'skin'), Skin::BACKGROUND_REPEAT_X => get_string('backgroundrepeatx', 'skin'), Skin::BACKGROUND_REPEAT_Y => get_string('backgroundrepeaty', 'skin'), Skin::BACKGROUND_REPEAT_BOTH => get_string('backgroundrepeatboth', 'skin'))), 'body_background_attachment' => array('type' => 'radio', 'title' => get_string('backgroundattachment', 'skin'), 'defaultvalue' => !empty($viewskin['body_background_repeat']) ? $viewskin['body_background_attachment'] : 'scroll', 'options' => array('fixed' => get_string('backgroundfixed', 'skin'), 'scroll' => get_string('backgroundscroll', 'skin'))), 'body_background_position' => array('type' => 'radio', 'title' => get_string('backgroundposition', 'skin'), 'defaultvalue' => !empty($viewskin['body_background_position']) ? intval($viewskin['body_background_position']) : 1, 'rowsize' => 3, 'hiddenlabels' => true, 'separator' => '<br />', 'options' => $positions))); } $elements['viewbg'] = array('type' => 'fieldset', 'legend' => get_string('viewbackgroundoptions', 'skin'), 'class' => $fieldset != 'viewbg' ? 'collapsed' : '', 'elements' => array('view_background_color' => array('type' => 'color', 'title' => get_string('viewbgcolor', 'skin'), 'defaultvalue' => !empty($viewskin['view_background_color']) ? $viewskin['view_background_color'] : '#FFFFFF', 'size' => 7, 'options' => array('transparent' => true)))); if (!$designsiteskin) { $elements['viewbg']['elements'] = array_merge($elements['viewbg']['elements'], array('view_background_image' => array('type' => 'filebrowser', 'title' => get_string('viewbgimage', 'skin'), 'folder' => isset($folder) ? $folder : 0, 'highlight' => $highlight, 'browse' => isset($folder) ? 1 : 0, 'filters' => array('artefacttype' => array('image', 'profileicon')), 'page' => get_config('wwwroot') . 'skin/design.php?id=' . $id . '&fs=viewbg', 'config' => array('upload' => false, '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, 'selectone' => true), 'defaultvalue' => !empty($viewskin['view_background_image']) ? array(intval($viewskin['view_background_image'])) : array(), 'selectlistcallback' => 'artefact_get_records_by_id'), 'view_background_repeat' => array('type' => 'select', 'title' => get_string('backgroundrepeat', 'skin'), 'defaultvalue' => !empty($viewskin['view_background_repeat']) ? intval($viewskin['view_background_repeat']) : 4, 'options' => array(Skin::BACKGROUND_REPEAT_NO => get_string('backgroundrepeatno', 'skin'), Skin::BACKGROUND_REPEAT_X => get_string('backgroundrepeatx', 'skin'), Skin::BACKGROUND_REPEAT_Y => get_string('backgroundrepeaty', 'skin'), Skin::BACKGROUND_REPEAT_BOTH => get_string('backgroundrepeatboth', 'skin'))), 'view_background_attachment' => array('type' => 'radio', 'title' => get_string('backgroundattachment', 'skin'), 'defaultvalue' => !empty($viewskin['view_background_repeat']) ? $viewskin['view_background_attachment'] : 'scroll', 'options' => array('fixed' => get_string('backgroundfixed', 'skin'), 'scroll' => get_string('backgroundscroll', 'skin'))), 'view_background_position' => array('type' => 'radio', 'title' => get_string('backgroundposition', 'skin'), 'defaultvalue' => !empty($viewskin['view_background_position']) ? intval($viewskin['view_background_position']) : 1, 'rowsize' => 3, 'hiddenlabels' => true, 'separator' => '<br />', 'options' => $positions), 'view_background_width' => array('type' => 'select', 'title' => get_string('viewwidth', 'skin'), 'defaultvalue' => !empty($viewskin['view_background_width']) ? intval($viewskin['view_background_width']) : 90, 'options' => array(50 => '50%', 60 => '60%', 70 => '70%', 80 => '80%', 90 => '90%', 100 => '100%')))); } $elements['viewheader'] = array('type' => 'fieldset', 'legend' => get_string('viewheaderoptions', 'skin'), 'class' => $fieldset != 'viewheader' ? 'collapsed' : '', 'elements' => array('header_background_color' => array('type' => 'color', 'title' => get_string('backgroundcolor', 'skin'), 'defaultvalue' => !empty($viewskin['header_background_color']) ? $viewskin['header_background_color'] : '#CCCCCC', 'size' => 7, 'options' => array('transparent' => true)), 'header_text_font_color' => array('type' => 'color', 'title' => get_string('textcolor', 'skin'), 'defaultvalue' => !empty($viewskin['header_text_font_color']) ? $viewskin['header_text_font_color'] : '#000000', 'size' => 7, 'options' => array('transparent' => true)), 'header_link_normal_color' => array('type' => 'color', 'title' => get_string('normallinkcolor', 'skin'), 'defaultvalue' => !empty($viewskin['header_link_normal_color']) ? $viewskin['header_link_normal_color'] : '#0000EE', 'size' => 7, 'options' => array('transparent' => true)), 'header_link_normal_underline' => array('type' => 'checkbox', 'title' => get_string('linkunderlined', 'skin'), 'defaultvalue' => isset($viewskin['header_link_normal_underline']) and intval($viewskin['header_link_normal_underline']) == 1 ? 'checked' : ''), 'header_link_hover_color' => array('type' => 'color', 'title' => get_string('hoverlinkcolor', 'skin'), 'defaultvalue' => !empty($viewskin['header_link_hover_color']) ? $viewskin['header_link_hover_color'] : '#EE0000', 'size' => 7, 'options' => array('transparent' => true)), 'header_link_hover_underline' => array('type' => 'checkbox', 'title' => get_string('linkunderlined', 'skin'), 'defaultvalue' => isset($viewskin['header_link_hover_underline']) and intval($viewskin['header_link_hover_underline']) == 1 ? 'checked' : ''), 'header_logo_image' => array('type' => 'radio', 'id' => 'designskinform_header_logo', 'title' => get_string('headerlogoimage1', 'skin'), 'defaultvalue' => !empty($viewskin['header_logo_image']) ? $viewskin['header_logo_image'] : 'normal', 'options' => array('normal' => get_string('headerlogoimagenormal', 'skin'), 'light' => get_string('headerlogoimagelight1', 'skin'), 'dark' => get_string('headerlogoimagedark1', 'skin')), 'separator' => '<br />'))); $elements['viewcontent'] = array('type' => 'fieldset', 'legend' => get_string('viewcontentoptions', 'skin'), 'class' => $fieldset != 'viewcontent' ? 'collapsed' : '', 'elements' => array('view_heading_font_family' => array('type' => 'select', 'title' => get_string('headingfontfamily', 'skin'), 'defaultvalue' => !empty($viewskin['view_heading_font_family']) ? $viewskin['view_heading_font_family'] : 'Arial', 'width' => 144, 'options' => Skin::get_all_font_options()), 'view_text_font_family' => array('type' => 'select', 'title' => get_string('textfontfamily', 'skin'), 'defaultvalue' => !empty($viewskin['view_text_font_family']) ? $viewskin['view_text_font_family'] : 'Arial', 'width' => 144, 'options' => Skin::get_textonly_font_options()), 'view_text_font_size' => array('type' => 'select', 'title' => get_string('fontsize', 'skin'), 'defaultvalue' => !empty($viewskin['view_text_font_size']) ? $viewskin['view_text_font_size'] : 'small', 'width' => 144, 'height' => 22, 'options' => array('xx-small' => array('value' => get_string('fontsizesmallest', 'skin'), 'style' => 'font-size: xx-small;'), 'x-small' => array('value' => get_string('fontsizesmaller', 'skin'), 'style' => 'font-size: x-small;'), 'small' => array('value' => get_string('fontsizesmall', 'skin'), 'style' => 'font-size: small;'), 'medium' => array('value' => get_string('fontsizemedium', 'skin'), 'style' => 'font-size: medium;'), 'large' => array('value' => get_string('fontsizelarge', 'skin'), 'style' => 'font-size: large;'), 'x-large' => array('value' => get_string('fontsizelarger', 'skin'), 'style' => 'font-size: x-large;'), 'xx-large' => array('value' => get_string('fontsizelargest', 'skin'), 'style' => 'font-size: xx-large;'))), 'view_text_font_color' => array('type' => 'color', 'title' => get_string('textcolor', 'skin'), 'description' => get_string('textcolordescription', 'skin'), 'defaultvalue' => !empty($viewskin['view_text_font_color']) ? $viewskin['view_text_font_color'] : '#000000', 'size' => 7, 'options' => array('transparent' => true)), 'view_text_heading_color' => array('type' => 'color', 'title' => get_string('headingcolor', 'skin'), 'description' => get_string('headingcolordescription', 'skin'), 'defaultvalue' => !empty($viewskin['view_text_heading_color']) ? $viewskin['view_text_heading_color'] : '#000000', 'size' => 7, 'options' => array('transparent' => true)), 'view_text_emphasized_color' => array('type' => 'color', 'title' => get_string('emphasizedcolor', 'skin'), 'description' => get_string('emphasizedcolordescription', 'skin'), 'defaultvalue' => !empty($viewskin['view_text_emphasized_color']) ? $viewskin['view_text_emphasized_color'] : '#000000', 'size' => 7, 'options' => array('transparent' => true)), 'view_link_normal_color' => array('type' => 'color', 'title' => get_string('normallinkcolor', 'skin'), 'defaultvalue' => !empty($viewskin['view_link_normal_color']) ? $viewskin['view_link_normal_color'] : '#0000EE', 'size' => 7, 'options' => array('transparent' => true)), 'view_link_normal_underline' => array('type' => 'checkbox', 'title' => get_string('linkunderlined', 'skin'), 'defaultvalue' => isset($viewskin['view_link_normal_underline']) and intval($viewskin['view_link_normal_underline']) == 1 ? 'checked' : ''), 'view_link_hover_color' => array('type' => 'color', 'title' => get_string('hoverlinkcolor', 'skin'), 'defaultvalue' => !empty($viewskin['view_link_hover_color']) ? $viewskin['view_link_hover_color'] : '#EE0000', 'size' => 7, 'options' => array('transparent' => true)), 'view_link_hover_underline' => array('type' => 'checkbox', 'title' => get_string('linkunderlined', 'skin'), 'defaultvalue' => isset($viewskin['view_link_hover_underline']) and intval($viewskin['view_link_hover_underline']) == 1 ? 'checked' : ''))); $elements['viewtable'] = array('type' => 'fieldset', 'legend' => get_string('viewtableoptions', 'skin'), 'class' => $fieldset != 'viewtable' ? 'collapsed' : '', 'elements' => array('view_table_border_color' => array('type' => 'color', 'title' => get_string('tableborder', 'skin'), 'defaultvalue' => !empty($viewskin['view_table_border_color']) ? $viewskin['view_table_border_color'] : '#CCCCCC', 'size' => 7, 'options' => array('transparent' => true)), 'view_table_header_color' => array('type' => 'color', 'title' => get_string('tableheader', 'skin'), 'defaultvalue' => !empty($viewskin['view_table_header_color']) ? $viewskin['view_table_header_color'] : '#CCCCCC', 'size' => 7, 'options' => array('transparent' => true)), 'view_table_header_text_color' => array('type' => 'color', 'title' => get_string('tableheadertext', 'skin'), 'defaultvalue' => !empty($viewskin['view_table_header_text_color']) ? $viewskin['view_table_header_text_color'] : '#000000', 'size' => 7, 'options' => array('transparent' => true)), 'view_table_odd_row_color' => array('type' => 'color', 'title' => get_string('tableoddrows', 'skin'), 'defaultvalue' => !empty($viewskin['view_table_odd_row_color']) ? $viewskin['view_table_odd_row_color'] : '#EEEEEE', 'size' => 7, 'options' => array('transparent' => true)), 'view_table_even_row_color' => array('type' => 'color', 'title' => get_string('tableevenrows', 'skin'), 'defaultvalue' => !empty($viewskin['view_table_even_row_color']) ? $viewskin['view_table_even_row_color'] : '#FFFFFF', 'size' => 7, 'options' => array('transparent' => true)), 'view_button_normal_color' => array('type' => 'color', 'title' => get_string('normalbuttoncolor', 'skin'), 'defaultvalue' => !empty($viewskin['view_button_normal_color']) ? $viewskin['view_button_normal_color'] : '#CCCCCC', 'options' => array('transparent' => true)), 'view_button_hover_color' => array('type' => 'color', 'title' => get_string('hoverbuttoncolor', 'skin'), 'defaultvalue' => !empty($viewskin['view_button_hover_color']) ? $viewskin['view_button_hover_color'] : '#EEEEEE', 'options' => array('transparent' => true)), 'view_button_text_color' => array('type' => 'color', 'title' => get_string('buttontextcolor', 'skin'), 'defaultvalue' => !empty($viewskin['view_button_text_color']) ? $viewskin['view_button_text_color'] : '#FFFFFF', 'options' => array('transparent' => true)))); $elements['viewadvanced'] = array('type' => 'fieldset', 'legend' => get_string('viewadvancedoptions', 'skin'), 'class' => $fieldset != 'viewadvanced' ? 'collapsed' : '', 'elements' => array('view_custom_css' => array('type' => 'textarea', 'rows' => 7, 'cols' => 50, 'style' => 'font-family:monospace', 'resizable' => true, 'fullwidth' => true, 'title' => get_string('skincustomcss', 'skin'), 'description' => get_string('skincustomcssdescription', 'skin'), 'defaultvalue' => !empty($viewskin['view_custom_css']) ? $viewskin['view_custom_css'] : null))); $elements['fs'] = array('type' => 'hidden', 'value' => $fieldset); $elements['submit'] = array('type' => 'submitcancel', 'value' => array(get_string('save', 'mahara'), get_string('cancel', 'mahara')), 'goto' => get_config('wwwroot') . $goto); $designskinform = pieform(array('name' => 'designskinform', 'class' => 'jstabs', 'method' => 'post', 'plugintype' => 'core', 'pluginname' => 'skin', 'renderer' => 'table', 'autofocus' => false, 'configdirs' => array(get_config('libroot') . 'form/', get_config('docroot') . 'artefact/file/form/'), 'elements' => $elements)); $smarty = smarty(array('jquery', 'tabs'), array(), array('mahara' => array('tab', 'selected')), array()); $smarty->assign('LANG', substr($CFG->lang, 0, 2)); $smarty->assign('USER', $USER); $smarty->assign('designskinform', $designskinform); $smarty->assign('PAGEHEADING', hsc(TITLE)); $smarty->display('skin/design.tpl'); function designskinform_validate(Pieform $form, $values) { global $USER; if (isset($values['viewskin_access']) && !($values['viewskin_access'] == 'site')) { $artefactfields = array('body_background_image', 'view_background_image'); foreach ($artefactfields as $field) { if (empty($values[$field])) { continue; }
$configdata = $bi->get('configdata'); if (!isset($configdata['showsharedviews'])) { $configdata['showsharedviews'] = 1; } $limit = isset($configdata['count']) ? intval($configdata['count']) : 5; $limit = $limit > 0 ? $limit : 5; // Find out what order to sort them by (default is titles) if (!isset($configdata['sortsharedviewsby']) || $configdata['sortsharedviewsby'] == PluginBlocktypeGroupViews::SORTBY_TITLE) { $sortsharedviewsby = 'v.title'; } else { $sortsharedviewsby = 'v.mtime DESC'; } // For group members, display a list of views that others have // shared to the group if (empty($configdata['showsharedviews'])) { $sharedviews = array('data' => array(), 'count' => 0, 'limit' => $limit, 'offset' => 0); } else { $sharedviews = (array) View::get_sharedviews_data($limit, $offset, $groupid, $configdata['showsharedviews'] == 2 ? false : true, $sortsharedviewsby); foreach ($sharedviews['data'] as &$view) { if (!$editing && isset($view['template']) && $view['template']) { $view['form'] = pieform(create_view_form($group, null, $view->id)); } } } if (!empty($configdata['showsharedviews'])) { $baseurl = $group_homepage_view->get_url(); $baseurl .= (strpos($baseurl, '?') === false ? '?' : '&') . 'group=' . $groupid . '&editing=' . $editing; $pagination = array('baseurl' => $baseurl, 'id' => 'sharedviews_pagination', 'datatable' => 'sharedviewlist', 'jsonscript' => 'blocktype/groupviews/sharedviews.json.php', 'resultcounttextsingular' => get_string('view', 'view'), 'resultcounttextplural' => get_string('views', 'view')); PluginBlocktypeGroupViews::render_items($sharedviews, 'blocktype:groupviews:sharedviews.tpl', $configdata, $pagination); } json_reply(false, array('data' => $sharedviews));
} } //END OVERWRITE 1 } $elements = array('firstname' => array('type' => 'text', 'title' => get_string('firstname'), 'rules' => array('required' => true)), 'lastname' => array('type' => 'text', 'title' => get_string('lastname'), 'rules' => array('required' => true)), 'email' => array('type' => 'text', 'title' => get_string('email'), 'rules' => array('required' => true)), 'leap2afile' => array('type' => 'file', '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' => 'checkbox', 'title' => get_string('sitestaff', 'admin'), 'ignore' => !$USER->get('admin')), 'admin' => array('type' => 'checkbox', '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' => $mhr_auth_instance->id, 'rules' => array('required' => true), 'ignore' => !$authinstancecount), 'institutionadmin' => array('type' => 'checkbox', 'title' => get_string('institutionadministrator', 'admin'), 'ignore' => !$authinstancecount), 'submit' => array('type' => 'submit', 'value' => get_string('createuser', 'admin'))); 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', 'autofocus' => false, 'template' => 'adduser.php', 'templatedir' => pieform_template_dir('adduser.php'), 'plugintype' => 'core', 'pluginname' => 'admin', '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; } // OVERWRITE 3: insert if ($authobj->authname != 'internal') { $form->set_error('authinstance', 'Must be internal'); return; }
* @subpackage artefact-internal * @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('MENUITEM', 'myportfolio/blogs'); define('SECTION_PLUGINTYPE', 'artefact'); define('SECTION_PLUGINNAME', 'blog'); define('SECTION_PAGE', 'new'); require dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php'; define('TITLE', get_string('newblog', 'artefact.blog')); require_once 'pieforms/pieform.php'; safe_require('artefact', 'blog'); $form = pieform(array('name' => 'newblog', 'method' => 'post', 'action' => '', 'plugintype' => 'artefact', 'pluginname' => 'blog', 'elements' => array('title' => array('type' => 'text', 'title' => get_string('blogtitle', 'artefact.blog'), 'description' => get_string('blogtitledesc', 'artefact.blog'), 'rules' => array('required' => true)), 'description' => array('type' => 'wysiwyg', 'rows' => 10, 'cols' => 70, 'title' => get_string('blogdesc', 'artefact.blog'), 'description' => get_string('blogdescdesc', 'artefact.blog'), 'rules' => array('required' => false)), 'tags' => array('type' => 'tags', 'title' => get_string('tags'), 'description' => get_string('tagsdescprofile'), 'help' => true), 'submit' => array('type' => 'submitcancel', 'value' => array(get_string('createblog', 'artefact.blog'), get_string('cancel', 'artefact.blog')))))); $smarty =& smarty(); $smarty->assign_by_ref('newblogform', $form); $smarty->display('artefact:blog:new.tpl'); exit; /** * This function gets called to submit the new blog. * * @param array */ function newblog_submit(Pieform $form, $values) { global $USER; ArtefactTypeBlog::new_blog($USER, $values); redirect('/artefact/blog/'); }
* @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('ADMIN', 1); require dirname(dirname(dirname(__FILE__))) . '/init.php'; define('TITLE', get_string('suspenduser', 'admin')); define('SECTION_PLUGINTYPE', 'core'); define('SECTION_PLUGINNAME', 'admin'); require_once 'pieforms/pieform.php'; $id = param_integer('id'); if (!($user = get_record('usr', 'id', $id))) { throw new UserNotFoundException("User not found"); } $f = pieform(array('name' => 'suspend', 'elements' => array('id' => array('type' => 'hidden', 'value' => $id), 'reason' => array('type' => 'text', 'title' => get_string('reason')), 'submit' => array('type' => 'submitcancel', 'value' => array(get_string('suspenduser', 'admin'), get_string('cancel')))))); function suspend_submit(Pieform $form, $values) { global $SESSION; suspend_user($values['id'], $values['reason']); $SESSION->add_ok_msg(get_string('usersuspended', 'admin')); redirect('/user/view.php?id=' . $values['id']); } function suspend_cancel_submit() { redirect('/admin/users/search.php'); } $smarty = smarty(); $smarty->assign('user', $user); $smarty->assign('form', $f); $smarty->display('admin/users/suspend.tpl');
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL * @copyright (C) 2011 James Kerrigan and Geoffrey Rowland geoff.rowland@yeovil.ac.uk * */ define('INTERNAL', true); define('MENUITEM', 'content/cpds'); require_once dirname(dirname(dirname(dirname(__FILE__)))) . '/init.php'; require_once 'pieforms/pieform.php'; safe_require('artefact', 'cpds'); define('TITLE', get_string('deletecpd', 'artefact.cpds')); $id = param_integer('id'); $todelete = new ArtefactTypeCpd($id); if (!$USER->can_edit_artefact($todelete)) { throw new AccessDeniedException(get_string('accessdenied', 'error')); } $deleteform = array('name' => 'deletecpdform', 'plugintype' => 'artefact', 'pluginname' => 'cpd', 'renderer' => 'div', 'elements' => array('submit' => array('type' => 'submitcancel', 'value' => array(get_string('deletecpd', 'artefact.cpds'), get_string('cancel')), 'goto' => get_config('wwwroot') . '/artefact/cpds/'))); $form = pieform($deleteform); $smarty = smarty(); $smarty->assign('form', $form); $smarty->assign('PAGEHEADING', $todelete->get('title')); $smarty->assign('subheading', get_string('deletethiscpd', 'artefact.cpds', $todelete->get('title'))); $smarty->assign('message', get_string('deletecpdconfirm', 'artefact.cpds')); $smarty->display('artefact:cpds:delete.tpl'); // calls this function first so that we can get the artefact and call delete on it function deletecpdform_submit(Pieform $form, $values) { global $SESSION, $todelete; $todelete->delete(); $SESSION->add_ok_msg(get_string('cpddeletedsuccessfully', 'artefact.cpds')); redirect('/artefact/cpds/'); }
foreach ($menulist as &$menu) { $menu = array('value' => $menu, 'name' => get_string($menu, 'admin')); } // Edit form for footer links $all = footer_menu(true); $active = get_config('footerlinks'); $active = $active ? unserialize($active) : array_keys($all); $activeurls = get_config('footercustomlinks'); $activeurls = $activeurls ? unserialize($activeurls) : null; $footerelements = array(); foreach ($all as $k => $v) { $footerelements[$k] = array('type' => 'switchbox', 'class' => 'last pb0', 'title' => $v['title'], 'defaultvalue' => in_array($k, $active), 'onclick' => "getElement('footerlinks_{$k}_link').disabled = !this.checked;"); $footerelements[$k . '_link'] = array('type' => 'text', 'size' => 60, 'description' => get_string('footercustomlink', 'admin', $v['url']), 'defaultvalue' => isset($activeurls[$k]) ? $activeurls[$k] : '', 'disabled' => !in_array($k, $active)); } $footerelements['submit'] = array('class' => 'btn-primary', 'type' => 'submit', 'value' => get_string('savechanges', 'admin')); $footerform = pieform(array('name' => 'footerlinks', 'elements' => $footerelements)); function footerlinks_submit(Pieform $form, $values) { global $active, $activeurls, $all, $SESSION; $new = array(); $newurls = array(); foreach (array_keys($all) as $k) { if (!empty($values[$k])) { $new[] = $k; } if (!empty($values[$k . '_link']) && $values[$k . '_link'] != $all[$k]['url']) { $newurls[$k] = $values[$k . '_link']; } } if ($new != $active) { set_config('footerlinks', serialize($new));
* */ define('INTERNAL', true); define('MENUITEM', 'profile/mygoals'); define('SECTION_PLUGINTYPE', 'artefact'); define('SECTION_PLUGINNAME', 'resume'); define('SECTION_PAGE', 'goals'); require_once dirname(dirname(dirname(__FILE__))) . '/init.php'; require_once 'pieforms/pieform.php'; require_once get_config('docroot') . 'artefact/lib.php'; $personal = null; $academic = null; $career = null; try { $personal = artefact_instance_from_type('personalgoal'); } catch (Exception $e) { } try { $academic = artefact_instance_from_type('academicgoal'); } catch (Exception $e) { } try { $career = artefact_instance_from_type('careergoal'); } catch (Exception $e) { } $gform = array('name' => 'goalform', 'jsform' => true, 'plugintype' => 'artefact', 'pluginname' => 'resume', 'successcallback' => 'goalandskillform_submit', 'elements' => array('personalgoal' => array('type' => 'wysiwyg', 'rows' => 10, 'cols' => 65, 'defaultvalue' => !empty($personal) ? $personal->get('description') : null, 'title' => get_string('personalgoal', 'artefact.resume')), 'academicgoal' => array('type' => 'wysiwyg', 'rows' => 10, 'cols' => 65, 'defaultvalue' => !empty($academic) ? $academic->get('description') : null, 'title' => get_string('academicgoal', 'artefact.resume')), 'careergoal' => array('type' => 'wysiwyg', 'rows' => 10, 'cols' => 65, 'defaultvalue' => !empty($career) ? $career->get('description') : null, 'title' => get_string('careergoal', 'artefact.resume')), 'submit' => array('type' => 'submit', 'value' => get_string('save')))); $goalform = pieform($gform); $smarty = smarty(); $smarty->assign('goalform', $goalform); $smarty->assign('heading', get_string('mygoals', 'artefact.resume')); $smarty->display('artefact:resume:goals.tpl');
$returnto = param_alpha('returnto', 'mygroups'); define('GROUP', $groupid); $group = group_current_group(); define('TITLE', $group->name); if (!group_user_access($group->id)) { throw new AccessDeniedException(get_string('notamember', 'group')); } if (!group_user_can_leave($group)) { throw new AccessDeniedException(get_string('cantleavegroup', 'group')); } $goto = get_config('wwwroot') . 'group/' . $returnto . '.php' . ($returnto == 'view' ? '?id=' . $groupid : ''); $views = count_records_sql('SELECT COUNT(*) FROM {view} v INNER JOIN {view_access_group} a ON a.group = ? AND a.view = v.id WHERE v.owner = ?', array($groupid, $USER->get('id'))); $form = pieform(array('name' => 'leavegroup', 'renderer' => 'div', 'autofocus' => false, 'method' => 'post', 'elements' => array('submit' => array('type' => 'submitcancel', 'value' => array(get_string('yes'), get_string('no')), 'goto' => $goto), 'returnto' => array('type' => 'hidden', 'value' => $returnto)))); $smarty = smarty(); $smarty->assign('subheading', get_string('leavespecifiedgroup', 'group', $group->name)); $smarty->assign('form', $form); $smarty->assign('message', $views ? get_string('groupconfirmleavehasviews', 'group') : get_string('groupconfirmleave', 'group')); $smarty->assign('group', $group); $smarty->display('group/leave.tpl'); function leavegroup_submit(Pieform $form, $values) { global $USER, $SESSION, $groupid, $goto; group_remove_user($groupid, $USER->get('id')); $SESSION->add_ok_msg(get_string('leftgroup', 'group')); redirect($goto); }
*/ define('INTERNAL', 1); define('INSTITUTIONALADMIN', 1); define('MENUITEM', 'manageinstitutions/institutionfiles'); define('SECTION_PLUGINTYPE', 'artefact'); define('SECTION_PLUGINNAME', 'file'); define('SECTION_PAGE', 'institutionfiles'); require dirname(dirname(dirname(__FILE__))) . '/init.php'; safe_require('artefact', 'file'); require_once get_config('libroot') . 'institution.php'; $institution = param_alphanum('institution', false); define('TITLE', get_string('institutionfiles', 'admin')); $s = institution_selector_for_page($institution, get_config('wwwroot') . 'artefact/file/institutionfiles.php'); $institution = $s['institution']; $pagebase = get_config('wwwroot') . 'artefact/file/institutionfiles.php?institution=' . $institution; $form = pieform(ArtefactTypeFileBase::files_form($pagebase, null, $institution)); $js = ArtefactTypeFileBase::files_js(); $smarty = smarty(); setpageicon($smarty, 'icon-university'); if ($institution === false) { $smarty->display('admin/users/noinstitutions.tpl'); exit; } if (!$USER->can_edit_institution($institution)) { throw new AccessDeniedException(); } $smarty->assign('institution', $institution); $smarty->assign('institutionselector', $s['institutionselector']); $smarty->assign('form', $form); $smarty->assign('INLINEJAVASCRIPT', $s['institutionselectorjs'] . $js); $smarty->assign('PAGEHEADING', TITLE);
WHERE topic IN (' . implode(',', $checked) . ') AND "user" = ?', array($USER->get('id'))); $SESSION->add_ok_msg(get_string('topicunsubscribesuccess', 'interaction.forum')); } } } } } } } else { // $checked contains bad values $SESSION->add_error_msg(get_string('topicupdatefailed', 'interaction.forum')); } redirect('/interaction/forum/view.php?id=' . $forumid . '&offset=' . $offset); } if ($membership) { $forum->subscribe = pieform(array('name' => 'subscribe_forum', 'renderer' => 'div', 'plugintype' => 'interaction', 'pluginname' => 'forum', 'autofocus' => false, 'elements' => array('submit' => array('type' => 'submit', 'class' => 'btn-subscribe', 'value' => $forum->subscribed ? get_string('unsubscribefromforum', 'interaction.forum') : get_string('subscribetoforum', 'interaction.forum'), 'help' => true), 'forum' => array('type' => 'hidden', 'value' => $forumid), 'redirect' => array('type' => 'hidden', 'value' => 'view'), 'offset' => array('type' => 'hidden', 'value' => $offset), 'type' => array('type' => 'hidden', 'value' => $forum->subscribed ? 'unsubscribe' : 'subscribe')))); } // gets the info about topics // the last post is found by taking the max id of the posts in a topic with the max post time // taking the max id is needed because multiple posts can have the same post time $sql = 'SELECT t.id, p1.subject, p1.body, p1.poster, p1.deleted, m.user AS moderator, COUNT(p2.id) AS postcount, t.closed, s.topic AS subscribed, p4.id AS lastpost, ' . db_format_tsfield('p4.ctime', 'lastposttime') . ', p4.poster AS lastposter, m2.user AS lastpostermoderator FROM {interaction_forum_topic} t INNER JOIN {interaction_forum_post} p1 ON (p1.topic = t.id AND p1.parent IS NULL) LEFT JOIN ( SELECT m.forum, m.user FROM {interaction_forum_moderator} m INNER JOIN {usr} u ON (m.user = u.id AND u.deleted = 0) ) m ON (m.forum = t.forum AND p1.poster = m.user) INNER JOIN {interaction_forum_post} p2 ON (p2.topic = t.id AND p2.deleted != 1) LEFT JOIN {interaction_forum_subscription_topic} s ON (s.topic = t.id AND s."user" = ?) INNER JOIN (
if ($copy) { $type = 'submit'; $submitstr = get_string('next') . ': ' . get_string('editviews', 'collection'); $confirm = null; } else { $type = 'submitcancel'; if ($new) { $submitstr = array('button' => get_string('next') . ': ' . get_string('editviews', 'collection'), 'cancel' => get_string('cancel')); $confirm = array('cancel' => get_string('confirmcancelcreatingcollection', 'collection')); } else { $submitstr = array(get_string('save'), get_string('cancel')); $confirm = null; } } $elements['submit'] = array('type' => $type, 'class' => 'btn-primary', 'value' => $submitstr, 'confirm' => $confirm); $form = pieform(array('name' => 'edit', 'plugintype' => 'core', 'pluginname' => 'collection', 'successcallback' => 'submit', 'elements' => $elements)); $smarty = smarty(); setpageicon($smarty, 'icon-folder-open'); if (!empty($groupid)) { $smarty->assign('PAGESUBHEADING', SUBTITLE); $smarty->assign('PAGEHELPNAME', '0'); $smarty->assign('SUBPAGEHELPNAME', '1'); } else { $smarty->assign('PAGEHEADING', SUBTITLE); } $smarty->assign('PAGEHEADING', TITLE); $smarty->assign('headingclass', 'page-header'); $smarty->assign_by_ref('form', $form); $smarty->display('collection/edit.tpl'); function submit(Pieform $form, $values) {
if ($blogobj->get('institution')) { $institution = true; $institutionname = $blogobj->get('institution'); } else { if ($blogobj->get('group')) { $groupid = $blogobj->get('group'); } } PluginArtefactBlog::set_blog_nav($institution, $institutionname, $groupid); $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' => 'editpost', 'method' => 'post', 'autofocus' => $focuselement, 'jsform' => true, 'newiframeonsubmit' => true, 'jssuccesscallback' => 'editpost_callback', 'jserrorcallback' => 'editpost_callback', 'plugintype' => 'artefact', 'pluginname' => 'blog', 'configdirs' => array(get_config('libroot') . 'form/', get_config('docroot') . 'artefact/file/form/'), 'elements' => array('blog' => array('type' => 'hidden', 'value' => $blog), 'blogpost' => array('type' => 'hidden', 'value' => $blogpost), 'title' => array('type' => 'text', 'title' => get_string('posttitle', 'artefact.blog'), 'rules' => array('required' => true), 'defaultvalue' => $title), 'description' => array('type' => 'wysiwyg', 'rows' => 20, 'cols' => 70, 'title' => get_string('postbody', 'artefact.blog'), 'description' => get_string('postbodydesc', 'artefact.blog'), 'rules' => array('maxlength' => 65536, 'required' => true), 'defaultvalue' => $description), 'tags' => array('defaultvalue' => $tags, 'type' => 'tags', 'title' => get_string('tags'), 'description' => get_string('tagsdesc'), 'help' => true), 'license' => license_form_el_basic(isset($blogpostobj) ? $blogpostobj : null), 'licensing_advanced' => license_form_el_advanced(isset($blogpostobj) ? $blogpostobj : null), 'filebrowser' => array('type' => 'filebrowser', 'title' => get_string('attachments', 'artefact.blog'), 'folder' => $folder, 'highlight' => $highlight, 'institution' => $institutionname, 'group' => $groupid, 'browse' => $browse, 'page' => get_config('wwwroot') . 'artefact/blog/post.php?' . ($blogpost ? 'id=' . $blogpost : 'blog=' . $blog) . '&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' => $attachments, 'selectlistcallback' => 'artefact_get_records_by_id', 'selectcallback' => 'add_attachment', 'unselectcallback' => 'delete_attachment'), 'draft' => array('type' => 'switchbox', 'title' => get_string('draft', 'artefact.blog'), 'description' => get_string('thisisdraftdesc', 'artefact.blog'), 'defaultvalue' => $checked, 'help' => true), 'allowcomments' => array('type' => 'switchbox', 'title' => get_string('allowcomments', 'artefact.comment'), 'description' => get_string('allowcommentsonpost', 'artefact.blog'), 'defaultvalue' => $blogpost ? $blogpostobj->get('allowcomments') : 1), 'submitpost' => array('type' => 'submitcancel', 'class' => 'btn-primary', 'value' => array(get_string('savepost', 'artefact.blog'), get_string('cancel')), 'goto' => get_config('wwwroot') . 'artefact/blog/view/index.php?id=' . $blog)))); /* * Javascript specific to this page. Creates the list of files * attached to the blog post. */ $wwwroot = get_config('wwwroot'); $noimagesmessage = json_encode(get_string('noimageshavebeenattachedtothispost', 'artefact.blog')); $javascript = <<<EOF function editpost_callback(form, data) { editpost_filebrowser.callback(form, data); }; EOF; $smarty = smarty(array(), array(), array(), array('tinymceconfig' => ' image_filebrowser: "editpost_filebrowser", ', 'sideblocks' => array(array('name' => 'quota', 'weight' => -10, 'data' => array())))); $smarty->assign('INLINEJAVASCRIPT', $javascript);
$message .= '<li>' . full_name($user) . ' <' . hsc($user->email) . "></li>\n"; } $message .= "</ul>\n"; $SESSION->add_info_msg($message, false); } } log_info('Inserted ' . count($CSVDATA) . ' records'); $SESSION->add_ok_msg(get_string('uploadcsvusersaddedsuccessfully', 'admin')); redirect('/admin/users/uploadcsv.php'); } // Get a list of all profile fields, to inform the user on what fields they can // put in their file. $fields = "<ul class=fieldslist>\n"; foreach (array_keys(ArtefactTypeProfile::get_all_fields()) as $type) { if ($type == 'firstname' || $type == 'lastname' || $type == 'email') { continue; } $fields .= '<li>' . hsc($type) . "</li>\n"; } $fields .= "<div class=cl></div></ul>\n"; if ($USER->get('admin')) { $uploadcsvpagedescription = get_string('uploadcsvpagedescription2', 'admin', get_config('wwwroot') . 'admin/extensions/pluginconfig.php?plugintype=artefact&pluginname=internal&type=profile', get_config('wwwroot') . 'admin/users/institutions.php', $fields); } else { $uploadcsvpagedescription = get_string('uploadcsvpagedescription2institutionaladmin', 'admin', get_config('wwwroot') . 'admin/users/institutions.php', $fields); } $form = pieform($form); $smarty = smarty(); $smarty->assign('uploadcsvpagedescription', $uploadcsvpagedescription); $smarty->assign('uploadcsvform', $form); $smarty->assign('PAGEHEADING', TITLE); $smarty->display('admin/users/uploadcsv.tpl');
require_once 'group.php'; require_once 'pieforms/pieform.php'; define('GROUP', param_integer('id')); $group = group_current_group(); if (!is_logged_in() && !$group->public) { throw new AccessDeniedException(); } $role = group_user_access($group->id); if ($role != 'admin') { throw new AccessDeniedException(); } if ($group->jointype != 'controlled') { redirect(get_config('wwwroot') . 'group/members.php?id=' . GROUP); } define('TITLE', $group->name . ' - ' . get_string('addmembers', 'group')); $form = pieform(array('name' => 'addmembers', 'elements' => array('users' => array('type' => 'userlist', 'lefttitle' => get_string('potentialmembers', 'group'), 'righttitle' => get_string('userstobeadded', 'group'), 'searchscript' => 'group/membersearchresults.json.php', 'defaultvalue' => array(), 'searchparams' => array('id' => GROUP, 'limit' => 100, 'html' => 0, 'membershiptype' => 'nonmember')), 'submit' => array('type' => 'submit', 'value' => get_string('submit'))))); $smarty = smarty(); $smarty->assign('subheading', get_string('addmembers', 'group')); $smarty->assign('form', $form); $smarty->display('group/form.tpl'); exit; function addmembers_submit(Pieform $form, $values) { global $SESSION; if (empty($values['users'])) { redirect(get_config('wwwroot') . 'group/addmembers.php?id=' . GROUP); } db_begin(); foreach ($values['users'] as $userid) { group_add_user(GROUP, $userid); }