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("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", $get_file.$image_array['location'].urlencode($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['login']); $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')) && ($user_own==true)){ $template->setCurrentBlock("COMMENT_START"); $color=''; if ((is_admin_for_course()==true) || ($user_own==true)){ if ($comment_array[$i]['status']==DISAPPROVED){ $color="disapproved"; $template->setVariable("MESSAGE", _AT('pa_note_comment_disapproved')); } else if ($comment_array[$i]['status']==POSTED_NEW){ $color="posted_new"; $template->setVariable("MESSAGE", _AT('pa_note_comment_posted_new')); } } $COMMENT_DEL_FORM="blog_del_form"; $COMMENT_DEL_ACTION=DELETE_CONFIRM_ACTION; $COMMENT_DEL=_AT('pa_button_del_comment'); $COMMENT_EDIT_FORM="blog_edit_form"; $COMMENT_EDIT_ACTION=EDIT_ACTION; $COMMENT_EDIT=_AT('pa_button_edit_comment'); $COMMENT_ID=$comment_array[$i]['comment_id']; $COMMENT_CHOOSE=COMMENT; $template->setVariable("COLOR", $color); $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']); $control_button="
"; $control_button.="
"; $control_button.=""; $control_button.=""; $control_button.=""; $control_button.=""; $control_button.="
"; $control_button.="
"; $control_button.=""; $control_button.=""; $control_button.=""; $control_button.=""; $control_button.="
"; $control_button.="
"; $template->setVariable("CONTROL_BUTTONS", $control_button); $template->parseCurrentBlock("COMMENT_START"); } else { $template->setCurrentBlock("COMMENT_START"); $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_START"); } } $template->parseCurrentBlock("COMMENT_HEAD"); } $template->parseCurrentBlock(); $template->show(); } else { $msg->addError('pa_obj_view'); redirect('index.php'); } ?>