本文整理汇总了PHP中print_simple_box_end函数的典型用法代码示例。如果您正苦于以下问题:PHP print_simple_box_end函数的具体用法?PHP print_simple_box_end怎么用?PHP print_simple_box_end使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_simple_box_end函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: print_entry
function print_entry($course)
{
global $CFG, $USER;
$strloginto = get_string("loginto", "", $course->shortname);
$strcourses = get_string("courses");
$teacher = get_teacher($course->id);
if ((double) $course->cost < 0) {
$cost = (double) $CFG->enrol_cost;
} else {
$cost = (double) $course->cost;
}
if (abs($cost) < 0.01) {
// no cost, default to base class entry to course
$manual = enrolment_factory::factory('manual');
$manual->print_entry($course);
} else {
$navlinks = array();
$navlinks[] = array('name' => $strcourses, 'link' => "{$CFG->wwwroot}/course", 'type' => 'misc');
$navlinks[] = array('name' => $strloginto, 'link' => null, 'type' => 'misc');
$navigation = build_navigation($navlinks);
print_header($strloginto, $course->fullname, $navigation);
print_course($course, "80%");
if ($course->password) {
// Presenting two options
print_heading(get_string('costorkey', 'enrol_paypal'), 'center');
}
print_simple_box_start("center");
if ($USER->username == 'guest') {
// force login only for guest user, not real users with guest role
if (empty($CFG->loginhttps)) {
$wwwroot = $CFG->wwwroot;
} else {
// This actually is not so secure ;-), 'cause we're
// in unencrypted connection...
$wwwroot = str_replace("http://", "https://", $CFG->wwwroot);
}
echo '<div align="center"><p>' . get_string('paymentrequired') . '</p>';
echo '<p><b>' . get_string('cost') . ": {$CFG->enrol_currency} {$cost}" . '</b></p>';
echo '<p><a href="' . $wwwroot . '/login/">' . get_string('loginsite') . '</a></p>';
echo '</div>';
} else {
//Sanitise some fields before building the PayPal form
$coursefullname = $course->fullname;
$courseshortname = $course->shortname;
$userfullname = fullname($USER);
$userfirstname = $USER->firstname;
$userlastname = $USER->lastname;
$useraddress = $USER->address;
$usercity = $USER->city;
include $CFG->dirroot . '/enrol/paypal/enrol.html';
}
print_simple_box_end();
if ($course->password) {
// Second option
$password = '';
include $CFG->dirroot . '/enrol/manual/enrol.html';
}
print_footer();
}
}
示例2: display_msg
/**
* Display an message with optional details from HTML
*
* @param string $msg The message to display
* @param string $details Any message details to be initially hidden
* @param string $type The 'type' of message: i.e. 'error','general', ???
*/
function display_msg($msg, $details = '', $type = 'error')
{
$width = '';
if (!empty($details)) {
$innertags = array('html', 'body');
foreach ($innertags as $tag) {
if (($tagpos = stripos($details, '<' . $tag)) !== false && ($firstend = strpos(substr($details, $tagpos), '>')) !== false) {
if (($tagend = stripos($details, '</' . $tag . '>')) !== false) {
$details = substr($details, $tagpos + $firstend + 1, $tagend - $tagpos - $firstend - 1);
} else {
$details = substr($details, $tagpos + $firstend + 1);
}
}
}
$details = addcslashes($details, "'");
$details = preg_replace("/\n/", '', $details);
$details = preg_replace("|/alfresco/images/logo/AlfrescoLogo32.png|", '/blocks/repository/AlfrescoLogo32.png', $details);
$width = '99%';
// TBD
}
$output = print_simple_box_start('center', $width, '', 5, $type . 'box', '', true);
$output .= $msg;
if (!empty($details)) {
$output .= '<p align="right"><input type="button" value="' . get_string('details', 'block_repository') . '" onclick="toggle_msgdetails();" /></p>' . '<div id="msgdetails" style="overflow:auto;overflow-y:hidden;-ms-overflow-y:hidden"></div>';
$output .= "\n<script type=\"text/javascript\">\n//<![CDATA[\nfunction toggle_msgdetails() {\n mddiv = document.getElementById('msgdetails');\n if (mddiv) {\n mddiv.innerHTML = (mddiv.innerHTML == '') ? '{$details}' : '';\n }\n}\n//]]>\n</script>\n";
}
$output .= print_simple_box_end(true);
echo $output;
}
示例3: view
/**
* Displays the assignment content - this method overrides
* the parent class, adding a repository availability check
*/
function view()
{
global $USER;
require_capability('mod/assignment:view', $this->context);
//start of RL base-class modification
$repo = $this->get_repository_object();
if (!$repo) {
//configuration is not complete
$message = get_string('errorrepository', 'assignment_backpack');
//wrap the error with further instructions
print_error('errorrepositoryview', 'assignment_backpack', '', $message);
}
//end of RL base-class modification
add_to_log($this->course->id, 'assignment', 'view', "view.php?id={$this->cm->id}", $this->assignment->id, $this->cm->id);
$this->view_header();
if ($this->assignment->timeavailable > time() and !has_capability('mod/assignment:grade', $this->context) and $this->assignment->var3) {
// force hiding before available date
print_simple_box_start('center', '', '', 0, 'generalbox', 'intro');
print_string('notavailableyet', 'assignment');
print_simple_box_end();
} else {
$this->view_intro();
}
$this->view_dates();
$filecount = $this->count_user_files($USER->id);
$submission = $this->get_submission($USER->id);
$this->view_feedback();
if (!$this->drafts_tracked() or !$this->isopen() or $this->is_finalized($submission)) {
print_heading(get_string('submission', 'assignment'), '', 3);
} else {
print_heading(get_string('submissiondraft', 'assignment'), '', 3);
}
if ($filecount and $submission) {
print_simple_box($this->print_user_files($USER->id, true), 'center');
} else {
if (!$this->isopen() or $this->is_finalized($submission)) {
print_simple_box(get_string('nofiles', 'assignment'), 'center');
} else {
print_simple_box(get_string('nofilesyet', 'assignment'), 'center');
}
}
if (has_capability('mod/assignment:submit', $this->context)) {
$this->view_upload_form();
}
if ($this->notes_allowed()) {
print_heading(get_string('notes', 'assignment'), '', 3);
$this->view_notes();
}
$this->view_final_submission();
$this->view_footer();
}
示例4: journal_user_complete_index
function journal_user_complete_index($course, $user, $journal, $journalopen, $heading)
{
/// Prints a journal, entry and feedback ... used on the journal index page.
if (isteacher($course->id)) {
$entrycount = journal_count_entries($journal, get_current_group($course->id));
$entryinfo = " (<a href=\"report.php?id={$journal->coursemodule}\">" . get_string("viewallentries", "journal", $entrycount) . "</a>)";
} else {
$entryinfo = "";
}
$journal->name = "<a href=\"view.php?id={$journal->coursemodule}\">" . format_string($journal->name, true) . "</a>";
if ($heading) {
echo "<h3>{$heading} - {$journal->name}{$entryinfo}</h3>";
} else {
echo "<h3>{$journal->name}{$entryinfo}</h3>";
}
print_simple_box_start("left", "90%");
echo format_text($journal->intro, $journal->introformat);
print_simple_box_end();
echo "<br clear=\"all\" />";
echo "<br />";
if (isstudent($course->id) or isteacher($course->id)) {
print_simple_box_start("right", "90%");
if ($journalopen) {
echo "<p align=\"right\"><a href=\"edit.php?id={$journal->coursemodule}\">";
echo get_string("edit") . "</a></p>";
} else {
echo "<p align=\"right\"><a href=\"view.php?id={$journal->coursemodule}\">";
echo get_string("view") . "</a></p>";
}
if ($entry = get_record("journal_entries", "userid", $user->id, "journal", $journal->id)) {
if ($entry->modified) {
echo "<p align=\"center\"><font size=\"1\">" . get_string("lastedited") . ": " . userdate($entry->modified) . "</font></p>";
}
if ($entry->text) {
echo format_text($entry->text, $entry->format);
}
if ($entry->teacher) {
$grades = make_grades_menu($journal->assessed);
journal_print_feedback($course, $entry, $grades);
}
} else {
print_string("noentry", "journal");
}
print_simple_box_end();
echo "<br clear=\"all\" />";
echo "<br />";
}
}
示例5: instance_config_print
function instance_config_print()
{
global $CFG;
/// set up the numberoftags select field
$numberoftags = array();
for ($i = 1; $i <= 200; $i++) {
$numberoftags[$i] = $i;
}
if (is_file($CFG->dirroot . '/blocks/' . $this->name() . '/config_instance.html')) {
print_simple_box_start('center', '', '', 5, 'blockconfigglobal');
include $CFG->dirroot . '/blocks/' . $this->name() . '/config_instance.html';
print_simple_box_end();
} else {
notice(get_string('blockconfigbad'), str_replace('blockaction=', 'dummy=', qualified_me()));
}
}
示例6: view
function view()
{
global $USER;
require_capability('mod/assignment:view', $this->context);
add_to_log($this->course->id, 'assignment', 'view', "view.php?id={$this->cm->id}", $this->assignment->id, $this->cm->id);
$this->view_header();
if ($this->assignment->timeavailable > time() and !has_capability('mod/assignment:grade', $this->context) and $this->assignment->var3) {
// force hiding before available date
print_simple_box_start('center', '', '', 0, 'generalbox', 'intro');
print_string('notavailableyet', 'assignment');
print_simple_box_end();
} else {
$this->view_intro();
}
$this->view_dates();
if (has_capability('mod/assignment:submit', $this->context)) {
$filecount = $this->count_user_files($USER->id);
$submission = $this->get_submission($USER->id);
$this->view_feedback();
if (!$this->drafts_tracked() or !$this->isopen() or $this->is_finalized($submission)) {
print_heading(get_string('submission', 'assignment'), '', 3);
} else {
print_heading(get_string('submissiondraft', 'assignment'), '', 3);
}
if ($filecount and $submission) {
print_simple_box($this->print_user_files($USER->id, true), 'center');
} else {
if (!$this->isopen() or $this->is_finalized($submission)) {
print_simple_box(get_string('nofiles', 'assignment'), 'center');
} else {
print_simple_box(get_string('nofilesyet', 'assignment'), 'center');
}
}
$this->view_upload_form();
if ($this->notes_allowed()) {
print_heading(get_string('notes', 'assignment'), '', 3);
$this->view_notes();
}
$this->view_final_submission();
}
$this->view_footer();
}
示例7: scorm_view_display
function scorm_view_display($user, $scorm, $action, $cm, $boxwidth = '')
{
global $CFG;
if ($scorm->updatefreq == UPDATE_EVERYTIME) {
require_once $CFG->dirroot . '/mod/scorm/lib.php';
$scorm->instance = $scorm->id;
scorm_update_instance($scorm);
}
$organization = optional_param('organization', '', PARAM_INT);
print_simple_box_start('center', $boxwidth);
?>
<div class="structurehead"><?php
print_string('contents', 'scorm');
?>
</div>
<?php
if (empty($organization)) {
$organization = $scorm->launch;
}
if ($orgs = get_records_select_menu('scorm_scoes', "scorm='{$scorm->id}' AND organization='' AND launch=''", 'id', 'id,title')) {
if (count($orgs) > 1) {
?>
<div class='scorm-center'>
<?php
print_string('organizations', 'scorm');
?>
<form id='changeorg' method='post' action='<?php
echo $action;
?>
'>
<?php
choose_from_menu($orgs, 'organization', "{$organization}", '', 'submit()');
?>
</form>
</div>
<?php
}
}
$orgidentifier = '';
if ($sco = scorm_get_sco($organization, SCO_ONLY)) {
if ($sco->organization == '' && $sco->launch == '') {
$orgidentifier = $sco->identifier;
} else {
$orgidentifier = $sco->organization;
}
}
/*
$orgidentifier = '';
if ($org = get_record('scorm_scoes','id',$organization)) {
if (($org->organization == '') && ($org->launch == '')) {
$orgidentifier = $org->identifier;
} else {
$orgidentifier = $org->organization;
}
}*/
$scorm->version = strtolower(clean_param($scorm->version, PARAM_SAFEDIR));
// Just to be safe
if (!file_exists($CFG->dirroot . '/mod/scorm/datamodels/' . $scorm->version . 'lib.php')) {
$scorm->version = 'scorm_12';
}
require_once $CFG->dirroot . '/mod/scorm/datamodels/' . $scorm->version . 'lib.php';
$result = scorm_get_toc($user, $scorm, 'structlist', $orgidentifier);
$incomplete = $result->incomplete;
echo $result->toc;
print_simple_box_end();
?>
<div class="scorm-center">
<form id="theform" method="post" action="<?php
echo $CFG->wwwroot;
?>
/mod/scorm/player.php">
<?php
if ($scorm->hidebrowse == 0) {
print_string('mode', 'scorm');
echo ': <input type="radio" id="b" name="mode" value="browse" /><label for="b">' . get_string('browse', 'scorm') . '</label>' . "\n";
echo '<input type="radio" id="n" name="mode" value="normal" checked="checked" /><label for="n">' . get_string('normal', 'scorm') . "</label>\n";
} else {
echo '<input type="hidden" name="mode" value="normal" />' . "\n";
}
if ($incomplete === false && ($result->attemptleft > 0 || $scorm->maxattempt == 0)) {
?>
<br />
<input type="checkbox" id="a" name="newattempt" />
<label for="a"><?php
print_string('newattempt', 'scorm');
?>
</label>
<?php
}
?>
<br />
<input type="hidden" name="scoid"/>
<input type="hidden" name="id" value="<?php
echo $cm->id;
?>
"/>
<input type="hidden" name="currentorg" value="<?php
echo $orgidentifier;
?>
" />
//.........这里部分代码省略.........
示例8: forum_print_big_search_form
/**
* @todo Document this function
*/
function forum_print_big_search_form($course)
{
global $CFG, $DB, $words, $subject, $phrase, $user, $userid, $fullwords, $notwords, $datefrom, $dateto;
print_simple_box(get_string('searchforumintro', 'forum'), 'center', '', '', 'searchbox', 'intro');
print_simple_box_start("center");
echo "<script type=\"text/javascript\">\n";
echo "var timefromitems = ['fromday','frommonth','fromyear','fromhour', 'fromminute'];\n";
echo "var timetoitems = ['today','tomonth','toyear','tohour','tominute'];\n";
echo "</script>\n";
echo '<form id="searchform" action="search.php" method="get">';
echo '<table cellpadding="10" class="searchbox" id="form">';
echo '<tr>';
echo '<td class="c0"><label for="words">' . get_string('searchwords', 'forum') . '</label>';
echo '<input type="hidden" value="' . $course->id . '" name="id" alt="" /></td>';
echo '<td class="c1"><input type="text" size="35" name="words" id="words"value="' . s($words, true) . '" alt="" /></td>';
echo '</tr>';
echo '<tr>';
echo '<td class="c0"><label for="phrase">' . get_string('searchphrase', 'forum') . '</label></td>';
echo '<td class="c1"><input type="text" size="35" name="phrase" id="phrase" value="' . s($phrase, true) . '" alt="" /></td>';
echo '</tr>';
echo '<tr>';
echo '<td class="c0"><label for="notwords">' . get_string('searchnotwords', 'forum') . '</label></td>';
echo '<td class="c1"><input type="text" size="35" name="notwords" id="notwords" value="' . s($notwords, true) . '" alt="" /></td>';
echo '</tr>';
if ($DB->get_db_family() == 'mysql' || $DB->get_db_family() == 'postgres') {
echo '<tr>';
echo '<td class="c0"><label for="fullwords">' . get_string('searchfullwords', 'forum') . '</label></td>';
echo '<td class="c1"><input type="text" size="35" name="fullwords" id="fullwords" value="' . s($fullwords, true) . '" alt="" /></td>';
echo '</tr>';
}
echo '<tr>';
echo '<td class="c0">' . get_string('searchdatefrom', 'forum') . '</td>';
echo '<td class="c1">';
if (empty($datefrom)) {
$datefromchecked = '';
$datefrom = make_timestamp(2000, 1, 1, 0, 0, 0);
} else {
$datefromchecked = 'checked="checked"';
}
echo '<input name="timefromrestrict" type="checkbox" value="1" alt="' . get_string('searchdatefrom', 'forum') . '" onclick="return lockoptions(\'searchform\', \'timefromrestrict\', timefromitems)" ' . $datefromchecked . ' /> ';
print_date_selector('fromday', 'frommonth', 'fromyear', $datefrom);
print_time_selector('fromhour', 'fromminute', $datefrom);
echo '<input type="hidden" name="hfromday" value="0" />';
echo '<input type="hidden" name="hfrommonth" value="0" />';
echo '<input type="hidden" name="hfromyear" value="0" />';
echo '<input type="hidden" name="hfromhour" value="0" />';
echo '<input type="hidden" name="hfromminute" value="0" />';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td class="c0">' . get_string('searchdateto', 'forum') . '</td>';
echo '<td class="c1">';
if (empty($dateto)) {
$datetochecked = '';
$dateto = time() + 3600;
} else {
$datetochecked = 'checked="checked"';
}
echo '<input name="timetorestrict" type="checkbox" value="1" alt="' . get_string('searchdateto', 'forum') . '" onclick="return lockoptions(\'searchform\', \'timetorestrict\', timetoitems)" ' . $datetochecked . ' /> ';
print_date_selector('today', 'tomonth', 'toyear', $dateto);
print_time_selector('tohour', 'tominute', $dateto);
echo '<input type="hidden" name="htoday" value="0" />';
echo '<input type="hidden" name="htomonth" value="0" />';
echo '<input type="hidden" name="htoyear" value="0" />';
echo '<input type="hidden" name="htohour" value="0" />';
echo '<input type="hidden" name="htominute" value="0" />';
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td class="c0"><label for="menuforumid">' . get_string('searchwhichforums', 'forum') . '</label></td>';
echo '<td class="c1">';
choose_from_menu(forum_menu_list($course), 'forumid', '', get_string('allforums', 'forum'), '');
echo '</td>';
echo '</tr>';
echo '<tr>';
echo '<td class="c0"><label for="subject">' . get_string('searchsubject', 'forum') . '</label></td>';
echo '<td class="c1"><input type="text" size="35" name="subject" id="subject" value="' . s($subject, true) . '" alt="" /></td>';
echo '</tr>';
echo '<tr>';
echo '<td class="c0"><label for="user">' . get_string('searchuser', 'forum') . '</label></td>';
echo '<td class="c1"><input type="text" size="35" name="user" id="user" value="' . s($user, true) . '" alt="" /></td>';
echo '</tr>';
echo '<tr>';
echo '<td class="submit" colspan="2" align="center">';
echo '<input type="submit" value="' . get_string('searchforums', 'forum') . '" alt="" /></td>';
echo '</tr>';
echo '</table>';
echo '</form>';
echo "<script type=\"text/javascript\">";
echo "lockoptions('searchform','timefromrestrict', timefromitems);";
echo "lockoptions('searchform','timetorestrict', timetoitems);";
echo "</script>\n";
print_simple_box_end();
}
示例9: main_upgrade
//.........这里部分代码省略.........
}
if (!($sectionid = add_mod_to_section($mod))) {
notify("Could not add the new course module to that section");
return false;
}
if (!set_field("course_modules", "section", $sectionid, "id", $mod->coursemodule)) {
notify("Could not update the course module with the correct section");
return false;
}
}
}
}
}
if ($oldversion < 2002111003) {
execute_sql(" ALTER TABLE `course` ADD `modinfo` TEXT NOT NULL AFTER `format` ");
if ($courses = get_records_sql("SELECT * FROM course")) {
require_once "{$CFG->dirroot}/course/lib.php";
foreach ($courses as $course) {
$modinfo = serialize(get_array_of_activities($course->id));
if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
notify("Could not cache module information for course '" . format_string($course->fullname) . "'!");
}
}
}
}
if ($oldversion < 2002111100) {
print_simple_box_start("CENTER", "", "#FFCCCC");
echo "<FONT SIZE=+1>";
echo "<P>Changes have been made to all built-in themes, to add the new popup navigation menu.";
echo "<P>If you have customised themes, you will need to edit theme/xxxx/header.html as follows:";
echo "<UL><LI>Change anywhere it says <B>\$" . "button</B> to say <B>\$" . "menu</B>";
echo "<LI>Add <B>\$" . "button</B> elsewhere (eg at the end of the navigation bar)</UL>";
echo "<P>See the standard themes for examples, eg: theme/standard/header.html";
print_simple_box_end();
}
if ($oldversion < 2002111200) {
execute_sql(" ALTER TABLE `course` ADD `showrecent` TINYINT(5) UNSIGNED DEFAULT '1' NOT NULL AFTER `numsections` ");
}
if ($oldversion < 2002111400) {
// Rebuild all course caches, because some may not be done in new installs (eg site page)
if ($courses = get_records_sql("SELECT * FROM course")) {
require_once "{$CFG->dirroot}/course/lib.php";
foreach ($courses as $course) {
$modinfo = serialize(get_array_of_activities($course->id));
if (!set_field("course", "modinfo", $modinfo, "id", $course->id)) {
notify("Could not cache module information for course '" . format_string($course->fullname) . "'!");
}
}
}
}
if ($oldversion < 2002112000) {
set_config("guestloginbutton", 1);
}
if ($oldversion < 2002122300) {
execute_sql("ALTER TABLE `log` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
execute_sql("ALTER TABLE `user_admins` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
execute_sql("ALTER TABLE `user_students` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
execute_sql("ALTER TABLE `user_teachers` CHANGE `user` `userid` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
execute_sql("ALTER TABLE `user_students` CHANGE `start` `timestart` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
execute_sql("ALTER TABLE `user_students` CHANGE `end` `timeend` INT(10) UNSIGNED DEFAULT '0' NOT NULL ");
}
if ($oldversion < 2002122700) {
if (!record_exists("log_display", "module", "user", "action", "view")) {
execute_sql("INSERT INTO {$CFG->prefix}log_display (module, action, mtable, field) VALUES ('user', 'view', 'user', 'CONCAT(firstname,' ',lastname)') ");
}
}
示例10: instance_config_print
function instance_config_print()
{
global $CFG, $DB;
if (!isset($this->config)) {
// ... teacher has not yet configured the block, let's put some default values here to explain things
$this->config->title = get_string('blockname', 'block_glossary_random');
$this->config->refresh = 0;
$this->config->showconcept = 1;
$this->config->cache = get_string('notyetconfigured', 'block_glossary_random');
$this->config->addentry = get_string('addentry', 'block_glossary_random');
$this->config->viewglossary = get_string('viewglossary', 'block_glossary_random');
$this->config->invisible = get_string('invisible', 'block_glossary_random');
}
// select glossaries to put in dropdown box ...
$glossaries = $DB->get_records_menu('glossary', array('course' => $this->course->id), 'name', 'id,name');
//format menu texts to avoid html and to filter multilang values
if (!empty($glossaries)) {
foreach ($glossaries as $key => $value) {
$glossaries[$key] = strip_tags(format_string($value, true));
}
}
// and select quotetypes to put in dropdown box
$type[0] = get_string('random', 'block_glossary_random');
$type[1] = get_string('lastmodified', 'block_glossary_random');
$type[2] = get_string('nextone', 'block_glossary_random');
$this->config->nexttime = usergetmidnight(time()) + DAYSECS * $this->config->refresh;
// display the form
if (is_file($CFG->dirroot . '/blocks/' . $this->name() . '/config_instance.html')) {
print_simple_box_start('center', '', '', 5, 'blockconfigglobal');
include $CFG->dirroot . '/blocks/' . $this->name() . '/config_instance.html';
print_simple_box_end();
} else {
notice(get_string('blockconfigbad'), str_replace('blockaction=', 'dummy=', qualified_me()));
}
return true;
}
示例11: fm_unzip_show_status
function fm_unzip_show_status($list, $removepath)
{
//This function shows the results of the unzip execution
//depending of the value of the $CFG->zip, results will be
//text or an array of files.
global $CFG;
if (empty($CFG->unzip)) {
// Use built-in php-based zip function
$strname = get_string("name");
$strsize = get_string("size");
$strmodified = get_string("modified");
$strstatus = get_string("status");
echo "<table cellpadding=\"4\" cellspacing=\"2\" border=\"0\" width=\"640\">";
echo "<tr><th class=\"header\" align=\"left\">{$strname}</th>";
echo "<th class=\"header\" align=\"right\">{$strsize}</th>";
echo "<th class=\"header\" align=\"right\">{$strmodified}</th>";
echo "<th class=\"header\" align=\"right\">{$strstatus}</th></tr>";
foreach ($list as $item) {
echo "<tr>";
$item['filename'] = str_replace(cleardoubleslashes($removepath) . '/', "", $item['filename']);
print_cell("left", $item['filename']);
if (!$item['folder']) {
print_cell("right", display_size($item['size']));
} else {
echo "<td> </td>";
}
$filedate = userdate($item['mtime'], get_string("strftimedatetime"));
print_cell("right", $filedate);
print_cell("right", $item['status']);
echo "</tr>";
}
echo "</table>";
} else {
// Use external zip program
print_simple_box_start("center");
echo "<pre>";
foreach ($list as $item) {
echo str_replace(cleardoubleslashes($removepath . '/'), '', $item) . '<br />';
}
echo "</pre>";
print_simple_box_end();
}
}
示例12: user_complete
/**
* Print complete information about the user's interaction with the assignment
*
* @param $user object
*/
function user_complete($user, $grade = null)
{
if ($grade) {
echo '<p>' . get_string('grade') . ': ' . $grade->str_long_grade . '</p>';
if ($grade->str_feedback) {
echo '<p>' . get_string('feedback') . ': ' . $grade->str_feedback . '</p>';
}
}
if ($submission = $this->get_submission($user->id)) {
if ($basedir = $this->file_area($user->id)) {
if ($files = get_directory_list($basedir)) {
$countfiles = count($files) . " " . get_string("uploadedfiles", "assignment");
foreach ($files as $file) {
$countfiles .= "; {$file}";
}
}
}
print_simple_box_start();
echo get_string("lastmodified") . ": ";
echo userdate($submission->timemodified);
echo $this->display_lateness($submission->timemodified);
$this->print_user_files($user->id);
echo '<br />';
$this->view_feedback($submission);
print_simple_box_end();
} else {
print_string("notsubmittedyet", "assignment");
}
}
示例13: dialogue_print_conversation
//.........这里部分代码省略.........
global $USER, $CFG;
if (!($course = get_record('course', 'id', $dialogue->course))) {
error('Course is misconfigured');
}
if (!($cm = get_coursemodule_from_instance('dialogue', $dialogue->id, $course->id))) {
error('Course Module ID was incorrect');
}
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$dialoguemanagers = array_keys(get_users_by_capability($context, 'mod/dialogue:manage'));
$timenow = time();
$showbutton = false;
require_once 'dialogue_reply_form.php';
$mform = new mod_dialogue_reply_form('dialogues.php', array('conversationid' => $conversation->id));
$mform->set_data(array('id' => $cm->id, 'action' => 'insertentries', 'pane' => DIALOGUEPANE_CURRENT));
$showbutton = true;
print_simple_box_start('center', '');
echo "<table align=\"center\" border=\"1\" cellspacing=\"0\" valign=\"top\" cellpadding=\"4\" \n width=\"100%\">\n";
echo "<tr><td>\n";
if (in_array($USER->id, $dialoguemanagers)) {
if (!in_array($conversation->userid, $dialoguemanagers)) {
if (!($otheruser = get_record('user', 'id', $conversation->userid))) {
error("User's record not found");
}
} else {
if (!($otheruser = get_record('user', 'id', $conversation->recipientid))) {
error("User's record not found");
}
}
} else {
if ($USER->id != $conversation->userid) {
if (!($otheruser = get_record('user', 'id', $conversation->userid))) {
error("User's record not found");
}
} else {
if (!($otheruser = get_record('user', 'id', $conversation->recipientid))) {
error("User's record not found");
}
}
}
$picture = print_user_picture($otheruser->id, $course->id, $otheruser->picture, false, true);
echo $picture . " <b>" . get_string('dialoguewith', 'dialogue', fullname($otheruser)) . '</b></td>';
echo '<td><i>' . format_string($conversation->subject) . " </i><br />\n";
echo "<div align=\"right\">\n";
if (!$conversation->subject) {
// conversation does not have a subject, show add subject link
echo "<a href=\"dialogues.php?action=getsubject&id={$cm->id}&cid={$conversation->id}&pane=" . DIALOGUEPANE_CURRENT . "\">" . get_string('addsubject', 'dialogue') . "</a>\n";
helpbutton('addsubject', get_string('addsubject', 'dialogue'), 'dialogue');
echo ' | ';
}
if (!$conversation->closed && has_capability('mod/dialogue:close', $context)) {
echo "<a href=\"dialogues.php?action=confirmclose&id={$cm->id}&cid={$conversation->id}&pane=" . DIALOGUEPANE_CURRENT . "\">" . get_string('close', 'dialogue') . "</a>\n";
helpbutton('closedialogue', get_string('close', 'dialogue'), 'dialogue');
}
echo "</div></td></tr>\n";
if ($entries = get_records_select('dialogue_entries', "conversationid = {$conversation->id}", 'id')) {
$firstentry = true;
foreach ($entries as $entry) {
if (!($otheruser = get_record('user', 'id', $entry->userid))) {
error('User not found');
}
$canedit = false;
if (!$conversation->closed && $entry->userid == $USER->id && $timenow < $entry->timecreated + $dialogue->edittime * 60) {
$canedit = true;
}
if ($entry->timecreated != $entry->timemodified) {
$modified = get_string('updated', 'dialogue', userdate($entry->timemodified));
} else {
$modified = '';
}
if ($entry->userid == $USER->id) {
echo "<tr><td colspan=\"2\" bgcolor=\"#FFFFFF\">\n";
if ($canedit) {
if ($firstentry) {
echo "<a href=\"dialogues.php?action=editconversation&id={$cm->id}&entryid={$entry->id}&pane=" . DIALOGUEPANE_CURRENT . "\">" . get_string('edit') . '</a>';
} else {
echo "<a href=\"dialogues.php?action=editreply&id={$cm->id}&entryid={$entry->id}&pane=" . DIALOGUEPANE_CURRENT . "\">" . get_string('edit') . '</a>';
}
}
echo "<p><font size=\"1\">" . get_string('onyouwrote', 'dialogue', userdate($entry->timecreated) . ' ' . $modified);
echo ":</font></p><br />" . format_text($entry->text);
} else {
echo "<tr><td colspan=\"2\">\n";
echo "<p><font size=\"1\">" . get_string("onwrote", "dialogue", userdate($entry->timecreated) . " {$modified} " . fullname($otheruser));
echo ":</font></p><br />" . format_text($entry->text);
}
echo dialogue_print_attachments($entry);
echo "</td></tr>\n";
$firstentry = false;
}
}
echo "</table><br />\n";
if (!$conversation->closed && (has_capability('mod/dialogue:participateany', $context) || $conversation->userid == $USER->id || $conversation->recipientid == $USER->id)) {
$mform->display();
}
print_simple_box_end();
if (!$conversation->seenon && $conversation->lastrecipientid == $USER->id) {
set_field('dialogue_conversations', 'seenon', time(), 'id', $conversation->id);
}
dialogue_mark_conversation_read($conversation->id, $USER->id);
}
示例14: unzip_show_status
function unzip_show_status($list, $removepath, $removepath2)
{
//This function shows the results of the unzip execution
//depending of the value of the $CFG->zip, results will be
//text or an array of files.
global $CFG;
if (empty($CFG->unzip)) {
// Use built-in php-based zip function
$strname = get_string("name");
$strsize = get_string("size");
$strmodified = get_string("modified");
$strstatus = get_string("status");
echo "<table width=\"640\">";
echo "<tr><th class=\"header\" scope=\"col\">{$strname}</th>";
echo "<th class=\"header\" align=\"right\" scope=\"col\">{$strsize}</th>";
echo "<th class=\"header\" align=\"right\" scope=\"col\">{$strmodified}</th>";
echo "<th class=\"header\" align=\"right\" scope=\"col\">{$strstatus}</th></tr>";
foreach ($list as $item) {
echo "<tr>";
$item['filename'] = str_replace(cleardoubleslashes($removepath) . '/', "", $item['filename']);
$item['filename'] = str_replace(cleardoubleslashes($removepath2) . '/', "", $item['filename']);
echo '<td align="left" style="white-space:nowrap ">' . s(clean_param($item['filename'], PARAM_PATH)) . '</td>';
if (!$item['folder']) {
echo '<td align="right" style="white-space:nowrap ">' . display_size($item['size']) . '</td>';
} else {
echo "<td> </td>";
}
$filedate = userdate($item['mtime'], get_string("strftimedatetime"));
echo '<td align="right" style="white-space:nowrap ">' . $filedate . '</td>';
echo '<td align="right" style="white-space:nowrap ">' . $item['status'] . '</td>';
echo "</tr>";
}
echo "</table>";
} else {
// Use external zip program
print_simple_box_start("center");
echo "<pre>";
foreach ($list as $item) {
$item = str_replace(cleardoubleslashes($removepath . '/'), '', $item);
$item = str_replace(cleardoubleslashes($removepath2 . '/'), '', $item);
echo s($item) . '<br />';
}
echo "</pre>";
print_simple_box_end();
}
}
示例15: resource_delete_warning
function resource_delete_warning($course, $files)
{
global $CFG;
$found = array();
foreach ($files as $key => $file) {
$files[$key] = trim($file, '/');
}
$sql = "SELECT r.id, r.reference, r.name, cm.id AS cmid\n FROM {$CFG->prefix}resource r,\n {$CFG->prefix}course_modules cm,\n {$CFG->prefix}modules m\n WHERE r.course = '{$course->id}'\n AND m.name = 'resource'\n AND cm.module = m.id\n AND cm.instance = r.id\n AND (r.type = 'file' OR r.type = 'directory')";
if ($resources = get_records_sql($sql)) {
foreach ($resources as $resource) {
if ($resource->reference == '') {
continue;
// top shared directory does not prevent anything
}
if (in_array($resource->reference, $files)) {
$found[$resource->id] = $resource;
} else {
foreach ($files as $file) {
if (preg_match('|^' . preg_quote($file, '|') . '/|', $resource->reference)) {
$found[$resource->id] = $resource;
}
}
}
}
}
if (!empty($found)) {
print_simple_box_start("center");
echo '<p><strong>' . get_string('affectedresources', 'resource') . ':</strong><ul>';
foreach ($found as $resource) {
echo "<li><a href=\"{$CFG->wwwroot}/mod/resource/view.php?id={$resource->cmid}\" target=\"_blank\">{$resource->name}</a>: {$resource->reference}</li>";
}
echo '</ul></p>';
print_simple_box_end();
return true;
} else {
return false;
}
}