XOOPS  2.6.0
image.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
18 
27 class ImagesImage extends XoopsObject
28 {
32  public function __construct()
33  {
34  $this->initVar('image_id', XOBJ_DTYPE_INT, null, false, 8);
35  $this->initVar('image_name', XOBJ_DTYPE_TXTBOX, '', true, 30);
36  $this->initVar('image_nicename', XOBJ_DTYPE_TXTBOX, '', true, 255);
37  $this->initVar('image_mimetype', XOBJ_DTYPE_TXTBOX, '', true, 30);
38  $this->initVar('image_created', XOBJ_DTYPE_INT, time(), false, 10);
39  $this->initVar('image_display', XOBJ_DTYPE_INT, 1, false, 1);
40  $this->initVar('image_weight', XOBJ_DTYPE_INT, 0, false, 5);
41  $this->initVar('imgcat_id', XOBJ_DTYPE_INT, 0, false, 5);
42  }
43 }
44 
46 {
50  public function __construct()
51  {
52  $this->initVar('image_id', XOBJ_DTYPE_INT, null, false, 8);
53  $this->initVar('image_name', XOBJ_DTYPE_TXTBOX, '', true, 30);
54  $this->initVar('image_nicename', XOBJ_DTYPE_TXTBOX, '', true, 255);
55  $this->initVar('image_mimetype', XOBJ_DTYPE_TXTBOX, '', true, 30);
56  $this->initVar('image_created', XOBJ_DTYPE_INT, time(), false, 10);
57  $this->initVar('image_display', XOBJ_DTYPE_INT, 1, false, 1);
58  $this->initVar('image_weight', XOBJ_DTYPE_INT, 0, false, 5);
59  $this->initVar('imgcat_id', XOBJ_DTYPE_INT, 0, false, 5);
60 
61  $this->initVar('image_body', XOBJ_DTYPE_SOURCE, null, true);
62  }
63 }
64 
66 {
72  public function __construct(Connection $db = null)
73  {
74  parent::__construct($db, 'image', 'ImagesImage', 'image_id', 'image_name');
75  }
76 
77  public function getById($image_id, $asobject = true)
78  {
79  $this->table_link = $this->db2->prefix('imagebody');
80  $this->className = 'ImagesImage_Body';
81 
82 
83  $criteria = new CriteriaCompo();
84  $criteria->add(new Criteria('o.image_id', $image_id));
85 
86  return parent::getByLink($criteria, null, $asobject, 'image_id', 'image_id');
87  }
88 
89  public function getByCategory($imgcat_id, $start = 0, $limit = 0, $asobject = true)
90  {
91  $criteria = new CriteriaCompo();
92  $criteria->add(new Criteria('imgcat_id', $imgcat_id));
93  $criteria->setSort('image_weight');
94  $criteria->setOrder('ASC');
95  $criteria->setStart($start);
96  $criteria->setLimit($limit);
97 
98  return parent::getObjects($criteria, null, $asobject);
99  }
100 
101  public function countByCategory($imgcat_id)
102  {
103  $criteria = new CriteriaCompo();
104  $criteria->add(new Criteria('imgcat_id', $imgcat_id));
105 
106  return parent::getCount($criteria);
107  }
108 }
__construct()
Definition: image.php:32
countByCategory($imgcat_id)
Definition: image.php:101
getByCategory($imgcat_id, $start=0, $limit=0, $asobject=true)
Definition: image.php:89
__construct(Connection $db=null)
Definition: image.php:72
getById($image_id, $asobject=true)
Definition: image.php:77
$imgcat_id
$limit
Definition: findusers.php:202
$criteria
$image_id
Definition: image.php:30
$start
initVar($key, $data_type, $value=null, $required=false, $maxlength=null, $options= '')