예제 #1
0
function updatemembers_POST(Web &$w)
{
    $arrdb = array();
    $arrdb['report_id'] = $_REQUEST['report_id'];
    $arrdb['role'] = $_REQUEST['role'];
    $arrdb['is_deleted'] = 0;
    $member = $_REQUEST['member'];
    // for each selected member, complete population of input array
    $arrdb['user_id'] = $member;
    // find member against report ID
    $mem = $w->Report->getReportMember($arrdb['report_id'], $arrdb['user_id']);
    // if no membership, create it, otherwise update and continue
    if (!$mem) {
        $mem = new ReportMember($w);
        $mem->fill($arrdb);
        $mem->insert();
    } else {
        $mem->fill($arrdb);
        $mem->update();
    }
    // return
    $w->msg("Member Group updated", "/report/edit/" . $arrdb['report_id'] . "#members");
}
예제 #2
0
function savereport_POST(Web &$w)
{
    $w->Report->navigation($w, "Create Report");
    // get type of statement: select/insert/update/delete
    $_POST['sqltype'] = $w->Report->getSQLStatementType($_POST['report_code']);
    // insert report into database
    $report = new Report($w);
    $report->fill($_POST);
    $report->insert();
    // if insert successful, make creator a MEMBER of this report
    if ($report->id) {
        $arr['report_id'] = $report->id;
        $arr['user_id'] = $w->session('user_id');
        $mem = new ReportMember($w);
        $mem->fill($arr);
        $mem->insert();
    }
    $w->msg("Report created", "/report/index/");
}