isError()!=true){ //if there is no error in index object, display the index page $_SESSION['pa']['course_id']=$index->getVariable('course_id'); /* display index page from here */ $template=new HTML_Template_ITX("./Template"); $template->loadTemplatefile("index.tpl.php", true, true); /* display images */ $template->setCurrentBlock("IMAGE_START"); $template->setVariable("IMAGE_PAGE_TITLE", _AT('pa_title_index')); $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')); $image_array=$index->getVariable('image_array'); for ($i=0; $i < count($image_array); $i++) { $template->setCurrentBlock("IMAGE_DISPLAY"); $template->setVariable("LINK", $image_array[$i]['link']); $count=get_total_comment_number(STUDENT, $index->getVariable('course_id'), APPROVED, $image_array[$i]['image_id']); if ($count >0 ){ $template->setVariable("IMAGE_TITLE", $image_array[$i]['title']." [".$count."]"); } else { $template->setVariable("IMAGE_TITLE", $image_array[$i]['title']); } $template->setVariable("IMAGE_SRC", $get_file.$image_array[$i]['location'].urlencode($image_array[$i]['thumb_image_name'])); $template->setVariable("IMAGE_ALT", $image_array[$i]['alt']); $template->parseCurrentBlock("IMAGE_DISPLAY"); } if ($index->getVariable('show_modification_buttons')==true){ $template->setCurrentBlock("IMAGE_ADD_BUTTON"); $template->setVariable("FORM_NAME", "thumb_form"); $template->setVariable("ACTION", UPLOAD_ACTION); $template->setVariable("ADD_STRING", _AT('pa_button_add_image')); $template->setVariable("CHOOSE_VALUE", IMAGE); $template->parseCurrentBlock("IMAGE_ADD_BUTTON"); } /* Display page table */ $page_array=&$index->getVariable('page_array'); $current=$index->getVariable('current_page'); if ($index->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", '
  • \''.$first_button.'\'
  • '); $template->parseCurrentBlock("B_DATA_PART"); $template->setCurrentBlock("B_DATA_PART"); $template->setVariable("B_DATA", '
  • \''.$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", '
  • '.$i.'
  • '); $template->parseCurrentBlock("B_DATA_PART"); } } if ($index->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", '
  • \''.$next_button.'\'
  • '); $template->parseCurrentBlock("B_DATA_PART"); $template->setCurrentBlock("B_DATA_PART"); $template->setVariable("B_DATA", '
  • \''.$last_button.'\'
  • '); $template->parseCurrentBlock("B_DATA_PART"); } $template->parseCurrentBlock("B_DATA_PART"); $template->parseCurrentBlock("IMAGE_START"); $template->parseCurrentBlock(); $template->show(); } else { $msg->addError('pa_obj_pa_index'); redirect('../../index.php'); } ?>