Example #1
0
 function deleteKeywords($tcID, $kwID = null, $audit = self::AUDIT_ON)
 {
     $sql = " DELETE FROM {$this->tables['testcase_keywords']}  WHERE testcase_id = {$tcID} ";
     if (!is_null($kwID)) {
         if (is_array($kwID)) {
             $sql .= " AND keyword_id IN (" . implode(',', $kwID) . ")";
             $key4log = $kwID;
         } else {
             $sql .= " AND keyword_id = {$kwID}";
             $key4log = array($kwID);
         }
     } else {
         $key4log = array_keys((array) $this->get_keywords_map($tcID));
     }
     $result = $this->db->exec_query($sql);
     if ($result) {
         $tcInfo = $this->tree_manager->get_node_hierarchy_info($tcID);
         if ($tcInfo && $key4log) {
             foreach ($key4log as $key2get) {
                 $keyword = tlKeyword::getByID($this->db, $key2get);
                 if ($keyword && $audit == self::AUDIT_ON) {
                     logAuditEvent(TLS("audit_keyword_assignment_removed_tc", $keyword->name, $tcInfo['name']), "ASSIGN", $tcID, "nodes_hierarchy");
                 }
             }
         }
     }
     return $result;
 }
Example #2
0
 /**
  * gets the keyword with the given id
  *
  * @param type $kwid
  **/
 public function getKeyword($id)
 {
     return tlKeyword::getByID($this->db, $id);
 }