Methods to access properties of an area
This class is used to manage areas. The following functions are supplied
Located in /program/lib/areamanager.class.php (line 62)
construct an AreaManager object
This initialises the AreaManager and also dispatches the chore to do.
present a dialog where the user can enter minimal properties for a new area
this displays a dialog where the user can enter the minimal necessary properties of a new area. These properties are:
The new area is saved via performing the 'chore' AREAMANAGER_CHORE_SAVE_NEW.
delete an area from ths site after confirmation
this either presents a confirmation dialog to the user OR deletes an area. First the user's permissions are checked and also there should be no nodes left in the area before anything is done. Only allowing deletion of an empty area is safety measure: we don't want to accidently delete many many nodes from an area in one go (see also task_node_delete()). Also, we don't want to introduce orphaned node records (by deleting the area record without deleting nodes).
Note that this routine could have been split into two routines, with the first one displaying the confirmation dialog and the second one 'saving the changes'. However, I think it is counter-intuitive to perform a deletion of data under the name of 'saving'. So, I decided to use the same routine for both displaying the dialog and acting on the dialog.
show the basic properties edit dialog and the edit menu
Note that this dialog does NOT allow every area property to be edited: the path to the datafiles is readonly. It feels too complicated to allow the user to actually change the path because in that case we need to move all existing files to the new location, etc. etc. I did consider to allow the GURU to perform that task (ie editing the path), but eventually decided against it: it is simply not worth it. However, if you know the way to the database and manually edit the path field you can do so, but in that case you're on your own... The user can see the path but not touch it.
show the theme/area configuration dialog and the edit menu
this displays the list of configurable properties of the theme currently associated with this area in a dialog so that the user can modify the values. Since the area-theme configuration is a more or less 'standard' list of properties, we can use the generic configuration manipulator contained in the ConfigAssistant class.
display list of areas with edit/delete icons etc. and option to add an area
this constructs the heart of the area manager: an optional link to add an area followed by a list of links for all areas to which the user has access. From here the user can set the default area, attempt to delete an area and edit the basic and advanced properties of an area. All actions that manipulate an area return here eventually.
Note that the calling routine (the configuration manager) is allowed to display a menu because we set the parameter show_parent_menu to TRUE here.
The constructed list looks something like this:
The clickable icons [H] and [ ] manipulate the default area The clickable icons [D] lead to a Delete area confirmation dialog The clickable icons [E] lead to the Edit area (theme parameters) The clickable titles lead to the Edit area (basic parameters) The clickable link 'Add an area' leads to the add new area dialog.
The area titles are dimmed (grayed-out) if the user is able to see these areas (because they're public or the user has at most intranet acces for that area). Private areas for which the user has no access at all don't show up in the list. If the user has Edit-permissions, the area title is not dimmed and the area can be edited.
reset the theme configuration to the factory defaults
this is a two-step process: we either show a confirmation dialog or we actually overwrite the existing theme configuration with the default values.
validate and save modified data to database
this saves data from both the edit and the edit theme dialog if data validates. If the data does NOT validate, the edit screen is displayed again otherwise the area overview is displayed again.
save the newly added area to the database
This saves the essential information of a new area to the database, using sensible defaults for the other fields. Also, a data directory is created and the relative path is stored in the new area record.
If something goes wrong, the user can redo the dialog, otherwise we return to the area overview.
make the selected area the default for the site
this sets a default area. First we check permissions and if the user
shorthand for the anchor parameters that lead to the area manager
determine the number of existing properties for a theme in an area
construct the add area dialog
this constructs an add area dialog definition with the bare minimal fields.
construct the delete area dialog
this is basically two buttons and a CSRF token
construct the edit area basic properties dialog
Note that this dialog makes the private/public flag readonly; this field is only displayed. Also note that the datadirectory path is shown readonlye too. It is simply too much hassle to allow the user to change this path because that would imply that the existing files should move along. We'll keep it simple. However, it must be possible to look up the name of the data dir, so therefore we do display it.
fill the dialog with current area data from the database
Note that area_path is no longer a part of the dialogdef (see also get_dialogdef_edit_area()) but if it were, the data would still be fetched.
construct a clickable icon to delete this area
construct a clickable icon to edit theme properties of this area (edit advanced)
construct a clickable icon to set the default area
the 'default' icon is displayed for the default area, the 'non-default' icon for all others. The user is allowed to make the area the default area if the user has edit permissions for both the old and the new default area.
fetch a list of themes available for an area
this retrieves a list of themes that can be used as a list of options in a listbox or radiobuttons. Only the active themes are considered. The names of the themes that are displayed in the list are translated (retrieved from the themes language files). The list is ordered by that translated theme name.
retrieve a list of all available theme records
this returns a list of active theme-records or FALSE if none are are available The list is cached via a static variable so we don't have to go to the database more than once for this. Note that the returned array is keyed with theme_id.
reset the theme properties of an area to the default values
this deletes any existing properties for the combination of $area_id and $theme_id from the properties table. After that, a copy of the defaults of the theme $theme_id is inserted in the areas-themes properties table. _Eventually_ this may exhaust the available primary keys in the area-theme-properties table. Oh well: with a handful of properties each time you need a lot of resets...
This routine returns TRUE on success or FALSE on error. In the latter case either we were not able to delete old values OR we were not able to insert a copy of the default properties.
display the edit menu via $this->output
This displays a clickable menu on in the menu area.
allow the caller to use the menu area (or not)
this routine tells the caller if it is OK to use the menu area (TRUE returned) or not (FALSE returned).
determine the value for the sort order of a new area
this calculates a new sort order value based on the existing minimum or maximum values of existing areas (if any).
Note The default sort order for areas differs from that of pages and sections: we assume that the person managing areas knows where to find the newly added area (at the bottom) whereas for a page/section maintainer it is probably more convenient to have a new page/section added at the top of the (perhaps very long) list.
Documentation generated on Tue, 28 Jun 2016 19:08:21 +0200 by phpDocumentor 1.4.0