Exemplo n.º 1
0
 /**
  * Delete a check by check ID
  * @access  public
  * @param   $checkID
  * @return  true / false
  * @author  Cindy Qi Li
  */
 function Delete($checkID)
 {
     $checkID = intval($checkID);
     // delete all languages
     require_once AC_INCLUDE_PATH . 'classes/DAO/LanguageTextDAO.class.php';
     require_once AC_INCLUDE_PATH . 'classes/DAO/CheckPrerequisitesDAO.class.php';
     require_once AC_INCLUDE_PATH . 'classes/DAO/TestPassDAO.class.php';
     require_once AC_INCLUDE_PATH . 'classes/DAO/SubgroupChecksDAO.class.php';
     require_once AC_INCLUDE_PATH . 'classes/DAO/Techniques.class.php';
     require_once AC_INCLUDE_PATH . 'classes/DAO/CheckExamplesDAO.class.php';
     $langTextDAO = new LanguageTextDAO();
     $row = $this->getCheckByID($checkID);
     if ($row['note'] != '') {
         $langTextDAO->DeleteByVarAndTerm('_check', $row['note']);
     }
     if ($row['name'] != '') {
         $langTextDAO->DeleteByVarAndTerm('_check', $row['name']);
     }
     if ($row['err'] != '') {
         $langTextDAO->DeleteByVarAndTerm('_check', $row['err']);
     }
     if ($row['description'] != '') {
         $langTextDAO->DeleteByVarAndTerm('_check', $row['description']);
     }
     if ($row['search_str'] != '') {
         $langTextDAO->DeleteByVarAndTerm('_check', $row['search_str']);
     }
     if ($row['long_description'] != '') {
         $langTextDAO->DeleteByVarAndTerm('_check', $row['long_description']);
     }
     if ($row['rationale'] != '') {
         $langTextDAO->DeleteByVarAndTerm('_check', $row['rationale']);
     }
     if ($row['how_to_repair'] != '') {
         $langTextDAO->DeleteByVarAndTerm('_check', $row['how_to_repair']);
     }
     if ($row['repair_example'] != '') {
         $langTextDAO->DeleteByVarAndTerm('_check', $row['repair_example']);
     }
     if ($row['question'] != '') {
         $langTextDAO->DeleteByVarAndTerm('_check', $row['question']);
     }
     if ($row['decision_pass'] != '') {
         $langTextDAO->DeleteByVarAndTerm('_check', $row['decision_pass']);
     }
     if ($row['decision_fail'] != '') {
         $langTextDAO->DeleteByVarAndTerm('_check', $row['decision_fail']);
     }
     if ($row['test_procedure'] != '') {
         $langTextDAO->DeleteByVarAndTerm('_check', $row['test_procedure']);
     }
     if ($row['test_expected_result'] != '') {
         $langTextDAO->DeleteByVarAndTerm('_check', $row['test_expected_result']);
     }
     if ($row['test_failed_result'] != '') {
         $langTextDAO->DeleteByVarAndTerm('_check', $row['test_failed_result']);
     }
     $checkPrerequisitesDAO = new CheckPrerequisitesDAO();
     $checkPrerequisitesDAO->DeleteByCheckID($checkID);
     $testPassDAO = new TestPassDAO();
     $testPassDAO->DeleteByCheckID($checkID);
     $subgroupChecksDAO = new SubgroupChecksDAO();
     $subgroupChecksDAO->DeleteByCheckID($checkID);
     $techniques = new Techniques();
     $techniques->DeleteByCheckID($checkID);
     $checkExamplesDAO = new CheckExamplesDAO();
     $checkExamplesDAO->DeleteByCheckID($checkID);
     $sql = "DELETE FROM " . TABLE_PREFIX . "checks WHERE check_id=" . $checkID;
     return $this->execute($sql);
 }