Exemple #1
0
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$starttime = $mtime;
// input_form - array in session that contains latest user request (needed for file export)
unset($_SESSION['input_form']);
$guidelinesDAO = new GuidelinesDAO();
// process to make decision
if (isset($_POST['make_decision']) || isset($_POST['reverse'])) {
    $decision = new Decision($_SESSION['user_id'], $_POST['uri'], $_POST['output'], $_POST['jsessionid']);
    if ($decision->hasError()) {
        $decision_error = $decision->getErrorRpt();
        // displays in checker_input_form.tmpl.php
    } else {
        // make decsions
        if (isset($_POST['make_decision'])) {
            $decision->makeDecisions($_POST['d']);
        }
        // reverse decision
        if (isset($_POST['reverse'])) {
            foreach ($_POST['reverse'] as $sequenceID => $garbage) {
                $decision->makeDecisions(array($sequenceID => AC_NO_DECISION));
            }
        }
    }
}
// end of process to made decision
// validate referer URIs that has passed validation and received seal. The click on the seal triggers
// the if - else below.
if ($_GET['uri'] == 'referer') {
    // validate if the URI from referer matches the URI defined in user_links.user_link_id
    if (isset($_GET['id'])) {
        $errors[] = 'AC_ERROR_INVALID_WEB_SERVICE_ID';
    } else {
        $user_id = $user_row['user_id'];
    }
}
if (!is_array($decisions)) {
    $errors[] = 'AC_ERROR_SEQUENCEID_NOT_GIVEN';
}
// return errors
if (is_array($errors)) {
    if ($output == 'rest') {
        echo RESTWebServiceOutput::generateErrorRpt($errors);
    } else {
        echo HTMLRpt::generateErrorRpt($errors);
    }
    exit;
}
// make decisions
$decision = new Decision($user_id, $uri, $output, $session_id);
if ($decision->hasError()) {
    $decision_error = $decision->getErrorRpt();
    // displays in checker_input_form.tmpl.php
} else {
    // make decsions
    $decision->makeDecisions($decisions);
    if ($output == 'rest') {
        echo RESTWebServiceOutput::generateSuccessRpt();
    } else {
        echo HTMLRpt::generateSuccessRpt();
    }
}
<?php

/************************************************************************/
/* AChecker                                                             */
/************************************************************************/
/* Copyright (c) 2008 - 2011                                            */
/* Inclusive Design Institute                                           */
/*                                                                      */
/* This program is free software. You can redistribute it and/or        */
/* modify it under the terms of the GNU General Public License          */
/* as published by the Free Software Foundation.                        */
/************************************************************************/
// $Id: index.php 495 2011-02-10 21:27:00Z cindy $
// Called by ajax request from guidelineline view report -> "make decision(s)" buttons
// @ see checker/js/checker.js
define('AC_INCLUDE_PATH', '../include/');
include AC_INCLUDE_PATH . 'vitals.inc.php';
include_once AC_INCLUDE_PATH . 'classes/Utility.class.php';
include_once AC_INCLUDE_PATH . 'classes/Decision.class.php';
// main process to save decisions
$decision = new Decision($_SESSION['user_id'], $_POST['uri'], $_POST['output'], $_POST['jsessionid']);
if ($decision->hasError()) {
    $decision_error = $decision->getErrorRpt();
    // displays in checker_input_form.tmpl.php
    Utility::returnError($decision_error);
} else {
    // make decisions
    $decision->makeDecisions($_POST['d']);
    Utility::returnSuccess(_AC('saved_successfully'));
}
exit;