+++ /dev/null
-<?php\r
-/*==============================================================\r
- Photo Album\r
- ==============================================================\r
- Copyright (c) 2006 by Dylan Cheon & Kelvin Wong\r
- Institute for Assistive Technology / University of Victoria\r
- http://www.canassist.ca/ \r
- \r
- This program is free software. You can redistribute it and/or\r
- modify it under the terms of the GNU General Public License \r
- as published by the Free Software Foundation. \r
- ==============================================================\r
- */\r
-// $Id:\r
-\r
-/**\r
- * @desc This file displays the view page used to display an image and its thread of comments\r
- * @author Dylan Cheon & Kelvin Wong\r
- * @copyright 2006, Institute for Assistive Technology / University of Victoria \r
- * @link http://www.canassist.ca/ \r
- * @license GNU\r
- */\r
-define('AT_INCLUDE_PATH', '../../include/');\r
-require_once(AT_INCLUDE_PATH.'vitals.inc.php');\r
-$_custom_css = $_base_path . 'mods/photo_album/module.css'; // use a custom stylesheet\r
-require_once (AT_INCLUDE_PATH.'header.inc.php');\r
-\r
-?>\r
-\r
-<?php \r
-require_once ('define.php');\r
-require_once ('HTML/Template/ITX.php');\r
-require_once ('classes/pa_view.class.php');\r
-\r
-$view=new View();\r
-$admin_mode=$_SESSION['pa']['administrator_mode']; //save the admin mode if it is true;\r
-$instructor_mode=$_SESSION['pa']['instructor_mode']; //save the instructor mode if it is true;\r
-unset($_SESSION['pa']);\r
-$_SESSION['pa']['administrator_mode']=$admin_mode;\r
-$_SESSION['pa']['instructor_mode']=$instructor_mode;\r
-\r
-if ($view->isError()!=true){ //no error is occured with the view object, so display view page.\r
- $_SESSION['pa']['course_id']=$view->getVariable('course_id');\r
- $_SESSION['pa']['image_id']=$view->getVariable('image_id');\r
- \r
- $image_array=$view->getVariable('image_array'); \r
- $template=new HTML_Template_ITX("./Template");\r
- $template->loadTemplatefile("view.tpl.php", true, true);\r
- \r
- $template->setVariable("IMAGE_TITLE_STRING", _AT('pa_tag_image_title'));\r
- $template->setVariable("IMAGE_TITLE", $image_array['title']);\r
- $template->setCurrentBlock("IMAGE");\r
- \r
- /* display delete and edit buttons for the image */\r
- if (user_own(IMAGE, $_SESSION['pa']['image_id'], $_SESSION['pa']['course_id'])==true){\r
- $template->setCurrentBlock("IMAGE_MODIFY_BUTTONS");\r
- $template->setVariable("IMAGE_CHOOSE", IMAGE);\r
- $template->setVariable("EDIT_FORM", "edit_form");\r
- $template->setVariable("EDIT_ACTION", UPLOAD_ACTION);\r
- $template->setVariable("EDIT_DISPLAY", _AT('pa_button_edit_image'));\r
- $template->setVariable("DEL_FORM", "DEL_action");\r
- $template->setVariable("DEL_ACTION", DELETE_CONFIRM_ACTION); \r
- $template->setVariable("DEL_DISPLAY", _AT('pa_button_del_image'));\r
- $template->setVariable("IMAGE_ID", $image_array['image_id']);\r
- $template->parseCurrentBlock("IMAGE_MODIFY_BUTTONS");\r
- }\r
- \r
- /* display the image */\r
- $template->setVariable("IMAGE_SRC", $get_file.$image_array['location'].urlencode($image_array['view_image_name']));\r
- $template->setVariable("ALT", $image_array['alt']);\r
- $template->parseCurrentBlock("IMAGE");\r
- \r
- \r
- /* display image information */\r
- $template->setCurrentBlock("TABLE");\r
- $template->setVariable("IMAGE_DISPLAY", _AT('pa_tag_image_description'));\r
- $image_owner_name=get_member_name($image_array['login']);\r
- $template->setVariable("IMAGE_NAME_STRING", _AT('name'));\r
- $template->setVariable("IMAGE_NAME", $image_owner_name);\r
- $template->setVariable("IMAGE_DESC", convert_newlines($image_array['description']));\r
- $template->setVariable("IMAGE_DATE_STRING", _AT('date'));\r
- $template->setVariable("IMAGE_DATE", $image_array['date']);\r
- $template->parseCurrentBlock("TABLE");\r
- \r
- if ($view->getVariable('show_modification_buttons')==true){\r
- $template->setCurrentBlock("ADD_COMMENT_BUTTON");\r
- $template->setVariable("ADD_FORM", "add_form");\r
- $template->setVariable("ADD_ACTION", ADD_ACTION);\r
- $template->setVariable("ADD_DISPLAY", _AT('pa_button_add_comment'));\r
- $template->setVariable("COMMENT_CHOOSE", COMMENT);\r
- $template->parseCurrentBlock("ADD_COMMENT_BUTTON");\r
- }\r
- \r
- /* display comments */\r
- $comment_array=$view->comment_array; \r
- if (count($comment_array) >= 1){\r
- $template->setCurrentBlock("COMMENT_HEAD");\r
- $template->setVariable("COMMENT_DISPLAY", _AT('pa_tag_comment_description'));\r
- \r
- for ($i=0; $i<count($comment_array); $i++){\r
- $blog_owner_name=get_member_name($comment_array[$i]['login']);\r
- $user_own=user_own(COMMENT, $comment_array[$i]['image_id'], $comment_array[$i]['course_id'], $comment_array[$i]['comment_id']);\r
- if (($comment_array[$i]['status']!=APPROVED) && ($user_own!=true)){\r
- continue;\r
- } \r
- if (($view->getVariable('show_modification_buttons')) && ($user_own==true)){\r
- $template->setCurrentBlock("COMMENT_START");\r
- $color='';\r
- if ((is_admin_for_course()==true) || ($user_own==true)){\r
- if ($comment_array[$i]['status']==DISAPPROVED){\r
- $color="disapproved";\r
- $template->setVariable("MESSAGE", _AT('pa_note_comment_disapproved'));\r
- } else if ($comment_array[$i]['status']==POSTED_NEW){\r
- $color="posted_new";\r
- $template->setVariable("MESSAGE", _AT('pa_note_comment_posted_new'));\r
- }\r
- }\r
- $COMMENT_DEL_FORM="blog_del_form";\r
- $COMMENT_DEL_ACTION=DELETE_CONFIRM_ACTION;\r
- $COMMENT_DEL=_AT('pa_button_del_comment');\r
- \r
- $COMMENT_EDIT_FORM="blog_edit_form";\r
- $COMMENT_EDIT_ACTION=EDIT_ACTION;\r
- $COMMENT_EDIT=_AT('pa_button_edit_comment');\r
- $COMMENT_ID=$comment_array[$i]['comment_id'];\r
- $COMMENT_CHOOSE=COMMENT;\r
- \r
- \r
- $template->setVariable("COLOR", $color);\r
- $template->setVariable("COMMENT_NAME", $blog_owner_name);\r
- $template->setVariable("COMMENT_VALUE", convert_newlines($comment_array[$i]['comment']));\r
- $template->setVariable("COMMENT_DATE", $comment_array[$i]['date']);\r
- \r
- $control_button="<div class=\"row buttons\">";\r
- $control_button.="<form name=\"blog_del_form\" method=\"post\" action=\"".$COMMENT_DEL_ACTION."\">";\r
- $control_button.="<input type=\"submit\" name=\"delete\" value=\"".$COMMENT_DEL."\"/>";\r
- $control_button.="<input type=\"hidden\" name=\"mode\" value=\"delete\"/>";\r
- $control_button.="<input type=\"hidden\" name=\"comment_id\" value=\"".$COMMENT_ID."\"/>";\r
- $control_button.="<input type=\"hidden\" name=\"choose\" value=\"".$COMMENT_CHOOSE."\"/>";\r
- $control_button.="</form>";\r
- \r
- \r
- $control_button.="<form name=\"blog_edit_form\" method=\"post\" action=\"".$COMMENT_EDIT_ACTION."\">";\r
- $control_button.="<input type=\"submit\" name=\"edit\" value=\"".$COMMENT_EDIT."\"/>";\r
- $control_button.="<input type=\"hidden\" name=\"mode\" value=\"edit\"/>";\r
- $control_button.="<input type=\"hidden\" name=\"comment_id\" value=\"".$COMMENT_ID."\"/>";\r
- $control_button.="<input type=\"hidden\" name=\"choose\" value=\"".$COMMENT_CHOOSE."\"/>";\r
- $control_button.="</form>";\r
- $control_button.="</div>";\r
- \r
- \r
- $template->setVariable("CONTROL_BUTTONS", $control_button);\r
- $template->parseCurrentBlock("COMMENT_START");\r
- } else {\r
- $template->setCurrentBlock("COMMENT_START");\r
- $template->setVariable("COMMENT_NAME", $blog_owner_name);\r
- $template->setVariable("COMMENT_VALUE", convert_newlines($comment_array[$i]['comment']));\r
- $template->setVariable("COMMENT_DATE", $comment_array[$i]['date']);\r
- $template->parseCurrentBlock("COMMENT_START");\r
- }\r
- }\r
- $template->parseCurrentBlock("COMMENT_HEAD");\r
- }\r
- \r
- $template->parseCurrentBlock();\r
- $template->show();\r
-} else {\r
- $msg->addError('pa_obj_view');\r
- redirect('index.php');\r
-} \r
-?>\r
-\r
-<?php require_once(AT_INCLUDE_PATH.'footer.inc.php'); ?>\r