[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/administrator/components/com_postinstall/src/Model/ -> MessagesModel.php (summary)

(no description)

Copyright: (C) 2013 Open Source Matters, Inc.
License: GNU General Public License version 2 or later; see LICENSE.txt
File Size: 740 lines (27 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

MessagesModel:: (14 methods):
  populateState()
  getItem()
  unpublishMessage()
  archiveMessage()
  republishMessage()
  getItems()
  getItemsCount()
  getExtensionName()
  resetMessages()
  hideMessages()
  onProcessList()
  getComponentOptions()
  addPostInstallationMessage()
  getJoomlaFilesExtensionId()


Class: MessagesModel  - X-Ref

Model class to manage postinstall messages

populateState()   X-Ref
Method to auto-populate the state.

This method should only be called once per instantiation and is designed
to be called on the first call to the getState() method unless the
configuration flag to ignore the request is set.

return: void

getItem($id)   X-Ref
Gets an item with the given id from the database

param: integer  $id  The item id
return: Object

unpublishMessage($id)   X-Ref
Unpublishes specified post-install message

param: integer  $id  The message id
return: void

archiveMessage($id)   X-Ref
Archives specified post-install message

param: integer  $id  The message id
return: void

republishMessage($id)   X-Ref
Republishes specified post-install message

param: integer  $id  The message id
return: void

getItems()   X-Ref
Returns a list of messages from the #__postinstall_messages table

return: array

getItemsCount()   X-Ref
Returns a count of all enabled messages from the #__postinstall_messages table

return: integer

getExtensionName($eid)   X-Ref
Returns the name of an extension, as registered in the #__extensions table

param: integer  $eid  The extension ID
return: string  The extension name

resetMessages($eid)   X-Ref
Resets all messages for an extension

param: integer  $eid  The extension ID whose messages we'll reset
return: mixed  False if we fail, a db cursor otherwise

hideMessages($eid)   X-Ref
Hides all messages for an extension

param: integer  $eid  The extension ID whose messages we'll hide
return: mixed  False if we fail, a db cursor otherwise

onProcessList(&$resultArray)   X-Ref
List post-processing. This is used to run the programmatic display
conditions against each list item and decide if we have to show it or
not.

Do note that this a core method of the RAD Layer which operates directly
on the list it's being fed. A little touch of modern magic.

param: array  &$resultArray  A list of items to process
return: void

getComponentOptions()   X-Ref
Get the dropdown options for the list of component with post-installation messages

return: array  Compatible with JHtmlSelect::genericList

addPostInstallationMessage(array $options)   X-Ref
Adds or updates a post-installation message (PIM) definition. You can use this in your post-installation script using this code:

require_once JPATH_LIBRARIES . '/fof/include.php';
FOFModel::getTmpInstance('Messages', 'PostinstallModel')->addPostInstallationMessage($options);

The $options array contains the following mandatory keys:

extension_id        The numeric ID of the extension this message is for (see the #__extensions table)

type                One of message, link or action. Their meaning is:
message  Informative message. The user can dismiss it.
link     The action button links to a URL. The URL is defined in the action parameter.
action   A PHP action takes place when the action button is clicked. You need to specify the action_file
(RAD path to the PHP file) and action (PHP function name) keys. See below for more information.

title_key           The Text language key for the title of this PIM.
Example: COM_FOOBAR_POSTINSTALL_MESSAGEONE_TITLE

description_key     The Text language key for the main body (description) of this PIM
Example: COM_FOOBAR_POSTINSTALL_MESSAGEONE_DESCRIPTION

action_key          The Text language key for the action button. Ignored and not required when type=message
Example: COM_FOOBAR_POSTINSTALL_MESSAGEONE_ACTION

language_extension  The extension name which holds the language keys used above.
For example, com_foobar, mod_something, plg_system_whatever, tpl_mytemplate

language_client_id  Should we load the frontend (0) or backend (1) language keys?

version_introduced  Which was the version of your extension where this message appeared for the first time?
Example: 3.2.1

enabled             Must be 1 for this message to be enabled. If you omit it, it defaults to 1.

condition_file      The RAD path to a PHP file containing a PHP function which determines whether this message should be shown to
the user. @see FOFTemplateUtils::parsePath() for RAD path format. Joomla! will include this file before calling
the condition_method.
Example:   admin://components/com_foobar/helpers/postinstall.php

condition_method    The name of a PHP function which will be used to determine whether to show this message to the user. This must be
a simple PHP user function (not a class method, static method etc) which returns true to show the message and false
to hide it. This function is defined in the condition_file.
Example: com_foobar_postinstall_messageone_condition

When type=message no additional keys are required.

When type=link the following additional keys are required:

action  The URL which will open when the user clicks on the PIM's action button
Example:    index.php?option=com_foobar&view=tools&task=installSampleData

When type=action the following additional keys are required:

action_file  The RAD path to a PHP file containing a PHP function which performs the action of this PIM. @see FOFTemplateUtils::parsePath()
for RAD path format. Joomla! will include this file before calling the function defined in the action key below.
Example:   admin://components/com_foobar/helpers/postinstall.php

action       The name of a PHP function which will be used to run the action of this PIM. This must be a simple PHP user function
(not a class method, static method etc) which returns no result.
Example: com_foobar_postinstall_messageone_action

param: array  $options  See description
return: $this

getJoomlaFilesExtensionId()   X-Ref
Returns the library extension ID.

return: integer



Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer