| applications_debedoo

# Class: Bs_Debedoo Source Location: /applications/debedoo/Bs_Debedoo.class.php
### Class Overview
    Bs_Object
       |
       --Bs_Debedoo
Debedoo is the pronounced version of "DB Do", aka "Database do". So Debedoo does something with the database. it makes the content of a db table editable. a bit like phpMyAdmin but in a customized way for that particular table. #### Author(s): andrej arn <andrej at blueshoes dot org, sam blum <sam at blueshoes dot org #### Version: 4.3.$Revision: 1.3 $ $Date: 2003/10/29 17:47:48 $ #### Copyright: blueshoes.org | ### Variables $addHeadString $Bs_Array $Bs_TextUtil $dbName $dbTableName $formName $guiStrings $internalName $overviewSettings $overviewWindroseStyles $persister $persisterID $persisterVarSettings $searchSettings $selfDocument $useLongID $userGroup $_clickOffset $_searchTerm | ### Methods Bs_Debedoo buildUrl doItYourself getHomepage getOverview getSearchForm search setDbByDsn setGetVars setLanguage setPostVars unPersist _addAutoNumbers _cleanOverviewData _debedooTreatAddForm _getHtmlEnd _getHtmlStart _loadForm _treatFormAdd _treatFormView
### Inherited Variables | ### Inherited Methods #### Class: Bs_Object Bs_Object::Bs_Object() Bs_Object::getErrors() Basic error handling: Get *all* errors as string array from the global Bs_Error-error stack. Bs_Object::getLastError() Basic error handling: Get last error string from the global Bs_Error-error stack. Bs_Object::getLastErrors() Basic error handling: Get last errors string array from the global Bs_Error-error stack sinc last call of getLastErrors(). Bs_Object::persist() Persists this object by serializing it and saving it to a file with unique name. Bs_Object::setError() Basic error handling: Push an error string on the global Bs_Error-error stack. Bs_Object::toHtml() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::toString() Dumps the content of this object to a string using PHP's var_dump(). Bs_Object::unpersist() Fetches an object that was persisted with persist()
### Class Details [line 46] Debedoo is the pronounced version of "DB Do", aka "Database do". So Debedoo does something with the database. it makes the content of a db table editable. a bit like phpMyAdmin but in a customized way for that particular table. another name for this class would be DbWrapper. dependencies: Bs_Db, Bs_DbWrapper, Bs_ObjPersisterForMySql, Bs_Form, Bs_HtmlTable, Bs_HtmlTableWindrose, Bs_TextUtil, Bs_LanguageHandler, Bs_Array #### Tags:
version: | 4.3.$Revision: 1.3 $ $Date: 2003/10/29 17:47:48 $
copyright: | blueshoes.org
author: | andrej arn <andrej at blueshoes dot org, sam blum <sam at blueshoes dot org
[ Top ] ### Class Variables #### $addHeadString = [line 247] string that should be added into the head of the output (after the <html> tag). #### Tags:
access: | public
Type: | string
[ Top ] #### $Bs_Array = [line 111] reference to the pseudostatic Bs_Array. #### Tags:
access: | public
Type: | object
[ Top ] #### $Bs_TextUtil = [line 104] reference to the global pseudostatic Bs_TextUtil. #### Tags:
access: | public
Type: | object
[ Top ] #### $dbName = [line 150] the database name. if not given then the current db will be used. #### Tags:
access: | public
Type: | mixed
[ Top ] #### $dbTableName = [line 156] the database table name. #### Tags:
access: | public
Type: | mixed
[ Top ] #### $formName = [line 136] the internal name of the form (as it is persisted). if no form is used or if it cannot be loaded/found then a form will be produced on the fly based on the information that's available (db table structure). that's not as good, misses tons of features, but it's ok. i mean it's not that hard to spit out a textarea html field for a blob db field. #### Tags:
access: | public
Type: | string
[ Top ] #### $guiStrings = [line 325] hash with the gui strings loaded from language files in the constructor. feel free to modify it. but better create your own files. #### Tags:
var: | (hash)
access: | public
Type: | array
[ Top ] #### $internalName = [line 123] the internal unique name of this debedoo object. we need to be able to identify it. maybe you want to use the tablename here, maybe along with the dbname and host somehow. #### Tags:
access: | public
Type: | string
[ Top ] #### $overviewSettings = [line 231] this var is used for the overview data tables. it defines how the overview table will look. you can define different "profiles". one might need that for different user groups or so. examples: $overviewSettings['myProfile'] = array( 'userGroups' => array('admin', 'superman'), 'limit' => 20, 'trim' => 20, ... ); KEY DATATYPE DEFAULT EXAMPLE DESCRIPTION 'userGroups' array (vector) array() array('-all-') the users or groups that may use this profile. the entry '-all-' means 'everyone'. 'limit' int 20 0 the number of records per page. 20 is the default. 0 = no limit. 'trim' int 20 0 the number of chars after which we trim (and attach '...' to the string). 0 = don't trim. 'trimBlob' int 20 100 same as trim but for blobs this time. 'hideID' bool TRUE FALSE whether the ID field should be hidden or not. 'resolveKeys' bool TRUE FALSE whether to resolve foreign keys or not (ID => caption). 'autoNumbers' bool TRUE FALSE whether to add auto-numbers on the left side of the table or not. //'fields' hash, key is the fieldname, value is a hash with the following keys: // 'caption' the caption to use. if not set then the field name will be used. maybe an array (language dependancy) or just a string. // 'trim' (like above) // 'trimBlob' (like above) // 'foreignKey' if it's a foreign key then you can give the fields in the foreign table that should be used in the // view. ideas to implement: makeLinksClickable (email, url, all) emailToLink urlToLink sortable = TRUE pageable = TRUE fieldsToShow alignNumRight align numeric values (depending on db field definition) to the right, like excel. if no profile is given or may be used, the following rules apply: userGroups : everyone fieldsToShow: the first 5 fields that are not blobs. the ID field is omitted. char fields are trimmed at 20 chars and extended with '...'. the caption will be the field name (except if it's a known field name like 'phone' or 'street' or so). #### Tags:
var: | (hash, see above)
todo: | it's not really an overview setting, it's used for everything. rename it? recode stuff? i leave it by now. --andrej
access: | public
Type: | array
[ Top ] #### $overviewWindroseStyles = [line 256] if set then these styles will be applied to the overview table. otherwise a default style will be used. #### Tags:
var: | (hash)
see: | core/Html/Bs_HtmlTableWindrose.class.php
access: | public
Type: | array
[ Top ] #### $persister = NULL [line 55] instance of Bs_ObjPersisterForMySql to persist the settings.
Type: | object
[ Top ] #### $persisterID = [line 62] reserved var for the persister. don't fuck with this. #### Tags:
see: | $this->setPersisterID()
Type: | int
[ Top ] #### $persisterVarSettings = array('internalName' => array('mode'=>'lonely', 'metaType'=>'string', 'index'=>TRUE),'formName'=>array('mode'=>'lonely','metaType'=>'string','index'=>TRUE),'_dbDsn'=>array('mode'=>'stream','crypt'=>TRUE),'dbName'=>array('mode'=>'lonely','metaType'=>'string','index'=>TRUE),'dbTableName'=>array('mode'=>'lonely','metaType'=>'string','index'=>TRUE),'searchSettings'=>array('mode'=>'stream'),'overviewSettings'=>array('mode'=>'stream'),'addHeadString'=>array('mode'=>'stream'),) [line 64]
Type: | mixed
[ Top ] #### $searchSettings = [line 169] sqlQuery ("select * from table where field = %s") fields fieldName = 'firstname' operator = 'AND' compare = '=', 'LIKE', 'LIKE x%', 'LIKE %x', 'LIKE %x%' #### Tags:
todo: | all (not sure if this one gets used at all in the future.)
access: | public
Type: | mixed
[ Top ] #### $selfDocument = [line 300] the document where the links should go to (get, post). this will be set to $_SERVER['PHP_SELF'] in the constructor. feel free to change it. #### Tags:
access: | public
Type: | string
[ Top ] #### $useLongID = FALSE [line 268] normally id's in foreign key tables are called "ID". some ppl like to name them tablenameID, eg "fooID" when the table name is "foo". if you do that, set this var to TRUE. #### Tags:
since: | bs4.5
access: | public
Type: | mixed
[ Top ] #### $userGroup = [line 279] the user or group that currently uses the page. used to determine what may be showed and what may be editable (rights). #### Tags:
access: | public
Type: | string
[ Top ] #### $_clickOffset = 0 [line 363] the offset in case the user is clicking through the result data pages.
Type: | mixed
[ Top ] #### $_searchTerm = [line 358] the search term we got from the user - if any.
Type: | mixed
[ Top ] ### Class Methods ### constructor Bs_Debedoo [line 369]
`Bs_Debedoo Bs_Debedoo( )`
Constructor [ Top ] ### method buildUrl [line 1886]
`string buildUrl( [bool $minimal = FALSE])`
returns the url with querystring params that make sense (db name, click offset etc). #### Tags:
return: | (url)
access: | public
#### Parameters:
bool | $minimal | (default is FALSE. if set to TRUE then most query-params are omitted.)
[ Top ] ### method doItYourself [line 445]
`string doItYourself( )`
#### Tags:
access: | public
[ Top ] ### method getHomepage [line 521]
`string getHomepage( [bool $withHtmlAround = TRUE])`
#### Tags:
return: | (html code)
access: | public
#### Parameters:
bool | $withHtmlAround | (with html start and end tags, default is TRUE.)
[ Top ] ### method getOverview [line 581]
`string getOverview( )`
returns the overview table. #### Tags:
return: | (html output)
throws: | bs_exception
access: | public
[ Top ] ### method getSearchForm [line 559]
`string getSearchForm( )`
returns the search form. #### Tags:
return: | (html output)
access: | public
[ Top ] ### method search [line 1114]
`void search( )`
********************************* overview methods ***************************** [ Top ] ### method setDbByDsn [line 390]
`bool setDbByDsn( array $dsn)`
sets the db object by using a dsn. #### Tags:
return: | (currently TRUE only)
throws: | bs_exception
access: | public
#### Parameters:
array | $dsn | (hash)
[ Top ] ### method setGetVars [line 404]
`void setGetVars( mixed $getVars)`
gets done in the constructor, only do it if needed. #### Tags:
see: | var $_getVars
[ Top ] ### method setLanguage [line 423]
`bool setLanguage( [string $lang = 'en'])`
sets the language and loads the gui strings for it. #### Tags:
return: | (if ANY language has been loaded. may be a fallback language.)
access: | public
#### Parameters:
string | $lang | (default is 'en')
[ Top ] ### method setPostVars [line 412]
`void setPostVars( mixed $postVars)`
gets done in the constructor, only do it if needed. #### Tags:
see: | var $_postVars
[ Top ] ### method unPersist [line 1858]
`void unPersist( [mixed $internalName = NULL])`
********************************* persister ***************************** [ Top ] ### method _addAutoNumbers [line 941]
`void _addAutoNumbers( mixed &$data)`
adds auto-numbers to the overview output array (on the left side). [ Top ] ### method _cleanOverviewData [line 835]
`void _cleanOverviewData( mixed &$data)`
removes unwanted columns from the data array. CAUTION: this method (re)moves the pointer of the array $data back to the start. this is a behavior you would normally not expect from our code. [ Top ] ### method _debedooTreatAddForm [line 1776]
`void _debedooTreatAddForm( )`
********************************* alter methods ***************************** [ Top ] ### method _getHtmlEnd [line 1849]
`void _getHtmlEnd( )`
[ Top ] ### method _getHtmlStart [line 1843]
`void _getHtmlStart( )`
********************************* html methods ***************************** [ Top ] ### method _loadForm [line 1127]
`bool _loadForm( )`
loads the form. #### Tags:
return: | TRUE
throws: | bs_exception
[ Top ] ### method _treatFormAdd [line 1574]
`string _treatFormAdd( )`
treats the form in 'add' mode. #### Tags:
throws: | bs_exception
[ Top ] ### method _treatFormView [line 1748]
`string _treatFormView( )`
treats the form in 'view' mode. #### Tags:
throws: | bs_exception
[ Top ] Documentation generated on Mon, 29 Dec 2003 21:08:49 +0100 by phpDocumentor 1.2.3