1 |
joko |
1.1 |
<? |
2 |
joko |
1.2 |
/** |
3 |
|
|
* This file contains a Data::Lift actor component. |
4 |
|
|
* |
5 |
|
|
* @author Andreas Motl <andreas.motl@ilo.de> |
6 |
|
|
* @package org.netfrag.glib |
7 |
|
|
* @name Data::Lift::hash::job::html |
8 |
|
|
* |
9 |
|
|
*/ |
10 |
|
|
|
11 |
|
|
|
12 |
joko |
1.1 |
// ------------------------------------------------------------------------- |
13 |
joko |
1.3 |
// $Id: html.php,v 1.2 2003/03/10 17:55:30 joko Exp $ |
14 |
joko |
1.1 |
// ------------------------------------------------------------------------- |
15 |
joko |
1.2 |
// $Log: html.php,v $ |
16 |
joko |
1.3 |
// Revision 1.2 2003/03/10 17:55:30 joko |
17 |
|
|
// + metadata for phpDocumentor |
18 |
|
|
// |
19 |
joko |
1.2 |
// Revision 1.1 2003/02/22 16:21:11 joko |
20 |
|
|
// + initial commit |
21 |
|
|
// |
22 |
joko |
1.1 |
// ------------------------------------------------------------------------- |
23 |
|
|
|
24 |
|
|
|
25 |
|
|
// Data::Lift::hash::content2html - |
26 |
|
|
// Convert hash containing content information to html |
27 |
|
|
|
28 |
|
|
|
29 |
|
|
//class Data_Lift_hash_job_html extends Data_Lift { |
30 |
joko |
1.2 |
|
31 |
|
|
|
32 |
|
|
/** |
33 |
|
|
* --- Data::Lift::hash::job::html |
34 |
|
|
* |
35 |
|
|
* |
36 |
|
|
* @author Andreas Motl <andreas.motl@ilo.de> |
37 |
|
|
* @copyright (c) 2003 - All Rights reserved. |
38 |
|
|
* @license GNU LGPL (GNU Lesser General Public License) |
39 |
|
|
* |
40 |
|
|
* @link http://www.netfrag.org/~joko/ |
41 |
|
|
* @link http://www.gnu.org/licenses/lgpl.txt |
42 |
|
|
* |
43 |
|
|
* @package org.netfrag.glib |
44 |
|
|
* @subpackage DataLift |
45 |
|
|
* @name Data::Lift::hash::job::html |
46 |
|
|
* |
47 |
|
|
* @link http://cvs.netfrag.org/php/libs/org.netfrag.glib |
48 |
|
|
* |
49 |
|
|
*/ |
50 |
joko |
1.1 |
class Data_Lift_hash_job_html { |
51 |
|
|
|
52 |
|
|
function perform(&$data) { |
53 |
|
|
|
54 |
|
|
//print Dumper($data); |
55 |
|
|
//return $data; |
56 |
|
|
|
57 |
|
|
//$description = ''; |
58 |
|
|
|
59 |
|
|
//print Dumper($value[description]); |
60 |
|
|
|
61 |
|
|
// V1: |
62 |
|
|
//$name = $value[name]; |
63 |
|
|
//$description = $value[metadata][description]; |
64 |
|
|
|
65 |
|
|
//$description = str_replace("", "\n", $description); |
66 |
|
|
|
67 |
|
|
/* |
68 |
|
|
// V2: |
69 |
|
|
$name = $key; |
70 |
|
|
if (!is_array($value[description])) { |
71 |
|
|
$description = $value[description]; |
72 |
|
|
$description = preg_replace("/^\n+/", " ", $description); |
73 |
|
|
} |
74 |
|
|
if (!$description) { |
75 |
|
|
$description = 'n/a'; |
76 |
|
|
} |
77 |
|
|
|
78 |
|
|
$description = str_replace("\n", "<br/>", $description); |
79 |
|
|
|
80 |
|
|
//$description = preg_replace("/\n+/", " ", $description); |
81 |
|
|
//$description = preg_replace("/^\s+/", "", $description); |
82 |
|
|
*/ |
83 |
|
|
|
84 |
|
|
// V3: |
85 |
|
|
|
86 |
|
|
// 1. modify description |
87 |
|
|
$description = $data[description]; |
88 |
|
|
|
89 |
|
|
if (is_array($description)) { |
90 |
|
|
if (count($description)) { |
91 |
|
|
$description = Dumper($description); |
92 |
|
|
} else { |
93 |
|
|
unset($description); |
94 |
|
|
} |
95 |
|
|
} else { |
96 |
|
|
$description = str_replace("\n", "<br/>", $description); |
97 |
|
|
} |
98 |
|
|
|
99 |
|
|
// if no description could be figured out, set to "not assigned" |
100 |
|
|
if (!$description) { |
101 |
|
|
$description = 'n/a'; |
102 |
|
|
} |
103 |
|
|
$data[description] = $description; |
104 |
|
|
|
105 |
|
|
// 2. try to make up some detailed information about steps from additional metadata |
106 |
joko |
1.3 |
if (is_array($data[container])) { |
107 |
joko |
1.1 |
$steps = array(); |
108 |
|
|
// check 'container' |
109 |
|
|
foreach ($data[container] as $key => $value) { |
110 |
|
|
if (is_array($value)) { |
111 |
|
|
$arg_parts = array(); |
112 |
|
|
|
113 |
|
|
foreach ($value as $step_entry) { |
114 |
|
|
if (is_array($value)) { |
115 |
|
|
$value = join(', ', $value); |
116 |
|
|
} |
117 |
|
|
if (is_array($step_entry)) { |
118 |
|
|
$buf = array(); |
119 |
|
|
foreach ($step_entry as $opt_name => $opt_value) { |
120 |
|
|
// special case 'target' |
121 |
|
|
if ($opt_name == 'target') { |
122 |
|
|
$link = rAnchor($opt_value, array( job => $opt_value ) ); |
123 |
|
|
$opt_value = $link->render(); |
124 |
|
|
} |
125 |
|
|
array_push($buf, "<i>$opt_name</i>=$opt_value"); |
126 |
|
|
} |
127 |
|
|
$value = join(', ', $buf); |
128 |
|
|
} |
129 |
|
|
array_push($arg_parts, "<b>$key</b>: $value"); |
130 |
|
|
} |
131 |
|
|
|
132 |
|
|
$args = join('<br/>', $arg_parts); |
133 |
|
|
} else { |
134 |
|
|
$args = "<b>$key</b>: $value"; |
135 |
|
|
} |
136 |
|
|
array_push($steps, $args); |
137 |
|
|
} |
138 |
|
|
$data[steps] = join('<br/>', $steps); |
139 |
joko |
1.3 |
} |
140 |
joko |
1.1 |
|
141 |
|
|
} |
142 |
|
|
|
143 |
|
|
} |
144 |
|
|
|
145 |
|
|
?> |