bzr branch
http://darksoft.org/webbzr/adei/trunk
11
by Suren A. Chilingaryan
Graph navigation: mouse wheel, modifier keys, etc. |
1 |
<?php
|
2 |
||
114
by Suren A. Chilingaryan
Massive rewrite of DRAW (unfinished): multiple groups and axis |
3 |
require($ADEI_ROOTDIR . "/classes/drawtext.php"); |
4 |
||
5 |
||
6 |
class WELCOME extends DRAWText { |
|
11
by Suren A. Chilingaryan
Graph navigation: mouse wheel, modifier keys, etc. |
7 |
var $req; |
8 |
var $height, $width; |
|
9 |
var $graph; |
|
10 |
||
11 |
var $tmpfile; |
|
12 |
var $ready; |
|
13 |
||
14 |
function __construct(REQUEST $req = NULL) { |
|
114
by Suren A. Chilingaryan
Massive rewrite of DRAW (unfinished): multiple groups and axis |
15 |
parent::__construct($req); |
11
by Suren A. Chilingaryan
Graph navigation: mouse wheel, modifier keys, etc. |
16 |
|
17 |
if (is_file($TMP_PATH . "/" . $this->tmpfile)) $this->ready = true; |
|
18 |
else $this->ready = false; |
|
19 |
}
|
|
20 |
||
21 |
function GetTmpFile() { |
|
22 |
global $ADEI_SESSION; |
|
23 |
global $TMP_PATH; |
|
24 |
||
25 |
$dir = "clients/" . $ADEI_SESSION . "/"; |
|
26 |
||
27 |
if (!is_dir($TMP_PATH . "/" . $dir)) { |
|
28 |
if (!@mkdir($TMP_PATH . "/" . $dir, 0755, true)) |
|
29 |
throw new ADEIException(translate("DRAW class have not access to the temporary directory")); |
|
30 |
}
|
|
31 |
||
32 |
return $dir . "welcome-" . $this->width . "x" . $this->height . ".png"; |
|
33 |
}
|
|
34 |
||
35 |
||
36 |
function Create() { |
|
37 |
if ($this->ready) return; |
|
38 |
||
39 |
$this->graph = new CanvasGraph($this->width, $this->height, 'auto'); |
|
40 |
$this->graph->SetMargin(5,11,6,11); |
|
41 |
/*
|
|
42 |
$this->graph->SetShadow();
|
|
43 |
$this->graph->SetMarginColor( "teal");
|
|
44 |
$this->graph->InitFrame();
|
|
45 |
*/
|
|
46 |
||
47 |
$hpos = 15; |
|
48 |
||
49 |
$text = new Text("ADEI", $this->width/2, $hpos); |
|
50 |
$text->SetFont(FF_ARIAL, FS_BOLD, 24); |
|
51 |
$text->Align('center', 'top'); |
|
52 |
$text->Stroke( $this->graph->img); |
|
53 |
||
54 |
$hpos += $text->GetTextHeight($this->graph->img) + 10; |
|
55 |
||
76
by Suren A. Chilingaryan
Fix from UI branch: prevent filtering of uncached virtual groups and databases |
56 |
// $msg = "Welcome to the Advanced Data Extraction Infrastructure! Please";
|
11
by Suren A. Chilingaryan
Graph navigation: mouse wheel, modifier keys, etc. |
57 |
$msg = preg_replace( |
58 |
array("/\n([^\n])/"), |
|
59 |
array(' \1'), |
|
60 |
file_get_contents("docs/welcome.txt") |
|
61 |
);
|
|
62 |
||
63 |
||
64 |
$text_width = $this->width - 50; |
|
65 |
if ($text_width < 100) return; |
|
66 |
||
67 |
$text = new Text($msg, $this->width/2, $hpos); |
|
68 |
$text->SetFont(FF_ARIAL, FS_NORMAL, 18); |
|
69 |
$text->Align('center', 'top'); |
|
70 |
||
71 |
$width = $text->GetWidth($this->graph->img); |
|
72 |
if ($width > $text_width) { |
|
73 |
$char_width = ceil($width / strlen($msg)); |
|
74 |
$cpl = $text_width / $char_width; |
|
75 |
||
76 |
$wmsg = wordwrap($msg, $cpl, "\n", true); |
|
77 |
$text->Set($wmsg); |
|
78 |
||
79 |
$width = $text->GetWidth($this->graph->img); |
|
80 |
while (($width > $text_width)&&($cpl>10)) { |
|
81 |
$cpl-=$cpl/10; |
|
82 |
$wmsg = wordwrap($msg, $cpl, "\n", true); |
|
83 |
$text->Set($wmsg); |
|
84 |
$width = $text->GetWidth($this->graph->img); |
|
85 |
}
|
|
86 |
}
|
|
87 |
||
88 |
||
89 |
$text->Stroke( $this->graph->img); |
|
90 |
||
91 |
||
92 |
// $text->ParagraphAlign('center');
|
|
93 |
// $text->SetBox( "white", "black","gray");
|
|
94 |
||
95 |
||
96 |
/*
|
|
97 |
// $text->Align('left', 'top');
|
|
98 |
// $text->ParagraphAlign('left');
|
|
99 |
// $text->SetBox( "white", "black","gray");
|
|
100 |
|
|
101 |
$width = $text->GetWidth($this->graph->img);
|
|
102 |
|
|
103 |
*/
|
|
104 |
// $text->Stroke( $this->graph->img);
|
|
105 |
}
|
|
106 |
}
|
|
107 |
||
108 |
?>
|