3 * Elgg Presentation tool
6 * @package mod_presentation
10 @require_once
("../../includes.php");
13 define("context","presentation");
15 // Load global variables
16 global $CFG, $PAGE, $page_owner, $profile_id, $metatags, $template, $template_name;
18 // Initialise page body and title
20 $title = __gettext("View Presentation");
22 $view = optional_param('view');
23 if ($view == "clean") {
24 // non-elgg in-elgg view
27 templates_page_setup();
30 //var_dump($template_name);
31 $metatags .= "\n" . '<script type="text/javascript" src="' . $CFG->wwwroot
. 'mod/presentation/presentation.js"></script>' . "\n";
33 $template['pageshell'] = file_get_contents($CFG->dirroot
. "mod/presentation/plainviewpageshell.html");
34 $template['css'] = file_get_contents($CFG->dirroot
. "mod/presentation/presentation.css");
35 $template['css'] .= file_get_contents($CFG->dirroot
. "mod/presentation/plainviewpageshell.css");
36 //var_dump($template);
39 $pres = optional_param('id',0,PARAM_INT
);
40 if ($presrec = get_record("presentations", "ident", $pres)) {
41 $page_owner = $presrec->owner
;
42 $profile_id = $page_owner;
43 $ownername = user_info("username",$page_owner);
45 $title = run("profile:display:name", $page_owner) . " :: " . __gettext("View Presentation");
47 if (isloggedin() && $presrec->owner
== $USER->ident
) {
48 $PAGE->menu_sub
[] = array(
49 'name' => 'presentation:edit',
51 $CFG->wwwroot
. $ownername . '/presentations/' . $presrec->ident
. '/edit',
57 $PAGE->menu_sub
[] = array(
58 'name' => 'presentation:edit',
60 $CFG->wwwroot
. $ownername . '/presentations/' . $presrec->ident
. '/clean',
61 __gettext("Plain View")
65 if ($view != "clean") {
66 templates_page_setup();
69 $presentationsallowed = presentation_get_presentations_visible($page_owner);
70 //var_dump($presentationsallowed);
72 if ($presrec && $presentationsallowed && array_key_exists($presrec->ident
, $presentationsallowed)) {
74 $tinymceids = array();
77 if ($view == "clean") {
78 $body .= '<a href="' . $CFG->wwwroot
. $ownername . '/profile/">' . run("profile:display:name", $presrec->owner
) . '</a> :: ';
80 $body .= htmlspecialchars($presrec->name
) . "</h1>";
82 if ($view == "clean") {
85 $disableaddcommentsform = true;
89 $disableaddcommentsform = false;
91 if ($sections = presentation_get_sections($presrec->ident
)) {
92 //var_dump($sections);
94 $body .= '<div class="presentation-contentslist"><h2><a href="javascript:toggleVisibility(\'presentationcontentslist\')">' . __gettext('Contents') . '</a></h2><ol id="presentationcontentslist">';
96 foreach ($sections as $asection) {
97 $atitle = presentation_section_gettitle($asection);
98 $body .= '<li><a href="#sectop' . $i . '">' . $atitle . '</a></li>';
102 <script type="text/javascript">
104 toggleVisibility(\'presentationcontentslist\');
106 </script><!-- --></div>
110 foreach ($sections as $asection) {
111 $body .= '<a name="sectop' . $i . '"></a>' . presentation_section_display($asection, $menuedit, $menucomments, $disableaddcommentsform);
112 $tinymceids[] = 'commentbodyp' . $presrec->ident
. 's' . $asection->ident
;
117 $body .= "<p>" . __gettext("This presentation doesn't have any content yet.") . "</p>\n";
121 if ($comments = presentation_get_comments($presrec->ident
, 0)) {
122 $numcomments = count($comments);
125 if ($view == "clean") {
126 $body .= '<a href="javascript:toggleVisibility(\'presentationoverallcomments\')">';
128 $body .= sprintf(__gettext('%s Presentation Comments'), $numcomments);
129 if ($view == "clean") {
133 $body .= '<div id="presentationoverallcomments">';
136 $body .= presentation_comments_display($presrec->ident
, 0, $comments);
139 if (logged_on ||
(!$CFG->disable_publiccomments
&& user_flag_get("publiccomments",$presrec->owner
)) ) {
140 $tinymceids[] = 'commentbodyp' . $presrec->ident
. 's0';
141 $body .= presentation_comments_add_form($presrec->ident
, 0, $_SERVER['REQUEST_URI']);
143 $body .= "<p>" . __gettext("You must be logged in to post a comment.") . "</p>";
148 if ($view == "clean") {
150 <script type
="text/javascript">
152 toggleVisibility('presentationoverallcomments');
159 run('tinymce:include', array($tinymceids) );
162 $body = __gettext('Error: Access denied.');
165 $body = __gettext('Error: Presentation not found.');
175 if ($view == "clean") {
177 // non-elgg in-elgg view
178 echo templates_page_draw( array(
185 // Output to the screen
186 $body = templates_draw(array(
187 'context' => 'contentholder',
193 echo templates_page_draw( array(