Ejemplo n.º 1
0
function blocks_print_adminblock(&$page, &$pageblocks)
{
    global $USER;
    $missingblocks = blocks_get_missing($page, $pageblocks);
    if (!empty($missingblocks)) {
        $strblocks = '<div class="title"><h2>';
        $strblocks .= get_string('blocks');
        $strblocks .= '</h2></div>';
        $stradd = get_string('add');
        foreach ($missingblocks as $blockid) {
            $block = blocks_get_record($blockid);
            $blockobject = block_instance($block->name);
            if ($blockobject === false) {
                continue;
            }
            if (!$blockobject->user_can_addto($page)) {
                continue;
            }
            $menu[$block->id] = $blockobject->get_title();
        }
        asort($menu);
        $target = $page->url_get_full(array('sesskey' => $USER->sesskey, 'blockaction' => 'add'));
        $content = popup_form($target . '&amp;blockid=', $menu, 'add_block', '', $stradd . '...', '', '', true);
        print_side_block($strblocks, $content, NULL, NULL, NULL, array('class' => 'block_adminblock'));
    }
}
Ejemplo n.º 2
0
                         $destweight = 0;
                     }
                 } else {
                     if (!empty($countrecords)) {
                         $destweight = $recordexists ? $instweight->weight : $instweight->weight + 1;
                     } else {
                         $destweight = 0;
                     }
                 }
             }
             blocks_move_block($PAGE, $blockinstance, $column, $destweight);
             $current_blocks = blocks_get_by_page_pinned($PAGE);
             global $COURSE;
             foreach ($current_blocks as $pos => $blocks) {
                 if (count($current_blocks[$pos]) == 0) {
                     print_side_block('', '', NULL, NULL, '', array('id' => $pos . 'inst0', 'class' => 'tempblockhandle'), '');
                 }
             }
             break;
     }
     break;
 case 'section':
     if (!record_exists('course_sections', 'course', $course->id, 'section', $id)) {
         error_log('AJAX commands.php: Bad Section ID ' . $id);
         die;
     }
     switch ($field) {
         case 'visible':
             set_section_visible($course->id, $id, $value);
             break;
         case 'move':
Ejemplo n.º 3
0
 function _print_block()
 {
     global $COURSE;
     // is_empty() includes a call to get_content()
     if ($this->is_empty() && empty($COURSE->javascriptportal)) {
         if (empty($this->edit_controls)) {
             // No content, no edit controls, so just shut up
             return;
         } else {
             // No content but editing, so show something at least
             $this->_print_shadow();
         }
     } else {
         if ($this->hide_header() && empty($this->edit_controls)) {
             // Header wants to hide, no edit controls to show, so no header it is
             print_side_block(NULL, '', $this->content->items, $this->content->icons, $this->content->footer, $this->html_attributes());
         } else {
             // The full treatment, please. Include the title text.
             print_side_block($this->_title_html(), '', $this->content->items, $this->content->icons, $this->content->footer, $this->html_attributes(), $this->title);
         }
     }
 }
print '<div class="oublog-topofpage"></div>';
// The left column ...
if ($hasleft = !empty($CFG->showblocksonmodpages) && blocks_have_content($pageblocks, BLOCK_POS_LEFT)) {
    print '<div id="left-column">';
    blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
    print '</div>';
}
// The right column, BEFORE the middle-column.
print '<div id="right-column">';
if (isloggedin() and !isguestuser()) {
    list($oublog, $oubloginstance) = oublog_get_personal_blog($USER->id);
    $blogeditlink = "<br /><a href=\"view.php\" class=\"oublog-links\">{$oubloginstance->name}</a>";
    print_side_block(format_string($oublog->name), $blogeditlink, NULL, NULL, NULL, array('id' => 'oublog-summary'), get_string('bloginfo', 'oublog'));
}
if ($feeds = oublog_get_feedblock($oublog, 'all', '', false, $cm)) {
    print_side_block($strfeeds, $feeds, NULL, NULL, NULL, array('id' => 'oublog-feeds'), $strfeeds);
}
print '</div>';
// Start main column
$classes = '';
$classes .= $hasleft ? 'has-left-column ' : '';
$classes .= 'has-right-column ';
$classes = trim($classes);
if ($classes) {
    print '<div id="middle-column" class="' . $classes . '">';
} else {
    print '<div id="middle-column">';
}
print skip_main_destination();
// Print blog posts
if ($posts) {
/**
 * This function prints blocks.
 *
 * @uses $CGF, $USER
 * @param int $userid User ID
 * @param int $courseid Course ID
 * @param boolean $printsearchblock Print search block
 * @return NULL
 * @todo Finish documenting this function
 **/
function email_printblocks($userid, $courseid, $printsearchblock = true)
{
    global $CFG, $USER;
    $strcourse = get_string('course');
    $strcourses = get_string('mailboxs', 'block_email_list');
    $strsearch = get_string('search');
    $strmail = get_string('name', 'block_email_list');
    // For title blocks
    $startdivtitle = '<div class="title">';
    $enddivtitle = '</div>';
    $list = array();
    $icons = array();
    if ($printsearchblock) {
        // Print search block
        $form = email_get_search_form($courseid);
        print_side_block_start($startdivtitle . $strsearch . $enddivtitle);
        echo $form;
        print_side_block_end();
    }
    // Print my folders
    email_print_tree_myfolders($userid, $courseid);
    // Remove old fields
    unset($list);
    unset($icons);
    // Get my course
    $mycourses = get_my_courses($USER->id, NULL, 'id, fullname, visible');
    $list = array();
    $icons = array();
    // Get courses
    foreach ($mycourses as $mycourse) {
        $context = get_context_instance(CONTEXT_COURSE, $mycourse->id);
        //Get the number of unread mails
        $numberunreadmails = email_count_unreaded_mails($USER->id, $mycourse->id);
        $unreadmails = '';
        // Only show if has unreaded mails
        if ($numberunreadmails > 0) {
            $unreadmails = '<b>(' . $numberunreadmails . ')</b>';
            // Define default path of icon for course
            $icon = '<img src="' . $CFG->wwwroot . '/blocks/email_list/email/images/openicon.gif" height="16" width="16" alt="' . $strcourse . '" />';
        } else {
            // Define default path of icon for course
            $icon = '<img src="' . $CFG->wwwroot . '/blocks/email_list/email/icon.gif" height="16" width="16" alt="' . $strcourse . '" />';
        }
        $linkcss = $mycourse->visible ? '' : ' class="dimmed" ';
        if (!$mycourse->visible and !has_capability('moodle/legacy:student', $context, $USER->id, false) or !has_capability('moodle/legacy:student', $context, $USER->id, false) or has_capability('moodle/legacy:student', $context, $USER->id, false) and $mycourse->visible) {
            $list[] = '<a href="' . $CFG->wwwroot . '/blocks/email_list/email/index.php?id=' . $mycourse->id . '" ' . $linkcss . '>' . $mycourse->fullname . ' ' . $unreadmails . '</a>';
            $icons[] = $icon;
        }
    }
    // Print block of my courses
    print_side_block($startdivtitle . $strcourses . $enddivtitle, '', $list, $icons);
}
Ejemplo n.º 6
0
// For filtering
$content = '<div class="filters">';
$content .= calendar_filter_controls($view, $getvars, NULL, $courses);
$content .= '</div>';
print_side_block(get_string('eventskey', 'calendar'), $content);
$content = '<div class="minicalendarblock minicalendartop">';
$content .= calendar_top_controls('display', array('id' => $courseid, 'm' => $prevmon, 'y' => $prevyr));
$content .= calendar_get_mini($courses, $groups, $users, $prevmon, $prevyr);
$content .= '</div><div class="minicalendarblock">';
$content .= calendar_top_controls('display', array('id' => $courseid, 'm' => $mon, 'y' => $yr));
$content .= calendar_get_mini($courses, $groups, $users, $mon, $yr);
$content .= '</div><div class="minicalendarblock">';
$content .= calendar_top_controls('display', array('id' => $courseid, 'm' => $nextmon, 'y' => $nextyr));
$content .= calendar_get_mini($courses, $groups, $users, $nextmon, $nextyr);
$content .= '</div>';
print_side_block(get_string('monthlyview', 'calendar'), $content);
echo '</td>';
echo '</tr></table>';
print_footer();
function calendar_show_day($d, $m, $y, $courses, $groups, $users, $courseid)
{
    global $CFG, $USER;
    if (!checkdate($m, $d, $y)) {
        $now = usergetdate(time());
        list($d, $m, $y) = array(intval($now['mday']), intval($now['mon']), intval($now['year']));
    }
    $getvars = 'from=day&amp;cal_d=' . $d . '&amp;cal_m=' . $m . '&amp;cal_y=' . $y;
    // For filtering
    $starttime = make_timestamp($y, $m, $d);
    $endtime = make_timestamp($y, $m, $d + 1) - 1;
    $events = calendar_get_upcoming($courses, $groups, $users, 1, 100, $starttime);
Ejemplo n.º 7
0
 public function display()
 {
     $strquiznavigation = get_string('quiznavigation', 'quiz');
     $content = '';
     if ($this->attemptobj->get_quiz()->showuserpicture) {
         $content .= $this->get_user_picture() . "\n";
     }
     $content .= $this->get_question_buttons() . "\n";
     $content .= '<div class="othernav">' . "\n" . $this->get_end_bits() . "\n</div>\n";
     print_side_block($strquiznavigation, $content, NULL, NULL, '', array('id' => 'quiznavigation'), $strquiznavigation);
 }
/**
 * Prints the summary block. This includes the blog summary
 * and possibly links to change it, depending on the type of blog and user
 * permissions.
 * @param object $oublog Blog object
 * @param object $oubloginstance Blog instance object
 * @param bool $canmanageposts True if they're allowed to edit the blog
 */
function oublog_print_summary_block($oublog, $oubloginstance, $canmanageposts)
{
    global $USER;
    $links = '';
    if ($oublog->global) {
        $summary = $oubloginstance->summary;
        $name = $oubloginstance->name;
        if ($oubloginstance->userid == $USER->id || $canmanageposts) {
            $strblogoptions = get_string('blogoptions', 'oublog');
            $links = "<br /><a href=\"editinstance.php?instance={$oubloginstance->id}\" class=\"oublog-links\">{$strblogoptions}</a>";
        }
        $links .= "<br/><a href=\"allposts.php\" class=\"oublog-links\">" . get_string('siteentries', 'oublog') . "</a>";
    } else {
        $summary = $oublog->summary;
        $name = $oublog->name;
    }
    print_side_block(format_string($name), format_text($summary, FORMAT_HTML) . $links, NULL, NULL, NULL, array('id' => 'oublog-summary'), get_string('bloginfo', 'oublog'));
}
             $pageindex .= '<div><a href="' . $CFG->wwwroot . '/course/view.php?id=' . $id . '&topic=' . ($previouschapter->section - 1) . '"> Previous Chapter...</a><br/></div><hr/>';
         } else {
             $pageindex .= '';
         }
         foreach ($pages_in_chapter as $singlepage) {
             if ($singlepage->section == $topic) {
                 $selectedpage = ' class="selectedpage" ';
             } else {
                 $selectedpage = ' ';
             }
             $pageindex .= '<div ' . $selectedpage . '><a href="' . $CFG->wwwroot . '/course/view.php?id=' . $id . '&topic=' . $singlepage->section . '"><span id="pagetitle">Page ' . $singlepage->page . '</span>: <span id="pagetitle">' . $singlepage->title . '</span></a><br/></div>';
             $lastpageinchapter = $singlepage->section;
         }
         // Display Next Chapter link
         $pageindex .= '<hr/><div><a href="' . $CFG->wwwroot . '/course/view.php?id=' . $id . '&topic=' . ($lastpageinchapter + 1) . '"> Next Chapter...</a><br/></div>';
         print_side_block('Pages for Chapter ' . $ebook->chapter, $pageindex);
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
         print_container_end();
         echo '</td>';
     }
     break;
 case 'middle':
     /// Start main column
     echo '<td id="middle-column">';
     print_container_start();
     echo skip_main_destination();
     // use topics or pages?
     //$section = ($topic>0 and $page==0) ? $topic : $page;
     //if ($section == 0) $section = $_COOKIE['ebookpage'];
     $imgleft = '<a href="view.php?id=' . $_GET['id'] . '&topic=' . (string) (int) ($topic - 1) . '"><img height="24" src="' . $CFG->wwwroot . '/course/format/ebook/arrow-left.png"></a>';
     $imgright = '<a href="view.php?id=' . $_GET['id'] . '&topic=' . (string) (int) ($topic + 1) . '"><img height="24" src="' . $CFG->wwwroot . '/course/format/ebook/arrow-right.png"></a>';
Ejemplo n.º 10
0
/**
 * If left menu is turned on, then this will
 * print the menu in a block
 *
 * @param int $cmid Course Module ID for this lesson
 * @param object $lesson Full lesson record object
 * @return void
 **/
function lesson_print_menu_block($cmid, $lesson)
{
    global $CFG;
    if ($lesson->displayleft) {
        $pageid = get_field('lesson_pages', 'id', 'lessonid', $lesson->id, 'prevpageid', 0);
        $pages = get_records_select('lesson_pages', "lessonid = {$lesson->id}");
        $currentpageid = optional_param('pageid', $pageid, PARAM_INT);
        if ($pageid and $pages) {
            $content = '<a href="#maincontent" class="skip">' . get_string('skip', 'lesson') . "</a>\n<div class=\"menuwrapper\">\n<ul>\n";
            while ($pageid != 0) {
                $page = $pages[$pageid];
                // Only process branch tables with display turned on
                if ($page->qtype == LESSON_BRANCHTABLE and $page->display) {
                    if ($page->id == $currentpageid) {
                        $content .= '<li class="selected">' . format_string($page->title, true) . "</a></li>\n";
                    } else {
                        $content .= "<li class=\"notselected\"><a href=\"{$CFG->wwwroot}/mod/lesson/view.php?id={$cmid}&amp;pageid={$page->id}\">" . format_string($page->title, true) . "</a></li>\n";
                    }
                }
                $pageid = $page->nextpageid;
            }
            $content .= "</ul>\n</div>\n";
            print_side_block(get_string('lessonmenu', 'lesson'), $content, NULL, NULL, '', array('class' => 'menu'), get_string('lessonmenu', 'lesson'));
        }
    }
}
Ejemplo n.º 11
0
function blocks_print_adminblock($page, $blockmanager)
{
    global $USER;
    $missingblocks = array_keys($page->blocks->get_addable_blocks());
    if (!empty($missingblocks)) {
        $strblocks = '<div class="title"><h2>';
        $strblocks .= get_string('blocks');
        $strblocks .= '</h2></div>';
        $stradd = get_string('add');
        foreach ($missingblocks as $blockid) {
            $block = blocks_get_record($blockid);
            $blockobject = block_instance($block->name);
            if ($blockobject !== false && $blockobject->user_can_addto($page)) {
                $menu[$block->id] = $blockobject->get_title();
            }
        }
        asort($menu, SORT_LOCALE_STRING);
        $target = $page->url->out(false, array('sesskey' => sesskey(), 'blockaction' => 'add'));
        $content = popup_form($target . '&amp;blockid=', $menu, 'add_block', '', $stradd . '...', '', '', true);
        print_side_block($strblocks, $content, NULL, NULL, NULL, array('class' => 'block_adminblock'));
    }
}
Ejemplo n.º 12
0
/**
 * This function prints blocks.
 *
 * @uses $CGF, $USER, $OUTPUT
 * @param int $userid User ID
 * @param int $courseid Course ID
 * @param boolean $printsearchblock Print search block
 * @return NULL
 * @todo Finish documenting this function
 **/
function email_printblocks($userid, $courseid, $printsearchblock = true)
{
    global $CFG, $USER, $OUTPUT;
    $strcourse = get_string('course');
    $strcourses = get_string('mailboxs', 'block_email_list');
    $strsearch = get_string('search');
    $strmail = get_string('name', 'block_email_list');
    // For title blocks
    $startdivtitle = '<div class="title">';
    $enddivtitle = '</div>';
    $list = array();
    $icons = array();
    if ($printsearchblock) {
        // Print search block
        $form = email_get_search_form($courseid);
        print_side_block_start($startdivtitle . $strsearch . $enddivtitle);
        echo $form;
        print_side_block_end();
    }
    // Print my folders
    email_print_tree_myfolders($userid, $courseid);
    // Remove old fields
    unset($list);
    unset($icons);
    // Get my course
    $mycourses = get_my_courses($USER->id, NULL, 'id, fullname, shortname, visible', false, $CFG->email_max_number_courses);
    // Limit
    $list = array();
    $icons = array();
    $number = 0;
    // Get courses
    foreach ($mycourses as $mycourse) {
        ++$number;
        // increment for first course
        if ($number > $CFG->email_max_number_courses && !empty($CFG->email_max_number_courses)) {
            continue;
        }
        $context = get_context_instance(CONTEXT_COURSE, $mycourse->id);
        //Get the number of unread mails
        $numberunreadmails = email_count_unreaded_mails($USER->id, $mycourse->id);
        $unreadmails = '';
        // Only show if has unreaded mails
        if ($numberunreadmails > 0) {
            $unreadmails = '<b>(' . $numberunreadmails . ')</b>';
            // Define default path of icon for course
            $icon = '<img src="' . $CFG->wwwroot . '/blocks/email_list/email/images/openicon.gif" height="16" width="16" alt="' . $strcourse . '" />';
        } else {
            // Define default path of icon for course
            $icon = '<img src="' . $CFG->wwwroot . '/blocks/email_list/email/icon.gif" height="16" width="16" alt="' . $strcourse . '" />';
        }
        $linkcss = $mycourse->visible ? '' : ' class="dimmed" ';
        $coursename = $CFG->email_display_course_fullname ? $mycourse->fullname : $mycourse->shortname;
        // If I'm student
        if (has_capability('moodle/course:viewhiddencourses', $context)) {
            // Thanks Tim
            // If course visible
            if ($mycourse->visible) {
                $list[] = '<a href="' . $CFG->wwwroot . '/blocks/email_list/email/index.php?id=' . $mycourse->id . '" ' . $linkcss . '>' . $coursename . ' ' . $unreadmails . '</a>';
                $icons[] = $icon;
            }
        } else {
            $list[] = '<a href="' . $CFG->wwwroot . '/blocks/email_list/email/index.php?id=' . $mycourse->id . '" ' . $linkcss . '>' . $coursename . ' ' . $unreadmails . '</a>';
            $icons[] = $icon;
        }
    }
    // Print block of my courses
    print_side_block($startdivtitle . $strcourses . $enddivtitle, '', $list, $icons);
}
             }
             if ($topic == 0) {
                 $topicbutton .= "<a id=\"topic{$topic}\" href=\"#\">" . get_string('overview', 'format_summaryblk') . "</a><br/>";
             } else {
                 $topicbutton .= "<a id=\"topic{$topic}\" href=\"#\">" . $sections[$topic]->summary . "</a></br>";
             }
             $topicbuttonevent .= '
        Event.on("topic' . $topic . '", "click", function(e) {
            topic = ' . $topic . ';
            console.log("topic: ' . $topic . '");
            var request = YAHOO.util.Connect.asyncRequest("GET", sUrl + "' . $topic . '", callback);
        });
    ';
         }
         $topicbutton .= '</div>';
         print_side_block(get_string('navmenu', 'format_summaryblk'), $topicbutton, NULL, NULL, NULL, array('id' => 'navmenu'), '');
         print_container_start();
         blocks_print_group($PAGE, $pageblocks, BLOCK_POS_LEFT);
         print_container_end();
         echo '</td>';
     }
     break;
 case 'middle':
     /// Start main column
     echo '<td id="middle-column">';
     print_container_start();
     echo skip_main_destination();
     //print_heading_block(get_string('topicoutline'), 'outline');
     //echo '<div id="navbuttons" style="float:right;"><button id="next">הבאה</button><button id="prev">קודמת</button></div>';
     if (isediting($course->id)) {
         $displayfirsttopic = '';
Ejemplo n.º 14
0
    $quizcontentsclass = 'quizwhenbankcollapsed';
}
// Nasty short-term hack, becuase I am getting rid of separate print_side_block_start/end functions.
ob_start();
echo '<span id="questionbank"></span>';
echo '<div class="container">';
echo '<div id="module" class="module">';
echo '<div class="bd">';
$questionbank->display('editq', $pagevars['qpage'], $pagevars['qperpage'], $pagevars['qsortorder'], $pagevars['qsortorderdecoded'], $pagevars['cat'], $pagevars['recurse'], $pagevars['showhidden'], $pagevars['showquestiontext']);
echo '</div>';
echo '</div>';
echo '</div>';
$qbhtml = ob_get_contents();
ob_end_clean();
print_side_block(get_string('questionbankcontents', 'quiz') . ' <a href="' . $thispageurl->out(false, array('qbanktool' => '1')) . '" id="showbankcmd">[' . get_string('show') . ']</a>
       <a href="' . $thispageurl->out(false, array('qbanktool' => '0')) . '" id="hidebankcmd">[' . get_string('hide') . ']</a>
       ', $qbhtml, null, null, '', array('class' => 'questionbankwindow ' . $bankclass));
echo '<div class="quizcontents ' . $quizcontentsclass . '" id="quizcontentsblock">';
if ($quiz->shufflequestions) {
    $repaginatingdisabledhtml = 'disabled="disabled"';
    $repaginatingdisabled = true;
    $quiz->questions = quiz_repaginate($quiz->questions, $quiz->questionsperpage);
} else {
    $repaginatingdisabledhtml = '';
    $repaginatingdisabled = false;
}
if ($quiz_reordertool) {
    echo '<div class="repaginatecommand"><button id="repaginatecommand" ' . $repaginatingdisabledhtml . '>' . get_string('repaginatecommand', 'quiz') . '...</button>';
    echo '</div>';
}
echo $OUTPUT->heading($pagetitle . ": " . $quiz->name, 2);