From f06c1637382162e9c73600e6882847688526c70b Mon Sep 17 00:00:00 2001 From: Hy-Fly Date: Thu, 14 Apr 2016 23:25:47 +0200 Subject: [PATCH] initial version based the Joomla3 tutorial: Developing an MVC Component --- README.md | 9 + admin/access.xml | 21 +++ admin/config.xml | 35 ++++ admin/controller.php | 29 ++++ admin/controllers/helloworld.php | 50 ++++++ admin/controllers/helloworlds.php | 36 ++++ admin/controllers/index.html | 1 + admin/helloworld.php | 34 ++++ admin/helpers/helloworld.php | 73 ++++++++ admin/helpers/index.html | 1 + admin/index.html | 1 + admin/language/en-GB/en-GB.com_helloworld.ini | 43 +++++ .../en-GB/en-GB.com_helloworld.sys.ini | 21 +++ admin/language/en-GB/index.html | 1 + admin/language/index.html | 1 + admin/models/fields/helloworld.php | 60 +++++++ admin/models/fields/index.html | 1 + admin/models/forms/filter_helloworlds.xml | 22 +++ admin/models/forms/helloworld.js | 7 + admin/models/forms/helloworld.xml | 75 ++++++++ admin/models/forms/index.html | 1 + admin/models/helloworld.php | 96 +++++++++++ admin/models/helloworlds.php | 163 ++++++++++++++++++ admin/models/index.html | 1 + admin/models/rules/greeting.php | 26 +++ admin/models/rules/index.html | 1 + admin/sql/index.html | 1 + admin/sql/install.mysql.utf8.sql | 20 +++ admin/sql/uninstall.mysql.utf8.sql | 1 + admin/sql/updates/index.html | 1 + admin/sql/updates/mysql/0.0.1.sql | 0 admin/sql/updates/mysql/0.0.12.sql | 1 + admin/sql/updates/mysql/0.0.13.sql | 1 + admin/sql/updates/mysql/0.0.14.sql | 1 + admin/sql/updates/mysql/0.0.6.sql | 15 ++ admin/sql/updates/mysql/1.0.15.sql | 0 admin/sql/updates/mysql/index.html | 1 + admin/tables/helloworld.php | 134 ++++++++++++++ admin/tables/index.html | 1 + admin/views/helloworld/index.html | 1 + admin/views/helloworld/submitbutton.js | 36 ++++ admin/views/helloworld/tmpl/edit.php | 33 ++++ admin/views/helloworld/tmpl/index.html | 1 + admin/views/helloworld/view.html.php | 131 ++++++++++++++ admin/views/helloworlds/index.html | 1 + admin/views/helloworlds/tmpl/default.php | 78 +++++++++ admin/views/helloworlds/tmpl/index.html | 1 + admin/views/helloworlds/view.html.php | 118 +++++++++++++ admin/views/index.html | 1 + helloworld.xml | 90 ++++++++++ media/images/index.html | 1 + media/images/tux-16x16.png | Bin 0 -> 3670 bytes media/images/tux-48x48.png | Bin 0 -> 4428 bytes media/index.html | 1 + script.php | 73 ++++++++ site/controller.php | 20 +++ site/helloworld.php | 21 +++ site/index.html | 1 + site/language/en-GB/en-GB.com_helloworld.ini | 0 site/language/en-GB/index.html | 1 + site/language/index.html | 1 + site/models/helloworld.php | 97 +++++++++++ site/models/index.html | 1 + site/views/helloworld/index.html | 1 + site/views/helloworld/tmpl/default.php | 15 ++ site/views/helloworld/tmpl/default.xml | 19 ++ site/views/helloworld/tmpl/index.html | 1 + site/views/helloworld/view.html.php | 42 +++++ site/views/index.html | 1 + 69 files changed, 1773 insertions(+) create mode 100644 README.md create mode 100644 admin/access.xml create mode 100644 admin/config.xml create mode 100644 admin/controller.php create mode 100644 admin/controllers/helloworld.php create mode 100644 admin/controllers/helloworlds.php create mode 100644 admin/controllers/index.html create mode 100644 admin/helloworld.php create mode 100644 admin/helpers/helloworld.php create mode 100644 admin/helpers/index.html create mode 100644 admin/index.html create mode 100644 admin/language/en-GB/en-GB.com_helloworld.ini create mode 100644 admin/language/en-GB/en-GB.com_helloworld.sys.ini create mode 100644 admin/language/en-GB/index.html create mode 100644 admin/language/index.html create mode 100644 admin/models/fields/helloworld.php create mode 100644 admin/models/fields/index.html create mode 100644 admin/models/forms/filter_helloworlds.xml create mode 100644 admin/models/forms/helloworld.js create mode 100644 admin/models/forms/helloworld.xml create mode 100644 admin/models/forms/index.html create mode 100644 admin/models/helloworld.php create mode 100644 admin/models/helloworlds.php create mode 100644 admin/models/index.html create mode 100644 admin/models/rules/greeting.php create mode 100644 admin/models/rules/index.html create mode 100644 admin/sql/index.html create mode 100644 admin/sql/install.mysql.utf8.sql create mode 100644 admin/sql/uninstall.mysql.utf8.sql create mode 100644 admin/sql/updates/index.html create mode 100644 admin/sql/updates/mysql/0.0.1.sql create mode 100644 admin/sql/updates/mysql/0.0.12.sql create mode 100644 admin/sql/updates/mysql/0.0.13.sql create mode 100644 admin/sql/updates/mysql/0.0.14.sql create mode 100644 admin/sql/updates/mysql/0.0.6.sql create mode 100644 admin/sql/updates/mysql/1.0.15.sql create mode 100644 admin/sql/updates/mysql/index.html create mode 100644 admin/tables/helloworld.php create mode 100644 admin/tables/index.html create mode 100644 admin/views/helloworld/index.html create mode 100644 admin/views/helloworld/submitbutton.js create mode 100644 admin/views/helloworld/tmpl/edit.php create mode 100644 admin/views/helloworld/tmpl/index.html create mode 100644 admin/views/helloworld/view.html.php create mode 100644 admin/views/helloworlds/index.html create mode 100644 admin/views/helloworlds/tmpl/default.php create mode 100644 admin/views/helloworlds/tmpl/index.html create mode 100644 admin/views/helloworlds/view.html.php create mode 100644 admin/views/index.html create mode 100644 helloworld.xml create mode 100644 media/images/index.html create mode 100644 media/images/tux-16x16.png create mode 100644 media/images/tux-48x48.png create mode 100644 media/index.html create mode 100644 script.php create mode 100644 site/controller.php create mode 100644 site/helloworld.php create mode 100644 site/index.html create mode 100644 site/language/en-GB/en-GB.com_helloworld.ini create mode 100644 site/language/en-GB/index.html create mode 100644 site/language/index.html create mode 100644 site/models/helloworld.php create mode 100644 site/models/index.html create mode 100644 site/views/helloworld/index.html create mode 100644 site/views/helloworld/tmpl/default.php create mode 100644 site/views/helloworld/tmpl/default.xml create mode 100644 site/views/helloworld/tmpl/index.html create mode 100644 site/views/helloworld/view.html.php create mode 100644 site/views/index.html diff --git a/README.md b/README.md new file mode 100644 index 0000000..9b6d4c6 --- /dev/null +++ b/README.md @@ -0,0 +1,9 @@ +# Joomla3 Front-End private data editing +This tutorial provides a guideline for development of a Joomla component that enables users to create and edit their own (private) data records in the database. This can be used for instance as starter for an address book. + +This guide continues from the tutorial 'Developing an MVC Component' (aka the 'Hello World' tutorial) from this Joomla site: https://docs.joomla.org/J3.x:Developing_an_MVC_Component. + + +Version history: + +v1-15 2016-04 initial version based on the Joomla3 tutorial: Developing an MVC Component diff --git a/admin/access.xml b/admin/access.xml new file mode 100644 index 0000000..1e54bf2 --- /dev/null +++ b/admin/access.xml @@ -0,0 +1,21 @@ + + +
+ + + + + +
+
+ + + + + +
+
+ + +
+
diff --git a/admin/config.xml b/admin/config.xml new file mode 100644 index 0000000..c17dfeb --- /dev/null +++ b/admin/config.xml @@ -0,0 +1,35 @@ + + +
+ + + + +
+
+ +
+
diff --git a/admin/controller.php b/admin/controller.php new file mode 100644 index 0000000..5cdcf76 --- /dev/null +++ b/admin/controller.php @@ -0,0 +1,29 @@ +authorise( "core.edit", "com_helloworld.message." . $id ); + } + } +} diff --git a/admin/controllers/helloworlds.php b/admin/controllers/helloworlds.php new file mode 100644 index 0000000..19f96c8 --- /dev/null +++ b/admin/controllers/helloworlds.php @@ -0,0 +1,36 @@ + true)) + { + $model = parent::getModel($name, $prefix, $config); + + return $model; + } +} diff --git a/admin/controllers/index.html b/admin/controllers/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/controllers/index.html @@ -0,0 +1 @@ + diff --git a/admin/helloworld.php b/admin/helloworld.php new file mode 100644 index 0000000..8c21348 --- /dev/null +++ b/admin/helloworld.php @@ -0,0 +1,34 @@ +addStyleDeclaration('.icon-helloworld {background-image: url(../media/com_helloworld/images/tux-16x16.png);}'); + +// Access check: is this user allowed to access the backend of this component? +if (!JFactory::getUser()->authorise('core.manage', 'com_helloworld')) +{ + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); +} + +// require helper file +JLoader::register('HelloWorldHelper', JPATH_COMPONENT . '/helpers/helloworld.php'); + +// Get an instance of the controller prefixed by HelloWorld +$controller = JControllerLegacy::getInstance('HelloWorld'); + +// Perform the Request task +$input = JFactory::getApplication()->input; +$controller->execute($input->getCmd('task')); + +// Redirect if set by the controller +$controller->redirect(); diff --git a/admin/helpers/helloworld.php b/admin/helpers/helloworld.php new file mode 100644 index 0000000..29ce1f0 --- /dev/null +++ b/admin/helpers/helloworld.php @@ -0,0 +1,73 @@ +addStyleDeclaration('.icon-48-helloworld ' . + '{background-image: url(../media/com_helloworld/images/tux-48x48.png);}'); + if ($submenu == 'categories') + { + $document->setTitle(JText::_('COM_HELLOWORLD_ADMINISTRATION_CATEGORIES')); + } + } + + /** + * Get the actions + */ + public static function getActions($messageId = 0) + { + $result = new JObject; + + if (empty($messageId)) { + $assetName = 'com_helloworld'; + } + else { + $assetName = 'com_helloworld.message.'.(int) $messageId; + } + + $actions = JAccess::getActions('com_helloworld', 'component'); + + foreach ($actions as $action) { + $result->set($action->name, JFactory::getUser()->authorise($action->name, $assetName)); + } + + return $result; + } +} diff --git a/admin/helpers/index.html b/admin/helpers/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/helpers/index.html @@ -0,0 +1 @@ + diff --git a/admin/index.html b/admin/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/index.html @@ -0,0 +1 @@ + diff --git a/admin/language/en-GB/en-GB.com_helloworld.ini b/admin/language/en-GB/en-GB.com_helloworld.ini new file mode 100644 index 0000000..2b3a1ed --- /dev/null +++ b/admin/language/en-GB/en-GB.com_helloworld.ini @@ -0,0 +1,43 @@ +; Joomla! Project +; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +COM_HELLOWORLD_ADMINISTRATION="HelloWorld - Administration" +COM_HELLOWORLD_ADMINISTRATION_CATEGORIES="HelloWorld - Categories" +COM_HELLOWORLD_NUM="#" +COM_HELLOWORLD_HELLOWORLDS_FILTER="Filters" +COM_HELLOWORLD_PUBLISHED="Published" +COM_HELLOWORLD_GREET_NAME="Name" +COM_HELLOWORLD_ID="Id" +COM_HELLOWORLD_HELLOWORLD_CREATING="HelloWorld - Creating" +COM_HELLOWORLD_HELLOWORLD_DETAILS="Details" +COM_HELLOWORLD_HELLOWORLD_EDITING="HelloWorld - Editing" +COM_HELLOWORLD_HELLOWORLD_ERROR_UNACCEPTABLE="Some values are unacceptable" +COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_DESC="The category the messages belongs to" +COM_HELLOWORLD_HELLOWORLD_FIELD_CATID_LABEL="Category" +COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_DESC="This message will be displayed" +COM_HELLOWORLD_HELLOWORLD_FIELD_GREETING_LABEL="Message" +COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_LABEL="Show category" +COM_HELLOWORLD_HELLOWORLD_FIELD_SHOW_CATEGORY_DESC="If set to Show, the title of the message’s category will show." +COM_HELLOWORLD_HELLOWORLD_HEADING_GREETING="Greeting" +COM_HELLOWORLD_HELLOWORLD_HEADING_ID="Id" +COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT="HelloWorld manager: Edit Message" +COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW="HelloWorld manager: New Message" +COM_HELLOWORLD_MANAGER_HELLOWORLDS="HelloWorld manager" +COM_HELLOWORLD_EDIT_HELLOWORLD="Edit message" +COM_HELLOWORLD_N_ITEMS_DELETED_1="One message deleted" +COM_HELLOWORLD_N_ITEMS_DELETED_MORE="%d messages deleted" +COM_HELLOWORLD_N_ITEMS_PUBLISHED="%d message(s) published" +COM_HELLOWORLD_N_ITEMS_UNPUBLISHED="%d message(s) unpublished" +COM_HELLOWORLD_HELLOWORLD_GREETING_LABEL="Greeting" +COM_HELLOWORLD_HELLOWORLD_GREETING_DESC="Add Hello World Greeting" +COM_HELLOWORLD_SUBMENU_MESSAGES="Messages" +COM_HELLOWORLD_SUBMENU_CATEGORIES="Categories" +COM_HELLOWORLD_CONFIGURATION="HelloWorld Configuration" +COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_LABEL="Messages settings" +COM_HELLOWORLD_CONFIG_GREETING_SETTINGS_DESC="Settings that will be applied to all messages by default" +COM_HELLOWORLD_FIELDSET_RULES="Message Permissions" +COM_HELLOWORLD_FIELD_RULES_LABEL="Permissions" +COM_HELLOWORLD_ACCESS_EDIT_DESC="Is this group allowed to edit this message?" +COM_HELLOWORLD_ACCESS_DELETE_DESC="Is this group allowed to delete this message?" diff --git a/admin/language/en-GB/en-GB.com_helloworld.sys.ini b/admin/language/en-GB/en-GB.com_helloworld.sys.ini new file mode 100644 index 0000000..110675e --- /dev/null +++ b/admin/language/en-GB/en-GB.com_helloworld.sys.ini @@ -0,0 +1,21 @@ +; Joomla! Project +; Copyright (C) 2005 - 2015 Open Source Matters. All rights reserved. +; License GNU General Public License version 2 or later; see LICENSE.txt, see LICENSE.php +; Note : All ini files need to be saved as UTF-8 + +COM_HELLOWORLD="Hello World!" +COM_HELLOWORLD_DESCRIPTION="This is the Hello World description" +COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_TITLE="Hello World" +COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC="This view displays a selected message" +COM_HELLOWORLD_INSTALL_TEXT="HelloWorld Install script" +COM_HELLOWORLD_MENU="Hello World!" +COM_HELLOWORLD_POSTFLIGHT_DISCOVER_INSTALL_TEXT="HelloWorld postlight discover install script" +COM_HELLOWORLD_POSTFLIGHT_INSTALL_TEXT="HelloWorld postflight install script" +COM_HELLOWORLD_POSTFLIGHT_UNINSTALL_TEXT="HelloWorld postflight uninstall script" +COM_HELLOWORLD_POSTFLIGHT_UPDATE_TEXT="HelloWorld postflight update script" +COM_HELLOWORLD_PREFLIGHT_DISCOVER_INSTALL_TEXT="HelloWorld preflight discover install script" +COM_HELLOWORLD_PREFLIGHT_INSTALL_TEXT="HelloWorld preflight install script" +COM_HELLOWORLD_PREFLIGHT_UNINSTALL_TEXT="HelloWorld preflight uninstall script" +COM_HELLOWORLD_PREFLIGHT_UPDATE_TEXT="HelloWorld preflight update script" +COM_HELLOWORLD_UNINSTALL_TEXT="HelloWorld Uninstall script" +COM_HELLOWORLD_UPDATE_TEXT="HelloWorld Update script. HelloWorld now updated to version %s." diff --git a/admin/language/en-GB/index.html b/admin/language/en-GB/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/language/en-GB/index.html @@ -0,0 +1 @@ + diff --git a/admin/language/index.html b/admin/language/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/language/index.html @@ -0,0 +1 @@ + diff --git a/admin/models/fields/helloworld.php b/admin/models/fields/helloworld.php new file mode 100644 index 0000000..b3363ad --- /dev/null +++ b/admin/models/fields/helloworld.php @@ -0,0 +1,60 @@ +getQuery(true); + $query ->select('h.id as id, h.greeting, c.title as category, catid') + ->from($db->quoteName('#__helloworld').' as h') + ->leftJoin($db->quoteName('#__categories').' as c on h.catid=c.id') + // Retrieve only published items + ->where('h.published = 1'); + $db->setQuery((string) $query); + $messages = $db->loadObjectList(); + $options = array(); + + if ($messages) + { + foreach ($messages as $message) + { + $options[] = JHtml::_('select.option', $message->id, $message->greeting . + ($message->catid ? ' (' . $message->category . ')' : '')); + } + } + + $options = array_merge(parent::getOptions(), $options); + + return $options; + } +} diff --git a/admin/models/fields/index.html b/admin/models/fields/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/models/fields/index.html @@ -0,0 +1 @@ + diff --git a/admin/models/forms/filter_helloworlds.xml b/admin/models/forms/filter_helloworlds.xml new file mode 100644 index 0000000..510e0ff --- /dev/null +++ b/admin/models/forms/filter_helloworlds.xml @@ -0,0 +1,22 @@ + +
+ + + + + + +
diff --git a/admin/models/forms/helloworld.js b/admin/models/forms/helloworld.js new file mode 100644 index 0000000..236e945 --- /dev/null +++ b/admin/models/forms/helloworld.js @@ -0,0 +1,7 @@ +jQuery(function() { + document.formvalidator.setHandler('greeting', + function (value) { + regex=/^[^0-9]+$/; + return regex.test(value); + }); +}); \ No newline at end of file diff --git a/admin/models/forms/helloworld.xml b/admin/models/forms/helloworld.xml new file mode 100644 index 0000000..df1406c --- /dev/null +++ b/admin/models/forms/helloworld.xml @@ -0,0 +1,75 @@ + +
+
+ + + + + +
+ +
+ + + + + +
+
+
+ + +
+
diff --git a/admin/models/forms/index.html b/admin/models/forms/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/models/forms/index.html @@ -0,0 +1 @@ + diff --git a/admin/models/helloworld.php b/admin/models/helloworld.php new file mode 100644 index 0000000..d7727a7 --- /dev/null +++ b/admin/models/helloworld.php @@ -0,0 +1,96 @@ +loadForm( 'com_helloworld.helloworld', 'helloworld', + array( 'control'=>'jform', 'load_data'=>$loadData ) ); + return ( empty($form) ) ? false : $form; + } + + /** + * Method to get the script that have to be included on the form + * + * @return string Script files + */ + public function getScript() + { + return 'administrator/components/com_helloworld/models/forms/helloworld.js'; + } + + /** + * Method to get the data that should be injected in the form. + * + * @return mixed The data for the form. + * + * @since 1.6 + */ + protected function loadFormData() + { + // Check the UserState session cache for previously entered form data. + $data = JFactory::getApplication()->getUserState( + 'com_helloworld.edit.helloworld.data', + array() + ); + + if (empty($data)) + { // if no previous data is present, get the item record from the db + $data = $this->getItem(); + } + + return $data; + } + + /** + * Method to check if it's OK to delete a message. Overwrites JModelAdmin::canDelete + */ + protected function canDelete($record) + { + if( !empty( $record->id ) ) + { + return JFactory::getUser()->authorise( "core.delete", "com_helloworld.message." . $record->id ); + } + } +} diff --git a/admin/models/helloworlds.php b/admin/models/helloworlds.php new file mode 100644 index 0000000..779e563 --- /dev/null +++ b/admin/models/helloworlds.php @@ -0,0 +1,163 @@ +getUserStateFromRequest('global.list.limit', 'limit', $app->get('list_limit', 0), 'uint'); + $this->setState('list.limit', $limit); + + $limitstart = (int)$app->getUserStateFromRequest($this->context.'.limitstart', 'limitstart', 0, 'int'); + $limitstart = ($limit == 0) ? 0 : (floor($limitstart / $limit) * $limit); + $this->setState('list.start', $limitstart); + } + + /** + * saveListState: saves the present list parameters in the UserState + * + * in een $(document).ready wordt + * on the fly aangemaakt die meekomt met de Joomla.tableOrdering('id','desc','') submit as + * ["list"]=> array(1) { ["fullordering"]=>string(8) "null ASC" } + * See media/jui/js/jquery.searchtools.js + * This is for the ProtoStar template and may work differently for other templates. + * + * so: + * * for a 'submit', e.g. by clicking the sort column, the 'list' array does not help + * as it only contains "fullordering" and not the column id. However, populateState also + * checks the "old ordering fields" 'get' parameters and still sets 'filter_order' in State. + * So selecting the order column should be fine. + * * a page reload without a submit, for instance when returning after visiting the item + * edit page has no list[fullordering]. In this case the saved 'list' values are restored + * by the standard populateState, as intended. + * * Note: do not call getUserStateFromRequest(list...) in the mean time, as this function not only + * retrieves 'list' but also updates the UserState from the 'get' parameters as side effect! + */ + public function saveListState() + { + $limit = $this->state->get('list.limit'); + $filter_order = $this->state->get('list.ordering'); + $filter_order_Dir = $this->state->get('list.direction'); + JFactory::getApplication()->setUserState($this->context.'.list',array( + 'limit' => $limit, + 'ordering' => $filter_order, + 'direction' => $filter_order_Dir, + ) ); + } + + /** + * Method to build an SQL query to load the list data. + * + * @return string An SQL query + */ + protected function getListQuery() + { + // Initialize variables. + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + + // Create the base select statement. + $query ->select('*') + ->from($db->quoteName('#__helloworld')); + + // Filter: like / search + $search = $this->getState('filter.search'); + + if (!empty($search)) + { + $like = $db->quote('%' . $search . '%'); + $query->where('greeting LIKE ' . $like); + } + + // Filter by published state + $published = $this->getState('filter.published'); + + if (is_numeric($published)) + { + $query->where('published = ' . (int) $published); + } + elseif ($published === '') + { + $query->where('(published IN (0, 1))'); + } + + // Add the list ordering clause. + $orderCol = $this->state->get('list.ordering', 'greeting'); + $orderDirn = $this->state->get('list.direction', 'asc'); + $query->order($db->escape($orderCol) . ' ' . $db->escape($orderDirn)); + return $query; + } +} diff --git a/admin/models/index.html b/admin/models/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/models/index.html @@ -0,0 +1 @@ + diff --git a/admin/models/rules/greeting.php b/admin/models/rules/greeting.php new file mode 100644 index 0000000..d6b76c2 --- /dev/null +++ b/admin/models/rules/greeting.php @@ -0,0 +1,26 @@ + diff --git a/admin/sql/index.html b/admin/sql/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/sql/index.html @@ -0,0 +1 @@ + diff --git a/admin/sql/install.mysql.utf8.sql b/admin/sql/install.mysql.utf8.sql new file mode 100644 index 0000000..e3def6e --- /dev/null +++ b/admin/sql/install.mysql.utf8.sql @@ -0,0 +1,20 @@ +DROP TABLE IF EXISTS `#__helloworld`; + +CREATE TABLE `#__helloworld` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `asset_id` INT(10) NOT NULL DEFAULT '0', + `greeting` VARCHAR(40) NOT NULL, + `published` tinyint(4) NOT NULL, + `catid` int(11) NOT NULL DEFAULT '0', + `params` VARCHAR(1024) NOT NULL DEFAULT '', + PRIMARY KEY (`id`) +) + ENGINE =MyISAM + AUTO_INCREMENT =0 + DEFAULT CHARSET =utf8; + +INSERT INTO `#__helloworld` (`greeting`) VALUES +('Hello World!'), +('Good bye World!'), +('See you later!'), +('We will meet again!'); diff --git a/admin/sql/uninstall.mysql.utf8.sql b/admin/sql/uninstall.mysql.utf8.sql new file mode 100644 index 0000000..41d86aa --- /dev/null +++ b/admin/sql/uninstall.mysql.utf8.sql @@ -0,0 +1 @@ +DROP TABLE IF EXISTS `#__helloworld`; \ No newline at end of file diff --git a/admin/sql/updates/index.html b/admin/sql/updates/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/sql/updates/index.html @@ -0,0 +1 @@ + diff --git a/admin/sql/updates/mysql/0.0.1.sql b/admin/sql/updates/mysql/0.0.1.sql new file mode 100644 index 0000000..e69de29 diff --git a/admin/sql/updates/mysql/0.0.12.sql b/admin/sql/updates/mysql/0.0.12.sql new file mode 100644 index 0000000..175e7fe --- /dev/null +++ b/admin/sql/updates/mysql/0.0.12.sql @@ -0,0 +1 @@ +ALTER TABLE `#__helloworld` ADD `catid` int(11) NOT NULL DEFAULT '0'; \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.13.sql b/admin/sql/updates/mysql/0.0.13.sql new file mode 100644 index 0000000..d1c0b2d --- /dev/null +++ b/admin/sql/updates/mysql/0.0.13.sql @@ -0,0 +1 @@ +ALTER TABLE `#__helloworld` ADD `params` VARCHAR(1024) NOT NULL DEFAULT ''; \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.14.sql b/admin/sql/updates/mysql/0.0.14.sql new file mode 100644 index 0000000..6c9ddcf --- /dev/null +++ b/admin/sql/updates/mysql/0.0.14.sql @@ -0,0 +1 @@ +ALTER TABLE`#__helloworld` ADD COLUMN `asset_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `id`; \ No newline at end of file diff --git a/admin/sql/updates/mysql/0.0.6.sql b/admin/sql/updates/mysql/0.0.6.sql new file mode 100644 index 0000000..af86d2b --- /dev/null +++ b/admin/sql/updates/mysql/0.0.6.sql @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS `#__helloworld`; + +CREATE TABLE `#__helloworld` ( + `id` INT(11) NOT NULL AUTO_INCREMENT, + `greeting` VARCHAR(25) NOT NULL, + `published` tinyint(4) NOT NULL, + PRIMARY KEY (`id`) +) + ENGINE =MyISAM + AUTO_INCREMENT =0 + DEFAULT CHARSET =utf8; + +INSERT INTO `#__helloworld` (`greeting`) VALUES +('Hello World!'), +('Good bye World!'); \ No newline at end of file diff --git a/admin/sql/updates/mysql/1.0.15.sql b/admin/sql/updates/mysql/1.0.15.sql new file mode 100644 index 0000000..e69de29 diff --git a/admin/sql/updates/mysql/index.html b/admin/sql/updates/mysql/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/sql/updates/mysql/index.html @@ -0,0 +1 @@ + diff --git a/admin/tables/helloworld.php b/admin/tables/helloworld.php new file mode 100644 index 0000000..2c9dd37 --- /dev/null +++ b/admin/tables/helloworld.php @@ -0,0 +1,134 @@ +loadArray($array['params']); + $array['params'] = (string)$parameter; + } + + // Bind the rules. + if (isset($array['rules']) && is_array($array['rules'])) + { + $rules = new JAccessRules($array['rules']); + $this->setRules($rules); + } + + return parent::bind($array, $ignore); + } + + /** + * Overloaded load function + * + * @param int $pk primary key + * @param boolean $reset reset data + * @return boolean + * @see JTable:load + */ + public function load($pk = null, $reset = true) + { + if (parent::load($pk, $reset)) + { + // Convert the params field to a registry. + $params = new JRegistry; + $params->loadString($this->params, 'JSON'); + + $this->params = $params; + return true; + } + else + { + return false; + } + } + /** + * Method to compute the default name of the asset. + * The default name is in the form `table_name.id` + * where id is the value of the primary key of the table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetName() + { + $k = $this->_tbl_key; + return 'com_helloworld.message.'.(int) $this->$k; + } + /** + * Method to return the title to use for the asset table. + * + * @return string + * @since 2.5 + */ + protected function _getAssetTitle() + { + return $this->greeting; + } + /** + * Method to get the asset-parent-id of the item + * + * @return int + */ + protected function _getAssetParentId(JTable $table = NULL, $id = NULL) + { + // We will retrieve the parent-asset from the Asset-table + $assetParent = JTable::getInstance('Asset'); + // Default: if no asset-parent can be found we take the global asset + $assetParentId = $assetParent->getRootId(); + + // Find the parent-asset + if (($this->catid)&& !empty($this->catid)) + { + // The item has a category as asset-parent + $assetParent->loadByName('com_helloworld.category.' . (int) $this->catid); + } + else + { + // The item has the component as asset-parent + $assetParent->loadByName('com_helloworld'); + } + + // Return the found asset-parent-id + if ($assetParent->id) + { + $assetParentId=$assetParent->id; + } + return $assetParentId; + } +} diff --git a/admin/tables/index.html b/admin/tables/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/tables/index.html @@ -0,0 +1 @@ + diff --git a/admin/views/helloworld/index.html b/admin/views/helloworld/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/views/helloworld/index.html @@ -0,0 +1 @@ + diff --git a/admin/views/helloworld/submitbutton.js b/admin/views/helloworld/submitbutton.js new file mode 100644 index 0000000..acdcf0f --- /dev/null +++ b/admin/views/helloworld/submitbutton.js @@ -0,0 +1,36 @@ +Joomla.submitbutton = function(task) +{ + if (task == '') + { + return false; + } + else + { + var isValid=true; + var action = task.split('.'); + if (action[1] != 'cancel' && action[1] != 'close') + { + var forms = $$('form.form-validate'); + for (var i=0;i +
+
+ form->getFieldsets() as $name => $fieldset): ?> +
+ label); ?> +
+ form->getFieldset($name) as $field): ?> +
+
label; ?>
+
input; ?>
+
+ +
+
+ +
+ + +
diff --git a/admin/views/helloworld/tmpl/index.html b/admin/views/helloworld/tmpl/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/views/helloworld/tmpl/index.html @@ -0,0 +1 @@ + diff --git a/admin/views/helloworld/view.html.php b/admin/views/helloworld/view.html.php new file mode 100644 index 0000000..a783585 --- /dev/null +++ b/admin/views/helloworld/view.html.php @@ -0,0 +1,131 @@ +form = $this->get('Form'); + $this->item = $this->get('Item'); + $this->script = $this->get('Script'); + + // What Access Permissions does this user have? What can (s)he do? + $this->canDo = HelloWorldHelper::getActions($this->item->id); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode('
', $errors)); + + return false; + } + + // Set the toolbar + $this->addToolBar(); + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Add the page title and toolbar. + * + * @return void + * + * @since 1.6 + */ + protected function addToolBar() + { + $input = JFactory::getApplication()->input; + + // Hide Joomla Administrator Main menu + $input->set('hidemainmenu', true); + + $isNew = ($this->item->id == 0); + + JToolBarHelper::title($isNew ? JText::_('COM_HELLOWORLD_MANAGER_HELLOWORLD_NEW') + : JText::_('COM_HELLOWORLD_MANAGER_HELLOWORLD_EDIT'), 'helloworld'); + // Build the actions for new and existing records. + if ($isNew) + { + // For new records, check the create permission. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::apply('helloworld.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('helloworld.save', 'JTOOLBAR_SAVE'); + JToolBarHelper::custom('helloworld.save2new', 'save-new.png', 'save-new_f2.png', + 'JTOOLBAR_SAVE_AND_NEW', false); + } + JToolBarHelper::cancel('helloworld.cancel', 'JTOOLBAR_CANCEL'); + } + else + { + if ($this->canDo->get('core.edit')) + { + // We can save the new record + JToolBarHelper::apply('helloworld.apply', 'JTOOLBAR_APPLY'); + JToolBarHelper::save('helloworld.save', 'JTOOLBAR_SAVE'); + + // We can save this record, but check the create permission to see + // if we can return to make a new one. + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('helloworld.save2new', 'save-new.png', 'save-new_f2.png', + 'JTOOLBAR_SAVE_AND_NEW', false); + } + } + if ($this->canDo->get('core.create')) + { + JToolBarHelper::custom('helloworld.save2copy', 'save-copy.png', 'save-copy_f2.png', + 'JTOOLBAR_SAVE_AS_COPY', false); + } + JToolBarHelper::cancel('helloworld.cancel', 'JTOOLBAR_CLOSE'); + } + } + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $isNew = ($this->item->id == 0); + $document = JFactory::getDocument(); + $document->setTitle($isNew ? JText::_('COM_HELLOWORLD_HELLOWORLD_CREATING') + : JText::_('COM_HELLOWORLD_HELLOWORLD_EDITING')); + $document->addScript(JURI::root() . $this->script); + $document->addScript(JURI::root() . "/administrator/components/com_helloworld" + . "/views/helloworld/submitbutton.js"); + JText::script('COM_HELLOWORLD_HELLOWORLD_ERROR_UNACCEPTABLE'); + } +} diff --git a/admin/views/helloworlds/index.html b/admin/views/helloworlds/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/views/helloworlds/index.html @@ -0,0 +1 @@ + diff --git a/admin/views/helloworlds/tmpl/default.php b/admin/views/helloworlds/tmpl/default.php new file mode 100644 index 0000000..a25eea8 --- /dev/null +++ b/admin/views/helloworlds/tmpl/default.php @@ -0,0 +1,78 @@ +escape($this->filter_order); +$listDirn = $this->escape($this->filter_order_Dir); +$nrColumns = 5; //number of columns in the table of the list +?> +
+ sidebar)) : ?> +
+ sidebar; ?> +
+ + +
+ +
+ $this) + ); + ?> +
+ + + + + + + + + + + + + + + + + + items)) : ?> + items as $i => $row) : + $link = JRoute::_( 'index.php?option=com_helloworld&task=helloworld.edit&id=' . $row->id ); + ?> + + + + + + + + + + +
pagination->getListFooter(); ?>
pagination->getRowOffset($i); ?>id); ?> + + greeting; ?> + + published, $i, 'helloworlds.', true, 'cb'); ?>id; ?>
+
+ + + + + +
diff --git a/admin/views/helloworlds/tmpl/index.html b/admin/views/helloworlds/tmpl/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/views/helloworlds/tmpl/index.html @@ -0,0 +1 @@ + diff --git a/admin/views/helloworlds/view.html.php b/admin/views/helloworlds/view.html.php new file mode 100644 index 0000000..60a450c --- /dev/null +++ b/admin/views/helloworlds/view.html.php @@ -0,0 +1,118 @@ +input; + $model = $this->getModel(); + $state = $this->get('State'); + $this->state = $state; + $this->filter_order = $state->get('list.ordering'); + $this->filter_order_Dir = $state->get('list.direction'); + $this->filterForm = $this->get('FilterForm'); + $this->activeFilters = $this->get('ActiveFilters'); + $this->pagination = $this->get('Pagination'); + $this->script = $this->get('Script'); + + $model->saveListState(); + + // read array of all records from the database + $this->items = $this->get('Items'); + + // What Access Permissions does this user have? What can (s)he do? + $this->canDo = HelloWorldHelper::getActions(); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JError::raiseError(500, implode('
', $errors)); + + return false; + } + + // Set the submenu + HelloWorldHelper::addSubmenu('messages'); //start with messages menu + $this->sidebar = JHtmlSidebar::render(); //show sidebar + + // Set the toolbar and number of found items + $this->addToolBar(); + + // Display the template + parent::display($tpl); + + // Set the document + $this->setDocument(); + } + + /** + * Add the page title and toolbar. + * + * @return void + * + * @since 1.6 + */ + protected function addToolBar() + { + $title = JText::_('COM_HELLOWORLD_MANAGER_HELLOWORLDS'); + + if ($this->pagination->total) + { + $title .= "(" . $this->pagination->total . ")"; + } + + JToolBarHelper::title($title, 'helloworld'); + + if ($this->canDo->get('core.create')) + { + JToolBarHelper::addNew('helloworld.add', 'JTOOLBAR_NEW'); + } + if ($this->canDo->get('core.edit')) + { + JToolBarHelper::editList('helloworld.edit', 'JTOOLBAR_EDIT'); + } + if ($this->canDo->get('core.delete')) + { + JToolBarHelper::deleteList('', 'helloworlds.delete', 'JTOOLBAR_DELETE'); + } + if ($this->canDo->get('core.admin')) + { + JToolBarHelper::divider(); + JToolBarHelper::preferences('com_helloworld'); + } + } + /** + * Method to set up the document properties + * + * @return void + */ + protected function setDocument() + { + $document = JFactory::getDocument(); + $document->setTitle(JText::_('COM_HELLOWORLD_ADMINISTRATION')); + } +} diff --git a/admin/views/index.html b/admin/views/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/admin/views/index.html @@ -0,0 +1 @@ + diff --git a/helloworld.xml b/helloworld.xml new file mode 100644 index 0000000..cac9755 --- /dev/null +++ b/helloworld.xml @@ -0,0 +1,90 @@ + + + + COM_HELLOWORLD + + March 2016 + John Doe + john.doe@example.org + http://www.example.org + Copyright Info + License Info + + 0.1.15 + + COM_HELLOWORLD_DESCRIPTION + + + script.php + + + + sql/install.mysql.utf8.sql + + + + + sql/uninstall.mysql.utf8.sql + + + + + sql/updates/mysql + + + + + + + index.html + controller.php + helloworld.php + models + views + + + + en-GB/en-GB.com_helloworld.ini + + + + index.html + images + + + + + COM_HELLOWORLD_MENU + + + + + index.html + controller.php + helloworld.php + access.xml + config.xml + + controllers + + helpers + + models + + sql + + tables + + views + + + en-GB/en-GB.com_helloworld.ini + en-GB/en-GB.com_helloworld.sys.ini + + + + diff --git a/media/images/index.html b/media/images/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/media/images/index.html @@ -0,0 +1 @@ + diff --git a/media/images/tux-16x16.png b/media/images/tux-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..2748fbcaa7dd86bd4da182ed7a39a5753d2063e7 GIT binary patch literal 3670 zcmV-c4yo~pP)KLZ*U+IBfRsybQWXdwQbLP>6pAqfylh#{fb6;Z(vMMVS~$e@S=j*ftg6;Uhf59&ghTmgWD0l;*T zI709Y^p6lP1rIRMx#05C~cW=H_Aw*bJ-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9Pe|2Ab)w{ z<1eP~+`ExVrSkY+VtjlYLI9rU!!%9I%sd=@|AY62W09CVH#Y}GkBy@>9f9xVQ`STHg&a-}j{ zRkN1RKYA*Rj-JDrGiR~2IMjFgozwJvpS^vr)AK!&9?5{wgvC>D4bpR69y)lCp`xuX zkOWC!U|;|(Ev=HKX_wNU!8zv2xw&OA$PtY*ZEGa2vZB6wPRaN!^KsA75 zZ{K0&^EOvjqRf~kgMjn`((!!SIhRH%#ihk1>dAG!bl?C1#3X^8(%AX)aR66pYs1KH z=CNsc$mDWJ8wPUuEF9ZHdegv0HiML5A(7D0+}r{HU;6=?ODi@4AO_~_|VshbYdB0+jk>lNdT}30E&?gP__*dzs}5$?QdI#Dz4(j&0eI< zeJCr;g2G2?qX@Z;IUGIu1ALyuvE#F-EX5@NP=q8Q71K;RH^c(e+chTN_3xQGx zU)_QB*6&bPa}UrBAQ?kZ`Oo6)+nx*nf+YT)64l`lB2tY|0RS%HI7RsK@m)Y6j_iIF znz9Kf00RLxPiI#bc19EYO96nIF2?&$zOijbd8WO)>B+kB*@$_J6sveEC&lRw`U-P9sWtwUiQwh^%gC;1b zNfAdly6UsclQmL!^M({UoD_1%QvhI3R}5Hg^q_p}V2fn|VX^_2q6m9ASf>} og(55<&BUQ9S1poj507*qoM6N<$f|lgfOaK4? literal 0 HcmV?d00001 diff --git a/media/images/tux-48x48.png b/media/images/tux-48x48.png new file mode 100644 index 0000000000000000000000000000000000000000..87955d3c98e23e024fee6ff32f57866ae0576f0a GIT binary patch literal 4428 zcmV-S5wq@zP)oBdeS}T{Jy{6_qQDh=N$i^hy1@5;MX1AFY|I=UmqYqq~Cqd!}C0});Q-V7K^gI zy?xE<)vGra3We2ueSJ+cGc)$kp+hHUW@h#e4h`)cA0Ho!q6kl=>x2LY;J~FHWFKdZ z!-o(5dH@z0T5IAsrlX@{bx%*vhLtN^t5eq{^%N&vzrq^+&( zcW$`hhQGe}UGKWaI>*HLIMr$utu@wKthLnkmQvQATrNj*b2B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@>KK!0}l=zoL~HBCf*GkH8~Gs{JHMl{9xVQn$Dc3@@EH&d|imczzSUuMmi= z=Bd!rc9^AI7M07^NkG_i1CgZC)c&^-0||P3lGk1tV&~s|Pkim)ZjXwlkxH?_$>J;`H;c?yoobnJt{C8AErifXlDLkJj&oDU9_;j&g}EZe^T~HAN-Grpa^w8Y zDylU>HslZm4?G1*y0m!|&Vh&pg<=^YeIe)d#nx(y{uvhe&PiFuAsxbHcNghf2;;C- zgB{n{YD_ZYh$bX1@mbKsIJL)UIOghPn5;uFdsg+|8)86=1a z!|ba@2!&|6+@rPwVf_JZFo@bVHRB+^MFDXCEsCj>$YhbKbQOc)o? z*%f(uYdzN;J6lBN$`sTTLf9cEKh*5`2N4S#Zk*0 Sy|v^30000 diff --git a/script.php b/script.php new file mode 100644 index 0000000..9a0e9b9 --- /dev/null +++ b/script.php @@ -0,0 +1,73 @@ +getParent()->setRedirectURL('index.php?option=com_helloworld'); + } + + /** + * method to uninstall the component + * + * @return void + */ + function uninstall($parent) + { + echo '

' . JText::_('COM_HELLOWORLD_UNINSTALL_TEXT') . '

'; + } + + /** + * method to update the component + * + * @return void + */ + function update($parent) + { + // $parent is the class calling this method + echo '

' . JText::sprintf('COM_HELLOWORLD_UPDATE_TEXT', $parent->get('manifest')->version) . '

'; + } + + /** + * method to run before an install/update/uninstall method + * + * @return void + */ + function preflight($type, $parent) + { + // $parent is the class calling this method + // $type is the type of change (install, update or discover_install) + echo '

' . JText::_('COM_HELLOWORLD_PREFLIGHT_' . $type . '_TEXT') . '

'; + } + + /** + * method to run after an install/update/uninstall method + * + * @return void + */ + function postflight($type, $parent) + { + // $parent is the class calling this method + // $type is the type of change (install, update or discover_install) + echo '

' . JText::_('COM_HELLOWORLD_POSTFLIGHT_' . $type . '_TEXT') . '

'; + } +} diff --git a/site/controller.php b/site/controller.php new file mode 100644 index 0000000..8044f8d --- /dev/null +++ b/site/controller.php @@ -0,0 +1,20 @@ +input; +$controller->execute($input->getCmd('task')); + +// Redirect if set by the controller +$controller->redirect(); diff --git a/site/index.html b/site/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/site/index.html @@ -0,0 +1 @@ + diff --git a/site/language/en-GB/en-GB.com_helloworld.ini b/site/language/en-GB/en-GB.com_helloworld.ini new file mode 100644 index 0000000..e69de29 diff --git a/site/language/en-GB/index.html b/site/language/en-GB/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/site/language/en-GB/index.html @@ -0,0 +1 @@ + diff --git a/site/language/index.html b/site/language/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/site/language/index.html @@ -0,0 +1 @@ + diff --git a/site/models/helloworld.php b/site/models/helloworld.php new file mode 100644 index 0000000..38c88b6 --- /dev/null +++ b/site/models/helloworld.php @@ -0,0 +1,97 @@ +input; + $id = $jinput->get('id', 1, 'INT'); + $this->setState('message.id', $id); + + // Load the parameters. + $this->setState('params', JFactory::getApplication()->getParams()); + parent::populateState(); + } + + /** + * Method to get a table object, load it if necessary. + * + * @param string $type The table name. Optional. + * @param string $prefix The class prefix. Optional. + * @param array $config Configuration array for model. Optional. + * + * @return JTable A JTable object + * + * @since 1.6 + */ + public function getTable($type = 'HelloWorld', $prefix = 'HelloWorldTable', $config = array()) + { + return JTable::getInstance($type, $prefix, $config); + } + + /** + * Get the message + * @return object The message to be displayed to the user + */ + public function getItem() + { + if (!isset($this->item)) + { + $id = $this->getState('message.id'); + $db = JFactory::getDbo(); + $query = $db->getQuery(true); + $query->select('h.greeting, h.params, c.title as category') + ->from('#__helloworld as h') + ->leftJoin('#__categories as c ON h.catid=c.id') + ->where('h.id=' . (int)$id); + $db->setQuery((string)$query); + + if ($this->item = $db->loadObject()) + { + // Load the JSON string + $params = new JRegistry; + $params->loadString($this->item->params, 'JSON'); + $this->item->params = $params; + + // Merge global params with item params + $params = clone $this->getState('params'); + $params->merge($this->item->params); + $this->item->params = $params; + } + } + return $this->item; + } +} diff --git a/site/models/index.html b/site/models/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/site/models/index.html @@ -0,0 +1 @@ + diff --git a/site/views/helloworld/index.html b/site/views/helloworld/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/site/views/helloworld/index.html @@ -0,0 +1 @@ + diff --git a/site/views/helloworld/tmpl/default.php b/site/views/helloworld/tmpl/default.php new file mode 100644 index 0000000..cd12718 --- /dev/null +++ b/site/views/helloworld/tmpl/default.php @@ -0,0 +1,15 @@ + +

item->greeting.(($this->item->category and $this->item->params->get('show_category')) + ? (' ('.$this->item->category.')') : ''); ?> +

diff --git a/site/views/helloworld/tmpl/default.xml b/site/views/helloworld/tmpl/default.xml new file mode 100644 index 0000000..59db31b --- /dev/null +++ b/site/views/helloworld/tmpl/default.xml @@ -0,0 +1,19 @@ + + + + COM_HELLOWORLD_HELLOWORLD_VIEW_DEFAULT_DESC + + +
+ +
+
+
\ No newline at end of file diff --git a/site/views/helloworld/tmpl/index.html b/site/views/helloworld/tmpl/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/site/views/helloworld/tmpl/index.html @@ -0,0 +1 @@ + diff --git a/site/views/helloworld/view.html.php b/site/views/helloworld/view.html.php new file mode 100644 index 0000000..6e58cf2 --- /dev/null +++ b/site/views/helloworld/view.html.php @@ -0,0 +1,42 @@ +item = $this->get('Item'); + + // Check for errors. + if (count($errors = $this->get('Errors'))) + { + JLog::add(implode('
', $errors), JLog::WARNING, 'jerror'); + return false; + } + + // Display the view + parent::display($tpl); + } +} diff --git a/site/views/index.html b/site/views/index.html new file mode 100644 index 0000000..94906bc --- /dev/null +++ b/site/views/index.html @@ -0,0 +1 @@ +