diff --git a/class/Constants.php b/class/Constants.php index be4fc9e2..96b6eda5 100644 --- a/class/Constants.php +++ b/class/Constants.php @@ -65,6 +65,7 @@ interface Constants public const PUBLISHER_SUBTITLE = 24; public const PUBLISHER_AUTHOR_ALIAS = 25; public const PUBLISHER_DATEEXPIRE = 26; + public const PUBLISHER_VOTETYPE = 27; // Global constants public const PUBLISHER_SEARCH = 1; public const PUBLISHER_RATE = 2; diff --git a/class/Form/ItemForm.php b/class/Form/ItemForm.php index 440650d5..ca1897ea 100644 --- a/class/Form/ItemForm.php +++ b/class/Form/ItemForm.php @@ -70,6 +70,7 @@ class ItemForm extends ThemeTabForm Constants::PUBLISHER_NOTIFY, Constants::PUBLISHER_AVAILABLE_PAGE_WRAP, Constants::PUBLISHER_UID, + Constants::PUBLISHER_VOTETYPE, ]; public $imagesTab = [ Constants::PUBLISHER_IMAGE_ITEM, @@ -271,6 +272,33 @@ public function createElements($obj) $this->addElement($availableWrapPages); } + //VOTING TYPE ===================================== + // if ($this->isGranted(Constants::PUBLISHER_VOTETYPE)) { + $groups = $GLOBALS['xoopsUser'] ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS; + /** @var GroupPermHandler $grouppermHandler */ + $grouppermHandler = $helper->getHandler('GroupPerm'); + $moduleId = $helper->getModule()->getVar('mid'); + if ($helper->getConfig('perm_rating') && $grouppermHandler->checkRight('global', _PUBLISHER_RATE, $groups, $moduleId)) { + $options = [ + Constants::RATING_NONE => _MI_BLOG_RATING_NONE, + Constants::RATING_5STARS => _MI_BLOG_RATING_5STARS, + Constants::RATING_10STARS => _MI_BLOG_RATING_10STARS, + Constants::RATING_LIKES => _MI_BLOG_RATING_LIKES, + Constants::RATING_10NUM => _MI_BLOG_RATING_10NUM, + Constants::RATING_REACTION => _MI_BLOG_RATING_REACTION, + ]; + + $votetypeSelect = new \XoopsFormSelect(\_MI_BLOG_RATINGBARS, 'votetype', $obj->getVar('votetype')); + $votetypeSelect->addOptionArray($options); + // $votetypeSelect->setDescription(\_MI_BLOG_RATINGBARS_DESC); + $this->addElement($votetypeSelect); + unset($votetypeSelect); + } + // } + //VOTING TYPE END ===================================== + + + $userUid = $obj->getVar('itemid') > 0 ? $obj->uid() : $currentUid; if ($this->isGranted(Constants::PUBLISHER_UID)) { $this->addElement(new \XoopsFormSelectUser(\_CO_PUBLISHER_UID, 'uid', false, $userUid, 1, false), false); diff --git a/docs/changelog.txt b/docs/changelog.txt index e1f8ffae..ec4c1c81 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,3 +1,7 @@ +