/**
  * Mark all children of the given node that match the marking filter.
  * @param DataObject $node Parent node.
  */
 public function markChildren($node, $context = null, $childrenMethod = "AllChildrenIncludingDeleted", $numChildrenMethod = "numChildren")
 {
     if ($node->hasMethod($childrenMethod)) {
         $children = $node->{$childrenMethod}($context);
     } else {
         user_error(sprintf("Can't find the method '%s' on class '%s' for getting tree children", $childrenMethod, get_class($this->owner)), E_USER_ERROR);
     }
     $node->markExpanded();
     if ($children) {
         foreach ($children as $child) {
             if (!$this->markingFilter || $this->markingFilterMatches($child)) {
                 if ($child->{$numChildrenMethod}()) {
                     $child->markUnexpanded();
                 } else {
                     $child->markExpanded();
                 }
                 $this->markedNodes[$child->ID] = $child;
             }
         }
     }
 }
Example #2
0
	/**
	 * Mark all children of the given node that match the marking filter.
	 * @param DataObject $node Parent node.
	 */
	public function markChildren($node, $context = null) {
		$children = $node->AllChildrenIncludingDeleted($context);
		$node->markExpanded();
		if($children) {
			foreach($children as $child) {
				if(!$this->markingFilter || $this->markingFilterMatches($child)) {
					$child->markUnexpanded();
					$this->markedNodes[$child->ID] = $child;
				}
			}
		}
	}