-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnavigation.class
More file actions
92 lines (66 loc) · 2.2 KB
/
Copy pathnavigation.class
File metadata and controls
92 lines (66 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<?php
/*
Copyright (C) 2004 Samuel J. Greear. All rights reserved.
$Id$
*/
class Navigation extends XMLement {
private $Order;
const ORDER_EARLY = 1;
const ORDER_LATE = 2;
public function __construct($style) {
parent::__construct('navigation', NULL, 'navigation');
$this->SetAttribute('style', $style);
}
public function AddElement($value) {
parent::AddElement('element', $value);
}
public function AddItem($title=NULL, $address=NULL, $summary=NULL, $icon=NULL) {
$this->AddChild(new NavigationItem($title, $address, $summary, $icon));
}
public function AddHeader($name) {
$element = $this->ForkChild('header');
$element->AddElement('heading', $name);
$this->AddChild($element);
}
public function AddText($text) {
$element = $this->ForkChild('text');
$element->AddElement('text', $text);
$this->AddChild($element);
}
public function AddBox($text) {
$element = $this->ForkChild('box');
$element->AddElement('box', $text);
$this->AddChild($element);
}
public function HintOrder($hint) {
if ($hint != Navigation::ORDER_EARLY || $hint != Navigation::ORDER_LATE)
throw new Exception('Invalid order hint specified.');
$this->Order = $hint;
}
}
class NavigationItem extends XMLement {
private $Title = NULL;
private $Address = NULL;
private $Summary = NULL;
private $Data = NULL;
private $Icon = NULL;
public function __construct($title=NULL, $address=NULL, $summary=NULL, $icon=NULL) {
$this->Title = $title;
$this->Address = $address;
$this->Summary = $summary;
$this->Icon = $icon;
$this->Create();
}
private function Create() {
parent::__construct('item', NULL, 'navigation');
if ($this->Title != NULL)
$this->AddElement('title', $this->Title);
if ($this->Address != NULL)
$this->AddElement('address', $this->Address);
if ($this->Summary != NULL)
$this->AddElement('summary', $this->Summary);
if ($this->Icon != NULL)
$this->AddElement('icon', $this->Icon);
}
}
?>