コード例 #1
0
/**
 * 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;
}
コード例 #2
0
/**
 * set the html for user admin page
 * this function is registered in xajax
 * @return xajaxResponse every xajax registered function needs to return this object
 */
function action_get_user_admin_page()
{
    global $logging;
    global $user;
    global $user_admin_table_configuration;
    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_admin_table_configuration);
    # set page, title, explanation and navigation
    $response->assign("page_title", "innerHTML", translate("LABEL_USER_ADMIN_TITLE"));
    $response->assign("navigation_container", "innerHTML", get_page_navigation(PAGE_TYPE_USER_ADMIN));
    $html_database_table->get_page(translate("LABEL_USER_ADMIN_TITLE"), $result);
    $response->assign("main_body", "innerHTML", $result->get_result_str());
    # set content
    $html_database_table->get_content($user, HTML_NO_LIST_PERMISSION_CHECK, "", DATABASETABLE_UNKWOWN_PAGE, $result);
    $response->custom_response->assign_with_effect(PORTAL_CSS_NAME_PREFIX . "content_pane", $result->get_result_str());
    # set action pane
    $html_str = $html_database_table->get_action_bar(USER_TABLE_NAME, "");
    $response->custom_response->assign_and_show("action_pane", $html_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;
}
コード例 #3
0
/**
 * set the html for a portal page
 * this function is registered in xajax
 * @return xajaxResponse every xajax registered function needs to return this object
 */
function action_get_portal_page()
{
    global $mobile;
    global $logging;
    global $user;
    global $portal_table_configuration;
    global $list_table_description;
    global $firstthingsfirst_portal_title;
    global $firstthingsfirst_portal_intro_text;
    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($portal_table_configuration);
    # set page, title, explanation and navigation
    $response->assign("page_title", "innerHTML", $firstthingsfirst_portal_intro_text);
    if ($mobile == FALSE) {
        $response->assign("navigation_container", "innerHTML", get_page_navigation(PAGE_TYPE_PORTAL));
    }
    $html_database_table->get_page($firstthingsfirst_portal_title, $result);
    $response->assign("main_body", "innerHTML", $result->get_result_str());
    # set content
    $html_database_table->get_content($list_table_description, LISTTABLEDESCRIPTION_TABLE_NAME, "", DATABASETABLE_ALL_PAGES, $result);
    $response->custom_response->assign_with_effect(PORTAL_CSS_NAME_PREFIX . "content_pane", $result->get_result_str());
    # no action pane
    # 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;
}
コード例 #4
0
/**
 * set the html to print a list
 * this function is registered in xajax
 * @param string $list_title title of list
 * @return xajaxResponse every xajax registered function needs to return this object
 */
function action_get_list_print_page($list_title)
{
    global $logging;
    global $user;
    global $list_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();
    $html_database_table = new HtmlDatabaseTable($list_table_configuration);
    # set page and title
    $response->assign("page_title", "innerHTML", $list_title);
    $html_database_table->get_page($list_title, $result);
    $response->assign("main_body", "innerHTML", $result->get_result_str());
    # 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("action_bar_button_print", "above", $error_message_str, $error_log_str, $error_str, $response);
        return $response;
    }
    # set content
    $html_database_table->get_content($list_table, $list_title, "", DATABASETABLE_ALL_PAGES, $result);
    $response->assign(LIST_CSS_NAME_PREFIX . "content_pane", "innerHTML", $result->get_result_str());
    # set footer
    $response->assign("footer_text", "innerHTML", get_footer($list_table->get_creator_modifier_array()));
    # check post conditions
    if (check_postconditions($result, $response) == FALSE) {
        return $response;
    }
    # show the content pane
    $response->script("\$('#" . LIST_CSS_NAME_PREFIX . "content_pane').show()");
    # print this page
    $response->script("window.print()");
    # log total time for this function
    $logging->info(get_function_time_str(__METHOD__));
    return $response;
}