/** * Get the html node for this element * * @param \DOMElement $node * @param \AppShed\Remote\XML\DOMDocument $xml * @param \AppShed\Remote\HTML\Settings $settings * @param CSSDocument $css * @param array $javascripts */ protected function getHTMLNodeBase($node, $xml, $settings, $css, &$javascripts) { $node->setAttribute('data-screentype', static::TYPE); if ($this->secure) { $xml->addClass($node, 'secured'); } $this->getCSS($css, $settings); if ($this->tabs === 'float') { $node->setAttribute('data-tabs', 'float'); } else { if (!$this->tabs) { $node->setAttribute('data-tabs', 'hide'); } } if ($this->header === 'float') { $xml->addClass($node, 'float-header'); } else { if (!$this->header) { $xml->addClass($node, 'hide-header'); } } if ($this->statusBarStyle === 'float') { $node->setAttribute('data-status', 'float'); } else { if ($this->statusBarStyle === 'black') { $node->setAttribute('data-status', 'black'); } } if ($this->tab) { $node->setAttribute('data-tab', $this->tab); } if ($settings->getFetchId()) { $node->setAttribute('data-fetch-id', $settings->getPrefix() . $settings->getFetchId()); } if ($settings->getFetchUrl()) { $node->setAttribute('data-fetch-url', $settings->getFetchUrl()); } if ($settings->getDirect()) { $node->setAttribute('data-fetch-direct', 'direct'); } $node->appendChild($navbar = $xml->createElement('div', 'header')); $navbar->setAttribute('x-blackberry-focusable', 'true'); $navbar->appendChild($xml->createElement('div', 'background')); if ($this->back !== false) { $navbar->appendChild($back = $xml->createElement('div', ['class' => 'back', 'data-linktype' => 'back', 'text' => 'Back'])); if ($this->back instanceof Screen) { $this->back->getHTMLNode($xml, $settings); $back->setAttribute('data-href', $settings->getPrefix() . $this->back->getId()); } else { if ($this->back !== true) { $back->setAttribute('data-href', $settings->getPrefix() . $this->back); } } $back->setAttribute('x-blackberry-focusable', 'true'); } $navbar->appendChild($title = $xml->createElement('div', 'title')); $title->appendChild($xml->createElement('span', ['text' => $this->title])); $items = $xml->createElement('div', 'items' . ($this->scroll ? ' scrolling' : '')); $node->appendChild($items); $headButtons = $this->addHTMLChildren($items, $xml, $settings, $css, $javascripts); foreach ($headButtons as $b) { $c = $b->getHTMLNode($xml, $settings); if ($c) { $navbar->appendChild($c); } } }
/** * Get the html node for this element * * @param \DOMElement $node * @param \AppShed\Remote\XML\DOMDocument $xml * @param \AppShed\Remote\HTML\Settings $settings */ protected function getHTMLNodeInner($node, $xml, $settings) { $css = new CSSDocument(); $idSelector = $css->getIdSelector($this->getIdType() . $settings->getPrefix() . $this->getId()); if ($this->customCSS) { $css->addCSSText($this->customCSS, $idSelector); } $this->getCSS($css, $settings); if ($this->splash) { $this->splash->toCSS($css, $idSelector . $css->getClassSelector('splash')); } if ($this->name) { $node->setAttribute('data-name', $this->name); } if ($this->description) { $node->setAttribute('data-description', $this->description); } if ($this->flag) { $node->setAttribute('data-flag', $this->flag); } if ($this->previewUrl) { $node->setAttribute('data-preview-url', $this->previewUrl); } if ($this->webviewUrl) { $node->setAttribute('data-webview-url', $this->webviewUrl); } if ($this->disableIos7) { $node->setAttribute('data-disable-ios7', 'data-disable-ios7'); } if ($this->disableMasking) { $node->setAttribute('data-disable-masking', 'data-disable-masking'); } if ($this->icon) { $node->setAttribute('data-icon', $this->icon->getUrl()); $idSelector = $css->getIdSelector($this->getIdType() . $settings->getPrefix() . $this->getId()); $css->addRule([".android .phone-navigator {$idSelector}.app .app-navigator .screen .header .back"], 'background-image', $css->getURLValue($this->icon->getUrl())); $css->addRule([".blackberry .phone-navigator {$idSelector}.app .app-navigator .screen .header"], 'background-image', $css->getURLValue($this->icon->getUrl())); } if ($settings->getFetchUrl()) { $node->setAttribute('data-fetch-url', $settings->getFetchUrl()); } $node->appendChild($navigator = $xml->createElement('div', 'app-navigator')); $navigator->appendChild($navinner = $xml->createElement('div', 'app-navigator-inner')); $navinner->appendChild($xml->createElement('div', 'app-navigator-inner-sides')); $navinner->appendChild($xml->createElement('div', 'app-navigator-inner-sides')); if ($this->ads) { $xml->addClass($navigator, 'ads'); $node->appendChild($xml->createElement('div', 'ad-holder')); } $node->appendChild($tabbarOuter = $xml->createElement('div', 'tab-bar')); $tabbarOuter->appendChild($tabbar = $xml->createElement('table')); $tabbar->appendChild($tabbarinner = $xml->createElement('tr', 'tar-bar-inner')); foreach ($this->children as $tab) { $tabbarinner->appendChild($tab->getHTMLNode($xml, $settings)); $tab->getCSS($css, $settings); } $settings->addApp($this->getId(), $xml->saveXML($node), $css, $this->splash ? "<style scoped>" . $css->toSplashString() . "</style><div class=\"splash\" id=\"app" . $this->getId() . "\"></div>" : null, $this->updated === true ? new \DateTime() : $this->updated, ['login' => null, 'register' => null], $this->js); }