Hazırlamış olduğum ADVTemplateListView Class dosyasının kodu şöyle:
<?php /** * This class is used to represent the view part of the Template List. * * @author Behçet MUTLU * @copyright 2009 */ class ADVTemplateListView { private $templateList; private $currentPage; private $pageSize; /** * ADVTemplateListView::__constructor() * * This is the default constructor of the view class. * * @param mixed $templateList * @param integer $currentPage * @param integer $pageSize * @return void */ public function __construct($templateList, $currentPage = 0, $pageSize = 4) { $this->templateList = $templateList; $this->currentPage = $currentPage; $this->pageSize = $pageSize; } public function getNextPage() { $output = "<ul class=\"tmpList\">"; $currentIndex = $this->currentPage * $this->pageSize; $nextIndex = min($currentIndex + $this->pageSize, $this->templateList->getTemplateCount()); for($i = $currentIndex; $i < $nextIndex; $i++) { $output.= $this->_toHTML($this->templateList->getTemplateAt($i)); } $output.= "</ul>"; $this->currentPage += 1; return $output; } /** * ADVTemplateListView::_toHTML() * * This method is used to get the HTML output of template thumbnail * * <li> * <a href="#">Şablon #4</a> * <div class="thumb"><img src="adv_templates/template1/thumb.jpg" width="178" height="148" /></div> * </li> * * @param mixed $template * @return */ private function _toHTML($template) { $output = "<li>"; $output.= "<a href=\"#\">" . $template->getName() . "</a>"; $output.="<div class=\"thumb\"><img src=\"". $template->getThumbnail() ."\" width=\"178\" height=\"148\"></div>"; return $output . "</li>"; } } ?>
0 yorum:
Yorum Gönder