コード例 #1
0
 final function _setDeletedDate($a_ref_id)
 {
     return parent::_setDeletedDate($a_ref_id);
 }
コード例 #2
0
 /**
  * save subtree: delete a subtree (defined by node_id) to a new tree
  * with $this->tree_id -node_id. This is neccessary for undelete functionality
  * @param	integer	node_id
  * @return	integer
  * @access	public
  */
 function saveSubTree($a_node_id, $a_set_deleted = false)
 {
     global $ilDB;
     if (!$a_node_id) {
         $message = sprintf('%s::saveSubTree(): No valid parameter given! $a_node_id: %s', get_class($this), $a_node_id);
         $this->log->write($message, $this->log->FATAL);
         $this->ilErr->raiseError($message, $this->ilErr->WARNING);
     }
     // LOCKED ###############################################
     if ($this->__isMainTree()) {
         $ilDB->lockTables(array(0 => array('name' => 'tree', 'type' => ilDB::LOCK_WRITE), 1 => array('name' => 'object_reference', 'type' => ilDB::LOCK_WRITE)));
         #ilDB::_lockTables(array('tree' => 'WRITE',
         #	'object_reference' => 'WRITE'));
     }
     // GET LEFT AND RIGHT VALUE
     $query = 'SELECT * FROM ' . $this->table_tree . ' ' . 'WHERE ' . $this->tree_pk . ' = %s ' . 'AND child = %s ';
     $res = $ilDB->queryF($query, array('integer', 'integer'), array($this->tree_id, $a_node_id));
     while ($row = $ilDB->fetchObject($res)) {
         $lft = $row->lft;
         $rgt = $row->rgt;
     }
     // GET ALL SUBNODES
     $query = 'SELECT child FROM ' . $this->table_tree . ' ' . 'WHERE ' . $this->tree_pk . ' = %s ' . 'AND lft BETWEEN %s AND %s ';
     $res = $ilDB->queryF($query, array('integer', 'integer', 'integer'), array($this->tree_id, $lft, $rgt));
     $subnodes = array();
     while ($row = $ilDB->fetchAssoc($res)) {
         $subnodes[] = $row['child'];
     }
     if (!count($subnodes)) {
         // possibly already deleted
         // Unlock locked tables before returning
         if ($this->__isMainTree()) {
             $ilDB->unlockTables();
         }
         return false;
     }
     // SAVE SUBTREE
     foreach ($subnodes as $child) {
         // set node as deleted
         if ($a_set_deleted) {
             // TODO: new method that expects an array of ids
             ilObject::_setDeletedDate($child);
         }
     }
     // Set the nodes deleted (negative tree id)
     $query = 'UPDATE ' . $this->table_tree . ' ' . 'SET tree = %s ' . 'WHERE ' . $this->tree_pk . ' = %s ' . 'AND lft BETWEEN %s AND %s ';
     $res = $ilDB->manipulateF($query, array('integer', 'integer', 'integer', 'integer'), array(-$a_node_id, $this->tree_id, $lft, $rgt));
     if ($this->__isMainTree()) {
         $ilDB->unlockTables();
     }
     // LOCKED ###############################################
     return true;
 }
コード例 #3
0
ファイル: ilObjectTest.php プロジェクト: Walid-Synakene/ilias
 /**
  * test object reference queries 
  */
 public function testObjectReference()
 {
     include_once './Services/Object/classes/class.ilObject.php';
     $ref_ids = ilObject::_getAllReferences(1);
     $bool = ilObject::_setDeletedDate(1);
     $bool = ilObject::_resetDeletedDate(1);
     $date = ilObject::_lookupDeletedDate(1);
     $this->assertEquals($date, null);
 }