[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/etemplate/inc/ -> class.uietemplate.inc.php (sommaire)

(pas de description)

Poids: 1816 lignes (72 kb)
Inclus ou requis: 5 fois
Référencé: 0 fois
Nécessite: 1 fichier
 etemplate/inc/class.boetemplate.inc.php

Définit 1 class

etemplate:: (14 méthodes):
  etemplate()
  location()
  exec()
  validation_errors()
  process_exec()
  process_values2url()
  show()
  show_grid()
  form_name()
  show_cell()
  array_stripslashes()
  process_show()
  java_script()
  include_java_script()


Classe: etemplate  - X-Ref

creates dialogs / HTML-forms from eTemplate descriptions

Usage example:
<code>
$tmpl =& CreateObject('etemplate.etemplate','app.template.name');
$tmpl->exec('app.class.callback',$content_to_show);
</code>
This creates a form from the eTemplate 'app.template.name' and takes care that
the method / public function 'callback' in class 'class' of 'app' gets called
if the user submits the form. For the complete param's see the description of exec.

etemplate or uietemplate extends boetemplate, all vars and public functions are inherited

etemplate($name='',$load_via='')   X-Ref
constructor of etemplate class, reads an eTemplate if $name is given

param: string $name of etemplate or array with name and other keys
param: string/array $load_via with keys of other etemplate to load in order to get $name

location($params='')   X-Ref
Abstracts a html-location-header call

In other UI's than html this needs to call the methode, defined by menuaction or
open a browser-window for any other links.

param: string/array $params url or array with get-params incl. menuaction

exec($method,$content,$sel_options='',$readonlys='',$preserv='',$output_mode=0,$ignore_validation='',$changes='')   X-Ref
Generats a Dialog from an eTemplate - abstract the UI-layer

This is the only function an application should use, all other are INTERNAL and
do NOT abstract the UI-layer, because they return HTML.
Generates a webpage with a form from the template and puts process_exec in the
form as submit-url to call process_show for the template before it
ExecuteMethod's the given $method of the caller.

param: string $method Methode (e.g. 'etemplate.editor.edit') to be called if form is submitted
param: array $content with content to fill the input-fields of template, eg. the text-field
param: $sel_options array or arrays with the options for each select-field, keys are the
param: array $readonlys with field-names as keys for fields with should be readonly
param: array $preserv with vars which should be transported to the $method-call (eg. an id) array('id' => $id) sets $_POST['id'] for the $method-call
param: int $output_mode 0 = echo incl. navbar, 1 = return html, 2 = echo without navbar (eg. for popups)
param: string $ignore_validation if not empty regular expression for validation-errors to ignore
param: array $changes change made in the last call if looping, only used internaly by process_exec
return: string html for $output_mode == 1, else nothing

validation_errors($ignore_validation,$cname='exec')   X-Ref
Check if we have not ignored validation errors

param: string $ignore_validation if not empty regular expression for validation-errors to ignore
param: string $cname name-prefix, which need to be ignored
return: boolean true if there are not ignored validation errors, false otherwise

process_exec()   X-Ref
Makes the necessary adjustments to _POST before it calls the app's method

This function is only to submit forms to, create with exec.
All eTemplates / forms executed with exec are submited to this function
via /etemplate/process_exec.php?menuaction=<callback>. We cant use the global index.php as
it would set some constants to etemplate instead of the calling app.
process_exec then calls process_show for the eTemplate (to adjust the content of the _POST) and
ExecMethod's the given callback from the app with the content of the form as first argument.

return: mixed false if no sessiondata and $this->sitemgr, else the returnvalue of exec of the method-calls

process_values2url()   X-Ref
process the values transfered with the javascript function values2url

The returned array contains the preserved values overwritten (only!) with the variables named in values2url

return: array/boolean content array or false on error

show($content,$sel_options='',$readonlys='',$cname='',$show_c=0,$show_row=0)   X-Ref
creates HTML from an eTemplate

This is done by calling show_cell for each cell in the form. show_cell itself
calls show recursivly for each included eTemplate.
You could use it in the UI-layer of an app, just make shure to call process_show !!!
This is intended as internal function and should NOT be called by new app's direct,
as it deals with HTML and is so UI-dependent, use exec instead.

param: array $content with content for the cells, keys are the names given in the cells/form elements
param: array $sel_options with options for the selectboxes, keys are the name of the selectbox
param: array $readonlys with names of cells/form-elements to be not allowed to change
param: string $cname basename of names for form-elements, means index in $_POST
param: string $show_c name/index for name expansion
param: string $show_row name/index for name expansion
return: string the generated HTML

show_grid(&$grid,$content,$readonlys='',$cname='',$show_c=0,$show_row=0,$path='')   X-Ref
creates HTML from an eTemplate

This is done by calling show_cell for each cell in the form. show_cell itself
calls show recursivly for each included eTemplate.
You can use it in the UI-layer of an app, just make shure to call process_show !!!
This is intended as internal function and should NOT be called by new app's direct,
as it deals with HTML and is so UI-dependent, use exec instead.

param: array $grid representing a grid
param: array $content with content for the cells, keys are the names given in the cells/form elements
param: array $readonlys with names of cells/form-elements to be not allowed to change
param: string $cname basename of names for form-elements, means index in $_POST
param: string $show_c name/index for name expansion
param: string $show_row name/index for name expansion
param: string $path path in the widget tree
return: string the generated HTML

form_name($cname,$name)   X-Ref
build the name of a form-element from a basename and name

name and basename can contain sub-indices in square bracets, eg. basename="base[basesub1][basesub2]"
and name = "name[sub]" gives "base[basesub1][basesub2][name][sub]"

param: string $cname basename
param: string $name name
return: string complete form-name

show_cell($cell,$content,$readonlys,$cname,$show_c,$show_row,&$span,&$class,$path='')   X-Ref
generates HTML for one widget (input-field / cell)

calls show to generate included eTemplates. Again only an INTERMAL function.

param: array $cell with data of the cell: name, type, ...
param: array $content with content for the cells, keys are the names given in the cells/form elements
param: array $readonlys with names of cells/form-elements to be not allowed to change
param: string $cname basename of names for form-elements, means index in $_POST
param: string $show_c name/index for name expansion
param: string $show_row name/index for name expansion
param: string &$span on return number of cells to span or 'all' for the rest (only used for grids)
param: string &$class on return the css class of the cell, to be set in the <td> tag
param: string $path path in the widget tree
return: string the generated HTML

array_stripslashes($var)   X-Ref
applies stripslashes recursivly on each element of an array

param: array &$var
return: array

process_show(&$content,$to_process,$cname='')   X-Ref
makes necessary adjustments on $_POST after a eTemplate / form gots submitted

This is only an internal function, dont call it direct use only exec
Process_show uses a list of input-fields/widgets generated by show.

param: array $content $_POST[$cname], on return the adjusted content
param: array $to_process list of widgets/form-fields to process
param: string $cname basename of our returnt content (same as in call to show)
return: int number of validation errors (the adjusted content is returned by the var-param &$content !)

java_script($consider_not_tested_as_enabled = True)   X-Ref
is javascript enabled?

this should be tested by the api at login

return: boolean true if javascript is enabled or not yet tested and $consider_not_tested_as_enabled

include_java_script($what = 3)   X-Ref
returns the javascript to be included by exec

param: int $what &1 = returns the test, note: has to be included in the body, not the header,
return: string javascript



Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7