We need a real framework to make GLPI easier to maintain and extend.

We need to know where we want to go in order to migrate slowly to such a structure.

Example : see https://dev.indepnet.net/glpi/browser/branches/0.72-mvc

Steps to clean actual structure :
  • Auto include : all functions in classes
  • Rename clases like tables
  • A single param for each functions : an array which must be checked
  • Actions must be named action (simply 'a') not update / add / delete / purge :
  • Clean front : merge form and search / do it with a switch -> one object / one controller
  • Add controller name in URL with name : c -> glpi.php for simple front router
  • Makes tabs in form with ajax -> forms can be associated to a single view

Now, we have a beginning of a MVC structure :
  • pages in front corresponding to controllers
  • CommonDBTM is a global management class which contains parts of model, view and controller.

We need to make a simple prototype describing destination structure.

First step may be to migrate to a MC model : View included in Controller

Meta Controller : launch specific controller based on $_REQUEST['module']

Controller : example of migration of computer.form.php and computer.php

// Computer_Controller extends Common_Controller
// Controller make checks on rights to do an action
$computer_controller=new Computer_Controller();

// Action send as $_REQUEST['action']

// $_REQUEST['action'] may be list (computer.php), view, add, delete, add_document, add_device...

Controller Class :


Model Class :