当前位置: 首页>>代码示例>>PHP>>正文


PHP ilObject::_resetDeletedDate方法代码示例

本文整理汇总了PHP中ilObject::_resetDeletedDate方法的典型用法代码示例。如果您正苦于以下问题:PHP ilObject::_resetDeletedDate方法的具体用法?PHP ilObject::_resetDeletedDate怎么用?PHP ilObject::_resetDeletedDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ilObject的用法示例。


在下文中一共展示了ilObject::_resetDeletedDate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: insertNode


//.........这里部分代码省略.........
                 $parentLft = $r['lft'];
                 // Get the available space, without taking children into account yet
                 $availableSpace = $parentRgt - $parentLft;
                 if ($availableSpace < 2) {
                     // If there is not enough space between parent lft and rgt, we don't need
                     // to look any further, because we must spread the tree.
                     $lft = $parentRgt;
                 } else {
                     // If there is space between parent lft and rgt, we need to check
                     // whether there is space left between the rightmost child of the
                     // parent and parent rgt.
                     $query = sprintf('SELECT MAX(rgt) max_rgt FROM ' . $this->table_tree . ' ' . 'WHERE parent = %s ' . 'AND ' . $this->tree_pk . ' = %s', $ilDB->quote($a_parent_id, 'integer'), $ilDB->quote($this->tree_id, 'integer'));
                     $res = $ilDB->query($query);
                     $r = $ilDB->fetchAssoc($res);
                     if (isset($r['max_rgt'])) {
                         // If the parent has children, we compute the available space
                         // between rgt of the rightmost child and parent rgt.
                         $availableSpace = $parentRgt - $r['max_rgt'];
                         $lft = $r['max_rgt'] + 1;
                     } else {
                         // If the parent has no children, we know now, that we can
                         // add the new node at parent lft + 1 without having to spread
                         // the tree.
                         $lft = $parentLft + 1;
                     }
                 }
                 $rgt = $lft + 1;
                 // spread tree if there is not enough space to insert the new node
                 if ($availableSpace < 2) {
                     //$this->log->write('ilTree.insertNode('.$a_node_id.','.$a_parent_id.') creating gap at '.$a_parent_id.' '.$parentLft.'..'.$parentRgt.'+'.(2 + $this->gap * 2));
                     $query = sprintf('UPDATE ' . $this->table_tree . ' SET ' . 'lft = CASE WHEN lft  > %s THEN lft + %s ELSE lft END, ' . 'rgt = CASE WHEN rgt >= %s THEN rgt + %s ELSE rgt END ' . 'WHERE ' . $this->tree_pk . ' = %s ', $ilDB->quote($parentRgt, 'integer'), $ilDB->quote(2 + $this->gap * 2, 'integer'), $ilDB->quote($parentRgt, 'integer'), $ilDB->quote(2 + $this->gap * 2, 'integer'), $ilDB->quote($this->tree_id, 'integer'));
                     $res = $ilDB->manipulate($query);
                 } else {
                     //$this->log->write('ilTree.insertNode('.$a_node_id.','.$a_parent_id.') reusing gap at '.$a_parent_id.' '.$parentLft.'..'.$parentRgt.' for node '.$a_node_id.' '.$lft.'..'.$rgt);
                 }
             } else {
                 if ($this->__isMainTree()) {
                     #ilDB::_lockTables(array('tree' => 'WRITE'));
                     $ilDB->lockTables(array(0 => array('name' => $this->table_tree, 'type' => ilDB::LOCK_WRITE)));
                 }
                 // get right value of parent
                 $query = sprintf('SELECT * FROM ' . $this->table_tree . ' ' . 'WHERE child = %s ' . 'AND ' . $this->tree_pk . ' = %s ', $ilDB->quote($a_parent_id, 'integer'), $ilDB->quote($this->tree_id, 'integer'));
                 $res = $ilDB->query($query);
                 $r = $ilDB->fetchObject($res);
                 if ($r->parent == null) {
                     if ($this->__isMainTree()) {
                         $ilDB->unlockTables();
                     }
                     $this->ilErr->raiseError(get_class($this) . "::insertNode(): Parent with ID " . $a_parent_id . " not found in " . $this->table_tree . "!", $this->ilErr->WARNING);
                 }
                 $right = $r->rgt;
                 $lft = $right;
                 $rgt = $right + 1;
                 // spread tree
                 $query = sprintf('UPDATE ' . $this->table_tree . ' SET ' . 'lft = CASE WHEN lft >  %s THEN lft + 2 ELSE lft END, ' . 'rgt = CASE WHEN rgt >= %s THEN rgt + 2 ELSE rgt END ' . 'WHERE ' . $this->tree_pk . ' = %s', $ilDB->quote($right, 'integer'), $ilDB->quote($right, 'integer'), $ilDB->quote($this->tree_id, 'integer'));
                 $res = $ilDB->manipulate($query);
             }
             break;
         default:
             // this code shouldn't be executed
             if ($this->__isMainTree()) {
                 #ilDB::_lockTables(array('tree' => 'WRITE'));
                 $ilDB->lockTables(array(0 => array('name' => $this->table_tree, 'type' => ilDB::LOCK_WRITE)));
             }
             // get right value of preceeding child
             $query = sprintf('SELECT * FROM ' . $this->table_tree . ' ' . 'WHERE child = %s ' . 'AND ' . $this->tree_pk . ' = %s ', $ilDB->quote($a_pos, 'integer'), $ilDB->quote($this->tree_id, 'integer'));
             $res = $ilDB->query($query);
             $r = $ilDB->fetchObject($res);
             // crosscheck parents of sibling and new node (must be identical)
             if ($r->parent != $a_parent_id) {
                 if ($this->__isMainTree()) {
                     $ilDB->unlockTables();
                 }
                 $this->ilErr->raiseError(get_class($this) . "::insertNode(): Parents mismatch! " . "new node parent: " . $a_parent_id . " sibling parent: " . $r->parent, $this->ilErr->WARNING);
             }
             $right = $r->rgt;
             $lft = $right + 1;
             $rgt = $right + 2;
             // update lft/rgt values
             $query = sprintf('UPDATE ' . $this->table_tree . ' SET ' . 'lft = CASE WHEN lft >  %s THEN lft + 2 ELSE lft END, ' . 'rgt = CASE WHEN rgt >  %s THEN rgt + 2 ELSE rgt END ' . 'WHERE ' . $this->tree_pk . ' = %s', $ilDB->quote($right, 'integer'), $ilDB->quote($right, 'integer'), $ilDB->quote($this->tree_id, 'integer'));
             $res = $ilDB->manipulate($query);
             break;
     }
     // get depth
     $depth = $this->getDepth($a_parent_id) + 1;
     // insert node
     //$this->log->write('ilTree.insertNode('.$a_node_id.','.$a_parent_id.') inserting node:'.$a_node_id.' parent:'.$a_parent_id." ".$lft."..".$rgt." depth:".$depth);
     $query = sprintf('INSERT INTO ' . $this->table_tree . ' (' . $this->tree_pk . ',child,parent,lft,rgt,depth) ' . 'VALUES (%s,%s,%s,%s,%s,%s)', $ilDB->quote($this->tree_id, 'integer'), $ilDB->quote($a_node_id, 'integer'), $ilDB->quote($a_parent_id, 'integer'), $ilDB->quote($lft, 'integer'), $ilDB->quote($rgt, 'integer'), $ilDB->quote($depth, 'integer'));
     $res = $ilDB->manipulate($query);
     // Finally unlock tables and update cache
     if ($this->__isMainTree()) {
         #$GLOBALS['ilLog']->write(__METHOD__.': Storing in tree cache '.$a_node_id.' = true');
         $this->in_tree_cache[$a_node_id] = true;
         $ilDB->unlockTables();
     }
     // reset deletion date
     if ($a_reset_deletion_date) {
         ilObject::_resetDeletedDate($a_node_id);
     }
 }
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:101,代码来源:class.ilTree.php

示例2: insertNode

 /**
  * insert new node with node_id under parent node with parent_id
  * @access	public
  * @param	integer		node_id
  * @param	integer		parent_id
  * @param	integer		IL_LAST_NODE | IL_FIRST_NODE | node id of preceding child
  */
 public function insertNode($a_node_id, $a_parent_id, $a_pos = IL_LAST_NODE, $a_reset_deletion_date = false)
 {
     global $ilDB;
     //echo "+$a_node_id+$a_parent_id+";
     // CHECK node_id and parent_id > 0 if in main tree
     if ($this->__isMainTree()) {
         if ($a_node_id <= 1 or $a_parent_id <= 0) {
             $GLOBALS['ilLog']->logStack();
             $message = sprintf('%s::insertNode(): Invalid parameters! $a_node_id: %s $a_parent_id: %s', get_class($this), $a_node_id, $a_parent_id);
             $this->log->write($message, $this->log->FATAL);
             $this->ilErr->raiseError($message, $this->ilErr->WARNING);
         }
     }
     if (!isset($a_node_id) or !isset($a_parent_id)) {
         $GLOBALS['ilLog']->logStack();
         $this->ilErr->raiseError(get_class($this) . "::insertNode(): Missing parameter! " . "node_id: " . $a_node_id . " parent_id: " . $a_parent_id, $this->ilErr->WARNING);
     }
     if ($this->isInTree($a_node_id)) {
         $this->ilErr->raiseError(get_class($this) . "::insertNode(): Node " . $a_node_id . " already in tree " . $this->table_tree . "!", $this->ilErr->WARNING);
     }
     $this->getTreeImplementation()->insertNode($a_node_id, $a_parent_id, $a_pos);
     $this->in_tree_cache[$a_node_id] = true;
     // reset deletion date
     if ($a_reset_deletion_date) {
         ilObject::_resetDeletedDate($a_node_id);
     }
 }
开发者ID:arlendotcn,项目名称:ilias,代码行数:34,代码来源:class.ilTree.php

示例3:

 final function _resetDeletedDate($a_ref_id)
 {
     return parent::_resetDeletedDate($a_ref_id);
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:4,代码来源:class.ilObject2.php

示例4: testObjectReference

 /**
  * 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);
 }
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:12,代码来源:ilObjectTest.php


注:本文中的ilObject::_resetDeletedDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。