本文整理汇总了PHP中link_to_popup_window函数的典型用法代码示例。如果您正苦于以下问题:PHP link_to_popup_window函数的具体用法?PHP link_to_popup_window怎么用?PHP link_to_popup_window使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了link_to_popup_window函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: qcreate_question_action_icons
/**
* Function that can be used in various parts of the quiz code.
* @param object $quiz
* @param integer $cmid
* @param object $question
* @param string $returnurl url to return to after action is done.
* @return string html for a number of icons linked to action pages for a
* question - preview and edit / view icons depending on user capabilities.
*/
function qcreate_question_action_icons($cmid, $question, $returnurl)
{
global $CFG, $COURSE;
static $stredit = null;
static $strview = null;
static $strpreview = null;
static $strdelete = null;
if ($stredit === null) {
$stredit = get_string('edit');
$strview = get_string('view');
$strpreview = get_string('preview', 'quiz');
$strdelete = get_string("delete");
}
$html = '';
if ($question->qtype != 'random') {
if (question_has_capability_on($question, 'use', $question->cid)) {
$html .= link_to_popup_window('/question/preview.php?id=' . $question->id . '&courseid=' . $COURSE->id, 'questionpreview', "<img src=\"{$CFG->pixpath}/t/preview.gif\" class=\"iconsmall\" alt=\"{$strpreview}\" />", 0, 0, $strpreview, QUESTION_PREVIEW_POPUP_OPTIONS, true);
}
}
$questionparams = array('returnurl' => $returnurl, 'cmid' => $cmid, 'id' => $question->id);
$questionurl = new moodle_url("{$CFG->wwwroot}/question/question.php", $questionparams);
if (question_has_capability_on($question, 'edit', $question->cid) || question_has_capability_on($question, 'move', $question->cid)) {
$html .= "<a title=\"{$stredit}\" href=\"" . $questionurl->out() . "\">" . "<img src=\"{$CFG->pixpath}/t/edit.gif\" class=\"iconsmall\" alt=\"{$stredit}\" />" . "</a>";
} elseif (question_has_capability_on($question, 'view', $question->cid)) {
$html .= "<a title=\"{$strview}\" href=\"" . $questionurl->out(false, array('id' => $question->id)) . "\">" . "<img src=\"{$CFG->pixpath}/i/info.gif\" alt=\"{$strview}\" />" . "</a>";
}
if (question_has_capability_on($question, 'edit', $question->cid)) {
$html .= "<a title=\"{$strdelete}\" href=\"" . $returnurl . "&delete={$question->id}\">" . "<img src=\"{$CFG->pixpath}/t/delete.gif\" alt=\"{$strdelete}\" /></a>";
}
return $html;
}
示例2: print_question
function print_question(&$question, &$state, $number, $cmoptions, $options)
{
global $CFG;
$isfinished = question_state_is_graded($state->last_graded) || $state->event == QUESTION_EVENTCLOSE;
if (!empty($cmoptions->id)) {
$cm = get_coursemodule_from_instance('quiz', $cmoptions->id);
$cmorcourseid = '&cmid=' . $cm->id;
} else {
if (!empty($cmoptions->course)) {
$cmorcourseid = '&courseid=' . $cmoptions->course;
} else {
error('Need to provide courseid or cmid to print_question.');
}
}
// For editing teachers print a link to an editing popup window
$editlink = '';
if (question_has_capability_on($question, 'edit')) {
$stredit = get_string('edit');
$linktext = '<img src="' . $CFG->pixpath . '/t/edit.gif" alt="' . $stredit . '" />';
$editlink = link_to_popup_window('/question/question.php?id=' . $question->id . $cmorcourseid, $stredit, $linktext, 450, 550, $stredit, '', true);
}
$questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions);
$image = get_question_image($question);
$generalfeedback = '';
if ($isfinished && $options->generalfeedback) {
$generalfeedback = $this->format_text($question->generalfeedback, $question->questiontextformat, $cmoptions);
}
include "{$CFG->dirroot}/question/type/description/question.html";
}
示例3: block_exabis_eportfolio_print_extern_item
function block_exabis_eportfolio_print_extern_item($item, $access)
{
global $CFG;
print_heading(format_string($item->name));
$box_content = '';
if ($item->type == 'link') {
$link = clean_param($item->url, PARAM_URL);
$link_js = str_replace('http://', '', $link);
if ($link) {
$box_content .= '<p><a href="#" onclick="window.open(\'http://' . addslashes_js($link_js) . '\',\'validate\',\'width=620,height=450,scrollbars=yes,status=yes,resizable=yes,menubar=yes,location=yes\');return true;">' . $link . '</a></p>';
}
} elseif ($item->type == 'file') {
if ($item->attachment) {
$type = mimeinfo("type", $item->attachment);
$ffurl = "{$CFG->wwwroot}/blocks/exabis_eportfolio/portfoliofile.php?access=" . $access . "&itemid=" . $item->id;
if (in_array($type, array('image/gif', 'image/jpeg', 'image/png'))) {
// Image attachments don't get printed as links
$box_content .= "<img width=\"100%\" src=\"{$ffurl}\" alt=\"" . format_string($item->name) . "\" /><br/>";
} else {
$box_content .= "<p>" . link_to_popup_window("{$ffurl}", 'popup', "{$ffurl}", $height = 400, $width = 500, format_string($item->name), 'none', true) . "</p>";
}
}
}
$box_content .= format_text($item->intro, FORMAT_HTML);
print_box($box_content);
}
示例4: print_question
function print_question(&$question, &$state, $number, $cmoptions, $options)
{
global $CFG;
$isfinished = question_state_is_graded($state->last_graded) || $state->event == QUESTION_EVENTCLOSE;
// For editing teachers print a link to an editing popup window
$editlink = '';
if (has_capability('moodle/question:manage', get_context_instance(CONTEXT_COURSE, $cmoptions->course))) {
$stredit = get_string('edit');
$linktext = '<img src="' . $CFG->pixpath . '/t/edit.gif" alt="' . $stredit . '" />';
$editlink = link_to_popup_window('/question/question.php?id=' . $question->id, $stredit, $linktext, 450, 550, $stredit, '', true);
}
$questiontext = $this->format_text($question->questiontext, $question->questiontextformat, $cmoptions);
$image = get_question_image($question, $cmoptions->course);
$generalfeedback = '';
if ($isfinished && $options->generalfeedback) {
$generalfeedback = $this->format_text($question->generalfeedback, $question->questiontextformat, $cmoptions);
}
include "{$CFG->dirroot}/question/type/description/question.html";
}
示例5: display
//.........这里部分代码省略.........
$table->column_class('rpercent', 'numcol');
$table->column_class('facility', 'numcol');
$table->column_class('qsd', 'numcol');
$table->column_class('disc_index', 'numcol');
$table->column_class('disc_coeff', 'numcol');
$table->column_suppress('id');
$table->column_suppress('qname');
$table->column_suppress('facility');
$table->column_suppress('qsd');
$table->column_suppress('disc_index');
$table->column_suppress('disc_coeff');
$table->set_attribute('cellspacing', '0');
$table->set_attribute('id', 'itemanalysis');
$table->set_attribute('class', 'generaltable generalbox');
// Start working -- this is necessary as soon as the niceties are over
$table->setup();
$tablesort = $table->get_sql_sort();
$sorts = explode(",", trim($tablesort));
if ($tablesort and is_array($sorts)) {
$sortindex = array();
$sortorder = array();
foreach ($sorts as $sort) {
$data = explode(" ", trim($sort));
$sortindex[] = trim($data[0]);
$s = trim($data[1]);
if ($s == "ASC") {
$sortorder[] = SORT_ASC;
} else {
$sortorder[] = SORT_DESC;
}
}
if (count($sortindex) > 0) {
$sortindex[] = "id";
$sortorder[] = SORT_ASC;
foreach ($questions as $qid => $row) {
$index1[$qid] = $row[$sortindex[0]];
$index2[$qid] = $row[$sortindex[1]];
}
array_multisort($index1, $sortorder[0], $index2, $sortorder[1], $questions);
}
}
$format_options = new stdClass();
$format_options->para = false;
$format_options->noclean = true;
$format_options->newlines = false;
// Now it is time to page the data, simply slice the keys in the array
if (!isset($pagesize) || (int) $pagesize < 1) {
$pagesize = 10;
}
$table->pagesize($pagesize, count($questions));
$start = $table->get_page_start();
$pagequestions = array_slice(array_keys($questions), $start, $pagesize);
foreach ($pagequestions as $qnum) {
$q = $questions[$qnum];
$qid = $q['id'];
$question = get_record('question', 'id', $qid);
if (has_capability('moodle/question:manage', get_context_instance(CONTEXT_COURSE, $course->id))) {
$qnumber = " (" . link_to_popup_window('/question/question.php?id=' . $qid, '&cmid=' . $cm->id . 'editquestion', $qid, 450, 550, get_string('edit'), 'none', true) . ") ";
} else {
$qnumber = $qid;
}
$qname = '<div class="qname">' . format_text($question->name . " : ", $question->questiontextformat, $format_options, $quiz->course) . '</div>';
$qicon = print_question_icon($question, true);
$qreview = quiz_question_preview_button($quiz, $question);
$qtext = format_text($question->questiontext, $question->questiontextformat, $format_options, $quiz->course);
$qquestion = $qname . "\n" . $qtext . "\n";
$responses = array();
foreach ($q['responses'] as $aid => $resp) {
$response = new stdClass();
if ($q['credits'][$aid] <= 0) {
$qclass = 'uncorrect';
} elseif ($q['credits'][$aid] == 1) {
$qclass = 'correct';
} else {
$qclass = 'partialcorrect';
}
$response->credit = '<span class="' . $qclass . '">(' . format_float($q['credits'][$aid], 2) . ') </span>';
$response->text = '<span class="' . $qclass . '">' . format_text($resp, FORMAT_MOODLE, $format_options, $quiz->course) . ' </span>';
$count = $q['rcounts'][$aid] . '/' . $q['count'];
$response->rcount = $count;
$response->rpercent = '(' . format_float($q['rcounts'][$aid] / $q['count'] * 100, 0) . '%)';
$responses[] = $response;
}
$facility = format_float($q['facility'] * 100, 0) . "%";
$qsd = format_float($q['qsd'], 3);
$di = format_float($q['disc_index'], 2);
$dc = format_float($q['disc_coeff'], 2);
$response = array_shift($responses);
$table->add_data(array($qnumber . "\n<br />" . $qicon . "\n " . $qreview, $qquestion, $response->text, $response->credit, $response->rcount, $response->rpercent, $facility, $qsd, $di, $dc));
foreach ($responses as $response) {
$table->add_data(array('', '', $response->text, $response->credit, $response->rcount, $response->rpercent, '', '', '', ''));
}
}
print_heading_with_help(get_string("analysistitle", "quiz_analysis"), "itemanalysis", "quiz");
echo '<div id="tablecontainer">';
$table->print_html();
echo '</div>';
$this->print_options_form($quiz, $cm, $attemptselection, $lowmarklimit, $pagesize);
return true;
}
示例6: wiki_export_html
function wiki_export_html(&$WS)
{
global $CFG;
check_dir_exists("{$CFG->dataroot}/temp", true);
check_dir_exists("{$CFG->dataroot}/temp/html", true);
check_dir_exists("{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}", true);
check_dir_exists("{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}/atachments", true);
check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}", true);
check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}/moddata", true);
check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}/moddata/dfwiki{$WS->cm->id}", true);
//export contents
wiki_export_html_content($WS);
//export attached files
$flist = list_directories_and_files("{$CFG->dataroot}/{$WS->dfwiki->course}/moddata/dfwiki{$WS->cm->id}");
if ($flist != null) {
foreach ($flist as $fil) {
$from_file = "{$CFG->dataroot}/{$WS->dfwiki->course}/moddata/dfwiki{$WS->cm->id}/{$fil}";
$to_file = "{$CFG->dataroot}/temp/html/dfwiki{$WS->cm->id}/atachments/{$fil}";
copy($from_file, $to_file);
}
}
//zip file name
$times = time();
$name = $WS->dfwiki->name . '-' . $times . '.zip';
$cleanzipname = clean_filename($name);
//List of files and directories
$filelist = list_directories_and_files("{$CFG->dataroot}/temp/html");
//Convert them to full paths
$files = array();
if ($filelist != null) {
foreach ($filelist as $file) {
$files[] = "{$CFG->dataroot}/temp/html/{$file}";
}
}
check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}", true);
check_dir_exists("{$CFG->dataroot}/{$WS->dfwiki->course}/exportedhtml", true);
$destination = "{$CFG->dataroot}/{$WS->dfwiki->course}/exportedhtml/{$cleanzipname}";
$status = zip_files($files, $destination);
//delete the folder created in temp
$filelist2 = list_directories_and_files("{$CFG->dataroot}/temp/html");
if ($filelist2 != null) {
$del = delete_dir_contents("{$CFG->dataroot}/temp/html");
}
//show it all to be albe to download the file
$prop = null;
$prop->class = "textcenter";
wiki_div_start($prop);
wiki_size_text(get_string("exporthtmlcorrectly", "wiki"), 2);
wiki_div_end();
$prop = null;
$prop->border = "0";
$prop->class = "boxaligncenter";
$prop->classtd = "nwikileftnow";
wiki_table_start($prop);
$wdir = '/exportedhtml';
$fileurl = "{$wdir}/{$cleanzipname}";
$ffurl = "/file.php?file=/{$WS->cm->course}{$fileurl}";
$icon = mimeinfo("icon", $cleanzipname);
link_to_popup_window($ffurl, "display", "<img src=\"{$CFG->pixpath}/f/{$icon}\" height=\"16\" width=\"16\" alt=\"File\" />", 480, 640);
echo "\n" . ' ';
link_to_popup_window($ffurl, "display", htmlspecialchars($cleanzipname), 480, 640);
$prop = null;
$prop->class = "nwikileftnow";
wiki_change_row($prop);
echo ' ';
wiki_table_end();
$prop = null;
$prop->border = "0";
$prop->class = "boxaligncenter";
$prop->classtd = "nwikileftnow";
wiki_table_start($prop);
$prop = null;
$prop->id = "form";
$prop->method = "post";
$prop->action = '../xml/index.php?id=' . $WS->dfwiki->course . '&wdir=/exportedhtml';
wiki_form_start($prop);
wiki_div_start();
$prop = null;
$prop->name = "dfform[viewexported]";
$prop->value = get_string('viewexported', 'wiki');
wiki_input_submit($prop);
wiki_div_end();
wiki_form_end();
wiki_change_column();
print_continue("{$CFG->wwwroot}/mod/wiki/view.php?id={$WS->cm->id}");
wiki_table_end();
}
示例7: displaydir
function displaydir($wdir)
{
// $wdir == / or /a or /a/b/c/d etc
global $basedir;
global $usecheckboxes;
global $id;
global $USER, $CFG;
$fullpath = $basedir . $wdir;
$directory = opendir($fullpath);
// Find all files
while (false !== ($file = readdir($directory))) {
if ($file == "." || $file == "..") {
continue;
}
if (is_dir($fullpath . "/" . $file)) {
$dirlist[] = $file;
} else {
$filelist[] = $file;
}
}
closedir($directory);
$strfile = get_string("file");
$strname = get_string("name");
$strsize = get_string("size");
$strmodified = get_string("modified");
$straction = get_string("action");
$strmakeafolder = get_string("makeafolder");
$struploadafile = get_string("uploadafile");
$strwithchosenfiles = get_string("withchosenfiles");
$strmovetoanotherfolder = get_string("movetoanotherfolder");
$strmovefilestohere = get_string("movefilestohere");
$strdeletecompletely = get_string("deletecompletely");
$strcreateziparchive = get_string("createziparchive");
$strrename = get_string("rename");
$stredit = get_string("edit");
$strunzip = get_string("unzip");
$strlist = get_string("list");
$strchoose = get_string("choose");
echo "<form action=\"coursefiles.php\" method=\"post\" name=\"dirform\">\n";
echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\" width=\"100%\">\n";
if ($wdir == "/") {
$wdir = "";
} else {
$bdir = str_replace("/" . basename($wdir), "", $wdir);
if ($bdir == "/") {
$bdir = "";
}
print "<tr>\n<td colspan=\"5\">";
print "<a href=\"coursefiles.php?id={$id}&wdir={$bdir}&usecheckboxes={$usecheckboxes}\" onclick=\"return reset_value();\">";
print "<img src=\"{$CFG->wwwroot}/lib/editor/htmlarea/images/folderup.gif\" height=\"14\" width=\"24\" border=\"0\" alt=\"" . get_string('parentfolder') . "\" />";
print "</a></td>\n</tr>\n";
}
$count = 0;
if (!empty($dirlist)) {
asort($dirlist);
foreach ($dirlist as $dir) {
$count++;
$filename = $fullpath . "/" . $dir;
$fileurl = $wdir . "/" . $dir;
$filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p");
echo "<tr>";
if ($usecheckboxes) {
print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" onclick=\"return set_rename('{$dir}');\" />");
}
print_cell("left", "<a href=\"coursefiles.php?id={$id}&wdir={$fileurl}\" onclick=\"return reset_value();\"><img src=\"{$CFG->pixpath}/f/folder.gif\" class=\"icon\" alt=\"" . get_string('folder') . "\" /></a> <a href=\"coursefiles.php?id={$id}&wdir={$fileurl}&usecheckboxes={$usecheckboxes}\" onclick=\"return reset_value();\">" . htmlspecialchars($dir) . "</a>");
print_cell("right", " ");
print_cell("right", $filedate);
echo "</tr>";
}
}
if (!empty($filelist)) {
asort($filelist);
foreach ($filelist as $file) {
$icon = mimeinfo("icon", $file);
$imgtype = mimeinfo("type", $file);
$count++;
$filename = $fullpath . "/" . $file;
$fileurl = "{$wdir}/{$file}";
$filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p");
$dimensions = get_image_size($filename);
if ($dimensions) {
$imgwidth = $dimensions[0];
$imgheight = $dimensions[1];
} else {
$imgwidth = "Unknown";
$imgheight = "Unknown";
}
unset($dimensions);
echo "<tr>\n";
if ($usecheckboxes) {
print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" onclick=\";return set_rename('{$file}');\" />");
}
echo "<td align=\"left\" nowrap=\"nowrap\">";
$ffurl = get_file_url($id . $fileurl);
link_to_popup_window($ffurl, "display", "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfile}\" />", 480, 640);
$file_size = filesize($filename);
echo "<a onclick=\"return set_value(info = {url: '" . $ffurl . "',";
echo " isize: '" . $file_size . "', itype: '" . $imgtype . "', iwidth: '" . $imgwidth . "',";
echo " iheight: '" . $imgheight . "', imodified: '" . $filedate . "' })\" href=\"#\">{$file}</a>";
echo "</td>\n";
//.........这里部分代码省略.........
示例8: print_user_files
/**
* Produces a list of links to the files uploaded by a user
*
* @param $userid int optional id of the user. If 0 then $USER->id is used.
* @param $return boolean optional defaults to false. If true the list is returned rather than printed
* @return string optional
*/
function print_user_files($userid = 0, $return = false)
{
global $CFG, $USER;
if (!$userid) {
if (!isloggedin()) {
return '';
}
$userid = $USER->id;
}
$filearea = $this->file_area_name($userid);
$output = '';
if ($basedir = $this->file_area($userid)) {
if ($files = get_directory_list($basedir)) {
require_once $CFG->libdir . '/filelib.php';
foreach ($files as $key => $file) {
$icon = mimeinfo('icon', $file);
$ffurl = get_file_url("{$filearea}/{$file}", array('forcedownload' => 1));
// Syntax Highlighert source code
$viewlink = link_to_popup_window('/mod/assignment/type/onlinejudge/source.php?id=' . $this->cm->id . '&userid=' . $userid . '&file=' . $file, $file . 'sourcecode', get_string('preview'), 500, 740, $file, 'none', true, 'button' . $userid);
$output .= '<img src="' . $CFG->pixpath . '/f/' . $icon . '" class="icon" alt="' . $icon . '" />' . '<a href="' . $ffurl . '" >' . $file . '</a> (' . $viewlink . ')<br />';
}
}
}
$output = '<div class="files">' . $output . '</div>';
if ($return) {
return $output;
}
echo $output;
}
示例9: fullclone
$original_theme = fullclone($THEME);
foreach ($themes as $theme) {
unset($THEME);
if (!file_exists($CFG->themedir . '/' . $theme . '/config.php')) {
// bad folder
continue;
}
include $CFG->themedir . '/' . $theme . '/config.php';
$readme = '';
$screenshot = '';
$screenshotpath = '';
if (file_exists("{$theme}/README.html")) {
$readme = "\t\t\t\t<li>" . link_to_popup_window($CFG->themewww . '/' . $theme . '/README.html', $theme, $strinfo, 400, 500, '', 'none', true) . "</li>\n";
} else {
if (file_exists("{$theme}/README.txt")) {
$readme = "\t\t\t\t<li>" . link_to_popup_window($CFG->themewww . '/' . $theme . '/README.txt', $theme, $strinfo, 400, 500, '', 'none', true) . "</li>\n";
}
}
if (file_exists("{$theme}/screenshot.png")) {
$screenshotpath = "{$theme}/screenshot.png";
} else {
if (file_exists("{$theme}/screenshot.jpg")) {
$screenshotpath = "{$theme}/screenshot.jpg";
}
}
echo "\t<tr>\n";
// no point showing this if user is using screen reader
if (!$USER->screenreader) {
echo "\t\t<td align=\"center\">\n";
if ($screenshotpath) {
$screenshot = "\t\t\t\t<li><a href=\"{$theme}/screenshot.jpg\">{$strscreenshot}</a></li>\n";
示例10: link_to_popup_window
$abletomovecourses = true;
}
echo '</td>';
echo '<td align="center">';
echo '<input type="checkbox" name="c' . $acourse->id . '" />';
echo '</td>';
} else {
echo '<td align="right">';
if (!empty($acourse->guest)) {
echo '<a href="view.php?id=' . $acourse->id . '"><img title="' . $strallowguests . '" class="icon" src="' . $CFG->pixpath . '/i/user.gif" alt="' . $strallowguests . '" /></a>';
}
if (!empty($acourse->password)) {
echo '<a href="view.php?id=' . $acourse->id . '"><img title="' . $strrequireskey . '" class="icon" src="' . $CFG->pixpath . '/i/key.gif" alt="' . $strrequireskey . '" /></a>';
}
if (!empty($acourse->summary)) {
link_to_popup_window("/course/info.php?id={$acourse->id}", "courseinfo", '<img alt="' . get_string('info') . '" class="icon" src="' . $CFG->pixpath . '/i/info.gif" />', 400, 500, $strsummary);
}
echo "</td>";
}
echo "</tr>";
}
if ($abletomovecourses) {
echo '<tr><td colspan="3" align="right">';
echo '<br />';
unset($displaylist[$category->id]);
// loop and unset categories the user can't move into
foreach ($displaylist as $did => $dlist) {
if (!has_capability('moodle/category:update', get_context_instance(CONTEXT_COURSECAT, $did))) {
unset($displaylist[$did]);
}
}
示例11: admin_get_root
<?php
// $Id: index.php,v 1.4 2007/01/15 07:59:59 vyshane Exp $
require_once '../../../config.php';
require_once $CFG->dirroot . '/course/lib.php';
require_once $CFG->dirroot . '/course/report/log/lib.php';
require_once $CFG->libdir . '/adminlib.php';
$adminroot = admin_get_root();
admin_externalpage_setup('reportlog', $adminroot);
admin_externalpage_print_header($adminroot);
$course = get_site();
print_heading(get_string('chooselogs') . ':');
print_mnet_log_selector_form($CFG->mnet_localhost_id, $course);
echo '<br />';
print_heading(get_string('chooselivelogs') . ':');
$heading = link_to_popup_window('/course/report/log/live.php?id=' . $course->id, 'livelog', get_string('livelogs'), 500, 800, '', 'none', true);
print_heading($heading, 'center', 3);
admin_externalpage_print_footer($adminroot);
示例12: display
function display()
{
global $CFG;
/// Set up generic stuff first, including checking for access
parent::display();
/// Set up some shorthand variables
$cm = $this->cm;
$course = $this->course;
$resource = $this->resource;
require_once $CFG->libdir . '/filelib.php';
$subdir = optional_param('subdir', '', PARAM_PATH);
$resource->reference = clean_param($resource->reference, PARAM_PATH);
$formatoptions = new object();
$formatoptions->noclean = true;
$formatoptions->para = false;
// MDL-12061, <p> in html editor breaks xhtml strict
add_to_log($course->id, "resource", "view", "view.php?id={$cm->id}", $resource->id, $cm->id);
if ($resource->reference) {
$relativepath = "{$course->id}/{$resource->reference}";
} else {
$relativepath = "{$course->id}";
}
if ($subdir) {
$relativepath = "{$relativepath}{$subdir}";
if (stripos($relativepath, 'backupdata') !== FALSE or stripos($relativepath, $CFG->moddata) !== FALSE) {
error("Access not allowed!");
}
$subs = explode('/', $subdir);
array_shift($subs);
$countsubs = count($subs);
$count = 0;
$backsub = '';
foreach ($subs as $sub) {
$count++;
if ($count < $countsubs) {
$backsub .= "/{$sub}";
$this->navlinks[] = array('name' => $sub, 'link' => "view.php?id={$cm->id}", 'type' => 'title');
} else {
$this->navlinks[] = array('name' => $sub, 'link' => '', 'type' => 'title');
}
}
}
$pagetitle = strip_tags($course->shortname . ': ' . format_string($resource->name));
$update = update_module_button($cm->id, $course->id, $this->strresource);
if (has_capability('moodle/course:managefiles', get_context_instance(CONTEXT_COURSE, $course->id))) {
$options = array('id' => $course->id, 'wdir' => '/' . $resource->reference . $subdir);
$editfiles = print_single_button("{$CFG->wwwroot}/files/index.php", $options, get_string("editfiles"), 'get', '', true);
$update = $editfiles . $update;
}
$navigation = build_navigation($this->navlinks, $cm);
print_header($pagetitle, $course->fullname, $navigation, "", "", true, $update, navmenu($course, $cm));
if (trim(strip_tags($resource->summary))) {
print_simple_box(format_text($resource->summary, FORMAT_MOODLE, $formatoptions, $course->id), "center");
print_spacer(10, 10);
}
$files = get_directory_list("{$CFG->dataroot}/{$relativepath}", array($CFG->moddata, 'backupdata'), false, true, true);
if (!$files) {
print_heading(get_string("nofilesyet"));
print_footer($course);
exit;
}
print_simple_box_start("center", "", "", '0');
$strftime = get_string('strftimedatetime');
$strname = get_string("name");
$strsize = get_string("size");
$strmodified = get_string("modified");
$strfolder = get_string("folder");
$strfile = get_string("file");
echo '<table cellpadding="4" cellspacing="1" class="files" summary="">';
echo "<tr><th class=\"header name\" scope=\"col\">{$strname}</th>" . "<th align=\"right\" colspan=\"2\" class=\"header size\" scope=\"col\">{$strsize}</th>" . "<th align=\"right\" class=\"header date\" scope=\"col\">{$strmodified}</th>" . "</tr>";
foreach ($files as $file) {
if (is_dir("{$CFG->dataroot}/{$relativepath}/{$file}")) {
// Must be a directory
$icon = "folder.gif";
$relativeurl = "/view.php?blah";
$filesize = display_size(get_directory_size("{$CFG->dataroot}/{$relativepath}/{$file}"));
} else {
$icon = mimeinfo("icon", $file);
$relativeurl = get_file_url("{$relativepath}/{$file}");
$filesize = display_size(filesize("{$CFG->dataroot}/{$relativepath}/{$file}"));
}
if ($icon == 'folder.gif') {
echo '<tr class="folder">';
echo '<td class="name">';
echo "<a href=\"view.php?id={$cm->id}&subdir={$subdir}/{$file}\">";
echo "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfolder}\" /> {$file}</a>";
} else {
echo '<tr class="file">';
echo '<td class="name">';
link_to_popup_window($relativeurl, "resourcedirectory{$resource->id}", "<img src=\"{$CFG->pixpath}/f/{$icon}\" class=\"icon\" alt=\"{$strfile}\" /> {$file}", 450, 600, '');
}
echo '</td>';
echo '<td> </td>';
echo '<td align="right" class="size">';
echo $filesize;
echo '</td>';
echo '<td align="right" class="date">';
echo userdate(filemtime("{$CFG->dataroot}/{$relativepath}/{$file}"), $strftime);
echo '</td>';
echo '</tr>';
//.........这里部分代码省略.........
示例13: print_box_start
print_box_start('generalbox', 'enterlink');
// users with screenreader set, will only see 1 link, to the manual refresh page
// for better accessibility
if (!empty($USER->screenreader)) {
$chattarget = "/mod/chat/gui_basic/index.php?id={$chat->id}{$groupparam}";
} else {
$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();
示例14: make_review_link
/** Make some text into a link to review the game, if that is appropriate. */
function make_review_link($linktext, $game, $attempt)
{
// If not even responses are to be shown in review then we don't allow any review
if (!($game->review & GAME_REVIEW_RESPONSES)) {
return $linktext;
}
// If the game is still open, are reviews allowed?
if ((!$game->timeclose or time() < $game->timeclose) and !($game->review & GAME_REVIEW_OPEN)) {
// If not, don't link.
return $linktext;
}
// If the game is closed, are reviews allowed?
if ($game->timeclose and time() > $game->timeclose and !($game->review & GAME_REVIEW_CLOSED)) {
// If not, don't link.
return $linktext;
}
// If the attempt is still open, don't link.
if (!$attempt->timefinish) {
return $linktext;
}
$url = "review.php?q={$game->id}&attempt={$attempt->id}";
if ($game->popup) {
$windowoptions = "left=0, top=0, channelmode=yes, fullscreen=yes, scrollbars=yes, resizeable=no, directories=no, toolbar=no, titlebar=no, location=no, status=no, menubar=no";
return link_to_popup_window('/mod/game/' . $url, 'gamepopup', $linktext, '+window.screen.height+', '+window.screen.width+', '', $windowoptions, true);
} else {
return "<a href='{$url}'>{$linktext}</a>";
}
}
示例15: displaydir
//.........这里部分代码省略.........
} else {
$bdir = str_replace("/" . basename($wdir), "", $wdir);
if ($bdir == "/") {
$bdir = "";
}
print "<tr>\n<td colspan=\"5\">";
print "<a href=\"imagebank.php?id={$id}&wdir={$bdir}&usecheckboxes={$usecheckboxes}\" onclick=\"return reset_value();\">";
print "<img src=\"{$CFG->wwwroot}/lib/editor/images/folderup.gif\" height=\"14\" width=\"24\" border=\"0\" alt=\"Move up\" />";
print "</a></td>\n</tr>\n";
}
$count = 0;
if (!empty($dirlist)) {
asort($dirlist);
foreach ($dirlist as $dir) {
$count++;
$filename = $fullpath . "/" . $dir;
$fileurl = rawurlencode($wdir . "/" . $dir);
$filesafe = rawurlencode($dir);
$filedate = userdate(filemtime($filename), "%d %b %Y, %I:%M %p");
echo "<tr>";
if ($usecheckboxes && $isteacher) {
print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$fileurl}\" onclick=\"return set_rename('{$filesafe}');\" />");
} else {
print_cell("left");
}
print_cell("left", "<a href=\"imagebank.php?id={$id}&wdir={$fileurl}\" onclick=\"return reset_value();\"><img src=\"{$CFG->pixpath}/f/folder.gif\" height=\"16\" width=\"16\" border=\"0\" alt=\"folder\" /></a> <a href=\"imagebank.php?id={$id}&wdir={$fileurl}&usecheckboxes={$usecheckboxes}\" onclick=\"return reset_value();\">" . htmlspecialchars($dir) . "</a>");
print_cell("right", " ");
print_cell("right", $filedate);
echo "</tr>";
}
}
if (!empty($filelist)) {
foreach ($filelist as $file) {
$icon = mimeinfo("icon", $file['name']);
$imgtype = $file['mime'];
$count++;
//$filename = $fullpath."/".$file['name'];
$fileurl = "/mod/netpublish/image.php?id={$file['id']}";
$filesafe = rawurlencode($file['name']);
$fileurlsafe = rawurlencode($fileurl);
$filedate = $file['filedate'];
$imgwidth = $file['width'];
$imgheight = $file['height'];
echo "<tr>\n";
if ($usecheckboxes) {
if (intval($file['owner']) == intval($USER->id) or $isteacher) {
print_cell("center", "<input type=\"checkbox\" name=\"file{$count}\" value=\"{$file['id']}\" onclick=\"return set_rename('{$file['id']}');\" />");
} else {
print_cell("left");
}
}
echo "<td align=\"left\" nowrap=\"nowrap\">";
if ($CFG->slasharguments) {
$ffurl = $fileurl;
} else {
$ffurl = $fileurl;
}
link_to_popup_window($ffurl, "display", "<img src=\"{$CFG->pixpath}/f/{$icon}\" height=\"16\" width=\"16\" border=\"0\" align=\"middle\" alt=\"{$strfile}\" />", 480, 640);
$file_size = $file['size'];
echo "<a onclick=\"return set_value(info = {url: '" . $CFG->wwwroot . $ffurl . "',";
echo " isize: '" . $file_size . "', itype: '" . $imgtype . "', iwidth: '" . $imgwidth . "',";
echo " iheight: '" . $imgheight . "', imodified: '" . $filedate . "', ialt: '" . $file['name'] . "' })\" href=\"#\">{$file['name']}</a>";
echo "</td>\n";
if ($icon == "zip.gif") {
$edittext = "<a href=\"imagebank.php?id={$id}&wdir={$wdir}&file={$fileurl}&action=unzip&sesskey={$USER->sesskey}\">{$strunzip}</a> ";
$edittext .= "<a href=\"imagebank.php?id={$id}&wdir={$wdir}&file={$fileurl}&action=listzip&sesskey={$USER->sesskey}\">{$strlist}</a> ";
} else {
$edittext = " ";
}
print_cell("right", "{$edittext} ");
print_cell("right", $filedate);
echo "</tr>\n";
}
}
echo "</table>\n";
if (empty($wdir)) {
$wdir = "/";
}
echo "<table border=\"0\" cellspacing=\"2\" cellpadding=\"2\">\n";
echo "<tr>\n<td>";
echo "<input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n";
echo "<input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />\n";
echo "<input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />\n";
$options = array("move" => "{$strmovetoanotherfolder}", "delete" => "{$strdeletecompletely}", "zip" => "{$strcreateziparchive}");
if (!empty($count)) {
choose_from_menu($options, "action", "", "{$strwithchosenfiles}...", "javascript:document.dirform.submit()");
}
if (!empty($USER->fileop) and $USER->fileop == "move" and $USER->filesource != $wdir) {
echo "<form action=\"imagebank.php\" method=\"get\">\n";
echo " <input type=\"hidden\" name=\"id\" value=\"{$id}\" />\n";
echo " <input type=\"hidden\" name=\"wdir\" value=\"{$wdir}\" />\n";
echo " <input type=\"hidden\" name=\"action\" value=\"paste\" />\n";
echo " <input type=\"hidden\" name=\"sesskey\" value=\"{$USER->sesskey}\" />\n";
echo " <input type=\"submit\" value=\"{$strmovefilestohere}\" />\n";
echo "</form>";
}
echo "</td></tr>\n";
echo "</table>\n";
echo "</form>\n";
}