XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
ImageAdminEditForm.class.php
1<?php
11
12if (!defined('XOOPS_ROOT_PATH')) {
13 exit();
14}
15
16require_once XOOPS_ROOT_PATH . '/core/XCube_ActionForm.class.php';
17require_once XOOPS_MODULE_PATH . '/legacy/class/Legacy_Validator.class.php';
18require_once XOOPS_MODULE_PATH . '/legacy/forms/ImageUploadForm.class.php';
19
21{
22 public $_mImgcatId = 0;
23
24 public function getTokenName()
25 {
26 return 'module.legacy.ImageAdminEditForm.TOKEN' . $this->get('image_id');
27 }
28
29 public function prepare()
30 {
31 parent::prepare();
32
33 //
34 // Set form properties
35 //
36 $this->mFormProperties['image_id'] =new XCube_IntProperty('image_id');
37 $this->mFormProperties['image_display'] =new XCube_BoolProperty('image_display');
38 $this->mFormProperties['image_weight'] =new XCube_IntProperty('image_weight');
39
40 //
41 // Set field properties
42 //
43 $this->mFieldProperties['image_id'] =new XCube_FieldProperty($this);
44 $this->mFieldProperties['image_id']->setDependsByArray(['required']);
45 $this->mFieldProperties['image_id']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _AD_LEGACY_LANG_IMAGE_ID);
46
47 $this->mFieldProperties['image_weight'] =new XCube_FieldProperty($this);
48 $this->mFieldProperties['image_weight']->setDependsByArray(['required']);
49 $this->mFieldProperties['image_weight']->addMessage('required', _MD_LEGACY_ERROR_REQUIRED, _AD_LEGACY_LANG_IMAGE_WEIGHT);
50 }
51
52 public function load(&$obj)
53 {
54 parent::load($obj);
55 $this->set('image_id', $obj->get('image_id'));
56 $this->set('image_display', $obj->get('image_display'));
57 $this->set('image_weight', $obj->get('image_weight'));
58
59 $this->_mImgcatId = $obj->get('imgcat_id');
60 }
61
62 public function update(&$obj)
63 {
64 parent::update($obj);
65 $obj->set('image_id', $this->get('image_id'));
66 $obj->set('image_display', $this->get('image_display'));
67 $obj->set('image_weight', $this->get('image_weight'));
68 }
69}
70
72{
73 public function validateImgcat_id()
74 {
75 parent::validateImgcat_id();
76
77 $handler =& xoops_getmodulehandler('imagecategory', 'legacy');
78 $currentCategory =& $handler->get($this->_mImgcatId);
79
80 $specificCategory =& $handler->get($this->get('imgcat_id'));
81 if ($currentCategory->get('imgcat_storetype') != $specificCategory->get('imgcat_storetype')) {
82 $this->set('imgcat_id', $this->_mImgcatId);
83 }
84 }
85}
update(&$obj)
[Abstract] Updates an object with properties values.
getTokenName()
Gets the token name of this actionform's token.
prepare()
[Abstract] Set up form properties and field properties.
load(&$obj)
[Abstract] Initializes properties' values from an object.
Represents bool property.
[Abstract] Used for validating member property values of XCube_ActionForm.
Represents int property.