From 8090a393390598ba92d835e3d57de73b533de3b9 Mon Sep 17 00:00:00 2001 From: Lio MJ Date: Thu, 14 Oct 2021 14:30:44 +0800 Subject: [PATCH 1/2] add option to hide member limit field in the form --- class/EventHandler.php | 5 +++++ event.php | 1 + language/english/modinfo.php | 2 ++ xoops_version.php | 23 ++++++++++++++++------- 4 files changed, 24 insertions(+), 7 deletions(-) diff --git a/class/EventHandler.php b/class/EventHandler.php index 7ece403..302a27b 100644 --- a/class/EventHandler.php +++ b/class/EventHandler.php @@ -1162,10 +1162,15 @@ public function getEventForm($siteSide = 'user', $mode = 'new', $data = null) } $form->addElement($descEditor); + + if ($helper->getConfig('formShowMemberLimit', 1) == 1) { // Max registered member for this event $nbMemberElement = new \XoopsFormText(\_MD_EXTCAL_NBMEMBER, 'event_nbmember', 4, 4, $nbMember); $nbMemberElement->setDescription(\_MD_EXTCAL_NBMEMBER_DESC); $form->addElement($nbMemberElement, false); + } else { + $form->addElement(new \XoopsFormHidden('event_nbmember', $event_nbmember), false); + } //Price and monnaie if ($helper->getConfig('formShowPrice', 1) == 1) { diff --git a/event.php b/event.php index f7c6ae4..0d798a9 100644 --- a/event.php +++ b/event.php @@ -95,6 +95,7 @@ function clear_unicodeslashes($text) $xoopsTpl->assign('showAddress', $helper->getConfig('formShowAddress', 1));// $xoopsTpl->assign('showFile', $helper->getConfig('formShowFile', 1));// $xoopsTpl->assign('showPicture', $helper->getConfig('formShowPicture', 1));// +$xoopsTpl->assign('showMemberLimit', $helper->getConfig('formShowMemberLimit', 1));// // Assigning event to the template $xoopsTpl->assign('event', $event); diff --git a/language/english/modinfo.php b/language/english/modinfo.php index 0a258f5..643563a 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -175,6 +175,8 @@ define('_MI_EXTCAL_FORMSHOW_FILE_DESC', ''); define('_MI_EXTCAL_FORMSHOW_PICTURE', 'Display pictures fields in the form?'); define('_MI_EXTCAL_FORMSHOW_PICTURE_DESC', ''); +define('_MI_EXTCAL_FORMSHOW_MEMBERLIMIT', 'Display member limit field in the form?'); +define('_MI_EXTCAL_FORMSHOW_MEMBERLIMIT_DESC', ''); // 2.38 diff --git a/xoops_version.php b/xoops_version.php index 5d9dca3..d361409 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -593,7 +593,7 @@ 'description' => '_MI_EXTCAL_FORMSHOW_ICON_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', - 'default' => 1, + 'default' => 0, ]; $modversion['config'][] = [ @@ -611,7 +611,7 @@ 'description' => '_MI_EXTCAL_FORMSHOW_PRICE_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', - 'default' => 1, + 'default' => 0, ]; $modversion['config'][] = [ @@ -629,7 +629,7 @@ 'description' => '_MI_EXTCAL_FORMSHOW_CONTACT_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', - 'default' => 1, + 'default' => 0, ]; $modversion['config'][] = [ @@ -638,7 +638,7 @@ 'description' => '_MI_EXTCAL_FORMSHOW_URL_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', - 'default' => 1, + 'default' => 0, ]; $modversion['config'][] = [ @@ -647,7 +647,7 @@ 'description' => '_MI_EXTCAL_FORMSHOW_EMAIL_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', - 'default' => 1, + 'default' => 0, ]; $modversion['config'][] = [ @@ -656,7 +656,7 @@ 'description' => '_MI_EXTCAL_FORMSHOW_ADDRESS_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', - 'default' => 1, + 'default' => 0, ]; $modversion['config'][] = [ @@ -665,7 +665,7 @@ 'description' => '_MI_EXTCAL_FORMSHOW_RECURENCE_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', - 'default' => 1, + 'default' => 0, ]; $modversion['config'][] = [ @@ -686,6 +686,15 @@ 'default' => 1, ]; +$modversion['config'][] = [ + 'name' => 'formShowMemberLimit', + 'title' => '_MI_EXTCAL_FORMSHOW_MEMBERLIMIT', + 'description' => '_MI_EXTCAL_FORMSHOW_MEMBERLIMIT_DESC', + 'formtype' => 'yesno', + 'valuetype' => 'int', + 'default' => 0, +]; + $modversion['config'][] = [ 'name' => 'break' . $i, 'title' => '_MI_EXTCAL_SHOW_OTHEROPTIONS', From f17f1e4b26e2b887eac4cf2a53e7833992e52889 Mon Sep 17 00:00:00 2001 From: Lio MJ Date: Thu, 14 Oct 2021 14:40:46 +0800 Subject: [PATCH 2/2] Update EventHandler.php --- class/EventHandler.php | 1 + 1 file changed, 1 insertion(+) diff --git a/class/EventHandler.php b/class/EventHandler.php index 302a27b..99e484f 100644 --- a/class/EventHandler.php +++ b/class/EventHandler.php @@ -1079,6 +1079,7 @@ public function getEventForm($siteSide = 'user', $mode = 'new', $data = null) $event_picture2 = ''; $event_price = ''; $event_location = ''; + $event_nbmember = ''; $files = []; $event_icone = ''; }