function pager_link($link_text, $url, $icon = false)
 {
     global $path_to_root;
     if (user_graphic_links() && $icon) {
         $link_text = set_icon($icon, $link_text);
     }
     $href = $path_to_root . $url;
     return "<a href='{$href}'>" . $link_text . "</a>";
 }
コード例 #2
0
function display_companies()
{
    global $def_coy, $db_connections;
    $coyno = $_SESSION["wa_current_user"]->company;
    echo "\n\t\t<script language='javascript'>\n\t\tfunction deleteCompany(id, name) {\n\t\t\tif (!confirm('" . _("Are you sure you want to delete company no. ") . "'+id+' '+name+'?'))\n\t\t\t\treturn\n\t\t\tdocument.location.replace('create_coy.php?c=df&id='+id)\n\t\t}\n\t\t</script>";
    start_table(TABLESTYLE);
    $th = array(_("Company"), _("Database Host"), _("Database User"), _("Database Name"), _("Table Pref"), _("Default"), "", "");
    table_header($th);
    $k = 0;
    $conn = $db_connections;
    $n = count($conn);
    for ($i = 0; $i < $n; $i++) {
        if ($i == $def_coy) {
            $what = _("Yes");
        } else {
            $what = _("No");
        }
        if ($i == $coyno) {
            start_row("class='stockmankobg'");
        } else {
            alt_table_row_color($k);
        }
        label_cell($conn[$i]['name']);
        label_cell($conn[$i]['host']);
        label_cell($conn[$i]['dbuser']);
        label_cell($conn[$i]['dbname']);
        label_cell($conn[$i]['tbpref']);
        label_cell($what);
        $edit = _("Edit");
        $delete = _("Delete");
        if (user_graphic_links()) {
            $edit = set_icon(ICON_EDIT, $edit);
            $delete = set_icon(ICON_DELETE, $delete);
        }
        label_cell("<a href='" . $_SERVER['PHP_SELF'] . "?selected_id={$i}'>{$edit}</a>");
        $name = "\"" . $conn[$i]['name'] . "\"";
        label_cell($i == $coyno ? '' : "<a href='javascript:deleteCompany({$i}, {$name})'>{$delete}</a>");
        end_row();
    }
    end_table();
    display_note(_("The marked company is the current company which cannot be deleted."), 0, 0, "class='currentfg'");
    display_note(_("If no Admin Password is entered, the new Admin Password will be '<b>password</b>' by default "), 1, 0, "class='currentfg'");
}
 function button($name, $value, $title = false, $icon = false, $aspect = '')
 {
     // php silently changes dots,spaces,'[' and characters 128-159
     // to underscore in POST names, to maintain compatibility with register_globals
     $rel = '';
     if ($aspect == 'selector') {
         $rel = " rel='{$value}'";
         $value = _("Select");
     }
     if (user_graphic_links() && $icon) {
         if ($value == _("Delete")) {
             // Helper during implementation
             $icon = ICON_DELETE;
         }
         return "<button type='submit' class='btn editbutton' name='" . htmlentities(strtr($name, array('.' => '=2E', '=' => '=3D'))) . "' value='1'" . ($title ? " title='{$title}'" : " title='{$value}'") . ($aspect ? " aspect='{$aspect}'" : '') . $rel . " />" . set_icon($icon) . "</button>\n";
     } else {
         return "<input type='submit' class='btn editbutton' name='" . htmlentities(strtr($name, array('.' => '=2E', '=' => '=3D'))) . "' value='{$value}'" . ($title ? " title='{$title}'" : '') . ($aspect ? " aspect='{$aspect}'" : '') . $rel . " />\n";
     }
 }