2001-10-16 03:25:23 +02:00
|
|
|
<?php
|
2002-10-03 23:38:11 +02:00
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare API - Link box generator *
|
|
|
|
* http://www.phpgroupware.org/api *
|
|
|
|
* Written by Mark Peters <skeeter@phpgroupware.org> *
|
|
|
|
* Creates listboxes using templates *
|
|
|
|
* Copyright (C) 2000 - 2002 Mark Peters *
|
|
|
|
* ------------------------------------------------------------------------ *
|
|
|
|
* This library is part of the phpGroupWare API *
|
|
|
|
* http://www.phpgroupware.org/api *
|
|
|
|
* ------------------------------------------------------------------------ *
|
|
|
|
* This library is free software; you can redistribute it and/or modify it *
|
|
|
|
* under the terms of the GNU Lesser General Public License as published by *
|
|
|
|
* the Free Software Foundation; either version 2.1 of the License, *
|
|
|
|
* or any later version. *
|
|
|
|
* This library is distributed in the hope that it will be useful, but *
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of *
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
|
|
|
|
* See the GNU Lesser General Public License for more details. *
|
|
|
|
* You should have received a copy of the GNU Lesser General Public License *
|
|
|
|
* along with this library; if not, write to the Free Software Foundation, *
|
|
|
|
* Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
|
|
|
|
\**************************************************************************/
|
|
|
|
/* $Id$ */
|
2001-10-16 03:25:23 +02:00
|
|
|
|
2002-10-25 18:44:35 +02:00
|
|
|
require_once('class.portalbox.inc.php');
|
2001-10-16 03:25:23 +02:00
|
|
|
|
|
|
|
class listbox extends portalbox
|
|
|
|
{
|
|
|
|
/*
|
|
|
|
Set up the Object. You will notice, we have not reserved
|
|
|
|
memory space for variables. In this circumstance it is not necessary.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
This is the constructor for the listbox. The only thing this does
|
|
|
|
is to call the constructor of the parent class. Why? Well, whilst
|
|
|
|
PHP manages a certain part of OO, one of the bits it falls down on
|
|
|
|
(at the moment) is constructors within sub-classes. So, to
|
|
|
|
be sure that the sub-class is instantiated with the constructor of
|
|
|
|
the parent class, I simply call the parent constructor. Of course,
|
|
|
|
if I then wanted to override any of the values, I could easily do so.
|
|
|
|
*/
|
2002-10-25 18:44:35 +02:00
|
|
|
function listbox()
|
|
|
|
{
|
2002-10-25 23:40:09 +02:00
|
|
|
$this->portalbox();
|
2002-10-25 18:44:35 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function set_params($param)
|
2001-10-16 03:25:23 +02:00
|
|
|
{
|
2002-10-25 23:40:09 +02:00
|
|
|
$this->portalbox(True);
|
2001-10-16 03:25:23 +02:00
|
|
|
@reset($param);
|
|
|
|
while(list($key,$value) = each($param))
|
|
|
|
{
|
2002-10-03 02:11:48 +02:00
|
|
|
if($key != 'title')
|
2001-10-16 03:25:23 +02:00
|
|
|
{
|
2002-10-03 02:11:48 +02:00
|
|
|
//echo 'Setting '.$key.':'.$value."<br>\n";
|
2001-10-16 03:25:23 +02:00
|
|
|
$this->setvar($key,$value);
|
|
|
|
}
|
|
|
|
}
|
2002-10-25 18:44:35 +02:00
|
|
|
$this->title = $param['title'];
|
2002-10-06 18:18:03 +02:00
|
|
|
|
|
|
|
if($param['app_id'])
|
|
|
|
{
|
|
|
|
$app_id = $this->getvar('app_id');
|
|
|
|
|
|
|
|
$var = Array
|
|
|
|
(
|
|
|
|
'up' => Array('url' => '/set_box.php', 'app' => $app_id),
|
|
|
|
'down' => Array('url' => '/set_box.php', 'app' => $app_id),
|
|
|
|
'close' => Array('url' => '/set_box.php', 'app' => $app_id),
|
|
|
|
'question' => Array('url' => '/set_box.php', 'app' => $app_id),
|
|
|
|
'edit' => Array('url' => '/set_box.php', 'app' => $app_id)
|
|
|
|
);
|
|
|
|
|
|
|
|
while(list($key,$value) = each($var))
|
|
|
|
{
|
|
|
|
$this->set_controls($key,$value);
|
|
|
|
}
|
|
|
|
}
|
2001-10-16 03:25:23 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
This is the only method within the class. Quite simply, as you can see
|
|
|
|
it draws the table(s), placing the required data in the appropriate place.
|
|
|
|
*/
|
|
|
|
function draw($extra_data='')
|
2002-10-06 01:40:51 +02:00
|
|
|
{
|
2002-10-25 23:40:09 +02:00
|
|
|
if(is_array($this->data) && !empty($this->data))
|
2002-10-06 01:40:51 +02:00
|
|
|
{
|
|
|
|
for ($x = 0; $x < count($this->data); $x++)
|
|
|
|
{
|
|
|
|
$var[] = array
|
|
|
|
(
|
|
|
|
'text' => $this->data[$x]['text'],
|
|
|
|
'link' => $this->data[$x]['link'],
|
|
|
|
'lang_link_statustext' => $this->data[$x]['lang_link_statustext']
|
|
|
|
);
|
|
|
|
}
|
2002-10-25 18:44:35 +02:00
|
|
|
$this->listbox = $var;
|
2002-10-06 01:40:51 +02:00
|
|
|
}
|
|
|
|
$this->set_internal($extra_data);
|
2002-10-25 05:04:28 +02:00
|
|
|
$this->draw_box();
|
2002-10-06 01:40:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function xdraw($extra_data='')
|
2001-10-16 03:25:23 +02:00
|
|
|
{
|
2002-10-06 00:00:25 +02:00
|
|
|
if ($extra_data)
|
|
|
|
{
|
|
|
|
$this->start_template(True);
|
|
|
|
}
|
2002-11-30 03:02:32 +01:00
|
|
|
|
2002-10-25 23:40:09 +02:00
|
|
|
if(is_array($this->data) && !empty($this->data))
|
2001-10-16 03:25:23 +02:00
|
|
|
{
|
2001-10-19 04:11:46 +02:00
|
|
|
for ($x = 0; $x < count($this->data); $x++)
|
|
|
|
{
|
2002-10-04 00:02:19 +02:00
|
|
|
$var[] = array
|
2002-10-03 23:38:11 +02:00
|
|
|
(
|
|
|
|
'text' => $this->data[$x]['text'],
|
|
|
|
'link' => $this->data[$x]['link'],
|
|
|
|
'lang_link_statustext' => $this->data[$x]['lang_link_statustext']
|
|
|
|
);
|
2001-10-19 04:11:46 +02:00
|
|
|
}
|
2002-10-25 18:44:35 +02:00
|
|
|
$this->listbox = $var;
|
2001-10-16 03:25:23 +02:00
|
|
|
}
|
2002-10-06 01:40:51 +02:00
|
|
|
$this->set_xinternal($extra_data);
|
2002-10-25 05:04:28 +02:00
|
|
|
$this->draw_box();
|
2001-10-16 03:25:23 +02:00
|
|
|
}
|
|
|
|
}
|
2002-10-03 23:38:11 +02:00
|
|
|
?>
|