Ejemplo n.º 1
0
 /**
  * Delete user
  * @access  public
  * @param   user_id
  * @return  true, if successful
  *          false and add error into global var $msg, if unsuccessful
  * @author  Cindy Qi Li
  */
 public function Delete($userIDs)
 {
     // delete customized guidelines created by user but yet open to public
     include_once AC_INCLUDE_PATH . 'classes/DAO/GuidelinesDAO.class.php';
     include_once AC_INCLUDE_PATH . 'classes/DAO/ChecksDAO.class.php';
     include_once AC_INCLUDE_PATH . 'classes/DAO/UserLinksDAO.class.php';
     include_once AC_INCLUDE_PATH . 'classes/Utility.class.php';
     $userIDs = Utility::sanitizeIntArray($userIDs);
     $guidelinesDAO = new GuidelinesDAO();
     $guidelines = $guidelinesDAO->getGuidelineByUserIDs($userIDs);
     if (is_array($guidelines)) {
         foreach ($guidelines as $guideline) {
             if ($guideline['open_to_public'] == 0) {
                 $guidelinesDAO->Delete($guideline['guideline_id']);
             }
         }
     }
     // delete customized checks created by user but yet open to public
     $checksDAO = new ChecksDAO();
     $checks = $checksDAO->getCheckByUserIDs($userIDs);
     if (is_array($checks)) {
         foreach ($checks as $check) {
             if ($check['open_to_public'] == 0) {
                 $checksDAO->Delete($check['check_id']);
             }
         }
     }
     // delete user links and decisions generated by this user
     $userLinksDAO = new UserLinksDAO();
     $userLinks = $userLinksDAO->DeleteByUserID($userIDs);
     $sql = "DELETE FROM " . TABLE_PREFIX . "users\n\t\t         WHERE user_id in (" . implode(",", $userIDs) . ")";
     return $this->execute($sql);
 }
Ejemplo n.º 2
0
/* 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/DAO/GuidelinesDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/UserLinksDAO.class.php';
// main process to save decisions
$guidelinesDAO = new GuidelinesDAO();
$guideline_rows = $guidelinesDAO->getGuidelineByIDs($_POST['gids']);
if (!is_array($guideline_rows)) {
    echo _AC("AC_ERROR_EMPTY_GID");
    exit;
}
$utility = new Utility();
$seals = $utility->getSeals($guideline_rows);
if (is_array($seals)) {
    $userLinksDAO = new UserLinksDAO();
    $rows = $userLinksDAO->getByUserIDAndURIAndSession($_SESSION['user_id'], $_POST['uri'], $_POST['jsessionid']);
    $savant->assign('user_link_id', $rows[0]['user_link_id']);
    $savant->assign('seals', $seals);
    $savant->display('checker/seals.tmpl.php');
}
exit;
Ejemplo n.º 3
0
    die("Error: AC_INCLUDE_PATH is not defined in checker_input_form.php.");
}
global $_current_user, $decision_error;
$default_uri_value = "";
$num_of_guidelines_per_row = 3;
// default number of guidelines to display in a row on the page
if (!isset($_POST["checkbox_gid"])) {
    $_POST["checkbox_gid"] = array(DEFAULT_GUIDELINE);
}
if (!isset($_POST["radio_gid"])) {
    $_POST["radio_gid"] = array(DEFAULT_GUIDELINE);
}
if (!isset($_POST["rpt_format"])) {
    $_POST["rpt_format"] = REPORT_FORMAT_GUIDELINE;
}
$guidelinesDAO = new GuidelinesDAO();
$open_guidelines = $guidelinesDAO->getOpenGuidelines();
$savant->assign('default_uri_value', $default_uri_value);
$savant->assign('num_of_guidelines_per_row', $num_of_guidelines_per_row);
if (isset($_current_user)) {
    $user_guidelines = $guidelinesDAO->getClosedEnabledGuidelinesByUserID($_SESSION['user_id']);
    if (is_array($user_guidelines)) {
        $guidelines = array_merge($open_guidelines, $user_guidelines);
    } else {
        $guidelines = $open_guidelines;
    }
} else {
    $guidelines = $open_guidelines;
}
if (isset($decision_error)) {
    $savant->assign('error', $decision_error);
Ejemplo n.º 4
0
<?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$
define('AC_INCLUDE_PATH', '../include/');
include AC_INCLUDE_PATH . 'vitals.inc.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/GuidelinesDAO.class.php';
$gid = intval($_GET["id"]);
$guidelinesDAO = new GuidelinesDAO();
$rows = $guidelinesDAO->getGuidelineByIDs($gid);
if (!$rows) {
    global $msg;
    $msg->addError('GUIDELINE_NOT_FOUND');
    header('Location: index.php');
} else {
    $savant->assign('row', $rows[0]);
    $savant->assign('gid', $gid);
    $savant->display('guideline/view_guideline.tmpl.php');
}
Ejemplo n.º 5
0
include_once AC_INCLUDE_PATH . 'classes/DAO/GuidelineSubgroupsDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/TestProcedureDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/TestExpectedDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/TestFailDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/CheckExamplesDAO.class.php';
$check_id = intval($_GET["id"]);
$checksDAO = new ChecksDAO();
$row = $checksDAO->getCheckByID($check_id);
if (!$row) {
    // invalid check id
    $msg->addError('INVALID_CHECK_ID');
    $msg->printAll();
    require AC_INCLUDE_PATH . 'footer.inc.php';
    exit;
}
$guidelinesDAO = new GuidelinesDAO();
$guideline_rows = $guidelinesDAO->getEnabledGuidelinesByCheckID($check_id);
$checkExamplesDAO = new CheckExamplesDAO();
$pass_examples = $checkExamplesDAO->getByCheckIDAndType($check_id, AC_CHECK_EXAMPLE_PASS);
$fail_examples = $checkExamplesDAO->getByCheckIDAndType($check_id, AC_CHECK_EXAMPLE_FAIL);
$guidelineGroupsDAO = new GuidelineGroupsDAO();
$guidelineSubgroupsDAO = new GuidelineSubgroupsDAO();
?>
<div class="output-form">
	
<h2><?php 
echo _AC("html_tag");
?>
</h2>
<span class="msg"><?php 
echo $row["html_tag"];
define('AC_INCLUDE_PATH', '../include/');
include AC_INCLUDE_PATH . 'vitals.inc.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/GuidelinesDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/GuidelineGroupsDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/GuidelineSubgroupsDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/SubgroupChecksDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/ChecksDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/UsersDAO.class.php';
global $_current_user;
if (isset($_GET["id"])) {
    $gid = intval($_GET["id"]);
}
if ($gid == 0) {
    unset($gid);
}
$guidelinesDAO = new GuidelinesDAO();
$guidelineGroupsDAO = new GuidelineGroupsDAO();
$guidelineSubgroupsDAO = new GuidelineSubgroupsDAO();
$subgroupChecksDAO = new SubgroupChecksDAO();
// handle submits
if (isset($_POST['cancel'])) {
    $msg->addFeedback('CANCELLED');
    header('Location: index.php');
    exit;
} else {
    if (isset($_POST['save_no_close']) || isset($_POST['save_and_close']) || $_POST['javascript_submit']) {
        if (isset($gid)) {
            $guidelinesDAO->update($gid, $_POST['user_id'], $_POST['title'], $_POST['abbr'], $_POST['long_name'], $_POST['published_date'], $_POST['earlid'], '', $_POST['status'], $_POST['open_to_public']);
        } else {
            $gid = $guidelinesDAO->Create($_SESSION['user_id'], $_POST['title'], $_POST['abbr'], $_POST['long_name'], $_POST['published_date'], $_POST['earlid'], '', $_POST['status'], $_POST['open_to_public']);
            if (intval($gid) == 0) {
Ejemplo n.º 7
0
if (isset($htmlValidator)) {
    $num_of_html_errors = $htmlValidator->getNumOfValidateError();
    $savant->assign('htmlValidator', $htmlValidator);
    $savant->assign('num_of_html_errors', $num_of_html_errors);
}
// CSS Validator
if (isset($cssValidator)) {
    $num_of_css_errors = $cssValidator->getNumOfValidateError();
    $savant->assign('cssValidator', $cssValidator);
    $savant->assign('num_of_css_errors', $num_of_css_errors);
}
if (isset($aValidator)) {
    global $_gids;
    // array of the guideline_ids that have been validated against. initialized in checker/index.php
    // find out selected guidelines
    $guidelinesDAO = new GuidelinesDAO();
    $guideline_rows = $guidelinesDAO->getGuidelineByIDs($_gids);
    $guidelines_text = "";
    if (is_array($guideline_rows)) {
        foreach ($guideline_rows as $id => $row) {
            $guidelines_text .= '<a title="' . $row["title"] . _AC('link_open_in_new') . '" target="_new" href="' . AC_BASE_HREF . 'guideline/view_guideline.php?id=' . $row["guideline_id"] . '">' . $row["title"] . '</a>, ';
        }
    }
    $guidelines_text = substr($guidelines_text, 0, -2);
    // remove ending space and ,
    $num_of_total_a_errors = $aValidator->getNumOfValidateError();
    $errors = $aValidator->getValidationErrorRpt();
    // if it's a LOGIN user validates URI, save into database for user to make decision.
    // Note that results of validating uploaded files are not saved
    $user_link_id = '';
    $allow_set_decision = 'false';
Ejemplo n.º 8
0
 /**
  * public
  * main process of creating file
  * @param
  * $title: validated content title (fount in <title> tag); if empty title will not be displayed
  * $uri: validated content URL (only in case of url input); if empty URL will not be displayed
  * $problem: problem type on which to create report (can be: known, likely, potential, html, css or all)
  * $mode: 'guideline' or 'line'; pdf document may have different layout (for known, likely, potential) depending on this var
  * $_gids: array of guidelines that were used as testing criteria
  */
 public function getPDF($title, $uri, $problem, $mode, $_gids)
 {
     // set filename
     $date = AC_date('%Y-%m-%d');
     $time = AC_date('%H-%i-%s');
     $filename = 'achecker_' . $date . '_' . $time . $rand_str;
     $guidelinesDAO = new GuidelinesDAO();
     $guideline_rows = $guidelinesDAO->getGuidelineByIDs($_gids);
     // get list of guidelines separated by ','
     if (is_array($guideline_rows)) {
         foreach ($guideline_rows as $id => $row) {
             $guidelines_text .= $row["title"] . ', ';
         }
     }
     $guidelines_text = substr($guidelines_text, 0, -2);
     // remove ending space and ,
     // print time, date, [resource title,] [resource url,] str with guidelines
     $this->printInfo($title, $uri, $guidelines_text, $time);
     // if report by guideline
     if ($mode == 'guideline') {
         if ($problem == 'all') {
             $this->printGuideline('known');
             $this->AddPage();
             $this->printGuideline('likely');
             $this->AddPage();
             $this->printGuideline('potential');
             if ($this->error_nr_html != -1) {
                 $this->AddPage();
                 $this->printHTML();
             }
             if ($this->error_nr_css != -1) {
                 $this->AddPage();
                 $this->printCSS();
             }
         } else {
             if ($problem == 'html') {
                 $this->printHTML();
             } else {
                 if ($problem == 'css') {
                     $this->printCSS();
                 } else {
                     $this->printGuideline($problem);
                 }
             }
         }
     } else {
         if ($mode == 'line') {
             if ($problem == 'all') {
                 $this->printLine('known');
                 $this->AddPage();
                 $this->printLine('likely');
                 $this->AddPage();
                 $this->printLine('potential');
                 if ($this->error_nr_html != -1) {
                     $this->AddPage();
                     $this->printHTML();
                 }
                 if ($this->error_nr_css != -1) {
                     $this->AddPage();
                     $this->printCSS();
                 }
             } else {
                 if ($problem == 'html') {
                     $this->printHTML();
                 } else {
                     if ($problem == 'css') {
                         $this->printCSS();
                     } else {
                         $this->printLine($problem);
                     }
                 }
             }
         }
     }
     // close and save PDF document
     $path = AC_EXPORT_RPT_DIR . $filename . '.pdf';
     $this->Output($path, 'F');
     return $path;
 }
Ejemplo n.º 9
0
    }
    $user_id = $user_row['user_id'];
}
// return errors
if (is_array($errors)) {
    if ($output == 'rest') {
        header('Content-type: text/xml');
        echo RESTWebServiceOutput::generateErrorRpt($errors);
    } else {
        echo HTMLRpt::generateErrorRpt($errors);
    }
    exit;
}
// generate guidelines
$guides = explode(',', $guide);
$guidelinesDAO = new GuidelinesDAO();
foreach ($guides as $abbr) {
    if ($abbr == '') {
        continue;
    }
    $row = $guidelinesDAO->getEnabledGuidelinesByAbbr($abbr);
    if ($row[0]['guideline_id'] != '') {
        $gids[] = $row[0]['guideline_id'];
    }
}
// set to default guideline if no input guidelines
if (!is_array($gids)) {
    $gids[] = DEFAULT_GUIDELINE;
}
// retrieve user link ID
$userLinksDAO = new UserLinksDAO();
Ejemplo n.º 10
0
 /**
  * private
  * writes AChecker info, date, time [, url] [, title] and guidelines
  * returns them as CSV string
  * @param
  * $input_content_type: 'file', 'paste' or http://file_path
  * $title: validated content title (fount in <title> tag); if empty title will not be displayed
  * $_gids: array of guidelines that were used as testing criteria
  * $date: date when function to create file called (showed in file title and inside document)
  * $time: time when function to create file called (showed in file title and inside document)
  */
 private function getInfo($input_content_type, $title, $_gids, $date, $time)
 {
     // achecker info
     $file_content = _AC('file_title') . DELIM . 'version ' . VERSION . DELIM . $this->prepareStr(_AC('file_description')) . EOL . $this->achecker_file_url . EOL . EOL;
     // date, time
     $file_content .= str_replace("-", ".", $date) . ' ' . str_replace("-", ":", $time) . EOL;
     // test info
     if ($input_content_type != 'file' && $input_content_type != 'paste') {
         $file_content .= _AC('file_source_url') . DELIM . $input_content_type . EOL;
     } else {
         $file_content .= EOL;
     }
     if ($title != '') {
         $file_content .= _AC('file_source_title') . DELIM . $title . EOL;
     } else {
         $file_content .= EOL;
     }
     // guidelines
     $file_content .= EOL;
     $guidelinesDAO = new GuidelinesDAO();
     $guideline_rows = $guidelinesDAO->getGuidelineByIDs($_gids);
     if (is_array($guideline_rows)) {
         foreach ($guideline_rows as $id => $row) {
             $file_content .= $row["abbr"] . DELIM . _AC($row["long_name"]) . EOL;
         }
     }
     return $file_content;
 }
Ejemplo n.º 11
0
    /**
     * private
     * prints Assertor, Test Subject, Test Criterion Sections
     * @param
     * $input_content_type: 'file', 'paste' or http://file_path
     * $title: validated content title (fount in <title> tag); if empty title will not be displayed
     * $_gids: array of guidelines that were used as testing criteria
     * $date: date when function to create file called (showed in file title and inside document)
     * returns these sections as string
     */
    private function getAssertorTestSubjectTestCriterionSections($input_content_type, $title, $_gids, $date)
    {
        // assertor
        $file_content = '<rdf:RDF
         xmlns:earl="http://www.w3.org/ns/earl#"
         xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
         xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
         
         <!-- Assertor -->
         ';
        $user_data = $this->getUserData();
        if ($user_data) {
            $username = $user_data[0];
            $email = $user_data[1];
            $file_content .= '<foaf:Group rdf:ID="assertor01">
			<dct:title>' . $username . ' and ' . _AC('file_title') . '</dct:title>
			<dct:hasVersion>' . VERSION . '</dct:hasVersion>
			<dct:description xml:lang="en">
				' . _AC('file_description') . '
			</dct:description>
			<earl:mainAssertor rdf:resource="' . $this->achecker_url . '"/>
			<foaf:member>
				<foaf:Person>
					<foaf:mbox rdf:resource="mailto:' . $email . '"/>
					<foaf:name>' . $username . '</foaf:name>
				</foaf:Person>
			</foaf:member>
		</foaf:Group>
		
		';
        } else {
            $file_content .= '<earl:Software rdf:about="' . $this->achecker_url . '">
			<dct:title xml:lang="en">' . _AC('file_title') . '</dct:title>
			<dct:hasVersion>' . VERSION . '</dct:hasVersion>
			<dct:description xml:lang="en">
				' . _AC('file_description') . '
			</dct:description>
		</earl:Software>
		
		';
        }
        // test subject
        $file_content .= '<!-- Test Subject -->
		';
        if ($input_content_type == 'file') {
            $file_content .= '<earl:TestSubject xml:lang="en">' . _AC('file_input_file') . '</earl:TestSubject>';
        } else {
            if ($input_content_type == 'paste') {
                $file_content .= '<earl:TestSubject xml:lang="en">' . _AC('file_input_paste') . '</earl:TestSubject>';
            } else {
                $file_content .= '<earl:TestSubject rdf:about="' . $input_content_type . '">';
                $file_content .= '
			<dct:title xml:lang="en">' . $title . '</dct:title>';
                $file_content .= '
			<dct:date>' . $date . '</dct:date>
		</earl:TestSubject>
		
		';
            }
        }
        // test criterion
        $file_content .= '<!-- Test Criterion -->
		';
        $guidelinesDAO = new GuidelinesDAO();
        $guideline_rows = $guidelinesDAO->getGuidelineByIDs($_gids);
        // display guidelines
        if (is_array($guideline_rows)) {
            foreach ($guideline_rows as $id => $row) {
                $file_content .= '<earl:TestRequirement rdf:about="' . $row["earlid"] . '">
			<dct:title xml:lang="en">' . $row["abbr"] . '</dct:title>
			<dct:description xml:lang="en">' . _AC($row["long_name"]) . '</dct:description>
		</earl:TestRequirement>
		
		';
            }
        }
        return $file_content;
    }
Ejemplo n.º 12
0
// $Id$
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/DAO/GuidelinesDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/ChecksDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/UserLinksDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/Decision.class.php';
global $starttime;
$mtime = microtime();
$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));
 /**
  * private
  * main process to generate report in html format
  */
 private function generateRESTRpt()
 {
     $num_of_errors = 0;
     $num_of_likely_problems = 0;
     $num_of_potential_problems = 0;
     $checksDAO = new ChecksDAO();
     $userDecisionsDAO = new UserDecisionsDAO();
     // generate section details
     foreach ($this->errors as $error) {
         // generate each error result
         $result_type = '';
         $repair = '';
         $decision = '';
         $decision_questions = '';
         $decision_made = '';
         $row_check = $checksDAO->getCheckByID($error["check_id"]);
         if ($row_check["confidence"] == KNOWN) {
             // only known errors have <repair>
             $num_of_errors++;
             $result_type = _AC('error');
             $repair = str_replace('{REPAIR}', htmlentities(_AC($row_check["how_to_repair"])), $this->rest_repair);
         } else {
             // generate user's decision. only likely and potential problems have decisions to make
             $row_userDecision = $userDecisionsDAO->getByUserLinkIDAndLineNumAndColNumAndCheckID($this->userLinkID, $error["line_number"], $error["col_number"], $error['check_id']);
             if ($row_userDecision['decision'] == AC_DECISION_PASS || $row_userDecision['decision'] == AC_DECISION_FAIL) {
                 if ($row_userDecision['decision'] == AC_DECISION_PASS) {
                     $decision_text = _AC('pass');
                 }
                 if ($row_userDecision['decision'] == AC_DECISION_FAIL) {
                     $decision_text = _AC('fail');
                 }
                 $decision_made = str_replace(array('{DECISIONMADE}', '{DECISIONMADEDATE}'), array(htmlentities($decision_text), $row_userDecision['last_update']), $this->rest_decision_made);
             }
             if ($row_check["confidence"] == LIKELY) {
                 $result_type = _AC('likely_problem');
                 if (!$row_userDecision || $row_userDecision['decision'] == AC_DECISION_FAIL) {
                     $num_of_likely_problems++;
                 }
             }
             if ($row_check["confidence"] == POTENTIAL) {
                 $result_type = _AC('potential_problem');
                 if (!$row_userDecision || $row_userDecision['decision'] == AC_DECISION_FAIL) {
                     $num_of_potential_problems++;
                 }
             }
             $decision_questions = str_replace(array('{SEQUENCEID}', '{DECISIONPASS}', '{DECISIONFAIL}'), array($error['line_number'] . '_' . $error['col_number'] . '_' . $error['check_id'], htmlentities(_AC($row_check['decision_pass'])), htmlentities(_AC($row_check['decision_fail']))), $this->rest_decision_questions);
             $decision = $decision_questions . $decision_made;
             // end of generating user's decision
         }
         $result .= str_replace(array('{RESULTTYPE}', '{LINENUM}', '{COLUMNNUM}', '{BASE_HREF}', '{CHECK_ID}', '{TITLE}', '{ERRORMSG}', '{ERRORSOURCECODE}', '{REPAIR}', '{DECISION}'), array($result_type, $error["line_number"], $error["col_number"], htmlentities(AC_BASE_HREF), $error['check_id'], htmlentities(_AC("suggest_improvements")), htmlentities(_AC($row_check['err'])), htmlentities($error["html_code"], ENT_QUOTES, "UTF-8"), $repair, $decision), $this->rest_result);
     }
     // retrieve session id
     $userLinksDAO = new UserLinksDAO();
     $row = $userLinksDAO->getByUserLinkID($this->userLinkID);
     $sessionID = $row['last_sessionID'];
     // generate guidelines
     $guidelinesDAO = new GuidelinesDAO();
     foreach ($this->guidelineArray as $gid) {
         $row_guideline = $guidelinesDAO->getGuidelineByIDs($gid);
         $guidelines .= str_replace('{GUIDELINE}', htmlentities($row_guideline[0]['title']), $this->rest_guideline);
     }
     // find out result status: pass, fail, conditional pass
     if ($num_of_errors > 0) {
         $status = _AC('fail');
     } else {
         if ($num_of_likely_problems + $num_of_potential_problems > 0) {
             $status = _AC('conditional_pass');
         } else {
             $status = _AC('pass');
         }
     }
     // generate final output
     $this->output = str_replace(array('{STATUS}', '{SESSIONID}', '{NUMOFERRORS}', '{NUMOFLIKELYPROBLEMS}', '{NUMOFPOTENTIALPROBLEMS}', '{GUIDELINES}', '{RESULTS}'), array($status, $sessionID, $num_of_errors, $num_of_likely_problems, $num_of_potential_problems, $guidelines, $result), $this->rest_main);
 }
Ejemplo n.º 14
0
/************************************************************************/
// $Id$
define('AC_INCLUDE_PATH', '../include/');
include_once AC_INCLUDE_PATH . 'vitals.inc.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/ChecksDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/CheckPrerequisitesDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/TestPassDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/CheckExamplesDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/GuidelinesDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/UsersDAO.class.php';
if (isset($_GET['id'])) {
    $check_id = $_GET['id'];
}
$checkPrerequisitesDAO = new CheckPrerequisitesDAO();
$testPassDAO = new TestPassDAO();
$guidelinesDAO = new GuidelinesDAO();
$checkExamplesDAO = new CheckExamplesDAO();
// handle submit
if (isset($_POST['cancel'])) {
    header('Location: index.php');
    exit;
} else {
    if (isset($_POST['save_no_close']) || isset($_POST['save_and_close']) || $_POST['javascript_submit']) {
        $checksDAO = new ChecksDAO();
        if (!isset($check_id)) {
            $check_id = $checksDAO->Create($_SESSION['user_id'], $_POST['html_tag'], $_POST['confidence'], $_POST['note'], $_POST['name'], $_POST['err'], $_POST['description'], $_POST['search_str'], $_POST['long_description'], $_POST['rationale'], $_POST['how_to_repair'], $_POST['repair_example'], $_POST['question'], $_POST['decision_pass'], $_POST['decision_fail'], $_POST['test_procedure'], $_POST['test_expected_result'], $_POST['test_failed_result'], $_POST['open_to_public']);
        } else {
            $checksDAO->Update($check_id, $_SESSION['user_id'], $_POST['html_tag'], $_POST['confidence'], $_POST['note'], $_POST['name'], $_POST['err'], $_POST['description'], $_POST['search_str'], $_POST['long_description'], $_POST['rationale'], $_POST['how_to_repair'], $_POST['repair_example'], $_POST['question'], $_POST['decision_pass'], $_POST['decision_fail'], $_POST['test_procedure'], $_POST['test_expected_result'], $_POST['test_failed_result'], $_POST['open_to_public']);
        }
        if (!$msg->containsErrors()) {
            // re-create check examples
 /**
  * set guideline string used to replace $html_main.{GUIDELINE}
  * @access  private
  * @param   none
  * @return  set $guidelineStr
  * @author  Cindy Qi Li
  */
 private function setGuidelineStr()
 {
     if (!is_array($this->guidelineIDs)) {
         return '';
     }
     $guidelinesDAO = new GuidelinesDAO();
     $rows = $guidelinesDAO->getGuidelineByIDs($this->guidelineIDs);
     unset($this->guidelineStr);
     if (is_array($rows)) {
         foreach ($rows as $id => $row) {
             $this->guidelineStr .= str_replace(array('{TITLE}', '{HREF}'), array($row['title'] . _AC('link_open_in_new'), AC_BASE_HREF . 'guideline/view_guideline.php?id=' . $row['guideline_id']), $this->html_a) . "&nbsp;&nbsp;";
         }
     }
 }
Ejemplo n.º 16
0
 /**
  * get guideline string used to replace $html_main.{GUIDELINE}
  */
 private function getGuidelineStr($_gids, $problem)
 {
     $guidelineStr = '';
     if ($problem == 'html' || $problem == 'css') {
         // do not show if validation data only required
         return $guidelineStr;
     } else {
         $guidelinesDAO = new GuidelinesDAO();
         $guideline_rows = $guidelinesDAO->getGuidelineByIDs($_gids);
         if (is_array($guideline_rows)) {
             foreach ($guideline_rows as $id => $row) {
                 $guidelineStr .= '<strong>Guides: </strong>' . str_replace(array('{TITLE}', '{HREF}'), array($row['title'] . _AC('link_open_in_new'), AC_BASE_HREF . 'guideline/view_guideline.php?id=' . $row['guideline_id']), $this->html_a) . "&nbsp;&nbsp;";
             }
         }
         return $guidelineStr;
     }
 }
Ejemplo n.º 17
0
/************************************************************************/
/* 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$
define('AC_INCLUDE_PATH', '../include/');
include AC_INCLUDE_PATH . 'vitals.inc.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/GuidelinesDAO.class.php';
global $_current_user;
$guidelinesDAO = new GuidelinesDAO();
if ((isset($_POST['delete']) || isset($_POST['view']) || isset($_POST['edit']) || isset($_POST['open_to_public']) || isset($_POST['close_from_public'])) && !isset($_POST['id'])) {
    $msg->addError('NO_ITEM_SELECTED');
} else {
    if ($_POST['view']) {
        header('Location: view_guideline.php?id=' . $_POST['id']);
        exit;
    } else {
        if ($_POST['delete']) {
            header('Location: delete_guideline.php?id=' . $_POST['id']);
            exit;
        } else {
            if ($_POST['edit']) {
                header('Location: create_edit_guideline.php?id=' . $_POST['id']);
                exit;
            } else {
Ejemplo n.º 18
0
/* as published by the Free Software Foundation.                        */
/************************************************************************/
// $Id$
define('AC_INCLUDE_PATH', '../include/');
include AC_INCLUDE_PATH . 'vitals.inc.php';
include AC_INCLUDE_PATH . 'classes/DAO/ChecksDAO.class.php';
include AC_INCLUDE_PATH . 'classes/DAO/GuidelinesDAO.class.php';
include AC_INCLUDE_PATH . 'classes/DAO/GuidelineGroupsDAO.class.php';
include AC_INCLUDE_PATH . 'classes/DAO/GuidelineSubgroupsDAO.class.php';
include AC_INCLUDE_PATH . 'classes/DAO/CheckPrerequisitesDAO.class.php';
include AC_INCLUDE_PATH . 'classes/DAO/TestPassDAO.class.php';
// initialize constants
$results_per_page = 50;
$dao = new DAO();
$checksDAO = new ChecksDAO();
$guidelinesDAO = new GuidelinesDAO();
$guidelineGroupsDAO = new GuidelineGroupsDAO();
$guidelineSubgroupsDAO = new GuidelineSubgroupsDAO();
$checkPrerequisitesDAO = new CheckPrerequisitesDAO();
$testPassDAO = new TestPassDAO();
// handle submit
if ((isset($_GET['edit']) || isset($_GET['edit_function']) || isset($_GET['delete']) || isset($_GET['add'])) && !isset($_GET['id'])) {
    $msg->addError('SELECT_ONE_ITEM');
} else {
    if (isset($_GET['edit'], $_GET['id'])) {
        header('Location: check_create_edit.php?id=' . $_GET['id']);
        exit;
    } else {
        if (isset($_GET['edit_function'], $_GET['id'])) {
            header('Location: check_function_edit.php?id=' . $_GET['id']);
            exit;
Ejemplo n.º 19
0
/************************************************************************/
/* 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$
define('AC_INCLUDE_PATH', '../include/');
include AC_INCLUDE_PATH . 'vitals.inc.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/GuidelinesDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/ChecksDAO.class.php';
$guidelinesDAO = new GuidelinesDAO();
if (isset($_POST['submit_no'])) {
    $msg->addFeedback('CANCELLED');
    header('Location: index.php');
    exit;
} else {
    if (isset($_POST['submit_yes'])) {
        if ($guidelinesDAO->Delete($_POST['id'])) {
            $msg->addFeedback('ACTION_COMPLETED_SUCCESSFULLY');
            header('Location: index.php');
            exit;
        }
    }
}
$rows = $guidelinesDAO->getGuidelineByIDs($_GET['id']);
unset($hidden_vars);