diff --git a/administrator/forms/categoria.xml b/administrator/forms/categoria.xml new file mode 100644 index 0000000..e691f20 --- /dev/null +++ b/administrator/forms/categoria.xml @@ -0,0 +1,16 @@ + +
+
+ + + + + + + + + + + +
+
diff --git a/administrator/forms/circolare.xml b/administrator/forms/circolare.xml index f8a6976..198a9cd 100644 --- a/administrator/forms/circolare.xml +++ b/administrator/forms/circolare.xml @@ -1,55 +1,27 @@ - +
- - + + - + -
- -
- -
-
-
+ diff --git a/administrator/forms/filter_categorie.xml b/administrator/forms/filter_categorie.xml new file mode 100644 index 0000000..f6dd155 --- /dev/null +++ b/administrator/forms/filter_categorie.xml @@ -0,0 +1,23 @@ + +
+ + + + + + + + + + + + + + + + + + + + +
diff --git a/administrator/languages/en-GB/com_circolari.ini b/administrator/languages/en-GB/com_circolari.ini index 0b57a88..3c16843 100644 --- a/administrator/languages/en-GB/com_circolari.ini +++ b/administrator/languages/en-GB/com_circolari.ini @@ -1,109 +1,120 @@ -COM_CIRCOLARI="Circolari" -COM_CIRCOLARI_COMPONENT_LABEL="Circolari" -COM_CIRCOLARI_CONFIGURATION="Circolari Configuration" -COM_CIRCOLARI_ACCESS_HEADING="Access" -COM_CIRCOLARI_COMPONENT_DESC="" -COM_CIRCOLARI_XML_DESCRIPTION="" -COM_CIRCOLARI_N_ITEMS_ARCHIVED="%d items successfully archived" -COM_CIRCOLARI_N_ITEMS_ARCHIVED_1="%d item successfully archived" -COM_CIRCOLARI_N_ITEMS_CHECKED_IN_0="No item successfully checked in" -COM_CIRCOLARI_N_ITEMS_CHECKED_IN_1="%d item successfully checked in" -COM_CIRCOLARI_N_ITEMS_CHECKED_IN_MORE="%d items successfully checked in" -COM_CIRCOLARI_N_ITEMS_DELETED="%d items successfully deleted" -COM_CIRCOLARI_N_ITEMS_DELETED_1="%d item successfully deleted" -COM_CIRCOLARI_N_ITEMS_PUBLISHED="%d items successfully published" -COM_CIRCOLARI_N_ITEMS_PUBLISHED_1="%d item successfully published" -COM_CIRCOLARI_N_ITEMS_TRASHED="%d items successfully trashed" -COM_CIRCOLARI_N_ITEMS_TRASHED_1="%d item successfully trashed" -COM_CIRCOLARI_N_ITEMS_UNPUBLISHED="%d items successfully unpublished" -COM_CIRCOLARI_N_ITEMS_UNPUBLISHED_1="%d item successfully unpublished" -COM_CIRCOLARI_NO_ITEM_SELECTED="No items selected" -COM_CIRCOLARI_SAVE_SUCCESS="Item successfully saved" -COM_CIRCOLARI_ITEM_ID_SELECT_LABEL="Select the item ID" -COM_CIRCOLARI_ITEM_ID_SELECT_LABEL_FORM="Select the Item ID to Edit (Set up as 0 if you want to set up as add form)" -COM_CIRCOLARI_FIELDSET_ITEM_ID_SELECT_LABEL="Required Settings" -COM_CIRCOLARI_FILTER_SELECT_LABEL=" - Select %s - " -COM_CIRCOLARI_TEST_LABEL="Test label" -COM_CIRCOLARI_FIELDSET_RULES="Permissions" -COM_CIRCOLARI_FROM_FILTER="From %s" -COM_CIRCOLARI_TO_FILTER="To %s" -COM_CIRCOLARI_VIEW_FILE="[View File]" -COM_CIRCOLARI_ITEMS_SUCCESS_DUPLICATED="Items successfully duplicated" - -COM_CIRCOLARI_SEARCH_FILTER_SUBMIT = "Search" -COM_CIRCOLARI_SEARCH_TOOLS = "Search Tools" -COM_CIRCOLARI_SEARCH_TOOLS_DESC = "Filter the list items" -COM_CIRCOLARI_SEARCH_FILTER_CLEAR = "Clear filter" -COM_CIRCOLARI_TITLE_FIRMETIPI = "Firme" -COM_CIRCOLARI_TAB_ETICHETTA = "Firma" -COM_CIRCOLARI_FIELDSET_ETICHETTA="Firma" -COM_HIGHLIGHTS_FORM_LBL_ETICHETTA_NOME="Nome" -COM_HIGHLIGHTS_FORM_DESC_ETICHETTA_NOME="Nome" -COM_CIRCOLARI_FIELD_TIPOLOGIA_FIRMA_LABEL="Tipologia" -COM_CIRCOLARI_XML_DESCRIPTION = "" - -COM_CIRCOLARI_TITLE_CIRCOLARES = "Circolari" -COM_CIRCOLARI_CIRCOLARES_ID = "ID" -COM_CIRCOLARI_CIRCOLARES_STATE = "State" -COM_CIRCOLARI_CIRCOLARES_ORDERING = "Order" -COM_CIRCOLARI_CIRCOLARES_CHECKED_OUT = "N/A" -COM_CIRCOLARI_CIRCOLARES_CHECKED_OUT_TIME = "N/A" -COM_CIRCOLARI_CIRCOLARES_CREATED_BY = "Created by" -COM_CIRCOLARI_CIRCOLARES_MODIFIED_BY = "Modified by" -COM_CIRCOLARI_CIRCOLARES_TITLE = "Title" -COM_CIRCOLARI_CIRCOLARES_DESCRIPTION = "Description" -COM_CIRCOLARI_CIRCOLARES_ATTACHMENT = "Alle" -COM_CIRCOLARI_CIRCOLARES_IMAGE = "Image" -COM_CIRCOLARI_ID_DESC = "ID Descending" -COM_CIRCOLARI_STATE_DESC = "State Descending" -COM_CIRCOLARI_ORDERING_DESC = "Order Descending" -COM_CIRCOLARI_CHECKED_OUT_DESC = "N/A Descending" -COM_CIRCOLARI_CHECKED_OUT_TIME_DESC = "N/A Descending" -COM_CIRCOLARI_CREATED_BY_DESC = "Created by Descending" -COM_CIRCOLARI_MODIFIED_BY_DESC = "Modified by Descending" -COM_CIRCOLARI_TITLE_DESC = "Title Descending" -COM_CIRCOLARI_DESCRIPTION_DESC = "Description Descending" -COM_CIRCOLARI_ATTACHMENT_DESC = "Alle Descending" -COM_CIRCOLARI_IMAGE_DESC = "Image Descending" -COM_CIRCOLARI_ID_ASC = "ID Ascending" -COM_CIRCOLARI_STATE_ASC = "State Ascending" -COM_CIRCOLARI_ORDERING_ASC = "Order Ascending" -COM_CIRCOLARI_CHECKED_OUT_ASC = "N/A Ascending" -COM_CIRCOLARI_CHECKED_OUT_TIME_ASC = "N/A Ascending" -COM_CIRCOLARI_CREATED_BY_ASC = "Created by Ascending" -COM_CIRCOLARI_MODIFIED_BY_ASC = "Modified by Ascending" -COM_CIRCOLARI_TITLE_ASC = "Title Ascending" -COM_CIRCOLARI_DESCRIPTION_ASC = "Description Ascending" -COM_CIRCOLARI_ATTACHMENT_ASC = "Alle Ascending" -COM_CIRCOLARI_IMAGE_ASC = "Image Ascending" - -COM_CIRCOLARI_TITLE_CIRCOLARE = "Circolari" -COM_CIRCOLARI_LEGEND_CIRCOLARE = "Circolari" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_ID = "ID" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_ID = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_STATE = "State" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_STATE = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_ORDERING = "Order" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_ORDERING = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_CHECKED_OUT = "N/A" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_CHECKED_OUT = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_CHECKED_OUT_TIME = "N/A" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_CHECKED_OUT_TIME = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_CREATED_BY = "Created by" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_CREATED_BY = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_MODIFIED_BY = "Modified by" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_MODIFIED_BY = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_TITLE = "Title" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_TITLE = "" -COM_CIRCOLARI_TAB_CIRCOLARI = "Circolari" -COM_CIRCOLARI_FIELDSET_CIRCOLARI = "Circolari" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_DESCRIPTION = "Description" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_DESCRIPTION = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_ATTACHMENT = "Attachment" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_ATTACHMENT = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_IMAGE = "Image" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_IMAGE = "" - - - - +COM_CIRCOLARI="Circolari" +COM_CIRCOLARI_COMPONENT_LABEL="Circolari" +COM_CIRCOLARI_CONFIGURATION="Circolari Configuration" +COM_CIRCOLARI_ACCESS_HEADING="Access" +COM_CIRCOLARI_COMPONENT_DESC="" +COM_CIRCOLARI_XML_DESCRIPTION="" +COM_CIRCOLARI_N_ITEMS_ARCHIVED="%d items successfully archived" +COM_CIRCOLARI_N_ITEMS_ARCHIVED_1="%d item successfully archived" +COM_CIRCOLARI_N_ITEMS_CHECKED_IN_0="No item successfully checked in" +COM_CIRCOLARI_N_ITEMS_CHECKED_IN_1="%d item successfully checked in" +COM_CIRCOLARI_N_ITEMS_CHECKED_IN_MORE="%d items successfully checked in" +COM_CIRCOLARI_N_ITEMS_DELETED="%d items successfully deleted" +COM_CIRCOLARI_N_ITEMS_DELETED_1="%d item successfully deleted" +COM_CIRCOLARI_N_ITEMS_PUBLISHED="%d items successfully published" +COM_CIRCOLARI_N_ITEMS_PUBLISHED_1="%d item successfully published" +COM_CIRCOLARI_N_ITEMS_TRASHED="%d items successfully trashed" +COM_CIRCOLARI_N_ITEMS_TRASHED_1="%d item successfully trashed" +COM_CIRCOLARI_N_ITEMS_UNPUBLISHED="%d items successfully unpublished" +COM_CIRCOLARI_N_ITEMS_UNPUBLISHED_1="%d item successfully unpublished" +COM_CIRCOLARI_NO_ITEM_SELECTED="No items selected" +COM_CIRCOLARI_SAVE_SUCCESS="Item successfully saved" +COM_CIRCOLARI_ITEM_ID_SELECT_LABEL="Select the item ID" +COM_CIRCOLARI_ITEM_ID_SELECT_LABEL_FORM="Select the Item ID to Edit (Set up as 0 if you want to set up as add form)" +COM_CIRCOLARI_FIELDSET_ITEM_ID_SELECT_LABEL="Required Settings" +COM_CIRCOLARI_FILTER_SELECT_LABEL=" - Select %s - " +COM_CIRCOLARI_TEST_LABEL="Test label" +COM_CIRCOLARI_FIELDSET_RULES="Permissions" +COM_CIRCOLARI_FROM_FILTER="From %s" +COM_CIRCOLARI_TO_FILTER="To %s" +COM_CIRCOLARI_VIEW_FILE="[View File]" +COM_CIRCOLARI_ITEMS_SUCCESS_DUPLICATED="Items successfully duplicated" + +COM_CIRCOLARI_SEARCH_FILTER_SUBMIT = "Search" +COM_CIRCOLARI_SEARCH_TOOLS = "Search Tools" +COM_CIRCOLARI_SEARCH_TOOLS_DESC = "Filter the list items" +COM_CIRCOLARI_SEARCH_FILTER_CLEAR = "Clear filter" +COM_CIRCOLARI_TITLE_FIRMETIPI = "Firme" +COM_CIRCOLARI_TAB_ETICHETTA = "Firma" +COM_CIRCOLARI_FIELDSET_ETICHETTA="Firma" +COM_HIGHLIGHTS_FORM_LBL_ETICHETTA_NOME="Nome" +COM_HIGHLIGHTS_FORM_DESC_ETICHETTA_NOME="Nome" +COM_CIRCOLARI_FIELD_TIPOLOGIA_FIRMA_LABEL="Tipologia" +COM_CIRCOLARI_XML_DESCRIPTION = "" + +COM_CIRCOLARI_TITLE_CIRCOLARES = "Circolari" +COM_CIRCOLARI_CIRCOLARES_ID = "ID" +COM_CIRCOLARI_CIRCOLARES_STATE = "State" +COM_CIRCOLARI_CIRCOLARES_ORDERING = "Order" +COM_CIRCOLARI_CIRCOLARES_CHECKED_OUT = "N/A" +COM_CIRCOLARI_CIRCOLARES_CHECKED_OUT_TIME = "N/A" +COM_CIRCOLARI_CIRCOLARES_CREATED_BY = "Created by" +COM_CIRCOLARI_CIRCOLARES_MODIFIED_BY = "Modified by" +COM_CIRCOLARI_CIRCOLARES_TITLE = "Title" +COM_CIRCOLARI_CIRCOLARES_DESCRIPTION = "Description" +COM_CIRCOLARI_CIRCOLARES_ATTACHMENT = "Alle" +COM_CIRCOLARI_CIRCOLARES_IMAGE = "Image" +COM_CIRCOLARI_ID_DESC = "ID Descending" +COM_CIRCOLARI_STATE_DESC = "State Descending" +COM_CIRCOLARI_ORDERING_DESC = "Order Descending" +COM_CIRCOLARI_CHECKED_OUT_DESC = "N/A Descending" +COM_CIRCOLARI_CHECKED_OUT_TIME_DESC = "N/A Descending" +COM_CIRCOLARI_CREATED_BY_DESC = "Created by Descending" +COM_CIRCOLARI_MODIFIED_BY_DESC = "Modified by Descending" +COM_CIRCOLARI_TITLE_DESC = "Title Descending" +COM_CIRCOLARI_DESCRIPTION_DESC = "Description Descending" +COM_CIRCOLARI_ATTACHMENT_DESC = "Alle Descending" +COM_CIRCOLARI_IMAGE_DESC = "Image Descending" +COM_CIRCOLARI_ID_ASC = "ID Ascending" +COM_CIRCOLARI_STATE_ASC = "State Ascending" +COM_CIRCOLARI_ORDERING_ASC = "Order Ascending" +COM_CIRCOLARI_CHECKED_OUT_ASC = "N/A Ascending" +COM_CIRCOLARI_CHECKED_OUT_TIME_ASC = "N/A Ascending" +COM_CIRCOLARI_CREATED_BY_ASC = "Created by Ascending" +COM_CIRCOLARI_MODIFIED_BY_ASC = "Modified by Ascending" +COM_CIRCOLARI_TITLE_ASC = "Title Ascending" +COM_CIRCOLARI_DESCRIPTION_ASC = "Description Ascending" +COM_CIRCOLARI_ATTACHMENT_ASC = "Alle Ascending" +COM_CIRCOLARI_IMAGE_ASC = "Image Ascending" + +COM_CIRCOLARI_TITLE_CIRCOLARE = "Circolari" +COM_CIRCOLARI_LEGEND_CIRCOLARE = "Circolari" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_ID = "ID" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_ID = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_STATE = "State" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_STATE = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_ORDERING = "Order" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_ORDERING = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_CHECKED_OUT = "N/A" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_CHECKED_OUT = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_CHECKED_OUT_TIME = "N/A" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_CHECKED_OUT_TIME = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_CREATED_BY = "Created by" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_CREATED_BY = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_MODIFIED_BY = "Modified by" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_MODIFIED_BY = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_TITLE = "Title" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_TITLE = "" +COM_CIRCOLARI_TAB_CIRCOLARI = "Circolari" +COM_CIRCOLARI_FIELDSET_CIRCOLARI = "Circolari" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_DESCRIPTION = "Description" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_DESCRIPTION = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_ATTACHMENT = "Attachment" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_ATTACHMENT = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_IMAGE = "Image" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_IMAGE = "" + + + + + +COM_CIRCOLARI_TITLE_CATEGORIE="Categories" + +COM_CIRCOLARI_TITLE_CATEGORIA="Category" + +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_USERGROUP="User group" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_USERGROUP="Restrict this circular to a specific user group (0 = no restriction)." + +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_IMAGE="Image" + +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_ATTACHMENT="Attachment" diff --git a/administrator/languages/it-IT/com_circolari.ini b/administrator/languages/it-IT/com_circolari.ini index 77546d2..6b52cf6 100644 --- a/administrator/languages/it-IT/com_circolari.ini +++ b/administrator/languages/it-IT/com_circolari.ini @@ -1,108 +1,119 @@ -COM_CIRCOLARI="Circolari" -COM_CIRCOLARI_COMPONENT_LABEL="Circolari" -COM_CIRCOLARI_CONFIGURATION="Circolari Configuration" -COM_CIRCOLARI_ACCESS_HEADING="Access" -COM_CIRCOLARI_COMPONENT_DESC="" -COM_CIRCOLARI_XML_DESCRIPTION="" -COM_CIRCOLARI_N_ITEMS_ARCHIVED="%d items successfully archived" -COM_CIRCOLARI_N_ITEMS_ARCHIVED_1="%d item successfully archived" -COM_CIRCOLARI_N_ITEMS_CHECKED_IN_0="No item successfully checked in" -COM_CIRCOLARI_N_ITEMS_CHECKED_IN_1="%d item successfully checked in" -COM_CIRCOLARI_N_ITEMS_CHECKED_IN_MORE="%d items successfully checked in" -COM_CIRCOLARI_N_ITEMS_DELETED="%d items successfully deleted" -COM_CIRCOLARI_N_ITEMS_DELETED_1="%d item successfully deleted" -COM_CIRCOLARI_N_ITEMS_PUBLISHED="%d items successfully published" -COM_CIRCOLARI_N_ITEMS_PUBLISHED_1="%d item successfully published" -COM_CIRCOLARI_N_ITEMS_TRASHED="%d items successfully trashed" -COM_CIRCOLARI_N_ITEMS_TRASHED_1="%d item successfully trashed" -COM_CIRCOLARI_N_ITEMS_UNPUBLISHED="%d items successfully unpublished" -COM_CIRCOLARI_N_ITEMS_UNPUBLISHED_1="%d item successfully unpublished" -COM_CIRCOLARI_NO_ITEM_SELECTED="No items selected" -COM_CIRCOLARI_SAVE_SUCCESS="Item successfully saved" -COM_CIRCOLARI_ITEM_ID_SELECT_LABEL="Select the item ID" -COM_CIRCOLARI_ITEM_ID_SELECT_LABEL_FORM="Select the Item ID to Edit (Set up as 0 if you want to set up as add form)" -COM_CIRCOLARI_FIELDSET_ITEM_ID_SELECT_LABEL="Required Settings" -COM_CIRCOLARI_FILTER_SELECT_LABEL=" - Select %s - " -COM_CIRCOLARI_TEST_LABEL="Test label" -COM_CIRCOLARI_FIELDSET_RULES="Permissions" -COM_CIRCOLARI_FROM_FILTER="From %s" -COM_CIRCOLARI_TO_FILTER="To %s" -COM_CIRCOLARI_VIEW_FILE="[View File]" -COM_CIRCOLARI_ITEMS_SUCCESS_DUPLICATED="Items successfully duplicated" -COM_CIRCOLARI_TITLE_FIRMETIPI = "Firme" -COM_CIRCOLARI_TAB_ETICHETTA = "Firma" -COM_CIRCOLARI_FIELDSET_ETICHETTA="Firma" -COM_HIGHLIGHTS_FORM_LBL_ETICHETTA_NOME="Nome" -COM_HIGHLIGHTS_FORM_DESC_ETICHETTA_NOME="Nome" -COM_CIRCOLARI_SEARCH_FILTER_SUBMIT = "Search" -COM_CIRCOLARI_SEARCH_TOOLS = "Search Tools" -COM_CIRCOLARI_SEARCH_TOOLS_DESC = "Filter the list items" -COM_CIRCOLARI_SEARCH_FILTER_CLEAR = "Clear filter" - -COM_CIRCOLARI_XML_DESCRIPTION = "" - -COM_CIRCOLARI_TITLE_CIRCOLARES = "Circolari" -COM_CIRCOLARI_CIRCOLARES_ID = "ID" -COM_CIRCOLARI_CIRCOLARES_STATE = "State" -COM_CIRCOLARI_CIRCOLARES_ORDERING = "Order" -COM_CIRCOLARI_CIRCOLARES_CHECKED_OUT = "N/A" -COM_CIRCOLARI_CIRCOLARES_CHECKED_OUT_TIME = "N/A" -COM_CIRCOLARI_CIRCOLARES_CREATED_BY = "Created by" -COM_CIRCOLARI_CIRCOLARES_MODIFIED_BY = "Modified by" -COM_CIRCOLARI_CIRCOLARES_TITLE = "Title" -COM_CIRCOLARI_CIRCOLARES_DESCRIPTION = "Description" -COM_CIRCOLARI_CIRCOLARES_ATTACHMENT = "Alle" -COM_CIRCOLARI_CIRCOLARES_IMAGE = "Image" -COM_CIRCOLARI_ID_DESC = "ID Descending" -COM_CIRCOLARI_STATE_DESC = "State Descending" -COM_CIRCOLARI_ORDERING_DESC = "Order Descending" -COM_CIRCOLARI_CHECKED_OUT_DESC = "N/A Descending" -COM_CIRCOLARI_CHECKED_OUT_TIME_DESC = "N/A Descending" -COM_CIRCOLARI_CREATED_BY_DESC = "Created by Descending" -COM_CIRCOLARI_MODIFIED_BY_DESC = "Modified by Descending" -COM_CIRCOLARI_TITLE_DESC = "Title Descending" -COM_CIRCOLARI_DESCRIPTION_DESC = "Description Descending" -COM_CIRCOLARI_ATTACHMENT_DESC = "Alle Descending" -COM_CIRCOLARI_IMAGE_DESC = "Image Descending" -COM_CIRCOLARI_ID_ASC = "ID Ascending" -COM_CIRCOLARI_STATE_ASC = "State Ascending" -COM_CIRCOLARI_ORDERING_ASC = "Order Ascending" -COM_CIRCOLARI_CHECKED_OUT_ASC = "N/A Ascending" -COM_CIRCOLARI_CHECKED_OUT_TIME_ASC = "N/A Ascending" -COM_CIRCOLARI_CREATED_BY_ASC = "Created by Ascending" -COM_CIRCOLARI_MODIFIED_BY_ASC = "Modified by Ascending" -COM_CIRCOLARI_TITLE_ASC = "Title Ascending" -COM_CIRCOLARI_DESCRIPTION_ASC = "Description Ascending" -COM_CIRCOLARI_ATTACHMENT_ASC = "Alle Ascending" -COM_CIRCOLARI_IMAGE_ASC = "Image Ascending" - -COM_CIRCOLARI_TITLE_CIRCOLARE = "Circolari" -COM_CIRCOLARI_LEGEND_CIRCOLARE = "Circolari" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_ID = "ID" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_ID = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_STATE = "State" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_STATE = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_ORDERING = "Order" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_ORDERING = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_CHECKED_OUT = "N/A" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_CHECKED_OUT = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_CHECKED_OUT_TIME = "N/A" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_CHECKED_OUT_TIME = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_CREATED_BY = "Created by" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_CREATED_BY = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_MODIFIED_BY = "Modified by" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_MODIFIED_BY = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_TITLE = "Title" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_TITLE = "" -COM_CIRCOLARI_TAB_CIRCOLARI = "Circolari" -COM_CIRCOLARI_FIELDSET_CIRCOLARI = "Circolari" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_DESCRIPTION = "Description" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_DESCRIPTION = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_ATTACHMENT = "Attachment" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_ATTACHMENT = "" -COM_CIRCOLARI_FORM_LBL_CIRCOLARE_IMAGE = "Image" -COM_CIRCOLARI_FORM_DESC_CIRCOLARE_IMAGE = "" - - - - +COM_CIRCOLARI="Circolari" +COM_CIRCOLARI_COMPONENT_LABEL="Circolari" +COM_CIRCOLARI_CONFIGURATION="Circolari Configuration" +COM_CIRCOLARI_ACCESS_HEADING="Access" +COM_CIRCOLARI_COMPONENT_DESC="" +COM_CIRCOLARI_XML_DESCRIPTION="" +COM_CIRCOLARI_N_ITEMS_ARCHIVED="%d items successfully archived" +COM_CIRCOLARI_N_ITEMS_ARCHIVED_1="%d item successfully archived" +COM_CIRCOLARI_N_ITEMS_CHECKED_IN_0="No item successfully checked in" +COM_CIRCOLARI_N_ITEMS_CHECKED_IN_1="%d item successfully checked in" +COM_CIRCOLARI_N_ITEMS_CHECKED_IN_MORE="%d items successfully checked in" +COM_CIRCOLARI_N_ITEMS_DELETED="%d items successfully deleted" +COM_CIRCOLARI_N_ITEMS_DELETED_1="%d item successfully deleted" +COM_CIRCOLARI_N_ITEMS_PUBLISHED="%d items successfully published" +COM_CIRCOLARI_N_ITEMS_PUBLISHED_1="%d item successfully published" +COM_CIRCOLARI_N_ITEMS_TRASHED="%d items successfully trashed" +COM_CIRCOLARI_N_ITEMS_TRASHED_1="%d item successfully trashed" +COM_CIRCOLARI_N_ITEMS_UNPUBLISHED="%d items successfully unpublished" +COM_CIRCOLARI_N_ITEMS_UNPUBLISHED_1="%d item successfully unpublished" +COM_CIRCOLARI_NO_ITEM_SELECTED="No items selected" +COM_CIRCOLARI_SAVE_SUCCESS="Item successfully saved" +COM_CIRCOLARI_ITEM_ID_SELECT_LABEL="Select the item ID" +COM_CIRCOLARI_ITEM_ID_SELECT_LABEL_FORM="Select the Item ID to Edit (Set up as 0 if you want to set up as add form)" +COM_CIRCOLARI_FIELDSET_ITEM_ID_SELECT_LABEL="Required Settings" +COM_CIRCOLARI_FILTER_SELECT_LABEL=" - Select %s - " +COM_CIRCOLARI_TEST_LABEL="Test label" +COM_CIRCOLARI_FIELDSET_RULES="Permissions" +COM_CIRCOLARI_FROM_FILTER="From %s" +COM_CIRCOLARI_TO_FILTER="To %s" +COM_CIRCOLARI_VIEW_FILE="[View File]" +COM_CIRCOLARI_ITEMS_SUCCESS_DUPLICATED="Items successfully duplicated" +COM_CIRCOLARI_TITLE_FIRMETIPI = "Firme" +COM_CIRCOLARI_TAB_ETICHETTA = "Firma" +COM_CIRCOLARI_FIELDSET_ETICHETTA="Firma" +COM_HIGHLIGHTS_FORM_LBL_ETICHETTA_NOME="Nome" +COM_HIGHLIGHTS_FORM_DESC_ETICHETTA_NOME="Nome" +COM_CIRCOLARI_SEARCH_FILTER_SUBMIT = "Search" +COM_CIRCOLARI_SEARCH_TOOLS = "Search Tools" +COM_CIRCOLARI_SEARCH_TOOLS_DESC = "Filter the list items" +COM_CIRCOLARI_SEARCH_FILTER_CLEAR = "Clear filter" + +COM_CIRCOLARI_XML_DESCRIPTION = "" + +COM_CIRCOLARI_TITLE_CIRCOLARES = "Circolari" +COM_CIRCOLARI_CIRCOLARES_ID = "ID" +COM_CIRCOLARI_CIRCOLARES_STATE = "State" +COM_CIRCOLARI_CIRCOLARES_ORDERING = "Order" +COM_CIRCOLARI_CIRCOLARES_CHECKED_OUT = "N/A" +COM_CIRCOLARI_CIRCOLARES_CHECKED_OUT_TIME = "N/A" +COM_CIRCOLARI_CIRCOLARES_CREATED_BY = "Created by" +COM_CIRCOLARI_CIRCOLARES_MODIFIED_BY = "Modified by" +COM_CIRCOLARI_CIRCOLARES_TITLE = "Title" +COM_CIRCOLARI_CIRCOLARES_DESCRIPTION = "Description" +COM_CIRCOLARI_CIRCOLARES_ATTACHMENT = "Alle" +COM_CIRCOLARI_CIRCOLARES_IMAGE = "Image" +COM_CIRCOLARI_ID_DESC = "ID Descending" +COM_CIRCOLARI_STATE_DESC = "State Descending" +COM_CIRCOLARI_ORDERING_DESC = "Order Descending" +COM_CIRCOLARI_CHECKED_OUT_DESC = "N/A Descending" +COM_CIRCOLARI_CHECKED_OUT_TIME_DESC = "N/A Descending" +COM_CIRCOLARI_CREATED_BY_DESC = "Created by Descending" +COM_CIRCOLARI_MODIFIED_BY_DESC = "Modified by Descending" +COM_CIRCOLARI_TITLE_DESC = "Title Descending" +COM_CIRCOLARI_DESCRIPTION_DESC = "Description Descending" +COM_CIRCOLARI_ATTACHMENT_DESC = "Alle Descending" +COM_CIRCOLARI_IMAGE_DESC = "Image Descending" +COM_CIRCOLARI_ID_ASC = "ID Ascending" +COM_CIRCOLARI_STATE_ASC = "State Ascending" +COM_CIRCOLARI_ORDERING_ASC = "Order Ascending" +COM_CIRCOLARI_CHECKED_OUT_ASC = "N/A Ascending" +COM_CIRCOLARI_CHECKED_OUT_TIME_ASC = "N/A Ascending" +COM_CIRCOLARI_CREATED_BY_ASC = "Created by Ascending" +COM_CIRCOLARI_MODIFIED_BY_ASC = "Modified by Ascending" +COM_CIRCOLARI_TITLE_ASC = "Title Ascending" +COM_CIRCOLARI_DESCRIPTION_ASC = "Description Ascending" +COM_CIRCOLARI_ATTACHMENT_ASC = "Alle Ascending" +COM_CIRCOLARI_IMAGE_ASC = "Image Ascending" + +COM_CIRCOLARI_TITLE_CIRCOLARE = "Circolari" +COM_CIRCOLARI_LEGEND_CIRCOLARE = "Circolari" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_ID = "ID" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_ID = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_STATE = "State" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_STATE = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_ORDERING = "Order" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_ORDERING = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_CHECKED_OUT = "N/A" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_CHECKED_OUT = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_CHECKED_OUT_TIME = "N/A" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_CHECKED_OUT_TIME = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_CREATED_BY = "Created by" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_CREATED_BY = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_MODIFIED_BY = "Modified by" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_MODIFIED_BY = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_TITLE = "Title" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_TITLE = "" +COM_CIRCOLARI_TAB_CIRCOLARI = "Circolari" +COM_CIRCOLARI_FIELDSET_CIRCOLARI = "Circolari" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_DESCRIPTION = "Description" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_DESCRIPTION = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_ATTACHMENT = "Attachment" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_ATTACHMENT = "" +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_IMAGE = "Image" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_IMAGE = "" + + + + + +COM_CIRCOLARI_TITLE_CATEGORIE="Categorie" + +COM_CIRCOLARI_TITLE_CATEGORIA="Categoria" + +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_USERGROUP="Gruppo utenti" +COM_CIRCOLARI_FORM_DESC_CIRCOLARE_USERGROUP="Limita questa circolare a un gruppo utenti specifico (0 = nessun vincolo)." + +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_IMAGE="Immagine" + +COM_CIRCOLARI_FORM_LBL_CIRCOLARE_ATTACHMENT="Allegato" diff --git a/administrator/sql/install.mysql.utf8.sql b/administrator/sql/install.mysql.utf8.sql index e25f1ae..c2f870d 100644 --- a/administrator/sql/install.mysql.utf8.sql +++ b/administrator/sql/install.mysql.utf8.sql @@ -9,32 +9,37 @@ CREATE TABLE IF NOT EXISTS `#__circolari_firmetipi` ( ) ENGINE=InnoDB DEFAULT COLLATE=utf8mb4_unicode_ci; -- Tabella principale circolari -CREATE TABLE IF NOT EXISTS `#__circolari` ( - `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, - `state` TINYINT(1) NULL DEFAULT 1, - `ordering` INT(11) NULL DEFAULT 0, - `checked_out` INT(11) UNSIGNED DEFAULT NULL, - `checked_out_time` DATETIME NULL DEFAULT NULL, - `created_by` INT(11) UNSIGNED NULL DEFAULT 0, - `modified_by` INT(11) UNSIGNED NULL DEFAULT 0, - `title` VARCHAR(255) NULL DEFAULT "", - `description` TEXT NULL, - `attachment` VARCHAR(255) NULL DEFAULT "", - `image` VARCHAR(255) NULL DEFAULT "", - `tipologia_firma_id` INT(11) UNSIGNED DEFAULT NULL, - `firma_obbligatoria` TINYINT(1) DEFAULT 0, - `scadenza` DATE DEFAULT NULL, - PRIMARY KEY (`id`), - KEY `idx_state` (`state`), - KEY `idx_checked_out` (`checked_out`), - KEY `idx_created_by` (`created_by`), - KEY `idx_modified_by` (`modified_by`), - KEY `idx_tipologia_firma_id` (`tipologia_firma_id`), - CONSTRAINT `fk_tipologia_firma` - FOREIGN KEY (`tipologia_firma_id`) - REFERENCES `#__circolari_firmetipi` (`id`) - ON DELETE SET NULL - ON UPDATE CASCADE +CREATE TABLE IF NOT EXISTS `#__circolari` (`id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, +`state` TINYINT(1) DEFAULT 1, +`ordering` INT(11) DEFAULT 0, +`checked_out` INT(11) UNSIGNED DEFAULT NULL, +`checked_out_time` DATETIME DEFAULT NULL, +`created_by` INT(11) UNSIGNED DEFAULT 0, +`modified_by` INT(11) UNSIGNED DEFAULT 0, +`categoria_id` INT(11) UNSIGNED NOT NULL DEFAULT 0, +`usergroup_id` INT(11) UNSIGNED NOT NULL DEFAULT 0, +`hits` INT(11) UNSIGNED NOT NULL DEFAULT 0, +`title` VARCHAR(255) DEFAULT "", +`description` TEXT, +`attachment` VARCHAR(255) DEFAULT "", +`image` VARCHAR(255) DEFAULT "", +`tipologia_firma_id` INT(11) UNSIGNED DEFAULT NULL, +`firma_obbligatoria` TINYINT(1) DEFAULT 0, +`scadenza` DATETIME DEFAULT NULL, +PRIMARY KEY (`id`), +KEY `idx_state` (`state`), +KEY `idx_checked_out` (`checked_out`), +KEY `idx_created_by` (`created_by`), +KEY `idx_modified_by` (`modified_by`), +KEY `idx_tipologia_firma_id` (`tipologia_firma_id`), +KEY `idx_categoria_id` (`categoria_id`), +KEY `idx_usergroup_id` (`usergroup_id`), +KEY `idx_hits` (`hits`), +CONSTRAINT `fk_tipologia_firma` + FOREIGN KEY (`tipologia_firma_id`) + REFERENCES `#__circolari_firmetipi` (`id`) + ON DELETE SET NULL + ON UPDATE CASCADE ) ENGINE=InnoDB DEFAULT COLLATE=utf8mb4_unicode_ci; -- Tabella firme @@ -47,3 +52,21 @@ CREATE TABLE IF NOT EXISTS `#__circolari_firme` ( PRIMARY KEY (`id`), UNIQUE KEY `firma_unica` (`circolare_id`, `user_id`) ) ENGINE=InnoDB DEFAULT COLLATE=utf8mb4_unicode_ci; + + +-- Aggiunge tabella categorie interne per com_circolari e il campo categoria_id su #__circolari +CREATE TABLE IF NOT EXISTS `#__circolari_categorie` ( + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `title` VARCHAR(190) NOT NULL, + `alias` VARCHAR(190) NOT NULL DEFAULT '', + `description` TEXT DEFAULT NULL, + `state` TINYINT(1) NOT NULL DEFAULT 1, + `ordering` INT(11) NOT NULL DEFAULT 0, + `created` DATETIME NULL DEFAULT NULL, + `created_by` INT(10) UNSIGNED NULL DEFAULT NULL, + `modified` DATETIME NULL DEFAULT NULL, + `modified_by` INT(10) UNSIGNED NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `idx_alias` (`alias`) +) ENGINE=InnoDB DEFAULT COLLATE=utf8mb4_unicode_ci; + diff --git a/administrator/sql/updates/1.1.3.sql b/administrator/sql/updates/1.1.3.sql index 3109bb6..e73639f 100644 --- a/administrator/sql/updates/1.1.3.sql +++ b/administrator/sql/updates/1.1.3.sql @@ -1,9 +1,9 @@ ALTER TABLE `#__circolari` - ADD COLUMN `catid` INT(10) UNSIGNED NOT NULL DEFAULT 0 AFTER `modified_by`, - ADD INDEX `idx_catid` (`catid`); + ADD COLUMN `categoria_id` INT(10) UNSIGNED NOT NULL DEFAULT 0 AFTER `modified_by`, + ADD INDEX `idx_catid` (`categoria_id`); ALTER TABLE `#__circolari` - ALTER `catid` SET DEFAULT 11; + ALTER `categoria_id` SET DEFAULT 11; --- opzionale, porta a 11 i record con catid 0/null -UPDATE `#__circolari` SET `catid` = 11 WHERE `catid` IS NULL OR `catid` = 0; +-- opzionale, porta a 11 i record con categoria_id 0/null +UPDATE `#__circolari` SET `categoria_id` = 11 WHERE `categoria_id` IS NULL OR `categoria_id` = 0; diff --git a/administrator/sql/updates/1.1.4.sql b/administrator/sql/updates/1.1.4.sql new file mode 100644 index 0000000..0928a00 --- /dev/null +++ b/administrator/sql/updates/1.1.4.sql @@ -0,0 +1,15 @@ +-- Aggiunge tabella categorie interne per com_circolari e il campo categoria_id su #__circolari +CREATE TABLE IF NOT EXISTS `#__circolari_categorie` ( + `id` INT(11) UNSIGNED NOT NULL AUTO_INCREMENT, + `title` VARCHAR(190) NOT NULL, + `alias` VARCHAR(190) NOT NULL DEFAULT '', + `description` TEXT DEFAULT NULL, + `state` TINYINT(1) NOT NULL DEFAULT 1, + `ordering` INT(11) NOT NULL DEFAULT 0, + `created` DATETIME NULL DEFAULT NULL, + `created_by` INT(10) UNSIGNED NULL DEFAULT NULL, + `modified` DATETIME NULL DEFAULT NULL, + `modified_by` INT(10) UNSIGNED NULL DEFAULT NULL, + PRIMARY KEY (`id`), + UNIQUE KEY `idx_alias` (`alias`) +) ENGINE=InnoDB DEFAULT COLLATE=utf8mb4_unicode_ci; diff --git a/administrator/sql/updates/1.1.5.sql b/administrator/sql/updates/1.1.5.sql new file mode 100644 index 0000000..f8a5090 --- /dev/null +++ b/administrator/sql/updates/1.1.5.sql @@ -0,0 +1,7 @@ +-- Rimuove catid (categoria Joomla), aggiunge usergroup_id e hits +ALTER TABLE `#__circolari` + DROP COLUMN IF EXISTS `catid`, + ADD COLUMN IF NOT EXISTS `usergroup_id` INT(11) UNSIGNED NOT NULL DEFAULT 0 , + ADD COLUMN IF NOT EXISTS `hits` INT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `usergroup_id`, + ADD INDEX `idx_usergroup_id` (`usergroup_id`), + ADD INDEX `idx_hits` (`hits`); diff --git a/administrator/sql/updates/1.1.6.sql b/administrator/sql/updates/1.1.6.sql new file mode 100644 index 0000000..1b12aca --- /dev/null +++ b/administrator/sql/updates/1.1.6.sql @@ -0,0 +1,3 @@ +-- Converte scadenza a DATETIME per includere orario +ALTER TABLE `#__circolari` + MODIFY `scadenza` DATETIME NULL DEFAULT NULL; \ No newline at end of file diff --git a/administrator/src/Controller/CategoriaController.php b/administrator/src/Controller/CategoriaController.php new file mode 100644 index 0000000..b7c9ec6 --- /dev/null +++ b/administrator/src/Controller/CategoriaController.php @@ -0,0 +1,24 @@ + + * @copyright 2024 Eddy Prosperi + * @license GNU General Public License versione 2 o successiva; vedi LICENSE.txt + */ + +namespace Pcrt\Component\Circolari\Administrator\Controller; + +\defined('_JEXEC') or die; + +use Joomla\CMS\MVC\Controller\FormController; + +/** + * Etichetta Categoria controller class. + * + * @since 1.0.0 + */ +class CategoriaController extends FormController +{ + protected $view_list = 'categorie'; +} diff --git a/administrator/src/Controller/CategorieController.php b/administrator/src/Controller/CategorieController.php new file mode 100644 index 0000000..f82b4d1 --- /dev/null +++ b/administrator/src/Controller/CategorieController.php @@ -0,0 +1,116 @@ + + * @copyright 2024 Eddy Prosperi + * @license GNU General Public License versione 2 o successiva; vedi LICENSE.txt + */ + +namespace Pcrt\Component\Circolari\Administrator\Controller; + +\defined('_JEXEC') or die; + +use Joomla\CMS\Application\SiteApplication; +use Joomla\CMS\Factory; +use Joomla\CMS\Language\Multilanguage; +use Joomla\CMS\Language\Text; +use Joomla\CMS\MVC\Controller\AdminController; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Uri\Uri; +use Joomla\Utilities\ArrayHelper; + +/** + * Etichette list Categorie controller class. + * + * @since 1.0.0 + */ +class CategorieController extends AdminController +{ + /** + * Method to clone existing Etichette + * + * @return void + * + * @throws Exception + */ + public function duplicate() + { + // Check for request forgeries + $this->checkToken(); + + // Get id(s) + $pks = $this->input->post->get('cid', array(), 'array'); + + try + { + if (empty($pks)) + { + throw new \Exception(Text::_('COM_HIGHLIGHTS_NO_ELEMENT_SELECTED')); + } + + ArrayHelper::toInteger($pks); + $model = $this->getModel(); + $model->duplicate($pks); + $this->setMessage(Text::_('COM_HIGHLIGHTS_ITEMS_SUCCESS_DUPLICATED')); + } + catch (\Exception $e) + { + Factory::getApplication()->enqueueMessage($e->getMessage(), 'warning'); + } + + $this->setRedirect('index.php?option=com_circolari&view=categorie'); + } + + /** + * Proxy for getModel. + * + * @param string $name Optional. Model name + * @param string $prefix Optional. Class prefix + * @param array $config Optional. Configuration array for model + * + * @return object The Model + * + * @since 1.0.0 + */ + public function getModel($name = 'FirmaTipo', $prefix = 'Administrator', $config = array()) + { + return parent::getModel($name, $prefix, array('ignore_request' => true)); + } + + + + /** + * Method to save the submitted ordering values for records via AJAX. + * + * @return void + * + * @since 1.0.0 + * + * @throws Exception + */ + public function saveOrderAjax() + { + // Get the input + $pks = $this->input->post->get('cid', array(), 'array'); + $order = $this->input->post->get('order', array(), 'array'); + + // Sanitize the input + ArrayHelper::toInteger($pks); + ArrayHelper::toInteger($order); + + // Get the model + $model = $this->getModel(); + + // Save the ordering + $return = $model->saveorder($pks, $order); + + if ($return) + { + echo "1"; + } + + // Close the application + Factory::getApplication()->close(); + } +} diff --git a/administrator/src/Controller/CircolareController.php b/administrator/src/Controller/CircolareController.php index cb630e9..26fc3ec 100644 --- a/administrator/src/Controller/CircolareController.php +++ b/administrator/src/Controller/CircolareController.php @@ -20,5 +20,12 @@ use Joomla\CMS\MVC\Controller\FormController; */ class CircolareController extends FormController { - protected $view_list = 'circolares'; + protected $view_list = 'circolares'; + + public function __construct($config = array()) + { + parent::__construct($config); + $this->registerTask('apply', 'save'); + $this->registerTask('save2new', 'save'); + } } diff --git a/administrator/src/Field/CalSafeField.php b/administrator/src/Field/CalSafeField.php new file mode 100644 index 0000000..5cb3cfe --- /dev/null +++ b/administrator/src/Field/CalSafeField.php @@ -0,0 +1,49 @@ +name; + $id = $this->id; + $value = (string) $this->value; + + if (!empty($value)) { + $value = preg_replace('/\s+/', ' ', $value); + $value = str_replace('T', ' ', $value); + if (preg_match('/^(\d{4}-\d{2}-\d{2})\s(\d{2}:\d{2})(?::\d{2})?$/', $value, $m)) { + $value = $m[1] . 'T' . $m[2]; + } else { + try { + $dt = Factory::getDate($value); + $value = $dt->format('Y-m-d\TH:i'); + } catch (\Throwable $e) { + $value = ''; + } + } + } + + $attrs = []; + $attrs[] = 'type="datetime-local"'; + $attrs[] = 'name="' . htmlspecialchars($name, ENT_COMPAT, 'UTF-8') . '"'; + $attrs[] = 'id="' . htmlspecialchars($id, ENT_COMPAT, 'UTF-8') . '"'; + if ($value !== '') { + $attrs[] = 'value="' . htmlspecialchars($value, ENT_COMPAT, 'UTF-8') . '"'; + } + if ($this->required) $attrs.append('required'); + if ($this->readonly) $attrs.append('readonly'); + if ($this->disabled) $attrs.append('disabled'); + $class = $this->element['class'] ? (string) $this->element['class'] : 'form-control'; + $attrs[] = 'class="' . htmlspecialchars($class, ENT_COMPAT, 'UTF-8') . '"'; + + return ''; + } +} diff --git a/administrator/src/Field/CategoriaField.php b/administrator/src/Field/CategoriaField.php new file mode 100644 index 0000000..bbd4bd7 --- /dev/null +++ b/administrator/src/Field/CategoriaField.php @@ -0,0 +1,34 @@ +get('DatabaseDriver'); + $q = $db->getQuery(true) + ->select($db->quoteName(['id','title'])) + ->from($db->quoteName('#__circolari_categorie')) + ->where($db->quoteName('state') . ' = 1') + ->order($db->quoteName('title') . ' ASC'); + $db->setQuery($q); + + $rows = (array) $db->loadObjectList(); + foreach ($rows as $row) { + $options[] = (object)[ 'value' => (int)$row->id, 'text' => (string)$row->title ]; + } + + $options = array_merge(parent::getOptions(), $options); + return $options; + } +} diff --git a/administrator/src/Field/TipologiafirmaField.php b/administrator/src/Field/TipologiafirmaField.php new file mode 100644 index 0000000..b02346e --- /dev/null +++ b/administrator/src/Field/TipologiafirmaField.php @@ -0,0 +1,28 @@ +get('DatabaseDriver'); + $q = $db->getQuery(true) + ->select($db->quoteName(['id','nome'])) + ->from($db->quoteName('#__circolari_firmetipi')) + ->where($db->quoteName('state') . ' = 1') + ->order($db->quoteName('nome') . ' ASC'); + $db->setQuery($q); + foreach ((array)$db->loadObjectList() as $row) { + $options[] = (object) ['value' => (int) $row->id, 'text' => (string) $row->nome]; + } + return $options; + } +} diff --git a/administrator/src/Model/CategoriaModel.php b/administrator/src/Model/CategoriaModel.php new file mode 100644 index 0000000..2285fd1 --- /dev/null +++ b/administrator/src/Model/CategoriaModel.php @@ -0,0 +1,275 @@ + + * @copyright 2024 Eddy Prosperi + * @license GNU General Public License versione 2 o successiva; vedi LICENSE.txt + */ + +namespace Pcrt\Component\Circolari\Administrator\Model; +// No direct access. +defined('_JEXEC') or die; + +use \Joomla\CMS\Table\Table; +use \Joomla\CMS\Factory; +use \Joomla\CMS\Language\Text; +use \Joomla\CMS\Plugin\PluginHelper; +use \Joomla\CMS\MVC\Model\AdminModel; +use \Joomla\CMS\Helper\TagsHelper; +use \Joomla\CMS\Filter\OutputFilter; +use \Joomla\CMS\Event\Model; +use Joomla\CMS\Event\AbstractEvent; + + +/** + * Etichetta model. + * + * @since 1.0.0 + */ +class CategoriaModel extends AdminModel +{ + /** + * @var string The prefix to use with controller messages. + * + * @since 1.0.0 + */ + protected $text_prefix = 'COM_CIRCOLARI'; + + /** + * @var string Alias to manage history control + * + * @since 1.0.0 + */ + public $typeAlias = 'com_circolari.categoria'; + + /** + * @var null Item data + * + * @since 1.0.0 + */ + protected $item = null; + + + + + /** + * Returns a reference to the a Table object, always creating it. + * + * @param string $type The table type to instantiate + * @param string $prefix A prefix for the table class CategoriaModel. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return Table A database object + * + * @since 1.0.0 + */ + public function getTable($type = 'Categoria', $prefix = 'Administrator', $config = array()) + { + return parent::getTable($type, $prefix, $config); + } + + /** + * Method to get the record form. + * + * @param array $data An optional array of data for the form to interogate. + * @param boolean $loadData True if the form is to load its own data (default case), false if not. + * + * @return \JForm|boolean A \JForm object on success, false on failure + * + * @since 1.0.0 + */ + public function getForm($data = array(), $loadData = true) + { + // Initialise variables. + $app = Factory::getApplication(); + + // Get the form. + $form = $this->loadForm('com_circolari.categoria', 'categoria', + array( + 'control' => 'jform', + 'load_data' => $loadData + ) + ); + + + + if (empty($form)) + { + return false; + } + + return $form; + } + + + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.0.0 + */ + protected function loadFormData() + { + // Check the session for previously entered form data. + $data = Factory::getApplication()->getUserState('com_circolari.edit.categoria.data', array()); + + if (empty($data)) + { + if ($this->item === null) + { + $this->item = $this->getItem(); + } + + $data = $this->item; + + } + + return $data; + } + + /** + * Method to get a single record. + * + * @param integer $pk The id of the primary key. + * + * @return mixed Object on success, false on failure. + * + * @since 1.0.0 + */ + public function getItem($pk = null) + { + + if ($item = parent::getItem($pk)) + { + if (isset($item->params)) + { + $item->params = json_encode($item->params); + } + + // Do any procesing on fields here if needed + } + + return $item; + + } + + /** + * Method to duplicate an Etichetta + * + * @param array &$pks An array of primary key IDs. + * + * @return boolean True if successful. + * + * @throws Exception + */ + public function duplicate(&$pks) + { + $app = Factory::getApplication(); + $user = $app->getIdentity(); + $dispatcher = $this->getDispatcher(); + + // Access checks. + if (!$user->authorise('core.create', 'com_circolari')) + { + throw new \Exception(Text::_('JERROR_CORE_CREATE_NOT_PERMITTED')); + } + + $context = $this->option . '.' . $this->name; + + // Include the plugins for the save events. + PluginHelper::importPlugin($this->events_map['save']); + + $table = $this->getTable(); + + foreach ($pks as $pk) + { + + if ($table->load($pk, true)) + { + // Reset the id to create a new record. + $table->id = 0; + + if (!$table->check()) + { + throw new \Exception($table->getError()); + } + + + // Create the before save event. + $beforeSaveEvent = AbstractEvent::create( + $this->event_before_save, + [ + 'context' => $context, + 'subject' => $table, + 'isNew' => true, + 'data' => $table, + ] + ); + + // Trigger the before save event. + $dispatchResult = Factory::getApplication()->getDispatcher()->dispatch($this->event_before_save, $beforeSaveEvent); + + // Check if dispatch result is an array and handle accordingly + $result = isset($dispatchResult['result']) ? $dispatchResult['result'] : []; + + // Proceed with your logic + if (in_array(false, $result, true) || !$table->store()) { + throw new \Exception($table->getError()); + } + + // Trigger the after save event. + Factory::getApplication()->getDispatcher()->dispatch( + $this->event_after_save, + AbstractEvent::create( + $this->event_after_save, + [ + 'context' => $context, + 'subject' => $table, + 'isNew' => true, + 'data' => $table, + ] + ) + ); + } + else + { + throw new \Exception($table->getError()); + } + + } + + // Clean cache + $this->cleanCache(); + + return true; + } + + /** + * Prepare and sanitise the table prior to saving. + * + * @param Table $table Table Object + * + * @return void + * + * @since 1.0.0 + */ + protected function prepareTable($table) + { + jimport('joomla.filter.output'); + + if (empty($table->id)) + { + // Set ordering to the last item if not set + if (@$table->ordering === '') + { + $db = $this->getDbo(); + $db->setQuery('SELECT MAX(ordering) FROM #__circolari_categorie'); + $max = $db->loadResult(); + $table->ordering = $max + 1; + } + } + } +} diff --git a/administrator/src/Model/CategorieModel.php b/administrator/src/Model/CategorieModel.php new file mode 100644 index 0000000..1dcd299 --- /dev/null +++ b/administrator/src/Model/CategorieModel.php @@ -0,0 +1,195 @@ + + * @copyright 2024 Eddy Prosperi + * @license GNU General Public License versione 2 o successiva; vedi LICENSE.txt + */ + +namespace Pcrt\Component\Circolari\Administrator\Model; +// No direct access. +defined('_JEXEC') or die; + +use \Joomla\CMS\MVC\Model\ListModel; +use \Joomla\Component\Fields\Administrator\Helper\FieldsHelper; +use \Joomla\CMS\Factory; +use \Joomla\CMS\Language\Text; +use \Joomla\CMS\Helper\TagsHelper; +use \Joomla\Database\ParameterType; +use \Joomla\Utilities\ArrayHelper; + +/** + * Methods supporting a list of Etichette records. + * + * @since 1.0.0 + */ +class CategorieModel extends ListModel +{ + /** + * Constructor. + * + * @param array $config An optional associative array of configuration settings. + * + * @see JController + * @since 1.6 + */ + public function __construct($config = array()) + { + if (empty($config['filter_fields'])) + { + $config['filter_fields'] = array( + 'id', 'a.id', + 'state', 'a.state', + 'ordering', 'a.ordering', + 'created_by', 'a.created_by', + 'modified_by', 'a.modified_by', + 'title', 'a.title', + 'lingua', 'a.lingua', + ); + } + + parent::__construct($config); + } + + + + + + + + + /** + * Method to auto-populate the model state. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering Elements order + * @param string $direction Order direction + * + * @return void + * + * @throws Exception + */ + protected function populateState($ordering = null, $direction = null) + { + // List state information. + parent::populateState("a.id", "ASC"); + + $context = $this->getUserStateFromRequest($this->context.'.filter.search', 'filter_search'); + $this->setState('filter.search', $context); + + // Split context into component and optional section + if (!empty($context)) + { + $parts = FieldsHelper::extract($context); + + if ($parts) + { + $this->setState('filter.component', $parts[0]); + $this->setState('filter.section', $parts[1]); + } + } + } + + /** + * Method to get a store id based on model configuration state. + * + * This is necessary because the model is used by the component and + * different modules that might need different sets of data or different + * ordering requirements. + * + * @param string $id A prefix for the store id. + * + * @return string A store id. + * + * @since 1.0.0 + */ + protected function getStoreId($id = '') + { + // Compile the store id. + $id .= ':' . $this->getState('filter.search'); + $id .= ':' . $this->getState('filter.state'); + + + return parent::getStoreId($id); + + } + + /** + * Build an SQL query to load the list data. + * + * @return DatabaseQuery + * + * @since 1.0.0 + */ + protected function getListQuery() + { + // Create a new query object. + $db = $this->getDbo(); + $query = $db->getQuery(true); + + // Select the required fields from the table. + $query->select( + $this->getState( + 'list.select', 'DISTINCT a.*' + ) + ); + $query->from('`#__circolari_categorie` AS a'); + + + + + // Filter by published state + $published = $this->getState('filter.state'); + + if (is_numeric($published)) + { + $query->where('a.state = ' . (int) $published); + } + elseif (empty($published)) + { + $query->where('(a.state IN (0, 1))'); + } + + // Filter by search in title + $search = $this->getState('filter.search'); + + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + else + { + $search = $db->Quote('%' . $db->escape($search, true) . '%'); + + } + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', "a.id"); + $orderDirn = $this->state->get('list.direction', "ASC"); + + if ($orderCol && $orderDirn) + { + $query->order($db->escape($orderCol . ' ' . $orderDirn)); + } + + return $query; + } + + /** + * Get an array of data items + * + * @return mixed Array of data items on success, false on failure. + */ + public function getItems() + { + $items = parent::getItems(); + + + return $items; + } +} diff --git a/administrator/src/Model/CircolareModel.php b/administrator/src/Model/CircolareModel.php index 3133df0..420af0b 100644 --- a/administrator/src/Model/CircolareModel.php +++ b/administrator/src/Model/CircolareModel.php @@ -129,9 +129,9 @@ class CircolareModel extends AdminModel if ((is_array($data) && empty($data['id'])) || (is_object($data) && empty($data->id))) { if (is_array($data)) { - $data['catid'] = (int)($data['catid'] ?? 0) ?: 11; + $data['categoria_id'] = (int)($data['categoria_id'] ?? 0) ?: 0; } else { - $data->catid = (int)($data->catid ?? 0) ?: 11; + $data->categoria_id = (int)($data->categoria_id ?? 0) ?: 0; } } diff --git a/administrator/src/Table/CategoriaTable.php b/administrator/src/Table/CategoriaTable.php new file mode 100644 index 0000000..6cf62df --- /dev/null +++ b/administrator/src/Table/CategoriaTable.php @@ -0,0 +1,327 @@ + + * @copyright 2024 Eddy Prosperi + * @license GNU General Public License versione 2 o successiva; vedi LICENSE.txt + */ + +namespace Pcrt\Component\Circolari\Administrator\Table; +// No direct access +defined('_JEXEC') or die; + +use \Joomla\Utilities\ArrayHelper; +use \Joomla\CMS\Factory; +use \Joomla\CMS\Access\Access; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Application\ApplicationHelper; +use \Joomla\CMS\Table\Table as Table; +use \Joomla\CMS\Versioning\VersionableTableInterface; +use Joomla\CMS\Tag\TaggableTableInterface; +use Joomla\CMS\Tag\TaggableTableTrait; +use \Joomla\Database\DatabaseDriver; +use \Joomla\CMS\Filter\OutputFilter; +use \Joomla\CMS\Filesystem\File; +use \Joomla\Registry\Registry; +use \Pcrt\Component\Circolari\Administrator\Helper\CircolariHelper; +use \Joomla\CMS\Helper\ContentHelper; + + +/** + * Categoria table + * + * @since 1.0.0 + */ +class CategoriaTable extends Table implements VersionableTableInterface, TaggableTableInterface +{ + use TaggableTableTrait; + + /** + * Indicates that columns fully support the NULL value in the database + * + * @var boolean + * @since 4.0.0 + */ + protected $_supportNullValue = true; + + + /** + * Constructor + * + * @param JDatabase &$db A database connector object + */ + public function __construct(DatabaseDriver $db) + { + $this->typeAlias = 'com_circolari.firmaTipo'; + parent::__construct('#__circolari_categorie', 'id', $db); + $this->setColumnAlias('published', 'state'); + + } + + /** + * Get the type alias for the history table + * + * @return string The alias as described above + * + * @since 1.0.0 + */ + public function getTypeAlias() + { + return $this->typeAlias; + } + + /** + * Overloaded bind function to pre-process the params. + * + * @param array $array Named array + * @param mixed $ignore Optional array or list of parameters to ignore + * + * @return boolean True on success. + * + * @see Table:bind + * @since 1.0.0 + * @throws \InvalidArgumentException + */ + public function bind($array, $ignore = '') + { + $date = Factory::getDate(); + $task = Factory::getApplication()->input->get('task'); + $user = Factory::getApplication()->getIdentity(); + + $input = Factory::getApplication()->input; + $task = $input->getString('task', ''); + + if ($array['id'] == 0 && empty($array['created_by'])) + { + $array['created_by'] = Factory::getUser()->id; + } + + if ($array['id'] == 0 && empty($array['modified_by'])) + { + $array['modified_by'] = Factory::getUser()->id; + } + + if ($task == 'apply' || $task == 'save') + { + $array['modified_by'] = Factory::getUser()->id; + } + + if (isset($array['params']) && is_array($array['params'])) + { + $registry = new Registry; + $registry->loadArray($array['params']); + $array['params'] = (string) $registry; + } + + if (isset($array['metadata']) && is_array($array['metadata'])) + { + $registry = new Registry; + $registry->loadArray($array['metadata']); + $array['metadata'] = (string) $registry; + } + + if (!$user->authorise('core.admin', 'com_circolari.firmaTipo.' . $array['id'])) + { + $actions = Access::getActionsFromFile( + JPATH_ADMINISTRATOR . '/components/com_circolari/access.xml', + "/access/section[@name='firmaTipo']/" + ); + $default_actions = Access::getAssetRules('com_circolari.firmaTipo.' . $array['id'])->getData(); + $array_jaccess = array(); + + foreach ($actions as $action) + { + if (key_exists($action->name, $default_actions)) + { + $array_jaccess[$action->name] = $default_actions[$action->name]; + } + } + + $array['rules'] = $this->JAccessRulestoArray($array_jaccess); + } + + // Bind the rules for ACL where supported. + if (isset($array['rules']) && is_array($array['rules'])) + { + $this->setRules($array['rules']); + } + + return parent::bind($array, $ignore); + } + + /** + * Method to store a row in the database from the Table instance properties. + * + * If a primary key value is set the row with that primary key value will be updated with the instance property values. + * If no primary key value is set a new row will be inserted into the database with the properties from the Table instance. + * + * @param boolean $updateNulls True to update fields even if they are null. + * + * @return boolean True on success. + * + * @since 1.0.0 + */ + public function store($updateNulls = true) + { + + + return parent::store($updateNulls); + } + + /** + * This function convert an array of Access objects into an rules array. + * + * @param array $jaccessrules An array of Access objects. + * + * @return array + */ + private function JAccessRulestoArray($jaccessrules) + { + $rules = array(); + + foreach ($jaccessrules as $action => $jaccess) + { + $actions = array(); + + if ($jaccess) + { + foreach ($jaccess->getData() as $group => $allow) + { + $actions[$group] = ((bool)$allow); + } + } + + $rules[$action] = $actions; + } + + return $rules; + } + + /** + * Overloaded check function + * + * @return bool + */ + + /** + * Check and prepare data (ordering, title, alias uniqueness) + * + * @return boolean + */ + public function check() + { + // If ordering exists and new row, set next ordering + if (property_exists($this, 'ordering') && (int) $this->id === 0) { + $this->ordering = self::getNextOrder(); + } + + // Title required + $this->title = trim((string) ($this->title ?? '')); + if ($this->title === '') { + $this->setError(Text::_('JLIB_DATABASE_ERROR_MUSTCONTAIN_A_TITLE')); + return false; + } + + // --- ALIAS: generate if empty, sanitize, avoid numeric-only, make unique --- + $this->alias = trim((string) ($this->alias ?? '')); + if ($this->alias === '') { + $this->alias = ApplicationHelper::stringURLSafe($this->title); + } else { + $this->alias = ApplicationHelper::stringURLSafe($this->alias); + } + if ($this->alias === '' || ctype_digit($this->alias)) { + $seed = (int) ($this->id ?: time()); + $this->alias = ApplicationHelper::stringURLSafe($this->title . '-' . $seed); + } + $base = $this->alias; + $i = 2; + while ($this->aliasExists($this->alias, (int) $this->id)) { + $this->alias = $base . '-' . $i; + $i++; + } + + return parent::check(); + } + + /** + * Check if an alias already exists (excluding current id) + */ + protected function aliasExists(string $alias, int $excludeId = 0): bool + { + $query = $this->_db->getQuery(true) + ->select('COUNT(*)') + ->from($this->_db->quoteName('#__circolari_categorie')) + ->where($this->_db->quoteName('alias') . ' = ' . $this->_db->quote($alias)); + + if ($excludeId > 0) { + $query->where($this->_db->quoteName('id') . ' != ' . (int) $excludeId); + } + + $this->_db->setQuery($query); + return (int) $this->_db->loadResult() > 0; + } + + + /** + * Define a namespaced asset name for inclusion in the #__assets table + * + * @return string The asset name + * + * @see Table::_getAssetName + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + + return $this->typeAlias . '.' . (int) $this->$k; + } + + /** + * Returns the parent asset's id. If you have a tree structure, retrieve the parent's id using the external key field + * + * @param Table $table Table name + * @param integer $id Id + * + * @see Table::_getAssetParentId + * + * @return mixed The id on success, false on failure. + */ + protected function _getAssetParentId($table = null, $id = null) + { + // We will retrieve the parent-asset from the Asset-table + $assetParent = Table::getInstance('Asset'); + + // Default: if no asset-parent can be found we take the global asset + $assetParentId = $assetParent->getRootId(); + + // The item has the component as asset-parent + $assetParent->loadByName('com_circolari'); + + // Return the found asset-parent-id + if ($assetParent->id) + { + $assetParentId = $assetParent->id; + } + + return $assetParentId; + } + + //XXX_CUSTOM_TABLE_FUNCTION + + + /** + * Delete a record by id + * + * @param mixed $pk Primary key value to delete. Optional + * + * @return bool + */ + public function delete($pk = null) + { + $this->load($pk); + $result = parent::delete($pk); + + return $result; + } +} diff --git a/administrator/src/Table/CircolareTable.php b/administrator/src/Table/CircolareTable.php index 8b1cabf..11f38c7 100644 --- a/administrator/src/Table/CircolareTable.php +++ b/administrator/src/Table/CircolareTable.php @@ -235,12 +235,24 @@ class CircolareTable extends Table implements VersionableTableInterface, Taggabl } - // Default categoria (nuovi record o catid non impostato) - $this->catid = (int)($this->catid ?? 0) ?: 11; + // Default categoria (nuovi record o categoria_id non impostato) + $this->categoria_id = (int)($this->categoria_id ?? 0) ?: 0; - return parent::check(); + // Default gruppo utenti + $this->usergroup_id = (int)($this->usergroup_id ?? 0); + $this->hits = max(0, (int)($this->hits ?? 0)); + + // Normalize scadenza from datetime-local (YYYY-MM-DDTHH:MM) + if (!empty($this->scadenza)) { + $this->scadenza = str_replace('T', ' ', (string) $this->scadenza); + if (preg_match('/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}$/', (string) $this->scadenza)) { + $this->scadenza .= ':00'; + } + } + + return parent::check(); } /** diff --git a/administrator/src/View/Categoria/HtmlView.php b/administrator/src/View/Categoria/HtmlView.php new file mode 100644 index 0000000..fc96679 --- /dev/null +++ b/administrator/src/View/Categoria/HtmlView.php @@ -0,0 +1,114 @@ + + * @copyright 2024 Eddy Prosperi + * @license GNU General Public License versione 2 o successiva; vedi LICENSE.txt + */ + +namespace Pcrt\Component\Circolari\Administrator\View\Categoria; +// No direct access +defined('_JEXEC') or die; + +use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; +use \Joomla\CMS\Toolbar\ToolbarHelper; +use \Joomla\CMS\Factory; +use \Pcrt\Component\Circolari\Administrator\Helper\CircolariHelper; +use \Joomla\CMS\Language\Text; + +/** + * View class HtmlView a single Categoria. + * + * @since 1.0.0 + */ +class HtmlView extends BaseHtmlView +{ + protected $state; + + protected $item; + + protected $form; + + /** + * Display the view + * + * @param string $tpl Template name + * + * @return void + * + * @throws Exception + */ + public function display($tpl = null) + { + $this->state = $this->get('State'); + $this->item = $this->get('Item'); + $this->form = $this->get('Form'); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new \Exception(implode("\n", $errors)); + } + $this->addToolbar(); + + parent::display($tpl); + } + + /** + * Add the page title and toolbar. + * + * @return void + * + * @throws Exception + */ + protected function addToolbar() + { + Factory::getApplication()->input->set('hidemainmenu', true); + + $user = Factory::getApplication()->getIdentity(); + $isNew = ($this->item->id == 0); + + if (isset($this->item->checked_out)) + { + $checkedOut = !($this->item->checked_out == 0 || $this->item->checked_out == $user->get('id')); + } + else + { + $checkedOut = false; + } + + $canDo = CircolariHelper::getActions(); + + ToolbarHelper::title(Text::_('Firma'), "generic"); + + // If not checked out, can save the item. + if (!$checkedOut && ($canDo->get('core.edit') || ($canDo->get('core.create')))) + { + ToolbarHelper::apply('categoria.apply', 'JTOOLBAR_APPLY'); + ToolbarHelper::save('categoria.save', 'JTOOLBAR_SAVE'); + } + + if (!$checkedOut && ($canDo->get('core.create'))) + { + ToolbarHelper::custom('categoria.save2new', 'save-new.png', 'save-new_f2.png', 'JTOOLBAR_SAVE_AND_NEW', false); + } + + // If an existing item, can save to a copy. + if (!$isNew && $canDo->get('core.create')) + { + ToolbarHelper::custom('categoria.save2copy', 'save-copy.png', 'save-copy_f2.png', 'JTOOLBAR_SAVE_AS_COPY', false); + } + + + + if (empty($this->item->id)) + { + ToolbarHelper::cancel('categoria.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + ToolbarHelper::cancel('categoria.cancel', 'JTOOLBAR_CLOSE'); + } + } +} diff --git a/administrator/src/View/Categorie/HtmlView.php b/administrator/src/View/Categorie/HtmlView.php new file mode 100644 index 0000000..be0f399 --- /dev/null +++ b/administrator/src/View/Categorie/HtmlView.php @@ -0,0 +1,177 @@ + + * @copyright 2024 Eddy Prosperi + * @license GNU General Public License versione 2 o successiva; vedi LICENSE.txt + */ + +namespace Pcrt\Component\Circolari\Administrator\View\Categorie; +// No direct access +defined('_JEXEC') or die; + +use \Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; +use \Pcrt\Component\Circolari\Administrator\Helper\CircolariHelper; +use \Joomla\CMS\Toolbar\Toolbar; +use \Joomla\CMS\Toolbar\ToolbarHelper; +use \Joomla\CMS\Language\Text; +use \Joomla\Component\Content\Administrator\Extension\ContentComponent; +use \Joomla\CMS\Form\Form; +use \Joomla\CMS\HTML\Helpers\Sidebar; +/** + * View class HtmlView a list of Categorie. + * + * @since 1.0.0 + */ +class HtmlView extends BaseHtmlView +{ + protected $items; + + protected $pagination; + + protected $state; + + /** + * Display the view + * + * @param string $tpl Template name + * + * @return void + * + * @throws Exception + */ + public function display($tpl = null) + { + $this->state = $this->get('State'); + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + $this->filterForm = $this->get('FilterForm'); + $this->activeFilters = $this->get('ActiveFilters'); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + throw new \Exception(implode("\n", $errors)); + } + + $this->addToolbar(); + + $this->sidebar = Sidebar::render(); + parent::display($tpl); + } + + /** + * Add the page title and toolbar. + * + * @return void + * + * @since 1.0.0 + */ + protected function addToolbar() + { + $state = $this->get('State'); + $canDo = CircolariHelper::getActions(); + + ToolbarHelper::title(Text::_('COM_CIRCOLARI_TITLE_CATEGORIE'), "generic"); + + $toolbar = Toolbar::getInstance('toolbar'); + + // Check if the form exists before showing the add/edit buttons + $formPath = JPATH_COMPONENT_ADMINISTRATOR . '/src/View/Categorie'; + + if (file_exists($formPath)) + { + if ($canDo->get('core.create')) + { + $toolbar->addNew('categoria.add'); + } + } + + if ($canDo->get('core.edit.state')) + { + $dropdown = $toolbar->dropdownButton('status-group') + ->text('JTOOLBAR_CHANGE_STATUS') + ->toggleSplit(false) + ->icon('fas fa-ellipsis-h') + ->buttonClass('btn btn-action') + ->listCheck(true); + + $childBar = $dropdown->getChildToolbar(); + + if (isset($this->items[0]->state)) + { + $childBar->publish('categorie.publish')->listCheck(true); + $childBar->unpublish('categorie.unpublish')->listCheck(true); + $childBar->archive('categorie.archive')->listCheck(true); + } + + $childBar->standardButton('duplicate') + ->text('JTOOLBAR_DUPLICATE') + ->icon('fas fa-copy') + ->task('categorie.duplicate') + ->listCheck(true); + + if (isset($this->items[0]->checked_out)) + { + $childBar->checkin('categorie.checkin')->listCheck(true); + } + + if (isset($this->items[0]->state)) + { + $childBar->trash('categorie.trash')->listCheck(true); + } + } + + + + // Show trash and delete for components that uses the state field + if (isset($this->items[0]->state)) + { + + if ($this->state->get('filter.state') == ContentComponent::CONDITION_TRASHED && $canDo->get('core.delete')) + { + $toolbar->delete('categorie.delete') + ->text('JTOOLBAR_EMPTY_TRASH') + ->message('JGLOBAL_CONFIRM_DELETE') + ->listCheck(true); + } + } + + if ($canDo->get('core.admin')) + { + $toolbar->preferences('com_circolari'); + } + + // Set sidebar action + Sidebar::setAction('index.php?option=com_circolari&view=categorie'); + } + + /** + * Method to order fields + * + * @return void + */ + protected function getSortFields() + { + return array( + 'a.`id`' => Text::_('JGRID_HEADING_ID'), + 'a.`state`' => Text::_('JSTATUS'), + 'a.`ordering`' => Text::_('JGRID_HEADING_ORDERING'), + 'a.`nome`' => Text::_('COM_HIGHLIGHTS_ETICHETTE_NOME'), + 'a.`lingua`' => Text::_('COM_HIGHLIGHTS_ETICHETTE_LINGUA'), + ); + } + + /** + * Check if state is set + * + * @param mixed $state State + * + * @return bool + */ + public function getState($state) + { + return isset($this->state->{$state}) ? $this->state->{$state} : false; + } +} diff --git a/administrator/src/View/Circolare/HtmlView.php b/administrator/src/View/Circolare/HtmlView.php index 5a6858e..219e365 100644 --- a/administrator/src/View/Circolare/HtmlView.php +++ b/administrator/src/View/Circolare/HtmlView.php @@ -102,13 +102,16 @@ class HtmlView extends BaseHtmlView - if (empty($this->item->id)) - { - ToolbarHelper::cancel('circolare.cancel', 'JTOOLBAR_CANCEL'); - } - else - { - ToolbarHelper::cancel('circolare.cancel', 'JTOOLBAR_CLOSE'); - } + if (empty($this->item->id)) { + ToolbarHelper::apply('circolare.apply'); + ToolbarHelper::save('circolare.save'); + ToolbarHelper::save2new('circolare.save2new'); + ToolbarHelper::cancel('circolare.cancel', 'JTOOLBAR_CANCEL'); + } else { + ToolbarHelper::apply('circolare.apply'); + ToolbarHelper::save('circolare.save'); + ToolbarHelper::save2new('circolare.save2new'); + ToolbarHelper::cancel('circolare.cancel', 'JTOOLBAR_CLOSE'); + } } } diff --git a/administrator/tmpl/categoria/default.php b/administrator/tmpl/categoria/default.php new file mode 100644 index 0000000..adae16f --- /dev/null +++ b/administrator/tmpl/categoria/default.php @@ -0,0 +1,32 @@ + + * @copyright 2023 Super User + * @license GNU General Public License version 2 or later; see LICENSE.txt + */ + +// No direct access +defined('_JEXEC') or die; + +use \Joomla\CMS\HTML\HTMLHelper; +use \Joomla\CMS\Factory; +use \Joomla\CMS\Uri\Uri; +use \Joomla\CMS\Router\Route; +use \Joomla\CMS\Language\Text; +use \Joomla\CMS\Session\Session; +use Joomla\Utilities\ArrayHelper; + + +?> + +
+ + + + +
+ +
+ diff --git a/administrator/tmpl/categoria/edit.php b/administrator/tmpl/categoria/edit.php new file mode 100644 index 0000000..7cf4c06 --- /dev/null +++ b/administrator/tmpl/categoria/edit.php @@ -0,0 +1,42 @@ + +
+ + 'details']); ?> + + +
+
+ form->renderField('title'); ?> + form->renderField('alias'); ?> + form->renderField('description'); ?> +
+
+ form->renderField('state'); ?> + form->renderField('ordering'); ?> + form->renderField('id'); ?> +
+
+ + + + + + +
diff --git a/administrator/tmpl/categorie/default.php b/administrator/tmpl/categorie/default.php new file mode 100644 index 0000000..0202d55 --- /dev/null +++ b/administrator/tmpl/categorie/default.php @@ -0,0 +1,78 @@ +document->getWebAssetManager(); +$wa->useStyle('com_circolari.admin') + ->useScript('com_circolari.admin'); + +$user = Factory::getApplication()->getIdentity(); +$listOrder = $this->state->get('list.ordering'); +$listDirn = $this->state->get('list.direction'); +$canChange = $user->authorise('core.edit.state', 'com_circolari'); +?> + +
+
+
+
+ $this)); ?> + +
+ + + + + + + + + + + + + + + + + items as $i => $item) : ?> + + + + + + + + + +
+ +
pagination->getListFooter(); ?>
id); ?> + + title ?? ''), ENT_QUOTES, 'UTF-8'); ?> + + description ?? '') ?? '', ENT_QUOTES, 'UTF-8'); ?>state, $i, 'categorie.', $canChange, 'cb'); ?>id; ?>
+ + + + + +
+
+
+
diff --git a/administrator/tmpl/circolare/edit.php b/administrator/tmpl/circolare/edit.php index 9f7fa7a..c62dcf9 100644 --- a/administrator/tmpl/circolare/edit.php +++ b/administrator/tmpl/circolare/edit.php @@ -25,7 +25,7 @@ HTMLHelper::_('bootstrap.tooltip');
+ method="post" enctype="multipart/form-data" name="adminForm" id="adminForm" class="form-validate" class="form-validate form-horizontal"> 'Circolari')); ?> @@ -36,7 +36,9 @@ HTMLHelper::_('bootstrap.tooltip'); form->renderField('title'); ?> form->renderField('alias'); ?> - form->renderField('catid'); ?> + form->renderField('categoria_id'); ?> + form->renderField('usergroup_id'); ?> + form->renderField('hits'); ?> form->renderField('description'); ?> form->renderField('attachment'); ?> form->renderField('image'); ?> diff --git a/circolari.xml b/circolari.xml index dcf4751..843191a 100644 --- a/circolari.xml +++ b/circolari.xml @@ -7,7 +7,7 @@ Tommaso Cippitelli tommaso.cippitelli@protocollicreativi.it http:// - CVS: 1.1.3 + 1.1.6 Pcrt\Component\Circolari @@ -52,6 +52,7 @@ COM_CIRCOLARI_TITLE_CIRCOLARES COM_CIRCOLARI_TITLE_FIRMETIPI + COM_CIRCOLARI_TITLE_CATEGORIE diff --git a/site/src/Controller/DisplayController.php b/site/src/Controller/DisplayController.php index c0e48eb..898aa0e 100644 --- a/site/src/Controller/DisplayController.php +++ b/site/src/Controller/DisplayController.php @@ -3,20 +3,29 @@ namespace Pcrt\Component\Circolari\Site\Controller; \defined('_JEXEC') or die; +use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; class DisplayController extends BaseController { - protected $default_view = 'circolare'; // default se manca ?view= - public function display($cachable = false, $urlparams = []) { - // Se qualcuno forza un view strano, non rompiamo - $view = $this->input->getCmd('view', $this->default_view); - if (!in_array($view, ['circolare'], true)) { - $view = $this->default_view; - $this->input->set('view', $view); + $app = Factory::getApplication(); + $in = $app->input; + + $view = $in->getCmd('view', ''); + $id = $in->getInt('id', 0); + + if ($id > 0) { + // Singolo solo se c'è l'id + $in->set('view', 'circolare'); + } else { + // Nessun id: forziamo la lista (anche se il menu chiede "circolare") + if ($view === '' || $view === 'circolare' || $view === 'category') { + $in->set('view', 'circolari'); // <- lista + } } + return parent::display($cachable, $urlparams); } } diff --git a/site/src/Model/CircolareModel.php b/site/src/Model/CircolareModel.php index 9168335..d025e98 100644 --- a/site/src/Model/CircolareModel.php +++ b/site/src/Model/CircolareModel.php @@ -3,31 +3,75 @@ namespace Pcrt\Component\Circolari\Site\Model; \defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\MVC\Model\ItemModel; +use Joomla\CMS\Factory; class CircolareModel extends ItemModel { - protected function populateState(): void + protected function populateState() { $app = Factory::getApplication(); - $this->setState('circolare.id', (int) $app->input->getInt('id')); + $id = $app->input->getInt('id', 0); + $this->setState('circolare.id', $id); + + $categoria_id = $app->input->getInt('categoria_id', 0); + $this->setState('filter.categoria_id', $categoria_id); parent::populateState(); } public function getItem($pk = null) { - $pk = $pk ?: (int) $this->getState('circolare.id'); - if (!$pk) return null; + $pk = (int) ($pk ?: $this->getState('circolare.id')); - $db = Factory::getContainer()->get('DatabaseDriver'); + if ($pk <= 0) { + return null; + } + + $db = $this->getDatabase(); $q = $db->getQuery(true) - ->select('*') - ->from($db->quoteName('#__circolari')) - ->where($db->quoteName('id') . ' = ' . (int) $pk) - ->where($db->quoteName('state') . ' = 1'); - $db->setQuery($q); + ->select('c.*') // <<< evita errori di colonne + ->from($db->quoteName('#__circolari') . ' AS c') + ->where('c.id = ' . (int) $pk); - return $db->loadObject(); + // Se esistono le colonne, applica filtri + $cols = array_change_key_case( + $db->getTableColumns($db->replacePrefix('#__circolari'), false), + CASE_LOWER + ); + + // categoria_id (se impostato e colonna esiste) + $categoria_id = (int) $this->getState('filter.categoria_id', 0); + if ($categoria_id > 0 && isset($cols['categoria_id'])) { + $q->where('c.categoria_id = ' . $categoria_id); + } + + // stato (se colonna esiste) + if (isset($cols['state'])) { + $q->where('COALESCE(c.state, 1) = 1'); + } + + $db->setQuery($q); + $row = $db->loadObject(); + + return $row ?: null; } } + + +/** + * Incrementa gli hits della circolare. + */ +public function hit($pk = null) +{ + $pk = $pk ?: (int) $this->getState($this->getName() . '.id'); + if (!$pk) { + return false; + } + $db = $this->getDatabase(); + $query = $db->getQuery(true) + ->update($db->quoteName('#__circolari')) + ->set($db->quoteName('hits') . ' = ' . $db->quoteName('hits') . ' + 1') + ->where($db->quoteName('id') . ' = ' . (int)$pk); + $db->setQuery($query)->execute(); + return true; +} diff --git a/site/src/Model/CircolariModel.php b/site/src/Model/CircolariModel.php new file mode 100644 index 0000000..391798f --- /dev/null +++ b/site/src/Model/CircolariModel.php @@ -0,0 +1,119 @@ +getUserStateFromRequest($this->context . '.list.limit', 'limit', $app->get('list_limit'), 'uint'); + $this->setState('list.limit', $limit); + + $start = $app->getUserStateFromRequest($this->context . '.list.start', 'limitstart', 0, 'uint'); + $this->setState('list.start', $start); + + // sorting + $orderCol = $app->getUserStateFromRequest($this->context . '.list.ordering', 'filter_order', $ordering, 'cmd'); + if (!\in_array($orderCol, $this->filter_fields, true)) { + $orderCol = $ordering; + } + $this->setState('list.ordering', $orderCol); + + $orderDirn = strtoupper($app->getUserStateFromRequest($this->context . '.list.direction', 'filter_order_Dir', $direction, 'cmd')); + $this->setState('list.direction', $orderDirn === 'ASC' ? 'ASC' : 'DESC'); + + // filtro testuale + $search = $app->getUserStateFromRequest($this->context . '.list.filter', 'filter-search', '', 'string'); + $this->setState('list.filter', $search); + + // categoria (se usi categoria_id) + $this->setState('filter.categoria_id', $app->input->getInt('categoria_id', 0)); + + parent::populateState($ordering, $direction); + } + + protected function getListQuery() + { + $db = $this->getDatabase(); + $q = $db->getQuery(true) + ->select('c.*') + ->from($db->quoteName('#__circolari', 'c')); + + // colonne effettive in tabella + $cols = array_change_key_case($db->getTableColumns($db->replacePrefix('#__circolari'))); + + // pubblicati + if (isset($cols['state'])) { + $q->where('COALESCE(c.state,1)=1'); + } + + // categoria_id + $categoria_id = (int) $this->getState('filter.categoria_id', 0); + if ($categoria_id > 0 && isset($cols['categoria_id'])) { + $q->where('c.categoria_id=' . $categoria_id); + } + + // search su title + $search = trim((string) $this->getState('list.filter', '')); + if ($search !== '' && isset($cols['title'])) { + $like = $db->quote('%' . $db->escape($search, true) . '%', false); + $q->where('c.title LIKE ' . $like); + } + + // ordinamento + $orderCol = $this->getState('list.ordering', 'c.created'); + $orderDir = $this->getState('list.direction', 'DESC'); + $q->order($db->escape($orderCol . ' ' . $orderDir)); + + return $q; + } + + // conteggio robusto (gestisce DISTINCT/GROUP BY) + public function getTotal() + { + if (isset($this->total)) { + return $this->total; + } + + $db = $this->getDatabase(); + $sub = $this->getListQuery(); + $query = $db->getQuery(true) + ->select('COUNT(*)') + ->from('(' . $sub . ') AS x'); + + $db->setQuery($query); + $this->total = (int) $db->loadResult(); + + return $this->total; + } + + public function getItems() + { + $items = parent::getItems(); + if (!\is_array($items)) { + return []; + } + return array_values(array_filter($items, static function ($it) { + return \is_object($it) && !empty($it->id); + })); + } +} diff --git a/site/src/Service/Category.php b/site/src/Service/Category.php deleted file mode 100644 index c39c186..0000000 --- a/site/src/Service/Category.php +++ /dev/null @@ -1,21 +0,0 @@ - - * @copyright 2025 Tommaso Cippitelli - * @license GNU General Public License version 2 or later; see LICENSE.txt - */ - -namespace Pcrt\Component\Circolari\Site\Service; -// No direct access -defined('_JEXEC') or die; - -use \Joomla\CMS\Categories\Categories; -/** - * Content Component Category Tree - * - * @since 1.0.0 - */ - diff --git a/site/src/Service/Router.php b/site/src/Service/Router.php index 5a431d5..4d32e27 100644 --- a/site/src/Service/Router.php +++ b/site/src/Service/Router.php @@ -21,9 +21,9 @@ class Router extends RouterView $category->setKey('id')->setNestable(); $this->registerView($category); - // Child: circolare (lega la category tramite catid) + // Child: circolare (lega la category tramite categoria_id) $circolare = new RouterViewConfiguration('circolare'); - $circolare->setKey('id')->setParent($category, 'catid', 'id'); + $circolare->setKey('id')->setParent($category, 'categoria_id', 'id'); $this->registerView($circolare); parent::__construct($app, $menu); @@ -48,7 +48,7 @@ class Router extends RouterView $path = (string) $db->setQuery( $db->getQuery(true) ->select('path') - ->from('#__categories') + ->from('#__circolari_categorie') ->where('id = ' . $id) ->where("extension = 'com_content'") )->loadResult(); @@ -73,7 +73,7 @@ class Router extends RouterView /* ---------------- PARSE ---------------- */ - // Ricava catid accumulando i segmenti e risolvendo per PATH completo + // Ricava categoria_id accumulando i segmenti e risolvendo per PATH completo public function getCategoryId($segment, $query) { static $segments = []; @@ -86,7 +86,7 @@ class Router extends RouterView $id = (int) $db->setQuery( $db->getQuery(true) ->select('id') - ->from('#__categories') + ->from('#__circolari_categorie') ->where('path = ' . $db->quote($path)) ->where("extension = 'com_content'") )->loadResult(); @@ -99,7 +99,7 @@ class Router extends RouterView $id = (int) $db->setQuery( $db->getQuery(true) ->select('id') - ->from('#__categories') + ->from('#__circolari_categorie') ->where('alias = ' . $db->quote($segment)) ->where("extension = 'com_content'") ->order('level DESC') @@ -108,10 +108,10 @@ class Router extends RouterView return $id ?: 0; } - // Alias circolare (+ catid già risolto) → id + // Alias circolare (+ categoria_id già risolto) → id public function getCircolareId($segment, $query) { - $catid = (int) ($query['catid'] ?? 0); + $categoria_id = (int) ($query['categoria_id'] ?? 0); $db = Factory::getContainer()->get('DatabaseDriver'); $q = $db->getQuery(true) @@ -119,8 +119,8 @@ class Router extends RouterView ->from('#__circolari') ->where('alias = ' . $db->quote($segment)); - if ($catid > 0) { - $q->where('catid = ' . $catid); + if ($categoria_id > 0) { + $q->where('categoria_id = ' . $categoria_id); } $db->setQuery($q); diff --git a/site/src/View/Circolare/HtmlView.php b/site/src/View/Circolare/HtmlView.php index 08146db..34a5d2c 100644 --- a/site/src/View/Circolare/HtmlView.php +++ b/site/src/View/Circolare/HtmlView.php @@ -3,35 +3,50 @@ namespace Pcrt\Component\Circolari\Site\View\Circolare; \defined('_JEXEC') or die; -use Joomla\CMS\Language\Text; +use Joomla\CMS\Factory; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; +use Joomla\CMS\Language\Text; class HtmlView extends BaseHtmlView { protected $item; + public $items = []; + public $pagination; + public $state; public function display($tpl = null) { + // Carica la singola $this->item = $this->get('Item'); - if (!$this->item) { - throw new \Exception(Text::_('COM_CIRCOLARI_ITEM_NOT_FOUND'), 404); - } + // Se NON c'è l'item → mostra la lista + if (!$this->item) { + $app = \Joomla\CMS\Factory::getApplication(); + $factory = $app->bootComponent('com_circolari')->getMVCFactory(); - // Se il layout non c'è, stampa un fallback minimale (debug-friendly) - $tplPath = JPATH_COMPONENT_SITE . '/tmpl/circolare/default.php'; - if (!is_file($tplPath)) { - $title = htmlspecialchars($this->item->title ?? 'Circolare'); - $body = $this->item->description ?? $this->item->testo ?? $this->item->descrizione ?? ''; - $html = '
' - . '' - . '
'.$body.'
' - . '
'; + /** @var \Pcrt\Component\Circolari\Site\Model\CircolariModel $model */ + $model = $factory->createModel('Circolari', 'Site', ['ignore_request' => true]); - $this->document->setBuffer($html, 'component'); - return; - } + // Imposta gli stati MANUALMENTE (niente populateState: è protected) + $model->setState('filter.categoria_id', 0); // nessun filtro categoria + $model->setState('list.start', 0); + $model->setState('list.limit', 0); // 0 = nessun limite (tutte) + $model->setState('list.ordering', 'c.id'); // colonna di ordinamento + $model->setState('list.direction', 'DESC'); // direzione - parent::display($tpl); + // Recupera i dati + $this->state = $model->getState(); + $this->items = $model->getItems(); + $this->pagination = $model->getPagination(); + + // Usa il layout della lista (tmpl/circolari/default.php) + $this->setLayout('default'); + $this->addTemplatePath(JPATH_COMPONENT_SITE . '/tmpl/circolari'); + + return parent::display($tpl); +} + + // Rendering normale della singola + return parent::display($tpl); } } diff --git a/site/src/View/Circolari/HtmlView.php b/site/src/View/Circolari/HtmlView.php new file mode 100644 index 0000000..64b5742 --- /dev/null +++ b/site/src/View/Circolari/HtmlView.php @@ -0,0 +1,21 @@ +state = $this->get('State'); + $this->items = $this->get('Items'); + $this->pagination = $this->get('Pagination'); + return parent::display($tpl); + } +} diff --git a/site/tmpl/category/default.xml b/site/tmpl/category/default.xml deleted file mode 100644 index 136089d..0000000 --- a/site/tmpl/category/default.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - -
- - - - -
-
- - - -
- - - - -
-
-
diff --git a/site/tmpl/circolare/default.php b/site/tmpl/circolare/default.php index 3744677..2844f16 100644 --- a/site/tmpl/circolare/default.php +++ b/site/tmpl/circolare/default.php @@ -7,20 +7,20 @@ use Joomla\CMS\Language\Text; /** @var \Pcrt\Component\Circolari\Site\View\Circolare\HtmlView $this */ $item = $this->item; ?> -
- -
- description ?: $item->testo ?: $item->descrizione ?: '(Nessun testo)'; ?> +
+ +
+
+

escape($item->title); ?>

+
+ +
+ Condividi +
+
+ description ?: $item->testo ?: $item->descrizione ?: '(Nessun testo)'; ?> +
- attachment)) : ?> -

- - - -

- -
+ \ No newline at end of file diff --git a/site/tmpl/circolari/default.php b/site/tmpl/circolari/default.php new file mode 100644 index 0000000..98dca2d --- /dev/null +++ b/site/tmpl/circolari/default.php @@ -0,0 +1,67 @@ +getInt('Itemid') ?: 0); +?> + + + + + + + + + + + + + + + + + + + + + + + + + pagesTotal > 1) : ?> + + + + +
+ + + + + + + +
+ diff --git a/site/tmpl/circolari/default.xml b/site/tmpl/circolari/default.xml new file mode 100644 index 0000000..c548122 --- /dev/null +++ b/site/tmpl/circolari/default.xml @@ -0,0 +1,10 @@ + + + + +
+ + +
+
+