Esempio n. 1
0
 /**
  * Prints the header and (if applicable) group selector.
  *
  * @param object $ouwiki Wiki object
  * @param object $cm Course-modules object
  * @param object $course
  * @param object $subwiki Subwiki objecty
  * @param string $pagename Name of page
  * @param object $context Context object
  * @param string $afterpage If included, extra content for navigation string after page link
  * @param bool $hideindex If true, doesn't show the index/recent pages links
  * @param bool $notabs If true, prints the after-tabs div here
  * @param string $head Things to include inside html head
  * @param string $title
  * @param string $querytext for use when changing groups against search criteria
  */
 public function ouwiki_print_start($ouwiki, $cm, $course, $subwiki, $pagename, $context, $afterpage = null, $hideindex = null, $notabs = null, $head = '', $title = '', $querytext = '')
 {
     $output = '';
     if ($pagename == null) {
         $pagename = '';
     }
     ouwiki_print_header($ouwiki, $cm, $subwiki, $pagename, $afterpage, $head, $title);
     $canview = ouwiki_can_view_participation($course, $ouwiki, $subwiki, $cm);
     $page = basename($_SERVER['PHP_SELF']);
     // Gather params for later use - saves passing as attributes within the renderer.
     $this->params = new StdClass();
     $this->params->ouwiki = $ouwiki;
     $this->params->cm = $cm;
     $this->params->subwiki = $subwiki;
     $this->params->course = $course;
     $this->params->pagename = $pagename;
     $this->params->hideindex = $hideindex;
     $this->params->canview = $canview;
     $this->params->page = $page;
     // Add wiki name header.
     $output .= $this->get_wiki_heading_text();
     // Add rss and atom feeds.
     $output .= $this->get_feeds_section();
     // Add group/user selector.
     $showselector = true;
     if ($page == 'userparticipation.php' && $canview != OUWIKI_MY_PARTICIPATION || $page == 'participation.php' && (int) $ouwiki->subwikis == OUWIKI_SUBWIKIS_INDIVIDUAL) {
         $showselector = false;
     }
     if ($showselector) {
         $selector = ouwiki_display_subwiki_selector($subwiki, $ouwiki, $cm, $context, $course, $page, $querytext);
         $output .= $selector;
     }
     // Add index links.
     list($content, $participationstr) = $this->ouwiki_get_links();
     $output .= $content;
     // Add page heading.
     $output .= $this->ouwiki_get_page_heading($participationstr);
     $output .= html_writer::div('', 'clearer');
     if ($notabs) {
         $extraclass = $selector ? ' ouwiki_gotselector' : '';
         $output .= html_writer::div('', 'ouwiki_notabs' . $extraclass, array('id' => 'ouwiki_belowtabs'));
     }
     return $output;
 }
Esempio n. 2
0
 /**
  * Prints the header and (if applicable) group selector.
  *
  * @param object $ouwiki Wiki object
  * @param object $cm Course-modules object
  * @param object $course
  * @param object $subwiki Subwiki objecty
  * @param string $pagename Name of page
  * @param object $context Context object
  * @param string $afterpage If included, extra content for navigation string after page link
  * @param bool $hideindex If true, doesn't show the index/recent pages links
  * @param bool $notabs If true, prints the after-tabs div here
  * @param string $head Things to include inside html head
  * @param string $title
  */
 public function ouwiki_print_start($ouwiki, $cm, $course, $subwiki, $pagename, $context, $afterpage = null, $hideindex = null, $notabs = null, $head = '', $title = '')
 {
     global $USER;
     $output = '';
     ouwiki_print_header($ouwiki, $cm, $subwiki, $pagename, $afterpage, $head, $title);
     $canview = ouwiki_can_view_participation($course, $ouwiki, $subwiki, $cm);
     $page = basename($_SERVER['PHP_SELF']);
     // Print group/user selector
     $showselector = true;
     if ($page == 'userparticipation.php' && $canview != OUWIKI_USER_PARTICIPATION || $page == 'participation.php' && (int) $ouwiki->subwikis == OUWIKI_SUBWIKIS_INDIVIDUAL) {
         $showselector = false;
     }
     if ($showselector) {
         $selector = ouwiki_display_subwiki_selector($subwiki, $ouwiki, $cm, $context, $course, $page);
         $output .= $selector;
     }
     // Print index link
     if (!$hideindex) {
         $output .= html_writer::start_tag('div', array('id' => 'ouwiki_indexlinks'));
         $output .= html_writer::start_tag('ul');
         if ($page == 'wikiindex.php') {
             $output .= html_writer::start_tag('li', array('id' => 'ouwiki_nav_index'));
             $output .= html_writer::start_tag('span');
             $output .= get_string('index', 'ouwiki');
             $output .= html_writer::end_tag('span');
             $output .= html_writer::end_tag('li');
         } else {
             $output .= html_writer::start_tag('li', array('id' => 'ouwiki_nav_index'));
             $output .= html_writer::tag('a', get_string('index', 'ouwiki'), array('href' => 'wikiindex.php?' . ouwiki_display_wiki_parameters('', $subwiki, $cm, OUWIKI_PARAMS_URL)));
             $output .= html_writer::end_tag('li');
         }
         if ($page == 'wikihistory.php') {
             $output .= html_writer::start_tag('li', array('id' => 'ouwiki_nav_history'));
             $output .= html_writer::start_tag('span');
             $output .= get_string('wikirecentchanges', 'ouwiki');
             $output .= html_writer::end_tag('span');
             $output .= html_writer::end_tag('li');
         } else {
             $output .= html_writer::start_tag('li', array('id' => 'ouwiki_nav_history'));
             $output .= html_writer::tag('a', get_string('wikirecentchanges', 'ouwiki'), array('href' => 'wikihistory.php?' . ouwiki_display_wiki_parameters('', $subwiki, $cm, OUWIKI_PARAMS_URL)));
             $output .= html_writer::end_tag('li');
         }
         if ($canview == OUWIKI_USER_PARTICIPATION) {
             $participationstr = get_string('participationbyuser', 'ouwiki');
             $participationpage = 'participation.php?' . ouwiki_display_wiki_parameters('', $subwiki, $cm, OUWIKI_PARAMS_URL);
         } else {
             if ($canview == OUWIKI_MY_PARTICIPATION) {
                 $participationstr = get_string('myparticipation', 'ouwiki');
                 $participationpage = 'userparticipation.php?' . ouwiki_display_wiki_parameters('', $subwiki, $cm, OUWIKI_PARAMS_URL);
                 $participationpage .= '&user='******'&group=' . $subwiki->groupid;
         }
         if ($canview > OUWIKI_NO_PARTICIPATION) {
             if ($page == 'participation.php' || $page == 'userparticipation.php') {
                 $output .= html_writer::start_tag('li', array('id' => 'ouwiki_nav_participation'));
                 $output .= html_writer::start_tag('span');
                 $output .= $participationstr;
                 $output .= html_writer::end_tag('span');
                 $output .= html_writer::end_tag('li');
             } else {
                 $output .= html_writer::start_tag('li', array('id' => 'ouwiki_nav_participation'));
                 $output .= html_writer::tag('a', $participationstr, array('href' => $participationpage));
                 $output .= html_writer::end_tag('li');
             }
         }
         $output .= html_writer::end_tag('ul');
         $output .= html_writer::end_tag('div');
     } else {
         $output .= html_writer::start_tag('div', array('id' => 'ouwiki_noindexlink'));
         $output .= html_writer::end_tag('div');
     }
     $output .= html_writer::start_tag('div', array('class' => 'clearer'));
     $output .= html_writer::end_tag('div');
     if ($notabs) {
         $extraclass = $selector ? ' ouwiki_gotselector' : '';
         $output .= html_writer::start_tag('div', array('id' => 'ouwiki_belowtabs', 'class' => 'ouwiki_notabs' . $extraclass));
         $output .= html_writer::end_tag('div');
     }
     return $output;
 }
/**
 * Prints the header and (if applicable) group selector.
 * @param object $ouwiki Wiki object
 * @param object $cm Course-modules object
 * @param object $subwiki Subwiki objecty
 * @param string $pagename Name of page
 * @param object $context Context object
 * @param string $afterpage If included, extra content for navigation string after page link
 * @param bool $hideindex If true, doesn't show the index/recent pages links
 * @param bool $notabs If true, prints the after-tabs div here
 * @param string $head Things to include inside html head
 */
function ouwiki_print_start($ouwiki, $cm, $course, $subwiki, $pagename, $context, $afterpage = null, $hideindex = false, $notabs = false, $head = '', $title = '')
{
    $wikiname = format_string(htmlspecialchars($ouwiki->name));
    // Print header
    $strwiki = get_string("modulename", "ouwiki");
    $strwikis = get_string("modulenameplural", "ouwiki");
    $buttontext = update_module_button($cm->id, $course->id, $strwiki);
    $extranavigation = array();
    if ($afterpage && $pagename) {
        $extranavigation[] = array('name' => htmlspecialchars($pagename), 'type' => 'ouwiki', 'link' => 'view.php?' . ouwiki_display_wiki_parameters($pagename, $subwiki, $cm));
    } else {
        if ($pagename) {
            $extranavigation[] = array('name' => htmlspecialchars($pagename), 'type' => 'ouwiki');
        } else {
            if ($afterpage) {
                $extranavigation[] = array('name' => get_string('startpage', 'ouwiki'), 'type' => 'ouwiki');
            } else {
            }
        }
    }
    if ($afterpage) {
        foreach ($afterpage as $element) {
            $extranavigation[] = $element;
        }
    }
    if (empty($title)) {
        $title = $wikiname;
    }
    $navigation = build_navigation($extranavigation, $cm);
    print_header_simple($title, "", $navigation, "", $head, true, $buttontext, navmenu($course, $cm));
    // Print group selector
    $selector = ouwiki_display_subwiki_selector($subwiki, $ouwiki, $cm, $context, $course);
    print $selector;
    // Print index link
    if (!$hideindex) {
        print '<div id="ouwiki_indexlinks">';
        print '<ul>';
        $isindex = basename($_SERVER['PHP_SELF']) == 'wikiindex.php';
        if ($isindex) {
            print '<li id="ouwiki_nav_index"><span>' . get_string('index', 'ouwiki') . '</span></li>';
        } else {
            print '<li id="ouwiki_nav_index"><a href="wikiindex.php?' . ouwiki_display_wiki_parameters(null, $subwiki, $cm) . '">' . get_string('index', 'ouwiki') . '</a></li>';
        }
        $ishistory = basename($_SERVER['PHP_SELF']) == 'wikihistory.php';
        if ($ishistory) {
            print '<li id="ouwiki_nav_history"><span>' . get_string('wikirecentchanges', 'ouwiki') . '</span></li>';
        } else {
            print '<li id="ouwiki_nav_history"><a href="wikihistory.php?' . ouwiki_display_wiki_parameters(null, $subwiki, $cm) . '">' . get_string('wikirecentchanges', 'ouwiki') . '</a></li>';
        }
        $isreports = basename($_SERVER['PHP_SELF']) == 'reportssummary.php';
        if ($isreports) {
            print '<li id="ouwiki_nav_report"><span>' . get_string('reports', 'ouwiki') . '</span></li>';
        } else {
            if (has_capability('mod/ouwiki:viewcontributions', $context)) {
                print '<li id="ouwiki_nav_report"><a href="reportssummary.php?' . ouwiki_display_wiki_parameters(null, $subwiki, $cm) . '">' . get_string('reports', 'ouwiki') . '</a></li>';
            }
        }
        print '</ul>';
        if (ouwiki_search_installed()) {
            print '<form action="search.php" method="get"><div>';
            print ouwiki_display_wiki_parameters(null, $subwiki, $cm, OUWIKI_PARAMS_FORM);
            print '<label for="ouw_searchbox" class="accesshide">' . get_string('search', 'ouwiki') . '</label>';
            $query = stripslashes(optional_param('query', '', PARAM_RAW));
            print '<input type="text" id="ouw_searchbox" name="query" ' . ($query ? 'value="' . htmlspecialchars($query) . '" ' : '') . '/>';
            print '<input type="submit" value="' . get_string('search', 'ouwiki') . '" /></div></form>';
        }
        print '</div>';
    } else {
        print '<div id="ouwiki_noindexlink"></div>';
    }
    //adding a link to the computing guide
    if (class_exists('ouflags')) {
        global $CFG;
        require_once $CFG->dirroot . '/local/utils_shared.php';
        $computingguidelink = get_link_to_computing_guide('ouwiki');
        print '<span class="computing-guide"> ' . $computingguidelink . '</span>';
    }
    print '<div class="clearer"></div>';
    if ($notabs) {
        $extraclass = $selector ? ' ouwiki_gotselector' : '';
        print '<div id="ouwiki_belowtabs" class="ouwiki_notabs' . $extraclass . '">';
    }
}