// don't get confused if ($candelete) { $found = false; foreach ($comments as $comment) { if ($comment->deleted) { $found = true; break; } } if ($found) { print '<p class="ouw_deletedcommentinfo">' . get_string('commentdeletedinfo', 'ouwiki') . '</p>'; } } print '<div class="ouwiki_allcomments">'; // OK, display all comments print ouwiki_display_comments($comments, $section, $pagename, $subwiki, $cm, true, $candelete); // And 'add comment' form if ($canpost) { print '<h2>' . get_string('commentpostheader', 'ouwiki') . '</h2>'; print '<a id="post"></a>'; print ouwiki_display_comment_form('comments', $section, $section ? $knownsections[$section] : null, $pagename, $subwiki, $cm); } print '</div>'; // Link to return to page global $CFG, $THEME; print '<div class="ouw_returnlink">' . '<span class="sep">' . $THEME->larrow . '</span> ' . '<a href="view.php?' . ouwiki_display_wiki_parameters($pageversion->title, $subwiki, $cm) . '">' . get_string('returntopage', 'ouwiki') . '</a></div>'; // Footer ouwiki_print_footer($course, $cm, $subwiki, $pagename); ?>
function ouwiki_internal_display_heading_bit($headingnumber, $pagename, $subwiki, $cm, &$comments, $xhtmlid, $annotations, $locked, &$returncomments = false) { global $CFG; $params = ouwiki_display_wiki_parameters($pagename, $subwiki, $cm); $result = ' <div class="ouw_byheading">'; // next link, seems to be, redundent. since it shows up in the Tabs links // so it is not enabled on Page level with: "&& !empty($xhtmlid)" (nadavkav 8-5-2011) if ($subwiki->canedit && !$locked && !empty($xhtmlid)) { $result .= '<a class="ouw_editsection" href="edit.php?' . $params . ($xhtmlid ? '&section=' . $xhtmlid : '') . '">' . get_string($xhtmlid ? 'editsection' : 'editpage', 'ouwiki') . '</a> '; } // output the 'comment on page' link if using per-section comment system $gotcomments = false; if (ouwiki_get_commenting($subwiki->commenting) == OUWIKI_COMMENTS_PERSECTION || ouwiki_get_commenting($subwiki->commenting) == OUWIKI_COMMENTS_BOTH) { $key = $xhtmlid ? $xhtmlid : ''; $url = 'comments.php?' . $params . ($xhtmlid ? '&section=' . $xhtmlid : ''); if (array_key_exists($key, $comments) && $comments[$key]->count > 0) { $a = new StdClass(); $a->count = $comments[$key]->count; $lastcomment = $comments[$key]->comments[count($comments[$key]->comments) - 1]; $a->date = ouwiki_nice_date($lastcomment->timeposted, true, true); $a->plural = $a->count == 1 ? '' : 's'; global $USER; $a->commentlink = '<a class="ouw_revealcomment" href="' . $url . '">' . get_string('commentcount', 'ouwiki', $a) . '</a>'; $result .= '<span class="ouw_commentsinfo">' . get_string('commentinfo', 'ouwiki', $a) . ($USER->id == $lastcomment->userid ? ' (' . get_string('commentbyyou', 'ouwiki') . ')' : '') . '</span> '; $gotcomments = true; } else { if ($subwiki->cancomment) { $result .= '<a class="ouw_makecomment" href="' . $url . '#post">' . get_string($xhtmlid ? 'commentonsection' : 'commentonpage', 'ouwiki') . '</a>'; } $gotcomments = false; } } // output the annotate link if using annotation comment system if (ouwiki_get_commenting($subwiki->commenting) == OUWIKI_COMMENTS_ANNOTATION || ouwiki_get_commenting($subwiki->commenting) == OUWIKI_COMMENTS_BOTH) { // if ($subwiki->canannotate) { // $result.='<a class="ouw_annotate" href="annotate.php?'.$params.'">'. // get_string('annotate','ouwiki').'</a>'; // } if ($annotations != false) { $orphancount = 0; foreach ($annotations as $annotation) { if ($annotation->orphaned == 1) { $orphancount++; } } if (count($annotations) > $orphancount) { $result .= '<span id="showhideannotations"> <a href="javascript:ouwikiShowAllAnnotations(\'block\')" id="showallannotations">' . get_string('showallannotations', 'ouwiki') . '</a> <a href="javascript:ouwikiShowAllAnnotations(\'none\')" id="hideallannotations">' . get_string('hideallannotations', 'ouwiki') . '</a> </span>'; } } } // Addition to offer Save To Portfolio ability for postings global $CFG; if (file_exists(dirname(__FILE__) . '/../portfolio/index.php')) { $modcontext = get_context_instance(CONTEXT_MODULE, $cm->id); if (has_capability('mod/portfolio:doanything', $modcontext, NULL, true, 'portfolio:doanything:false', 'portfolio')) { global $CFG; $wikiposttoportfolio = get_string($xhtmlid ? 'wikisectionposttoportfolio' : 'wikiposttoportfolio', "portfolio"); $result .= '<div style="display: inline; float: right;"><form method="post" action="' . $CFG->wwwroot . '/mod/portfolio/moodle/ouwiki/saveToPortfolio.php?' . $params . ($xhtmlid ? '&section=' . $xhtmlid : '') . '"><div><input type="image" title="' . $wikiposttoportfolio . '" alt="' . $wikiposttoportfolio . '" src="' . $CFG->wwwroot . '/mod/portfolio/html/_design/icon_download.gif" value="save" name="save" style="width: 11px; height: 11px;" class="ouwiki_download_icon"/></div></form></div>'; } } $result .= '</div></div>'; if ($gotcomments) { $commentsresult = '<div class="ouw_hiddencomments" id="ouw_comments_' . $xhtmlid . '">'; $commentsresult .= ouwiki_display_comments($comments[$key]->comments, $xhtmlid, $pagename, $subwiki, $cm); $commentsresult .= '<div class="ouw_hiddencommentoptions">'; if ($comments[$key]->count > count($comments[$key]->comments)) { $a = new StdClass(); $a->count = count($comments[$key]->comments); $a->link = '<a href="' . $url . '">' . get_string('commentsviewall', 'ouwiki') . '</a>'; $commentsresult .= '<span>' . get_string('commentsolder', 'ouwiki', $a) . '</span> '; } else { $commentsresult .= '<span><a href="' . $url . '">' . get_string('commentsviewseparate', 'ouwiki') . '</a></span> '; } if ($subwiki->cancomment) { $commentsresult .= '<a class="ouw_makecomment2" href="' . $url . '#post">' . get_string('commentpostheader', 'ouwiki') . '</a>'; } $commentsresult .= '</div></div>'; if ($returncomments) { $returncomments = $commentsresult; } else { $result .= $commentsresult; } } return $result; }