xuServer  4.2
xuServer est un Framework ORM écrit en PHP pour des bases de données MySQL.
Public Member Functions | Protected Member Functions | Private Member Functions
xsComponent Class Reference

This Class holds the Client Interface Common functionalities. More...

Inheritance diagram for xsComponent:
xsModel xsConcept xsClass xsCollection xsProperty

Public Member Functions

 addButton ($name="name", $value="", $label="__label", $CRUD="1111")
 
 addMethod ($name="name", $label="label", $container="xs-fn-footer")
 
 _form ($method="")
 builds and returns the html code for object formular More...
 
 _formCreate ()
 
 _formRead ()
 
 _formUpdate ()
 
 _formDelete ()
 
 _logo ($height="35")
 
 _icon ()
 
 _list_group_item ()
 
 _thumbnail ()
 
 _table ($sql="")
 
- Public Member Functions inherited from xsModel
 init ()
 
 load ($id="")
 
 build ($mci="", $debug=false)
 
 sql ($criteria="__NOTHING__")
 
 sql_create ()
 
 sql_read ()
 
 sql_update ()
 
 sql_delete ()
 
 sql_copy ()
 
 sql_each ()
 
 sql_stats ()
 
 sql_search ($term="")
 
 stats ($pFunc="")
 
 count ()
 
 sum ()
 
 min ()
 
 max ()
 
 avg ()
 
 percent ()
 
 every ()
 
 any ()
 
 CRUD ($CRUD="")
 
- Public Member Functions inherited from xsConcept
 mciparse ($string="")
 this method parses the given string parameter to determine the module name the concept name and the id of the object More...
 
 privilege ($key="")
 
 foldername ($autocreate=false)
 
 design_readclass ()
 
 design_constructor ()
 

Protected Member Functions

 addProperty ($name="name", $value="", $label="__label", $CRUD="1111")
 
 addCollection ($table, $fk_index)
 
 onMetadata ()
 
 onBeforeMetadata ()
 
 onBuildMethods ()
 
 onInstance ()
 
 onBeforeInstance ()
 
 onInstanceFail ()
 
 onBeforeUpdate ()
 
 onUpdate ()
 
 _fieldset ($ajax=true)
 
 _iconCRUD ($crud="", $class="success")
 
- Protected Member Functions inherited from xsModel
 instance ($stmt, $collections="__NONE__")
 
 build_sql ()
 
 build_collections ($criteria="__NOTHING__")
 
- Protected Member Functions inherited from xsConcept
 mciSet ()
 

Private Member Functions

 addMetaData ($type="VIRTUAL", $name="name", $value="", $label="__label", $CRUD="1111")
 

Additional Inherited Members

- Data Fields inherited from xsModel
 $db_table ="xam_user"
 name of the table in Database that stores class instances More...
 
 $db_index =""
 name of table field that stores the auto_increment primary key More...
 
 $db_title =""
 name of table field that stores the class title if not specified before using xsClass::load(), the second table column is used More...
 
 $is_built =false
 flag to test if object has been build (metadata, methods ...) More...
 
 $title ="__notitle__"
 this property stores the common name given to an instance of the class More...
 
 $name ="__notitle__"
 this property stores : More...
 
 $can_create =1
 can user create concept instance More...
 
 $can_read =1
 can user read concept instance More...
 
 $can_update =1
 can user update concept instance More...
 
 $can_delete =1
 can user delete concept instance More...
 
 $can_search =1
 can user search concept instance More...
 
 $sql_load_alias =Array()
 
- Data Fields inherited from xsConcept
 $mci =""
 identification of the class concatenation of module_concept_dbid More...
 
 $module ="xam"
 name of the module that deals with the object held by xsClass (convention : word before the first "_" in tablename) More...
 
 $concept ="user"
 name of the class beeing held by xsClass. concept is the name of the php class that extends metaclass xsClass More...
 
 $includeFile =""
 path to the business class file if exists More...
 
 $logoPath =""
 path to the logo of current class More...
 
 $privilegeKey =""
 privilege name defined on child classes More...
 
 $db_id =0
 unique identifyer of primary key, instance number of the class More...
 
- Protected Attributes inherited from xsModel
 $sql_statement =""
 last build sql statement : More...
 
 $sql_statement_create =""
 create an instance in db More...
 
 $sql_statement_read =""
 read an instance in db More...
 
 $sql_statement_update =""
 update an instance in db More...
 
 $sql_statement_delete =""
 delete an instance in db More...
 
 $sql_statement_each =""
 sql each stand for selecting objects in db More...
 
 $sql_statement_stats =""
 

Detailed Description

This Class holds the Client Interface Common functionalities.

The functions defined at this abstraction level allow any class child to :

Member Function Documentation

◆ _fieldset()

_fieldset (   $ajax = true)
protected

Properties NO TABS

◆ _form()

_form (   $method = "")

builds and returns the html code for object formular

Parameters
string$methodthe xsMethod launched when submitting the form
Returns
html form
See also
xsProperty, xsClass

USAGE :

Before using this method, you can design the desired FORMULAR using :

  • xsClass and xsProperty form design methods (title, hidden, readonly ...)
  • CRUD values (permission or specific needs) for xsClass and its members (xsProperty, xsMethods ....)

NAMING CONVENTION :

  • End User Methods, are encapsulated in "business classes" that inherit from xsClass. For example :
    class articles extends xsClass{
        function get_article_price(){
        }
    } 
    
  • Business Class Methods which name starts with "_" are ingored (a kind of meta private)
  • End User Methods starting with "get_" become 2step buttons that
    • first GET the desired <form> from the xsMethod treatments
    • then POST the <form> back to the xsMethod (see GET_ example below)
  • End User Methods starting with "post_" become buttons that POST the currently displayed <form>

EXAMPLE TEMPLATE : GET_ NAMED METHOD

function get_article_price(){ if(empty($_POST)){ return $this->_form("get_article_price"); // ... form modification, presentation }else{ $this->val(); // updating object with _POST data $this->update(); // ... some treatments on xsProperties ... then eventually update the objet return $this->_form("get_article_price"); // print the desired form

} }

EXAMPLE TEMPLATE : POST_ NAMED METHOD

function post_article_price(){ $this->val(); // updating object with _POST data $this->update(); // ... some treatments on xsProperties ... then eventually update the objet return $this->_form("get_article_price"); // print the desired form

}

Methods & submit button NO TABS

Methods

Collections

◆ _formCreate()

_formCreate ( )

◆ _formDelete()

_formDelete ( )

◆ _formRead()

_formRead ( )

◆ _formUpdate()

_formUpdate ( )

◆ _icon()

_icon ( )

◆ _iconCRUD()

_iconCRUD (   $crud = "",
  $class = "success" 
)
protected

◆ _list_group_item()

_list_group_item ( )

◆ _logo()

_logo (   $height = "35")

◆ _table()

_table (   $sql = "")

return the table of selected objects

Todo:
test & implement standalone methods xsProperty::_td() and xsProperty::_th()
See also
xsClass::$sql_statement
Returns
html

◆ _thumbnail()

_thumbnail ( )

builds and returns the html code for object thumbnail trick : $optDummy option to reloadd images each time

Returns
string

◆ addButton()

addButton (   $name = "name",
  $value = "",
  $label = "__label",
  $CRUD = "1111" 
)

Define additionnal Button or Field to object formular => use with onMetadata()

Parameters
string$name
string$label
string$jq

◆ addCollection()

addCollection (   $table,
  $fk_index 
)
protected

Méthode chainable given tablename and foreignkyname, this method set a new collection for current metaclass

Parameters
Array$table: name of the table that stores collection metaclass
StringindexKey $fk_index : name of the foreign key in collection metaclass
See also
xsCollection

◆ addMetaData()

addMetaData (   $type = "VIRTUAL",
  $name = "name",
  $value = "",
  $label = "__label",
  $CRUD = "1111" 
)
private

◆ addMethod()

addMethod (   $name = "name",
  $label = "label",
  $container = "xs-fn-footer" 
)

Define additionnal xsMethod

◆ addProperty()

addProperty (   $name = "name",
  $value = "",
  $label = "__label",
  $CRUD = "1111" 
)
protected

Add Meta Filed given its parameters :

Parameters
string$name
string$label
string$CRUD
Returns
xsProperty

◆ onBeforeInstance()

onBeforeInstance ( )
protected

EVENT triggered before instance is build from Database query.

See also
xsClass::load()
xsClass::onMetadata()

◆ onBeforeMetadata()

onBeforeMetadata ( )
protected

EVENT triggered before metadata is built. use it to define tabs structure

See also
xsClass::build_metadata()

◆ onBeforeUpdate()

onBeforeUpdate ( )
protected

◆ onBuildMethods()

onBuildMethods ( )
protected

EVENT triggered when metadata is build code it in child classes to customize properties definition setting type, list, insert, search attributes.

See also
xsClass::build_metadata()

◆ onInstance()

onInstance ( )
protected

EVENT triggered when instance is build from Database query. code it in child classes to customize properties definition setting type, list, insert, search attributes.

See also
xsClass::load()
xsClass::onMetadata()

◆ onInstanceFail()

onInstanceFail ( )
protected

EVENT triggered if no instance is found in Database.

See also
xsClass::load()
xsClass::onMetadata()

◆ onMetadata()

onMetadata ( )
protected

EVENT triggered when metadata is build code it in child classes to customize properties definition setting type, list, insert, search attributes.

See also
xsClass::build_metadata()

◆ onUpdate()

onUpdate ( )
protected