PhpLabWare version 0.3 |
functions interfacing with the database
1338 lines [source]
Referenced 8 times
Defines the following functions:
tableinfo($db,$realname=false,$id=false) X-Ref |
No description |
array_key_exists($find,$array) X-Ref |
No description |
getvaluesmenu($db,$selectname,$selected,$tablename,$columnname,$whereclause=false,$jscript=false) X-Ref |
Analogue of adodb GetMenu2, but display referenced values (using getvalues) |
comma_array_sql_where($db,$tablein,$column,$searchfield,$searchval) X-Ref |
SQL where search that returns a comma delimited string |
comma_array_sql($db,$tablein,$column,$where=false) X-Ref |
SQL search (entrire column) that returns a comma delimited string |
sortstring(&$sortdirarray,$sortup,$sortdown) X-Ref |
Update sortdirarray and returns formatted sortdirstring |
tableheader($sortdirarray,$columnname, $columnlabel) X-Ref |
Displays header of 'general' table |
add($db,$table,$fields,$fieldvalues,$USER,$tableid) X-Ref |
Inserts $fields with $fieldvalues into $table Returns the id of inserted record on succes, false otherwise. $fields is a comma separated list with all column names Fieldvalues must be an associative array containing all the $fields to be added. Fields named 'date' are automatically filled with a Unix timestamp |
update_mpulldown($db,$key_table,$recordid,$valueArray) X-Ref |
For multiple choice pulldowns. Deletes entries in key_table for a give record,and then re-inserts the ones present in the array |
modify($db,$table,$fields,$fieldvalues,$id,$USER,$tableid) X-Ref |
Modifies $fields in $table with values $fieldvalues where id=$id Returns true on succes, false on failure Fieldvalues must be an associative array containing all the $fields to be added. If a field is not present in $fieldvalues, it will not be changed. The entry 'id' in $fields will be ignored. Fields lastmodby and lastmoddate will be automatically set |
delete($db, $tableid, $id, $USER, $filesonly=false) X-Ref |
Deletes the entry with id=$id Returns true on succes, false on failure Checks whether the delete is allowed This is very generic, it is likely that you will need to do more cleanup |
process_image($db,$fileid,$bigsize) X-Ref |
Generates thumbnails and extracts information from 2-D image files |
upload_files($db,$tableid,$id,$columnid,$columnname,$USER,$system_settings) X-Ref |
Upload files and enters then into table files files should be called file[] in HTTP_POST_FILES filetitle in HTTP_POST_VARS will be inserted in the title field of table files returns id of last uploaded file upon succes, false otherwise |
get_files($db,$table,$id,$columnid,$format=1,$thumbtype='small') X-Ref |
returns an array with id,name,title,size, and hyperlink to all files associated with the given record |
file_path($db,$fileid) X-Ref |
Returns path to the file |
delete_column_file($db,$tableid,$columnid,$recordid,$USER) X-Ref |
Deletes all file associated with this record,column and table |
delete_file($db,$fileid,$USER) X-Ref |
Deletes file identified with id. Checks 'mother table' whether this is allowed Also deletes entries in index table for this file Returns name of deleted file on succes |
user_array($db) X-Ref |
Returns a 2D array with id and full name of all users called by show_access |
show_access($db,$tableid,$id,$USER,$global_settings) X-Ref |
Prints a table with access rights input is string as 'rw-rw-rw-' names are same as used in get_access |
get_access($fieldvalues,$column) X-Ref |
Returns a formatted access strings given an associative array with 'grr','evr','grw','evw' as keys |
may_read_sql_subselect($db,$table,$tableid,$USER,$clause=false) X-Ref |
Returns an SQL SELECT statement with ids of records the user may see Since it uses subqueries it does not work with MySQL |
make_sql_ids($r,$ids,$field="id") X-Ref |
returns a comma-separated list of quoted values from a SQL search helper function for may_read_SQL |
may_read_sql_join($db,$table,$USER) X-Ref |
Returns an array with ids of records the user may see in SQL format Works with MySQL but not with early postgres 7 versions (current ones should work) |
may_read_sql($db,$tableinfo,$USER,$temptable="tempa") X-Ref |
Generates an SQL query asking for the records that mey be seen by this users Generates a left join for mysql, subselect for postgres |
make_temp_table($db,$temptable,$r) X-Ref |
Generates a temporary table from given recordset |
may_read($db,$tableinfo,$id,$USER) X-Ref |
determines whether or not the user may read this record |
may_write($db,$tableid,$id,$USER) X-Ref |
checks if this user may write/modify/delete these data |
make_sql_csf($r,$ids,$field="id",&$column_count) X-Ref |
returns an comma-separated list of quoted values from a SQL search derived from make_SQL_ids but can be called from anywhere |
typevalue($value,$type) X-Ref |
helperfunction for numerictoSQL |
numerictosql($searchterm,$column,$type,$and) X-Ref |
interprets numerical search terms into an SQL statement implements ranges (i.e. 1-6), and lists (1,2,3) and combinations thereof < and > can also be used |
searchhelp($db,$tableinfo,$column,&$columnvalues,$query,$wcappend,$and) X-Ref |
Helper function for search Interprets fields the right way |
search($db,$tableinfo,$fields,&$fieldvalues,$whereclause=false,$wcappend=true) X-Ref |
Returns an SQL search statement The whereclause should NOT start with WHERE The whereclause should contain the output of may_read_SQL and can also be used for sorting |
first_last_page(&$r,&$current_page,$r_p_p,$numrows) X-Ref |
sets AtFirstPage and AtLastPage |
next_previous_buttons($r,$paging=false,$num_p_r=false,$numrows=false,$pagenr=false,$db=false,$tableinfo=false) X-Ref |
Displays the next and previous buttons $r is the result of a $db->Execute query used to display the table with records When $paging is true, the records per page field will also be displayed $num_p_r holds the (global) records per page variable |
paging($num_p_r,&$USER) X-Ref |
Returns the variable $num_p_r holding the # of records per page check user settings and POST_VARS Write the value back to the user defaults When no value is found, default to 10 |
current_page($curr_page, $sname, $num_p_r, $numrows) X-Ref |
Returns current page current page is table specific, therefore The variable name is formed using the short name for the table |
make_search_sql($db,$tableinfo,$fields,$USER,$search,$searchsort="title",$whereclause=false) X-Ref |
Assembles the search SQL statement and remembers it in HTTP_SESSION_VARS |
may_see_table($db,$USER,$tableid) X-Ref |
Checks whether a user has access to a given table |
Generated: Sun Oct 5 21:17:35 2003 | Generated by PHPXref 0.2 |