egroupware_official/phpgwapi/inc/class.sbox2.inc.php

603 lines
19 KiB
PHP
Raw Normal View History

2001-05-28 21:48:31 +02:00
<?php
/**************************************************************************\
* phpGroupWare API - Select Box 2 *
* Written by Ralf Becker <RalfBecker@outdoor-training.de> *
* Class for creating select boxes for addresse, projects, array items, ... *
* Copyright (C) 2000, 2001 Dan Kuykendall *
* -------------------------------------------------------------------------*
* This library is part of the phpGroupWare API *
2002-02-24 22:21:53 +01:00
* http://www.phpgroupware.org/api *
2001-05-28 21:48:31 +02:00
* ------------------------------------------------------------------------ *
* 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$ */
2002-02-24 22:21:53 +01:00
if(!isset($GLOBALS['phpgw_info']['flags']['included_classes']['sbox']))
{
include(PHPGW_API_INC . '/class.sbox.inc.php');
$GLOBALS['phpgw_info']['flags']['included_classes']['sbox'] = True;
}
2001-09-23 20:58:31 +02:00
class sbox2 extends sbox
{
2001-05-28 21:48:31 +02:00
/*
2001-09-23 20:58:31 +02:00
* Function: search for an id of an db-entry, eg. an address
* Parameter: $name base name for all template-vars and of the submitted vars (not to conflict with other template-var-names !!!)
* $lang_name titel of the field
* $prompt for the JavaScript prompt()
* $id_name id of previosly selected entry
* $content from id (eg. 'company: lastname, givenname' for address $id) if $id != 0, or
* array with searchresult (id's as key), if array is empty if search was unsucsessful
2001-12-24 16:34:08 +01:00
* $multipe present a multiple selectable box instead of one selector-button
2001-09-23 20:58:31 +02:00
* Returns: array with vars to set in temaplate, the vars are:
* {doSearchFkt} Javascript Funktion, place somewhere in Template (before rest of the vars)
* {$name.'_title} button with titel $lang_name (if JS) or just $lang_name
* {$name} content of $id if != 0, or lang('use Button to search for').$lang_name
* {$name.'_nojs} searchfield + button if we have no JavaScript, else empty
2001-05-28 21:48:31 +02:00
*
* To use call $template->set_var(getIdSearch( ... ));
2001-12-24 16:34:08 +01:00
* the template should look like {doSearchFkt} <tr><td>{XXX_title}</td><td>{XXX}</td><td>{XXX_nojs}</td></tr> (XXX is content of $name)
2001-05-28 21:48:31 +02:00
* In the submitted page the vars $query_XXX and $id_XXX are set according to what is selected, see getAddress as Example
*/
2003-05-05 22:59:14 +02:00
function sbox2()
{
$this->sbox(); // call constructor extended class
}
2001-12-24 16:34:08 +01:00
function getId($name,$lang_name,$prompt,$id_name,$content='',$note='',$multiple=False)
2001-09-23 20:58:31 +02:00
{
2001-05-28 21:48:31 +02:00
// echo "<p>getId('$name','$lang_name','$prompt',$id_name,'$content') =";
2002-02-24 22:21:53 +01:00
$ret['doSearchFkt'] =
2001-05-28 21:48:31 +02:00
'<script language="JavaScript">'."\n".
" function doSearch(field,ask) {\n".
" field.value = prompt(ask,'');\n".
" if (field.value != 'null') {\n".
" if (field.value.length == 0)\n".
" field.value = '%';\n".
" field.form.submit();\n".
2001-05-28 21:48:31 +02:00
" } else\n".
" field.value = ''\n".
" }\n".
'</script>';
2002-02-24 22:21:53 +01:00
$ret[$name.'_title'] = is_array($content) && count($content) ? $lang_name :
2001-05-28 21:48:31 +02:00
'<script language="JavaScript">'."\n".
" document.writeln('<input type=\"hidden\" name=\"query_$name\" value=\"\">');\n".
" document.writeln('<input type=\"button\" onClick=\"doSearch(this.form.query_$name,\'$prompt\')\" value=\"$lang_name\">');\n".
"</script>\n".
"<noscript>\n".
" $lang_name\n".
"</noscript>";
2001-09-23 20:58:31 +02:00
if (is_array($content))
2002-02-24 22:21:53 +01:00
{
// result from search
2001-09-23 20:58:31 +02:00
if (!count($content))
2002-02-24 22:21:53 +01:00
{
// search was unsuccsessful
2001-05-28 21:48:31 +02:00
$ret[$name] = lang('no entries found, try again ...');
2001-09-23 20:58:31 +02:00
}
else
{
$ret[$name.'_OK'] = ''; // flag we have something so select
2001-12-24 16:34:08 +01:00
if ($multiple)
{
$ret[$name] = '<select name="id_'.$name.'[]" size=10 multiple>'."\n";
}
else
{
$ret[$name] = '<select name="id_'.$name.'">'."\n";
}
2001-09-23 20:58:31 +02:00
while (list( $id,$text ) = each( $content ))
{
$ret[$name] .= "<option value=\"$id\">" . $GLOBALS['phpgw']->strip_html($text) . "\n";
2001-05-28 21:48:31 +02:00
}
$ret[$name] .= '<option value="0">'.lang('none')."\n";
$ret[$name] .= '</select>';
}
2001-09-23 20:58:31 +02:00
}
else
{
if ($id_name)
{
2001-05-28 21:48:31 +02:00
$ret[$name] = $content . "\n<input type=\"hidden\" name=\"id_$name\" value=\"$id_name\">";
2001-09-23 20:58:31 +02:00
}
else
{
$ret[$name] = "<span class=note>$note</span>";
2001-09-23 20:58:31 +02:00
}
}
2001-05-28 21:48:31 +02:00
$ret[$name.'_nojs'] =
"<noscript>\n".
2002-02-24 22:21:53 +01:00
" <input name=\"query_$name\" value=\"\" size=10> &nbsp;<input type=\"submit\" value=\"?\">\n".
2001-05-28 21:48:31 +02:00
"</noscript>";
// print_r($ret);
return $ret;
}
2002-06-30 14:18:07 +02:00
function event2name( $event )
{
if (!is_object($this->bocal))
{
$this->bocal = createobject('calendar.bocalendar');
}
if (!is_array($event) && (int) $event > 0)
{
$event = $this->bocal->read_entry($event);
}
if (!is_array($event))
{
return 'not an event !!!';
}
$name = $GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['start']) - $this->bocal->datetime->tz_offset);
$name .= ' -- ' . $GLOBALS['phpgw']->common->show_date($this->bocal->maketime($event['end']) - $this->bocal->datetime->tz_offset);
$name .= ': ' . $event['title'];
return $GLOBALS['phpgw']->strip_html($name);
}
/*
* Function Allows you to show and select an event from the calendar (works with and without javascript !!!)
* Parameters $name string with basename of all variables (not to conflict with the name other template or submitted vars !!!)
* $id_name id of the address for edit or 0 if none selected so far
* $query_name have to be called $query_XXX, the search pattern after the submit, has to be passed back to the function
* $multipe present a multiple selectable box instead of one selector-button
* On Submit $id_XXX contains the selected event (if != 0)
* $query_XXX search pattern if the search button is pressed by the user, or '' if regular submit
* Returns array with vars to set for the template, set with: $template->set_var( getEvent( ... )); (see getId( ))
*
* Note As query's for an event are submitted, you have to check $query_XXX if it is a search or a regular submit (!$query_string)
*/
function getEvent( $name,$id_name,$query_name,$title='',$multiple=False)
{
// echo "<p>getEvent('$name',$id_name,'$query_name','$title')</p>";
// fallback if calendar is not installed or not enabled for user
if (!file_exists(PHPGW_SERVER_ROOT.'/calendar') || !$GLOBALS['phpgw_info']['user']['apps']['calendar']['enabled'])
{
return array(
$name => "<input type=\"hidden\" name=\"id_$name\" value=\"$id_name\">\n",
$name.'_no_js' => '',
$name.'_title' => ''
);
}
if ($id_name || $query_name)
{
if (!is_object($this->bocal))
{
$this->bocal = createobject('calendar.bocalendar');
}
if ($query_name)
{
$event_ids = $this->bocal->search_keywords($query_name);
$content = array( );
while ($event_ids && list( $key,$id ) = each( $event_ids ))
{
$content[$id] = $this->event2name( $id );
}
}
else
{
$event = $this->bocal->read_entry( $id_name );
if ($event && is_array($event))
{
$content = $this->event2name( $event );
}
}
}
if (!$title)
{
$title = lang('Calendar');
}
return $this->getId($name,$title,lang('Pattern for Search in Calendar'),$id_name,$content,lang('use Button to search for Calendarevent'),$multiple);
}
2001-09-23 20:58:31 +02:00
function addr2name( $addr )
{
2001-05-28 21:48:31 +02:00
$name = $addr['n_family'];
if ($addr['n_given'])
2001-09-23 20:58:31 +02:00
{
2001-05-28 21:48:31 +02:00
$name .= ', '.$addr['n_given'];
2001-09-23 20:58:31 +02:00
}
else
{
2001-05-28 21:48:31 +02:00
if ($addr['n_prefix'])
2001-09-23 20:58:31 +02:00
{
2001-05-28 21:48:31 +02:00
$name .= ', '.$addr['n_prefix'];
2001-09-23 20:58:31 +02:00
}
}
2001-05-28 21:48:31 +02:00
if ($addr['org_name'])
2001-09-23 20:58:31 +02:00
{
2001-05-28 21:48:31 +02:00
$name = $addr['org_name'].': '.$name;
2001-09-23 20:58:31 +02:00
}
return $GLOBALS['phpgw']->strip_html($name);
2001-05-28 21:48:31 +02:00
}
/*
* Function Allows you to show and select an address from the addressbook (works with and without javascript !!!)
* Parameters $name string with basename of all variables (not to conflict with the name other template or submitted vars !!!)
* $id_name id of the address for edit or 0 if none selected so far
* $query_name have to be called $query_XXX, the search pattern after the submit, has to be passed back to the function
2001-12-24 16:34:08 +01:00
* $multipe present a multiple selectable box instead of one selector-button
2001-05-28 21:48:31 +02:00
* On Submit $id_XXX contains the selected address (if != 0)
* $query_XXX search pattern if the search button is pressed by the user, or '' if regular submit
* Returns array with vars to set for the template, set with: $template->set_var( getAddress( ... )); (see getId( ))
*
* Note As query's for an address are submitted, you have to check $query_XXX if it is a search or a regular submit (!$query_string)
*/
2001-12-24 16:34:08 +01:00
function getAddress( $name,$id_name,$query_name,$title='',$multiple=False)
2001-09-23 20:58:31 +02:00
{
2001-05-28 21:48:31 +02:00
// echo "<p>getAddress('$name',$id_name,'$query_name','$title')</p>";
2001-09-23 20:58:31 +02:00
if ($id_name || $query_name)
{
2001-05-28 21:48:31 +02:00
$contacts = createobject('phpgwapi.contacts');
2001-09-23 20:58:31 +02:00
if ($query_name)
{
2001-05-28 21:48:31 +02:00
$addrs = $contacts->read( 0,0,'',$query_name,'','DESC','org_name,n_family,n_given' );
$content = array( );
2001-09-23 20:58:31 +02:00
while ($addrs && list( $key,$addr ) = each( $addrs ))
{
2001-05-28 21:48:31 +02:00
$content[$addr['id']] = $this->addr2name( $addr );
}
2001-09-23 20:58:31 +02:00
}
else
{
2001-05-28 21:48:31 +02:00
list( $addr ) = $contacts->read_single_entry( $id_name );
2001-09-23 20:58:31 +02:00
if (count($addr))
{
2001-05-28 21:48:31 +02:00
$content = $this->addr2name( $addr );
2001-09-23 20:58:31 +02:00
}
2001-05-28 21:48:31 +02:00
}
}
2001-09-23 20:58:31 +02:00
if (!$title)
{
$title = lang('Addressbook');
}
2001-12-24 16:34:08 +01:00
return $this->getId($name,$title,lang('Pattern for Search in Addressbook'),$id_name,$content,lang('use Button to search for Address'),$multiple);
2001-09-23 20:58:31 +02:00
}
2001-05-28 21:48:31 +02:00
2001-09-23 20:58:31 +02:00
function addr2email( $addr,$home='' )
{
if (!is_array($addr))
{
$home = substr($addr,-1) == 'h';
$contacts = createobject('phpgwapi.contacts');
list( $addr ) = $contacts->read_single_entry( intval($addr) );
2001-09-23 20:58:31 +02:00
}
if ($home)
{
$home = '_home';
}
if (!count($addr) || !$addr['email'.$home])
2001-09-23 20:58:31 +02:00
{
return False;
2001-09-23 20:58:31 +02:00
}
if ($addr['n_given'])
2001-09-23 20:58:31 +02:00
{
$name = $addr['n_given'];
2001-09-23 20:58:31 +02:00
}
else
{
if ($addr['n_prefix'])
2001-09-23 20:58:31 +02:00
{
$name = $addr['n_prefix'];
2001-09-23 20:58:31 +02:00
}
}
$name .= ($name ? ' ' : '') . $addr['n_family'];
2001-09-23 20:58:31 +02:00
return $name.' <'.$addr['email'.$home].'>';
}
2001-09-23 20:58:31 +02:00
function getEmail( $name,$id_name,$query_name,$title='')
{
// echo "<p>getAddress('$name',$id_name,'$query_name','$title')</p>";
2001-09-23 20:58:31 +02:00
if ($id_name || $query_name)
{
$contacts = createobject('phpgwapi.contacts');
2001-09-23 20:58:31 +02:00
if ($query_name)
{
$addrs = $contacts->read( 0,0,'',$query_name,'','DESC','org_name,n_family,n_given' );
$content = array( );
2001-09-23 20:58:31 +02:00
while ($addrs && list( $key,$addr ) = each( $addrs ))
{
if ($addr['email'])
2001-09-23 20:58:31 +02:00
{
$content[$addr['id']] = $this->addr2email( $addr );
2001-09-23 20:58:31 +02:00
}
if ($addr['email_home'])
2001-09-23 20:58:31 +02:00
{
$content[$addr['id'].'h'] = $this->addr2email( $addr,'_home' );
2001-09-23 20:58:31 +02:00
}
}
2001-09-23 20:58:31 +02:00
}
else
{
$content = $this->addr2email( $id_name );
}
}
2001-09-23 20:58:31 +02:00
if (!$title)
{
$title = lang('Addressbook');
}
return $this->getId($name,$title,lang('Pattern for Search in Addressbook'),$id_name,$content);
}
2001-09-23 20:58:31 +02:00
2001-05-28 21:48:31 +02:00
/*
* Function Allows you to show and select an project from the projects-app (works with and without javascript !!!)
* Parameters $name string with basename of all variables (not to conflict with the name other template or submitted vars !!!)
* $id_name id of the project for edit or 0 if none selected so far
* $query_name have to be called $query_XXX, the search pattern after the submit, has to be passed back to the function
* On Submit $id_XXX contains the selected address (if != 0)
* $query_XXX search pattern if the search button is pressed by the user, or '' if regular submit
* Returns array with vars to set for the template, set with: $template->set_var( getProject( ... )); (see getId( ))
*
* Note As query's for an address are submitted, you have to check $query_XXX if it is a search or a regular submit (!$query_string)
*/
2001-09-23 20:58:31 +02:00
function getProject( $name,$id_name,$query_name,$title='' )
{
// echo "<p>getProject('$name',$id_name,'$query_name','$title')</p>";
2002-10-19 02:42:36 +02:00
// fallback if projects is not installed or not enabled for user
if (!file_exists(PHPGW_SERVER_ROOT.'/projects') || !$GLOBALS['phpgw_info']['user']['apps']['projects']['enabled'])
{
return array(
$name => "<input type=\"hidden\" name=\"id_$name\" value=\"$id_name\">\n",
$name.'_no_js' => '',
$name.'_title' => ''
);
}
2001-09-23 20:58:31 +02:00
if ($id_name || $query_name)
{
2002-02-24 22:21:53 +01:00
$projects = createobject('projects.boprojects');
if (!is_object($projects))
{
return '';
}
2001-09-23 20:58:31 +02:00
if ($query_name)
{
2002-02-24 22:21:53 +01:00
$projs = $projects->list_projects( 0,0,$query_name,'','','','',0,'mains','' );
2001-05-28 21:48:31 +02:00
$content = array();
2001-09-23 20:58:31 +02:00
while ($projs && list( $key,$proj ) = each( $projs ))
{
2002-10-19 02:42:36 +02:00
$content[$proj['project_id']] = $proj['title'];
2001-09-23 20:58:31 +02:00
}
}
else
{
2002-10-19 02:42:36 +02:00
if ($proj = $projects->read_single_project( $id_name ))
2001-09-23 20:58:31 +02:00
{
2001-05-28 21:48:31 +02:00
$content = $proj['title'];
// $customer_id = $proj['customer'];
}
}
2001-09-23 20:58:31 +02:00
}
if (!$title)
{
$title = lang('Project');
}
return $this->getId($name,$title,lang('Pattern for Search in Projects'),$id_name,$content,lang('use Button to search for Project'));
2001-09-23 20:58:31 +02:00
}
2001-05-28 21:48:31 +02:00
/*
* Function: Allows to show and select one item from an array
* Parameters: $name string with name of the submitted var which holds the key of the selected item form array
2002-02-24 22:21:53 +01:00
* $key key(s) of already selected item(s) from $arr, eg. '1' or '1,2' or array with keys
2001-05-28 21:48:31 +02:00
* $arr array with items to select, eg. $arr = array ( 'y' => 'yes','n' => 'no','m' => 'maybe');
2002-02-24 22:21:53 +01:00
* $no_lang if !$no_lang send items through lang()
* $options additional options (e.g. 'multiple')
* On submit $XXX is the key of the selected item (XXX is the content of $name)
* Returns: string to set for a template or to echo into html page
2001-05-28 21:48:31 +02:00
*/
2002-02-24 22:21:53 +01:00
function getArrayItem($name, $key, $arr=0,$no_lang=0,$options='',$multiple=0)
{
// should be in class common.sbox
2001-09-23 20:58:31 +02:00
if (!is_array($arr))
{
2001-05-28 21:48:31 +02:00
$arr = array('no','yes');
2001-09-23 20:58:31 +02:00
}
2002-02-24 22:21:53 +01:00
if (0+$multiple > 0)
{
$options .= ' MULTIPLE SIZE='.(0+$multiple);
if (substr($name,-2) != '[]')
{
$name .= '[]';
}
}
$out = "<select name=\"$name\" $options>\n";
2001-05-28 21:48:31 +02:00
2002-02-24 22:21:53 +01:00
if (is_array($key))
{
$key = implode(',',$key);
}
2001-09-23 20:58:31 +02:00
while (list($k,$text) = each($arr))
{
$out .= '<option value="'.$k.'"';
2002-02-24 22:21:53 +01:00
if($k == $key || strstr(",$key,",",$k,"))
{
$out .= " SELECTED";
}
$out .= ">" . ($no_lang || $text == '' ? $text : lang($text)) . "</option>\n";
2001-09-23 20:58:31 +02:00
}
$out .= "</select>\n";
2002-02-24 22:21:53 +01:00
2001-09-23 20:58:31 +02:00
return $out;
}
2002-02-24 22:21:53 +01:00
function getPercentage($name, $selected=0,$options='')
{
// reimplemented using getArrayItem
for ($i=0; $i <= 100; $i+=10)
{
$arr[$i] = "$i%";
}
return $this->getArrayItem($name,$selected,$arr,1,$options);
}
function getPriority($name, $selected=2,$options='')
{
// reimplemented using getArrayItem
$arr = array('','low','normal','high');
return $this->getArrayItem($name,$selected,$arr,0,$options);
}
function getAccessList($name,$selected='private',$options='')
{
// reimplemented using getArrayItem
$arr = array(
'private' => 'Private',
'public' => 'Global public',
'group' => 'Group public'
);
if (strstr($selected,','))
{
$selected = "group";
}
return $this->getArrayItem($name,$selected,$arr,0,$options);
}
function getCountry($name='country',$selected=' ',$options='')
{
// reimplemented using getArrayItem
return $this->getArrayItem($name,$selected,$this->country_array,0,$options);
}
function form_select($name='country',$selected=' ',$options='')
{
// reimplemented using getArrayItem (stupid name!!!)
return getCountry($name,$selected,$options);
}
function accountInfo($id,$account_data=0,$longnames=0,$show_type=0)
2001-09-23 20:58:31 +02:00
{
if (!$id)
{
return '&nbsp;';
}
if (!is_array($account_data))
{
2001-05-28 21:48:31 +02:00
$accounts = createobject('phpgwapi.accounts',$id);
$accounts->db = $GLOBALS['phpgw']->db;
2001-05-28 21:48:31 +02:00
$accounts->read_repository();
$account_data = $accounts->data;
}
2002-02-24 22:21:53 +01:00
$info = $show_type ? '('.$account_data['account_type'].') ' : '';
switch ($longnames)
2001-09-23 20:58:31 +02:00
{
2002-02-24 22:21:53 +01:00
case 2: $info .= '&lt;'.$account_data['account_lid'].'&gt; '; // fall-through
case 1: $info .= $account_data['account_firstname'].' '.$account_data['account_lastname']; break;
default: $info .= $account_data['account_lid']; break;
2001-09-23 20:58:31 +02:00
}
2002-02-24 22:21:53 +01:00
return $info;
2001-09-23 20:58:31 +02:00
}
2001-05-28 21:48:31 +02:00
/*
* Function: Allows to select one accountname
* Parameters: $name string with name of the submitted var, which holds the account_id or 0 after submit
* $id account_id of already selected account
2002-02-24 22:21:53 +01:00
* $longnames 0=account_lid 1=firstname lastname
2001-05-28 21:48:31 +02:00
*/
2002-02-24 22:21:53 +01:00
function getAccount($name,$id,$longnames=0,$type='accounts',$multiple=0,$options='')
2001-09-23 20:58:31 +02:00
{
2001-05-28 21:48:31 +02:00
$accounts = createobject('phpgwapi.accounts');
$accounts->db = $GLOBALS['phpgw']->db;
2002-02-24 22:21:53 +01:00
$accs = $accounts->get_list($type);
2001-09-23 20:58:31 +02:00
2002-02-24 22:21:53 +01:00
if ($multiple < 0)
{
$aarr[] = lang('not assigned');
}
2001-09-23 20:58:31 +02:00
while ($a = current($accs))
{
2002-02-24 22:21:53 +01:00
$aarr[$a['account_id']] = $this->accountInfo($a['account_id'],$a,$longnames,$type=='both');
2001-05-28 21:48:31 +02:00
next($accs);
}
2002-02-24 22:21:53 +01:00
return $this->getArrayItem($name,$id,$aarr,1,$options,$multiple);
2001-05-28 21:48:31 +02:00
}
2002-02-24 22:21:53 +01:00
function getDate($n_year,$n_month,$n_day,$date,$options='')
{
2002-02-24 22:21:53 +01:00
if (is_array($date))
{
list($year,$month,$day) = $date;
}
elseif (!$date)
2001-09-23 20:58:31 +02:00
{
$day = $month = $year = 0;
}
else
{
$day = date('d',$date);
$month = date('m',$date);
$year = date('Y',$date);
}
2002-02-24 22:21:53 +01:00
return $GLOBALS['phpgw']->common->dateformatorder(
$this->getYears($n_year,$year),
2001-09-23 20:58:31 +02:00
$this->getMonthText($n_month,$month),
2002-02-24 22:21:53 +01:00
$this->getDays($n_day,$day)
);
}
2001-12-24 16:34:08 +01:00
2002-02-24 22:21:53 +01:00
function getCategory($name,$cat_id='',$notall=False,$jscript=True,$multiple=0,$options='')
{
if (!is_object($this->cat))
{
$this->cat = CreateObject('phpgwapi.categories');
}
if ($jscript)
{
$options .= ' onChange="this.form.submit();"';
}
if (0+$multiple > 0)
{
$options .= ' MULTIPLE SIZE='.(0+$multiple);
if (substr($name,-2) != '[]')
{
$name .= '[]';
}
}
/* Setup all and none first */
$cats_link = "\n<SELECT NAME=\"$name\" $options>\n";
if (!$notall)
{
$cats_link .= '<option value=""';
if ($cat_id=='all')
{
$cats_link .= ' selected';
}
$cats_link .= '>'.lang("all")."</option>\n";
}
/* Get global and app-specific category listings */
2002-10-19 02:42:36 +02:00
$cats_link .= $this->cat->formatted_list('select','all',$cat_id,True);
2002-02-24 22:21:53 +01:00
$cats_link .= '</select>'."\n";
return $cats_link;
}
}