本文整理汇总了PHP中preferences_load函数的典型用法代码示例。如果您正苦于以下问题:PHP preferences_load函数的具体用法?PHP preferences_load怎么用?PHP preferences_load使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了preferences_load函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
*/
if (!defined("PARENT_INCLUDED")) {
exit;
} elseif (!isset($_SESSION["isAuthorized"]) || !$_SESSION["isAuthorized"]) {
header("Location: " . ENTRADA_URL);
exit;
} elseif (!$ENTRADA_ACL->amIAllowed("communityadmin", "read", false)) {
$ERROR++;
$ERRORSTR[] = "Your account does not have the permissions required to use this feature of this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance.";
echo display_error();
application_log("error", "Group [" . $GROUP . "] and role [" . $ROLE . "] does not have access to this module [" . $MODULE . "]");
} else {
define("IN_COMMUNITIES", true);
$BREADCRUMB[] = array("url" => ENTRADA_URL . "/admin/communities", "title" => "Manage Communities");
if ($router && $router->initRoute()) {
$PREFERENCES = preferences_load($MODULE);
$module_file = $router->getRoute();
if ($module_file) {
require_once $module_file;
}
/**
* Check if preferences need to be updated on the server at this point.
*/
preferences_update($MODULE, $PREFERENCES);
} else {
$url = ENTRADA_URL . "/admin/" . $MODULE;
application_log("error", "The Entrada_Router failed to load a request. The user was redirected to [" . $url . "].");
header("Location: " . $url);
exit;
}
}
示例2: add_error
* @author Developer: Matt Simpson <matt.simpson@queensu.ca>
* @author Developer: James Ellis <james.ellis@queensu.ca>
* @copyright Copyright 2010 Queen's University. All Rights Reserved.
*
*/
if (!defined("PARENT_INCLUDED")) {
exit;
}
if (!$ENTRADA_ACL->amIAllowed("dashboard", "read")) {
add_error("Your account does not have the permissions required to use this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance.");
echo display_error();
application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] does not have access to this module [" . $MODULE . "]");
} else {
$DISPLAY_DURATION = array();
$poll_where_clause = "";
$PREFERENCES = preferences_load("dashboard");
$HEAD[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_RELATIVE . "/javascript/tabpane/tabpane.js?release=" . html_encode(APPLICATION_VERSION) . "\"></script>";
$HEAD[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_RELATIVE . "/javascript/rssreader.js?release=" . html_encode(APPLICATION_VERSION) . "\"></script>";
$HEAD[] = "<link href=\"" . ENTRADA_RELATIVE . "/css/tabpane.css?release=" . html_encode(APPLICATION_VERSION) . "\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />";
$HEAD[] = "<link href=\"" . ENTRADA_RELATIVE . "/javascript/calendar/css/xc2_default.css\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />";
$HEAD[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_RELATIVE . "/javascript/calendar/config/xc2_default.js\"></script>";
$HEAD[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_RELATIVE . "/javascript/calendar/script/xc2_inpage.js\"></script>";
$HEAD[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_RELATIVE . "/javascript/calendar/script/xc2_timestamp.js\"></script>";
$HEAD[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_RELATIVE . "/javascript/dashboard-ics.js\"></script>";
$JQUERY[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_RELATIVE . "/javascript/jquery/jquery.weekcalendar.js?release=" . html_encode(APPLICATION_VERSION) . "\"></script>\n";
$JQUERY[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_RELATIVE . "/javascript/jquery/jquery.qtip.min.js?release=" . html_encode(APPLICATION_VERSION) . "\"></script>\n";
$JQUERY[] = "<link href=\"" . ENTRADA_RELATIVE . "/css/jquery/jquery.weekcalendar.css?release=" . html_encode(APPLICATION_VERSION) . "\" rel=\"stylesheet\" type=\"text/css\" media=\"all\" />\n";
/**
* Fetch the latest feeds and links for this user.
*/
$dashboard_feeds = dashboard_fetch_feeds();
示例3: elseif
if (!defined("PARENT_INCLUDED") || !defined("IN_MANAGE_USER_REPORTS")) {
exit;
} elseif (!isset($_SESSION["isAuthorized"]) || !$_SESSION["isAuthorized"]) {
header("Location: " . ENTRADA_URL);
exit;
} elseif (!$ENTRADA_ACL->amIAllowed("user", "update", false)) {
$ERROR++;
$ERRORSTR[] = "Your account does not have the permissions required to use this feature of this module.<br /><br />If you believe you are receiving this message in error please contact <a href=\"mailto:" . html_encode($AGENT_CONTACTS["administrator"]["email"]) . "\">" . html_encode($AGENT_CONTACTS["administrator"]["name"]) . "</a> for assistance.";
echo display_error();
application_log("error", "Group [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["group"] . "] and role [" . $_SESSION["permissions"][$ENTRADA_USER->getAccessId()]["role"] . "] does not have access to this module [" . $MODULE . "]");
} else {
require_once "Entrada/metadata/reports.inc.php";
$user = User::get($PROXY_ID);
$SCRIPT[] = "<script type=\"text/javascript\" src=\"" . ENTRADA_URL . "/javascript/meta_data.js\"></script>";
$ONLOAD[] = "api_url = \"" . ENTRADA_URL . "/admin/users/manage/metadata?section=api-metadata&id=" . $PROXY_ID . "\";page_init();";
$metadata_prefs = preferences_load('metadata');
if (is_array($metadata_prefs) && array_key_exists('reports', $metadata_prefs) && array_key_exists('features', $metadata_prefs['reports'])) {
$features = $metadata_prefs['reports']['features'];
} else {
$features = getExpandedFeatures();
}
/*
* outline
* -------
* page title: User Report: Name
* Link -- configure user report options
* Fieldset /w label indicating preview
* | preview |
* reminder that some options may be hidden. check config (link) page
* Export to (Select box) PDF* or HTML
*/
示例4: load_active_organisation
/**
* Load the active organisation for the user including their permissions,
* template, system groups, etc.
*
* @global type $ENTRADA_USER
* @global type $ENTRADA_TEMPLATE
* @global type $SYSTEM_GROUPS
* @global object $db
* @param type $organisation_id
* @param type $user_access_id
*/
function load_active_organisation($organisation_id = 0, $user_access_id = 0)
{
global $ENTRADA_USER, $ENTRADA_TEMPLATE, $SYSTEM_GROUPS, $db;
$allow_organisation_id_set = false;
$allow_access_id_set = false;
$change_organisations = true;
$organisation_id = (int) $organisation_id;
$user_access_id = (int) $user_access_id;
if ($ENTRADA_USER && $ENTRADA_TEMPLATE) {
$_SESSION["permissions"] = permissions_load();
/**
* Load active organisation from preferences if one exists.
*/
$active_organisation = preferences_load("organisation_switcher");
/**
* Check whether we are trying to set a new org and access_id or use one
* from user preferences, or the default.
*/
if (!$organisation_id || !$user_access_id) {
if (isset($active_organisation["organisation_id"]) && isset($active_organisation["access_id"])) {
$organisation_id = (int) $active_organisation["organisation_id"];
$user_access_id = (int) $active_organisation["access_id"];
} else {
$organisation_id = $ENTRADA_USER->getActiveOrganisation();
$user_access_id = $ENTRADA_USER->getAccessId();
}
}
/**
* Interate through existing permissions to ensure
*/
foreach ($_SESSION["permissions"] as $access_id => $permission) {
if ($permission["organisation_id"] == $organisation_id) {
$allow_organisation_id_set = true;
if ($access_id == $user_access_id) {
$allow_access_id_set = true;
}
}
}
if ($allow_organisation_id_set && $allow_access_id_set) {
$ENTRADA_USER->setActiveOrganisation($organisation_id);
$ENTRADA_USER->setAccessId($user_access_id);
$_SESSION[APPLICATION_IDENTIFIER]["organisation_switcher"]["organisation_id"] = $organisation_id;
$_SESSION[APPLICATION_IDENTIFIER]["organisation_switcher"]["access_id"] = $user_access_id;
application_log("success", "User [" . $ENTRADA_USER->getId() . "] loaded organisation [" . $organisation_id . "] and access_id [" . $user_access_id . "] successfully.");
} else {
application_log("error", "User [" . $ENTRADA_USER->getId() . "] attempted to change to organisation [" . $organisation_id . "] and access_id [" . $user_access_id . "] but was unsuccessful.");
}
/**
* Returns all of the system groups and roles associated with this user
* within the active organisation.
*/
$query = "SELECT a.*\n FROM `" . AUTH_DATABASE . "`.`system_groups` AS a,\n `" . AUTH_DATABASE . "`.`system_group_organisation` AS c\n WHERE a.`id` = c.`groups_id`\n AND c.`organisation_id` = " . $db->qstr($ENTRADA_USER->getActiveOrganisation()) . "\n ORDER BY a.`group_name` ASC";
$results = $db->GetAll($query);
if ($results) {
foreach ($results as $result) {
$SYSTEM_GROUPS[$result["group_name"]] = array();
$query = "SELECT a.*\n FROM `" . AUTH_DATABASE . "`.`system_roles` a\n WHERE a.`groups_id` = " . $result["id"] . "\n ORDER BY a.`role_name` ASC";
$roles = $db->GetAll($query);
if ($roles) {
foreach ($roles as $role) {
$SYSTEM_GROUPS[$result["group_name"]][] = $role["role_name"];
}
}
}
}
preferences_update("organisation_switcher", $active_organisation);
$ENTRADA_TEMPLATE->setActiveTemplate($ENTRADA_USER->getActiveOrganisation());
}
}
示例5: json_encode
if ($clean_emails) {
echo json_encode(array("status" => "success", "data" => implode(";", $clean_emails)));
} else {
echo json_encode(array("status" => "error", "data" => array("An error occured while attempting to get teacher email addresses.")));
}
break;
}
} else {
echo json_encode(array("status" => "error", "data" => array("No method provided.")));
}
exit;
}
$course = Models_Course::get($COURSE_ID);
if ($course) {
courses_subnavigation($course->toArray(), "reports");
$original_preferences = preferences_load("courses");
if (isset($original_preferences["teacher_report_start"]) && isset($original_preferences["teacher_report_finish"])) {
$PROCESSED["start_date"] = (int) $original_preferences["teacher_report_start"];
$PROCESSED["finish_date"] = (int) $original_preferences["teacher_report_finish"];
$teachers = $course->getTeachersByDates($PROCESSED["start_date"], $PROCESSED["finish_date"]);
if (!$teachers) {
add_notice("No Teachers found between " . date("Y-m-d", $PROCESSED["start_date"]) . " and " . date("Y-m-d", $PROCESSED["finish_date"]) . "");
}
}
//Error checking
switch ($STEP) {
case 2:
if (isset($_POST["start_date"])) {
$PROCESSED["start_date"] = validate_calendar("Start Date", "start", false);
}
if (isset($_POST["finish_date"])) {