case 26:
$compiler->addPageLabel($init['page'], $init['to']);
break;
+ case 27:
+ return new eventOverlayLink($id, $init, $compiler);
+ break;
default:
return null;
}
}
+class eventOverlayLink extends wsHTML5Link {
+ public function getHTMLContainerClass() {
+ return parent::getHTMLContainerClass() . ' eventOverlayLink';
+ }
+
+ public function getHTMLContent() {
+ return '<div></div>';
+ }
+}
+
class webLink extends normalLink {
public function getURL() {
$res = str_replace('"', '\'', wsHTML5Link::getUniversalLocation($this->to));
public function __construct($id, $init, $compiler) {
parent::__construct($id, $init, $compiler);
+ }
- fb($id, 'ID');
- fb($init, 'INIT');
- fb($compiler, 'COMPILER');
+ public function getAdditionnalContent() {
+ $res = parent::getAdditionnalContent();
+
+ // Data attributes
+ $attributes = [
+ 'maxzoom' => $this->to,
+ ];
+
+ // Set data attributes
+ foreach ($attributes as $key => $val) {
+ $res .= ' data-' . $key . '="' . $val . '"';
+ }
+
+ $this->generateImage();
+
+ return $res;
}
- public function getAdditionnalContent() {
- $res = parent::getAdditionnalContent();
+ public function generateImage() {
+ $left = CubeIT_Files::tempnam();
+
+ $p = wsDAOBook::getDocumentPage($this->compiler->book_id, $this->page);
+ $pdfpath = wsDocument::getDir($p['document_id']) . 'original.pdf';
- // Data attributes
- $attributes = [
- 'maxzoom' => $this->to,
- ];
+ CubeIT_CommandLine_Poppler::extractArea($pdfpath,
+ $this->page,
+ array('x' => $this->left, 'y' => $this->top, 'width' => $this->width, 'height' => $this->height),
+ $left);
- // Set data attributes
- foreach ($attributes as $key => $val) {
- $res .= ' data-'.$key.'="'. $val .'"';
- }
+ $this->compiler->simpleCopyLinkFile($left . '.png', 'data/links/zoom_' . $this->id . '.png');
+ }
- return $res;
- }
- public function getClasses() {
- return array_merge(['zoomPopup'], parent::getClasses());
- }
+ public function getClasses() {
+ return array_merge(['zoomPopup'], parent::getClasses());
+ }
}
\ No newline at end of file