function callHasChildren()
 {
     $has = parent::callHasChildren();
     $res = $this->getDepth() < $this->max_depth && $has;
     echo __METHOD__ . "(" . $this->getDepth() . ") = " . ($res ? "yes" : "no") . "/" . ($has ? "yes" : "no") . "\n";
     return $res;
 }
 /**
  * 重写父类中的方法,决定是否有子节点 
  * 
  * @access public
  * @return boolean
  */
 public function callHasChildren()
 {
     $sub_path = $this->getSubPathname();
     if (isset($this->__ignore_dir[$sub_path])) {
         return false;
     }
     return parent::callHasChildren();
 }
Example #3
0
 /**
  * JTreeRecursiveIterator::callHasChildren()
  * Called for each element to test whether it has children. (See Manual)
  *
  * @return mixed
  */
 public function callHasChildren()
 {
     $ret = parent::callHasChildren();
     $value = $this->current()->getValue();
     if ($ret === true) {
         $this->_str .= "<li>{$value}<ul>\n";
     } else {
         $this->_str .= "<li>{$value}</li>\n";
     }
     return $ret;
 }
Example #4
0
 function callHasChildren()
 {
     $this->skip = false;
     $has = parent::callHasChildren();
     $res = $this->getDepth() < $this->max_depth && $has;
     echo __METHOD__ . "(" . $this->getDepth() . ") = " . ($res ? "yes" : "no") . "/" . ($has ? "yes" : "no") . "\n";
     if ($has && !$res) {
         $this->over++;
         if ($this->over == 2) {
             $this->skip = true;
         }
     }
     return $res;
 }
Example #5
0
 public function callHasChildren()
 {
     $filename = $this->getFilename();
     if ($filename[0] == '.') {
         return false;
     }
     $source = $this->key();
     $target = str_replace($this->source, '', $source);
     $target = str_replace('/site', '', $target);
     $target = Util::buildTargetPath($target, $this->target);
     if (is_link($target)) {
         unlink($target);
     }
     if (!is_dir($target)) {
         $this->createLink($source, $target);
         return false;
     }
     return parent::callHasChildren();
 }
Example #6
0
 public function callHasChildren()
 {
     echo "MyIter::callHasChildren\n";
     return parent::callHasChildren();
 }
 function callHasChildren()
 {
     echo __METHOD__ . "; ";
     return parent::callHasChildren();
 }
Example #8
0
$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($result), RecursiveIteratorIterator::SELF_FIRST);
foreach ($it as $key => $value) {
    $key = str_repeat('&nbsp;&nbsp;&nbsp;', $it->getDepth()) . $key;
    $content .= '<tr>';
    if ($it->callHasChildren()) {
        $content .= '<td colspan="2"><b>' . $key . '</b></td>';
    } else {
        $content .= '<td>' . $key . '</td>';
        $content .= '<td>' . $value . '</td>';
    }
    $content .= '</tr>';
}
$content .= '</table>';
echo $content;
echo '<br />';
// hits
$content = '<table class="elgg-table">';
$it = new RecursiveIteratorIterator(new RecursiveArrayIterator($hits), RecursiveIteratorIterator::SELF_FIRST);
foreach ($it as $key => $value) {
    $key = str_repeat('&nbsp;&nbsp;&nbsp;', $it->getDepth()) . $key;
    $content .= '<tr>';
    if ($it->callHasChildren()) {
        $content .= '<td colspan="2"><b>' . $key . '</b></td>';
    } else {
        $content .= '<td>' . $key . '</td>';
        $content .= '<td>' . $value . '</td>';
    }
    $content .= '</tr>';
}
$content .= '</table>';
echo $content;