IMP_Ftree::getChildren PHP Method

getChildren() public method

Return the list of children for a given element ID.
public getChildren ( string $id ) : array
$id string Element ID.
return array Array of tree elements.
    public function getChildren($id)
    {
        if (!($elt = $this[$id]) || !isset($this->_parent[strval($elt)])) {
            return array();
        }
        $this->_sortLevel($elt);
        return array_map(array($this, 'offsetGet'), $this->_parent[strval($elt)]);
    }

Usage Example

コード例 #1
0
ファイル: Element.php プロジェクト: jubinpatel/horde
 /**
  */
 public function __get($name)
 {
     switch ($name) {
         case 'account':
             return $this->_tree->getAccount($this->_id);
         case 'base_elt':
             return $this->_id == IMP_Ftree::BASE_ELT;
         case 'child_list':
             return $this->_tree->getChildren($this->_id);
         case 'inbox':
             return $this->_id == 'INBOX';
         case 'level':
             if ($this->base_elt) {
                 return 0;
             }
             $i = substr_count($this->_id, $this->namespace_info->delimiter);
             $elt = $this;
             while ($elt = $elt->parent) {
                 if ($elt->namespace) {
                     return $i + 1;
                 } elseif ($elt->remote) {
                     if ($this->remote_mbox) {
                         ++$i;
                     }
                     return $i + 1;
                 }
             }
             return $i;
         case 'mbox_ob':
             return IMP_Mailbox::get($this->_id);
         case 'namespace':
             return $this->namespace_other || $this->namespace_shared;
         case 'namespace_info':
             return $this->mbox_ob->imp_imap->getNamespace($this->_id);
         case 'parent':
             return $this->_tree->getParent($this->_id);
         default:
             return $this->_tree->getAttribute($name, $this->_id);
     }
 }