mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-26 08:39:07 +01:00
Implemented display of custom fields in list-view
ToDo: implement search, sort and filtering by them
This commit is contained in:
parent
adf5ca040e
commit
04d48a677a
@ -278,8 +278,9 @@ class calendar_bo
|
||||
* order column-names plus optional DESC|ASC separted by comma
|
||||
* ignore_acl if set and true no check_perms for a general EGW_ACL_READ grants is performed
|
||||
* enum_groups boolean if set and true, group-members will be added as participants with status 'G'
|
||||
* cols string|array columns to select, if set the recordset/iterator will be returned
|
||||
* cols string|array columns to select, if set an iterator will be returned
|
||||
* append string to append to the query, eg. GROUP BY
|
||||
* cfs array if set, query given custom fields or all for empty array, none are returned, if not set (default)
|
||||
* @return iterator|array|boolean array of events or array with YYYYMMDD strings / array of events pairs (depending on $daywise param)
|
||||
* or false if there are no read-grants from _any_ of the requested users or iterator/recordset if cols are given
|
||||
*/
|
||||
@ -383,7 +384,7 @@ class calendar_bo
|
||||
}
|
||||
// date2ts(,true) converts to server time, db2data converts again to user-time
|
||||
$events =& $this->so->search(isset($start) ? $this->date2ts($start,true) : null,isset($end) ? $this->date2ts($end,true) : null,
|
||||
$users,$cat_id,$filter,$params['query'],$offset,(int)$params['num_rows'],$params['order'],$params['sql_filter'],$params['cols'],$params['append']);
|
||||
$users,$cat_id,$filter,$params['query'],$offset,(int)$params['num_rows'],$params['order'],$params['sql_filter'],$params['cols'],$params['append'],$params['cfs']);
|
||||
|
||||
if (isset($params['cols']))
|
||||
{
|
||||
|
@ -276,14 +276,15 @@ class calendar_so
|
||||
* @param int $num_rows=0 number of rows to return if offset set, default 0 = use default in user prefs
|
||||
* @param string $order='cal_start' column-names plus optional DESC|ASC separted by comma
|
||||
* @param string $sql_filter='' sql to be and'ed into query (fully quoted)
|
||||
* @param string|array $_cols=null what to select, default "$this->repeats_table.*,$this->cal_table.*,cal_start,cal_end,cal_recur_date"
|
||||
* if specified an iterator for the rows is returned
|
||||
* @param string|array $_cols=null what to select, default "$this->repeats_table.*,$this->cal_table.*,cal_start,cal_end,cal_recur_date",
|
||||
* if specified and not false an iterator for the rows is returned
|
||||
* @param string $append='' SQL to append to the query before $order, eg. for a GROUP BY clause
|
||||
* @param array $cfs=null custom fields to query, null = none, array() = all, or array with cfs names
|
||||
* @return array of cal_ids, or false if error in the parameters
|
||||
*
|
||||
* ToDo: search custom-fields too
|
||||
*/
|
||||
function &search($start,$end,$users,$cat_id=0,$filter='all',$query='',$offset=False,$num_rows=0,$order='cal_start',$sql_filter='',$_cols=null,$append='')
|
||||
function &search($start,$end,$users,$cat_id=0,$filter='all',$query='',$offset=False,$num_rows=0,$order='cal_start',$sql_filter='',$_cols=null,$append='',$cfs=null)
|
||||
{
|
||||
//echo '<p>'.__METHOD__.'('.($start ? date('Y-m-d H:i',$start) : '').','.($end ? date('Y-m-d H:i',$end) : '').','.array2string($users).','.array2string($cat_id).",'$filter',".array2string($query).",$offset,$num_rows,$order,$show_rejected,".array2string($_cols).",$append)</p>\n";
|
||||
|
||||
@ -439,6 +440,7 @@ class calendar_so
|
||||
{
|
||||
$id = $row['cal_id'];
|
||||
if ($row['cal_recur_date']) $id .= '-'.$row['cal_recur_date'];
|
||||
$recur_ids[$row['cal_id']][] = $id;
|
||||
|
||||
if (!isset($events[$id])) continue; // not needed first entry of recuring event
|
||||
|
||||
@ -446,21 +448,21 @@ class calendar_so
|
||||
$events[$id]['participants'][self::combine_user($row['cal_user_type'],$row['cal_user_id'])] =
|
||||
self::combine_status($row['cal_status'],$row['cal_quantity'],$row['cal_role']);
|
||||
}
|
||||
/* custom fields are not shown in the regular views, so we can ignore them here for the moment
|
||||
foreach($this->db->select($this->extra_table,'*',array('cal_id'=>$ids),__LINE__,__FILE__,false,'','calendar') as $row)
|
||||
//custom fields are not shown in the regular views, so we only query them, if explicitly required
|
||||
if (!is_null($cfs))
|
||||
{
|
||||
$set_ids = array($row['cal_id']);
|
||||
if (isset($recur_ids[$row['cal_id']])) $set_ids += $recur_ids[$row['cal_id']];
|
||||
|
||||
foreach($set_ids as $id)
|
||||
foreach($this->db->select($this->extra_table,'*',array('cal_id' => $ids,'cal_extra_name' => $cfs),
|
||||
__LINE__,__FILE__,false,'','calendar') as $row)
|
||||
{
|
||||
if (isset($events[$cal_id]))
|
||||
foreach((array)$recur_ids[$row['cal_id']] as $id)
|
||||
{
|
||||
$events[$id]['#'.$row['cal_extra_name']] = $row['cal_extra_value'];
|
||||
if (isset($events[$id]))
|
||||
{
|
||||
$events[$id]['#'.$row['cal_extra_name']] = $row['cal_extra_value'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
// alarms, atm. we read all alarms in the system, as this can be done in a single query
|
||||
foreach((array)$this->async->read('cal'.(is_array($ids) ? '' : ':'.(int)$ids).':%') as $id => $job)
|
||||
{
|
||||
|
@ -5,7 +5,7 @@
|
||||
* @link http://www.egroupware.org
|
||||
* @package calendar
|
||||
* @author Ralf Becker <RalfBecker-AT-outdoor-training.de>
|
||||
* @copyright (c) 2005-8 by RalfBecker-At-outdoor-training.de
|
||||
* @copyright (c) 2005-9 by RalfBecker-At-outdoor-training.de
|
||||
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
|
||||
* @version $Id$
|
||||
*/
|
||||
@ -82,7 +82,7 @@ class calendar_uilist extends calendar_ui
|
||||
'multiple' => 0,
|
||||
'view' => $this->bo->cal_prefs['defaultcalendar'],
|
||||
));
|
||||
$GLOBALS['egw']->session->appsession('calendar_list','calendar',''); // in case there's already something set
|
||||
egw_session::appsession('calendar_list','calendar',''); // in case there's already something set
|
||||
|
||||
return $this->listview(null,'',true);
|
||||
}
|
||||
@ -95,7 +95,7 @@ class calendar_uilist extends calendar_ui
|
||||
if ($_GET['msg']) $msg .= $_GET['msg'];
|
||||
if ($this->group_warning) $msg .= $this->group_warning;
|
||||
|
||||
$etpl =& CreateObject('etemplate.etemplate','calendar.list');
|
||||
$etpl = new etemplate('calendar.list');
|
||||
|
||||
if (is_array($content) && $content['nm']['rows']['delete'])
|
||||
{
|
||||
@ -120,7 +120,7 @@ class calendar_uilist extends calendar_ui
|
||||
}
|
||||
}
|
||||
$content = array(
|
||||
'nm' => $GLOBALS['egw']->session->appsession('calendar_list','calendar'),
|
||||
'nm' => egw_session::appsession('calendar_list','calendar'),
|
||||
'msg' => $msg,
|
||||
);
|
||||
if (!is_array($content['nm']))
|
||||
@ -201,7 +201,7 @@ class calendar_uilist extends calendar_ui
|
||||
$this->manage_states(array('date' => $this->bo->date2string($params['startdate'])));
|
||||
}
|
||||
}
|
||||
$old_params = $GLOBALS['egw']->session->appsession('calendar_list','calendar');
|
||||
$old_params = egw_session::appsession('calendar_list','calendar');
|
||||
if ($old_params['filter'] && $old_params['filter'] != $params['filter']) // filter changed => order accordingly
|
||||
{
|
||||
$params['order'] = 'cal_start';
|
||||
@ -211,14 +211,25 @@ class calendar_uilist extends calendar_ui
|
||||
{
|
||||
$this->adjust_for_search($params['search'],$params);
|
||||
}
|
||||
$GLOBALS['egw']->session->appsession('calendar_list','calendar',$params);
|
||||
egw_session::appsession('calendar_list','calendar',$params);
|
||||
|
||||
// do we need to query custom fields and which
|
||||
$select_cols = explode(',',$params['selectcols']);
|
||||
if (in_array('cfs',$select_cols))
|
||||
{
|
||||
$cfs = array();
|
||||
foreach($select_cols as $col)
|
||||
{
|
||||
if ($col[0] == '#') $cfs[] = substr($col,1);
|
||||
}
|
||||
}
|
||||
$search_params = array(
|
||||
'cat_id' => $this->cat_id,
|
||||
'filter' => $this->filter,
|
||||
'query' => $params['search'],
|
||||
'offset' => (int) $params['start'],
|
||||
'order' => $params['order'] ? $params['order'].' '.$params['sort'] : 'cal_start',
|
||||
'cfs' => $cfs,
|
||||
);
|
||||
switch($params['filter'])
|
||||
{
|
||||
@ -293,6 +304,7 @@ class calendar_uilist extends calendar_ui
|
||||
$event['date'] = $this->bo->date2string($event['start']);
|
||||
if (empty($event['description'])) $event['description'] = ' '; // no description screws the titles horz. alignment
|
||||
if (empty($event['location'])) $event['location'] = ' '; // no location screws the owner horz. alignment
|
||||
|
||||
$rows[] = $event;
|
||||
}
|
||||
$wv=0;
|
||||
@ -309,7 +321,7 @@ class calendar_uilist extends calendar_ui
|
||||
$rows['format'] = '16';
|
||||
$dv=1;
|
||||
}
|
||||
if ($wv&&$dv)
|
||||
if ($wv && $dv)
|
||||
{
|
||||
$rows['format'] = '64';
|
||||
}
|
||||
|
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0"?>
|
||||
<!-- $Id$ -->
|
||||
<overlay>
|
||||
<template id="calendar.list.rows" template="" lang="" group="0" version="1.5.001">
|
||||
<template id="calendar.list.rows" template="" lang="" group="0" version="1.7.002">
|
||||
<grid width="100%">
|
||||
<columns>
|
||||
<column/>
|
||||
@ -16,6 +16,7 @@
|
||||
<column/>
|
||||
<column/>
|
||||
<column/>
|
||||
<column/>
|
||||
</columns>
|
||||
<rows>
|
||||
<row class="th">
|
||||
@ -39,7 +40,11 @@
|
||||
<nextmatch-sortheader id="cal_owner" label="Owner" readonly="true"/>
|
||||
<nextmatch-sortheader id="cal_location" label="Location"/>
|
||||
<nextmatch-accountfilter options="All" id="participant" label="Participants"/>
|
||||
<description value="Actions" class="noPrint"/>
|
||||
<nextmatch-customfields label="Custom fields" id="cfs" readonly="true"/>
|
||||
<hbox label="Actions" class="noPrint">
|
||||
<description value="Actions" statustext="Check all" class="noPrint"/>
|
||||
<button image="check" label="Check all" id="check_all" statustext="Check all" onclick="toggle_all(this.form,form::name('checked[]')); return false;" needed="1" align="right"/>
|
||||
</hbox>
|
||||
</row>
|
||||
<row class="row" valign="top">
|
||||
<vbox id="start">
|
||||
@ -69,6 +74,7 @@
|
||||
</menulist>
|
||||
<description id="${row}[location]" no_lang="1"/>
|
||||
<html id="${row}[parts]" readonly="true" no_lang="1"/>
|
||||
<customfields-list id="$row"/>
|
||||
<hbox class="noPrint">
|
||||
<button image="view" label="View" id="view[$row_cont[id]]" statustext="View this event" onclick="window.open(egw::link('/index.php','menuaction=calendar.calendar_uiforms.edit&cal_id=$row_cont[id]&date=$row_cont[date]'),'425','dependent=yes,width=750,height=450,scrollbars=yes,status=yes'); return false;"/>
|
||||
<button image="edit" label="Edit" id="edit[$row_cont[id]]" statustext="Edit this event" onclick="window.open(egw::link('/index.php','menuaction=calendar.calendar_uiforms.edit&cal_id=$row_cont[id]&date=$row_cont[date]'),'425','dependent=yes,width=750,height=450,scrollbars=yes,status=yes'); return false;"/>
|
||||
@ -79,7 +85,7 @@
|
||||
</rows>
|
||||
</grid>
|
||||
</template>
|
||||
<template id="calendar.list" template="" lang="" group="0" version="1.5.001">
|
||||
<template id="calendar.list" template="" lang="" group="0" version="1.7.001">
|
||||
<grid width="100%">
|
||||
<columns>
|
||||
<column/>
|
||||
|
Loading…
Reference in New Issue
Block a user