1 | <?php |
---|
2 | /**************************************************************************\ |
---|
3 | * eGroupWare API - Result box * |
---|
4 | * This file written by Dan Kuykendall <seek3r@phpgroupware.org> * |
---|
5 | * and Joseph Engo <jengo@phpgroupware.org> * |
---|
6 | * Creates result boxes using templates * |
---|
7 | * Copyright (C) 2000, 2001 Dan Kuykendall * |
---|
8 | * -------------------------------------------------------------------------* |
---|
9 | * This library is part of the eGroupWare API * |
---|
10 | * http://www.egroupware.org/api * |
---|
11 | * ------------------------------------------------------------------------ * |
---|
12 | * This library is free software; you can redistribute it and/or modify it * |
---|
13 | * under the terms of the GNU Lesser General Public License as published by * |
---|
14 | * the Free Software Foundation; either version 2.1 of the License, * |
---|
15 | * or any later version. * |
---|
16 | * This library is distributed in the hope that it will be useful, but * |
---|
17 | * WITHOUT ANY WARRANTY; without even the implied warranty of * |
---|
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * |
---|
19 | * See the GNU Lesser General Public License for more details. * |
---|
20 | * You should have received a copy of the GNU Lesser General Public License * |
---|
21 | * along with this library; if not, write to the Free Software Foundation, * |
---|
22 | * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * |
---|
23 | \**************************************************************************/ |
---|
24 | |
---|
25 | |
---|
26 | CreateObject('phpgwapi.portalbox'); |
---|
27 | |
---|
28 | class resultbox extends portalbox |
---|
29 | { |
---|
30 | /* |
---|
31 | Set up the Object. You will notice, we have not reserved memory |
---|
32 | space for variables. In this circumstance it is not necessary. |
---|
33 | */ |
---|
34 | //constructor |
---|
35 | function resultbox($title='', $primary='', $secondary='', $tertiary='') |
---|
36 | { |
---|
37 | $this->portalbox($title, $primary, $secondary, $tertiary); |
---|
38 | $this->setvar('outerwidth',400); |
---|
39 | $this->setvar('innerwidth',400); |
---|
40 | } |
---|
41 | |
---|
42 | /* |
---|
43 | This is the only method within the class. Quite simply, as you can see |
---|
44 | it draws the table(s), placing the required data in the appropriate place. |
---|
45 | */ |
---|
46 | function draw() |
---|
47 | { |
---|
48 | echo '<table border="'.$this->getvar('outerborderwidth') |
---|
49 | . '" cellpadding="0" cellspacing="0" width="' . $this->getvar('outerwidth') |
---|
50 | . '" bordercolor="' . $this->getvar('outerbordercolor') |
---|
51 | . '" bgcolor="' . $this->getvar('titlebgcolor') . '">'; |
---|
52 | echo '<tr><td align="center">'.$this->getvar("title") . '</td></tr>'; |
---|
53 | echo '<tr><td>'; |
---|
54 | echo '<table border="0" cellpadding="0" cellspacing="0" width="'.$this->getvar('innerwidth') |
---|
55 | . '" bgcolor="' . $this->getvar('innerbgcolor') . '">'; |
---|
56 | $data_count = count($this->data); |
---|
57 | for ($x = 0; $x < $data_count; ++$x) |
---|
58 | { |
---|
59 | echo '<tr>'; |
---|
60 | echo '<td width="50%">' . $this->data[$x][0] . '</td>'; |
---|
61 | echo '<td width="50%">' . $this->data[$x][1] . '</td>'; |
---|
62 | echo '</tr>'; |
---|
63 | } |
---|
64 | echo '</table>'; |
---|
65 | echo '</td></tr>'; |
---|
66 | echo '</table>'; |
---|
67 | } |
---|
68 | } |
---|