24 include __DIR__ .
'/header.php';
27 $xoops->header(
'admin:images/images_admin_categories.tpl');
34 if (!
$xoops->security()->check()) {
35 $xoops->redirect(
'categories.php', 3, implode(
'<br />',
$xoops->security()->getErrors()));
43 $obj =
$helper->getHandlerCategories()->create();
46 $obj->setVar(
'imgcat_name', Request::getString(
'imgcat_name',
''));
47 $obj->setVar(
'imgcat_maxsize', Request::getInt(
'imgcat_maxsize', 100000));
48 $obj->setVar(
'imgcat_maxwidth', Request::getInt(
'imgcat_maxwidth', 128));
49 $obj->setVar(
'imgcat_maxheight', Request::getInt(
'imgcat_maxheight', 128));
50 $obj->setVar(
'imgcat_display', Request::getBool(
'imgcat_display', 1));
51 $obj->setVar(
'imgcat_weight', Request::getInt(
'imgcat_weight', 0));
52 $obj->setVar(
'imgcat_storetype', Request::getString(
'imgcat_storetype',
'file'));
53 $obj->setVar(
'imgcat_type',
'C');
66 $permissions = array(
'readgroup' =>
'imgcat_read',
'writegroup' =>
'imgcat_write');
67 foreach ($permissions as $k => $permission) {
68 $groups = Request::getArray($k, array(FixedGroups::ADMIN));
69 if (!in_array(FixedGroups::ADMIN,
$groups)) {
70 array_push(
$groups, FixedGroups::ADMIN);
73 $perm_obj =
$xoops->getHandlerGroupperm()->create();
74 $perm_obj->setVar(
'gperm_groupid', $group);
76 $perm_obj->setVar(
'gperm_name', $permission);
77 $perm_obj->setVar(
'gperm_modid',
$xoops->module->getVar(
'mid'));
78 $xoops->getHandlerGroupperm()->insert($perm_obj);
88 $obj =
$helper->getHandlerCategories()->create();
105 $ok = Request::getInt(
'ok', 0);
109 if (!
$xoops->security()->check()) {
110 $xoops->redirect(
'categories.php', 3, implode(
',',
$xoops->security()->getErrors()));
112 if (
$helper->getHandlerCategories()->delete($obj)) {
114 $images =
$helper->getHandlerImages()->getByCategory($obj->getVar(
'imgcat_id'));
115 foreach ($images as
$image) {
116 if (
$helper->getHandlerImages()->delete($image)) {
117 if ($obj->getVar(
'imgcat_storetype') ==
'db') {
118 $helper->getHandlerImagesBody()->delete(
$helper->getHandlerImagesBody()->get($image->getVar(
'image_id')));
137 array(
'op' =>
'del',
'ok' => 1,
'imgcat_id' =>
$imgcat_id),
138 XOOPS_URL .
'/modules/images/admin/categories.php',
149 $old = $imgcat->getVar(
'imgcat_display');
150 $imgcat->setVar(
'imgcat_display', !$old);
151 if (!
$helper->getHandlerCategories()->insert($imgcat)) {
162 $categories =
$helper->getHandlerCategories()->getPermittedObjects();
164 foreach (array_keys($categories) as
$i) {
167 if ($imgcat_read || $imgcat_write) {
168 $count =
$helper->getHandlerImages()->countByCategory($categories[$i]->getVar(
'imgcat_id'));
169 $cat_images = $categories[
$i]->getValues();
170 $cat_images[
'imgcat_count'] =
$count;
171 $xoops->tpl()->appendByRef(
'categories', $cat_images);
if(empty($image_id)) $image
if(empty($settings['ROOT_PATH'])) elseif(empty($settings['DB_PARAMETERS'])) $error
const _AM_IMAGES_CAT_SAVE
const _AM_IMAGES_CAT_NOTSAVE
const _AM_IMAGES_CAT_DELETE