/**
  * Returns true if the given action could be loaded with widget_load.
  * Wizards do not support that. They want to be displayed without menus.
  */
 protected function isWidgetAction($actionInstance)
 {
     $module = $actionInstance->getModuleName();
     $action = $actionInstance->getActionName();
     $doc = afConfigUtils::getOptionalDoc($module, $action);
     if (!$doc) {
         return false;
     }
     $view = afDomAccess::wrap($doc, 'view', new afVarScope($actionInstance->getVarHolder()->getAll()));
     return $view->get('@type') !== 'wizard';
 }
<?php

include dirname(__FILE__) . '/../bootstrap/dbunit.php';
$t = new lime_test(3, new lime_output_color());
$doc = afConfigUtils::getDoc('networkmonitor_snmp', 'editSnmpPackage');
$view = afDomAccess::wrap($doc, 'view');
$fields = $view->wrapAll('fields/field');
$t->is(count($fields), 3);
$t->is(afEditView::getParams($fields[1], 'validator/param'), array('class' => 'SnmpPackage', 'column' => 'name', 'unique_error' => 'This name is already used. Please choose another one!'));
$validators = json_decode('{"edit[name]":{"immValidatorUnique":{"params":{"class":"SnmpPackage","column":"name","unique_error":"This name is already used. Please choose another one!"}}},"edit[template]":{"immValidatorRequired":[]}}', true);
$t->is(afEditView::getValidators($fields), $validators);
 protected function wrapDoc($doc)
 {
     return afDomAccess::wrap($doc, 'view', new afVarScope($this->actionVars));
 }
 private function parseMenu(array $nodes = null, $menu = null)
 {
     if ($nodes === null) {
         $doc = $this->readDocumentByPath($this->root . "/apps/" . $this->application . "/config/menu.xml", false);
         $view = afDomAccess::wrap($doc, 'view', new afVarScope($this->attribute_holder));
         $nodes = $view->wrapAll("menu/node");
     }
     /*
     		foreach($nodes as $node) {
     				
     			$childnodes = $node->wrapAll("node");
     			$top = ($node->getParent()->getName() == "menu");
     			
     			if($top) {
     				$button = new afExtjsToolbarButton($this->layout->toolbar,array("label" => $node->get("@label"), "handler" => $node->get("@handler"),
     				"tooltip" => array("text" => $node->get("@tooltip"), "title" => $node->get("@tiptitle"))));
     				$this->buttons[$button->attributes["text"]] = array();
     			}
     			
     			if(count($childnodes)) {
     				if(!$top) {
     					$button = new afExtjsToolbarMenuItem($menu,array("label" => $node->get("@label"), "url" => $node->get("@target")));
     					$this->buttons[$button->attributes["text"]] = array();
     				}
     				$menu = new afExtjsToolbarMenu($button);
     				$this->parseMenu($childnodes,$menu);		
     			} else {
     				if(!$top) {
     					$this->buttons[$menu->containerObject->attributes["text"]][] =  $node->get("@label");
     					$item = new afExtjsToolbarMenuItem($menu,array("label" => $node->get("@label"), "url" => $node->get("@target")));
     					$item->end();	
     				}
     				
     			}
     			
     	
     			$menu = ($menus) ? $this->getMenuForNode($node,$menus) : null;
     			
     			if($node->getParent()->getName() == "menu") {
     				$buttons[] = array("button" => new afExtjsToolbarButton($toolbar,array("label" => $node->get("@label"), "handler" => $node->get("@handler"),
     				"tooltip" => array("text" => $node->get("@tooltip"), "title" => $node->get("@tiptitle")))), 
     				"node" => $node, "last" => count($childnodes) ? $childnodes[count($childnodes)-1] : null);
     			} else {
     				if(count($childnodes)) {
     					$buttons[] = array("button" => new afExtjsToolbarMenuItem($menu["menu"],array("label" => $node->get("@label"), "url" => 
     					$node->get("@target"))),"node" => $node, "last" => $childnodes[count($childnodes)-1]);
     				}
     			} 
     			
     			$button = $this->getMenuForNode($node,$buttons);
     			
     			if(count($childnodes)) {
     				$menus[] = array("menu" => new afExtjsToolbarMenu($button["button"]),"node" => $node, "last" => $childnodes[count($childnodes)-1]);
     				$this->parseMenu($childnodes,$toolbar,$menus,$buttons);	
     			} else {
     				if($menus) {
     					if($menu) {
     						$item = new afExtjsToolbarMenuItem($menu["menu"],array("label" => $node->get("@label"), "url" => $node->get("@target")));
     						$item->end();
     						if($node->getNode() === $menu["last"]->getNode()) {
     							$menu["menu"]->end();	
     						}	
     					}	
     				}
     			}
     			if(!$button["last"] || $node->getNode() === $button["last"]->getNode()) {
     				$button["button"]->end();	
     			}
     			
     		}
     */
 }