Example #1
0
 public function markAsDeleted($id)
 {
     $id = $this->da->escapeInt($id);
     $deletion_date = $this->da->escapeInt($_SERVER['REQUEST_TIME']);
     $sql = "UPDATE {$this->table_name} \n                SET deletion_date = {$deletion_date}\n                WHERE id = {$id}";
     if ($this->update($sql)) {
         $hierarchy_dao = new Tracker_Hierarchy_Dao();
         return $hierarchy_dao->deleteParentChildAssociationsForTracker($id);
     } else {
         return false;
     }
 }
Example #2
0
 public function update()
 {
     $vChildren = new Valid_UInt('children');
     $vChildren->required();
     if ($this->request->validArray($vChildren)) {
         $this->dao->updateChildren($this->tracker->getId(), $this->request->get('children'));
     } else {
         if ($this->request->exist('children')) {
             $GLOBALS['Response']->addFeedback('error', $GLOBALS['Language']->getText('plugin_tracker_hierarchy', 'controller_bad_request'));
         } else {
             $this->dao->deleteAllChildren($this->tracker->getId());
         }
     }
     $this->redirect(array('tracker' => $this->tracker->getId(), 'func' => 'admin-hierarchy'));
 }
 private function addRelationships(Tracker_Hierarchy $hierarchy, $search_tracker_ids)
 {
     $hierarchy_dar = $this->hierarchy_dao->searchTrackerHierarchy($search_tracker_ids);
     $relationships_ids = array();
     foreach ($hierarchy_dar as $row) {
         $this->addRelationshipAndStack($hierarchy, $row['parent_id'], $row['child_id'], $relationships_ids);
     }
     return $relationships_ids;
 }
 /**
  *
  * @param array $all_hierarchies
  *
  * Stores in database the hierarchy between created trackers
  */
 public function storeHierarchyInDB(array $all_hierarchies)
 {
     foreach ($all_hierarchies as $parent_id => $hierarchy) {
         $this->hierarchy_dao->updateChildren($parent_id, $hierarchy);
     }
 }
 /**
  *
  * @param array $mapping the id of tracker's children
  */
 public function updateFromXmlProjectImportProcess(array $mapping)
 {
     $this->dao->updateChildren($this->tracker->getId(), $mapping);
 }