$pageButton) { if (!($pageButton instanceof Control)) { trigger_error('No Control instance given.', E_USER_ERROR); } $pageButton->assignId(); if (!($pageButton instanceof Scriptable)) { trigger_error('No Scriptable instance given.', E_USER_ERROR); } $pageButton->setScriptEvents(true); $actionIds[$pageButton->getId()] = $action; } $pageIds = array(); foreach ($pages as $page) { if (!($page instanceof Control)) { trigger_error('No Control instance given.', E_USER_ERROR); } $page->assignId(); if (!empty($pageIds)) { $page->setVisible(false); } array_push($pageIds, $page->getId()); } if ($counterLabel) { $counterLabel->assignId(); $counterId = $counterLabel->getId(); } else { $counterId = uniqid(); } array_push($this->pages, array($actionIds, $pageIds, $counterId)); } /** * * @see \FML\Script\Sections\Includes::getIncludes() */ public function getIncludes() { $includes = array(); $includes["TextLib"] = "TextLib"; return $includes; } /** * * @see \FML\Script\Sections\Constants::getConstants() */ public function getConstants() { $constant = '['; $index = 0; foreach ($this->pages as $page) { $constant .= '['; $actionIds = $page[0]; foreach ($actionIds as $actionId => $action) { $constant .= '"' . $actionId . '" => ["' . $action . '"], '; } $constant .= '"__FML__Pages__Id__" => ["' . $page[2] . '"], '; $constant .= '"__FML__Pages__Ids__" => ['; $subIndex = 0; foreach ($page[1] as $pageId) { $constant .= '"' . $pageId . '"'; if ($subIndex < count($page[1]) - 1) { $constant .= ', '; } $subIndex++; } $constant .= ']]'; if ($index < count($this->pages) - 1) { $constant .= ', '; } $index++; } $constant .= ']'; $constants = array(); $constants[self::C_PAGEIDS] = $constant; return $constants; } /** * * @see \FML\Script\Sections\Globals::getGlobals() */ public function getGlobals() { $globals = array(); $globals['G_FML_PageIndexes'] = 'Integer[Text]'; return $globals; } /** * * @see \FML\Script\Sections\Labels::getLabels() */ public function getLabels() { $labels = array(); $labelOnInit = file_get_contents(__DIR__ . '/Templates/PageOnInit.txt'); $labels[Labels::ONINIT] = $labelOnInit; $labelMouseClick = file_get_contents(__DIR__ . '/Templates/PageMouseClick.txt'); $labels[Labels::MOUSECLICK] = $labelMouseClick; return $labels; } }