File/program/install/demodata.php

Description

/program/install/demodata.php - code to install the main demodata

this file, included from /program/install.php, contains a single routine which installs the main demodata. This is done only once during a fresh install of a site.

Functions
demodata (line 91)

insert basic demonstration data; the foundation for the module/theme demonstration data

this routine inserts all sorts of demonstation data as a foundation for the demonstration of various modules and themes.

The array &$messages is used to pass (error) messages back to the caller. The overall result returned is TRUE on success, or FALSE on failure.

The parameter &$config is used to communicate essential information about the site that is being installed, such as the main URL and the various directories. Also the information about the first user account is passed; this can be used to setup alerts etc. Finally, this array is used to return the three numbers of the three demonstration areas created.

The first demonstration area is a public area. This would be the area to show off all bells and whistles of the CMS. The second demonstration area is a private area. This area could be used to show off an intranet-type of application, maybe accessible only to members of the team. The third area is an in-active area, just for the heck of it.

Note that the demonstration data is to be translated. All translations can be found in /program/install/languages/LL/demodata.php where LL indicates the language code. The language to use is specified in the parameter $config['language_key'].

This routine is completely self-contained, even the translations are handled manually here.

As an added bonus for other demodata routines (eg. the installers of demo data for modules and themes) the main demodata strings are added to $config and also a set of handy search/replace pairs. After calling this routine, the $config array contains the following.

    $config['language_key']   => install language code (eg. 'en') $config['dir']            => path to CMS Root Directory (eg. /home/httpd/htdocs) $config['www']            => URL of CMS Root Directory (eg. http://exemplum.eu) $config['progdir']        => path to program directory (eg. /home/httpd/htdocs/program) $config['progwww']        => URL of program directory (eg. http://exemplum.eu/program) $config['datadir']        => path to data directory (eg. /home/httpd/wasdata/a1b2c3d4e5f6) $config['title']          => the name of the site $config['user_username']  => userid of webmaster (eg. wblader) $config['user_full_name'] => full name of webmaster (eg. Wilhelmina Bladergroen) $config['user_email']     => email of webmaster (eg. w.bladergroen@exemplum.eu) $config['user_id']        => numerical user_id (usually 1) $config['demo_salt']      => password salt for all demodata accounts $config['demo_password']  => password for all demodata accounts $config['friendly_url']   => TRUE if friendly URLs are allowed (added 2013-07-03) $config['demo_areas']     => array with demo area data $config['demo_groups']    => array with demo group data $config['demo_users']     => array with demo user data $config['demo_nodes']     => array with demo node data $config['demo_string']    => array with demo strings from /program/install/languages/LL/demodata.php $config['demo_replace']   => array with search/replace pairs to 'jazz up' the demo strings

  • return: TRUE on success + data entered into database, FALSE on error
bool demodata (array &$messages, array &$config)
  • array &$messages: used to return (error) messages to caller
  • array &$config: pertinent information about the site and also returns additional demo data
demodata_alerts (line 1129)

create a few alerts

  • return: TRUE on success + data entered into database, FALSE on error
bool demodata_alerts (array &$messages, array &$config, array &$tr)
  • array &$messages: used to return (error) messages to caller
  • array &$config: pertinent information about the site
  • array &$tr: translations of demodata texts
demodata_areas (line 174)

create three areas + themes

  • return: TRUE on success + data entered into database, FALSE on error
bool demodata_areas (array &$messages, array &$config, array &$tr)
  • array &$messages: used to return (error) messages to caller
  • array &$config: pertinent information about the site
  • array &$tr: translations of demodata texts
demodata_sections_pages (line 635)

create a few sections and pages

this constructs a complete public area with some pages and sections and also the 'frugal' theme is configured for this area. The information about the nodes (including the assigned node_id) is copied to $config['demo_nodes'] for the caller's perusal.

  • return: TRUE on success + data entered into database, FALSE on error
bool demodata_sections_pages (array &$messages, array &$config, array &$tr)
  • array &$messages: used to return (error) messages to caller
  • array &$config: pertinent information about the site; receives copy of nodes array on return
  • array &$tr: translations of demodata texts
demodata_users_groups (line 334)

create a handful of users/groups/capacities/acls

This routine creates the following 4 groups:

  • faculty (principals and teachers)
  • team (principals and teachers and all other employees)
  • seniors (pupils in grades 5 to 8)
  • juniors (pupils in grades 1 to 4)
The following 7 group/capacties are also created
  • faculty/principal (3)
  • faculty/member (4)
  • team/member (4)
  • seniors/pupil (1)
  • seniors/teacher (2)
  • juniors/pupil (1)
  • juniors/teacher (2)
The following 8 users are also created
  • Amelia Cackle (acackl): Faculty/Principal, Team/Member
  • Maria Montessori (mmonte): Faculty/Member, Team/Member, Seniors/Teacher
  • Helen Parkhurst (hparkh): Faculty/Member, Team/Member, Juniors/Teacher
  • Freddie Frinton (ffrint): Team/Member
  • Andrew Reese (andrew): Seniors/Pupil
  • Catherine Hayes (catherine): Seniors/Pupil
  • Herbert Spencer (herberd): Juniors/Pupil
  • Georgina King (georgina): Juniors/Pupil
Every user and every group/capacity gets their own acl
  • faculty/principal: access to all private areas
  • faculty/member: access to intranet in $config['demo_areas']['private']['area_id']
  • others get no special privileges
The arrays with groups (including the assigned group_id) and users (with the assigned user_id) are stored in $config['demo_groups'] and $config['demo_users'], for the caller's perusal.

  • return: TRUE on success + data entered into database, FALSE on error
  • todo: get rid of the $wizard kludge!
  • todo: should we append an underscore to the userpaths to make sure we don't clash with the first user account?
  • todo: should we also add groups_capacities, acls, users_groups_capacities to $config or are users and groups enough?
bool demodata_users_groups (array &$messages, array &$config, array &$tr)
  • array &$messages: used to return (error) messages to caller
  • array &$config: pertinent information about the site, also receives copy of users/groups data
  • array &$tr: translations of demodata texts

Documentation generated on Tue, 28 Jun 2016 19:09:09 +0200 by phpDocumentor 1.4.0