1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* This file is part of the O2System PHP Framework package. |
4
|
|
|
* |
5
|
|
|
* For the full copyright and license information, please view the LICENSE |
6
|
|
|
* file that was distributed with this source code. |
7
|
|
|
* |
8
|
|
|
* @author Steeve Andrian Salim |
9
|
|
|
* @copyright Copyright (c) Steeve Andrian Salim |
10
|
|
|
*/ |
11
|
|
|
// ------------------------------------------------------------------------ |
12
|
|
|
|
13
|
|
|
namespace O2System\Framework\Http\Presenter; |
14
|
|
|
|
15
|
|
|
// ------------------------------------------------------------------------ |
16
|
|
|
|
17
|
|
|
use O2System\Kernel\Http\Message\Uri; |
18
|
|
|
use O2System\Framework\Libraries\Ui\Components\Breadcrumb; |
19
|
|
|
use O2System\Framework\Libraries\Ui\Contents\Link; |
20
|
|
|
use O2System\Psr\Patterns\Structural\Repository\AbstractRepository; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* Class Page |
24
|
|
|
* |
25
|
|
|
* @package App\Datastructures |
26
|
|
|
*/ |
27
|
|
|
class Page extends AbstractRepository |
28
|
|
|
{ |
29
|
|
|
/** |
30
|
|
|
* Page::__construct |
31
|
|
|
*/ |
32
|
|
|
public function __construct() |
33
|
|
|
{ |
34
|
|
|
// Create Page breadcrumbs |
35
|
|
|
$breadcrumb = new Breadcrumb(); |
36
|
|
|
$breadcrumb->createList( new Link( language()->getLine( 'HOME' ), base_url() ) ); |
37
|
|
|
$this->store( 'breadcrumb', $breadcrumb ); |
38
|
|
|
|
39
|
|
|
// Store Page Uri |
40
|
|
|
$uri = new Uri(); |
41
|
|
|
$this->store( 'uri', $uri ); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
// ------------------------------------------------------------------------ |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* Page::setHeader |
48
|
|
|
* |
49
|
|
|
* @param string $header |
50
|
|
|
* |
51
|
|
|
* @return static |
52
|
|
|
*/ |
53
|
|
|
public function setHeader( $header ) |
54
|
|
|
{ |
55
|
|
|
$header = trim( $header ); |
56
|
|
|
$this->store( 'header', $header ); |
57
|
|
|
presenter()->meta->offsetSet( 'subtitle', $header ); |
|
|
|
|
58
|
|
|
presenter()->meta->title->append( $header ); |
59
|
|
|
|
60
|
|
|
return $this; |
61
|
|
|
} |
62
|
|
|
|
63
|
|
|
// ------------------------------------------------------------------------ |
64
|
|
|
|
65
|
|
|
/** |
66
|
|
|
* Page::setSubHeader |
67
|
|
|
* |
68
|
|
|
* @param string $subHeader |
69
|
|
|
* |
70
|
|
|
* @return static |
71
|
|
|
*/ |
72
|
|
|
public function setSubHeader( $subHeader ) |
73
|
|
|
{ |
74
|
|
|
$this->store( 'subHeader', trim( $subHeader ) ); |
75
|
|
|
|
76
|
|
|
return $this; |
77
|
|
|
} |
78
|
|
|
|
79
|
|
|
// ------------------------------------------------------------------------ |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* Page::setDescription |
83
|
|
|
* |
84
|
|
|
* @param string $description |
85
|
|
|
* |
86
|
|
|
* @return static |
87
|
|
|
*/ |
88
|
|
|
public function setDescription( $description ) |
89
|
|
|
{ |
90
|
|
|
$description = trim( $description ); |
91
|
|
|
$this->store( 'description', $description ); |
92
|
|
|
|
93
|
|
|
return $this; |
94
|
|
|
} |
95
|
|
|
|
96
|
|
|
// ------------------------------------------------------------------------ |
97
|
|
|
} |