Ejemplo n.º 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 {
            if (isset($_GET['delete'], $_GET['id'])) {
        }
        // 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"])) {
    echo '?id=' . $_GET["id"];
 /**
  * Add checks into guideline
  * @access  public
  * @param   $guidelineID : guideline id
  *          $cids : array of check ids to be added into guideline
  * @return  true : if successful
  *          false : if unsuccessful
  * @author  Cindy Qi Li
  */
 public function addChecks($guidelineID, $cids)
 {
     require_once AC_INCLUDE_PATH . 'classes/DAO/GuidelineGroupsDAO.class.php';
     require_once AC_INCLUDE_PATH . 'classes/DAO/GuidelineSubgroupsDAO.class.php';
     require_once AC_INCLUDE_PATH . 'classes/DAO/SubgroupChecksDAO.class.php';
     $guidelineID = intval($guidelineID);
     if ($guidelineID == 0) {
         $msg->addError('MISSING_GID');
         return false;
     }
     $guidelineGroupsDAO = new GuidelineGroupsDAO();
     $groups = $guidelineGroupsDAO->getUnnamedGroupsByGuidelineID($guidelineID);
     if (is_array($groups)) {
         $group_id = $groups[0]['group_id'];
     } else {
         $group_id = $guidelineGroupsDAO->Create($guidelineID, '', '', '');
     }
     if ($group_id) {
         $guidelineSubgroupsDAO = new GuidelineSubgroupsDAO();
         $subgroups = $guidelineSubgroupsDAO->getUnnamedSubgroupByGroupID($group_id);
         if (is_array($subgroups)) {
             $subgroup_id = $subgroups[0]['subgroup_id'];
         } else {
             $subgroup_id = $guidelineSubgroupsDAO->Create($group_id, '', '');
         }
         if ($subgroup_id) {
             $subgroupChecksDAO = new SubgroupChecksDAO();
             if (is_array($cids)) {
                 foreach ($cids as $cid) {
                     $cid = intval($cid);
                     if ($cid > 0) {
                         $subgroupChecksDAO->Create($subgroup_id, $cid);
                     }
                 }
             }
         } else {
             return false;
         }
     } else {
         return false;
     }
     return true;
 }
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);
            }
Ejemplo n.º 5
0
/* 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, '');
            }
Ejemplo n.º 6
0
$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");
?>