[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
[Code source] [Imprimer] [Statistiques]
(pas de description)
Poids: | 958 lignes (34 kb) |
Inclus ou requis: | 2 fois |
Référencé: | 0 fois |
Nécessite: | 1 fichier etemplate/inc/class.soetemplate.inc.php |
boetemplate:: (38 méthodes):
boetemplate()
check_disabled()
expand_name()
autorepeat_idx()
appsession_id()
save_appsession()
get_appsession()
php4_session_garbage_collection()
get_cell_attribute()
set_cell_attribute()
disable_cells()
set_row_attributes()
disable_row()
set_column_attributes()
disable_column()
loadExtension()
haveExtension()
extensionPreProcess()
extensionPostProcess()
extensionRender()
isset_array()
set_array()
get_array()
unset_array()
complete_array_merge()
get_widget_by_path()
get_widget_by_name()
cache_name()
store_in_cache()
delete_in_cache()
in_cache()
read_from_cache()
read()
save()
delete()
set_cell_attribute_helper()
get_widget_by_name_helper()
get_widget_by_path_helper()
Classe: boetemplate - X-Ref
Business Object for eTemplates, extending the Storage Objectboetemplate($name='',$load_via='') X-Ref |
constructor of class Calls the constructor of soetemplate param: string/array $name name of etemplate or array with name and other keys param: string/array $load_via name or array with keys of other etemplate to load in order to get $name |
check_disabled($disabled,$content) X-Ref |
checks if a grid row or column is disabled Expression: [!][@]val[=[@]check] Parts in square brackets are optional, a ! negates the expression, @val evaluates to $content['val'] if no =check is given all set non-empty and non-zero strings are true (standard php behavior) param: string $disabled expression to check, eg. "!@var" for !$content['var'] param: array $content the content-array in the context of the grid return: boolean true if the row/col is disabled or false if not |
expand_name($name,$c,$row,$c_='',$row_='',$cont='') X-Ref |
allows a few variables (eg. row-number) to be used in field-names This is mainly used for autorepeat, but other use is possible. You need to be aware of the rules PHP uses to expand vars in strings, a name of "Row$row[length]" will expand to 'Row' as $row is scalar, you need to use "Row${row}[length]" instead. Only one indirection is allowd in a string by php !!! Out of that reason we have now the variable $row_cont, which is $cont[$row] too. Attention !!! Using only number as index in field-names causes a lot trouble, as depending on the variable type (which php determines itself) you used filling and later accessing the array it can by the index or the key of an array element. To make it short and clear, use "Row$row" or "$col$row" not "$row" or "$row$col" !!! param: sring $name the name to expand param: int $c is the column index starting with 0 (if you have row-headers, data-cells start at 1) param: int $row is the row number starting with 0 (if you have col-headers, data-cells start at 1) param: int $c_ is the value of the previous template-inclusion, param: int $row_ is the value of the previous template-inclusion, param: array $cont content of the template, you might use it to generate button-names with id values in it: return: string the expanded name |
autorepeat_idx($cell,$c,$r,&$idx,&$idx_cname,$check_col=False) X-Ref |
Checks if we have an row- or column autorepeat and sets the indexes for $content, etc. Autorepeat is important to allow a variable numer of rows or cols, eg. for a list. The eTemplate has only one (have to be the last) row or column, which gets automaticaly repeated as long as content is availible. To check this the content has to be in an sub-array of content. The index / subscript into content is determined by the content of size for templates or name for regular fields. An autorepeat is defined by an index which contains variables to expand. (vor variable expansion in names see expand_names). Usually I use the keys $row: 0, 1, 2, 3, ... for only rows, $col: '@', 'A', 'B', 'C', ... for only cols or $col$row: '@0','A0',... '@1','A1','B1',... '@2','A2','B2',... for both rows and cells. In general everything expand_names can generate is ok - see there. As you usually have col- and row-headers, data-cells start with '1' or 'A' !!! param: array $cell with data of cell: name, type, size, ... param: int $c,$r col/row index starting from 0 param: string &$idx returns the index in $content and $readonlys (NOT $sel_options !!!) param: string &$idx_cname returns the basename for the form-name: is $idx if only one value param: boolean $check_col to check for col- or row-autorepeat return: boolean true if cell is autorepeat (has index with vars / '$') or false otherwise |
appsession_id() X-Ref |
creates a new appsession-id via microtime() |
save_appsession($data,$id='') X-Ref |
saves content,readonlys,template-keys, ... via the appsession function As a user may open several windows with the same content/template wie generate a location-id from microtime which is used as location for appsession to descriminate between the different windows. This location-id is then saved as a hidden-var in the form. The above mentions session-id has nothing to do / is different from the session-id which is constant for all windows opened in one session. param: array $data the data to save param: string $id the id to use or '' to generate a new id return: string location-id |
get_appsession($id) X-Ref |
gets content,readonlys,template-keys, ... back from the appsession function param: string $id the location-id return: array with session-data |
php4_session_garbage_collection($id_used='') X-Ref |
a little bit of garbage collection for php4 sessions (their size is limited by memory_limit) With constant eTemplate use it can grow quite big and lead to unusable sessions (php terminates before any output with "Allowed memory size of ... exhausted"). We delete now sessions once used after 10min and sessions never or multiple used after 60min. param: string $id_used id of session just read by get_appsession to increment the usage counter |
get_cell_attribute($name,$attr) X-Ref |
gets an attribute in a named cell param: string $name cell-name param: string $attr attribute-name return: mixed the attribute or False if named cell not found |
set_cell_attribute($name,$attr,$val) X-Ref |
set an attribute in a named cell if val is not NULL else return the attribute param: string $name cell-name param: string $attr attribute-name param: mixed $val if not NULL sets attribute else returns it return: mixed number of changed cells or False, if none changed |
disable_cells($name,$disabled=True) X-Ref |
disables all cells with name == $name param: sting $name cell-name param: boolean $disabled=true disable or enable a cell, default true=disable return: mixed number of changed cells or False, if none changed |
set_row_attributes($n,$height=0,$class=0,$valign=0,$disabled=0) X-Ref |
set one or more attibutes for row $n param: int $n numerical row-number starting with 1 (!) param: string $height percent or pixel or '' for no height param: string $class name of css class (without the leading '.') or '' for no class param: string $valign alignment (top,middle,bottom) or '' for none param: boolean $disabled True or expression or False to disable or enable the row (Only the number 0 means dont change the attribute !!!) |
disable_row($n,$enable=False) X-Ref |
disables row $n param: int $n numerical row-number starting with 1 (!) param: boolean $enable=false can be used to re-enable a row if set to True |
set_column_attributes($c,$width=0,$disabled=0) X-Ref |
set one or more attibutes for column $c param: int/string $c numerical column-number starting with 0 (!), or the char-code starting with 'A' param: string $width percent or pixel or '' for no height param: mixed $disabled=0 True or expression or False to disable or enable the column (Only the number 0 means dont change the attribute !!!) |
disable_column($c,$enable=False) X-Ref |
disables column $c param: int/string $c numerical column-number starting with 0 (!), or the char-code starting with 'A' param: boolean $enable can be used to re-enable a column if set to True |
loadExtension($type) X-Ref |
trys to load the Extension / Widget-class from the app or etemplate param: string $name name of the extension, the classname should be class.${name}_widget.inc.php return: string/boolean human readable name or false if not found/loadable |
haveExtension($type,$function='') X-Ref |
checks if extension is loaded (load it if it isnt) and optional checks if it has a given method param: string $name name of the extension, the classname should be class.${name}_widget.inc.php param: string $function 'pre_process', 'post_process' or 'render' return: boolean true if the extension (incl. method) exists, else false |
extensionPreProcess($type,$name,&$value,&$cell,&$readonlys) X-Ref |
executes the pre_process-function of the extension $cell[type] param: string $type type of the extension param: string $name form-name of this widget/field (used as a unique index into extension_data) param: mixed &$value value of the extensions content(-array) param: array &$cell table-cell on which the extension operates param: array &$readonlys value of the extensions readonly-setting(-array) return: mixed the return-value of the extensions preprocess function |
extensionPostProcess($type,$name,&$value,$value_in) X-Ref |
executes the post_process-function of the extension $cell[type] param: string $type name of the extension param: string $name form-name of this widget/field (used as a unique index into extension_data) param: mixed &$value returns the value of the extensions content(-array) param: mixed $value_in unprocessed value, eg. as posted by the browser return: boolean True if a value should be returned (default for no postprocess fkt.), else False |
extensionRender($type,$name,&$value,&$cell,$readonly) X-Ref |
executes the render-function of the extension $cell[type] param: string $type name of the extension param: string $name form-name of this widget/field (used as a unique index into extension_data) param: mixed &$value value of the extensions content(-array) param: array &$cell table-cell on which the extension operates param: array &$readonlys value of the extensions readonly-setting(-array) return: mixed return-value of the render function |
isset_array($arr,$idx) X-Ref |
checks if $idx is set in array $arr for one level of subindes identical to isset($arr[$idx]) param: array $arr array to check param: string $idx may contain multiple subindex (eg.'x[y][z]') return: boolean true if set, else false |
set_array(&$arr,$idx,$val) X-Ref |
sets $arr[$idx] = $val This works for non-trival indexes like 'a[b][c]' too: $arr['a']['b']['c'] = $val; param: array &$arr the array to search param: string $idx the index, may contain sub-indices like a[b], see example below param: mixed $val value to set |
get_array(&$arr,$idx,$reference_into=False) X-Ref |
return a reference to $arr[$idx] This works for non-trival indexes like 'a[b][c]' too: it returns &$arr[a][b][c] $sub = get_array($arr,'a[b]'); $sub = 'c'; is equivalent to $arr['a']['b'] = 'c'; param: array $arr the array to search, referenz as a referenz gets returned param: string $idx the index, may contain sub-indices like a[b], see example below param: boolean $reference_into default False, if True none-existing sub-arrays/-indices get created to be returned as referenz, else False is returned return: mixed reference to $arr[$idx] or false if $idx is not set and not $reference_into |
unset_array(&$arr,$idx) X-Ref |
unsets $arr[$idx] This works for non-trival indexes like 'a[b][c]' too unset_array($arr,'a[b]'); is equivalent to unset($arr['a']['b']); param: array $arr the array to search, referenz as a referenz gets returned param: string $idx the index, may contain sub-indices like a[b], see example below |
complete_array_merge($old,$new) X-Ref |
merges $old and $new, content of $new has precedence over $old THIS IS NOT THE SAME AS PHP4's functions: - array_merge, as it calls itself recursive for values which are arrays. - array_merge_recursive accumulates values with the same index and $new does NOT overwrite $old param: array $old param: array $new return: array the merged array |
get_widget_by_path($path,$ancestor=0) X-Ref |
returns a reference to a widget in the widget's children tree spezified by a path The path get's generated by the widget_tree_walk() methode and consists of the keys of the children arrays. For the 3. Column in the 2. row of a grid which is the only widget in the children-tree it is eg.: "/0/2C" param: string $path path in the widget tree param: int $ancestor=0 0: widget itself, 1: parent, 2: grand-parent, ... return: array referenz to the widget spezified or null, if it's not found |
get_widget_by_name($name) X-Ref |
returns a reference to a widget in the widget's children tree spezified it's name It returns the first match! param: string $name name of the widget return: array referenz to the widget spezified or null, if it's not found |
cache_name($name='',$template='default',$lang='default') X-Ref |
generated a file-name from an eTemplates, name, template(-set) and lang param: string/array $name name of template or array('name'=>$name,'template'=>$template,'lang'=>$lang) param: string $template template-set param: string $lang language to use return: string |
store_in_cache() X-Ref |
stores the etemplate in the cache in phpgw_info |
delete_in_cache() X-Ref |
deletes the etemplate in the cache in phpgw_info |
in_cache($name,$template='default',$lang='default',$group=0,$version='') X-Ref |
Pas de description |
read_from_cache($name,$template='default',$lang='default',$group=0,$version='') X-Ref |
Pas de description |
read($name,$template='default',$lang='default',$group=0,$version='',$load_via='') X-Ref |
reads an eTemplate from the cache or database / filesystem (and updates the cache) reimplementation of soetemplate::read to use and/or update the cache param: string $name name of the eTemplate or array with the values for all keys param: string $template template-set, '' loads the prefered template of the user, 'default' loads the default one '' in the db param: string $lang language, '' loads the pref. lang of the user, 'default' loads the default one '' in the db param: int $group id of the (primary) group of the user or 0 for none, not used at the moment !!! param: string $version version of the eTemplate param: mixed $load_via name/array of keys of etemplate to load in order to get $name (only as second try!) return: boolean True if a fitting template is found, else False |
save($name='',$template='.',$lang='.',$group=0,$version='.') X-Ref |
saves eTemplate-object to db and update the cache reimplementation of soetemplate::save to update the cache param: string $name name of the eTemplate or array with the values for all keys param: string $template template-set or '' for the default one param: string $lang language or '' for the default one param: int $group id of the (primary) group of the user or 0 for none, not used at the moment !!! param: string $version version of the eTemplate return: the number of affected rows, 1 should be ok, 0 somethings wrong |
delete() X-Ref |
Deletes the eTemplate from the db, object itself is unchanged reimplementation of soetemplate::delete to update the cache return: int number of affected rows, 1 should be ok, 0 somethings wrong |
set_cell_attribute_helper(&$widget,&$extra) X-Ref |
Pas de description |
get_widget_by_name_helper(&$widget,$extra) X-Ref |
Pas de description |
get_widget_by_path_helper(&$widget,$extra,$path) X-Ref |
Pas de description |
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |