本文整理汇总了PHP中system_messages函数的典型用法代码示例。如果您正苦于以下问题:PHP system_messages函数的具体用法?PHP system_messages怎么用?PHP system_messages使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了system_messages函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: embed_page_handler
/**
* Page handler for embeds
*
* @param array $page
*/
function embed_page_handler($page)
{
$params = array('output' => '', 'status' => 0, 'system_messages' => array('error' => array(), 'success' => array()));
$container_guid = get_input('container_guid');
if ($container_guid && get_entity($container_guid)) {
elgg_set_page_owner_guid($container_guid);
}
switch ($page[0]) {
default:
case 'tab':
$default_tab = elgg_is_active_plugin('file') ? 'file' : 'content_items';
$embed_tab = elgg_extract(1, $page, $default_tab);
$title = elgg_echo("embed:embed");
$filter = elgg_view('embed/filter', array('filter_context' => $embed_tab));
$view = "embed/tab/{$embed_tab}";
if (elgg_view_exists($view)) {
$content = elgg_view($view);
} else {
$embed_tab = elgg_get_config('embed_tab');
if ($embed_tab instanceof \ElggMenuItem) {
$view = $embed_tab->getData('view');
$options = $embed_tab->getData('options');
if ($view) {
$content = elgg_view($view);
} else {
if ($options) {
$content = elgg_view('embed/get_list', array('options' => $options));
}
}
}
}
if (empty($content)) {
$content = elgg_autop(elgg_echo('embed:section:invalid'));
}
$params['output'] = elgg_view_layout('one_column', array('title' => $title, 'content' => $filter . $content, 'class' => 'embed-wrapper'));
break;
}
$system_messages = system_messages(NULL, "");
if (isset($system_messages['success'])) {
$params['system_messages']['success'] = $system_messages['success'];
}
if (isset($system_messages['error'])) {
$params['system_messages']['error'] = $system_messages['error'];
$params['status'] = -1;
}
// We do not want to serve this page via non-xhr requests
if (!elgg_is_xhr()) {
register_error(elgg_echo('embed:error:non_xhr_request'));
return false;
}
echo json_encode($params);
exit;
}
开发者ID:hypejunction,项目名称:hypeembed,代码行数:58,代码来源:page_handlers.php
示例2: CheckLTIUser
function CheckLTIUser($user_id)
{
// Check that user_id is present; if not all we can do is forward
// to login page
if (empty($user_id)) {
system_messages(elgg_echo('LTI:info:noid'));
forward();
}
// Is there a user with username $user_id
$user = get_user_by_username($user_id);
if (!empty($user->username)) {
return $user;
}
// No such user
return null;
}
开发者ID:vsheokeen,项目名称:Elgg-Plugins,代码行数:16,代码来源:LTIUser.php
示例3: elgg_load_library
<?php
/*
* Create a new backup file
*/
elgg_load_library("backup_tool");
$backup_file_name = get_input("file");
if (backup_tool_restore_backup(array("file_name" => $backup_file_name))) {
system_messages(elgg_echo("backup-tool:restore:success", array($filename)));
} else {
register_error(elgg_echo("backup-tool:restore:fail"));
}
forward(REFERRER);
开发者ID:epsylon,项目名称:Hydra-dev,代码行数:13,代码来源:restore.php
示例4: loadEditMatchForm
/**
* Show the edit match form
*/
function loadEditMatchForm()
{
global $db, $_pre;
if (!isset($_GET['m_id'])) {
system_messages(0, 'No match given');
return;
}
if ($_GET['m_id'] == 'none') {
system_messages(0, 'Please select a match to edit');
return;
}
$match_id = $_GET['m_id'];
settype($match_id, 'integer');
$query = "SELECT * FROM {$_pre}matches WHERE id={$match_id} ORDER BY start_time DESC";
$db->setQuery($query);
if ($db->foundRows == 0) {
system_messages(0, 'No such match!');
return;
}
$row = $db->fetch_assoc();
?>
<span class="dark10">Editing CodeZone match <?php
echo "{$match_id} .::. {$row['title']}";
?>
</span><br />
<form class='admin-panel-form' name='global-conf' method='POST' action='index.php?a=su&a1=edit-match-details'>
<table class='admin-panel-forms-table' cellpadding="2" cellspacing="2" border="0">
<tr><td class='form-field-label'><span class='form-field-label-text'>Match Name</span></td>
<td><input type="text" name="edm-title" class="admin-panel-text-input" value="<?php
echo $row['title'];
?>
"/></td></tr>
<tr><td class='form-field-label'><span class='form-field-label-text'>Match duration (sec)</span></td><td><input type="text" name="edm-duration" class="admin-panel-text-input" value="<?php
echo $row['duration'];
?>
"/></td></tr>
<tr><td class='form-field-label'><span class='form-field-label-text'>Start date (yyyy-mm-dd)</span></td><td><input type="text" name="edm-start_date" class="admin-panel-text-input" value="<?php
echo get_date($row['start_time']);
?>
"/></td></tr>
<tr><td class='form-field-label'><span class='form-field-label-text'>Start time (hh:mm:ss)</span></td><td><input type="text" name="edm-start_time" class="admin-panel-text-input" value="<?php
echo get_time($row['start_time']);
?>
"/></td></tr>
<tr><td class='form-field-label'><span class='form-field-label-text'>Difficulty</span></td><td><input type="text" name="edm-difficulty" class="admin-panel-text-input" value="<?php
echo $row['difficulty'];
?>
"/></td></tr>
<tr><td class='form-field-label'><span class='form-field-label-text'>Match points</span></td><td><input type="text" name="edm-match_points" class="admin-panel-text-input" value="<?php
echo $row['match_points'];
?>
"/></td></tr>
<tr><td class='form-field-label'><span class='form-field-label-text'>Ranked match</span></td><td>Yes <input type="radio" name="edm-ranked_match" value="1" <?php
if ($row['match_ranked'] == 1) {
echo "checked='true'";
}
?>
/> No <input type="radio" name="edm-ranked_match" value="0" <?php
if ($row['match_ranked'] == 0) {
echo "checked='true'";
}
?>
/></td></tr>
<tr><td class='form-field-label'><span class='form-field-label-text'>Analysis <i>(Allowed tags are: <p>,<a>,<strong>,<i>,<br>. To highlight code blocks enclose the code in a div tag with class code_block e.g <div class="code_block"><pre>echo CONSTANT;</pre></div></i></span></td><td><textarea name="edm-analysis" class="admin-panel-textarea" style="width:400px;" rows="15" cols="45"><?php
echo stripslashes($row['analysis']);
?>
</textarea></td></tr>
<tr><td><input type="hidden" name="adm" value="<?php
echo base64_encode('su');
?>
" /><input type="hidden" name="f" value="<?php
echo base64_encode('edit_match');
?>
" /><input type="hidden" name="m_id" value="<?php
echo base64_encode($match_id);
?>
" /></td><td><input type="submit" name="save" class="admin-panel-submit-button" value="save" /> <input type="submit" name='delete_match' class="admin-panel-submit-button" value='Delete this match?' class="admin-panel-submit-button" onclick="return confirm('WARNING: Are you sure you want to delete this match? this action cannot be reversed!!');" /></td></tr>
</table>
</form>
<br />
<br />
<?php
$query = "SELECT COUNT(*) FROM {$_pre}{$row['match_table_name']} WHERE 1";
$db->setQuery($query);
$tmp_row = $db->fetch_assoc();
$st_total_registered = $tmp_row['COUNT(*)'];
//Total users registered for the match
$query = "SELECT * FROM {$_pre}user_match_log WHERE match_id={$row['id']} AND participated=1";
$db->setQuery($query);
$st_total_participated = $db->foundRows;
$query = "SELECT SUM(downloads_count) FROM {$_pre}{$row['match_table_name']} WHERE 1";
$db->setQuery($query);
$tmp_row = $db->fetch_assoc();
$st_downloads = $tmp_row['SUM(downloads_count)'];
$query = "SELECT SUM(submissions) FROM {$_pre}{$row['match_table_name']} WHERE 1";
$db->setQuery($query);
$tmp_row = $db->fetch_assoc();
//.........这里部分代码省略.........
开发者ID:sureronald,项目名称:codezone,代码行数:101,代码来源:adminViewCpanelRemoteHelper.php
示例5: system_messages
<link type="text/css" media="screen" rel="stylesheet" href="theme/jquery.colorbox/colorbox.css" />
<script type="text/javascript" src="js/jquery.colorbox-min.js"></script>
<script src="js/jquery.countdown.min.js" type="text/javascript"></script>
<script src="js/countdown.custom.js" type="text/javascript"></script>
<script src="js/server.time.js" type="text/javascript"></script>
<?php
//Check if there's an active match
if (!$arn->active_match()) {
system_messages(0, "There is no active match");
return;
}
//Check if user logged in i.e to entice him/her to login
if (!$login) {
system_messages(0, "To participate in the arena, you must login");
return;
}
//Initialize arena validation
require_once 'ajphp' . DS . 'arenaValidatorHelper.php';
$arnv = new arenaValidatorHelper(time(), $_pre, $db, $arn, $_max_submissions, $_submission_timeout);
//Is this user registered...?
if (!$arnv->isUserRegistered() && !$su) {
system_messages(0, 'You are not registered to participate in this match');
return;
}
//Set participated column to 1 in user_match_log table
$arn->set_participate();
/**
There's an active match... Now we need to render the match arena ie. the problem statement plus the relevant ajax scripts to handle data transfer, countdown timing, scoreboard refreshes ...
*/
$arn->render_arena();
}
开发者ID:sureronald,项目名称:codezone,代码行数:31,代码来源:arenaApplet.php
示例6: elgg_view_page
/**
* Assembles and outputs a full page.
*
* A "page" in Elgg is determined by the current view type and
* can be HTML for a browser, RSS for a feed reader, or
* Javascript, PHP and a number of other formats.
*
* @param string $title Title
* @param string $body Body
* @param string $page_shell Optional page shell to use. See page/shells view directory
* @param array $vars Optional vars array to pass to the page
* shell. Automatically adds title, body, and sysmessages
*
* @return string The contents of the page
* @since 1.8
*/
function elgg_view_page($title, $body, $page_shell = 'default', $vars = array())
{
$messages = null;
if (count_messages()) {
// get messages - try for errors first
$messages = system_messages(NULL, "error");
if (count($messages["error"]) == 0) {
// no errors so grab rest of messages
$messages = system_messages(null, "");
} else {
// we have errors - clear out remaining messages
system_messages(null, "");
}
}
$vars['title'] = $title;
$vars['body'] = $body;
$vars['sysmessages'] = $messages;
// check for deprecated view
if ($page_shell == 'default' && elgg_view_exists('pageshells/pageshell')) {
elgg_deprecated_notice("pageshells/pageshell is deprecated by page/{$page_shell}", 1.8);
global $CONFIG;
$vars['config'] = $CONFIG;
$output = elgg_view('pageshells/pageshell', $vars);
} else {
$output = elgg_view("page/{$page_shell}", $vars);
}
$vars['page_shell'] = $page_shell;
// Allow plugins to mod output
return elgg_trigger_plugin_hook('output', 'page', $vars, $output);
}
开发者ID:rasul,项目名称:Elgg,代码行数:46,代码来源:views.php
示例7: elgg_get_ini_setting_in_bytes
//You can add more than one receipients.
$formproc->AddRecipient($email);
//<<---Put your email address here
//2. For better security. Get a random tring from this link: http://tinyurl.com/randstr
// and put it here
$formproc->SetFormRandomKey('CnRrspl1FyEylUj');
$formproc->AddFileUploadField('photo', 'jpg,jpeg,gif,png,pdf,doc,docx,rar.zip,', 5120);
// Get post_max_size and upload_max_filesize
$post_max_size = elgg_get_ini_setting_in_bytes('post_max_size');
$upload_max_filesize = elgg_get_ini_setting_in_bytes('upload_max_filesize');
// Determine the correct value
$max_upload = $upload_max_filesize > $post_max_size ? $post_max_size : $upload_max_filesize;
$upload_limit = elgg_echo('file:upload_limit', array(elgg_format_bytes($max_upload)));
if (isset($_POST['submitted'])) {
if ($formproc->ProcessForm()) {
system_messages(elgg_echo('contactform:thankyoumsg'));
forward("mod/contactform");
// forward(elgg_get_site_url());
}
}
?>
<script type='text/javascript' src='scripts/gen_validatorv31.js'></script>
<script>
$(document).ready(function (){
$("#reason").change(function() {
// foo is the id of the other select box
if ($(this).val() == "Autres$Other") {
$("#subject").show();
}else{
开发者ID:smellems,项目名称:wet4,代码行数:31,代码来源:form.php
示例8: system_messages
<?php
$messages = null;
if (count_messages()) {
// get messages - try for errors first
$messages = system_messages(NULL, 'error');
if (count($messages['error']) == 0) {
// no errors so grab rest of messages
$messages = system_messages(null, '');
} else {
// we have errors - clear out remaining messages
system_messages(null, '');
}
}
$type = elgg_extract('type', $vars, 'view');
$entity = elgg_extract('entity', $vars);
echo elgg_view_menu('newsletter_buttons', ['entity' => $entity, 'type' => $type, 'class' => 'newsletter-buttons', 'sort_by' => 'priority']);
echo elgg_view('page/elements/messages', ['object' => $messages]);
echo elgg_format_element('style', ['type' => 'text/css'], elgg_view('css/newsletter/buttons.css'));
elgg_load_css('newsletter_buttons');
开发者ID:coldtrick,项目名称:newsletter,代码行数:20,代码来源:buttons.php
示例9: ajax_forward_hook
/**
* Catch calls to forward() in ajax request and force an exit.
*
* Forces response is json of the following form:
* <pre>
* {
* "current_url": "the.url.we/were/coming/from",
* "forward_url": "the.url.we/were/going/to",
* "system_messages": {
* "messages": ["msg1", "msg2", ...],
* "errors": ["err1", "err2", ...]
* },
* "status": -1 //or 0 for success if there are no error messages present
* }
* </pre>
* where "system_messages" is all message registers at the point of forwarding
*
* @param string $hook
* @param string $type
* @param string $reason
* @param array $params
*
*/
function ajax_forward_hook($hook, $type, $reason, $params)
{
if (elgg_is_xhr()) {
//grab any data echo'd in the action
$output = ob_get_clean();
//Avoid double-encoding in case data is json
$json = json_decode($output);
if (isset($json)) {
$params['output'] = $json;
} else {
$params['output'] = $output;
}
//Grab any system messages so we can inject them via ajax too
$params['system_messages'] = system_messages(NULL, "");
if (isset($params['system_messages']['error'])) {
$params['status'] = -1;
} else {
$params['status'] = 0;
}
header("Content-type: application/json");
echo json_encode($params);
exit;
}
}
开发者ID:rasul,项目名称:Elgg,代码行数:47,代码来源:actions.php
示例10: get_input
<?php
/*
* Do the redirect to previous trip
*
* Plugin: myTripsTeranga from previous version of @package ElggGroup
* Author: Rosana Montes Soldado
* Universidad de Granada
* Licence: CC-ByNCSA
* Reference: Microproyecto CEI BioTIC Ref. 11-2015
* Project coordinator: @rosanamontes
* Website: http://lsi.ugr.es/rosana
* Project colaborator: Antonio Moles
*
* Project Derivative:
* TFG: Desarrollo de un sistema de gestión de paquetería para Teranga Go
* Advisor: Rosana Montes
* Student: Ricardo Luzón Fernández
*
*/
$trip_guid = (int) get_input('trip_guid');
$trip = get_entity($trip_guid);
system_messages(elgg_echo('mytrips:manageOrders:saved'));
forward($trip->getUrl());
开发者ID:rosanamontes,项目名称:teranga.go,代码行数:24,代码来源:manageOrders.php
示例11: defined
defined('IN_APP') or die('Restricted Access!');
?>
<?php
if ($expire) {
system_messages(0, "Session expired, Please login again!");
}
if ($reg_pass_no) {
system_messages(0, "Reg No and password did not match");
}
if ($acc_active) {
system_messages(2, "Please activate this account to access CodeZone");
}
if ($acc_disabled) {
system_messages(2, "Your account has been disabled by CodeZone. Please contact an administrator");
}
if ($login_notify) {
system_messages(1, "Thank you for logging in {$user_row_data['nick_name']}");
}
if ($logout_notify) {
system_messages(1, "You are logged out, Bye bye!");
}
if ($request_expired) {
system_messages(0, "Request expired, please try again!");
}
if ($request_toofast) {
system_messages(0, 'Request too fast, Slow down and try again!');
}
?>
开发者ID:sureronald,项目名称:codezone,代码行数:29,代码来源:systemMessages.php
示例12: get_input
<?php
$schedule_action = get_input("schedule-action");
$enable_schedule = get_input("enable-schedule");
$schedule_period = get_input("schedule-period");
$schedule_delete = get_input("schedule-delete");
$backup_options = get_input("backup_options");
$ftp_enable = get_input("ftp-enable", false);
$ftp = get_input("ftp", false);
if (!$backup_options) {
register_error(elgg_echo('backup-tool:settings:error:backup_options'));
} else {
elgg_set_plugin_setting('backup_options', serialize($backup_options), 'backup-tool');
if ($schedule_action == elgg_echo("backuptool:schedule:button:enable")) {
$enable_schedule = true;
elgg_set_plugin_setting('enable_schedule', $enable_schedule, 'backup-tool');
system_messages(elgg_echo("backup-tool:settings:success:enable"));
} elseif ($schedule_action == elgg_echo("backuptool:schedule:button:disable")) {
$enable_schedule = false;
elgg_set_plugin_setting('enable_schedule', $enable_schedule, 'backup-tool');
system_messages(elgg_echo("backup-tool:settings:success:disable"));
} else {
system_messages(elgg_echo("backup-tool:settings:success"));
}
elgg_set_plugin_setting('schedule_period', $schedule_period, 'backup-tool');
elgg_set_plugin_setting('schedule_delete', $schedule_delete, 'backup-tool');
//save ftp settings
elgg_set_plugin_setting('ftp_enable', $ftp_enable[0], 'backup-tool');
elgg_set_plugin_setting('ftp', serialize($ftp), 'backup-tool');
}
开发者ID:epsylon,项目名称:Hydra-dev,代码行数:30,代码来源:schedule-settings.php
示例13: defined
| links clicked on the frontpage |
| |
*----------------------------------------------------------*
*/
//Is in application...?
defined('IN_APP') or die('Restricted access');
if ($action == 'showstory') {
if (!isset($_GET['s_id'])) {
system_messages(0, 'Requested story unknown');
return;
}
$story_id = (int) $_GET['s_id'];
$query = "SELECT {$_pre}stories.*,{$_pre}users.nick_name FROM {$_pre}stories LEFT JOIN {$_pre}users ON {$_pre}stories.registration_no = {$_pre}users.registration_no WHERE {$_pre}stories.published=1 AND {$_pre}stories.id={$story_id}";
$db->setQuery($query);
if ($db->foundRows < 1) {
system_messages(0, 'Invalid story requested');
return;
}
$data = $db->fetch_assoc();
?>
<h3 class='arena-match-title'>Title:: <?php
echo ucfirst($data['title']);
?>
</h3>
<hr class='h3-bottom-line' />
<div id="showstories">
<?php
echo stripslashes(preg_replace("/<rmore>/", "", $data['content']));
//Remove the read more tag and strip any splashes
echo "<p class='article_details'><span class='light1'>" . time_stamp_to_readable($data['create_time']) . "</span> .::. Author: <span class='admin_orange'>{$data['nick_name']}</span></p>";
//Get next and previous stories if any
开发者ID:sureronald,项目名称:codezone,代码行数:31,代码来源:showStory.php
示例14: render_arena
/**
* Render the arena
*/
function render_arena()
{
global $arnv, $_max_submissions;
$match_details = $this->get_match_details();
//Verify if there's actually an active match
if (!$match_details) {
system_messages(0, "There is no active match or match over");
return;
}
//Compute remaining time
$seconds_rem = $match_details['start_time'] + $match_details['duration'] - time();
?>
<div id="arena-applet-container">
<div id="arena-applet-left">
<?php
echo "<h3 class='arena-match-title'>Problem Statement ..::.. " . strtoupper($match_details['title']) . "</h3>";
echo "<hr class='h3-bottom-line' />";
echo "<p class='arena-match-subtitle'>Maximum points: {$match_details['match_points']} .::. Difficulty: {$match_details['difficulty']} .::. Max downloads allowed: {$_max_submissions}</p>";
?>
<div id="match-rem-time" align="right">
<!--Match remaining time-->
</div>
<?php
/**Only show the downloads link if there is remaining downloads*/
if ($arnv->downloads_over()) {
echo "<h4 class='contact-link'><a class='load-iframe' title='CodeZone solution submission' href='ajphp/arenaValidator.php?a=arenaval&v=render_submission_form'>Submit solution</a></h4>";
}
//Print the problem Statement
$this->print_problem();
?>
</div>
<div id="arena-applet-right">
<span class='arena-general'>Live Scoreboard</span>
<!--Live scoreboard goes here-->
<div id="live-scoreboard"></div>
</div>
<div id="clear"></div>
</div>
<script type="text/javascript">
$(document).ready(function(){
$.ajaxSetup({ cache:false });$(".load-iframe").colorbox({width:"60%", height:"45%", iframe:true,overlayClose:false});
var seconds=<?php
echo $seconds_rem;
?>
;
//Show match remaining time
$(function(){
$('#match-rem-time').countdown({ layout:"<span class='timer-rem-time'>Remaining time: {hnn} {hl}, {mnn} {ml}, {snn} {sl}</span>",until:+seconds, serverSync:serverTime,onExpiry:function(){alert('Match over!');window.location.href='index.php';}});
});
});
//Code to load scoreboard every 30 seconds
$('#live-scoreboard').load('ajphp/arenaValidator.php?a=arenaval&v=partial_scoreboard'); //Load it for the first time on page load
setInterval(function(){
$('#live-scoreboard').load('ajphp/arenaValidator.php?a=arenaval&v=partial_scoreboard');
}, 30000);
</script>
<?php
}
开发者ID:sureronald,项目名称:codezone,代码行数:65,代码来源:arenaAppletHelper.php
示例15: doContentHandler
function doContentHandler($tool_provider)
{
LoginUser($tool_provider);
system_messages('Forwarded to Group creation page');
forward(elgg_get_config('wwwroot') . '/groups/new/');
return;
}
开发者ID:vsheokeen,项目名称:Elgg-Plugins,代码行数:7,代码来源:register.php
示例16: izap_youtube_response
/**
* Save offserver video after getting responese from YouTube
*
* @version 5.0
*/
function izap_youtube_response()
{
$id = get_input('id');
$url = 'https://www.youtube.com/watch?v=' . $id;
$video_data = array('url' => $url);
$izap_video = new IzapVideo();
if ($izap_video->guid == 0) {
$new = true;
}
$izap_video->videourl = $url;
$izap_video->saveYouTubeVideoData($video_data);
if ($izap_video->save()) {
if ($new == true) {
if (is_callable('elgg_create_river_item')) {
elgg_create_river_item(array('view' => 'river/object/izap_video/create', 'action_type' => 'create', 'subject_guid' => elgg_get_logged_in_user_guid(), 'object_guid' => $izap_video->getGUID()));
} else {
add_to_river('river/object/izap_video/create', 'create', elgg_get_logged_in_user_guid(), $izap_video->getGUID());
}
}
elgg_clear_sticky_form('izap_videos');
system_messages(elgg_echo('izap-videos:Save:success'));
forward($izap_video->getURL($izap_video->getOwnerEntity(), GLOBAL_IZAP_VIDEOS_PAGEHANDLER));
}
}
开发者ID:justangel,项目名称:izap-videos,代码行数:29,代码来源:izap-videos.php
示例17: generate
/**
* @param int $amount
* @param string $profile
* @param string $locale
* @throws InvalidArgumentException
* @return int
*/
static function generate($amount, $profile, $locale)
{
$amount = (int) $amount;
if ($amount <= 0) {
throw new InvalidArgumentException("Amount must be positive integer.");
}
if (!in_array($profile, data_generator::getElggProviderMethods())) {
throw new InvalidArgumentException("Invalid profile provided: {$profile}");
}
if (!in_array($locale, data_generator::getLocales())) {
throw new InvalidArgumentException("Invalid locale provided: {$locale}");
}
$totalAmount = $amount;
$mt = microtime(true);
$time = null;
$generator = self::getGenerator($locale);
$success = 0;
$processed = 0;
while ($amount-- > 0) {
$processed++;
$data = $generator->{$profile}();
try {
if (is_callable(array($data, 'save'))) {
if ($data->save()) {
$success++;
} else {
if (self::is_cli()) {
//clear line
echo "\t\t\t\t\t\t\t\t\t\r";
echo "Fail: Error while saving\n";
$messages = system_messages(NULL, "error");
echo "Msgs: " . var_export($messages['error'], true) . "\n";
}
}
} else {
if (self::is_cli()) {
//clear line
echo "\t\t\t\t\t\t\t\t\t\r";
echo "Fail: Not saveable item: " . var_export($data, true) . "\n";
}
}
} catch (Exception $e) {
if (self::is_cli()) {
//clear line
echo "\t\t\t\t\t\t\t\t\t\r";
echo "Fail: " . $e->getMessage() . "\n";
}
//fail silently here - just count
}
if (self::is_cli()) {
if ($time === null || time() > $time + self::$cli_info_interval) {
$time = time();
echo sprintf("%.2f%% - %d items generated, %d failures in %.2fs\r", ($totalAmount - $amount) * 100 / $totalAmount, $success, $processed - $success, microtime(true) - $mt);
}
}
}
if (self::is_cli()) {
//clear line
echo "\t\t\t\t\t\t\t\t\t\r";
}
return $success;
}
开发者ID:srokap,项目名称:data_generator,代码行数:69,代码来源:data_generator.php
示例18: ProvisionLTIGroup
function ProvisionLTIGroup($tool_provider)
{
// Get status of group provisining
$values = GetPluginSettings();
$groupprovision = $values['groupprovision'];
$groupname = $tool_provider->context->title;
// Get context_id and consumer_key for primary context
$context_id = $tool_provider->context->id;
$consumer_key = $tool_provider->context->consumer_instance->consumer_guid;
$user_id = $tool_provider->user->getID(BasicLTI_Tool_Provider::ID_SCOPE_GLOBAL);
// Check if we are dealing with an unapproved share. If so return
// to consumer with suitable message
if (!empty($tool_provider->user->context->share_approved) && !$tool_provider->user->context->share_approved) {
$urlencode = urlencode(sprintf(elgg_echo('LTI:error:sharing'), elgg_get_config('sitename')));
forward($tool_provider->return_url . '<i_msg=' . $urlencode);
return false;
}
// Get user
$user = CheckLTIUser($user_id);
$user_guid = $user->getGUID();
$_SESSION['lti_logger_id'] = $user->getGUID();
$staff = $tool_provider->user->isStaff();
// Check that groups are present and provisioning is on
if (elgg_is_active_plugin('groups') && $groupprovision) {
$group = CheckLTIGroup($groupname, $context_id, $consumer_key);
// Only staff can create groups.
if ($staff && is_null($group)) {
$group = CreateLTIGroup($user, $groupname, $context_id, $consumer_key);
// Ensure that the owner is instructor as simpifies matters
add_entity_relationship($user_guid, 'instructor', $group->getGUID());
system_message(elgg_echo('LTI:info:newgroup'));
forward($group->getURL());
}
if (is_null($group)) {
system_messages(elgg_echo('LTI:info:nogroup'));
forward();
}
$group_guid = $group->getGUID();
$_SESSION['lti_group_id'] = $group->getGUID();
// Is this user a member of the group
if ($group->isMember($user)) {
// If user used to be instructor but is now student remove 'instructor' relationship
if ($tool_provider->user->isLearner() && check_entity_relationship($user_guid, 'instructor', $group_guid)) {
remove_entity_relationship($user_guid, 'instructor', $group->getGUID());
system_messages(elgg_echo('LTI:change:downgrade'));
forward($group->getURL());
}
// If user is staff add instructor relationship unless they are group owner
if ($staff && !check_entity_relationship($user_guid, 'instructor', $group_guid) && $user_guid != $group_guid) {
add_entity_relationship($user_guid, 'instructor', $group_guid);
system_messages(elgg_echo('LTI:change:upgrade'));
forward($group->getURL());
}
system_messages('Forwarded to Group');
forward($group->getURL());
}
// If not member join
$group->join($user);
// If instructor but not owner give instructor relationship to group. This makes
// other consumer instructors able to edit the group in Elgg
if ($staff && !check_entity_relationship($user_guid, 'instructor', $group_guid)) {
add_entity_relationship($user_guid, 'instructor', $group_guid);
system_messages(elgg_echo('LTI:change:upgrade'));
forward($group->getURL());
}
system_messages('Forwarded to Group');
forward($group->getURL());
}
}
开发者ID:vsheokeen,项目名称:Elgg-Plugins,代码行数:69,代码来源:LTIGroup.php
示例19: defined
| |
*----------------------------------------------------------*
*/
//Is in application...?
defined('IN_APP') or die('Restricted access');
if ($action == 'profile') {
if (isset($_GET['do'])) {
$do = $_GET['do'];
} else {
system_messages(2, 'Invalid arguments in query');
return;
}
$handle = '';
if (isset($_GET['nick_name'])) {
$handle = $_GET['nick_name'];
}
//Get the profileHelper class
require_once 'profileHelper.php';
$profile = new profileHelper($handle);
if ($do == 'viewProfile') {
$profile->view_profile();
} else {
if ($do == 'updateProfile' && $login) {
//Allow profile update only if user is logged in
$profile->update_profile_fields();
} else {
system_messages(2, 'Invalid arguments in query');
}
}
//print_r($profile);
}
开发者ID:sureronald,项目名称:codezone,代码行数:31,代码来源:profile.php
示例20: system_messages
//Is the requested match valid?
if ($db->foundRows < 1) {
system_messages(2, 'Invalid match requested');
return;
}
$match_data = $db->fetch_assoc();
//Is the requested match still active?
if ($match_data['start_time'] < time()) {
system_messages(0, 'Match is inactive');
return;
}
$query = "SELECT * FROM {$_pre}{$match_data['match_table_name']} WHERE registration_no='{$registration_no}'";
$db->setQuery($query);
//Is this user already registered?
if ($db->foundRows > 0) {
system_messages(0, 'You are already registered for this match!');
return;
}
//Now we can safely register this user (fun..)
$query = "INSERT INTO {$_pre}{$match_data['match_table_name']} (registration_no,nick_name) VALUES ('{$registration_no}','{$nick_name}')";
$db->setQuery($query);
//Update profile table that is, match_count column and add the user to user_match_log table
$query = "SELECT match_count FROM " . $_pre . "profile WHERE registration_no='{$registration_no}'";
$db->setQuery($query);
$data = $db->fetch_assoc();
$new_match_count = $data['match_count'] + 1;
//$matches_participated=(strlen($data['matches_participated'])==0)?$match_data['id'].'---'.$match_data['title']:$data['matches_participated'].'*****'.$match_data['id'].'---'.$match_data['title'];
$query = "UPDATE " . $_pre . "profile SET match_count={$new_match_count} WHERE registration_no='{$registration_no}'";
$db->setQuery($query);
$query = "INSERT INTO {$_pre}user_match_log (registration_no,match_id,title,match_date,register_date) VALUES ('{$registration_no}',{$match_data['id']},'{$match_data['title']}',{$match_data['start_time']}," . time() . ")";
$db->setQuery($query);
开发者ID:sureronald,项目名称:codezone,代码行数:31,代码来源:registerUserForMatch.php
注:本文中的system_messages函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论