Maarch Framework 3/Developer handbook (deprecated)

De Maarch // Wiki.

Aller à : Navigation, rechercher
Warning.gif Cette section du wiki est en cours de restructuration et de rédaction. Nous nous excusons pour la gêne occasionnée.
This section of the wiki is under heavy restructuring and writing. We're sorry for the inconvenience.

Sommaire

Concerned Audience

This technical document is dedicated to developers. It gives some keys to the inside of Maarch Framework. This book is open to contributors, as there is a lot to say and not so much time.

Description and Utility of Maarch Core Classes

The core is composed of files essential with the good performance of Maarch business applications and its modules. In the core there is no CSS and image, they must be treated by business applications (a "maarch_sample"). Some features are managed by the core (classes and data model).

  • Database access management (class_db.php)
  • Requests generation (class_request.php)
  • Connection to the business application (identification + authentification : class_security.php)
  • Storage management (class_docserver.php)
  • Standardized methods to insert, update and delete a resource (class_resource.php)
  • Portal management
  • Connections logs and events history management (class_history.php)
  • Common functions to all the applications : tool box(class_functions.php)

The main philosophy is to manage the framework mechanics in the core. Display is not managed by the core but by modules and business applications.

class_core_tools.php

Utility :

  • management and construction of the framework</li>
  • loading of the services of the modules</li>
  • execution of the services of the modules</li>

Properties

None

Methods

Application building
 public function build_core_config($pathtoxmlcore)
    => Arguments : path to the core configuration file (xml)
    => Objective : load Maarch core configuration into sessions vars 
 public function load_modules_config($modules)
   => Arguments : array of enabled modules
   => Objective : Load Maarch modules configuration into sessions vars 
 public function load_var_session($modules)
   => Arguments : array of enabled modules
   => Objective : Load the specific variables of each module into session
 public function load_lang() 
   => Objective : Load the language variables of the application into session
 public function load_lang_modules($modules)
   => Arguments : array of enabled modules
   => Objective : Load the language variables of each module into session
 public function load_menu($modules)
   => Arguments : array of enabled modules
   => Objective : Load menu items of each module and the application into session
 public function build_menu($menu)
   => Arguments : array of enabled menu items
   => Objective : build the application menu with the session variable $_SESSION['menu']
 public function load_html()
   => Objective : write the doctype and the html declaration
 public function load_header($title=) 
   => Arguments : value of the title tag (optional)
   => Objective : write the html header
 private function load_html()
   => Objective : write the application and modules css declarations
 private function load_js()
   => Objective : write the application and modules javascript calls
 public function insert_page()
   => Objective : Enable to insert the required PHP script into the Maarch main index page
 public function load_footer()
   => Objective : write the footer 
 public function get_session_time_expire() 
   => Objective : get the time when the session expires
Loading of the services of the modules
 public function load_app_services()
   => Objective : load the services of the application into session (services.xml)
 public function load_modules_services($modules)
   => Arguments : array of enabled modules
   => Objective : load the services of each module into session
 public function is_module_loaded($module_id) 
   => Arguments : module identifier
   => Objective : Test if the module is loaded, you have to use this function before execution of service of a module
Execution of the services of the modules
 public function test_admin($id_service, $redirect=true) 
   => Arguments : service identifier, boolean which activate or not page redirection in error case (optional)
   => Objective : Test if the current user has right on an administration service
 public function test_service($id_service, $redirect=true) 
   => Arguments : service identifier, boolean which activate or not page redirection in error case (optional)
   => Objective : Test if the current user has right on the service
 public function execute_preprocess_of_services_in_background($modules_services, $whereami) 
   => Arguments : array of enabled services, the page here to execute the preprocess
   => Objective : Execute the preprocess of services in background in the page 
 public function execute_postprocess_of_services_in_background($modules_services, $whereami) 
   => Arguments : array of enabled services, the page here to execute the postprocess
   => Objective : Execute the postprocess of services in background in the page 
 public function execute_modules_services($modules_services, $whereami, $servicenature='all', $id_service=, $id_module=)
   => Arguments : array containing all the services for each modules, page where the services must be executed, nature of the services to execute (optional), id of a service (optional), id of a module (optional)
   => Objective : execute the modules services in the good page 
 public function load_first_tab($modules_services, $whereami)
   => Arguments : array containing all the services for each modules, page where the services must be executed
   => Objective : load the services of tab nature into the page
 public function execute_apps_services($app_services, $whereami, $servicenature='all')
   => Arguments : array containing all the application services, page where the services must be executed, nature of the services to execute (optional)
   => Objective : execute the services of the application in the good page 
 public function get_service_page($id_service, $origin, $id_module=) 
   => Arguments : service identifier, service origin (APPS or MODULE), module identifier (optional)
   => Objective : Get the page corresponding to the service

Others

 public function is_var_in_history_keywords_tab($id)
 => Arguments : Key word to check
 => Objective : Check if the key word (history event) is known of the apps
 public function view_debug()
 => Objective : Show the debug data 
 public function test_user()
 => Objective : test if the current user data are in session
 public function retrieve_label_service($id_service) 
 => Arguments : service identifier
 => Objective : return the label of the service

class_db.php

Utility :

  • compatibility with the following databases allows:Mysql, Postgres, Mssql Server
  • connection to the Maarch database
  • execution of SQL queries to the Maarch database
  • recovery of the results of SQL requests
  • managing the database errors

Properties

private $debug 
=> debug mode activation
private $debug_query
=> debug query (in debug mode)
private $sql_link
=> SQL link identifier
private $what_sql_error
=> Error number, to know why the script stop
private $query
=> SQL query
private $nb_query
=> Number of queries made with the current identifier
private $result
=> Result of the query

Methods

Connexion to Maarch database

 public function connect()
=> Objective : open a connextion to the database 
 public function close_conn()
=> Objective : open a connextion to the database 

Execution of SQL queries and recovery of the results

 public function query($q_sql, $catch_error=false)
=> Arguments : SQL query text, boolean to catch sql error or not (optional)
=> Objective : execution of SQL queries
 public function fetch_object() 
=> Objective : returns the query results in an object
 public function fetch_array() 
=> Objective : returns the query results in an array
 public function fetch_row() 
=> Objective : returns the query results in a row
 public function nb_result()
=> Objective : returns the number of results for the current query

Managing the database errors

 public function error()
=> Objective : database error management
 public function show()
=> Objective : allow you to show the SQL request in a debug mode

class_docserver.php

Utility :

  • selection of docserver
  • copy of a new file into the docserver
  • update of the docserver characteristics

Properties

private $docserver_id
=> Docserver identifier
private $is_readonly
=> the docserver is in readonly mode or not
private $is_enabled
=> the docserver is enabled or not
private $size_limit
=> Docserver size limit
private $actual_size
=> Actual size of the docserver
private $path
=> Docserver path
private $creation_date
=> Docserver creation date
private $close_date
=> Docserver close date
private $coll_id
=>  Identifier of the colletion linked to the docserver
private $error
=> Docserver error

Methods

Selection of a docserver

 funtion __construct($table, $coll_id)
=> Arguments : docserver table, collection identifier
=> Objective : construct method, by default chooses the first available docserver of a collection (lower priority)
 public function select_docserver($id,$table)
=> Arguments : docserver identifier, docserver table
=> Objective : select a specified docserver
 public funtion check_size($filesize)
=> Arguments : size of a file 
=> Objective : check the size of the docserver to see if there is enough disk place

Copy a new file in the docserver

 public funtion filename()
=> Objective : copy and rename the file in the selected docserver, create a new subdirectory if needed

Update docserver characteristics

 public funtion set_size()
=> Objective : set the new size of the docserver after file copy

Docserver Error Management

 public funtion get_error()
=> Objective : get the error message
 public funtion init_error()
=> Objective : empty the docserver error variable

Data retrieval

 public funtion get_id()
=> Objective : get the current docserver identifier
 public funtion get_path()
=> Objective : get the current docserver path

class_functions.php

Utility :

  • the toolkit of the Maarch framework
  • management of the posting variables
  • management of date format

Properties

Methods

The toolkit of the Maarch framework

 public funtion manage_location_bar($path='', $label ='', $id_page ='', $init = true, $level ='')
=> Arguments : url of a page to show in the location bar (empty by default), label of the page to show, identifier of the page to show, reinit the location bar or not (true by default), level of the page in the location bar
=> Objective : Manage the application location bar (4 levels max)
 private funtion where_am_i()
=> Objective : Indicate where the current user is located in the application (used in the manage_location_bar function)
 public funtion echo_error($title, $message, $type='', $img_src)
=> Arguments : title, the message to show, if type = 'title' the title is showed, the source of the image to show (optional)
=> Objective : write an error in a specific format with header and footer (used to avoid $_SESSION['error'])
 public funtion infouser($user_id)
=> Arguments : user identifier
=> Objective : return an array with the user data
 public funtion return_bytes($val) 
=> Arguments : value to convert
=> Objective : convert a value in giga(g), mega(m) or kilo(k) into bytes, useful to compare the upload size file with the maximum allowed size for uploaded files specified by the php.ini

Management of the posting variables

 public funtion wash($what, $mask='no', $msg_error ='', $empty='yes', $min_limit='', $max_limit='')
=> Arguments : variable to clean, using a mask or not (mail, num, float, letter, alphanum, nick, url,file, name),  eerror message (empty by default), accept empty variable or not (yes, no), minimum size limit, maximum size limit 
=> Objective : clean a variable using different possibilities
 public funtion show($what)
=> Arguments : variable to show 
=> Objective : show a var with personnal formating. It allows you to add formating action for 
showing the var (by default, return a variable without slashes)
 public funtion show_array($array)
=> Arguments : array to show 
=> Objective : show an array in a more readable way (indented)
 public funtion protect_string_db($string)
=> Arguments : the string to format
=> Objective : Return the string in the database format for insert (USE THIS FUNCTION WHEN YOU MUST INSERT A STRING INTO THE DATABASE)
 public function show_string_db($string)
=> Arguments : the string to show
=> Objective : clean the string  after a select query in a database to be properly showed in the application
 public function retrieve_constant_lang($constant, $lang_file)
=> Arguments : the constant to retrieve, the language file
=> Objective : retrieve a constant value of a language file
 public function wash_html($var)
=> Arguments : the string to clean
=> Objective : clean html string, replacing accentued entities by utf-8 code (used for javascript message box)

Management of the date format

 public funtion format_date($datetime)
=> Arguments : datetime to format
=> Objective : convert a datetime in a date DD-MM-YYYY
 public funtion dateformat($datetime)
=> Arguments : date or datetime to format
=> Objective : format a datetime or a date to DD/MM/YYYY
 public funtion dateformat($day, $month, $year)
=> Arguments : day, month and year
=> Objective : check a date validity and write the error in the session ($_SESSION['error']) if any
 public funtion format_date_db($date, $insert=true)
=> Arguments : the date to format, boolean if true format the date to be inserted into the database
=> Objective : Return the date in the database format for insert (USE THIS FUNCTION WHEN YOU MUST INSERT A DATE INTO THE DATABASE)
 public funtion WhenEasterCelebrates($year = null)
=> Arguments : year (null by default)
=> Objective : return the next eastern date
 public funtion WhenOpenDay($date, $delta)
=> Arguments : date, delta
=> Objective : return the next open day
 public funtion addDate($date, num)
=> Arguments : date, integer
=> Objective : add an integer to a date
 public funtion date_max_treatment($delay)
=> Arguments : delay in days
=> Objective : return the next open day after the delay
 public funtion date_format_en($date)
=> Arguments : date to format
=> Objective : format a datetime to a MM/DD/YYYY hh:ii:ss format

class_history.php

Utility :

  • connection log and event history management

Properties

None

Methods

Connection log and event history management

public function add($where, $id, $how, $databasetype, $id_module='admin')
=> Arguments : table or view, identifier of the object, event type, event description, identifier of the module (admin by default)
=> Objective : Insert a record in the history table

class_portal.php

Utility :

  • enabled management of business applications connected to the same Maarch core

Properties

None

Methods

Management of business applications connected to the same Maarch core

public function build_config()
=> Objective : build Maarch portal configuration into sessions vars with an xml 
configuration file
public function unset_session()
=> Objective : unset all the session variables


class_request.php

Utility :

  • SQL request auto generation

Properties

None

Methods

SQL query auto generation

public function select($select, $where, $other, $databasetype, $limit='500', $left_join=false, $first_join_table='', $second_join_table = '', $join_key = '', $add_security = true) 
=> Arguments : requested fields, where clause of the query, query adding (order by, group by) database type, maximum number of result for the query, is the query a left join (false by default), first table of the join (empty by default), second table of the join (empty by default), key of the join (empty by default), adding current user security on the query (true by default) 
=> Objective : constructs the select query and send the results, useful to construct array for the list show object
public function insert($table, $data,  $databasetype) 
=> Arguments : table for the insert, array of the data to insert, database type
=> Objective : constructs the insert query and send it to the db
public function update($table, $data, $where, $databasetype) 
=> Arguments : table for the update, array of the data to update, where clause, database type
=> Objective : constructs the update query and send it to the db

class_resource.php

Utility :

  • standardized methods to insert, update and delete a resource

Properties

private $res_id
=> Identifier of the resource
private $type_id
=> Identifier of the document type
private $typist
=> Person who insert the resource in the application
private $format
=> File format
private $docserver_id
=> Docserver identifier 
private $path
=> Path of the resource in the docserver
private $fingerprint
=> Fingerprint of the resource
private $filename
=> Filename of the resource in the docserver 
private $filesize
=> File size
private $offset
=> Offset
private $status
=> Status of the resource in the database
private $error
=> Error

Methods

Standardized methods to insert, update and delete a resource

public function load_into_db($table, $path, $filename, $docserver_path, $docserver_id, $data, $databasetype)
=> Arguments : resource table, path of the file in the docserver, file name in the docserver, docserver path, docserver identifier, array of the index of the resource, database type)
=> Objective : Insert the resource object data into the database
private function check_basic_fields($data)
=> Arguments :  array of the index of the resource to insert into the database
=> Objective : check minimum required fields

Object data retrieval

public function get_id()
=> Objective : Return the resource identifier
public function get_error()
=> Objective : Return the object error

class_security.php

Utility :

  • management of connection to the business application
  • management of user rigths

Properties

None

Methods

Management of connexion to the business application

public function login($user_id, $password)
=> Arguments : user identifier, password for the user
=> Objective : function to log a user
public function reopen($user_id, $cookie_key)
=> Arguments : user identifier, cookie key
=> Objective : function to to reopen a session with the user's cookie

Management of user rigths and users groups

public function load_security_group($group_id)
=> Arguments : group identifier
=> Objective : load the security parameters for a group in session
public function load_services_group($group_id)
=> Arguments : group identifier
=> Objective : load the services for a group in session
public function init_session()
=> Objective : Init the session variables related to the group administration 
public function init_rights_session()
=> Objective : Init to 'N' (no) the rights in the the session variables related to the group administration 
public function set_rights_session($coll_id, $where)
=> Arguments : collection identifier, string corresponding to the right to set ('CAN_INSERT', 'CAN_DELETE' or 'CAN_UPDATE')
=> Objective : set the rights (insert, update or delete) for the collection passed on parameters
public function remove_security($array_coll)
=> Arguments : array of the rights on collections 
=> Objective : remove the security rights on the collections passed in parameters 
public function add_grouptmp_session($coll_id, $where, $comment, $insert, $update, $delete, $mode)
=> Arguments : collection identifier, where clause of the collection, comment on the rights, insert right, update right, delete right and mode
=> Objective : add security parameters of  group in the session variables related to the group administration
public function load_db()
=> Objective : update the database with the groups security of the session variables
public function where_test()
=> Objective : test the syntax of the where clause of all collections for the current group
public function load_groups()
=> Objective : loads data related to the user groups (group name, role, primary group or not) in session variables
public function load_security() 
=> Objective : loads in session variables, the security parameters corresponding to 
the user groups
public function load_enabled_services() 
=> Objective : load the enabled services into session
public function load_services_db($services, $group) 
=> Arguments : array of services, group identifier
=> Objective : load into database the services for a group
private function load_superadmin_services() 
=> Objective : load into session all the services for the superadmin
public function load_user_services($user_id) 
=> Arguments : user identifier
=> Objective : load into session all the services for the user

retrieve_insert_collections() : returns in an array the list of available collections
retrieve_user_insert_coll() : returns in an array the list of available collections for an user
collection_user_right() : returns true if the user can do the action on a collection
get_where_clause_from_view() : returns the where clause of a view

Collection management

public function get_ind_collection($coll_id)
=> Arguments : collection identifier
=> Objective : get the index of the collection 
public function retrieve_insert_collections()
=> Objective : return all collections where we can insert new documents (with tables)
public function get_script_from_coll($coll_id, $script_name)
=> Arguments : collection identifier, script name (script_add, script_search, script_search_result, script_details)
=> Objective : return a script related to a collection
public function retrieve_coll_id_from_table($table)
=> Arguments : tablename
=> Objective : given a table, return the collection identifier of the collection
public function retrieve_coll_table_from_view($view)
=> Arguments : view
=> Objective : given a view, return the collection table
public function retrieve_coll_id_from_view($view)
=> Arguments : view
=> Objective : given a view, return the collection identifier
public function retrieve_view_from_coll_id($coll_id)
=> Arguments : collection identifier
=> Objective : given a collection identifier, return the view
public function retrieve_view_from_table($table)
=> Arguments : table
=> Objective : given a table, return the collection view
public function retrieve_table_from_coll($coll_id)
=> Arguments : collection identifier
=> Objective : given a collection identifier, return the collection identifier
public function retrieve_table_from_view($view)
=> Arguments : view
=> Objective : given a view, return the collection table
public function retrieve_coll_label_from_table($table)
=> Arguments : table
=> Objective : given a table, return the collection label
public function retrieve_coll_label_from_coll_id($coll_id)
=> Arguments : collection identifier
=> Objective : given a collection identifier, return the collection label
public function get_ind_coll($coll_id)
=> Arguments : collection identifier
=> Objective : given a collection identifier, return the collection index of the collection session variable


public function retrieve_user_insert_coll()
=> Objective : return all collections where the current user can insert new resources (with tables)
public function collection_user_right($coll_id, $action)
=> Arguments : collection identifier, action (can_update, can_insert or can_delete)
=> Objective : return true if the current user can do the action on the collection
public function get_where_clause_from_coll_id($coll_id)
=> Arguments : collection identifier
=> Objective : given a collection identifier, return the where clause of the current user on the collection
public function get_where_clause_from_view($view)
=> Arguments : view
=> Objective : given a view, return the where clause of the current user on the collection
public function retrieve_user_coll_table($view)
=> Arguments : view
=> Objective : given a view, return the table
public function test_right_doc($coll_id, $res_id)
=> Arguments : collection identifier, resource identifier
=> Objective : test the right on the resource of a collection for the current user 

Development recommendations for a Maarch business application

class_business_app_tools.php

Utility :

  • contains all the functions to load correctly a business application
  • you can declare specific links of the business application

Load a business applications

build_business_app_config() : build Maarch business app configuration into sessions vars with a xml configuration file
In this class you can defined all the functions to load the specifics variables of a business application.
Ex : load values of business tables in session variables.

Declare specifics links of the business application

insert_app_pages() : allows you to declare specifics links of the application, this function will be called by the insert_page() function of the class class_core_tools.php

Example :

 public function insert_app_page($name)
 {
   if($name == "structures")
   {
     $path = $_SESSION['config']['businessapppath']."admin".$_SESSION['slash_env']."architecture".$_SESSION['slash_env']."structures".$_SESSION['slash_env'].'structures.php'; 
     return $path;
   }
   ...
 }

Development recommendations for a Maarch module

Name of the module

The id of the module declared in the config.xml file (module_id/xml/config.xml) must be the same name as the directory of the module.

class_module_tools.php

Utility :

  • contains all the functions to load correctly a module

Load a module

build_business_app_config() : build Maarch business app configuration into sessions vars with a xml configuration file.
In this class you can defined all the functions to load the specifics variables of a business application.
Ex : load values of business tables in session variables.

Name of the class in class_module_tools.php

The name of the class in class_module_tools.php must be the same name as the id of the module (configured in config.xml of the module).

Example of the autofoldering module :

class autofoldering extends dbquery
{
...
}

Verify module existence before execution

When you want to call a module in a PHP script, you have to verify first that the module is correctly loaded in the framework.
To check this condition, you must call upon the function is_module_loaded() of the class class_core_tools.php.

Execution of a service

To execute a service of a module in PHP script, you have to call these functions of the class class_core_tools.php :

test_admin() : test if the user have admin rights to execute an admin service
test_service() : test if the user have rights to execute a service
execute_modules_services() : execute modules services in the good page
execute_app_services() : execute business application services in the good page
execute_preprocess_of_services_in_background() : execute preprocess services in background
execute_postprocess_of_services_in_background() : execute postprocess services in background
load_first_tab() : allows you to load the first tab of a tab service

Example execute "view_history" service on the details.php script of the module indexing_searching :
->services.xml of the module indexing_searching :

 <SERVICE>
  <id>view_history</id>
  <name>_VIEW_HISTORY</name>
  <comment>_VIEW_HISTORY</comment>
  <servicepage>hist_doc.php</servicepage>
  <servicetype>use</servicetype>
  <enabled>true</enabled>
  <WHEREAMIUSED>
    <page>details.php</page>
    <nature>frame</nature>
    <width>700</width>
    <height>400</height>
  </WHEREAMIUSED>
 </SERVICE>
 <SERVICE>
  <id>select_folder</id>
  <name>_SELECT_FOLDER</name>
  <comment>_SELECT_FOLDER</comment>
  <servicepage>select_folder.php</servicepage>
  <servicetype>use</servicetype>
  <enabled>true</enabled>
  <WHEREAMIUSED>
    <page>index_file.php</page>
    <nature>tab</nature>
    <tab_label>_FOLDER</tab_label>
    <tab_order>1</tab_order>
  </WHEREAMIUSED>
  <WHEREAMIUSED>
    <page>store_file.php</page>
    <nature>tab</nature>
    <tab_label>_FOLDER</tab_label>
    <tab_order>1</tab_order>
  </WHEREAMIUSED>
  <WHEREAMIUSED>
    <page>qualify_doc.php</page>
    <nature>tab</nature>
    <tab_label>_FOLDER</tab_label>
    <tab_order>1</tab_order>
  </WHEREAMIUSED>
  <PROCESSINBACKGROUND>
    <page>file_index.php</page>
    <processorder>2</processorder>
    <preprocess>select_folder_result_preprocess.php</preprocess>
    <postprocess>select_folder_result_postprocess.php</postprocess>
  </PROCESSINBACKGROUND>
 </SERVICE>

->details.php of the module indexing_searching :
echo $core_tools->execute_modules_services($_SESSION['modules_services'], 'details.php');

The function execute_modules_services() will execute all the services defined for the script details.php.

Service developement recommendations

The code of the executed script must be call obligatorily before any action upon the function test_service() (or test_admin() if it is a service of administration) to check that the connected user has the right to execute this service.
->hist_doc.php :
test_service('view_history');

Menu service type

If you declare a service of the menu type, the id of this service must be equal to the id of this service in the file of declaration of the elements of the menu (module_id/xml/menu.xml).

Use of collections and views

The views (there is one view per collection) are used to avoid making joints on several tables at the time of a SQL SELECT request when you are looking for a resource.

You can use these functions of the class security to use collections :

retrieve_insert_collections() : returns in an array the list of available collections
retrieve_user_insert_coll() : returns in an array the list of available collections for an user
collection_user_right() : returns true if the user can do the action on a collection
get_where_clause_from_view() : returns the where clause of a view

You have to use the session variable $_SESSION['collection_choice'] to know the view to use.

NB : the actions of modification, suppression and insertion are not services because specifics to the collections.

Development recommendations for a Maarch PHP script

In order you have to...

Call of classes

To call a core class, use the session variable : $_SESSION['pathtocoreclass'].
To call a business class, use the session variable : $_SESSION['businessapppath'].

require_once($_SESSION['pathtocoreclass']."class_functions.php");
require_once($_SESSION['pathtocoreclass']."class_db.php");
require_once($_SESSION['pathtocoreclass']."class_request.php");
require_once($_SESSION['pathtocoreclass']."class_core_tools.php");
require_once($_SESSION['config']['businessapppath']."class".$_SESSION['slash_env']."class_list_show.php");
require_once("class/class_admin_workflow.php");

Location bar

Use this example code, to add the current page in the Maarch location bar :
/****************Management of the location bar ************/
$init = false;
if($_REQUEST['reinit'] == "true")
{
$init = true;
}
$level = "";
if($_REQUEST['level'] == 2 || $_REQUEST['level'] == 3 || $_REQUEST['level'] == 4 || $_REQUEST['level'] == 1)
{
$level = $_REQUEST['level'];
}
$page_path = $_SESSION['config']['businessappurl'].'index.php?page=list_workflows&module=workflows';
$page_label = _WORKFLOWS_LIST;
$page_id = "list_workflows";
$admin->manage_location_bar($page_path, $page_label, $page_id, $init, $level);
/***********************************************************/

Case of popup

If the page that you create is a popup, you must add the following example script with the loading of the page :

<?
$time = $core_tools->get_session_time_expire();
?>
<body id="validation_page" onLoad="setTimeout(window.close, <? echo $time;?>*60*1000);">

General development recommendations

Naming of PHP files

Names of the files that you created must correspond to the following nomenclature :

  • frame : frame_name_of_the_script.php
  • popup : popup_name_of_the_script.php

Naming of images

The names of images in Maarch must be in English and correspond to the image.
The names of images must be also prefixed by the trigram of the id of the module.

Example :
image of the folder module : fol_search_folder.gif

The format of the images must be GIF.

Naming of css id

The names of css id in Maarch must be in English and correspond to the HTML code.
The names of css id must be also prefixed by the trigram of the id of the module.

Example :
css id of the folder module : fol_view_folder.on

Management of languages and naming of constants

We recommend to avoid using the quotes in the language files.
You must use in the place of the quotes the character & acute;

The name of language constants must be single !

Management of the posting variables

You must use the function show_string_db() of the class class_functions.php before posting a character string coming from the database.

In the same way, you must use the function protect_string_db() of the class class_functions.php before inserting a character string in the database.

Links between pages and modules

$_SESSION['pathtocoreclass'] : use this session variable to call a class/script of the core.
Example :
require_once($_SESSION['pathtocoreclass']."class_functions.php");

$_SESSION['pathtomodules'] : use this session variable to call a class/script of a module.
Example :
require_once($_SESSION['pathtomodules']."folder".$_SESSION['slash_env']."class".$_SESSION['slash_env']."class_modules_tools.php");

$_SESSION['businessapppath'] : use this session variable to call a class/script of a business application.
Example :
require_once($_SESSION['config']['businessapppath']."class".$_SESSION['slash_env']."class_business_app_tools.php");

$_SESSION['urltomodules'] : use this session variable to call a class/script of a module.
You can use this variable for a src frame or the action of a form.
Example :
require_once($_SESSION['config']['businessapppath']."class".$_SESSION['slash_env']."class_business_app_tools.php");

To create an hypertext link with another page, you must add in the url parameter the page and the module name.
Example :
<a href='index.php?page=search_adv&module=indexing_searching'>link test</a>

UTF-8

In the files of configuration XML you must use the language variables to avoid putting special characters (accents, quotes…).

Example :
<label>_THE_LABEL</label>

Private functions in classes

Put in private the functions used only in the class

Useful sessions variables of Maarch v3 framework

$_SESSION['config']

Contains all the basics parameters of the core and the business application :

  • connection info to the database
  • path to the core and business application

$_SESSION['tablename']

Contains all the tables declared in the core, the business application and the modules loaded.

$_SESSION['collections']

Contains all the collections declared in the business application :

  • id of the collection
  • label of the collection
  • table of the collection
  • view of the collection

$_SESSION['history']

Contains all the events recorded in the history of Maarch.

$_SESSION['history_keywords']

Contains all keywords of the events recorded in the history of Maarch.

$_SESSION['modules']

Contains all the modules declared in the business application.

$_SESSION['modules_loaded']

Contains all the modules declared in the business application and theirs parameters :

  • name of the module
  • path of the module
  • comment of the module
  • fileprefix of the module
  • is the module loaded

$_SESSION['app_services']

Contains all the services declared in the business application and theirs parameters :

  • id of the service
  • name of the service
  • comment of the service
  • script of the service
  • type of the service
  • where the service will be used and how

$_SESSION['modules_services']

Contains all the services declared in the modules and theirs parameters :

  • id of the service
  • name of the service
  • comment of the service
  • script of the service
  • type of the service
  • where the service will be used and how

$_SESSION['user']

Contains all the security informations of the user connected :

  • civility of the user
  • groups of the user
  • where clauses of the user

$_SESSION['trees']

Contains all the parameters of the autofoldering batch.

$_SESSION['basket_page']

Contains all the parameters of the basket module.

$_SESSION['index']

Contains all the parameters of the indexing_searching module.

$_SESSION['folder_index']

Contains all the parameters of the folder module.

$_SESSION['enabled_services']

Contains all the services loaded in the business application.

$_SESSION['menu']

Contains all the parameters of the general Maarch menu :

  • id of elements menu
  • label of elements menu
  • link of elements menu
  • css id of elements menu

$_SESSION['location_bar']

Contains all the parameters of the general Maarch location bar :

  • level of the location
  • path of the location
  • id of the location

Customizing Indexing & Searching module

The Maarch Framework v3 sample application has been written to illustrate Maarch potential. From the sample application, you can make your own document management application, provided that you create your own application directory and scripts, and that update Indexing & Searching module.

This diagram illustrates what's happening when indexing a new resource inside the sample : Index file syn.png

This diagram illustrates what's happening during a search inside the sample : Search adv syn.png

Language