本文整理汇总了PHP中isediting函数的典型用法代码示例。如果您正苦于以下问题:PHP isediting函数的具体用法?PHP isediting怎么用?PHP isediting使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了isediting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_content
function get_content()
{
global $CFG, $COURSE;
if ($this->content !== NULL) {
return $this->content;
}
if (empty($this->instance)) {
return '';
}
$this->content = new object();
$options = new object();
$options->noclean = true;
// Don't clean Javascripts etc
$this->content->text = format_text($COURSE->summary, FORMAT_HTML, $options);
if (isediting($COURSE->id)) {
// ?? courseid param not there??
if ($COURSE->id == SITEID) {
$editpage = $CFG->wwwroot . '/' . $CFG->admin . '/settings.php?section=frontpagesettings';
} else {
$editpage = $CFG->wwwroot . '/course/edit.php?id=' . $COURSE->id;
}
$this->content->text .= "<div class=\"editbutton\"><a href=\"{$editpage}\"><img src=\"{$CFG->pixpath}/t/edit.gif\" alt=\"" . get_string('edit') . "\" /></a></div>";
}
$this->content->footer = '';
return $this->content;
}
示例2: get_content
function get_content()
{
global $CFG, $USER, $COURSE;
$this->content = new stdClass();
$this->content->footer = "";
if (isediting($COURSE)) {
if ($COURSE->format == 'weeks' || $COURSE->format == 'topics') {
$this->add_load_event_declared = false;
$this->content->text = $this->addLoadEvent('massaction_addcheckboxes()', true) . $this->addLoadEvent('disable_js_warning()', true) . generate_form($this->instance->id);
} else {
$this->content->text = get_string('unsupported', 'block_massaction', $COURSE->format);
}
} else {
$this->content = '';
}
return $this->content;
}
示例3: filter_get_results
/**
* provides constraint values from filters
*
*/
function filter_get_results($fielddef, $fieldname, $specialvalue = '', $forcereload = false, &$printoutbuffer = null)
{
static $FILTERSETS;
global $CFG, $DB, $PAGE;
$tracing = 0;
// computes filter query
if (empty($this->filterfields->queries[$fielddef])) {
// if not explicit query, make an implicit one
$sql = preg_replace('/<%%FILTERS%%>|<%%PARAMS%%>/', '', $this->sql);
if ($this->allow_filter_desaggregate($fielddef)) {
// try desagregate
$sql = preg_replace('/MAX\\(([^\\(]+)\\)/si', '$1', $sql);
$sql = preg_replace('/SUM\\((.*?)\\) AS/si', '$1 AS', $sql);
$sql = preg_replace('/COUNT\\((?:DISTINCT)?([^\\(]+)\\)/si', '$1', $sql);
// purge from unwanted clauses
if (preg_match('/\\bGROUP BY\\b/si', $sql)) {
$sql = preg_replace('/GROUP BY.*(?!GROUP BY).*$/si', '', $sql);
}
if (preg_match('/\\bORDER BY\\b/si', $sql)) {
$sql = preg_replace('/ORDER BY.*?$/si', '', $sql);
}
}
$filtersql = 'SELECT DISTINCT ' . $fieldname . ' FROM ( ' . $sql . ' ) as subreq ';
$filtersql .= " ORDER BY {$fieldname} ";
} else {
// explicit query, manager will have to ensure consistency of output values to filter requirement
$filtersql = $this->filterfields->queries[$fielddef];
}
$filtersql = $this->protect($filtersql);
// filter values return from cache
if (isset($FILTERSETS) && array_key_exists($fielddef, $FILTERSETS) && empty($specialvalue)) {
if (!empty($this->config->showfilterqueries)) {
if (!is_null($printoutbuffer)) {
$printoutbuffer .= "<div class=\"dashboard-filter-query\" style=\"padding:1px;border:1px solid #808080;margin:2px;font-size;0.75em;font-family:monospace\"><b>STATIC CACHED DATA FILTER :</b> {$filtersql}</div>";
}
}
return $FILTERSETS[$fielddef];
}
// check DB cache
$sqlkey = md5($filtersql);
if (@$this->config->showbenches) {
$bench = new StdClass();
$bench->name = 'Filter cache prefetch ' . $fielddef;
$bench->start = time();
}
$cachefootprint = $DB->get_record('block_dashboard_filter_cache', array('querykey' => $sqlkey, 'access' => $this->config->target));
if (@$this->config->showbenches) {
$bench->end = time();
$this->benches[] = $bench;
}
if ((!$PAGE->user_is_editing() || !@$CFG->block_dashboard_enable_isediting_security) && (!@$this->config->uselocalcaching || !$cachefootprint || $cachefootprint && $cachefootprint->timereloaded < time() - @$this->config->cachingttl * 60 || $forcereload)) {
$DB->delete_records('block_dashboard_filter_cache', array('querykey' => $sqlkey, 'access' => $this->config->target));
list($usec, $sec) = explode(' ', microtime());
$t1 = (double) $usec + (double) $sec;
if ($this->config->target == 'moodle') {
if (@$this->config->showbenches) {
$bench = new StdClass();
$bench->name = 'Filter pre-query ' . $fielddef;
$bench->start = time();
}
$FILTERSET[$fielddef] = $DB->get_records_sql($filtersql);
if (@$this->config->showbenches) {
$bench->end = time();
$this->benches[] = $bench;
}
} else {
if (!isediting() || !@$CFG->block_dashboard_enable_isediting_security) {
$FILTERSET[$fielddef] = extra_db_query($filtersql, false, true, $error);
if ($error) {
$this->content->text .= $error;
}
} else {
$FILTERSET[$fielddef] = array();
}
}
list($usec, $sec) = explode(' ', microtime());
$t2 = (double) $usec + (double) $sec;
// echo $t2 - $t1; // benching
// make a footprint
if (!empty($this->config->uselocalcaching)) {
$cacherec = new StdClass();
$cacherec->access = $this->config->target;
$cacherec->querykey = $sqlkey;
$cacherec->filterrecord = base64_encode(serialize($FILTERSET[$fielddef]));
$cacherec->timereloaded = time();
if ($tracing) {
mtrace('Inserting filter cache');
}
$DB->insert_record('block_dashboard_filter_cache', $cacherec);
}
if (!empty($this->config->showfilterqueries)) {
if (!is_null($printoutbuffer)) {
$printoutbuffer .= "<div class=\"dashboard-filter-query\" style=\"padding:1px;border:1px solid #808080;margin:2px;font-size;0.75em;font-family:monospace\"><b>FILTER :</b> {$filtersql}</div>";
}
}
} else {
//.........这里部分代码省略.........
示例4: wikipediacalls_filter
function wikipediacalls_filter($courseid, $text)
{
global $USER;
global $CFG;
global $wikiBlockCount;
if ($CFG->release < '1.6') {
$CFG->filter_wikipediacalls_showkeys = 1;
}
// Filters special tags inserts
// get word before [WP] marker
// replace word and marker by wikipedia link (language aware)
$lang = substr(@$USER->lang, 0, 2);
if ($lang == '') {
$lang = "fr";
}
// this collects all wikipedia keys for reporting
if (isediting($courseid, 0) && $CFG->filter_wikipediacalls_showkeys) {
$CFG->currenttextiscacheable = true;
$WPKeys = array();
preg_match_all("/([^ \\.\\'`\"\\(\\)\\[\\]<>;:]+)\\[WP\\]/", $text, $matches, PREG_PATTERN_ORDER);
foreach ($matches[1] as $aMatch) {
$WPKeys[urlencode($aMatch)] = "http://{$lang}.wikipedia.org/wiki/" . urlencode($aMatch);
}
preg_match_all("/([^ \\.\\'`\"\\(\\)\\[\\]<>;:]+)\\[WP\\|([^|]*?)\\|([^\\]]*?)\\]/", $text, $matches, PREG_PATTERN_ORDER);
for ($i = 0; $i < count($matches[2]); $i++) {
$WPKeys[urlencode($matches[2][$i])] = "http://{$matches[3][$i]}.wikipedia.org/wiki/" . urlencode($matches[2][$i]);
$i++;
}
preg_match_all("/([^ \\.\\'`\"\\(\\)\\[\\]<>;:]+)\\[WP\\|([^|]*?)\\]/", $text, $matches, PREG_PATTERN_ORDER);
foreach ($matches[2] as $aMatch) {
$WPKeys[urlencode($aMatch)] = "http://{$lang}.wikipedia.org/wiki/" . str_replace("+", "_", urlencode($aMatch));
}
}
// this inserts any wikipedia calls
$text = preg_replace("/([^ \\.\\'`\"\\(\\)<>;:\\[\\]]+)\\[WP\\]/", "<a href=\"http://{$lang}.wikipedia.org/wiki/\\1\" target=\"_blank\">\\1</a>", $text);
$text = preg_replace("/([^ \\.\\'`\"\\(\\)<>;:\\[\\]]+)\\[WP\\|([^|\\]]+)\\|([^|\\]]+)\\]/", "<a href=\"http://\\3.wikipedia.org/wiki/\\2\" target=\"_blank\">\\1</a>", $text);
$text = preg_replace("/([^ \\.\\'`\"\\(\\)<>;:\\[\\]]+)\\[WP\\|([^\\]]+)\\]/", "<a href=\"http://{$lang}.wikipedia.org/wiki/\\2\" target=\"_blank\">\\1</a>", $text);
$text = preg_replace("/\\[WP\\]/", '', $text);
// this prepare wikipedia reports and testing invocator
if (isediting($courseid, 0) && $CFG->filter_wikipediacalls_showkeys) {
if (count($WPKeys)) {
$text = $text . "<br>" . get_string('wikipediakeys', 'wikipediacalls') . " : <br>" . implode('<br>', $WPKeys);
// pass all keys and call data to session for checking
if (!isset($wikiBlockCount)) {
$wikiBlockCount = 0;
}
$_SESSION['wikipediaKeys'][$wikiBlockCount] = $WPKeys;
// if link code is not loaded, load link code
// REM : no include can be used here as effective code production is delayed
if (!isset($CFG->testCallsLink)) {
$CFG->testCallsLink = mb_convert_encoding(implode('', file("{$CFG->dirroot}/filter/wikipediacalls/testWikipediaCallsLink.tpl")), "ASCII", "auto");
}
$testCallsLink = str_replace('<%%WWWROOT%%>', $CFG->wwwroot, $CFG->testCallsLink);
$testCallsLink = str_replace('<%%TESTLINKLABEL%%>', get_string('wikipediacallslinklabel', 'wikipediacalls'), $testCallsLink);
$testCallsLink = str_replace('<%%WIKIBLOCKID%%>', $wikiBlockCount, $testCallsLink);
$text = $text . $testCallsLink;
$wikiBlockCount++;
}
}
// special views for developper
if (isadmin()) {
// $CFG->currenttextiscacheable = false; // huge overhead in computing time
if (preg_match("/\\[MOODLE_CFG\\]/", $text)) {
print_r($CFG);
}
if (preg_match("/\\[MOODLE_USER\\]/", $text)) {
print_r($USER);
}
if (preg_match("/\\[MOODLE_SESSION\\]/", $text)) {
print_r($_SESSION);
}
}
return $text;
// Look for all these words in the text
}
示例5: print_error
if (!($coursecontext = get_context_instance(CONTEXT_COURSE, $course->id))) {
print_error('nocontext');
}
require_login($course);
// From /course/view.php - Facilitates the correct population of the setttings block.
//$PAGE->set_context($coursecontext);
//$PAGE->set_url('/course/format/topcoll/set_layout.php&id=', array('id' => $courseid)); // From /course/view.php
//$PAGE->set_pagelayout('course'); // From /course/view.php
//$PAGE->set_pagetype('course-view-topcoll'); // From /course/view.php
//$PAGE->set_other_editing_capability('moodle/course:manageactivities'); // From /course/view.php
//$PAGE->set_title(get_string('setlayout', 'format_topcoll') . ' - ' . $course->fullname . ' ' . get_string('course'));
//$PAGE->set_heading(get_string('setlayout', 'format_topcoll') . ' - ' . $course->fullname . ' ' . get_string('course'));
//require_sesskey();
require_capability('moodle/course:update', $coursecontext);
$courseurl = $CFG->wwwroot . '/course/view.php?id=' . $courseid;
if (isediting($courseid)) {
$mform = new set_layout_form(null, array('courseid' => $courseid, 'setelement' => $setelement, 'setstructure' => $setstructure));
if ($mform->is_cancelled()) {
redirect($courseurl);
} else {
if ($formdata = $mform->get_data()) {
put_layout($formdata->id, $formdata->set_element, $formdata->set_structure);
redirect($courseurl);
}
}
$PAGE = page_create_object(PAGE_COURSE_VIEW, $course->id);
$pageblocks = blocks_setup($PAGE, BLOCKS_PINNED_BOTH);
$PAGE->print_header(get_string('setlayout', 'format_topcoll') . ' - ' . $course->fullname . ' ' . get_string('course'), null, '', null);
// Layout from format.php.
// Bounds for block widths
// more flexible for theme designers taken from theme config.php
示例6: cms_render
function cms_render($pagedata, $course)
{
global $sections, $USER;
// Insert dynamic content
// content marked as private should be shown with a special style to people with editing rights
// and should not be shown to others
$context = get_context_instance(CONTEXT_COURSE, $course->id);
$canedit = has_capability('format/cms:editpage', $context, $USER->id);
$private = $canedit ? '<div class="private">$1</div>' : '';
$search = array("#\\[\\[INCLUDE (.+?)\\]\\]#ie", "#\\[\\[SCRIPT (.+?)\\]\\]#ie", "#\\[\\[PAGE (.+?)\\]\\]#ie", "#\\[\\[NEWS\\]\\]#ie", "#\\[\\[PRIVATE (.+?)\\]\\]#is", "#\\[\\[TOC\\]\\]#ie", "#\\[\\[([^\\[\\]]+?)\\s*\\|\\s*(.+?)\\]\\]#es", "#\\._\\.#ie");
$replace = array('cms_safe_include("$1", true)', 'cms_safe_include("$1", false)', 'cms_include_page("$1", $course)', 'cms_render_news($course)', $private, 'cms_print_toc($pagedata->id)', 'cms_render_link("$1" ,"$2")', '');
$body = preg_replace($search, $replace, $pagedata->body);
// Search sections.
preg_match_all("/{#section([0-9]+)}/i", $body, $match);
$cmssections = $match[1];
// At this point allow only course level not site level.
if (!empty($cmssections)) {
foreach ($cmssections as $cmssection) {
if (!empty($sections[$cmssection])) {
$thissection = $sections[$cmssection];
} else {
unset($thissection);
// make sure that the section doesn't exist.
if (!record_exists('course_sections', 'section', $cmssection, 'course', $course->id)) {
$thissection->course = $course->id;
// Create a new section structure
$thissection->section = $cmssection;
$thissection->summary = '';
$thissection->visible = 1;
if (!($thissection->id = insert_record('course_sections', $thissection))) {
notify('Error inserting new topic!');
}
} else {
$thissection = get_record('course_sections', 'course', $course->id, 'section', $cmssection);
}
}
if (!empty($thissection)) {
if (empty($mods)) {
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
}
$showsection = ($canedit or $thissection->visible or !$course->hiddensections);
if ($showsection) {
$content = '<div id="cms-section-' . $cmssection . '">';
$content .= cms_get_section($course, $thissection, $mods, $modnamesused);
if (isediting($course->id)) {
$content .= cms_section_add_menus($course, $cmssection, $modnames, false);
}
$content .= '</div>';
$body = preg_replace("/{#section{$cmssection}}/", $content, $body);
}
} else {
$body = preg_replace("/{#section{$cmssection}}/", "", $body);
}
}
}
$options = new stdClass();
$options->noclean = true;
return format_text(stripslashes($body), FORMAT_HTML, $options);
}
示例7: get_string
$stractivities = get_string("activities");
$strshowalltopics = get_string("showalltopics");
$strtopic = get_string("topic");
$strgroups = get_string("groups");
$strgroupmy = get_string("groupmy");
$editing = $PAGE->user_is_editing();
if ($editing) {
$strstudents = moodle_strtolower($course->students);
$strtopichide = get_string("topichide", "", $strstudents);
$strtopicshow = get_string("topicshow", "", $strstudents);
$strmarkthistopic = get_string("markthistopic");
$strmarkedthistopic = get_string("markedthistopic");
$strmoveup = get_string("moveup");
$strmovedown = get_string("movedown");
}
$isediting = isediting($course->id);
$isteacher = has_capability('moodle/grade:viewall', $cobject->context);
/// Add the selected_week to the course object (so it can be used elsewhere).
$course->selected_week = $selected_week;
/// Layout the whole page as three big columns.
echo '<table id="layout-table" cellspacing="0"><tr valign="top">';
/// If we are using mandatory activities, until they are completed only show them.
if (!empty($course->usemandatory) && !$cobject->all_mandatory_completed($course->id, $cobject->mods)) {
/// Start main column
echo '<td id="middle-column" align="center">';
echo '<table class="weeks" width="*" cellpadding="8">';
echo "<tr>";
echo "<td valign=top class=\"fnweeklycontent\" width=\"100%\">";
$cobject->print_mandatory_section();
echo '</td></tr></table>';
echo '</td>';
示例8: print_section
}
echo '</div>';
print_section($course, $thissection, $mods, $modnamesused);
if (isediting($course->id)) {
print_section_add_menus($course, $section, $modnames);
}
}
echo '</td>';
echo '<td class="right side">';
if ($displaysection == $section) {
echo '<a href="view.php?id=' . $course->id . '&week=0#section-' . $section . '" title="' . $strshowallweeks . '">' . '<img src="' . $CFG->pixpath . '/i/all.gif" class="icon wkall" alt="' . $strshowallweeks . '" /></a><br />';
} else {
$strshowonlyweek = get_string("showonlyweek", "", $section);
echo '<a href="view.php?id=' . $course->id . '&week=' . $section . '" title="' . $strshowonlyweek . '">' . '<img src="' . $CFG->pixpath . '/i/one.gif" class="icon wkone" alt="' . $strshowonlyweek . '" /></a><br />';
}
if (isediting($course->id) && has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id))) {
if ($thissection->visible) {
// Show the hide/show eye
echo '<a href="view.php?id=' . $course->id . '&hide=' . $section . '&sesskey=' . $USER->sesskey . '#section-' . $section . '" title="' . $strweekhide . '">' . '<img src="' . $CFG->pixpath . '/i/hide.gif" class="icon hide" alt="' . $strweekhide . '" /></a><br />';
} else {
echo '<a href="view.php?id=' . $course->id . '&show=' . $section . '&sesskey=' . $USER->sesskey . '#section-' . $section . '" title="' . $strweekshow . '">' . '<img src="' . $CFG->pixpath . '/i/show.gif" class="icon hide" alt="' . $strweekshow . '" /></a><br />';
}
if ($section > 1) {
// Add a arrow to move section up
echo '<a href="view.php?id=' . $course->id . '&random=' . rand(1, 10000) . '&section=' . $section . '&move=-1&sesskey=' . $USER->sesskey . '#section-' . ($section - 1) . '" title="' . $strmoveup . '">' . '<img src="' . $CFG->pixpath . '/t/up.gif" class="iconsmall up" alt="' . $strmoveup . '" /></a><br />';
}
if ($section < $course->numsections) {
// Add a arrow to move section down
echo '<a href="view.php?id=' . $course->id . '&random=' . rand(1, 10000) . '&section=' . $section . '&move=1&sesskey=' . $USER->sesskey . '#section-' . ($section + 1) . '" title="' . $strmovedown . '">' . '<img src="' . $CFG->pixpath . '/t/down.gif" class="iconsmall down" alt="' . $strmovedown . '" /></a><br />';
}
}
示例9: get_content
/**
* Get the block content
*
* @return object content items and icons arrays of what is to be displayed in this block
*/
function get_content()
{
global $CFG, $COURSE, $USER;
if (!isloggedin() || isguestuser()) {
//user is not properly logged in
return '';
}
if ($this->content !== NULL) {
return $this->content;
}
$this->content = new stdClass();
$this->content->footer = '';
$siteContext = get_context_instance(CONTEXT_SYSTEM);
if ($COURSE->id == SITEID) {
$context = $siteContext;
} else {
$context = get_context_instance(CONTEXT_COURSE, $COURSE->id);
}
// make sure the user has the required role
if (!empty($this->config->role)) {
$sql = "SELECT r.id, r.name\n FROM {$CFG->prefix}role r\n JOIN {$CFG->prefix}role_assignments ra ON ra.roleid = r.id\n JOIN {$CFG->prefix}user u ON u.id = ra.userid\n WHERE ra.contextid = {$context->id}\n AND u.id = {$USER->id}\n AND ra.roleid = {$this->config->role}";
if (!record_exists_sql($sql)) {
$this->content->items = array();
$this->content->icons = array();
return $this->content;
}
}
$items = array();
$icons = array();
$categories = array();
if (isset($this->config->reports)) {
// Require the php_report class
require_once $CFG->dirroot . '/blocks/php_report/php_report_base.php';
$params = array();
// set the parameters that we can get from the environment
// (currently only the course ID)
if ($this->instance->pagetype == PAGE_COURSE_VIEW) {
if ($this->instance->pageid != SITEID) {
$params['courseid'] = $this->instance->pageid;
}
}
// TODO: figure out capability for showing scheduling icon
$isediting = isediting($this->instance->pageid);
// && has_capability('block/php_report:manageactivities', $context);
$count = 0;
// create links to the reports
foreach ($this->config->reports as $report) {
if (isset(block_elis_reports::$reports_map[$report->id])) {
$report->id = block_elis_reports::$reports_map[$report->id];
}
$report_instance = php_report::get_default_instance($report->id);
//make sure the report shortname is valid
if ($report_instance !== FALSE) {
if ($report_instance->is_available() && $report_instance->can_view_report()) {
$category = $report_instance->get_category();
if (!isset($categories[$category])) {
$categories[$category] = array();
}
$name = $report_instance->get_display_name();
$report_link = new moodle_url($CFG->wwwroot . '/blocks/php_report/render_report_page.php', $params + $report->params + array('report' => $report->id));
$categories[$category][$count]['item'] = '<a href="' . $report_link->out() . '">' . $name . '</a>';
//create an instance specifically for testing scheduling permissions
$test_scheduling_permissions_instance = php_report::get_default_instance($report->id, NULL, php_report::EXECUTION_MODE_SCHEDULED);
//get_default instance will return FALSE if we are not allowed access to scheduling
$can_schedule = $test_scheduling_permissions_instance !== FALSE;
if ($isediting && $can_schedule) {
// TODO: add permissions to this url
$link = new moodle_url('/blocks/php_report/schedule.php?report=' . $report->id . '&action=listinstancejobs&createifnone=1');
$image_link = '<a href="#" alt=\'' . get_string('schedule_this_report', 'block_php_report') . '\' title=\'' . get_string('schedule_this_report', 'block_php_report') . '\' onclick="openpopup(\'' . $link->out() . '\', \'php_report_param_popup\', \'menubar=0,location=0,scrollbars,status,resizable,width=1600,height=600\');return false;">
<img src="' . $CFG->wwwroot . '/blocks/php_report/pix/schedule.png"/>
</a>';
$categories[$category][$count]['sched_icon'] = $image_link;
}
$categories[$category][$count]['icon'] = '<img src="' . $CFG->wwwroot . '/blocks/elis_reports/pix/report.png" />';
$count++;
}
}
}
// Generates items and icons array
$this->generate_content($categories, $this->content->items, $this->content->icons);
}
return $this->content;
}
示例10: preg_replace
$goback = true;
}
} else {
if ($edit != -1) {
// Non-OU: just turn on edit flag
$USER->editing = $edit;
$goback = true;
}
}
if ($goback) {
$url = preg_replace('~&edit=[^&]*~', '', $FULLME);
redirect($url);
}
}
// Note: Course ID is ignored outside OU
$editing = class_exists('ouflags') ? isediting($cm->course) : isediting();
// Display header. Because this pagelib class doesn't actually have a
// $buttontext parameter, there has to be a really evil hack
$PAGEWILLCALLSKIPMAINDESTINATION = true;
$PAGE->print_header($course->shortname . ': ' . format_string($forum->get_name()), null, '', $meta, $buttontext);
$forum->print_js($cm->id);
// The left column ...
if ($hasleft = !empty($CFG->showblocksonmodpages) && (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing)) {
print '<div id="left-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
print '</div>';
}
if ($hasright = !empty($CFG->showblocksonmodpages) && (blocks_have_content($pageblocks, BLOCK_POS_RIGHT) || $editing)) {
print '<div id="right-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_RIGHT);
print '</div>';
示例11: print_section_fn
function print_section_fn(&$section, $absolute = false, $width = "100%")
{
/// Prints a section full of activity modules
global $CFG, $USER, $THEME;
static $initialised;
static $groupbuttons;
static $groupbuttonslink;
static $isteacher, $isteacheredit;
static $isediting;
static $ismoving;
static $strmovehere;
static $strmovefull;
static $strunreadpostsone;
$labelformatoptions = new stdClass();
if (!isset($isteacher)) {
$groupbuttons = $this->course->groupmode;
$groupbuttonslink = !$this->course->groupmodeforce;
$isteacher = has_capability('moodle/grade:viewall', $this->context);
$isteacheredit = has_capability('moodle/course:manageactivities', $this->context);
$isediting = isediting($this->course->id);
$ismoving = ismoving($this->course->id);
if ($ismoving) {
$strmovehere = get_string("movehere");
$strmovefull = strip_tags(get_string("movefull", "", "'{$USER->activitycopyname}'"));
}
}
if (!isset($initialised)) {
include_once $CFG->dirroot . '/mod/forum/lib.php';
if ($usetracking = forum_tp_can_track_forums()) {
$strunreadpostsone = get_string('unreadpostsone', 'forum');
}
$initialised = true;
}
// Replace this with language file changes (eventually).
$link_title = array('resource' => 'Lesson', 'choice' => 'Opinion', 'lesson' => 'Reading');
$labelformatoptions->noclean = true;
$modinfo = unserialize($this->course->modinfo);
echo "<table cellpadding=\"1\" cellspacing=\"0\" align=\"center\" width=\"{$width}\">\n";
if (!empty($section->sequence)) {
$sectionmods = explode(",", $section->sequence);
foreach ($sectionmods as $modnumber) {
if (empty($this->mods[$modnumber])) {
continue;
}
$mod = $this->mods[$modnumber];
/// mrc - 20042312 - Begin G8 First Nations School Customization:
/// Added check for 'teacheredit' in order to hide invisible activities from
/// non-editing teachers.
/// if ($mod->visible or $isteacher) {
if ($mod->visible or $isteacheredit) {
/// mrc - 20042312 - End G8 First Nations School Customization:
if (right_to_left()) {
$tdalign = 'right';
} else {
$tdalign = 'left';
}
echo "<tr><td align=\"{$tdalign}\" class=\"activity{$mod->modname}\" width=\"{$width}\">";
if ($ismoving) {
if ($mod->id == $USER->activitycopy) {
continue;
}
echo "<a title=\"{$strmovefull}\"" . " href=\"{$CFG->wwwroot}/course/mod.php?moveto={$mod->id}&sesskey={$USER->sesskey}\">" . "<img height=\"16\" width=\"80\" src=\"{$CFG->pixpath}/movehere.gif\" " . " alt=\"{$strmovehere}\" border=\"0\"></a><br />\n";
}
$instancename = urldecode($modinfo[$modnumber]->name);
if (!empty($CFG->filterall)) {
$instancename = filter_text("<nolink>{$instancename}</nolink>", $this->course->id);
}
if (!empty($modinfo[$modnumber]->extra)) {
$extra = urldecode($modinfo[$modnumber]->extra);
} else {
$extra = "";
}
if (!empty($modinfo[$modnumber]->icon)) {
$icon = "{$CFG->pixpath}/" . urldecode($modinfo[$modnumber]->icon);
} else {
$icon = "{$CFG->modpixpath}/{$mod->modname}/icon.gif";
}
if ($mod->indent) {
print_spacer(12, 20 * $mod->indent, false);
}
// /// If the questionnaire is mandatory
// if (($mod->modname == 'questionnaire') && empty($mandatorypopup)) {
// $mandatorypopup = is_mod_mandatory($mod, $USER->id);
// }
if ($mod->modname == "label") {
if (empty($this->course->usemandatory) || empty($mod->mandatory)) {
if (!$mod->visible) {
echo "<span class=\"dimmed_text\">";
}
echo format_text($extra, FORMAT_HTML, $labelformatoptions);
if (!$mod->visible) {
echo "</span>";
}
} else {
if ($isediting) {
$linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
$alttext = isset($link_title[$mod->modname]) ? $link_title[$mod->modname] : $mod->modfullname;
echo "<img src=\"{$icon}\"" . " height=16 width=16 alt=\"{$alttext}\">" . " <font size=2><a title=\"{$alttext}\" {$linkcss} {$extra}" . " href=\"{$CFG->wwwroot}/mod/{$mod->modname}/view.php?id={$mod->id}\">{$instancename}</a></font>";
}
}
//.........这里部分代码省略.........
示例12: print_header
if ($hideunusedblog) {
print_header();
} else {
$navigation = oublog_build_navigation($cm, $oublog, $oubloginstance, $oubloguser, $extranav);
print_header_simple(format_string($oublog->name), "", $navigation, "", oublog_get_meta_tags($oublog, $oubloginstance, $currentgroup, $cm), true, $buttontext, navmenu($course, $cm));
}
} else {
$navigation = oublog_build_navigation($cm, $oublog, $oubloginstance, null, $extranav);
print_header_simple(format_string($oublog->name), "", $navigation, "", oublog_get_meta_tags($oublog, $oubloginstance, $currentgroup, $cm), true, $buttontext, navmenu($course, $cm));
}
print '<div class="oublog-topofpage"></div>';
require_once dirname(__FILE__) . '/pagelib.php';
// Initialize $PAGE, compute blocks
$PAGE = page_create_instance($oublog->id);
$pageblocks = blocks_setup($PAGE);
$editing = isediting($cm->course);
if (class_exists('ouflags') && ou_get_is_mobile() && $blogdets == 'show') {
print '<div id="middle-column">';
ou_print_mobile_navigation($id, $blogdets, null, $user);
} else {
// The left column ...
if ($hasleft = !empty($CFG->showblocksonmodpages) && (blocks_have_content($pageblocks, BLOCK_POS_LEFT) || $editing)) {
print '<div id="left-column">';
blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
print '</div>';
}
print '</div>';
// fix mixed columns in rtl mode and editing mode (nadavkav patch)
// The right column, BEFORE the middle-column.
print '<div id="right-column">';
}
示例13: print_section_dblistview
function print_section_dblistview($course, $section, $mods, $modnamesused, $absolute = false, $width = "100%")
{
/// Prints a section full of activity modules
global $CFG, $USER;
static $initialised;
static $groupbuttons;
static $groupbuttonslink;
static $isediting;
static $ismoving;
static $strmovehere;
static $strmovefull;
static $strunreadpostsone;
static $usetracking;
static $groupings;
if (!isset($initialised)) {
$groupbuttons = ($course->groupmode or !$course->groupmodeforce);
$groupbuttonslink = !$course->groupmodeforce;
$isediting = isediting($course->id);
$ismoving = $isediting && ismoving($course->id);
if ($ismoving) {
$strmovehere = get_string("movehere");
$strmovefull = strip_tags(get_string("movefull", "", "'{$USER->activitycopyname}'"));
}
include_once $CFG->dirroot . '/mod/forum/lib.php';
if ($usetracking = forum_tp_can_track_forums()) {
$strunreadpostsone = get_string('unreadpostsone', 'forum');
}
$initialised = true;
}
$labelformatoptions = new object();
$labelformatoptions->noclean = true;
/// Casting $course->modinfo to string prevents one notice when the field is null
$modinfo = get_fast_modinfo($course);
//Acccessibility: replace table with list <ul>, but don't output empty list.
if (!empty($section->sequence)) {
// Fix bug #5027, don't want style=\"width:$width\".
echo "<ul class=\"section img-text\">\n";
$sectionmods = explode(",", $section->sequence);
foreach ($sectionmods as $modnumber) {
if (empty($mods[$modnumber])) {
continue;
}
$mod = $mods[$modnumber];
if ($ismoving and $mod->id == $USER->activitycopy) {
// do not display moving mod
continue;
}
if (isset($modinfo->cms[$modnumber])) {
if (!$modinfo->cms[$modnumber]->uservisible) {
// visibility shortcut
continue;
}
} else {
if (!file_exists("{$CFG->dirroot}/mod/{$mod->modname}/lib.php")) {
// module not installed
continue;
}
if (!coursemodule_visible_for_user($mod)) {
// full visibility check
continue;
}
}
// The magic! ... if indent == 1 then ... hide module
// if ($mod->indent == 1) {
// $hiddemodule = 'hidden';
// } else {
// $hiddemodule = '';
// }
echo '<li class="activity ' . $mod->modname . ' ' . $hiddemodule . '" id="module-' . $modnumber . '">';
// Unique ID
if ($ismoving) {
echo '<a title="' . $strmovefull . '"' . ' href="' . $CFG->wwwroot . '/course/mod.php?moveto=' . $mod->id . '&sesskey=' . $USER->sesskey . '">' . '<img class="movetarget" src="' . $CFG->pixpath . '/movehere.gif" ' . ' alt="' . $strmovehere . '" /></a><br />
';
}
if ($mod->indent) {
print_spacer(12, 20 * $mod->indent, false);
}
$extra = '';
if (!empty($modinfo->cms[$modnumber]->extra)) {
$extra = $modinfo->cms[$modnumber]->extra;
}
if ($mod->modname == "label") {
echo "<span class=\"";
if (!$mod->visible) {
echo 'dimmed_text';
} else {
echo 'label';
}
echo '">';
echo format_text($extra, FORMAT_HTML, $labelformatoptions);
echo "</span>";
if (!empty($CFG->enablegroupings) && !empty($mod->groupingid) && has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
if (!isset($groupings)) {
$groupings = groups_get_all_groupings($course->id);
}
echo " <span class=\"groupinglabel\">(" . format_string($groupings[$mod->groupingid]->name) . ')</span>';
}
} else {
// Normal activity
$instancename = format_string($modinfo->cms[$modnumber]->name, true, $course->id);
//.........这里部分代码省略.........
示例14: get_content
function get_content()
{
global $CFG, $USER, $COURSE;
//error_reporting(E_ALL);
if ($this->content !== NULL) {
return $this->content;
}
if (empty($this->instance)) {
return $this->content = '';
}
if (empty($USER->id)) {
return $this->content = '';
}
$course = $COURSE->id == $this->instance->pageid ? $COURSE : get_record('course', 'id', $this->instance->pageid);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
$editing = isediting($this->instance->pageid) && has_capability('moodle/course:manageactivities', $context);
if (!$editing) {
return $this->content = '';
}
// DBから取得したアイテムを表示すべきものだけ抜き出し、木構造化
// また、ここでドロップダウンリスト用にフォルダ名列挙もしておく
$tree = array();
$dirs = array();
if ($shared_items = get_records('sharing_cart', 'user', $USER->id)) {
foreach ($shared_items as $shared_item) {
$node =& self::path_to_node($tree, explode('/', $shared_item->tree));
$node[] = array('id' => $shared_item->id, 'path' => $shared_item->tree, 'icon' => empty($shared_item->icon) ? $shared_item->name == 'label' ? '' : '<img src="' . $CFG->wwwroot . '/mod/' . $shared_item->name . '/icon.gif" alt="" class="icon" />' : '<img src="' . $CFG->pixpath . '/' . $shared_item->icon . '" alt="" class="icon" />', 'text' => $shared_item->text, 'sort' => $shared_item->sort);
$dirs[$shared_item->tree] = $shared_item->tree;
}
self::sort_tree($tree);
unset($dirs['']);
usort($dirs, 'strnatcasecmp');
}
// ツリーをHTMLにレンダリング
$text = "<ul class=\"list\">\n" . self::render_tree($tree) . '</ul>';
require_once dirname(__FILE__) . '/shared/SharingCart_CourseScript.php';
$courseScript = new SharingCart_CourseScript();
$js_import = $courseScript->import($CFG->wwwroot . '/blocks/sharing_cart/sharing_cart.js', true);
foreach (sharing_cart_plugins::get_imports() as $import) {
$js_import .= $courseScript->import($CFG->wwwroot . '/blocks/sharing_cart/plugins/' . $import, true);
}
$js_pre = '
<script type="text/javascript">
//<![CDATA[
var sharing_cart = new sharing_cart_handler({
wwwroot : "' . $CFG->wwwroot . '",
pixpath : "' . $CFG->pixpath . '",
instance_id : ' . $this->instance->id . ',
course_id : ' . $course->id . ',
return_url : "' . urlencode($_SERVER['REQUEST_URI']) . '",
directories : [
' . implode(',
', array_map(create_function('$dir', '
return "\\"".addslashes($dir)."\\"";
'), $dirs)) . '
],
str : {
rootdir : "' . get_string('rootdir', 'block_sharing_cart') . '",
notarget : "' . get_string('notarget', 'block_sharing_cart') . '",
copyhere : "' . get_string('copyhere', 'block_sharing_cart') . '",
movehere : "' . get_string('movehere') . '",
edit : "' . get_string('edit') . '",
cancel : "' . get_string('cancel') . '",
backup : "' . get_string('backup', 'block_sharing_cart') . '",
clipboard : "' . addslashes(get_string('clipboard', 'block_sharing_cart')) . '",
confirm_backup : "' . addslashes(get_string('confirm_backup', 'block_sharing_cart')) . '",
confirm_delete : "' . addslashes(get_string('confirm_delete', 'block_sharing_cart')) . '"
}
});
' . implode('
', sharing_cart_plugins::get_scripts()) . '
//]]>
</script>
';
$js_post = $courseScript->addLoadEvent('sharing_cart.init();', true);
$this->content = new stdClass();
$this->content->text = $js_import . $js_pre . $text;
$this->content->footer = '<div id="sharing_cart_header" style="text-align:right;">' . implode('', sharing_cart_plugins::get_headers()) . helpbutton('sharing_cart', $this->title, 'block_sharing_cart', true, false, '', true) . '</div>' . implode('', sharing_cart_plugins::get_footers()) . $js_post;
return $this->content;
}
示例15: user_is_editing
function user_is_editing()
{
$this->init_full();
return isediting($this->modulerecord->course);
}