|
Umfragen
|
database class, handles all database stuff More...
Public Member Functions | |
| __construct ($dbuser, $dbpass, $dbname, $dbhost) | |
| get_sql_all_assoc ($sql) | |
| makes a databse query and returns an array or results | |
| get_poll_name_from_list ($polls) | |
| gets a mapping array of ID to name of a pollist | |
| get_all_polls_array () | |
| gets an array of all polls | |
| get_all_polls_array_from_status ($stat) | |
| get_poll_infoArray ($pollID) | |
| gets an infoarray for a specific poll | |
| get_poll_result_for_user ($pollID, $username) | |
| gets the pollresult from a user | |
| get_widget_names ($pollID) | |
| gets a list of all widget names from a poll | |
| get_config_array () | |
| gets all config variable stored in the database | |
| count_results ($pollID) | |
| simple result count | |
| get_schedule_widget_data ($widget) | |
| gets a list of data for the schedule widget | |
| export_to_csv (poll $poll, $delimiter, $enclosure, $download=true) | |
| exports results to csv | |
| export_result ($pollID, $sort="", $order="asc") | |
| exports the result table according to sort criteria | |
| load_child_from_parentID ($pollID, $ID, $whitelist) | |
| loads all childs which have the same parent ID. used by db::load_widget() | |
| load_widget ($pollID, $ID) | |
| loads a specific widget completely with options | |
| load_poll ($pollID) | |
| loads the widget_list, an array of all widgets from a poll | |
| insert_widget (&$w, $pollType) | |
| inserts a widget and sets it's ID | |
| insert_poll (&$p, $create_result_table=true) | |
| inserts a poll with its widgets and sets the pollID. | |
| make_umfragen_table () | |
| creates the table where all polls are stored | |
| make_user_config_table () | |
| creates the table where all polls are stored | |
| make_config_table () | |
| creates the table where some settings are stored | |
| make_email_stack_table () | |
| creates the table where some settings are stored | |
| check_tables () | |
| checks if all vital tables are there (not complete) | |
| duplicate_poll ($pID) | |
| duplicates a poll | |
| duplicate_widget ($pID, $wID) | |
| duplicates a widget in a specific poll | |
| rename_result_column ($pollID, $long_result, $old_name, $new_name) | |
| renames a column in the result table of a poll | |
| add_widget_to_result_table ($widget) | |
| adds a widget to the result table according to its nature | |
| make_void_result_table (poll $poll) | |
| makes a clean result table for a poll. | |
| make_poll_result_table (poll $poll) | |
| makes a complete result table including widgets | |
| add_all_widgets_to_poll_result_table (poll $poll) | |
| adds all widgets to a (clean) pollresult table | |
| insert_poll_result ($poll2) | |
| inserts a complete result record in the result table | |
| klassenliste ($au, $poll) | |
| makes a list of users into the results table | |
| garbage_collect_result_table (poll $poll) | |
| deletes unused and empty columns in the result table | |
| get_visited_polls_for_user ($user) | |
| get a list of polls a user has visited and participated in | |
| garbage_collect_visited_polls ($user) | |
| remove deleted pollIDs from the list of visited polls of a user, does not update the database | |
| update_visited_polls ($user, $pollID) | |
| appends a pollID to the list of visited polls for a user | |
| remove_visited_poll ($user, $pollID) | |
| appends a pollID to the list of visited polls for a user | |
| mass_update_widget ($wlist) | |
| updates the database records of a list of widgets | |
| update_widget_field ($w, $field, $data) | |
| updates a specific database column of a widget | |
| update_poll_field ($ID, $field, $data) | |
| updates a specific database column of a poll | |
| update_user_config_field ($user, $field, $data) | |
| updates a specific database column of a user_config | |
| email_stack_add ($data) | |
| adds a email event on the email stack table | |
| email_stack_get () | |
| get the next entry from the email stack, does not delete it from the database | |
| email_stack_get_all () | |
| gets all entries from the email stack array of array of results | |
| email_stack_del ($ID) | |
| deletes an entry from the emails stack | |
| update_config_field ($name, $value) | |
| updates a specific database column of the config table | |
| load_user_config_field ($user, $field) | |
| loads a specific database column of a user_config | |
| update_widget_name ($widget, $new_name) | |
| updates a widget::name in the result table and the widgets table | |
| convert_polltype_S2A ($poll) | |
| converts the polltype of a poll from simple to advanced | |
| convert_polltype_A2S ($poll) | |
| converts the polltype of a poll from advanced to simple | |
| is_results_empty ($pid) | |
| checks if there is data in the result table (apart from the standard fields as username...) | |
| anonymize_results ($pollID) | |
| does nothing | |
| drop_poll ($id) | |
| deletes the widget table of a poll | |
| drop_poll_results ($id) | |
| deletes the result table trom a poll | |
| delete_poll ($id) | |
| deletes the row from umfragen table of a poll | |
| delete_widget ($pollID, $wID) | |
| deletes a widget from a poll | |
| delete_result_for_user_list ($pollID, $username_list) | |
| deletes the row in the result table of a poll belonging to users from a list | |
| delete_all_result ($pollID) | |
| deletes all results bot not the result table from a poll | |
Data Fields | |
| $dbh | |
| holds the PDO connection to the database | |
| $last_poll_insert_id = -1 | |
database class, handles all database stuff
this object is intended to be used as singleton per page
Definition at line 37 of file db.class.php.
| __construct | ( | $dbuser, | |
| $dbpass, | |||
| $dbname, | |||
| $dbhost | |||
| ) |
constructor, connects directly to the database server and stores the reference
Definition at line 45 of file db.class.php.
| add_all_widgets_to_poll_result_table | ( | poll | $poll | ) |
adds all widgets to a (clean) pollresult table
| poll | $poll |
Definition at line 1054 of file db.class.php.
| add_widget_to_result_table | ( | $widget | ) |
adds a widget to the result table according to its nature
| widget | $widget |
Definition at line 990 of file db.class.php.
| anonymize_results | ( | $pollID | ) |
| check_tables | ( | ) |
checks if all vital tables are there (not complete)
Definition at line 795 of file db.class.php.
| convert_polltype_A2S | ( | $poll | ) |
converts the polltype of a poll from advanced to simple
| poll | $poll |
Definition at line 1709 of file db.class.php.
| convert_polltype_S2A | ( | $poll | ) |
converts the polltype of a poll from simple to advanced
| poll | $poll |
Definition at line 1688 of file db.class.php.
| count_results | ( | $pollID | ) |
simple result count
| int | $pollID |
Definition at line 168 of file db.class.php.
| delete_all_result | ( | $pollID | ) |
deletes all results bot not the result table from a poll
| int | $pollID | pollID |
Definition at line 1861 of file db.class.php.
| delete_poll | ( | $id | ) |
deletes the row from umfragen table of a poll
| int | $id | pollID |
Definition at line 1809 of file db.class.php.
| delete_result_for_user_list | ( | $pollID, | |
| $username_list | |||
| ) |
deletes the row in the result table of a poll belonging to users from a list
| int | $pollID | pollID |
| array | $username_list | list of usernames |
Definition at line 1836 of file db.class.php.
| delete_widget | ( | $pollID, | |
| $wID | |||
| ) |
deletes a widget from a poll
| int | $pollID | pollID |
| int | $wID | the widget ID |
Definition at line 1821 of file db.class.php.
| drop_poll | ( | $id | ) |
deletes the widget table of a poll
| int | $id | pollID |
Definition at line 1787 of file db.class.php.
| drop_poll_results | ( | $id | ) |
deletes the result table trom a poll
| int | $id | pollID |
Definition at line 1798 of file db.class.php.
| duplicate_poll | ( | $pID | ) |
duplicates a poll
| int | $pID | pollID |
Definition at line 836 of file db.class.php.
| duplicate_widget | ( | $pID, | |
| $wID | |||
| ) |
duplicates a widget in a specific poll
| int | $pID | pollID |
| int | $wID | the widgets ID |
Definition at line 891 of file db.class.php.
| email_stack_add | ( | $data | ) |
adds a email event on the email stack table
| array | $data | an array with data we want to write into the database |
| exception | if the values in the array are not set |
the array needs following indexes: pollID, type, fullName, uname
Definition at line 1561 of file db.class.php.
| email_stack_del | ( | $ID | ) |
deletes an entry from the emails stack
| string | $ID | the email stack table ID of the element bool true |
Definition at line 1604 of file db.class.php.
| email_stack_get | ( | ) |
get the next entry from the email stack, does not delete it from the database
Definition at line 1580 of file db.class.php.
| email_stack_get_all | ( | ) |
gets all entries from the email stack array of array of results
Definition at line 1593 of file db.class.php.
| export_result | ( | $pollID, | |
$sort = "", |
|||
$order = "asc" |
|||
| ) |
exports the result table according to sort criteria
| string | $pollID | the Id of the poll |
| string | $sort | a column name we want to sort by |
| $order | either "asc" or "desc" for the order of the sort |
Definition at line 409 of file db.class.php.
| export_to_csv | ( | poll | $poll, |
| $delimiter, | |||
| $enclosure, | |||
$download = true |
|||
| ) |
exports results to csv
| poll | $poll | |
| string | $delimiter | The delimiter used for the CSV |
| string | $enclosure | The enclosureused for the CSV |
| bool | $download | True if the file is for download. Uses HTTP header! |
Definition at line 357 of file db.class.php.
| garbage_collect_result_table | ( | poll | $poll | ) |
deletes unused and empty columns in the result table
| poll | $poll |
Definition at line 1288 of file db.class.php.
| garbage_collect_visited_polls | ( | $user | ) |
remove deleted pollIDs from the list of visited polls of a user, does not update the database
| string | $user | the username of the user |
Definition at line 1373 of file db.class.php.
| get_all_polls_array | ( | ) |
gets an array of all polls
Definition at line 97 of file db.class.php.
| get_all_polls_array_from_status | ( | $stat | ) |
| int | $stat | statusID as defined in the configfile |
Definition at line 107 of file db.class.php.
| get_config_array | ( | ) |
gets all config variable stored in the database
Definition at line 154 of file db.class.php.
| get_poll_infoArray | ( | $pollID | ) |
gets an infoarray for a specific poll
| int | $pollID |
Definition at line 117 of file db.class.php.
| get_poll_name_from_list | ( | $polls | ) |
gets a mapping array of ID to name of a pollist
| array | $polls | list with pollIDs |
Definition at line 80 of file db.class.php.
| get_poll_result_for_user | ( | $pollID, | |
| $username | |||
| ) |
gets the pollresult from a user
| int | $pollID | |
| string | $username |
Definition at line 128 of file db.class.php.
| get_schedule_widget_data | ( | $widget | ) |
gets a list of data for the schedule widget
| widget | $widget | the schedule widget we want the data from |
Definition at line 317 of file db.class.php.
| get_sql_all_assoc | ( | $sql | ) |
makes a databse query and returns an array or results
| string | $sql | a valid SQL query string |
Definition at line 66 of file db.class.php.
| get_visited_polls_for_user | ( | $user | ) |
get a list of polls a user has visited and participated in
| string | "user" the username of the user |
Definition at line 1357 of file db.class.php.
| get_widget_names | ( | $pollID | ) |
gets a list of all widget names from a poll
| int | $pollID |
Definition at line 141 of file db.class.php.
| insert_poll | ( | & | $p, |
$create_result_table = true |
|||
| ) |
inserts a poll with its widgets and sets the pollID.
| poll | $p | |
| bool | $create_result_table,=false | not used anymore |
Definition at line 658 of file db.class.php.
| insert_poll_result | ( | $poll2 | ) |
inserts a complete result record in the result table
uses a clone of the poll object and inserts there the matrixQuestion objects
| poll | $poll2 |
Definition at line 1073 of file db.class.php.
| insert_widget | ( | & | $w, |
| $pollType | |||
| ) |
inserts a widget and sets it's ID
| widget | &$w | |
| int | $pollType | provided by configfile: simple or advanced |
Definition at line 550 of file db.class.php.
| is_results_empty | ( | $pid | ) |
checks if there is data in the result table (apart from the standard fields as username...)
| int | $pid | pollID |
Definition at line 1730 of file db.class.php.
| klassenliste | ( | $au, | |
| $poll | |||
| ) |
makes a list of users into the results table
| auth | $au | (LSAP OR MYSQL authentification object) |
| poll | $poll |
Definition at line 1221 of file db.class.php.
| load_child_from_parentID | ( | $pollID, | |
| $ID, | |||
| $whitelist | |||
| ) |
loads all childs which have the same parent ID. used by db::load_widget()
| int | $pollID | |
| int | $ID | the parent ID |
| array | $whitelist | whitelist of widget types which are allowed as child ("*" -> no restriction) |
Definition at line 457 of file db.class.php.
| load_poll | ( | $pollID | ) |
loads the widget_list, an array of all widgets from a poll
| int | $pollID |
Definition at line 522 of file db.class.php.
| load_user_config_field | ( | $user, | |
| $field | |||
| ) |
loads a specific database column of a user_config
| int | $user | the username |
| mixed | $field | the column name to be updated if $field is an array of strings, then a array of results will be returned. The "*" wildcard works. |
Definition at line 1645 of file db.class.php.
| load_widget | ( | $pollID, | |
| $ID | |||
| ) |
loads a specific widget completely with options
| int | $pollID | |
| int | $ID | the ID of the widget |
Definition at line 489 of file db.class.php.
| make_config_table | ( | ) |
creates the table where some settings are stored
Definition at line 761 of file db.class.php.
| make_email_stack_table | ( | ) |
creates the table where some settings are stored
Definition at line 775 of file db.class.php.
| make_poll_result_table | ( | poll | $poll | ) |
makes a complete result table including widgets
| poll | $poll |
Definition at line 1027 of file db.class.php.
| make_umfragen_table | ( | ) |
creates the table where all polls are stored
Definition at line 717 of file db.class.php.
| make_user_config_table | ( | ) |
creates the table where all polls are stored
Definition at line 745 of file db.class.php.
| make_void_result_table | ( | poll | $poll | ) |
makes a clean result table for a poll.
standard colums:
| poll | $poll |
Definition at line 1010 of file db.class.php.
| mass_update_widget | ( | $wlist | ) |
updates the database records of a list of widgets
| array | $wlist | list of widget objects |
Definition at line 1450 of file db.class.php.
| remove_visited_poll | ( | $user, | |
| $pollID | |||
| ) |
appends a pollID to the list of visited polls for a user
| string | $user | the username of the user |
| string | $pollID | the ID we want add |
Definition at line 1433 of file db.class.php.
| rename_result_column | ( | $pollID, | |
| $long_result, | |||
| $old_name, | |||
| $new_name | |||
| ) |
renames a column in the result table of a poll
| int | $pollID | |
| string | $widgettype | the type of the widget in string form |
| string | $old_name | the old name of the column |
| string | $new_name | the new name of the column |
Definition at line 975 of file db.class.php.
| update_config_field | ( | $name, | |
| $value | |||
| ) |
updates a specific database column of the config table
| string | $name | the variable name to save |
| string | $value | the data we want store. mostly serialized |
Definition at line 1615 of file db.class.php.
| update_poll_field | ( | $ID, | |
| $field, | |||
| $data | |||
| ) |
updates a specific database column of a poll
| int | $ID | the pollID |
| string | $field | the column name to be updated |
| mixed | $data | the value to be set |
Definition at line 1522 of file db.class.php.
| update_user_config_field | ( | $user, | |
| $field, | |||
| $data | |||
| ) |
updates a specific database column of a user_config
| int | $user | the username |
| string | $field | the column name to be updated |
| mixed | $data | the value to be set |
Definition at line 1534 of file db.class.php.
| update_visited_polls | ( | $user, | |
| $pollID | |||
| ) |
appends a pollID to the list of visited polls for a user
| string | $user | the username of the user |
| string | $pollID | the ID we want add |
Definition at line 1402 of file db.class.php.
| update_widget_field | ( | $w, | |
| $field, | |||
| $data | |||
| ) |
updates a specific database column of a widget
| widget | $w | |
| string | $field | the column name to be updated |
| mixed | $data | the value to be set |
Definition at line 1501 of file db.class.php.
| update_widget_name | ( | $widget, | |
| $new_name | |||
| ) |
updates a widget::name in the result table and the widgets table
| widget | $widget | |
| string | $new_name | the name to be set |
Definition at line 1674 of file db.class.php.
| $dbh |
holds the PDO connection to the database
Definition at line 39 of file db.class.php.
| $last_poll_insert_id = -1 |
Definition at line 40 of file db.class.php.