本文整理汇总了PHP中param_boolean函数的典型用法代码示例。如果您正苦于以下问题:PHP param_boolean函数的具体用法?PHP param_boolean怎么用?PHP param_boolean使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了param_boolean函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: pieform_element_rolepermissions_get_value
function pieform_element_rolepermissions_get_value(Pieform $form, $element)
{
/*{{{*/
if (isset($element['value'])) {
return $element['value'];
}
if (isset($element['defaultvalue'])) {
$value = $element['defaultvalue'];
} else {
$value = group_get_default_artefact_permissions($element['group']);
}
if ($form->is_submitted()) {
$global = $form->get_property('method') == 'get' ? $_GET : $_POST;
$prefix = $form->get_name() . '_' . $element['name'] . '_p';
foreach ($value as $r => $perms) {
foreach (array_keys(get_object_vars($perms)) as $p) {
if ($r != 'admin') {
$value[$r]->{$p} = param_boolean($prefix . '_' . $r . '_' . $p);
}
}
}
}
return $value;
}
示例2: define
* @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('INSTITUTIONALSTAFF', 1);
define('MENUITEM', 'configusers/usersearch');
require dirname(dirname(dirname(__FILE__))) . '/init.php';
define('TITLE', get_string('usersearch', 'admin'));
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'admin');
define('SECTION_PAGE', 'usersearch');
require_once 'searchlib.php';
$search = (object) array('query' => trim(param_variable('query', '')), 'f' => param_alpha('f', null), 'l' => param_alpha('l', null), 'sortby' => param_alpha('sortby', 'firstname'), 'sortdir' => param_alpha('sortdir', 'asc'), 'loggedin' => param_alpha('loggedin', 'any'), 'loggedindate' => param_variable('loggedindate', strftime(get_string('strftimedatetimeshort'))), 'duplicateemail' => param_boolean('duplicateemail', false));
$offset = param_integer('offset', 0);
$limit = param_integer('limit', 10);
if ($USER->get('admin') || $USER->get('staff')) {
$institutions = get_records_array('institution', '', '', 'displayname');
$search->institution = param_alphanum('institution', 'all');
} else {
$institutionnames = array_keys(array_merge($USER->get('admininstitutions'), $USER->get('staffinstitutions')));
$institutions = get_records_select_array('institution', 'name IN (' . join(',', array_fill(0, count($institutionnames), '?')) . ')', $institutionnames, 'displayname');
}
$loggedintypes = array();
$loggedintypes[] = array('name' => 'any', 'string' => get_string('anyuser', 'admin'));
$loggedintypes[] = array('name' => 'ever', 'string' => get_string('usershaveloggedin', 'admin'));
$loggedintypes[] = array('name' => 'never', 'string' => get_string('usershaveneverloggedin', 'admin'));
$loggedintypes[] = array('name' => 'since', 'string' => get_string('usershaveloggedinsince', 'admin'));
$loggedintypes[] = array('name' => 'notsince', 'string' => get_string('usershavenotloggedinsince', 'admin'));
示例3: define
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'collection');
define('SECTION_PAGE', 'edit');
require dirname(dirname(__FILE__)) . '/init.php';
require_once 'pieforms/pieform.php';
require_once 'collection.php';
$new = param_boolean('new', 0);
$copy = param_boolean('copy', 0);
if ($new) {
// if creating a new collection
$owner = null;
$groupid = param_integer('group', 0);
$institutionname = param_alphanum('institution', false);
if (empty($groupid) && empty($institutionname)) {
$owner = $USER->get('id');
}
$collection = new Collection(null, array('owner' => $owner, 'group' => $groupid, 'institution' => $institutionname));
define('SUBTITLE', get_string('edittitleanddesc', 'collection'));
} else {
// if editing an existing or copied collection
$id = param_integer('id');
$collection = new Collection($id);
$owner = $collection->get('owner');
示例4: define
* @subpackage core
* @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
*
*/
// TODO fix title of this page
// TODO check security of this page
define('INTERNAL', 1);
require_once dirname(dirname(__FILE__)) . '/init.php';
require_once 'pieforms/pieform.php';
require_once 'view.php';
require_once get_config('libroot') . 'group.php';
define('TITLE', get_string('changemyviewlayout', 'view'));
$id = param_integer('id');
$new = param_boolean('new');
$category = param_alpha('c', '');
$view = new View($id);
$numcolumns = $view->get('numcolumns');
$currentlayout = $view->get('layout');
$back = !$USER->get_account_preference('addremovecolumns');
$group = $view->get('group');
$institution = $view->get('institution');
View::set_nav($group, $institution);
if (!$USER->can_edit_view($view)) {
throw new AccessDeniedException();
}
// if not set, use equal width layout for that number of columns
if (!$currentlayout) {
$currentlayout = $numcolumns == 2 ? 1 : ($numcolumns == 3 ? 4 : 7);
}
示例5: define
* @author Gregor Anzelj
* @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.
* @copyright (C) 2010-2013 Gregor Anzelj <gregor.anzelj@gmail.com>
*
*/
define('INTERNAL', true);
define('SECTION_PLUGINTYPE', 'core');
define('SECTION_PLUGINNAME', 'skin');
define('SECTION_PAGE', 'design');
require_once dirname(dirname(__FILE__)) . '/init.php';
require_once 'skin.php';
require_once 'pieforms/pieform.php';
safe_require('artefact', 'file');
$fieldset = param_alpha('fs', 'viewskin');
$designsiteskin = param_boolean('site', false);
if (!can_use_skins(null, $designsiteskin)) {
throw new FeatureNotEnabledException();
}
if ($designsiteskin) {
define('ADMIN', 1);
if (!$USER->get('admin')) {
$SESSION->add_error_msg(get_string('accessforbiddentoadminsection'));
redirect();
}
define('MENUITEM', 'configsite/siteskins');
$goto = '/admin/site/skins.php';
$redirect = '/admin/site/skins.php';
} else {
define('MENUITEM', 'myportfolio/skins');
$goto = '/skin/index.php';
示例6: define
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
/**
* returns shared views in a given group id
*/
define('INTERNAL', 1);
define('JSON', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
safe_require('blocktype', 'groupviews');
require_once get_config('libroot') . 'view.php';
require_once get_config('libroot') . 'group.php';
require_once get_config('libroot') . 'pieforms/pieform.php';
$offset = param_integer('offset', 0);
$groupid = param_integer('group');
$editing = param_boolean('editing', false);
$group_homepage_view = group_get_homepage_view($groupid);
$bi = group_get_homepage_view_groupview_block($groupid);
if (!can_view_view($group_homepage_view)) {
json_reply(true, get_string('accessdenied', 'error'));
}
$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 {
示例7: build_artefactchooser_data
/**
* Builds data for the artefact chooser.
*
* This builds three pieces of information:
*
* - HTML containing table rows
* - Pagination HTML and Javascript
* - The total number of artefacts found
* - Artefact fields to return
*/
public static function build_artefactchooser_data($data, $group = null, $institution = null)
{
global $USER;
// If lazyload is set, immediately return an empty resultset
// In the case of forms using lazyload, lazyload is set to false by subsequent requests via ajax,
// for example in views/artefactchooser.json.php, at which time the full resultset is returned.
if (isset($data['lazyload']) && $data['lazyload']) {
$result = '';
$pagination = build_pagination(array('id' => $data['name'] . '_pagination', 'class' => 'ac-pagination', 'url' => View::make_base_url() . (param_boolean('s') ? '&s=1' : ''), 'count' => 0, 'limit' => 0, 'offset' => 0, 'datatable' => $data['name'] . '_data', 'jsonscript' => 'view/artefactchooser.json.php', 'firsttext' => '', 'previoustext' => '', 'nexttext' => '', 'lasttext' => '', 'numbersincludefirstlast' => false, 'extradata' => array('value' => $data['defaultvalue'], 'blocktype' => $data['blocktype'], 'group' => $group, 'institution' => $institution)));
return array($result, $pagination, 0, 0, array());
}
$search = '';
if (!empty($data['search']) && param_boolean('s')) {
$search = param_variable('search', '');
// Maybe later, depending on performance - don't search if there's
// not enough characters. Prompts should be added to the UI too.
//if (strlen($search) < 3) {
// $search = '';
//}
}
$data['search'] = $search;
$data['offset'] -= $data['offset'] % $data['limit'];
safe_require('blocktype', $data['blocktype']);
$blocktypeclass = generate_class_name('blocktype', $data['blocktype']);
$data['sortorder'] = array(array('fieldname' => 'title', 'order' => 'ASC'));
if (method_exists($blocktypeclass, 'artefactchooser_get_sort_order')) {
$data['sortorder'] = call_static_method($blocktypeclass, 'artefactchooser_get_sort_order');
}
list($artefacts, $totalartefacts) = self::get_artefactchooser_artefacts($data, $USER, $group, $institution);
$selectone = $data['selectone'];
$value = $data['defaultvalue'];
$elementname = $data['name'];
$template = $data['template'];
$returnfields = isset($data['returnfields']) ? $data['returnfields'] : null;
$returnartefacts = array();
$result = '';
if ($artefacts) {
if (!empty($data['ownerinfo'])) {
require_once get_config('docroot') . 'artefact/lib.php';
$userid = $group || $institution ? null : $USER->get('id');
foreach (artefact_get_owner_info(array_keys($artefacts)) as $k => $v) {
if ($artefacts[$k]->owner !== $userid || $artefacts[$k]->group !== $group || $artefacts[$k]->institution !== $institution) {
$artefacts[$k]->ownername = $v->name;
$artefacts[$k]->ownerurl = $v->url;
}
}
}
foreach ($artefacts as &$artefact) {
safe_require('artefact', get_field('artefact_installed_type', 'plugin', 'name', $artefact->artefacttype));
if (method_exists($blocktypeclass, 'artefactchooser_get_element_data')) {
$artefact = call_static_method($blocktypeclass, 'artefactchooser_get_element_data', $artefact);
}
// Build the radio button or checkbox for the artefact
$formcontrols = '';
if ($selectone) {
$formcontrols .= '<input type="radio" class="radio" id="' . hsc($elementname . '_' . $artefact->id) . '" name="' . hsc($elementname) . '" value="' . hsc($artefact->id) . '"';
if ($value == $artefact->id) {
$formcontrols .= ' checked="checked"';
}
$formcontrols .= '>';
} else {
$formcontrols .= '<input type="checkbox" id="' . hsc($elementname . '_' . $artefact->id) . '" name="' . hsc($elementname) . '[' . hsc($artefact->id) . ']"';
if ($value && in_array($artefact->id, $value)) {
$formcontrols .= ' checked="checked"';
}
$formcontrols .= ' class="artefactid-checkbox checkbox">';
$formcontrols .= '<input type="hidden" name="' . hsc($elementname) . '_onpage[]" value="' . hsc($artefact->id) . '" class="artefactid-onpage">';
}
$smarty = smarty_core();
$smarty->assign('artefact', $artefact);
$smarty->assign('elementname', $elementname);
$smarty->assign('formcontrols', $formcontrols);
$result .= $smarty->fetch($template) . "\n";
if ($returnfields) {
$returnartefacts[$artefact->id] = array();
foreach ($returnfields as $f) {
if ($f == 'safedescription') {
$returnartefacts[$artefact->id]['safedescription'] = clean_html($artefact->description);
continue;
}
if ($f == 'attachments') {
// Check if the artefact has attachments - we need to update the instance config form
// to have those attachments selected.
$attachment_ids = get_column('artefact_attachment', 'attachment', 'artefact', $artefact->id);
$returnartefacts[$artefact->id]['attachments'] = $attachment_ids;
continue;
}
$returnartefacts[$artefact->id][$f] = $artefact->{$f};
}
}
//.........这里部分代码省略.........
示例8: View
$view = new View(array('urlid' => $pageurl, 'ownerurlid' => $profile));
} else {
if ($homepage = param_alphanumext('homepage', null)) {
$view = new View(array('urlid' => $pageurl, 'groupurlid' => $homepage));
} else {
throw new ViewNotFoundException(get_string('viewnotfoundexceptiontitle', 'error'));
}
}
$viewid = $view->get('id');
} else {
$viewid = param_integer('id');
}
}
}
$new = param_boolean('new');
$showmore = param_boolean('showmore');
if (!$showmore) {
$showmore = 0;
}
if (!isset($view)) {
$view = new View($viewid);
}
if (!can_view_view($view)) {
$errorstr = param_integer('objection', null) ? get_string('accessdeniedobjection', 'error') : get_string('accessdenied', 'error');
throw new AccessDeniedException($errorstr);
} else {
// To save the atime in the db - make it a millisecond in the past
// so it differs from the atime in the View constructor and so triggers
// the saving of the atime change. Can't use $view->set('dirty', true)
// as that will also get the view object to update the mtime which is not
// what we want.
示例9: define
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('PUBLIC', 1);
define('SECTION_PLUGINTYPE', 'artefact');
define('SECTION_PLUGINNAME', 'internal');
define('SECTION_PAGE', 'validate');
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once 'pieforms/pieform.php';
safe_require('artefact', 'internal');
define('TITLE', get_string('emailactivation', 'artefact.internal'));
$email = param_variable('email');
$key = param_variable('key');
$decline = param_boolean('decline');
$row = get_record('artefact_internal_profile_email', 'email', $email, 'key', $key, null, null, 'owner,artefact,email,verified,' . db_format_tsfield('expiry'));
if ($row) {
if ($decline) {
delete_records_select('artefact_internal_profile_email', 'verified=0 AND key=? AND email=?', array($key, $email));
$SESSION->add_ok_msg(get_string('emailactivationdeclined', 'artefact.internal'));
redirect(get_config('wwwroot'));
}
if ($row->expiry > time()) {
if ($row->artefact) {
$artefact = new ArtefactTypeEmail($row->artefact);
} else {
$artefact = new ArtefactTypeEmail();
}
$artefact->set('owner', $row->owner);
$artefact->set('title', $row->email);
示例10: editview_submit
function editview_submit(Pieform $form, $values)
{
global $view, $SESSION;
if (param_boolean('back')) {
redirect('/view/blocks.php?id=' . $view->get('id') . '&new=' . $new);
}
$view->set('title', $values['title']);
$view->set('description', $values['description']);
$view->set('tags', $values['tags']);
if (isset($values['ownerformat']) && $view->get('owner')) {
$view->set('ownerformat', $values['ownerformat']);
}
$view->commit();
if ($values['new']) {
$redirecturl = '/view/access.php?id=' . $view->get('id') . '&new=1';
} else {
$SESSION->add_ok_msg(get_string('viewsavedsuccessfully', 'view'));
if ($view->get('group')) {
$redirecturl = '/view/groupviews.php?group=' . $view->get('group');
} else {
if ($view->get('institution')) {
$redirecturl = '/view/institutionviews.php?institution=' . $view->get('institution');
} else {
$redirecturl = '/view/index.php';
}
}
}
redirect($redirecturl);
}
示例11: define
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
/**
* This displays a pdf in an <iframe>
*
*/
define('INTERNAL', 1);
define('PUBLIC', 1);
require dirname(dirname(dirname(dirname(dirname(__FILE__))))) . '/init.php';
require_once get_config('docroot') . '/artefact/lib.php';
$fileid = param_integer('file');
$viewid = param_integer('view');
$editing = param_boolean('editing', false);
$ingroup = param_boolean('ingroup', false);
if (!artefact_in_view($fileid, $viewid)) {
throw new AccessDeniedException('');
}
if (!can_view_view($viewid)) {
throw new AccessDeniedException('');
}
$file = artefact_instance_from_id($fileid);
if (!$file instanceof ArtefactTypeFile) {
throw new NotFoundException();
}
$urlbase = get_config('wwwroot');
if (get_config('cleanurls') && get_config('cleanurlusersubdomains') && !$editing && !$ingroup) {
$view = new View($viewid);
$viewauthor = new User();
$viewauthor->find_by_id($view->get('owner'));
示例12: define
<?php
/**
*
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('JSON', 1);
define('INSTITUTIONALSTAFF', 1);
require dirname(dirname(dirname(__FILE__))) . '/init.php';
require_once 'searchlib.php';
$params = new StdClass();
$params->query = trim(param_variable('query', ''));
$params->institution = param_alphanum('institution', null);
$params->f = param_alpha('f', null);
$params->l = param_alpha('l', null);
$params->sortby = param_alpha('sortby', 'firstname');
$params->sortdir = param_alpha('sortdir', 'asc');
$params->loggedin = param_alpha('loggedin', 'any');
$params->loggedindate = param_variable('loggedindate', null);
$params->duplicateemail = param_boolean('duplicateemail', false);
$offset = param_integer('offset', 0);
$limit = param_integer('limit', 10);
list($html, $columns, $pagination, $search) = build_admin_user_search_results($params, $offset, $limit);
json_reply(false, array('message' => null, 'data' => array('tablerows' => $html, 'pagination' => $pagination['html'], 'pagination_js' => $pagination['javascript'])));
示例13: build_artefactchooser_data
/**
* Builds data for the artefact chooser.
*
* This builds three pieces of information:
*
* - HTML containing table rows
* - Pagination HTML and Javascript
* - The total number of artefacts found
*/
public static function build_artefactchooser_data($data, $group = null, $institution = null)
{
global $USER;
$search = '';
if (!empty($data['search']) && param_boolean('s')) {
$search = param_variable('search', '');
// Maybe later, depending on performance - don't search if there's
// not enough characters. Prompts should be added to the UI too.
//if (strlen($search) < 3) {
// $search = '';
//}
}
$data['search'] = $search;
$data['offset'] -= $data['offset'] % $data['limit'];
safe_require('blocktype', $data['blocktype']);
$blocktypeclass = generate_class_name('blocktype', $data['blocktype']);
$data['sortorder'] = array(array('fieldname' => 'title', 'order' => 'ASC'));
if (method_exists($blocktypeclass, 'artefactchooser_get_sort_order')) {
$data['sortorder'] = call_static_method($blocktypeclass, 'artefactchooser_get_sort_order');
}
list($artefacts, $totalartefacts) = self::get_artefactchooser_artefacts($data, $USER, $group, $institution);
$selectone = $data['selectone'];
$value = $data['defaultvalue'];
$elementname = $data['name'];
$template = $data['template'];
$result = '';
if ($artefacts) {
foreach ($artefacts as &$artefact) {
safe_require('artefact', get_field('artefact_installed_type', 'plugin', 'name', $artefact->artefacttype));
if (method_exists($blocktypeclass, 'artefactchooser_get_element_data')) {
$artefact = call_static_method($blocktypeclass, 'artefactchooser_get_element_data', $artefact);
}
// Build the radio button or checkbox for the artefact
$formcontrols = '';
if ($selectone) {
$formcontrols .= '<input type="radio" class="radio" id="' . hsc($elementname . '_' . $artefact->id) . '" name="' . hsc($elementname) . '" value="' . hsc($artefact->id) . '"';
if ($value == $artefact->id) {
$formcontrols .= ' checked="checked"';
}
$formcontrols .= '>';
} else {
$formcontrols .= '<input type="checkbox" id="' . hsc($elementname . '_' . $artefact->id) . '" name="' . hsc($elementname) . '[' . hsc($artefact->id) . ']"';
if ($value && in_array($artefact->id, $value)) {
$formcontrols .= ' checked="checked"';
}
$formcontrols .= ' class="artefactid-checkbox checkbox">';
$formcontrols .= '<input type="hidden" name="' . hsc($elementname) . '_onpage[]" value="' . hsc($artefact->id) . '" class="artefactid-onpage">';
}
$smarty = smarty_core();
$smarty->assign('artefact', $artefact);
$smarty->assign('elementname', $elementname);
$smarty->assign('formcontrols', $formcontrols);
$result .= $smarty->fetch($template) . "\n";
}
}
$pagination = build_pagination(array('id' => $elementname . '_pagination', 'class' => 'ac-pagination', 'url' => View::make_base_url() . (param_boolean('s') ? '&s=1' : ''), 'count' => $totalartefacts, 'limit' => $data['limit'], 'offset' => $data['offset'], 'datatable' => $elementname . '_data', 'jsonscript' => 'view/artefactchooser.json.php', 'firsttext' => '', 'previoustext' => '', 'nexttext' => '', 'lasttext' => '', 'numbersincludefirstlast' => false, 'extradata' => array('value' => $value, 'blocktype' => $data['blocktype'], 'group' => $group, 'institution' => $institution)));
return array($result, $pagination, $totalartefacts, $data['offset']);
}
示例14: define
<?php
/**
*
* @package mahara
* @subpackage core
* @author Catalyst IT Ltd
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL version 3 or later
* @copyright For copyright information on Mahara, please see the README file distributed with this software.
*
*/
define('INTERNAL', 1);
define('JSON', 1);
require 'init.php';
$showhomeinfo = (int) param_boolean('showhomeinfo');
$result = array();
$USER->set_account_preference('showhomeinfo', $showhomeinfo);
json_reply(false, $result);
示例15: param_variable
$reason = param_variable('reason');
try {
suspend_user($id, $reason);
} catch (MaharaException $e) {
json_reply('local', get_string('suspendfailed', 'admin') . ': ' . $e->getMessage());
}
json_reply(false, get_string('usersuspended', 'admin'));
}
if ($action == 'search') {
require_once 'searchlib.php';
$params = new StdClass();
$params->query = trim(param_variable('query', ''));
$params->institution = param_alphanum('institution', null);
$params->f = param_alpha('f', null);
$params->l = param_alpha('l', null);
$params->institution_requested = param_alphanum('institution_requested', null);
$offset = param_integer('offset', 0);
$limit = param_integer('limit', 10);
$sortby = param_alpha('sortby', 'firstname');
$sortdir = param_alpha('sortdir', 'asc');
json_headers();
if (param_boolean('raw', false)) {
$data = get_admin_user_search_results($params, $offset, $limit, $sortby, $sortdir);
} else {
$data['data'] = build_admin_user_search_results($params, $offset, $limit, $sortby, $sortdir);
}
$data['error'] = false;
$data['message'] = null;
echo json_encode($data);
exit;
}