예제 #1
0
 public function getControlsFromXML($file)
 {
     $xmlControls = new MXMLControls();
     $xmlControls->loadFile($file, $this);
     return $xmlControls->get();
 }
예제 #2
0
 private function getControlsFromInclude($node, &$controls, $handleChildren = false)
 {
     if ($node) {
         $attributes = $node->attributes();
         if ($attributes['file']) {
             $fileName = $attributes['file'];
             $file = $this->path . '/' . $this->processValue($fileName);
         } elseif ($attributes['component']) {
             $fileName = $attributes['component'];
             $file = Manager::getAppPath('components/' . $fileName);
         }
         $extension = pathinfo($file, PATHINFO_EXTENSION);
         if ($extension == 'xml') {
             $xmlControls = new MXMLControls();
             $xmlControls->loadFile($file, $this->context);
             if ($handleChildren) {
                 $this->handleChildren($controls, $xmlControls->root);
             } else {
                 foreach ($xmlControls->get() as $c) {
                     $this->getControlFromDOM($c, $node);
                     $controls[] = $c;
                 }
             }
         } elseif ($extension == 'php') {
             include_once $file;
             $fileName = end(explode('/', $fileName)) ?: $fileName;
             $className = str_replace('.' . $extension, '', $fileName);
             $c = new $className();
             $this->getControlFromDOM($c, $node);
             if ($handleChildren) {
                 $controls->addControl($c);
             } else {
                 $controls[] = $c;
             }
         }
     }
 }
예제 #3
0
 public function addControlsFromXML($file)
 {
     $xmlControls = new MXMLControls();
     $xmlControls->loadFile($file, $this);
     $xmlControls->process();
 }
예제 #4
0
 public function setFieldsFromXMLString($xmlString)
 {
     $controls = new MXMLControls();
     $controls->loadString($xmlString, $this->data);
     $this->setFields($controls->get('fields'));
     $this->setButtons($controls->get('buttons'));
     $this->setValidators($controls->get('validators'));
 }