The package contains basic modules like the articles, the pages, the comments, the slideshow, etc.
The first part of a module section lists recorded elements for this module, the second part is a form to add or modify an element.
In the settings section, you can manage the parameters essential to the smooth running of the web site and its manager.
Add / configure your own modules
You can add and personalize your own modules:
- Duplicate the folder /admin/modules/.TABLE_NAME_WITHOUT_PREFIX/ and its content
- Rename it with the same name of the table in the database without the prefix "pm_" (module name = table name without prefix = folder name)
- Edit the file db.sql in the module folder and execute this script in your phpMyAdmin
- Edit the file config.xml in the module folder
Database: db.sql
-- ================ CREATION OF THE TABLE pm_article =============
CREATE TABLE IF NOT EXISTS pm_article(
id int NOT NULL AUTO_INCREMENT,
lang int NOT NULL,
title varchar(250),
subtitle varchar(250),
alias varchar(100),
text longtext,
url varchar(250),
tags varchar(250),
id_page int,
id_user int,
home int DEFAULT 0,
checked int DEFAULT 0,
rank int DEFAULT 0,
add_date int,
edit_date int,
publish_date int,
unpublish_date int,
comment int DEFAULT 0,
PRIMARY KEY(id, lang)
) ENGINE=INNODB DEFAULT CHARSET=utf8;
ALTER TABLE pm_article ADD CONSTRAINT article_lang_fkey FOREIGN KEY (lang) REFERENCES pm_lang(id) ON DELETE CASCADE ON UPDATE NO ACTION;
ALTER TABLE pm_article ADD CONSTRAINT article_page_fkey FOREIGN KEY (id_page, lang) REFERENCES pm_page(id, lang) ON DELETE CASCADE ON UPDATE NO ACTION;
Usefull and reserved columns names for the tables
- id : required
- lang : required if "multi" attribute has the value 1 in config.xml (for multilingual modules)
- rank : required if "ranking" attribute has the value 1 in config.xml (if the elements can be sorted with drag'n'drop on the list)
- home : required if "home" attribute has the value 1 in config.xml (if the element can appear on homepage)
- checked : required if "validation" attribute has the value 1 in config.xml (if the element can be published or not)
- add_date / edit_date : required if "date" attribute has the value 1 in config.xml (if the element needs a add date and an edit date)
- publish_date / unpublish_date : required if "release" attribute has the value 1 in config.xml (if the release of the element needs to be sheduled)
Conserve the "TABLE_NAME_file" if the element neads medias (pdf, pictures, videos...)
Configuration: config.xml
The file config.xml define the module settings and the columns displayed in list.php and form.php (/admin/module/default/). config.xsd check the syntax of this document
<?xml version="1.0" encoding="UTF-8"?>
<module title="Articles" name="article" multi="1" library="1" dashboard="1" icon="thumb-tack" ranking="1" home="1" validation="1" dates="1" release="1" index="1">
<!-- resizing
[0] 1 single image
[1] 1x big, 1x medium, 1x small -->
<medias max="30" resizing="1">
<big maxw="1920" maxh="1440"/>
<medium maxw="600" maxh="600"/>
<small maxw="400" maxh="400"/>
</medias>
<list order="rank">
<filter label="Page" name="id_page" table="pm_page" fieldlabel="name" fieldvalue="id" order="name"/>
<col label="Title" name="title" type="none"/>
<col label="Page" name="id_page" table="pm_page" fieldvalue="name" fieldref="id"/>
</list>
<form>
<field multi="1" label="Title" name="title" type="text" required="1" unique="0" validation="none"/>
<field multi="1" label="Subtitle" name="subtitle" type="text" required="0" unique="0" validation="none"/>
<field multi="1" label="Alias" name="alias" type="text" required="1" unique="1" validation="none" comment="Article URL"/>
<field multi="1" label="Text" name="text" type="textarea" editor="1" required="0" unique="0" validation="none"/>
<field multi="1" label="URL" name="url" type="text" required="0" unique="0" validation="none"/>
<field multi="0" label="Page" name="id_page" type="select" required="1" unique="0" validation="none">
<options table="pm_page" fieldlabel="name" fieldvalue="id" order="name"/>
</field>
<field multi="0" label="Tags" name="tags" type="multiselect" required="0" unique="0" validation="none">
<options table="pm_tag" fieldlabel="value" fieldvalue="id" order="value"/>
</field>
<field multi="0" label="Allow comment ?" name="comment" type="radio" required="1" unique="0" validation="none" roles="administrator">
<options>
<option value="1">Yes</option>
<option value="0">No</option>
</options>
</field>
<field multi="0" label="User" name="id_user" type="select" required="1" unique="0" validation="none" roles="administrator">
<options table="pm_user" fieldlabel="login" fieldvalue="id" order="login"/>
</field>
</form>
<roles>
<user type="administrator" permissions="all"/>
<user type="manager" permissions="all"/>
<user type="editor" permissions="add,edit,upload"/>
</roles>
</module>
XML structure
<module> has the following attributes
Name |
Expected type / values |
Description |
title |
text |
title of the module |
name |
text |
column name in the table |
multi |
1 or 0 |
enables or disables the foreign languages (multilingual or not) |
library |
1 or 0 |
the medias of the module appear or not in the library of medias on the form page |
dashboard |
1 or 0 |
shows or hides a focus box on the manager homepage |
icon |
text |
the icon associated with the module (it's the suffix of "Font Awesome": fa fa-xxxx) |
ranking |
1 or 0 |
enables or disables the ranking of the elements in the list |
home |
1 or 0 |
possible or not to show/hide an element on the homepage |
validation |
1 or 0 |
possible or not to publish/unpublish an element |
dates |
1 or 0 |
enables or disables the add date and the edit date |
release |
1 or 0 |
possible or not to shedule the release of an element |
index |
integer > 0 |
rank of the module in the main menu |
<module> contains 1 element <media>, 1 element <list>, 1 element <form> and 1 element <roles>
<medias> has the following attributes
Name |
Expected type / values |
Description |
max |
integer |
maximum number of medias |
resizing |
1 or 0 |
resizing type for the picture: "0" = 1 single image, "1" = 1x big, 1x medium and 1x small |
<medias> contains 1x <big>, 1x <medium> and 1x <small>
<big>, <medium> and <small> has the following attributes
Name |
Expected type / values |
Description |
maxw |
integer |
maximum width of the pictures in pixels |
maxh |
integer |
maximum height of the pictures in pixels |
<list> has the following attributes
Name |
Expected type / values |
Description |
order |
text |
column name in the table followed by DESC or ASC if necessary |
<list> contains 1 or more elements <col>
<col> has the following attributes
Name |
Expected type / values |
Description |
label |
text |
title in the header cel |
name |
text |
column name in the table |
type |
"date" | "price" | "none" (for text) |
display format (price: currency in fn_form.php) |
table |
text |
table referencing the values (optional) |
fieldref |
text |
column name referencing the values of this table (visible, optional) |
fieldvalue |
text |
column name containing the value referenced by "fieldref" (hidden, optional) |
<form> contains 1 or more elements <field>
<field> has the following attributes
Name |
Expected type / values |
Description |
multi |
1 or 0 |
display for all languages or not |
label |
text |
label of the field (optional) |
type |
"radio" | "text" | "textarea" | "select" | "checkbox" | "date" | "current_date" | "separator" |
field type |
editor |
1 or 0 |
CKEditor or basic input |
name |
text |
column name in the table or other for a "separator" field, it must be unique for a module |
required |
1 or 0 |
required value or not |
validation |
"mail" | "numeric" | "none" |
validation type |
unique |
1 or 0 |
unique value in the table or not (e-mail for exmaple) |
comment |
text |
instruction about this field |
roles |
comma separated values: administrator, manager, editor |
user types allowed to edit this field |
<roles> contains 3 elements <user> (1 for each type of user)
<user> has the following attributes
Name |
Expected type / values |
Description |
type |
"administrator" | "manager" | "editor" |
type of user |
permissions |
comma separated values: all, add, edit, delete, publish, upload, no_access |
permissions for this user |
More about the field types
- radio : radio buttons - the options are defined into the <options> tag
- select : drop-down list - the options are defined into the <options> tag
- multiselect : multiple-choice list - the options are defined into the <options> tag
- checkbox : as the name suggests - the options are defined into the <options> tag
- text : text field
- textarea : as the name suggests
- date : automatic drop-down lists with year, month, day (converted in timestamp)
- datetime : automatic drop-down lists with year, month, day, hours, minutes, seconds (converted in timestamp)
- current_date : hidden field with the current date (timestamp)
- separator : separator between different parts of the form
More about the <options> tag
<field> can contain a <options> tag which define the options of the "checkbox", "radio" and "select" fields
-
the options are "continuous" values
<options> tag must contain 1 <min> and 1 <max> tags
-
the options are "one-off"
L'élément <options> devra comporter un ou plusieurs éléments <option> contenant le libellé de l'item.
each <option> tag must contain an attribute "value" like the html tag.
-
the options are stored in a specific table of the database
<options> must contain the following attributes
- table : table name containing the values
- fieldlabel : column name of the item label (visible)
- fieldvalue : column name of the item value (hidden)