17 public $mImageCategory =
null;
18 public $_mImageCategoryLoadedFlag =
false;
19 public $mImageBody =
null;
20 public $_mImageBodyLoadedFlag =
false;
22 public function __construct()
25 if (isset($initVars)) {
26 $this->mVars = $initVars;
29 $this->initVar(
'image_id', XOBJ_DTYPE_INT,
'',
false);
30 $this->initVar(
'image_name', XOBJ_DTYPE_STRING,
'',
true, 30);
31 $this->initVar(
'image_nicename', XOBJ_DTYPE_STRING,
'',
true, 191);
32 $this->initVar(
'image_mimetype', XOBJ_DTYPE_STRING,
'',
true, 30);
33 $this->initVar(
'image_created', XOBJ_DTYPE_INT, time(),
true);
34 $this->initVar(
'image_display', XOBJ_DTYPE_BOOL,
'1',
true);
35 $this->initVar(
'image_weight', XOBJ_DTYPE_INT,
'0',
true);
36 $this->initVar(
'imgcat_id', XOBJ_DTYPE_INT,
'0',
true);
37 $initVars=$this->mVars;
40 public function loadImagecategory()
42 if (
false === $this->_mImageCategoryLoadedFlag) {
43 $handler =& xoops_getmodulehandler(
'imagecategory',
'legacy');
44 $this->mImageCategory =& $handler->get($this->
get(
'imgcat_id'));
45 $this->_mImageCategoryLoadedFlag =
true;
49 public function loadImagebody()
51 if (
false === $this->_mImageBodyLoadedFlag) {
52 $handler =& xoops_getmodulehandler(
'imagebody',
'legacy');
53 $this->mImageBody =& $handler->get($this->
get(
'image_id'));
54 $this->_mImageBodyLoadedFlag =
true;
58 public function &createImagebody()
60 $handler =& xoops_getmodulehandler(
'imagebody',
'legacy');
61 $obj =& $handler->create();
62 $obj->set(
'image_id', $this->
get(
'image_id'));
69 public $mTable =
'image';
70 public $mPrimary =
'image_id';
71 public $mClass =
'LegacyImageObject';
73 public function insert(&$obj, $force =
false)
75 if (parent::insert($obj, $force)) {
76 if (is_object($obj->mImageBody)) {
77 $obj->mImageBody->set(
'image_id', $obj->get(
'image_id'));
78 $handler =& xoops_getmodulehandler(
'imagebody',
'legacy');
79 return $handler->insert($obj->mImageBody, $force);
96 public function delete(&$obj, $force =
false)
98 $obj->loadImagebody();
100 if (parent::delete($obj, $force)) {
101 $filepath = XOOPS_UPLOAD_PATH .
'/' . $obj->get(
'image_name');
102 if (file_exists($filepath)) {
106 if (is_object($obj->mImageBody)) {
107 $handler =& xoops_getmodulehandler(
'imagebody',
'legacy');
108 $handler->delete($obj->mImageBody, $force);