Exemple #1
0
 /**
  * Creates the HTML code for a form field
  *
  * @param \Xily\Xml $xmlField
  */
 private function buildField($xmlField)
 {
     $id = (string) $xmlField->id();
     $html = '<div class="control-group">';
     $html .= '<label class="control-label"' . ($id === '' ? '' : ' for="' . $id . '"') . '>' . $xmlField->attribute('label') . '</label>' . '<div class="controls">';
     $xmlField->removeAttribute('label');
     return $html . $xmlField->run() . '</div></div>';
 }
Exemple #2
0
 /**
  * Parses the mixed content of a XML node (CDATA and XML)
  *
  * @param \Xily\Xml $xmlNode The DocBook XML node
  * @return string Translated HTML code
  */
 public function parse_content($xmlNode)
 {
     $strResult = '';
     $arrContent = $xmlNode->content();
     foreach ($arrContent as $child) {
         if ($child instanceof \Xily\Xml) {
             $strResult .= $this->parseTag($child);
         } else {
             $strResult .= htmlspecialchars($child);
         }
     }
     return $strResult;
 }
Exemple #3
0
 /**
  * Converts the result into an XML structure
  *
  * @param \Xily\Xml $xmlNode
  * @param string|array $mxtData
  */
 public function convertXML($xmlNode, $mxtData)
 {
     if (is_array($mxtData)) {
         if (!$this->isFalse('assoc') && $this->checkAssoc($mxtData)) {
             foreach ($mxtData as $key => $value) {
                 $xmlChild = new XML($key);
                 $xmlNode->addChild(self::convertXML($xmlChild, $value));
             }
         } else {
             foreach ($mxtData as $key => $value) {
                 $xmlChild = new XML('node', null, array('key' => $key));
                 $xmlNode->addChild(self::convertXML($xmlChild, $value));
             }
         }
     } else {
         $xmlNode->setValue($mxtData);
     }
     return $xmlNode;
 }
Exemple #4
0
 /**
  * Includes another XML document
  *
  * @param \Xily\Xml $xmlNode
  */
 public function parse_include($xmlNode)
 {
     if (!$xmlNode->hasAttribute('file') || !file_exists($this->strIncludePath . $xmlNode->attribute('file'))) {
         return '';
     }
     return $this->parseTag(\Xily\Xml::create($this->strIncludePath . $xmlNode->attribute('file'), 1));
 }
Exemple #5
0
 /**
  * Enriches and returns the meta XML
  *
  * @param \Xily\Xml $xmlMeta
  * @return \Xily\Xml
  */
 public function enrichMeta(&$xmlMeta)
 {
     $xmlMeta->addChild(new \Xily\Xml('message', 'You are logged out now!', array('class' => 'alert alert-success')));
 }