Víkend s OZ VMS v duchu stolnotenisového turnaja

(17.2.2012) V nedeľu 12. februára 2012 sa konal vo Vlachove v poradí už tretí ročník stolnotenisového turnaja VMS CUP, ktorého organizátorom bolo obč. združenie Vlachovo motorsport team ...viac


path = $path; $this->nOfPhotosOnPage = $nOfPhotosOnPage; $this->nOfPhotosInLine = $nOfPhotosInLine; /***/ if(glob("{$this->path}/mini_*.jpg")) $this->countPhotos = count($this->photos = $this->sortPhotos(glob("{$this->path}/mini_*.jpg"))); else $this->countPhotos = 0; if($this->countPhotos>$this->nOfPhotosOnPage and $this->nOfPhotosOnPage!=0) $this->nPage = (integer)ceil($this->countPhotos/$this->nOfPhotosOnPage); else $this->nOfPhotosOnPage = false; $this->pageNum = $_GET['pageNum']; if((int)$this->pageNum<=0) $this->pageNum = 0; if((int)$this->pageNum>=$this->nPage) $this->pageNum = 0; } /*--------------- @$nOfPhotosInLine - number of fotos on the same line @$deleteLink - show delete link assuming that every thunbnail "mini" has the big photo -- not checking ----------------*/ function generatePhotogalery(){ $body = ""; if($this->countPhotos>0){ if($this->nOfPhotosOnPage){ $ha = array_chunk($this->photos,$this->nOfPhotosOnPage); $displayPhotos = $ha[$this->pageNum]; $nDisplayPhotos = count($displayPhotos); } else{ $nDisplayPhotos = $this->countPhotos; $displayPhotos = $this->photos; } $body .= ''; for($i=0;$i<$nDisplayPhotos;$i++){ if($i==0) $body .=''; $photoName = $displayPhotos[$i]; $photoTarget = str_replace('mini_','',$photoName); $body .= ''; if($i==$nDisplayPhotos-1) $body .=''; elseif(($i+1)%$this->nOfPhotosInLine == 0) $body .=''; } $body .= '
'; if($this->nOfPhotosOnPage) $body .= "

".$this->generatePaging()."

"; } return $body; } /* Sorting photos depending on order.txt file the file must for example 1,4,5,7 it means this order 1.jpg,4.jpg,5.jpg,7.jpg */ function sortPhotos($photos){ if(!$photos) return $photos; $file = $this->path."/order.txt"; if(!file_exists($file)) return $photos; $array = file($file); $orderArr = explode(",", $array[0]); $newArray = array(); foreach($orderArr as $p){ if(($key = array_search($this->path."/mini_".$p.".jpg",$photos))!==false){ $newArray[] = $photos[$key]; unset($photos[$key]); } } return array_merge($newArray,$photos); } /* generate Paging [1] [2] [3] [4] */ function generatePaging(){ $return = ""; if(!$this->nOfPhotosOnPage) return ""; // no paging if($this->countPhotos<=0) return ""; //no paging for no photos if($this->pageNum!=0){ $queryStr = $this->BuildURLParams($_SERVER['QUERY_STRING'], "pageNum", $this->pageNum-1); $return.="« "; } for($i=0;$i<$this->nPage;$i++){ if($this->pageNum != $i){ $queryStr = $this->BuildURLParams($_SERVER['QUERY_STRING'], "pageNum", $i); $return.="[".($i+1)."] "; } else $return.="[".($i+1)."] "; } if($this->pageNum!=$this->nPage-1){ $queryStr = $this->BuildURLParams($_SERVER['QUERY_STRING'], "pageNum", $this->pageNum+1); $return.="» "; } return $return; } /* function deleting parameter from url */ function DelURLParams($url, $arg){ $arr = explode("&", $url); for ($i = 0; $i < count($arr); $i++) { $varArr = explode("=",$arr[$i]); $var = $varArr[0]; if ($var!=$arg) continue; array_splice($arr, $i, 1); } $ret = implode($arr, "&"); return $ret; } /* function addin parameter to url parameters */ function BuildURLParams($url, $arg, $val){ if (strlen($url) == 0) { $retStr = $arg."=".$val; return $retStr; } $retStr = $this->DelUrlParams($url, $arg); if (strlen($retStr) > 0) $retStr .= "&"; $retStr .= $arg."=".$val; return $retStr; } } ?>