public $packager;
public static function getInstance($id, $init, &$packager) {
- switch ($init->link) {
+ switch ($init['type']) {
case 1:
case 2:
return new webLink($id, $init, $packager);
case 3:
return new mailLink($id, $init, $packager);
- case 4:
- return new internalLink($id, $init, $packager);
case 5:
+ return new internalLink($id, $init, $packager);
+ case 4:
return new videoLink($id, $init, $packager);
case 6:
case 7:
}
public function __construct($id, $init, &$packager) {
- $this->id = $id;
- $this->packager = $packager;
foreach ($init as $k => $v) {
$this->$k = $v;
}
+ $this->id = $id;
+ $this->packager = $packager;
}
public function getHTMLContainer() {
- return '<div class="l" id="l' . $this->id . '">' . $this->getHTMLContent() . '</div>';
+ return '<div class="link" id="link' . $this->id . '">' . $this->getHTMLContent() . '</div>';
}
public function getHTMLContent() {
}
public function copyExternalFile($file) {
- $packager->copyLinkFile($file, 'data/links/');
+ $this->packager->copyLinkFile($file, 'data/links/');
+ }
+
+ public function getCSSContainer() {
+ $css = '#link' . $this->id . '{';
+ $css.='left:' . $this->left . 'px;top:' . $this->top . 'px;';
+ $css.='width:' . $this->width . 'px;height:' . $this->height . 'px;';
+ $css.=$this->getCSS();
+ $css.='}';
+ return $css;
+ }
+
+ public function getCSS() {
+ return 'border:1px dotter #ff0000;';
}
public static function getUniversalLocation($loc) {
return '_self';
}
- public function getCSSContainer() {
- $css = '#l' . $this->id . '{';
- $css.='left:' . $this->left . 'px;top:' . $this->top . 'px;';
- $css.='width:' . $this->width . 'px;height:' . $this->height . 'px;';
- $css.=$this->getCSS();
- $css.='}';
- }
-
- public function getCSS() {
-
- }
-
}
class contentLink extends wsPackagerHTML5Link {
return '#/pages/' . $this->getPage();
}
+ public function getPage() {
+ return $this->to;
+ }
+
}
class videoLink extends wsPackagerHTML5Link {
$ext = array_pop($e);
$basename = implode('.', $e);
- $videos = array('mp4' => 'video/mp4; codecs=\'avc1.42E01E, mp4a.40.2\'', 'ogv' => 'video/ogg; codecs="theora, vorbis');
+ $types = array('mp4' => 'video/mp4; codecs=\'avc1.42E01E, mp4a.40.2\'', 'ogv' => 'video/ogg; codecs=\'theora, vorbis\'');
foreach ($types as $ext => $type) {
$res.='<source src="' . wsPackagerHTML5Link::getUniversalLocation($basename . '.' . $ext) . '" type="' . $type . '" />';
$this->copyExternalFile($basename . '.' . $ext);
mkdir($this->vdir . '/data/contents', 0777, true);\r
mkdir($this->vdir . '/data/background', 0777, true);\r
mkdir($this->vdir . '/data/style', 0777, true);\r
+ mkdir($this->vdir . '/data/links/pages', 0777, true);\r
\r
foreach ($this->div as $n => $page) {\r
file_put_contents($this->vdir . '/data/contents/p' . $n . '.html', $this->writePage($page));\r
}\r
$this->writeFonts();\r
$this->writeImages();\r
- $this->writeLinks();\r
- $this->writeCSS($this->vdir . '/data/style/style_%d.css');\r
+ $linksCSS = $this->writeLinks();\r
+ $this->writeCSS($this->vdir . '/data/style/style_%d.css', $linksCSS);\r
\r
file_put_contents($this->vdir . '/data/datas.js', $this->writeConfig());\r
}\r
$daoDoc->getLinksAndRulers($this->book_id, $links, $rulers);\r
\r
$i = 0;\r
+ $pages = array();\r
+ $css = array();\r
foreach ($links as $linkData) {\r
$link = wsPackagerHTML5Link::getInstance($this->base62($i), $linkData, $this);\r
+ if (is_null($link)) {\r
+ continue;\r
+ }\r
+ if (!isset($pages[$link->page])) {\r
+ $pages[$link->page] = '';\r
+ }\r
+ $pages[$link->page] .= $link->getHTMLContainer();\r
+ $css[] = $link->getCSSContainer();\r
$i++;\r
}\r
+\r
+ foreach ($pages as $n => $c) {\r
+ file_put_contents($this->vdir . '/data/links/pages/p' . $n . '.html', $c);\r
+ }\r
+ return $css;\r
}\r
\r
protected function writeConfig() {\r
return self::escapeHTML($span['text']);\r
}\r
\r
- protected function writeCSS($file) {\r
+ protected function writeCSS($file, $links) {\r
$res = array();\r
\r
// General theme\r
\r
\r
$navTop = ($this->book->parametres->height - 40 - 100) / 2;\r
- $res[] = '.portrait #pages,.portrait .doublePage.page,.page,.portrait #shadow,#shadow.single{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}';\r
+ $res[] = '.portrait #pages,.portrait .doublePage.page,.page,.portrait #shadow,#shadow.single,.page .links{width:' . $w . ';max-width:' . $w . ';height:' . $h . ';max-height:' . $h . '}';\r
$res[] = '.background{' . $this->writeCSSUA('transform-origin', 'top left') . ';}';\r
foreach (self::$resolutions as $r) {\r
$ratio = 72 / $r;\r
$res[] = '#shadow{' . $this->writeCSSUA('box-shadow', '0 0 20px ' . $shadowColor) . '}';\r
}\r
\r
+ // Links Styles\r
+ $res = array_merge($res, $links);\r
+\r
// Pages styles\r
foreach ($this->cssColor as $color => $index) {\r
$res[] = '.c' . $index . '{color:#' . $color . '}';\r