示例#1
0
                $group_balance_list[$i]['expenses'] = number_format($uexpense, DECIMALS, DSEP, TSEP);
                $group_balance_list[$i]['paid'] = number_format($upaid, DECIMALS, DSEP, TSEP);
                $group_balance_list[$i]['balance'] = number_format($upaid - $uexpense, DECIMALS, DSEP, TSEP);
                $group_balance_list[$i]['link'] = "http://" . $_SERVER['HTTP_HOST'] . DIR . "expenses.php?groupid=" . $grouplist[$i]['group_id'] . "&uid={$uid}";
                if ($grouplist[$i]['role'] == "founder") {
                    $group_balance_list[$i]['canedit'] = true;
                } else {
                    $group_balance_list[$i]['canedit'] = false;
                }
            }
        }
        print_group_balance_list_html($group_balance_list);
    }
} elseif ($editprofile) {
    if ($errorString) {
        print_pageitem_text_html("Please correct the following:", $errorString);
    }
    if (isset($_POST['realname'])) {
        $realname = $_POST['realname'];
    } else {
        $realname = $user->data['realname'];
    }
    if (isset($_POST['email'])) {
        $email = $_POST['email'];
    } else {
        $email = $user->data['email'];
    }
    if (isset($_POST['mode']) && isset($_POST['email_notify'])) {
        $checked = $_POST['email_notify'];
    } elseif (isset($_POST['mode']) && !isset($_POST['email_notify'])) {
        $checked = 0;
示例#2
0
$topbar['leftnav'][0]['url'] =  $backurl;*/
$back = get_back_page();
$topbar['leftnav'][0]['name'] = $back['name'];
$topbar['leftnav'][0]['url'] = $back['url'];
print_topbar($topbar);
print_body_start();
if ($showexpenses && array_key_exists(5, $permissions)) {
    if ($message) {
        print_pagetitle($message);
    }
    //$expenselist = get_groupexpenses($groupdetails['group_id'],$uid, "neg");
    $expenselist = get_groupexpenses($groupdetails['group_id'], $uid, $xtype, $user->data['user_id']);
    if (!empty($expenselist)) {
        print_expenselist_html($expenselist, $user);
    } else {
        print_pageitem_text_html("Sorry", "No expenses were found");
    }
}
//if ($ask_add && array_key_exists(0, $permissions) ) {
//  $a = "Add";
//  $b = "more members";
//  $formarray['action'] = $_SERVER['PHP_SELF'];
//  $formarray['rows'][0]['type'] = "select";
//  $formarray['rows'][0]['name'] = "number";
//  $formarray['rows'][0]['value'] = array(1=>"$a 1 $b",2=>"$a 2 $b",3=>"$a 3 $b",4=>"$a 4 $b",5=>"$a 5 $b",6=>"$a 6 $b",7=>"$a 7 $b",8=>"$a 8 $b",9=>"$a 9 $b",10=>"$a 10 $b");
//  $formarray['rows'][1]['items'] = "|mode|hidden|addmembers";
//  $formarray['rows'][2]['items'] = "|groupid|hidden|" .$groupdetails['group_id'];
//  $formarray['rows'][3]['items'] = "||submit|Go";
//  echo create_form_html($formarray);
//  unset($formarray);
//}
示例#3
0
function fatal_error($message)
{
    // print header, message, link to home and footer
    if (!headers_sent()) {
        print_header();
        print_body_start();
    }
    $link = "    <a href=\"http://" . $_SERVER['HTTP_HOST'] . DIR . "index.php\">Home</a>";
    print_pageitem_text_html("Something went wrong:", array($message, $link));
    print_footer();
    exit;
}
示例#4
0
    echo create_form_html($formarray);
    unset($formarray);
}
if ($addgroupresult) {
    print_pageitem_text_html("Succes:", $addgroupresult);
}
if ($showgrouplist) {
    $grouplist = get_groups($user->data['user_id']);
    // group_id - group_name - role - join_date - member_count
    $size = count($grouplist);
    if ($size > 0) {
        $user_expenses = get_user_expenses($user->data['user_id']);
        $user_paid_expenses = get_user_paid_expenses($user->data['user_id']);
        for ($i = 0; $i < $size; $i++) {
            $uexpense = $user_expenses['users'][$user->data['user_id']]['groups'][$grouplist[$i]['group_id']]['group_total'];
            $upaid = $user_paid_expenses['users'][$user->data['user_id']]['groups'][$grouplist[$i]['group_id']]['group_total'];
            $grouplist[$i]['balance'] = number_format($upaid - $uexpense, DECIMALS, DSEP, TSEP);
            $grouplist[$i]['link'] = "http://" . $_SERVER['HTTP_HOST'] . DIR . "group_detail.php?groupid=" . $grouplist[$i]['group_id'];
        }
        print_grouplist_html($grouplist);
    } elseif (!$showgroupaddform) {
        $text = "<a href=\"http://" . $_SERVER['HTTP_HOST'] . DIR . "group.php?mode=add\">create one now!</a>";
        print_pageitem_text_html("No groups found", $text);
    }
    if ($showgroupaddlink) {
        $url = "http://" . $_SERVER['HTTP_HOST'] . DIR . "group.php?mode=add";
        $name = "Add Group";
        print_topbutton_html($name, $url);
    }
}
print_footer($user, 1);
示例#5
0
include "inc/common.php";
// check if valid group specified and return group details
$groupdetails = check_group($_POST, $_GET);
// get permisssions for group
if (!($permissions = group_permissions($groupdetails['group_id'], $user->data['user_id']))) {
    fatal_error("No permissions for this group");
}
// Start HTML output
print_header();
// array structure: $bararray['title'], $bararray['leftnav'][$i][name|url], $bararray['rightnav'][$i][name|url]
$topbar['title'] = $groupdetails['name'];
$topbar['leftnav'][0]['name'] = "Back";
$topbar['leftnav'][0]['url'] = "http://" . $_SERVER['HTTP_HOST'] . DIR . "group_detail.php?groupid=" . $groupdetails['group_id'];
print_topbar($topbar);
print_body_start();
print_pageitem_text_html("Login log for " . $groupdetails['name'] . ":");
$memberlist = get_groupmembers($groupdetails['group_id']);
$groupmemberids = get_groupmember_ids($memberlist);
$user_expenses = get_user_expenses($groupmemberids);
$user_paid_expenses = get_user_paid_expenses($groupmemberids);
$size = count($memberlist);
for ($i = 0; $i < $size; $i++) {
    if (!empty($memberlist[$i]['username'])) {
        $uname = " (" . $memberlist[$i]['username'] . ")";
    } else {
        $uname = "";
    }
    $uexpense = $user_expenses['users'][$memberlist[$i][user_id]]['groups'][$groupdetails['group_id']]['group_total'];
    $upaid = $user_paid_expenses['users'][$memberlist[$i][user_id]]['groups'][$groupdetails['group_id']]['group_total'];
    $listarray[$i]['link'] = "http://" . $_SERVER['HTTP_HOST'] . DIR . "profile.php?uid=" . $memberlist[$i][user_id];
    //$listarray[$i]['name'] = $memberlist[$i]['realname'] . $uname;
示例#6
0
        $title = "Going Dutch - The expense overview page";
        $text[] = "An application to manage al your group expense needs";
        $text[] = "Copyright 2010 - InThere";
        break;
    case 5:
        // register page
        $title = "Going Dutch - Registering and logging in";
        $text[] = "An application to manage al your group expense needs";
        $text[] = "Copyright 2010 - InThere";
        break;
    case 6:
        // profile page
        $title = "Going Dutch - Your profile page";
        $text[] = "An application to manage al your group expense needs";
        $text[] = "Copyright 2010 - InThere";
        break;
    case 7:
        // expense detail  page
        $title = "Going Dutch - Expense detail page";
        $text[] = "An application to manage al your group expense needs";
        $text[] = "Copyright 2010 - InThere";
        break;
}
print_header();
$topbar['title'] = "Help";
$topbar['leftnav'][0]['name'] = "Back";
$topbar['leftnav'][0]['url'] = $url;
print_topbar($topbar);
print_body_start();
print_pageitem_text_html($title, $text);
示例#7
0
    $listarray[$i]['balance'] = $upaid - $uexpense;
    $listarray[$i]['user_id'] = $memberlist[$i]['user_id'];
}
//print_memberlist_html($listarray, SORT_DESC);
$a = 1;
$settle_array = close_group_expenses($listarray);
if ($mode == 'settle') {
    // Start HTML output
    print_header();
    // array structure: $bararray['title'], $bararray['leftnav'][$i][name|url], $bararray['rightnav'][$i][name|url]
    $topbar['title'] = $groupdetails['name'];
    $topbar['leftnav'][0]['name'] = "Back";
    $topbar['leftnav'][0]['url'] = "http://" . $_SERVER['HTTP_HOST'] . DIR . "group_detail.php?groupid=" . $groupdetails['group_id'];
    print_topbar($topbar);
    print_body_start();
    print_pageitem_text_html("These transactions will give every member a zero balance.");
    // even out the balances
    print_settle_group_list_html($settle_array);
    // show link to the transactions to settle balances
    if (array_key_exists(0, $permissions)) {
        $purl = "http://" . $_SERVER['HTTP_HOST'] . DIR . "settle_group.php?groupid=" . $groupdetails['group_id'];
        $formarray['action'] = $purl;
        $formarray['rows'][1]['items'] = "|mode|hidden|mark";
        $formarray['rows'][2]['items'] = "|groupid|hidden|" . $groupdetails['group_id'];
        $formarray['rows'][3]['items'] = "||submit|Mark these transactions paid";
        echo create_form_html($formarray);
        unset($formarray);
    }
} elseif ($mode == 'mark') {
    // Start HTML output
    print_header();