isError()!=true){ //no error is occured with the view object, so display view page. $_SESSION['pa']['course_id']=$view->getVariable('course_id'); $_SESSION['pa']['image_id']=$view->getVariable('image_id'); $image_array=$view->getVariable('image_array'); $template=new HTML_Template_ITX("./Template"); $template->loadTemplatefile("view.tpl.php", true, true); $template->setVariable("TITLE", _AT('pa_title_view')); $template->setCurrentBlock("GOBACK_BUTTON"); $template->setVariable("GOBACK_FORM", "goback_form"); $template->setVariable("GOBACK_ACTION", GO_BACK_TO_THUMBNAIL_ACTION); $template->setVariable("GOBACK_DISPLAY", _AT('pa_button_goback_thumbnail')); $template->parseCurrentBlock("GOBACK_BUTTON"); $template->setVariable("IMAGE_TITLE_STRING", _AT('pa_tag_image_title')); $template->setVariable("IMAGE_TITLE", $image_array['title']); $template->setCurrentBlock("IMAGE"); /* display delete and edit buttons for the image */ if (user_own(IMAGE, $_SESSION['pa']['image_id'], $_SESSION['pa']['course_id'])==true){ $template->setCurrentBlock("IMAGE_MODIFY_BUTTONS"); $template->setVariable("IMAGE_CHOOSE", IMAGE); $template->setVariable("EDIT_FORM", "edit_form"); $template->setVariable("EDIT_ACTION", UPLOAD_ACTION); $template->setVariable("EDIT_DISPLAY", _AT('pa_button_edit_image')); $template->setVariable("DEL_FORM", "DEL_action"); $template->setVariable("DEL_ACTION", DELETE_CONFIRM_ACTION); $template->setVariable("DEL_DISPLAY", _AT('pa_button_del_image')); $template->setVariable("IMAGE_ID", $image_array['image_id']); $template->parseCurrentBlock("IMAGE_MODIFY_BUTTONS"); } /* display the image */ $template->setVariable("IMAGE_SRC", $image_array['location'].$image_array['view_image_name']); $template->setVariable("ALT", $image_array['alt']); $template->parseCurrentBlock("IMAGE"); /* display image information */ $template->setCurrentBlock("TABLE"); $template->setVariable("IMAGE_DISPLAY", _AT('pa_tag_image_description')); $image_owner_name=get_member_name($image_array['member_id']); $template->setVariable("IMAGE_NAME_STRING", _AT('name')); $template->setVariable("IMAGE_NAME", $image_owner_name); $template->setVariable("IMAGE_DESC", convert_newlines($image_array['description'])); $template->setVariable("IMAGE_DATE_STRING", _AT('date')); $template->setVariable("IMAGE_DATE", $image_array['date']); $template->parseCurrentBlock("TABLE"); if ($view->getVariable('show_modification_buttons')==true){ $template->setCurrentBlock("ADD_COMMENT_BUTTON"); $template->setVariable("ADD_FORM", "add_form"); $template->setVariable("ADD_ACTION", ADD_ACTION); $template->setVariable("ADD_DISPLAY", _AT('pa_button_add_comment')); $template->setVariable("COMMENT_CHOOSE", COMMENT); $template->parseCurrentBlock("ADD_COMMENT_BUTTON"); } /* display comments */ $comment_array=$view->comment_array; if (count($comment_array) >= 1){ $template->setCurrentBlock("COMMENT_HEAD"); $template->setVariable("COMMENT_DISPLAY", _AT('pa_tag_comment_description')); for ($i=0; $igetVariable('show_modification_buttons')){ $template->setCurrentBlock("COMMENT_WITH_BUTTONS"); $template->setVariable("COMMENT_CHOOSE", COMMENT); $template->setVariable("COMMENT_NAME", $blog_owner_name); $template->setVariable("COMMENT_VALUE", convert_newlines($comment_array[$i]['comment'])); $template->setVariable("COMMENT_DATE", $comment_array[$i]['date']); $template->setVariable("COMMENT_DEL_FORM", "blog_del_form"); $template->setVariable("COMMENT_DEL_ACTION", DELETE_CONFIRM_ACTION); $template->setVariable("COMMENT_DEL", _AT('pa_button_del_comment')); $template->setVariable("COMMENT_EDIT_FORM", "blog_edit_form"); $template->setVariable("COMMENT_EDIT_ACTION", EDIT_ACTION); $template->setVariable("COMMENT_EDIT", _AT('pa_button_edit_comment')); $template->setVariable("COMMENT_ID", $comment_array[$i]['comment_id']); $template->parseCurrentBlock("COMMENT_WITH_BUTTONS"); } else { $template->setCurrentBlock("COMMENT_WITHOUT_BUTTONS"); $template->setVariable("COMMENT_NAME", $blog_owner_name); $template->setVariable("COMMENT_VALUE", convert_newlines($comment_array[$i]['comment'])); $template->setVariable("COMMENT_DATE", $comment_array[$i]['date']); $template->parseCurrentBlock("COMMENT_WITHOUT_BUTTONS"); } } $template->parseCurrentBlock("COMMENT_HEAD"); } $template->parseCurrentBlock(); $template->show(); } else { redirect('../index.php'); } ?>