foto.class.php
1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
Class Foto{
private $db;
private $lang;
function __construct($lang){
$this->db = sdb::getInstance();
$this->lang = $lang;
}
public function getRubrics(){
return $this->db->getAll("select * from foto_rubrics order by sort",array(),DB_FETCHMODE_ASSOC);
}
public function getRubric($id){
return $this->db->getRow("select * from foto_rubrics where id=?",array($id),DB_FETCHMODE_ASSOC);
}
public function getGallery($rubric_id = 0){
$search = array();
if($rubric_id>0)$search[] = sprintf("rubric_id='%d'",$rubric_id);
$sql = "select * from foto_gallery where 1=1 ";
if(count($search))$sql .= "AND " . implode(" AND ",$search)." ";
$sql .= "order by id desc";
//print $sql;
$pagerOptions = Array(
'mode' => 'Sliding',
'delta' => 6,
'perPage' => 10,
'spacesBeforeSeparator' => 1,
'spacesAfterSeparator' => 1
);
return Pager_Wrapper_DB($this->db, $sql, $pagerOptions, false, DB_FETCHMODE_ASSOC, array());
}
public function getGalleryOne($id){
return $this->db->getRow("select * from foto_gallery where id=?",array($id),DB_FETCHMODE_ASSOC);
}
}
?>