From 8bc43da98b17d907e601d08f08740650fbecb72b Mon Sep 17 00:00:00 2001 From: mediafoks Date: Thu, 14 Nov 2024 22:15:34 +0300 Subject: [PATCH] added a new field --- language/en-GB/mod_contacts_birthday.ini | 11 ++++------- language/ru-RU/mod_contacts_birthday.ini | 11 ++++------- mod_contacts_birthday.xml | 22 +++++----------------- services/provider.php | 4 ++-- src/Dispatcher/Dispatcher.php | 4 ++-- src/Helper/ContactsBirthdayHelper.php | 2 +- tmpl/card.php | 1 + tmpl/default.php | 11 +++++++---- update.xml | 4 ++-- 9 files changed, 28 insertions(+), 42 deletions(-) diff --git a/language/en-GB/mod_contacts_birthday.ini b/language/en-GB/mod_contacts_birthday.ini index f75555c..aacfbe4 100644 --- a/language/en-GB/mod_contacts_birthday.ini +++ b/language/en-GB/mod_contacts_birthday.ini @@ -1,14 +1,11 @@ MOD_CONTACTS_BIRTHDAY = "Contact birthdays" MOD_CONTACTS_BIRTHDAY_XML_DESCRIPTION = "Happy Birthday contacts. Set contact creation date to Birthday" -MOD_CONTACTS_BIRTHDAY_FIELD_CATEGORY_LABEL = "Category" - -MOD_CONTACTS_BIRTHDAY_FIELD_PREPARE_CONTENT_LABEL="Prepare Content" -MOD_CONTACTS_BIRTHDAY_FIELD_PREPARE_CONTENT_DESC="Optionally prepare the content with the Joomla Content Plugins" -MOD_CONTACTS_BIRTHDAY_FIELD_BACKGROUNDIMAGE_LABEL="Select a Background Image" - MOD_CONTACTS_BIRTHDAY_EVENT_TXT="birthday" MOD_CONTACTS_BIRTHDAY_INTRO_TXT="Today" MOD_CONTACTS_BIRTHDAY_SUFFIX_ACTION_TXT="celebrate" MOD_CONTACTS_BIRTHDAY_SUFFIX_SINGULAR_TXT="s" -MOD_CONTACTS_BIRTHDAY_SUFFIX_PLURAL_TXT="" \ No newline at end of file +MOD_CONTACTS_BIRTHDAY_SUFFIX_PLURAL_TXT="" + +MOD_CONTACTS_BIRTHDAY_FIELD_SUFFIX_TEXT_LABEL="Additional text" +MOD_CONTACTS_BIRTHDAY_FIELD_SUFFIX_TEXT_DESC="Add the text. It will be displayed after congratulations" \ No newline at end of file diff --git a/language/ru-RU/mod_contacts_birthday.ini b/language/ru-RU/mod_contacts_birthday.ini index cbc60ab..b4bae33 100644 --- a/language/ru-RU/mod_contacts_birthday.ini +++ b/language/ru-RU/mod_contacts_birthday.ini @@ -1,14 +1,11 @@ MOD_CONTACTS_BIRTHDAY = "Дни рождения контактов" MOD_CONTACTS_BIRTHDAY_XML_DESCRIPTION = "Поздравляет с Днем рождения контакты. Установите дату создания контакта, соответствующую Дню рождения" -MOD_CONTACTS_BIRTHDAY_FIELD_CATEGORY_LABEL = "Категория" - -MOD_CONTACTS_BIRTHDAY_FIELD_PREPARE_CONTENT_LABEL="Обработка событиями" -MOD_CONTACTS_BIRTHDAY_FIELD_PREPARE_CONTENT_DESC="Включить или отключить функцию обработки содержимого модуля событиями плагина (onContentPrepare)" -MOD_CONTACTS_BIRTHDAY_FIELD_BACKGROUNDIMAGE_LABEL="Фоновое изображение" - MOD_CONTACTS_BIRTHDAY_EVENT_TXT="День рождения" MOD_CONTACTS_BIRTHDAY_INTRO_TXT="Сегодня" MOD_CONTACTS_BIRTHDAY_SUFFIX_ACTION_TXT="отмеча" MOD_CONTACTS_BIRTHDAY_SUFFIX_SINGULAR_TXT="ет" -MOD_CONTACTS_BIRTHDAY_SUFFIX_PLURAL_TXT="ют" \ No newline at end of file +MOD_CONTACTS_BIRTHDAY_SUFFIX_PLURAL_TXT="ют" + +MOD_CONTACTS_BIRTHDAY_FIELD_SUFFIX_TEXT_LABEL="Дополнительный текст" +MOD_CONTACTS_BIRTHDAY_FIELD_SUFFIX_TEXT_DESC="Добавьте текст. Будет отображаться после поздравления" \ No newline at end of file diff --git a/mod_contacts_birthday.xml b/mod_contacts_birthday.xml index 1dc66e0..c67fdb9 100644 --- a/mod_contacts_birthday.xml +++ b/mod_contacts_birthday.xml @@ -7,7 +7,7 @@ GNU General Public License version 2 or later; see LICENSE.txt mediafoks@google.com https://github.com/mediafoks - 1.0.4 + 1.1.0 MOD_CONTACTS_BIRTHDAY_XML_DESCRIPTION Joomla\Module\ContactsBirthday @@ -25,17 +25,9 @@ -
- - -
-
- - - - - - +
+ +
@@ -43,16 +35,12 @@ - + - - - -
diff --git a/services/provider.php b/services/provider.php index 98802f9..0a45792 100644 --- a/services/provider.php +++ b/services/provider.php @@ -19,7 +19,7 @@ /** * The Ks contacts birthday module service provider. * - * @since 1.0.4 + * @since 1.1.0 */ return new class() implements ServiceProviderInterface { @@ -30,7 +30,7 @@ * * @return void * - * @since 1.0.4 + * @since 1.1.0 */ public function register(Container $container) { diff --git a/src/Dispatcher/Dispatcher.php b/src/Dispatcher/Dispatcher.php index f50b41f..2320b32 100644 --- a/src/Dispatcher/Dispatcher.php +++ b/src/Dispatcher/Dispatcher.php @@ -24,7 +24,7 @@ /** * Dispatcher class for mod_contacts_birthday * - * @since 1.0.4 + * @since 1.1.0 */ class Dispatcher extends AbstractModuleDispatcher { @@ -33,7 +33,7 @@ class Dispatcher extends AbstractModuleDispatcher * * @return array * - * @since 1.0.4 + * @since 1.1.0 */ private $moduleExtension; diff --git a/src/Helper/ContactsBirthdayHelper.php b/src/Helper/ContactsBirthdayHelper.php index d4724b2..3c07d37 100644 --- a/src/Helper/ContactsBirthdayHelper.php +++ b/src/Helper/ContactsBirthdayHelper.php @@ -19,7 +19,7 @@ /** * Helper for mod_contacts_birthday * - * @since 1.0.4 + * @since 1.1.0 */ class ContactsBirthdayHelper { diff --git a/tmpl/card.php b/tmpl/card.php index 02cb32e..772579c 100644 --- a/tmpl/card.php +++ b/tmpl/card.php @@ -15,6 +15,7 @@ defined('_JEXEC') or die; //$contacts - массив всех контактов. +if (!$contacts) return; $today = date("m-d"); //Текущая дата diff --git a/tmpl/default.php b/tmpl/default.php index 95bffea..1b495ea 100644 --- a/tmpl/default.php +++ b/tmpl/default.php @@ -13,22 +13,25 @@ use Joomla\CMS\Language\Text; //$contacts - массив всех контактов. +if (!$contacts) return; $today = date("m-d"); //Текущая дата -$arr_contacts_name = []; //Массив с именами контактов + +$contacts_name = []; //Массив с именами контактов +$suffix_text = $params->get('suffix_text'); // Дополнительный текст foreach ($contacts as $key => $contact) { $name = $contact->name; //Имя контакта $birthday = date_format(date_create($contact->created), 'm-d'); //Дата создания контакта - if ($today == $birthday) array_push($arr_contacts_name, $name); //Если дата создания контакта (ДР) равна текущей дате, то добавляем имя контакта в массив + if ($today == $birthday) array_push($contacts_name, $name); //Если дата создания контакта (ДР) равна текущей дате, то добавляем имя контакта в массив } ?> - +
- 1 ? Text::_('MOD_CONTACTS_BIRTHDAY_SUFFIX_PLURAL_TXT') : Text::_('MOD_CONTACTS_BIRTHDAY_SUFFIX_SINGULAR_TXT'), ' ' . Text::_('MOD_CONTACTS_BIRTHDAY_EVENT_TXT'); ?> + 1 ? Text::_('MOD_CONTACTS_BIRTHDAY_SUFFIX_PLURAL_TXT') : Text::_('MOD_CONTACTS_BIRTHDAY_SUFFIX_SINGULAR_TXT'), ' ' . Text::_('MOD_CONTACTS_BIRTHDAY_EVENT_TXT') . ' ' . $suffix_text ?: ''; ?>
\ No newline at end of file diff --git a/update.xml b/update.xml index f05dec3..22e647a 100644 --- a/update.xml +++ b/update.xml @@ -5,9 +5,9 @@ mod_contacts_birthday module site - 1.0.4 + 1.1.0 - https://github.com/mediafoks/mod_contacts_birthday/archive/refs/tags/v1.0.4.zip + https://github.com/mediafoks/mod_contacts_birthday/archive/refs/tags/v1.1.0.zip stable