Esempio n. 1
0
 function display()
 {
     global $CFG, $PAGE, $COURSE;
     $moving = optional_param('moving', 0, PARAM_INT);
     require_capability('format/page:managepages', $this->context);
     $PAGE->print_tabs('manage');
     if ($pages = page_get_all_pages($COURSE->id, 'flat')) {
         $table->head = array(get_string('pagename', 'format_page'), get_string('pageoptions', 'format_page'), get_string('displaytheme', 'format_page'), get_string('displaymenu', 'format_page'), get_string('publish', 'format_page'), get_string('locks', 'format_page'));
         $table->align = array('left', 'center', 'center', 'center', 'center', 'center');
         $table->width = '70%';
         $table->cellspacing = '0';
         $table->id = 'editing-table';
         $table->class = 'generaltable pageeditingtable';
         $table->data = array();
         foreach ($pages as $page) {
             $a = strip_tags(format_string($page->nameone));
             $editalt = get_string('edita', 'format_page', $a);
             $movealt = get_string('movea', 'format_page', $a);
             $delealt = get_string('deletea', 'format_page', $a);
             // Page link/name
             $name = page_pad_string('<a href="' . $PAGE->url_build('page', $page->id) . '" title="' . $a . '">' . format_string($page->nameone) . '</a>', $page->depth);
             // Edit, move and delete widgets
             $widgets = '<a title="' . $editalt . '" href="' . $PAGE->url_build('page', $page->id, 'action', 'editpage', 'returnaction', 'manage') . '" class="icon edit"><img src="' . $CFG->pixpath . '/t/edit.gif" alt="' . $editalt . '" /></a>&nbsp;';
             $widgets .= '<a title="' . $movealt . '" href="' . $PAGE->url_build('action', 'moving', 'moving', $page->id, 'sesskey', sesskey()) . '" class="icon move"><img src="' . $CFG->pixpath . '/t/move.gif" alt="' . $movealt . '" /></a>&nbsp;';
             $widgets .= '<a title="' . $delealt . '" href="' . $PAGE->url_build('action', 'confirmdelete', 'page', $page->id, 'sesskey', sesskey()) . '" class="icon delete"><img src="' . $CFG->pixpath . '/t/delete.gif" alt="' . $delealt . '" /></a>';
             // Theme, menu and publish widgets
             if ($page->parent == 0) {
                 // Only master pages get this one
                 $theme = $this->manage_showhide($page, DISP_THEME);
             } else {
                 //$theme = '';
                 $theme = $this->manage_showhide($page, DISP_THEME);
             }
             $menu = $this->manage_showhide($page, DISP_MENU);
             $publish = $this->manage_showhide($page, DISP_PUBLISH);
             if (empty($page->locks)) {
                 $lockalt = get_string('notlockedalt', 'format_page');
                 $lockicon = 'lock.gif';
             } else {
                 $lockalt = get_string('lockedalt', 'format_page');
                 $lockicon = 'unlock.gif';
             }
             $lock = '<a title="' . $lockalt . '" href="' . $PAGE->url_build('page', $page->id, 'action', 'lock') . '" class="icon lock"><img src="' . $CFG->pixpath . '/t/' . $lockicon . '" alt="' . $lockalt . '" /></a>';
             $table->data[] = array($name, $widgets, $theme, $menu, $publish, $lock);
         }
         print_table($table);
     } else {
         error(get_string('nopages', 'format_page'), $PAGE->url_build('action', 'editpage'));
     }
 }
Esempio n. 2
0
/**
 * Prints a page and recursively prints its children along
 * with move here markers.
 *
 * @param object $page Page object
 * @param int $moving ID of the page that we are moving
 * @return array
 **/
function page_print_moving_hierarchy($page, $moving)
{
    global $USER, $CFG, $PAGE;
    $data = array();
    // Add the page link/name
    $data[] = page_pad_string('<a href="' . $PAGE->url_build('page', $page->id) . '">' . format_string($page->nameone) . '</a>', $page->depth);
    // Add move here for making the moving page a child of this one
    $data[] = page_movehere_widget($moving, $page->id, 0, $page->depth, get_string('asachildof', 'format_page', format_string($page->nameone)));
    // Process all the children
    if (!empty($page->children)) {
        $sortorder = 1;
        foreach ($page->children as $child) {
            if ($moving != $child->id) {
                $data = array_merge($data, page_print_moving_hierarchy($child, $moving));
                $data[] = page_movehere_widget($moving, $page->id, $sortorder, $page->depth, get_string('asachildof', 'format_page', format_string($page->nameone)));
                $sortorder++;
            }
        }
    }
    return $data;
}
Esempio n. 3
0
/**
 * Preps a page name for being added to a menu dropdown
 *
 * @param string $name Page name
 * @param int $amount Amount of padding (Page depth for example)
 * @param int $length Can shorten the name so the dropdown does not get too wide (Pass NULL avoid shortening)
 * @return string
 **/
function page_name_menu($name, $amount, $length = 28)
{
    $name = format_string($name);
    if ($length !== NULL) {
        $name = shorten_text($name, $length);
    }
    return page_pad_string($name, $amount);
}
Esempio n. 4
0
 * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
 */
$moving = optional_param('moving', 0, PARAM_INT);
require_capability('format/page:managepages', $context);
$PAGE->print_tabs('manage');
if ($pages = page_get_all_pages($course->id, 'flat')) {
    $table->head = array(get_string('pagename', 'format_page'), get_string('pageoptions', 'format_page'), get_string('displaytheme', 'format_page'), get_string('displaymenu', 'format_page'), get_string('publish', 'format_page'));
    $table->align = array('left', 'center', 'center', 'center', 'center');
    $table->width = '70%';
    $table->cellspacing = '0';
    $table->id = 'editing-table';
    $table->class = 'generaltable pageeditingtable';
    $table->data = array();
    foreach ($pages as $page) {
        // Page link/name
        $name = page_pad_string('<a href="' . $PAGE->url_build('page', $page->id) . '">' . format_string($page->nameone) . '</a>', $page->depth);
        // Edit, move and delete widgets
        $widgets = '<a href="' . $PAGE->url_build('page', $page->id, 'action', 'editpage', 'returnaction', 'manage') . '" class="icon edit"><img src="' . $CFG->pixpath . '/t/edit.gif" alt="' . get_string('editpage', 'format_page') . '" /></a>&nbsp;';
        $widgets .= '<a href="' . $PAGE->url_build('action', 'moving', 'moving', $page->id, 'sesskey', sesskey()) . '" class="icon move"><img src="' . $CFG->pixpath . '/t/move.gif" /></a>&nbsp;';
        $widgets .= '<a href="' . $PAGE->url_build('action', 'confirmdelete', 'page', $page->id, 'sesskey', sesskey()) . '" class="icon delete"><img src="' . $CFG->pixpath . '/t/delete.gif" alt="' . get_string('deletepage', 'format_page') . '" /></a>';
        // Theme, menu and publish widgets
        if ($page->parent == 0) {
            // Only master pages get this one
            $theme = page_manage_showhide($page, DISP_THEME);
        } else {
            $theme = '';
        }
        $menu = page_manage_showhide($page, DISP_MENU);
        $publish = page_manage_showhide($page, DISP_PUBLISH);
        $table->data[] = array($name, $widgets, $theme, $menu, $publish);
    }