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("COURSE_PHOTO_URL", BASE_PATH.'index.php'); $template->setVariable("COURSE_PHOTO_ALT", _AT('pa_tag_course_photo_alt')); $template->setVariable("COURSE_PHOTO_IMAGE", COURSE_ALBUM_IMAGE); $template->setVariable("MY_PHOTO_URL", BASE_PATH.'my_photo.php'); $template->setVariable("MY_PHOTO_ALT", _AT('pa_tag_my_photo_alt')); $template->setVariable("MY_PHOTO_IMAGE", MY_ALBUM_IMAGE); $template->setVariable("IMAGE_PAGE_TITLE", _AT('pa_title_index')); $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_number_of_comment($index->getVariable('course_id'), $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", $image_array[$i]['location'].$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){ $template->setCurrentBlock("TABLE_DATA"); $template->setVariable("T_DATA", '\'first_page_button\'/'); $template->parseCurrentBlock("TABLE_DATA"); $template->setCurrentBlock("TABLE_DATA"); $template->setVariable("T_DATA", '\'previous_page_button\'/'); $template->parseCurrentBlock("TABLE_DATA"); } for ($i=$page_array['start']; $i<=$page_array['end']; $i++){ if ($i==$current){ $template->setCurrentBlock("TABLE_DATA"); $template->setVariable("T_DATA", $i); $template->parseCurrentBlock("TABLE_DATA"); } else { $template->setCurrentBlock("TABLE_DATA"); $template->setVariable("T_DATA", ''.$i.''); $template->parseCurrentBlock("TABLE_DATA"); } } if ($index->getVariable('show_page_right_buttons')==true){ $template->setCurrentBlock("TABLE_DATA"); $template->setVariable("T_DATA", '\'next_page_button\'/'); $template->parseCurrentBlock("TABLE_DATA"); $template->setCurrentBlock("TABLE_DATA"); $template->setVariable("T_DATA", '\'last_page_button\'/'); $template->parseCurrentBlock("TABLE_DATA"); } $template->parseCurrentBlock("TABLE_DATA"); $template->parseCurrentBlock("IMAGE_START"); $template->parseCurrentBlock(); $template->show(); } else { redirect('../index.php'); } ?>