Exemple #1
0
/************************************************************************/
// $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;
        } else {
<?php 
        }
        // end of foreach
        ?>
		</tbody>
	</table>
	<br/>
</form>
<?php 
    }
    // end of if
}
global $onload;
$onload = "initial();";
$gid = $this->gid;
$guidelineGroupsDAO = new GuidelineGroupsDAO();
$guidelineSubgroupsDAO = new GuidelineSubgroupsDAO();
include AC_INCLUDE_PATH . 'header.inc.php';
?>
<script type='text/javascript' src='jscripts/calendar.js'></script>

<div class="input-form">

<fieldset class="group_form"><legend class="group_form"><?php 
echo _AC('create_edit_guideline');
?>
</legend>

<form name="input_form" method="post" action="<?php 
echo $_SERVER['PHP_SELF'];
if (isset($_GET["id"])) {
 /**
  * Delete guideline by ID
  * @access  public
  * @param   $guidelineID : guideline id
  * @return  true : if successful
  *          false : if unsuccessful
  * @author  Cindy Qi Li
  */
 public function Delete($guidelineID)
 {
     require_once AC_INCLUDE_PATH . 'classes/DAO/GuidelineGroupsDAO.class.php';
     $guidelineID = intval($guidelineID);
     // Delete all subgroups
     $guidelineGroupsDAO = new GuidelineGroupsDAO();
     $sql = "SELECT group_id FROM " . TABLE_PREFIX . "guideline_groups\n\t\t         WHERE guideline_id = " . $guidelineID;
     $rows = $this->execute($sql);
     if (is_array($rows)) {
         foreach ($rows as $row) {
             $guidelineGroupsDAO->Delete($row['group_id']);
         }
     }
     // delete language for long name
     $sql = "DELETE FROM " . TABLE_PREFIX . "language_text \n\t\t         WHERE variable='_guideline' \n\t\t           AND term=(SELECT long_name \n\t\t                       FROM " . TABLE_PREFIX . "guidelines\n\t\t                      WHERE guideline_id=" . $guidelineID . ")";
     $this->execute($sql);
     $sql = "DELETE FROM " . TABLE_PREFIX . "guidelines WHERE guideline_id=" . $guidelineID;
     return $this->execute($sql);
 }
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) {
                unset($gid);
/* 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_once AC_INCLUDE_PATH . 'vitals.inc.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/ChecksDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/GuidelineGroupsDAO.class.php';
include_once AC_INCLUDE_PATH . 'classes/DAO/GuidelineSubgroupsDAO.class.php';
if (!isset($_REQUEST['gid']) && !isset($_REQUEST['ggid']) && !isset($_REQUEST['gsgid']) || !isset($_REQUEST['action'])) {
    include AC_INCLUDE_PATH . 'header.inc.php';
    $msg->addError('MISSING_GID');
    include AC_INCLUDE_PATH . 'footer.inc.php';
    exit;
}
$guidelineGroupsDAO = new GuidelineGroupsDAO();
$guidelineSubgroupsDAO = new GuidelineSubgroupsDAO();
if (isset($_POST['submit'])) {
    $name = trim($_POST['name']);
    if ($name == '') {
        $msg->addError(array('EMPTY_FIELDS', _AC('name')));
    }
    if (!$msg->containsErrors()) {
        if ($_GET['action'] == 'add') {
            if (isset($_GET['gid'])) {
                // add group into guideline
                $guidelineGroupsDAO->Create($_GET['gid'], $name, '', '');
            }
            if (isset($_GET['ggid'])) {
                // add group into guideline
                $guidelineSubgroupsDAO->Create($_GET['ggid'], $name, '');
$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"];
?>
</span>

<h2><?php 
echo _AC("error_type");