Oryxgen is a RAD (Rapid Application Development) for XOOPS module. It uses a database as input and creates a XOOPS Module application that maps the data in database within to a Web interface.
There is 5 concepts (class/DB table) in this generator :
Module, classes, attributes, states and actions. This meta model (store in database by the web interface) is used to generate software applications (module). Some meta data corresponds to data about tables and table colonnes, another data models the behavior of the future generated module.
It there also a logic based on the
states of the objects. States can be used to modelling our application behaviour and build our software applications
Each class (corrresponding to a table) have can have
- static attributes (correspoding to a collone)
- static actions (the classes actions)
In addition you can (but it's not obligatory) define
- states witch can have it's owns attributes and it's owns actions.
For example in the oryxgen interface
- when you edit an "module" object, there is a "IS_REP_OK" state (is the modules repository generated ?). If true you have the capabilitie to generate programs, if not the actions aren't show on the end user interface .
- when you edit an "attributes" object, there is several states depend on the attributes type. If you change the state by changing the attribute type (for example _TEXT to _FOREIGN_KEY), the list of updating attributes are changing.
Module :
--------
A module is the base of the system. You can generate all file starting from this entity.
Module have this folowing attribute :
Short name : used to prefix the "module" constant present in the /language repersitory.
Version : The version of the module -> see xoops_version
Default starting class : The index with is show for first time to the end user. You can change it on the preference module.
Modules have 1-n
classes. Without class you can only generated a default structure.
Classe :
--------
Each class start from a database table. You must have create a database table before define this entity. In the web interface you must choose a table present in a combo with is display all table present in database. Once you have create your class the "refresh" action is automatically execute to import the attributes class (rows of the database table). The default value are defined and you must persolalize it.
You must define
Short name : used to prefix the "class" constant present in the /language repersitory.
primary key : the selected table must have a single primary key defined in auto increment.
For administrator only : true if you want to limit access to admin profile.
In The generated bloc : true if you want to see access to this class stating from the generated block,
Classes have Attributes, actions to do and state.
You can generate class file or language file starting from this entity.
Attributes :
---------
Each row of the database table must have a oryxgen attribute. You can synchronize database by using the "refresh" action.
For each attributs you can define the folowing properties :
Type : condition generated type HTML. For the "_FOREIGN_KEY" type you must define a foreign class (define in the current modules) and his foreign key used by the joint
Weight : Give the position attribute in the form. More the weight is the great more attributee will be high in the form
Size : the html size
Default value : the default value stored in database if the value of attributes is not informed by the end user.
Obligatory : if true, a javascript control is perform to control its presence.
In the create object form : the attribute will be in the created formular. Among all the attributes of a class, there must be at least a boolean with truth.
In the update object form : the attribute will be in the updated fomular. Among all the attributes of a class, there must be at least a boolean with truth.
Possibility of updating in the list : if the classe is owned by an other. You can update it in a list. If true, this attribute will in this list and will be updating. Among all the attributes of a class, there must be at least a boolean with truth.
Take part in the object description : if true, the value of this attribute will be to add to the list of the attributes describing the object. Among all the attributes of a class, there must be at least a boolean with truth.
Take part in the unicity controle : You can controle the unicity of a entity regards to the composition of several attributes. If true, the value of this attribute will be to add to the list of the attributes making it possible to check the unicity of the object. Among all the attributes of a class, there must be at least a boolean with truth.
Help : You can have a contextual "help" on each attributes to help end user. If true, a help icone appear near the libelle and you must override the global named "MyATTIBUT_HELP" in the corresponding language file.
Is a search attribute : For each class you have a search tools. If true, this attribut will be a seach criteria.
Tray name attribute : To group attributes
Html extra adding : Html extra code to add in the tag.
States :
-------
States indicate the state of an object at the present moment.
A oryxgen state is :
Criterias : it is described by a condition that would need to be in the state. You can be described it directly with classe attributes criteria or you can speficied a php variable name. If you choose a php variable name, you must code your state as a boolean in the file /personalize/myClass/criteria_MyClass.inc.php and add on the $states variable. A steleton is generated.
For example in the \modules\oryxgen\personalize\xg_class\criteria_xg_class.inc.php i have code 2 states : "IS_REP_OK" to indicate if there is a repository and "WITH_ATTRIBUTES" to indicate if there is attributes attached to the classe.
For the end user, the states are show on the formular head.
Attributes : This attributes are usable for the end user only if an object is curently in the state (i.e. check the condition that would need to be in the state).
Actions : idem states attributes.
Actions :
-------
Actions can be defines for a class (classe action) and a state (state action). If you add a action you must code it in a special class : \modules\MyModule\personalize\MyClass\action_MyClass.php in the function of the same name :
In this classe, you can use the following variable
- $this->getobject() to manipulate the current object
- $this->getobjectId() to manipulate the current id, needed when the object is new
- $this->setforward_url($forward_url) to set the next url called
- $this->setMsg(MyMsg) to set the message print after action
- $this->addError(MyMsg) to add message error
You can also code a before
For a "MyAction" you can code a "MyAction_before" witch is executed before executing the MyAction and a "MyAction_after".
Once you have defined your meta data, you can generate files by using starting from the your module object :
- generate structure
- generate language
- generate xoopsversion
- generateblock
- generate program
You can personalize
- The language file generated in /language repersitory.
- The criteria used (if you have defined state) in the file \modules\MyModule\personalize\MyClass\criteria_MyClass.php
- The code action (if you have defined action) in the file \modules\MyModule\personalize\MyClass\action_MyClass.php
- you can add information in xoops_version.inc.php witch is include in xoops_version.php
Hope this informations can help us to generate simple module.
Kiang, a new version corrects the faults of language. There no more "xg_st_xg_statut_criteria"
http://www.oryxvet.com/dev/modules/mydownloads/singlefile.php?cid=4&lid=9