|
1 | | -<?php |
2 | | - |
3 | | -namespace Themes\VuetifyCore\Cli; |
4 | | - |
5 | | -use WebFiori\Framework\Ui\WebPage; |
6 | | -use WebFiori\Framework\Writers\ClassWriter; |
7 | | -use WebFiori\Ui\HTMLNode; |
8 | | - |
9 | | -/** |
10 | | - * A class which is used to write header section class of the theme. |
11 | | - * |
12 | | - * @author Ibrahim |
13 | | - */ |
14 | | -class HeaderSectionWriter extends ClassWriter { |
15 | | - /** |
16 | | - * |
17 | | - * @var string |
18 | | - */ |
19 | | - private $wf; |
20 | | - public function getWireframe() : string { |
21 | | - return $this->wf; |
22 | | - } |
23 | | - public function __construct(VuetifyThemeClassWriter $writer) { |
24 | | - parent::__construct('HeaderSection', $writer->getPath(), $writer->getNamespace()); |
25 | | - |
26 | | - $this->addUseStatement(WebPage::class); |
27 | | - $this->addUseStatement(HTMLNode::class); |
28 | | - $this->wf = $writer->getWireframe(); |
29 | | - |
30 | | - } |
31 | | - |
32 | | - public function writeClassBody() { |
33 | | - $wireframe = $this->getWireframe(); |
34 | | - $this->append([ |
35 | | - "/**", |
36 | | - " * Creates new instance of the class.", |
37 | | - " */", |
38 | | - $this->f('__construct',[ |
39 | | - 'page' => 'WebPage' |
40 | | - ]) |
41 | | - ], 1); |
42 | | - |
43 | | - if ($wireframe == 'Side Navigation' || $wireframe == 'Base' || $wireframe == 'System Bar' || $wireframe == 'Inbox') { |
44 | | - $this->append('parent::__construct(\'v-app-bar\', [', 2); |
45 | | - $this->append("'app'", 3); |
46 | | - $this->append(']);', 2); |
47 | | - $this->append("\$this->addChild('v-app-bar-nav-icon', [", 2); |
48 | | - $this->append("'@click' => \"drawer = !drawer\",", 3); |
49 | | - $this->append("'class' => \"d-sm-flex d-md-none\",", 3); |
50 | | - $this->append("'id' => \"nav-menu-icon\",", 3); |
51 | | - $this->append("]);", 2); |
52 | | - $this->append("\$this->addChild('v-toolbar-title')->text(\$page->getWebsiteName());", 2); |
53 | | - } else if ($wireframe == 'Extended Toolbar') { |
54 | | - $this->append('parent::__construct(\'v-app-bar\', [', 2); |
55 | | - $this->append("'app', 'shrink-on-scroll'", 3); |
56 | | - $this->append(']);', 2); |
57 | | - $this->append("\$this->addChild('v-app-bar-nav-icon', [", 2); |
58 | | - $this->append("'@click' => \"drawer = !drawer\",", 3); |
59 | | - $this->append("'class' => \"d-sm-flex d-md-none\",", 3); |
60 | | - $this->append("'id' => \"nav-menu-icon\",", 3); |
61 | | - $this->append("]);", 2); |
62 | | - $this->append("\$this->addChild('v-toolbar-title')->text(\$page->getWebsiteName());", 2); |
63 | | - $this->append("\$this->addChild('v-spacer');", 2); |
64 | | - $this->append("\$this->addChild('v-btn', ['icon'])->addChild('v-icon')->text('mdi-dots-vertical');", 2); |
65 | | - } |
66 | | - $this->append('//TODO: Add components to the header.', 2); |
67 | | - $this->append('}', 1); |
68 | | - $this->append('}'); |
69 | | - } |
70 | | - |
71 | | - public function writeClassComment() { |
72 | | - $this->append('/**'); |
73 | | - $this->append(' * This class represents header section the theme.'); |
74 | | - $this->append(' */'); |
75 | | - } |
76 | | - |
77 | | - public function writeClassDeclaration() { |
78 | | - $this->append("class ".$this->getName().' extends HTMLNode {'); |
79 | | - } |
80 | | - |
81 | | -} |
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Themes\VuetifyCore\Cli; |
| 4 | + |
| 5 | +use WebFiori\Framework\Ui\WebPage; |
| 6 | +use WebFiori\Framework\Writers\ClassWriter; |
| 7 | +use WebFiori\Ui\HTMLNode; |
| 8 | + |
| 9 | +/** |
| 10 | + * A class which is used to write header section class of the theme. |
| 11 | + * |
| 12 | + * @author Ibrahim |
| 13 | + */ |
| 14 | +class HeaderSectionWriter extends ClassWriter { |
| 15 | + /** |
| 16 | + * |
| 17 | + * @var string |
| 18 | + */ |
| 19 | + private $wf; |
| 20 | + public function getWireframe() : string { |
| 21 | + return $this->wf; |
| 22 | + } |
| 23 | + public function __construct(VuetifyThemeClassWriter $writer) { |
| 24 | + parent::__construct('HeaderSection', $writer->getPath(), $writer->getNamespace()); |
| 25 | + |
| 26 | + $this->addUseStatement(WebPage::class); |
| 27 | + $this->addUseStatement(HTMLNode::class); |
| 28 | + $this->wf = $writer->getWireframe(); |
| 29 | + |
| 30 | + } |
| 31 | + |
| 32 | + public function writeClassBody() { |
| 33 | + $wireframe = $this->getWireframe(); |
| 34 | + $this->append([ |
| 35 | + "/**", |
| 36 | + " * Creates new instance of the class.", |
| 37 | + " */", |
| 38 | + ], 1); |
| 39 | + $this->f('__construct',[ |
| 40 | + 'page' => 'WebPage' |
| 41 | + ]); |
| 42 | + |
| 43 | + if ($wireframe == 'Side Navigation' || $wireframe == 'Base' || $wireframe == 'System Bar' || $wireframe == 'Inbox') { |
| 44 | + $this->append('parent::__construct(\'v-app-bar\', [', 2); |
| 45 | + $this->append("'app'", 3); |
| 46 | + $this->append(']);', 2); |
| 47 | + $this->append("\$this->addChild('v-app-bar-nav-icon', [", 2); |
| 48 | + $this->append("'@click' => \"drawer = !drawer\",", 3); |
| 49 | + $this->append("'class' => \"d-sm-flex d-md-none\",", 3); |
| 50 | + $this->append("'id' => \"nav-menu-icon\",", 3); |
| 51 | + $this->append("]);", 2); |
| 52 | + $this->append("\$this->addChild('v-toolbar-title')->text(\$page->getWebsiteName());", 2); |
| 53 | + } else if ($wireframe == 'Extended Toolbar') { |
| 54 | + $this->append('parent::__construct(\'v-app-bar\', [', 2); |
| 55 | + $this->append("'app', 'shrink-on-scroll'", 3); |
| 56 | + $this->append(']);', 2); |
| 57 | + $this->append("\$this->addChild('v-app-bar-nav-icon', [", 2); |
| 58 | + $this->append("'@click' => \"drawer = !drawer\",", 3); |
| 59 | + $this->append("'class' => \"d-sm-flex d-md-none\",", 3); |
| 60 | + $this->append("'id' => \"nav-menu-icon\",", 3); |
| 61 | + $this->append("]);", 2); |
| 62 | + $this->append("\$this->addChild('v-toolbar-title')->text(\$page->getWebsiteName());", 2); |
| 63 | + $this->append("\$this->addChild('v-spacer');", 2); |
| 64 | + $this->append("\$this->addChild('v-btn', ['icon'])->addChild('v-icon')->text('mdi-dots-vertical');", 2); |
| 65 | + } |
| 66 | + $this->append('//TODO: Add components to the header.', 2); |
| 67 | + $this->append('}', 1); |
| 68 | + $this->append('}'); |
| 69 | + } |
| 70 | + |
| 71 | + public function writeClassComment() { |
| 72 | + $this->append('/**'); |
| 73 | + $this->append(' * This class represents header section the theme.'); |
| 74 | + $this->append(' */'); |
| 75 | + } |
| 76 | + |
| 77 | + public function writeClassDeclaration() { |
| 78 | + $this->append("class ".$this->getName().' extends HTMLNode {'); |
| 79 | + } |
| 80 | + |
| 81 | +} |
0 commit comments