/** * set the html for user settings page * this function is registered in xajax * @return xajaxResponse every xajax registered function needs to return this object */ function action_get_user_settings_page() { global $logging; global $user; global $user_settings_table_configuration; global $firstthingsfirst_portal_title; global $user_start_time_array; $logging->info("USER_ACTION " . __METHOD__ . " (user="******")"); # store start time $user_start_time_array[__METHOD__] = microtime(TRUE); # create necessary objects $result = new Result(); $response = new xajaxResponse(); $html_database_table = new HtmlDatabaseTable($user_settings_table_configuration); # create an array with selection of fields that user may change $db_fields_array = array(DB_ID_FIELD_NAME, USER_NAME_FIELD_NAME, USER_PW_FIELD_NAME, USER_LANG_FIELD_NAME, USER_DATE_FORMAT_FIELD_NAME, USER_DECIMAL_MARK_FIELD_NAME, USER_LINES_PER_PAGE_FIELD_NAME, USER_THEME_FIELD_NAME); $user_record_key_string = DatabaseTable::_get_encoded_key_string(array(DB_ID_FIELD_NAME => $user->get_id())); # set page, title, explanation and navigation $response->assign("page_title", "innerHTML", translate("LABEL_USER_SETTINGS_TITLE")); $response->assign("navigation_container", "innerHTML", get_page_navigation(PAGE_TYPE_USER_SETTINGS)); $html_database_table->get_page(translate("LABEL_USER_SETTINGS_TITLE"), $result); $response->assign("main_body", "innerHTML", $result->get_result_str()); # get action pane for current user $html_database_table->get_record($user, USER_TABLE_NAME, $user_record_key_string, $db_fields_array, $result); $response->custom_response->assign_with_effect("action_pane", $result->get_result_str()); # set footer $response->assign("footer_text", "innerHTML", " "); # check post conditions if (check_postconditions($result, $response) == FALSE) { return $response; } # log total time for this function $logging->info(get_function_time_str(__METHOD__)); return $response; }
/** * set list filter string (function is called when user hits filter button) * this function is registered in xajax * @param string $list_title title of list * @param string $filter_str filter string that user has set * @return xajaxResponse every xajax registered function needs to return this object */ function action_set_list_filter($list_title, $filter_str) { global $logging; global $user; global $list_state; global $list_table_configuration; global $user_start_time_array; $logging->info("USER_ACTION " . __METHOD__ . " (user="******", list_title={$list_title}, filter_str={$filter_str})"); # store start time $user_start_time_array[__METHOD__] = microtime(TRUE); # create necessary objects $result = new Result(); $response = new xajaxResponse(); $html_database_table = new HtmlDatabaseTable($list_table_configuration); # check if filter_str is well formed if (str_is_well_formed("filter_str", $filter_str) == FALSE_RETURN_STRING) { set_error_message("filter_form", "below", "ERROR_NOT_WELL_FORMED_STRING", "", "", $response); return $response; } # create list table object $list_table = new ListTable($list_title); if ($list_table->get_is_valid() == FALSE) { $logging->warn("create list object returns false"); $error_message_str = $list_table->get_error_message_str(); $error_log_str = $list_table->get_error_log_str(); $error_str = $list_table->get_error_str(); set_error_message("filter_form", "below", $error_message_str, $error_log_str, $error_str, $response); return $response; } # set filter value $user->get_list_state($list_table->get_table_name()); $list_state->set_filter_str($filter_str); $list_state->set_filter_str_sql(""); $user->set_list_state(); # set content $html_database_table->get_content($list_table, $list_title, "", DATABASETABLE_UNKWOWN_PAGE, $result); $response->custom_response->assign_with_effect(LIST_CSS_NAME_PREFIX . "content_pane", $result->get_result_str()); # check post conditions if (check_postconditions($result, $response) == FALSE) { return $response; } # log total time for this function $logging->info(get_function_time_str(__METHOD__)); return $response; }
/** * cancel current action and substitute current html with new html * this function is registered in xajax * @param string $title title of page * @return xajaxResponse every xajax registered function needs to return this object */ function action_cancel_user_admin_action($title) { global $logging; global $user; global $user_admin_table_configuration; global $user_start_time_array; $logging->info("USER_ACTION " . __METHOD__ . " (user="******", title={$title})"); # store start time $user_start_time_array[__METHOD__] = microtime(TRUE); # create necessary objects $response = new xajaxResponse(); $html_database_table = new HtmlDatabaseTable($user_admin_table_configuration); # set action pane $html_str = $html_database_table->get_action_bar($title, ""); $response->custom_response->assign_with_effect("action_pane", $html_str); # log total time for this function $logging->info(get_function_time_str(__METHOD__)); return $response; }
/** * delete a list table * this function is registered in xajax * @param string $list_title title of list table * @param string $key_string comma separated name value pairs * @return xajaxResponse every xajax registered function needs to return this object */ function action_delete_portal_record($list_title) { global $logging; global $user; global $list_table_description; global $portal_table_configuration; global $user_start_time_array; $logging->info("USER_ACTION " . __METHOD__ . " (user="******", list_title={$list_title})"); # store start time $user_start_time_array[__METHOD__] = microtime(TRUE); # create necessary objects $result = new Result(); $response = new xajaxResponse(); $list_table = new ListTable($list_title); if ($list_table->get_is_valid() == FALSE) { $logging->warn("create list object returns false"); $error_message_str = $list_table->get_error_message_str(); $error_log_str = $list_table->get_error_log_str(); $error_str = $list_table->get_error_str(); set_error_message("tab_portal_id", "below", $error_message_str, $error_log_str, $error_str, $response); return $response; } $html_database_table = new HtmlDatabaseTable($portal_table_configuration); # display error when delete returns false if ($list_table->drop() == FALSE) { $logging->warn("drop list returns false"); $error_message_str = $list_table->get_error_message_str(); $error_log_str = $list_table->get_error_log_str(); $error_str = $list_table->get_error_str(); set_error_message("tab_portal_id", "below", $error_message_str, $error_log_str, $error_str, $response); return $response; } # set content $html_database_table->get_content($list_table_description, $list_title, "", DATABASETABLE_ALL_PAGES, $result); $response->custom_response->assign_with_effect(PORTAL_CSS_NAME_PREFIX . "content_pane", $result->get_result_str()); # reset current list name only when active list has been removed if ($list_title == $user->get_current_list_name()) { $user->set_current_list_name(""); } # set page navigation and login status to update old 'list' links $page_navigation_str = get_page_navigation(PAGE_TYPE_PORTAL); $response->assign("navigation_container", "innerHTML", $page_navigation_str); # check post conditions if (check_postconditions($result, $response) == FALSE) { return $response; } # log total time for this function $logging->info(get_function_time_str(__METHOD__)); return $response; }