|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
class Ajde_Layout extends Ajde_Template |
|
4
|
|
|
{ |
|
5
|
|
|
public function __construct($name, $style = 'default', $format = null) |
|
6
|
|
|
{ |
|
7
|
|
|
$this->setName($name); |
|
8
|
|
|
$this->setStyle($style); |
|
9
|
|
|
|
|
10
|
|
|
$base = LAYOUT_DIR.$this->getName().DIRECTORY_SEPARATOR; |
|
11
|
|
|
$action = $this->getStyle(); |
|
12
|
|
|
if (!$format) { |
|
13
|
|
|
if ((Ajde_Http_Request::isAjax() && $this->exist($base, $action, 'ajax')) |
|
14
|
|
|
|| Ajde::app()->getDocument()->getFormat() === 'ajax' |
|
|
|
|
|
|
15
|
|
|
) { |
|
16
|
|
|
$format = 'ajax'; |
|
17
|
|
|
} else { |
|
18
|
|
|
if (Ajde::app()->getDocument()->getFormat() === 'crud') { |
|
|
|
|
|
|
19
|
|
|
$format = 'crud'; |
|
20
|
|
|
} else { |
|
21
|
|
|
$format = 'html'; |
|
22
|
|
|
} |
|
23
|
|
|
} |
|
24
|
|
|
} |
|
25
|
|
|
parent::__construct($base, $action, $format); |
|
26
|
|
|
} |
|
27
|
|
|
|
|
28
|
|
|
public function setName($name) |
|
29
|
|
|
{ |
|
30
|
|
|
$this->set('name', $name); |
|
31
|
|
|
} |
|
32
|
|
|
|
|
33
|
|
|
public function setStyle($style) |
|
34
|
|
|
{ |
|
35
|
|
|
$this->set('style', $style); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
public function getName() |
|
39
|
|
|
{ |
|
40
|
|
|
return $this->get('name'); |
|
41
|
|
|
} |
|
42
|
|
|
|
|
43
|
|
|
public function getStyle() |
|
44
|
|
|
{ |
|
45
|
|
|
return $this->get('style'); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
public function getFormat() |
|
49
|
|
|
{ |
|
50
|
|
|
return $this->get('format'); |
|
51
|
|
|
} |
|
52
|
|
|
|
|
53
|
|
|
public function getDocument() |
|
54
|
|
|
{ |
|
55
|
|
|
return $this->get('document'); |
|
56
|
|
|
} |
|
57
|
|
|
|
|
58
|
|
|
public function setDocument(Ajde_Document $document) |
|
59
|
|
|
{ |
|
60
|
|
|
return $this->set('document', $document); |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
public function getDefaultResourcePosition() |
|
64
|
|
|
{ |
|
65
|
|
|
return Ajde_Document_Format_Html::RESOURCE_POSITION_FIRST; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
public function requireTimeoutWarning() |
|
69
|
|
|
{ |
|
70
|
|
|
$this->requireJs('core.timeout', 'html', LAYOUT_DIR.'admin/'); |
|
|
|
|
|
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|
If you implement
__calland you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__callis implemented by a parent class and only the child class knows which methods exist: