2001-01-12 05:07:40 +01:00
|
|
|
<?php
|
2002-10-03 23:38:11 +02:00
|
|
|
/**************************************************************************\
|
|
|
|
* phpGroupWare API - Portal Box manager *
|
|
|
|
* Written by Joseph Engo <jengo@phpgroupware.org> *
|
|
|
|
* Helps manage the portal boxes for phpGroupWares main page *
|
|
|
|
* Copyright (C) 2000 - 2002 Joseph Engo *
|
|
|
|
* ------------------------------------------------------------------------ *
|
|
|
|
* 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-01-12 05:07:40 +01:00
|
|
|
|
2001-10-02 07:10:14 +02:00
|
|
|
class portalbox
|
|
|
|
{
|
|
|
|
//Set up the Object, reserving memory space for variables
|
|
|
|
|
|
|
|
var $outerwidth;
|
2001-10-16 03:31:47 +02:00
|
|
|
var $outerborderwidth = 1;
|
2001-10-02 07:10:14 +02:00
|
|
|
var $width;
|
|
|
|
var $innerwidth;
|
2001-10-16 03:31:47 +02:00
|
|
|
var $controls;
|
|
|
|
var $header_background_image;
|
|
|
|
var $classname;
|
|
|
|
var $up;
|
|
|
|
var $down;
|
|
|
|
var $close;
|
|
|
|
var $question;
|
|
|
|
var $edit;
|
2002-10-03 23:38:11 +02:00
|
|
|
|
|
|
|
var $output;
|
2001-10-21 12:49:29 +02:00
|
|
|
var $data = Array();
|
2001-10-02 07:10:14 +02:00
|
|
|
|
|
|
|
// Textual variables
|
|
|
|
var $title;
|
|
|
|
|
2001-10-16 03:31:47 +02:00
|
|
|
// Template
|
|
|
|
var $p;
|
|
|
|
|
2001-10-02 07:10:14 +02:00
|
|
|
/*
|
|
|
|
Use these functions to get and set the values of this
|
|
|
|
object's variables. This is good OO practice, as it means
|
|
|
|
that datatype checking can be completed and errors raised accordingly.
|
|
|
|
*/
|
|
|
|
function setvar($var,$value='')
|
|
|
|
{
|
|
|
|
if ($value=='')
|
|
|
|
{
|
|
|
|
global $$var;
|
|
|
|
$value = $$var;
|
|
|
|
}
|
|
|
|
$this->$var = $value;
|
|
|
|
// echo $var." = ".$this->$var."<br>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
function getvar($var='')
|
|
|
|
{
|
|
|
|
if ($var=='' || !isset($this->$var))
|
|
|
|
{
|
2001-10-16 03:31:47 +02:00
|
|
|
echo 'Programming Error: '.$this->getvar('classname').'->getvar('.$var.')!<br>'."\n";
|
2002-09-28 22:01:44 +02:00
|
|
|
$GLOBALS['phpgw_info']['flags']['nodisplay'] = True;
|
|
|
|
exit;
|
2001-10-02 07:10:14 +02:00
|
|
|
}
|
|
|
|
//echo "Var = ".$var."<br>\n";
|
|
|
|
//echo $var." = ".$this->$var."<br>\n";
|
|
|
|
return $this->$var;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
This is the constructor for the object.
|
|
|
|
*/
|
2002-10-03 02:11:48 +02:00
|
|
|
function portalbox($title='')
|
2001-10-02 07:10:14 +02:00
|
|
|
{
|
|
|
|
$this->setvar('title',$title);
|
|
|
|
// echo 'After SetVar Title = '.$this->getvar('title')."<br>\n";
|
|
|
|
}
|
2001-10-16 03:31:47 +02:00
|
|
|
|
|
|
|
function start_template()
|
|
|
|
{
|
2002-10-03 23:38:11 +02:00
|
|
|
$GLOBALS['phpgw']->xslttpl->add_file(array('portal'));
|
2001-10-16 03:31:47 +02:00
|
|
|
|
2002-10-03 23:38:11 +02:00
|
|
|
$this->output = array
|
|
|
|
(
|
2002-10-03 02:11:48 +02:00
|
|
|
'outer_border' => $this->getvar('outerborderwidth'),
|
|
|
|
'outer_width' => $this->getvar('width'),
|
|
|
|
'title' => $this->getvar('title'),
|
|
|
|
'inner_width' => $this->getvar('width'),
|
2002-10-03 23:38:11 +02:00
|
|
|
'header_background_image' => $this->getvar('header_background_image')
|
2001-10-16 03:31:47 +02:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
function set_controls($control='',$control_param='')
|
|
|
|
{
|
2002-10-03 23:38:11 +02:00
|
|
|
//echo '<br>Control: ' . $control . ', control_param="' . $control_param . '"';
|
|
|
|
|
2002-03-31 16:22:08 +02:00
|
|
|
if($control != '' && is_array($control_param))
|
2001-10-16 03:31:47 +02:00
|
|
|
{
|
|
|
|
$this->setvar($control,$GLOBALS['phpgw']->link($control_param['url'],'app='.$control_param['app'].'&control='.$control));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2001-10-21 12:49:29 +02:00
|
|
|
function set_internal($data='')
|
2001-10-16 03:31:47 +02:00
|
|
|
{
|
2001-10-21 12:49:29 +02:00
|
|
|
if($data=='' && !count($this->data))
|
|
|
|
{
|
2002-10-03 23:38:11 +02:00
|
|
|
$data = ' ';
|
2001-10-21 12:49:29 +02:00
|
|
|
}
|
2002-10-03 23:38:11 +02:00
|
|
|
|
|
|
|
$this->output['portal_row']['extrabox'] = array
|
|
|
|
(
|
|
|
|
'data' => $data
|
|
|
|
);
|
2001-10-16 03:31:47 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function draw_box()
|
|
|
|
{
|
|
|
|
$control = '';
|
|
|
|
if($this->up || $this->down || $this->close || $this->question || $this->edit)
|
|
|
|
{
|
2002-10-03 23:38:11 +02:00
|
|
|
$control_array = array
|
|
|
|
(
|
2001-10-16 03:31:47 +02:00
|
|
|
'up',
|
|
|
|
'down',
|
|
|
|
'question',
|
|
|
|
'close',
|
|
|
|
'edit'
|
|
|
|
);
|
|
|
|
@reset($control_array);
|
|
|
|
while(list($key,$param) = each($control_array))
|
|
|
|
{
|
|
|
|
if(isset($this->$param) && $this->$param)
|
|
|
|
{
|
|
|
|
$image_width = 15;
|
|
|
|
if($param == 'edit')
|
|
|
|
{
|
|
|
|
$image_width = 30;
|
|
|
|
}
|
2002-10-03 23:38:11 +02:00
|
|
|
|
|
|
|
$control_link[] = array
|
|
|
|
(
|
|
|
|
'param_url' => $this->$param,
|
|
|
|
'link_img' => $GLOBALS['phpgw']->common->image('phpgwapi',$param.'.button'),
|
|
|
|
'img_width' => $image_width,
|
|
|
|
'lang_param_statustext' => lang($param)
|
|
|
|
);
|
2001-10-16 03:31:47 +02:00
|
|
|
}
|
|
|
|
}
|
2002-10-03 23:38:11 +02:00
|
|
|
|
|
|
|
$this->output['control_link'] = $control_link;
|
2001-10-16 03:31:47 +02:00
|
|
|
}
|
2002-10-03 23:38:11 +02:00
|
|
|
$GLOBALS['phpgw']->xslttpl->set_var('portal',$this->output);
|
|
|
|
return $GLOBALS['phpgw']->xslttpl->parse();
|
2001-10-16 03:31:47 +02:00
|
|
|
}
|
2001-10-02 07:10:14 +02:00
|
|
|
}
|