addError('pa_var_unauthorized'); redirect('index.php'); } $my=new Mycomment(); if ($my->isError()!=true){ //no error is occured $course_id=$_SESSION['pa']['course_id']; //store course_id temporarily unset($_SESSION['pa']); //clear pa session variables $_SESSION['pa']['course_id']=$course_id; $_SESSION['pa']['my_pic_mode']=true; $template=new HTML_Template_ITX("./Template"); $template->loadTemplateFile("my_comment.tpl.php"); switch ($my->getVariable('mode')){ case POSTED_NEW: $template->setVariable("TITLE", _AT('pa_title_my_comment_new')); break; case APPROVED: $template->setVariable("TITLE", _AT('pa_title_my_comment_approved')); break; case DISAPPROVED: $template->setVariable("TITLE", _AT('pa_title_my_comment_disapproved')); break; } $template->setVariable("MAIN_URL", BASE_PATH.'index.php'); $template->setVariable("MAIN_TITLE", _AT('pa_tag_course_photo_alt')); $template->setVariable("MY_PHOTO_URL", BASE_PATH.'my_photo.php'); $template->setVariable("MY_PHOTO_TITLE", _AT('pa_tag_my_photo_alt')); $template->setVariable("MY_COMMENT_URL", BASE_PATH.'my_comment.php'); $template->setVariable("MY_COMMENT_TITLE", _AT('pa_tag_my_comment_alt')); $template->setCurrentBlock("SELECT_PART"); $template->setVariable("DESTINATION", BASE_PATH.'my_comment.php?mode='.POSTED_NEW.SEP.'current_page='.$my->getVariable('current_page')); $template->setVariable("LINK_TEXT", _AT('pa_tag_new_comment').' | '); $template->parseCurrentBlock("SELECT_PART"); $template->setCurrentBlock("SELECT_PART"); $template->setVariable("DESTINATION", BASE_PATH.'my_comment.php?mode='.APPROVED.SEP.'current_page='.$my->getVariable('current_page')); $template->setVariable("LINK_TEXT", _AT('pa_tag_approved_comment').' | '); $template->parseCurrentBlock("SELECT_PART"); $template->setCurrentBlock("SELECT_PART"); $template->setVariable("DESTINATION", BASE_PATH.'my_comment.php?mode='.DISAPPROVED.SEP.'current_page='.$my->getVariable('current_page')); $template->setVariable("LINK_TEXT", _AT('pa_tag_disapproved_comment')); $template->parseCurrentBlock("SELECT_PART"); /* start display comments */ $comment_array=$my->comment_array; for ($i=0; $isetCurrentBlock("COMMENT_TABLE_DATA"); $template->setVariable("CHECK_NAME", "commentId".$i); $template->setVariable("CHECK_VALUE", $comment_array[$i]['comment_id']); $template->setVariable("COMMENT_TABLE_DATA1", $comment_array[$i]['comment']); $img_data=get_single_data(IMAGE, $comment_array[$i]['image_id'], $comment_array[$i]['course_id']); $template->setVariable("COMMENT_TABLE_DATA2", _AT('title').": ".$img_data['title']); $template->setVariable("COMMENT_TABLE_DATA3", _AT('date').": ".$comment_array[$i]['date']); if ($img_data['status']==APPROVED){ $template->setVariable("COMMENT_TABLE_DATA4", ""._AT('pa_tag_view_comment_link').""); } else { $template->setVariable("COMMENT_TABLE_DATA4", _AT('pa_tag_image_not_approved')); } $template->parseCurrentBlock("COMMENT_TABLE_DATA"); } // Display page table $page_array=$my->getVariable('page_array'); $current=$my->getVariable('current_page'); $template->setCurrentBlock("PAGE_TABLE_PART"); if ($my->getVariable('show_page_left_buttons')==true){ $first_button=_AT('pa_tag_first_page_button'); $previous_button=_AT('pa_tag_previous_page_button'); $template->setCurrentBlock("B_DATA_PART"); $template->setVariable("B_DATA", '
  • getVariable('mode').'\'>\''.$first_button.'\'
  • '); $template->parseCurrentBlock("B_DATA_PART"); $template->setCurrentBlock("B_DATA_PART"); $template->setVariable("B_DATA", '
  • getVariable('mode').'\'>\''.$previous_button.'\'
  • '); $template->parseCurrentBlock("B_DATA_PART"); } for ($i=$page_array['start']; $i<=$page_array['end']; $i++){ if ($i==$current){ $template->setCurrentBlock("B_DATA_PART"); $template->setVariable("B_DATA", '
  • '.$i.'
  • '); $template->parseCurrentBlock("B_DATA_PART"); } else { $template->setCurrentBlock("B_DATA_PART"); $template->setVariable("B_DATA", '
  • getVariable('mode').'\'>'.$i.'
  • '); $template->parseCurrentBlock("B_DATA_PART"); } } if ($my->getVariable('show_page_right_buttons')==true){ $next_button=_AT('pa_tag_next_page_button'); $last_button=_AT('pa_tag_last_page_button'); $template->setCurrentBlock("B_DATA_PART"); $template->setVariable("B_DATA", '
  • getVariable('mode').'\'>\''.$next_button.'\'
  • '); $template->parseCurrentBlock("B_DATA_PART"); $template->setCurrentBlock("B_DATA_PART"); $template->setVariable("B_DATA", '
  • getVariable('mode').'\'>\''.$last_button.'\'
  • '); $template->parseCurrentBlock("B_DATA_PART"); } $template->parseCurrentBlock("PAGE_TABLE_PART"); $template->parseCurrentBlock(); $template->show(); } else { $msg->addError('pa_obj_mypic'); redirect('index.php'); } ?>