/**
  * @param tx_caretaker_AbstractNode $node
  * @param int $depth
  * @return array
  */
 protected function nodeToArray($node, $depth = 1)
 {
     // show node and icon
     $result = array();
     $uid = $node->getUid();
     $title = $node->getTitle();
     $hidden = $node->getHidden();
     $id = $node->getCaretakerNodeId();
     $testResult = $node->getTestResult();
     $resultClass = 'caretaker-state-' . strtolower($testResult->getStateInfo());
     $typeClass = 'caretaker-type-' . strtolower($node->getType());
     $result['type'] = strtolower($node->getType());
     $result['id'] = $id;
     $result['uid'] = $uid;
     $result['disabled'] = $hidden;
     $result['text'] = $title ? $title : '[no title]';
     $result['cls'] = $resultClass . ' ' . $typeClass;
     $result['iconCls'] = 'icon-' . $typeClass . ($hidden ? '-hidden' : '');
     if (strtolower($node->getType()) == 'instance' && $node instanceof tx_caretaker_InstanceNode) {
         $result['url'] = $node->getUrl();
     } else {
         $result['url'] = false;
     }
     // show subitems of tx_caretaker_AggregatorNodes
     if ($node instanceof tx_caretaker_AggregatorNode) {
         $children = $node->getChildren(true);
         $result['leaf'] = count($children) == 0 ? true : false;
         if ($depth > 0) {
             $result['children'] = array();
             foreach ($children as $child) {
                 $result['children'][] = $this->nodeToArray($child, $depth - 1);
             }
         }
     } else {
         $result['leaf'] = TRUE;
     }
     return $result;
 }
 /**
  *
  * @param tx_caretaker_AbstractNode $node
  * @return array
  */
 function getNodeData($node)
 {
     $data = array();
     // node data
     $data['uid'] = $node->getUid();
     $data['node_id'] = $node->getCaretakerNodeId();
     $data['node_type'] = $node->getType();
     $data['type'] = $node->getTypeDescription();
     $data['configuration'] = $node->getConfigurationInfo();
     $data['title'] = $node->getTitle();
     $data['description'] = $node->getDescription();
     // add state Infos
     $result = $node->getTestResult();
     $data['state'] = $result->getState();
     $data['state_info'] = $result->getStateInfo();
     $data['state_show'] = $result->getLocallizedStateInfo();
     $data['state_msg'] = $result->getLocallizedInfotext();
     $data['state_tstamp'] = $result->getTimestamp();
     if ($result instanceof tx_caretaker_TestResult) {
         $data['state_value'] = $result->getValue();
     }
     // instance data
     if (is_a($node, 'tx_caretaker_TestNode') || is_a($node, 'tx_caretaker_TestgroupNode')) {
         $data['instance'] = $node->getInstance()->getTitle();
     }
     $data['link_parameters'] = '&tx_caretaker_pi_singleview[id]=' . $node->getCaretakerNodeId();
     return $data;
 }