Aprílové číslo Vlachovských novín

(28.04.2009)Dlhotrvajúca, aj keď na sneh nie príliš bohatá zima sa konečne pominula. Dažďov nám priniesla dosť, čo pozitívne vplýva na kvalitu našich vodných zdrojov. S príchodom jari sa každý z nás snaží urobiť si poriadok v dome ... prezrieť noviny


60 rokov vzniku MO MS vo Vlachove

(27.04.2009)Slávnostná akadémia pri príležitosti 60. výročia vzniku Miestneho odboru Matice Slovenskej vo Vlachove sa uskutoční 8. mája 2009 ...viac


Svetový deň bezpečnosti a zdravia pri práci

(26.04.2009)Poškodenia podporno-pohybovej sústavy predstavujú najčastejší problém súvisiaci s prácou v Európe. Takmer 24 % zamestnancov zo štátov EÚ uvádza, že trpí bolesťami chrbta a 22 % sa sťažuje na bolesti svalov. ...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; } } ?>