本文整理汇总了PHP中usertimezone函数的典型用法代码示例。如果您正苦于以下问题:PHP usertimezone函数的具体用法?PHP usertimezone怎么用?PHP usertimezone使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了usertimezone函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fullname
}
$userinfo = fullname($u, has_capability('moodle/site:viewfullnames', $context));
}
if ($date) {
$dateinfo = userdate($date, get_string('strftimedaydate'));
}
switch ($logformat) {
case 'showashtml':
if ($hostid != $CFG->mnet_localhost_id || $hostid == $CFG->mnet_localhost_id && $course->id == SITEID) {
$adminroot = admin_get_root();
admin_externalpage_setup('reportlog', $adminroot);
admin_externalpage_print_header($adminroot);
} else {
print_header($course->shortname . ': ' . $strlogs, $course->fullname, "<a href=\"{$CFG->wwwroot}/course/view.php?id={$course->id}\">{$course->shortname}</a> ->\n <a href=\"{$CFG->wwwroot}/course/report.php?id={$course->id}\">{$strreports}</a> ->\n <a href=\"index.php?id={$course->id}\">{$strlogs}</a> -> {$userinfo}, {$dateinfo}", '');
}
print_heading(format_string($course->fullname) . ": {$userinfo}, {$dateinfo} (" . usertimezone() . ")");
print_mnet_log_selector_form($hostid, $course, $user, $date, $modname, $modid, $modaction, $group, $showcourses, $showusers, $logformat);
if ($hostid == $CFG->mnet_localhost_id) {
print_log($course, $user, $date, 'l.time DESC', $page, $perpage, "index.php?id={$course->id}&chooselog=1&user={$user}&date={$date}&modid={$modid}&modaction={$modaction}&group={$group}", $modname, $modid, $modaction, $group);
} else {
print_mnet_log($hostid, $id, $user, $date, 'l.time DESC', $page, $perpage, "", $modname, $modid, $modaction, $group);
}
break;
case 'downloadascsv':
if (!print_log_csv($course, $user, $date, 'l.time DESC', $modname, $modid, $modaction, $group)) {
notify("No logs found!");
print_footer($course);
}
exit;
case 'downloadasods':
if (!print_log_ods($course, $user, $date, 'l.time DESC', $modname, $modid, $modaction, $group)) {
示例2: chat_extend_settings_navigation
/**
* Adds module specific settings to the settings block
*
* @param settings_navigation $settings The settings navigation object
* @param navigation_node $chatnode The node to add module settings to
*/
function chat_extend_settings_navigation(settings_navigation $settings, navigation_node $chatnode)
{
global $DB, $PAGE, $USER;
$chat = $DB->get_record("chat", array("id" => $PAGE->cm->instance));
if ($chat->chattime && $chat->schedule) {
$nextsessionnode = $chatnode->add(get_string('nextsession', 'chat') . ': ' . userdate($chat->chattime) . ' (' . usertimezone($USER->timezone));
$nextsessionnode->add_class('note');
}
$currentgroup = groups_get_activity_group($PAGE->cm, true);
if ($currentgroup) {
$groupselect = " AND groupid = '{$currentgroup}'";
} else {
$groupselect = '';
}
if ($chat->studentlogs || has_capability('mod/chat:readlog', $PAGE->cm->context)) {
if ($DB->get_records_select('chat_messages', "chatid = ? {$groupselect}", array($chat->id))) {
$chatnode->add(get_string('viewreport', 'chat'), new moodle_url('/mod/chat/report.php', array('id' => $PAGE->cm->id)));
}
}
}
示例3: switch
}
switch ($logformat) {
case 'showashtml':
if ($hostid != $CFG->mnet_localhost_id || $course->id == SITEID) {
admin_externalpage_setup('reportlog');
echo $OUTPUT->header();
} else {
$PAGE->set_title($course->shortname .': '. $strlogs);
$PAGE->set_heading($course->fullname);
$PAGE->navbar->add("$userinfo, $dateinfo");
echo $OUTPUT->header();
}
echo $OUTPUT->heading(format_string($course->fullname) . ": $userinfo, $dateinfo (".usertimezone().")");
report_log_print_mnet_selector_form($hostid, $course, $user, $date, $modname, $modid, $modaction, $group, $showcourses, $showusers, $logformat);
if ($hostid == $CFG->mnet_localhost_id) {
print_log($course, $user, $date, 'l.time DESC', $page, $perpage,
"index.php?id=$course->id&chooselog=1&user=$user&date=$date&modid=$modid&modaction=$modaction&group=$group",
$modname, $modid, $modaction, $group);
} else {
print_mnet_log($hostid, $id, $user, $date, 'l.time DESC', $page, $perpage, "", $modname, $modid, $modaction, $group);
}
break;
case 'downloadascsv':
if (!print_log_csv($course, $user, $date, 'l.time DESC', $modname,
$modid, $modaction, $group)) {
echo $OUTPUT->notification("No logs found!");
echo $OUTPUT->footer();
示例4: foreach
$actionbar = "<a id='actionbar-publish-a-" . $recording['recordID'] . "' title='" . $view_recording_list_actionbar_hide . "' href='#'><img id='actionbar-publish-img-" . $recording['recordID'] . "' src='pix/hide.gif' class='iconsmall' onClick='actionCall(\\\"" . $publishURL . "\\\", \\\"publish\\\", \\\"" . $recording['recordID'] . "\\\")' /></a>";
} else {
$publishURL = BigBlueButtonBN::setPublishRecordingsURL($recording['recordID'], 'true', $url, $salt);
$actionbar = "<a id='actionbar-publish-a-" . $recording['recordID'] . "' title='" . $view_recording_list_actionbar_show . "' href='#'><img id='actionbar-publish-img-" . $recording['recordID'] . "' src='pix/show.gif' class='iconsmall' onClick='actionCall(\\\"" . $publishURL . "\\\", \\\"publish\\\", \\\"" . $recording['recordID'] . "\\\")' /></a>";
}
$actionbar .= "<a id='actionbar-delete-a-" . $recording['recordID'] . "' title='" . $view_recording_list_actionbar_delete . "' href='#'><img id='actionbar-delete-img-" . $recording['recordID'] . "' src='pix/delete.gif' class='iconsmall' alt='Delete' onClick='actionCall(\\\"" . $deleteURL . "\\\", \\\"delete\\\", \\\"" . $recording['recordID'] . "\\\")' /></a>";
}
$type = '';
foreach ($recording['playbacks'] as $playback) {
$type .= '<a href=\\"' . $playback['url'] . '\\" target=\\"_new\\">' . $playback['type'] . '</a> ';
}
//Make sure the startTime is timestamp
if (!is_numeric($recording['startTime'])) {
$date = new DateTime($recording['startTime']);
$recording['startTime'] = date_timestamp_get($date);
} else {
$recording['startTime'] = $recording['startTime'] / 1000;
}
//Set corresponding format
//$format = isset(get_string('strftimerecentfull', 'langconfig'));
//if( !isset($format) )
$format = '%a %h %d %H:%M:%S %Z %Y';
//Format the date
$formatedStartDate = userdate($recording['startTime'], $format, usertimezone($USER->timezone));
echo ' ["' . $type . '","' . $meta_course . '","' . $meta_activity . '","' . $meta_description . '","' . str_replace(" ", " ", $formatedStartDate) . '","' . $actionbar . '"],' . "\n";
}
}
}
}
echo ' ["","","","","",""]' . "\n";
echo '] }' . "\n";
示例5: test_usertimezone
public function test_usertimezone()
{
global $USER;
$this->resetAfterTest();
$this->setTimezone('Pacific/Auckland', 'Pacific/Auckland');
$USER->timezone = 'Europe/Prague';
$this->assertSame('Europe/Prague', usertimezone());
$USER->timezone = '1';
$this->assertSame('UTC+1', usertimezone());
$USER->timezone = '0';
$this->assertSame('UTC', usertimezone());
$USER->timezone = '99';
$this->assertSame('Pacific/Auckland', usertimezone());
$USER->timezone = '99';
$this->assertSame('Europe/Berlin', usertimezone('Europe/Berlin'));
$USER->timezone = '99';
$this->assertSame('Pacific/Auckland', usertimezone('99'));
$USER->timezone = 'Europe/Prague';
$this->assertSame('Europe/Prague', usertimezone('99'));
}
示例6: definition
function definition()
{
require_js_files();
$mform =& $this->_form;
$page = $this->_customdata['page'];
$workflow = $page->workflow;
$data = $workflow->unserialize_data();
// Configure the schedule display
$schedule_string = '';
$once = '1';
// Replace timezone with proper text
$tz = $data['timezone'];
$timezone = usertimezone($tz);
debug_error_log("/local/elisreports/form/scheduling.php::scheduling_form_step_confirm::definition() enddate = {$data['schedule']['enddate']}, timezone = {$tz} ({$timezone})");
// Set up for simple recurrence
if ($data['recurrencetype'] == scheduling_workflow::RECURRENCE_SIMPLE) {
if ($data['schedule']['runsremaining'] == '' && $data['schedule']['enddate'] == '') {
$schedule_string = get_string('indefinitely', 'local_elisreports');
} elseif ($data['schedule']['enddate'] != '') {
$enddate = userdate($data['schedule']['enddate'] + DAYSECS - 1, '', $tz);
// 2nd param to userdate() was: get_string('strftimedaydate')
$schedule_string = get_string('simple_until', 'local_elisreports', $enddate);
} else {
// Frequency schedule
$a = new stdClass();
$a->num = $data['schedule']['runsremaining'];
$a->freq = $data['schedule']['frequency'];
$a->freqtype = $data['schedule']['frequencytype'];
$schedule_string = get_string('simple_freq', 'local_elisreports', $a);
}
} else {
// calendar schedule
$min = str_pad($data['schedule']['minute'], 2, '0', STR_PAD_LEFT);
$hour = $data['schedule']['hour'];
$schedule_string .= get_string('at_time', 'local_elisreports', "{$hour}:{$min} ({$timezone})");
// days
if ($data['schedule']['dayofweek'] == '*' && $data['schedule']['day'] == '*') {
$schedule_string .= get_string('every_day', 'local_elisreports');
} elseif ($data['schedule']['day'] == '*') {
//Weekdays specified
$days_array = array('1' => get_string('mon', 'calendar'), '2' => get_string('tue', 'calendar'), '3' => get_string('wed', 'calendar'), '4' => get_string('thu', 'calendar'), '5' => get_string('fri', 'calendar'), '6' => get_string('sat', 'calendar'), '7' => get_string('sun', 'calendar'));
$days_selected_array = explode(',', $data['schedule']['dayofweek']);
$days_string = '';
$count = 0;
foreach ($days_selected_array as $weekday) {
if ($count > 0) {
$days_string .= ', ';
}
$days_string .= $days_array[$weekday];
$count++;
}
//Replace last , with the word and
$days_string = strrev(preg_replace('/,/', strrev(get_string('and', 'local_elisreports')), strrev($days_string), $once));
$schedule_string .= get_string('on_days', 'local_elisreports', $days_string);
} else {
//Specific days of the month
$days_string = strrev(preg_replace('/,/', strrev(get_string('and', 'local_elisreports')), strrev($data['schedule']['day']), $once));
$schedule_string .= get_string('month_days', 'local_elisreports', $days_string);
}
// months
if ($data['schedule']['month'] == '1,2,3,4,5,6,7,8,9,10,11,12' || $data['schedule']['month'] == '*') {
$months_string = get_string('every_month', 'local_elisreports');
$data['schedule']['month'] = '1,2,3,4,5,6,7,8,9,10,11,12';
} else {
$months_array = array('1' => strftime('%b', mktime(0, 0, 0, 1, 1)), '2' => strftime('%b', mktime(0, 0, 0, 2, 1)), '3' => strftime('%b', mktime(0, 0, 0, 3, 1)), '4' => strftime('%b', mktime(0, 0, 0, 4, 1)), '5' => strftime('%b', mktime(0, 0, 0, 5, 1)), '6' => strftime('%b', mktime(0, 0, 0, 6, 1)), '7' => strftime('%b', mktime(0, 0, 0, 7, 1)), '8' => strftime('%b', mktime(0, 0, 0, 8, 1)), '9' => strftime('%b', mktime(0, 0, 0, 9, 1)), '10' => strftime('%b', mktime(0, 0, 0, 10, 1)), '11' => strftime('%b', mktime(0, 0, 0, 11, 1)), '12' => strftime('%b', mktime(0, 0, 0, 12, 1)));
$months_selected_array = explode(',', $data['schedule']['month']);
$months_string = '';
$count = 0;
foreach ($months_selected_array as $month) {
if ($count > 0) {
$months_string .= ', ';
}
$months_string .= $months_array[$month];
$count++;
}
//Replace last , with the word and
$months_string = strrev(preg_replace('/,/', strrev(get_string('and', 'local_elisreports')), strrev($months_string), $once));
}
$schedule_string .= get_string('for_month', 'local_elisreports', $months_string);
//Include end date if selected
if (isset($data['schedule']['enddate']) && $data['schedule']['enddate'] != '') {
$schedule_string .= get_string('until_date', 'local_elisreports', userdate($data['schedule']['enddate'] + DAYSECS - 1, '', $tz));
// '' was: get_string('strftimedaydate')
} else {
$schedule_string .= get_string('until_indefinitely', 'local_elisreports');
}
}
// Create the param_string for selected parameters and their values
$param_string = '';
if (isset($this->_customdata['filterobject']) && isset($data['parameters'])) {
$report = $page->workflow->get_report_instance();
// Configure the parameter display
$parameters = $data['parameters'];
// Use this object to set up our parameter setting
$filter_object = $this->_customdata['filterobject'];
$filter_object_fields = $filter_object->_fields;
// Merge in any secondary filterings here...
if (isset($this->_customdata['filterobject']->secondary_filterings)) {
foreach ($filter_object->secondary_filterings as $key => $secondary_filtering) {
$filter_object_fields = array_merge($filter_object_fields, $secondary_filtering->_fields);
//.........这里部分代码省略.........
示例7: bigbluebuttonbn_get_recording_data_row
//.........这里部分代码省略.........
} else {
$attributes = 'data-imported="false"';
}
$recording_types = '';
if ($recording['published'] == 'true') {
$recording_types .= '<div id="playbacks-' . $recording['recordID'] . '" ' . $attributes . '>';
} else {
$recording_types .= '<div id="playbacks-' . $recording['recordID'] . '" ' . $attributes . '" hidden>';
}
foreach ($recording['playbacks'] as $playback) {
$recording_types .= $OUTPUT->action_link($playback['url'], get_string('view_recording_format_' . $playback['type'], 'bigbluebuttonbn'), null, array('title' => get_string('view_recording_format_' . $playback['type'], 'bigbluebuttonbn'), 'target' => '_new')) . ' ';
}
$recording_types .= '</div>';
//Initialize variables for styling text
$head = $tail = '';
//Set actionbar, if user is allowed to manage recordings
$actionbar = '';
if ($bbbsession['managerecordings']) {
// Set style for imported links
if (isset($recording['imported'])) {
$recordings_imported_count = 0;
$tag_tail = ' ' . get_string('view_recording_link', 'bigbluebuttonbn');
$head = '<i>';
$tail = '</i>';
} else {
$recordings_imported_array = bigbluebuttonbn_getRecordingsImportedAllInstancesArray($recording['recordID']);
$recordings_imported_count = count($recordings_imported_array);
$tag_tail = '';
}
$url = '#';
$action = null;
if (in_array("publishing", $tools)) {
///Set action [show|hide]
if ($recording['published'] == 'true') {
$manage_tag = 'hide';
$manage_action = 'unpublish';
} else {
$manage_tag = 'show';
$manage_action = 'publish';
}
$onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("' . $manage_action . '", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");';
if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) {
//With icon for publish/unpublish
$icon_attributes = array('id' => 'recording-btn-' . $manage_action . '-' . $recording['recordID']);
$icon = new pix_icon('t/' . $manage_tag, get_string($manage_tag) . $tag_tail, 'moodle', $icon_attributes);
$link_attributes = array('id' => 'recording-link-' . $manage_action . '-' . $recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
$actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false);
} else {
//With text for publish/unpublish
$link_attributes = array('title' => get_string($manage_tag) . $tag_tail, 'class' => 'btn btn-xs', 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
$actionbar .= $OUTPUT->action_link($url, get_string($manage_tag) . $tag_tail, $action, $link_attributes);
$actionbar .= " ";
}
}
if (in_array("deleting", $tools)) {
$onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("delete", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");';
if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) {
//With icon for delete
$icon_attributes = array('id' => 'recording-btn-delete-' . $recording['recordID']);
$icon = new pix_icon('t/delete', get_string('delete') . $tag_tail, 'moodle', $icon_attributes);
$link_attributes = array('id' => 'recording-link-delete-' . $recording['recordID'], 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
$actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false);
} else {
//With text for delete
$link_attributes = array('title' => get_string('delete') . $tag_tail, 'class' => 'btn btn-xs btn-danger', 'onclick' => $onclick, 'data-links' => $recordings_imported_count);
$actionbar .= $OUTPUT->action_link($url, get_string('delete') . $tag_tail, $action, $link_attributes);
}
}
if (in_array("importing", $tools)) {
$onclick = 'M.mod_bigbluebuttonbn.broker_manageRecording("import", "' . $recording['recordID'] . '", "' . $recording['meetingID'] . '");';
if (bigbluebuttonbn_get_cfg_recording_icons_enabled()) {
//With icon for import
$icon_attributes = array('id' => 'recording-btn-import-' . $recording['recordID']);
$icon = new pix_icon('i/import', get_string('import'), 'moodle', $icon_attributes);
$link_attributes = array('id' => 'recording-link-import-' . $recording['recordID'], 'onclick' => $onclick);
$actionbar .= $OUTPUT->action_icon($url, $icon, $action, $link_attributes, false);
} else {
//With text for import
$link_attributes = array('title' => get_string('import'), 'class' => 'btn btn-xs btn-danger', 'onclick' => $onclick);
$actionbar .= $OUTPUT->action_link($url, get_string('import'), $action, $link_attributes);
}
}
}
//Set corresponding format
$dateformat = get_string('strftimerecentfull', 'langconfig') . ' %Z';
$formattedStartDate = userdate($startTime / 1000, $dateformat, usertimezone($USER->timezone));
$row = new stdClass();
$row->recording = "{$head}{$recording_types}{$tail}";
$row->activity = "{$head}{$meta_activity}{$tail}";
$row->description = "{$head}{$meta_description}{$tail}";
$row->date = floatval($recording['startTime']);
$row->date_formatted = "{$head}{$formattedStartDate}{$tail}";
$row->duration = "{$duration}";
$row->duration_formatted = "{$head}{$duration}{$tail}";
if ($bbbsession['managerecordings']) {
$row->actionbar = $actionbar;
}
}
return $row;
}
示例8: link_to_popup_window
$chattarget = "/mod/chat/gui_{$CFG->chat_method}/index.php?id={$chat->id}{$groupparam}";
}
echo '<p>';
link_to_popup_window($chattarget, "chat{$course->id}{$chat->id}{$groupparam}", "{$strenterchat}", 500, 700, get_string('modulename', 'chat'));
echo '</p>';
// if user is using screen reader, then there is no need to display this link again
if ($CFG->chat_method == 'header_js' && empty($USER->screenreader)) {
// show frame/js-less alternative
echo '<p>(';
link_to_popup_window("/mod/chat/gui_basic/index.php?id={$chat->id}{$groupparam}", "chat{$course->id}{$chat->id}{$groupparam}", get_string('noframesjs', 'message'), 500, 700, get_string('modulename', 'chat'));
echo ')</p>';
}
print_box_end();
if ($chat->chattime and $chat->schedule) {
// A chat is scheduled
echo "<p class=\"nextchatsession\">{$strnextsession}: " . userdate($chat->chattime) . ' (' . usertimezone($USER->timezone) . ')</p>';
} else {
echo '<br />';
}
if ($chat->intro) {
print_box(format_text($chat->intro), 'generalbox', 'intro');
}
chat_delete_old_users();
if ($chatusers = chat_get_users($chat->id, $currentgroup, $cm->groupingid)) {
$timenow = time();
print_simple_box_start('center');
print_heading($strcurrentusers);
echo '<table id="chatcurrentusers">';
foreach ($chatusers as $chatuser) {
$lastping = $timenow - $chatuser->lastmessageping;
echo '<tr><td class="chatuserimage">';
示例9: display_listinstancejobs
/**
* Mainline for showing all jobs currently set up for an existing
* report
*
* @uses $CFG
* @uses $USER
* @uses $OUTPUT
* @uses $PAGE
*/
function display_listinstancejobs()
{
global $CFG, $USER, $OUTPUT, $PAGE;
//report specified by URL
$report = $this->required_param('report', PARAM_ALPHAEXT);
//get the necessary data
$recordset = local_elisreports_get_report_jobs_recordset($report);
//set up a job if none exist and a special parameter
//is passed in to signal this functinality
$createifnone = optional_param('createifnone', 0, PARAM_INT);
if ($createifnone) {
if (!$recordset or !$recordset->valid()) {
//set up a job for this report
$this->display_default();
return;
}
}
if ($recordset = local_elisreports_get_report_jobs_recordset($report) and $recordset->valid()) {
//we actually have scheduled instances for this report
//display appropriate headers
$this->render_listinstancejobs_header(true, NULL, php_report::EXECUTION_MODE_SCHEDULED);
//set up our form
echo '<form action="' . $this->url . '" method="post">';
//used by the "select all" functionality to identify a defining div
echo '<div id="list_display">';
echo '<input type="hidden" id="report" name="report" value="' . $report . '"/>';
//table setup
$table = new html_table();
//headers, with a "select all" checkbox in the first column
$PAGE->requires->js('/local/elisreports/js/lib.js');
//checkbox for selecting all
$checkbox_label = get_string('listinstancejobs_header_select', 'local_elisreports');
$checkbox_attributes = array('onclick' => 'select_all()');
$checkbox = html_writer::checkbox('selectall', '', false, $checkbox_label, $checkbox_attributes);
$table->head = array($checkbox, get_string('listinstancejobs_header_label', 'local_elisreports'), get_string('listinstancejobs_header_owner', 'local_elisreports'), get_string('listinstancejobs_header_lastrun', 'local_elisreports'), get_string('listinstancejobs_header_nextrun', 'local_elisreports'), get_string('listinstancejobs_header_lastmodified', 'local_elisreports'));
//left align all columns
$table->align = array();
foreach ($table->head as $column_header) {
$table->align[] = 'left';
}
$table->data = array();
//run through available schedules
foreach ($recordset as $record) {
$config_data = unserialize($record->config);
$tz = $config_data['timezone'];
//echo "action_listinstancejobs():: {$config_data['label']}: nextruntime = {$record->nextruntime}<br/>";
//convert the last run time to the appropraite format
if ($record->lastruntime == 0) {
//special case: never run before
$lastruntime = get_string('no_last_runtime', 'local_elisreports');
} else {
$lastruntime = userdate($record->lastruntime, '', $tz) . ' (' . usertimezone($tz) . ')';
debug_error_log("/local/elisreports/lib/schedulelib.php::action_listinstancejobs(); {$config_data['label']}: record->lastruntime = {$record->lastruntime}, tz = {$tz}");
}
// convert 'will run next at' time to appropriate format
$jobenddate = $config_data['schedule']['enddate'];
debug_error_log("/local/elisreports/lib/schedulelib.php::action_listinstancejobs(); {$config_data['label']}: nextruntime = {$record->nextruntime}, jobenddate = {$jobenddate}");
if (!empty($record->nextruntime) && (empty($jobenddate) || $record->nextruntime < $jobenddate + DAYSECS)) {
$nextruntime = userdate($record->nextruntime, '', $tz) . ' (' . usertimezone($tz) . ')';
} else {
$nextruntime = get_string('job_completed', 'local_elisreports');
}
$checkbox = '<input type="checkbox" name="schedule_' . $record->scheduleid . '">';
//link for editing this particular schedule instance
$edit_schedule_params = array('id' => $record->scheduleid, 'action' => 'default');
$edit_schedule_page = $this->get_new_page($edit_schedule_params);
$edit_schedule_link = '<a href="' . $edit_schedule_page->url . '">' . $config_data['label'] . '</a>';
//data row
$table->data[] = array($checkbox, $edit_schedule_link, php_report::fullname($record), $lastruntime, $nextruntime, userdate($config_data['timemodified']));
}
echo html_writer::table($table);
echo $OUTPUT->spacer();
//display the dropdown and button in an enabled state
$this->render_listinstancejobs_actions_dropdown(true);
echo '</div>';
echo '</form>';
} else {
//display header info
$this->render_listinstancejobs_header(false, NULL, php_report::EXECUTION_MODE_SCHEDULED);
//display the dropdown and button in a disabled state
$this->render_listinstancejobs_actions_dropdown(false);
echo $OUTPUT->spacer();
}
//general footer
$this->render_listinstancejobs_footer();
}
示例10: display_default
function display_default()
{
global $OUTPUT, $USER;
$this->get_base_page_params();
$display_name = $this->get_ip_plugin();
// TBD: more user-friendly
$ipscheds = rlip_get_scheduled_jobs($this->get_ip_plugin(), is_siteadmin() ? 0 : $USER->id);
if (!empty($ipscheds) && $ipscheds->valid()) {
echo $OUTPUT->notification(get_string("rlip_jobs_heading_jobs", 'local_datahub', get_string('pluginname', $display_name)), 'rlip_bold_header', 'left');
echo $OUTPUT->notification(get_string('rlip_jobs_heading_fullinstructions', 'local_datahub', $display_name), 'rlip_italic_header', 'left');
$table = new html_table();
$table->head = array(get_string('rlip_jobs_header_label', 'local_datahub'), get_string('rlip_jobs_header_owner', 'local_datahub'), get_string('rlip_jobs_header_lastran', 'local_datahub'), get_string('rlip_jobs_header_nextrun', 'local_datahub'), get_string('rlip_jobs_header_modified', 'local_datahub'), '');
$table->align = array('left', 'center', 'left', 'left', 'left', 'center');
$table->size = array('5%', '15%', '25%', '25%', '25%', '5%');
$table->data = array();
$table->rowclasses = array();
//TBD
$edit = get_string('edit');
$delete = get_string('delete');
foreach ($ipscheds as $ipjob) {
$ustr = "{$ipjob->username}<br/>(" . datahub_fullname($ipjob) . ')';
$tz = $ipjob->timezone;
$data = unserialize($ipjob->config);
$lastruntime = !empty($ipjob->lastruntime) ? userdate($ipjob->lastruntime, '', $tz) . ' (' . usertimezone($tz) . ')' : get_string('no_lastruntime', 'local_datahub');
$nextruntime = !empty($ipjob->nextruntime) ? userdate($ipjob->nextruntime, '', $tz) . ' (' . usertimezone($tz) . ')' : get_string('na', 'local_datahub');
$modified = !empty($data['timemodified']) ? userdate($data['timemodified'], '', $tz) . ' (' . usertimezone($tz) . ')' : get_string('na', 'local_datahub');
$target = $this->get_new_page(array('id' => $ipjob->id, 'plugin' => $ipjob->plugin));
$label = '<a name="edit" href="' . $target->url->out(true, array('action' => 'form')) . '">' . $data['label'] . '</a>';
$edit_link = '<a name="edit" href="' . $target->url->out(true, array('action' => 'form')) . '"><img alt="' . $edit . '" title="' . $edit . '" src="' . $OUTPUT->pix_url('t/edit') . '" /></a>';
$delete_link = '<a name="delete" href="' . $target->url->out(true, array('action' => 'delete')) . '"><img alt="' . $delete . '" title="' . $delete . '" src="' . $OUTPUT->pix_url('t/delete') . '" /></a>';
$table->rowclasses[] = '';
//TBD
$table->data[] = array($label, $ustr, $lastruntime, $nextruntime, $modified, "{$edit_link} {$delete_link}");
}
echo html_writer::table($table);
echo $OUTPUT->notification(get_string('schedulingtime', 'local_datahub', $display_name), 'rlip_italic_header', 'left');
} else {
echo $OUTPUT->notification(get_string('rlip_jobs_heading_nojobs', 'local_datahub', get_string('pluginname', $display_name)), 'rlip_bold_header', 'left');
echo $OUTPUT->notification(get_string('rlip_jobs_heading_instructions', 'local_datahub', $display_name), 'rlip_italic_header', 'left');
}
echo $OUTPUT->spacer();
$submit = $this->get_new_page(array('action' => 'form', 'plugin' => $this->get_ip_plugin()));
$this->add_submit_cancel_buttons($submit->url, get_string('rlip_new_job', 'local_datahub'));
}
示例11: get_userdetails_accounts
public function get_userdetails_accounts($userid)
{
global $DB, $OUTPUT;
$hierarchy = new hierarchy();
$requests = new requests();
$help_desk_lib = new user_filtering_accounts();
$user = $DB->get_record('user', array('id' => $userid));
$local_user = $DB->get_record('local_users', array('userid' => $userid));
$local_user_data = $DB->get_record('local_userdata', array('userid' => $userid));
$fullname = $user->firstname . ' ' . $user->lastname;
$out = '<div class="userprofilebox clearfix"><div class="profilepicture">';
$out .= $OUTPUT->user_picture($user, array('size' => 50));
$out .= '</div>';
$table = new html_table();
$table->id = 'accounts_viewmore';
$table->size = array('20%', '80%');
$table->align = array('right', 'left');
$get_alldepartments = $hierarchy->get_alldepartments($user->id);
$get_allmyactivesemester = $hierarchy->get_allmyactivesemester($user->id);
$student_semesters = student_semesters($user->id);
//School with department
if ($school = $requests->school($user->id)) {
foreach ($school as $schools) {
$schoolid = $schools->id;
$schoolname = $schools->fullname;
$s1[] = $schoolname;
$programs = $requests->program($schoolid, $user->id);
foreach ($programs as $program) {
$proid = $program->id;
$p[] = $DB->get_field('local_program', 'fullname', array('id' => $proid));
if ($serviceid = $requests->service($schoolid, $proid, $user->id)) {
$s3[] = $serviceid->serviceid;
}
}
}
if ($s1) {
$s2 = implode(', ', $s1);
$myschools = "<p><b>School: </b>" . $s2 . "</p>";
}
if ($p) {
$pro = implode(' ', $p);
$myschools .= "<span style='margin-left: 6%;'><b>Program: </b>" . $pro . "</span>";
}
}
//End of school
print_object($help_desk_lib->user_enrolled_courses($userid));
$table->data = array(array(get_string('username'), $user->username), array(get_string('fullname'), $fullname), array(get_string('firstname'), $user->firstname), array(get_string('lastname'), $user->lastname), array(get_string('email'), $user->email), array(get_string('phone'), $user->phone1), array(get_string('phone2'), $user->phone2), array(get_string('dob', 'local_admission'), date('Y-m-d', $local_user->dob)), array(get_string('doj', 'local_users'), date('Y-m-d', $local_user->timecreated)), array(get_string('genderheading', 'local_admission'), $local_user->gender), array(get_string('serviceid', 'local_users'), implode(', ', $s3)), array(get_string('idnumber'), $user->idnumber), array(get_string('hschool', 'local_users'), $local_user->primaryschoolname), array(get_string('primaryyear', 'local_admission'), $local_user->primaryyear), array(get_string('score', 'local_admission'), $local_user->primaryscore), array(get_string('pcountry', 'local_admission'), $local_user->primaryplace), array(get_string('contactname', 'local_admission'), $local_user->fathername), array(get_string('hno', 'local_admission'), $local_user->currenthno), array(get_string('pob', 'local_admission'), $local_user->pob), array(get_string('city'), $local_user->region), array(get_string('state'), $local_user->state), array(get_string('icqnumber'), $user->icq), array(get_string('skypeid'), $user->skype), array(get_string('yahooid'), $user->yahoo), array(get_string('aimid'), $user->aim), array(get_string('msnid'), $user->msn), array(get_string('language'), $user->lang), array(get_string('timezone'), usertimezone($user->timezone)), array(get_string('departments', 'local_help_desk'), $hierarchy->get_alldepartments($user->id)), array(get_string('activesemister', 'local_help_desk'), $hierarchy->get_allmyactivesemester($user->id)), array(get_string('studentsemister', 'local_help_desk'), student_semesters($user->id)), array(get_string('myschools', 'local_help_desk'), $myschools));
//get_string('dob', 'local_admission') . "</b></;" . date("Y-m-d", $local_users->dob) . "
//get_string('doj', 'local_users') . "</b></td>< date("Y-m-d", $local_users->timecreated)
//get_string('genderheading', 'local_admission')nbsp; " . $local_users->gender . "</
//print_object($get_alldepartments);
//print_object($get_allmyactivesemester);
//print_object($student_semesters);
//print_object(date('D M Y', $user->dob));
$edit_url = new moodle_url('/user/edit.php', array('id' => $userid));
$out .= html_writer::tag('a', 'EDIT', array('href' => $edit_url, 'id' => 'EDIT'));
$out .= html_writer::table($table);
return $out;
}
示例12: action_listinstancejobs
/**
* Mainline for showing all jobs currently set up for an existing
* report
*
* @uses $CFG
* @uses $USER
*/
function action_listinstancejobs()
{
global $CFG, $USER;
//report specified by URL
$report = $this->required_param('report', PARAM_ALPHAEXT);
//get the necessary data
$recordset = block_php_report_get_report_jobs_recordset($report);
//set up a job if none exist and a special parameter
//is passed in to signal this functinality
$createifnone = optional_param('createifnone', 0, PARAM_INT);
if ($createifnone) {
if (!$recordset or $recordset->_numOfRows == 0 or $recordset->EOF) {
//set up a job for this report
$this->action_default();
return;
}
}
//import necessary CSS
$stylesheet_web_path = $CFG->wwwroot . '/blocks/php_report/styles.php';
echo '<style>@import url("' . $stylesheet_web_path . '");</style>';
if ($recordset = block_php_report_get_report_jobs_recordset($report) and $recordset->_numOfRows != 0 and !$recordset->EOF) {
//we actually have scheduled instances for this report
//display appropriate headers
$this->render_listinstancejobs_header(true, NULL, php_report::EXECUTION_MODE_SCHEDULED);
//set up our form
echo '<form action="' . $this->get_url() . '" method="post">';
//used by the "select all" functionality to identify a defining div
echo '<div id="list_display">';
echo '<input type="hidden" id="report" name="report" value="' . $report . '"/>';
//table setup
$table = new stdClass();
//headers, with a "select all" checkbox in the first column
require_js($CFG->wwwroot . '/blocks/php_report/lib.js');
$checkbox = print_checkbox('selectall', '', false, get_string('listinstancejobs_header_select', 'block_php_report'), '', 'select_all()', true);
$table->head = array($checkbox, get_string('listinstancejobs_header_label', 'block_php_report'), get_string('listinstancejobs_header_owner', 'block_php_report'), get_string('listinstancejobs_header_lastrun', 'block_php_report'), get_string('listinstancejobs_header_nextrun', 'block_php_report'), get_string('listinstancejobs_header_lastmodified', 'block_php_report'));
//left align all columns
$table->align = array();
foreach ($table->head as $column_header) {
$table->align[] = 'left';
}
$table->data = array();
//run through available schedules
while ($record = rs_fetch_next_record($recordset)) {
$config_data = unserialize($record->config);
$tz = $config_data['timezone'];
//echo "action_listinstancejobs():: {$config_data['label']}: nextruntime = {$record->nextruntime}<br/>";
//convert the last run time to the appropraite format
if ($record->lastruntime == 0) {
//special case: never run before
$lastruntime = get_string('no_last_runtime', 'block_php_report');
} else {
$lastruntime = userdate($record->lastruntime, '', $tz) . ' (' . usertimezone($tz) . ')';
debug_error_log("/blocks/php_report/lib/schedulelib.php::action_listinstancejobs(); {$config_data['label']}: record->lastruntime = {$record->lastruntime}, tz = {$tz}");
}
// convert 'will run next at' time to appropriate format
$jobenddate = $config_data['schedule']['enddate'];
debug_error_log("/blocks/php_report/lib/schedulelib.php::action_listinstancejobs(); {$config_data['label']}: nextruntime = {$record->nextruntime}, jobenddate = {$jobenddate}");
if (!empty($record->nextruntime) && (empty($jobenddate) || $record->nextruntime < $jobenddate + DAYSECS)) {
$nextruntime = userdate($record->nextruntime, '', $tz) . ' (' . usertimezone($tz) . ')';
} else {
$nextruntime = get_string('job_completed', 'block_php_report');
}
$checkbox = '<input type="checkbox" name="schedule_' . $record->scheduleid . '">';
//link for editing this particular schedule instance
$edit_schedule_params = array('id' => $record->scheduleid);
$edit_schedule_link = '<a href="' . $this->get_url($edit_schedule_params) . '">' . $config_data['label'] . '</a>';
//data row
$table->data[] = array($checkbox, $edit_schedule_link, fullname($record), $lastruntime, $nextruntime, userdate($config_data['timemodified']));
}
print_table($table);
print_spacer();
//display the dropdown and button in an enabled state
$this->render_listinstancejobs_actions_dropdown(true);
echo '</div>';
echo '</form>';
} else {
//display header info
$this->render_listinstancejobs_header(false, NULL, php_report::EXECUTION_MODE_SCHEDULED);
//display the dropdown and button in a disabled state
$this->render_listinstancejobs_actions_dropdown(false);
print_spacer();
}
//general footer
$this->render_listinstancejobs_footer();
}
示例13: test_usertimezone
public function test_usertimezone()
{
global $USER;
$this->resetAfterTest();
$this->setTimezone('Pacific/Auckland', 'Pacific/Auckland');
$USER->timezone = 'Europe/Prague';
$this->assertSame('Europe/Prague', usertimezone());
$USER->timezone = '1';
$this->assertSame('UTC+1', usertimezone());
$USER->timezone = '0';
$this->assertSame('UTC', usertimezone());
$USER->timezone = '99';
$this->assertSame('Pacific/Auckland', usertimezone());
$USER->timezone = '99';
$this->assertSame('Europe/Berlin', usertimezone('Europe/Berlin'));
$USER->timezone = '99';
$this->assertSame('Pacific/Auckland', usertimezone('99'));
$USER->timezone = 'Europe/Prague';
$this->assertSame('Europe/Prague', usertimezone('99'));
// When passed an unknown non-whole hour TZ, verify we round to closest
// hour. (Possible for legacy reasons when old timezones go away).
$USER->timezone = '-9.23';
$this->assertSame('UTC-9', usertimezone('99'));
}
示例14: print_simple_box_start
if (dimdim_is_teacher($dimdim)) {
echo "這個會議尚未開始,時間排訂於" . $outputwithoutdaysTW . "由" . $displayname . "老師您啟動。<br/>This meeting has not started yet. This meeting is scheduled to start " . $outputwithoutdays . " \"" . $displayname . "\" will start the meeting";
} else {
echo "這個會議尚未開始,時間排訂於" . $outputwithoutdaysTW . $displayname . "您就可以參加了。<br/>This meeting has not started yet. This meeting is scheduled to start " . $outputwithoutdays . " \"" . $displayname . "\" will be able to join the meeting";
}
} else {
print_simple_box_start('center');
if (dimdim_is_teacher($dimdim)) {
echo "這個會議尚未開始,時間排訂於" . $outputTW . "由" . $displayname . "老師您啟動。<br/>This meeting has not started yet. This meeting is scheduled to start " . $output . " \"" . $displayname . "\" will start the meeting";
} else {
echo "這個會議尚未開始,時間排訂於" . $outputTW . $displayname . "同學您就可以參加了。<br/>This meeting has not started yet. This meeting is scheduled to start " . $output . " \"" . $displayname . "\" will be able to join the meeting";
}
}
}
if ($now > $dbtime + 7200) {
print_simple_box_start('center');
echo "這會議已經結束了!<br/>This meeting occured in the past and has finished";
}
if ($dimdim->dimdimtime and $dimdim->schedule) {
// A dimdim is scheduled
echo "<p align=\"center\">{$strnextsession}: " . userdate($dimdim->dimdimtime) . ' (' . usertimezone($USER->timezone) . ')</p>';
} else {
echo '<br />';
}
if ($dimdim->intro) {
print_simple_box(format_text($dimdim->intro), 'center', '70%', '', 5, 'generalbox', 'intro');
echo '<br />';
}
/// Finish the page
echo '</td></tr></table>';
print_footer($course);
示例15: userdate
$dateinfo = userdate($date, get_string('strftimedaydate'));
}
$navlinks = array();
$navlinks[] = array('name' => $strreports, 'link' => "{$CFG->wwwroot}/course/report.php?id={$course->id}", 'type' => 'misc');
$navlinks[] = array('name' => $strlogs, 'link' => "index.php?id={$course->id}", 'type' => 'misc');
$navigation = build_navigation($navlinks);
$printheader = print_header($course->shortname . ': ' . $strlogs, $course->fullname, $navigation, '', '', '', '', '', '', '', true);
// For moodle 1.8
/*print_header($course->shortname .': '. $strlogs, $course->fullname,
"<a href=\"$CFG->wwwroot/course/view.php?id=$course->id\">$course->shortname</a> ->
<a href=\"$CFG->wwwroot/course/report.php?id=$course->id\">$strreports</a> ->
<a href=\"index.php?id=$course->id\">$strlogs</a>",'','','','','','','', true);*/
$printheader = explode('</head>', $printheader);
$printheader[0] .= "<script type=\"text/javascript\" src=\"{$CFG->wwwroot}/course/report/log_timeline/api_timeline/timeline-api.js\"></script>\n";
echo implode('</head>', $printheader);
print_heading_modified(format_string($course->fullname) . " : {$userinfo} : {$dateinfo} (" . usertimezone() . ")", "title_timeline");
print_mnet_log_selector_form($hostid, $course, $user, $date, $modname, $modid, $modaction, $group, $showcourses, $showusers);
$logs = build_logs_array($course, $user, $date, '', 0, '', $modname, $modid, $modaction, $group);
if (!$logs) {
notify("No logs found!");
} else {
//Print the timeline
$getaxml = "getxml.php?id=" . $id . "&hostid=" . $hostid . "&user=" . $user . "&date=" . $date . "&modname=" . $modname . "&modid=" . $modid . "&modaction=" . $modaction . "&group=" . $group;
if ($height_timeline < 0) {
$height_timeline = 500;
}
echo '<div id="my-timeline" style="height: ' . $height_timeline . 'px; border: 1px solid #aaa"></div>';
?>
<script type="text/javascript">
<!--