예제 #1
0
 public function compile()
 {
     $class = $this->admin->getCompileClass();
     if ($this->route_root) {
         $class->addProperty('_admin_route_root', $this->route_root);
     }
     if (!empty($this->_route_children)) {
         $class->addProperty('_admin_route_children', $this->_route_children);
         /*
                     \Dev::debug($this->admin->name, 'children');
                     \Dev::dump( $this->_route_children);
         */
     }
     if (!empty($this->_route_parents)) {
         $parents = array();
         foreach ($this->admin->generator->admin_deep_order as $parent_name) {
             if (!isset($this->_route_parents[$parent_name])) {
                 continue;
             }
             $o = $this->_route_parents[$parent_name];
             if (count($o) > 1) {
                 foreach ($o as $c) {
                     $child_property = $c[0];
                     $parent_property = $c[1];
                     // if( !$parent_property ) continue ;
                     if (!isset($parents[$parent_name])) {
                         $parents[$parent_name] = array(1, array());
                     }
                     $parents[$parent_name][1] = array($parent_property, $child_property);
                 }
             } else {
                 foreach ($o as $c) {
                     $child_property = $c[0];
                     $parent_property = $c[1];
                     // if( !$parent_property ) continue ;
                     $parents[$parent_name] = array(0, array($parent_property, $child_property));
                 }
             }
         }
         /*
         \Dev::debug($this->admin->name, 'parents');
         \Dev::dump($parents, 8);
         */
         $class->addProperty('_admin_route_parents', $parents);
     }
 }