Пример #1
0
function intAssignVars(&$smarty)
{
    $smarty->assign("actions", array("ADD_USER" => "Add User", "CHANGE_CREDIT" => "Change Credit", "DEL_USER" => "Delete User", "All" => "All"));
    $smarty->assign("actions_default", requestVal("action", "All"));
    $smarty->assign("order_bys", array("change_time" => "Change Time", "per_user_credit" => "User Credit", "admin_credit" => "Admin Credit"));
    $smarty->assign("order_by_default", requestVal("order_by", "change_time"));
}
Пример #2
0
function intShowOnlinesByType(&$smarty, $onlines)
{
    $smarty->assign_by_ref("onlines", $onlines);
    $smarty->assign("refresh_times", array(5, 10, 20, 30, 60));
    $smarty->assign("refresh_default", requestVal("refresh", 10));
    $smarty->display("admin/report/online_users_by_type.tpl");
}
Пример #3
0
function getRPP()
{
    $rpp = (int) requestVal("rpp", 30);
    if ($rpp <= 0) {
        return 30;
    }
    return $rpp;
}
Пример #4
0
function intSetRasParams(&$smarty, $rule_info)
{
    $smarty->assign("ras_selected", requestVal("ras", $rule_info["ras"]));
    if ($rule_info["ras"] != "_ALL_") {
        foreach ($rule_info["ports"] as $port_name) {
            $smarty->assign("{$rule_info["ras"]}_{$port_name}", "checked");
        }
    }
}
Пример #5
0
function smarty_function_reportRPP($params, &$smarty)
{
    /*return html select of Result Per Page selection
    */
    require_once $smarty->_get_plugin_filepath('function', 'html_options');
    $rpps = array(20, 30, 50, 100, 500, 1000, 2000);
    $select_arr = array("output" => $rpps, "values" => $rpps, "name" => "rpp", "selected" => requestVal("rpp"));
    return smarty_function_html_options($select_arr, $smarty);
}
Пример #6
0
function intAssignVars(&$smarty)
{
    $smarty->assign("services", array("internet", "voip", "All"));
    $smarty->assign("services_default", requestVal("service", "All"));
    $smarty->assign("order_bys", array("user_id" => "User ID", "credit_used" => "Credit Used", "login_time" => "Login Time", "logout_time" => "Logout Time", "successful" => "Succesful", "service" => "Service", "ras_id" => "Ras ID"));
    $smarty->assign("order_by_default", requestVal("order_by", "login_time"));
    $smarty->assign("successful_options", array("Yes", "No", "All"));
    $smarty->assign("successful_default", requestVal("successful", "All"));
}
/**
 * Smarty {html_options} function plugin
 *
 * Type:     function<br>
 * Name:     html_options<br>
 * Input:<br>
 *           - name       (optional) - string default "select"
 *           - values     (required if no options supplied) - array
 *           - options    (required if no values supplied) - associative array
 *           - selected   (optional) - string default not set
 *           - output     (required if not options supplied) - array
 * Purpose:  Prints the list of <option> tags generated from
 *           the passed parameters
 * @link http://smarty.php.net/manual/en/language.function.html.options.php {html_image}
 *      (Smarty online manual)
 * @param array
 * @param Smarty
 * @return string
 * @uses smarty_function_escape_special_chars()
 */
function smarty_function_html_options($params, &$smarty)
{
    require_once $smarty->_get_plugin_filepath('shared', 'escape_special_chars');
    $name = null;
    $values = null;
    $options = null;
    $selected = array();
    $output = null;
    $extra = '';
    foreach ($params as $_key => $_val) {
        switch ($_key) {
            case 'name':
                ${$_key} = (string) $_val;
                break;
            case 'options':
                ${$_key} = (array) $_val;
                break;
            case 'values':
            case 'output':
                ${$_key} = array_values((array) $_val);
                break;
            case 'selected':
                ${$_key} = array_map('strval', array_values((array) $_val));
                break;
            case 'selected_request':
                $selected = array(requestVal($_val));
                break;
            default:
                if (!is_array($_val)) {
                    $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
                } else {
                    $smarty->trigger_error("html_options: extra attribute '{$_key}' cannot be an array", E_USER_NOTICE);
                }
                break;
        }
    }
    if (!isset($options) && !isset($values)) {
        return '';
    }
    /* raise error here? */
    $_html_result = '';
    if (is_array($options)) {
        foreach ($options as $_key => $_val) {
            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
        }
    } else {
        foreach ((array) $values as $_i => $_key) {
            $_val = isset($output[$_i]) ? $output[$_i] : '';
            $_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected);
        }
    }
    if (!empty($name)) {
        $_html_result = '<select name="' . $name . '"' . $extra . '>' . "\n" . $_html_result . '</select>' . "\n";
    }
    return $_html_result;
}
function intAssignVars(&$smarty)
{
    $smarty->assign("type_options", array("Internet", "VoIP", "All"));
    $smarty->assign("type_default", requestVal("type", "All"));
    $smarty->assign("order_bys", array("add_date" => "Date", "type" => "Type", "admin_id" => "Admin ID"));
    $smarty->assign("order_by_default", requestVal("order_by", "date"));
    if (isInRequest("msg")) {
        $smarty->set_page_error($_REQUEST["msg"]);
    }
}
Пример #9
0
function intAssignSelectedPermVals(&$smarty)
{
    if (isInRequest("selected")) {
        $has_perm = hasPerm($_REQUEST["selected"], $_REQUEST["admin_username"]);
        $smarty->assign("selected", $_REQUEST["selected"]);
        $smarty->assign("has_selected_perm", $has_perm);
        $smarty->assign("selected_value", requestVal("value"));
        if ($has_perm) {
            $perm_val_req = new AdminPermValue($_REQUEST["selected"], $_REQUEST["admin_username"]);
            list($success, $cur_val) = $perm_val_req->send();
            if ($success) {
                $smarty->assign("cur_val", $cur_val);
            } else {
                $smarty->assign("cur_val", "ERR");
                smartySetPageErr($smarty, $cur_val->getErrorMsgs());
            }
        }
    } else {
        $smarty->assign("selected", "");
    }
}