mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-24 17:04:14 +01:00
* Calendar: Added category filter for events without a category set
This commit is contained in:
parent
23f0b6faaf
commit
e9038d2f34
@ -623,19 +623,27 @@ class calendar_so
|
||||
function cat_filter($cat_id)
|
||||
{
|
||||
$sql = '';
|
||||
if ($cat_id)
|
||||
// No category
|
||||
if($cat_id === false || $cat_id && ($cat_id == ["0"] || !(int)$cat_id))
|
||||
{
|
||||
$sql = 'cal_category=""';
|
||||
}
|
||||
elseif($cat_id)
|
||||
{
|
||||
$cats = $GLOBALS['egw']->categories->return_all_children($cat_id);
|
||||
array_walk($cats, function(&$val, $key)
|
||||
array_walk($cats, function (&$val, $key)
|
||||
{
|
||||
unset($key); // not used, but required by function signature
|
||||
$val = (int) $val;
|
||||
unset($key); // not used, but required by function signature
|
||||
$val = (int)$val;
|
||||
});
|
||||
if (is_array($cat_id) && count($cat_id)==1) $cat_id = $cat_id[0];
|
||||
$sql = '(cal_category'.(count($cats) > 1 ? " IN ('".implode("','",$cats)."')" : '='.$this->db->quote((int)$cat_id));
|
||||
if(is_array($cat_id) && count($cat_id) == 1)
|
||||
{
|
||||
$cat_id = $cat_id[0];
|
||||
}
|
||||
$sql = '(cal_category' . (count($cats) > 1 ? " IN ('" . implode("','", $cats) . "')" : '=' . $this->db->quote((int)$cat_id));
|
||||
foreach($cats as $cat)
|
||||
{
|
||||
$sql .= ' OR '.$this->db->concat("','",'cal_category',"','").' LIKE '.$this->db->quote('%,'.$cat.',%');
|
||||
$sql .= ' OR ' . $this->db->concat("','", 'cal_category', "','") . ' LIKE ' . $this->db->quote('%,' . $cat . ',%');
|
||||
}
|
||||
$sql .= ') ';
|
||||
}
|
||||
|
@ -13,15 +13,17 @@ Egroupware
|
||||
|
||||
<overlay>
|
||||
<template id="calendar.sidebox">
|
||||
<et2-vbox parentId="calendar-et2_target">
|
||||
<et2-vbox parentId="calendar-et2_target">
|
||||
<calendar-date id="date"></calendar-date>
|
||||
<et2-textbox type="hidden" id="first"></et2-textbox>
|
||||
<et2-textbox type="hidden" id="last"></et2-textbox>
|
||||
<et2-textbox type="hidden" id="first"></et2-textbox>
|
||||
<et2-textbox type="hidden" id="last"></et2-textbox>
|
||||
<hrule/>
|
||||
<et2-select-cat id="cat_id" placeholder="All categories" onchange="app.calendar.update_state({cat_id: widget.getValue()});" emptyLabel="All categories" multiple="true"></et2-select-cat>
|
||||
<et2-select id="status_filter" onchange="app.calendar.update_state({status_filter: widget.getValue()});" noLang="true"></et2-select>
|
||||
<et2-select-cat id="cat_id" placeholder="All categories" onchange="app.calendar.update_state({cat_id: widget.getValue()});" emptyLabel="All categories" multiple="true">
|
||||
<option value="0">None</option>
|
||||
</et2-select-cat>
|
||||
<et2-select id="status_filter" onchange="app.calendar.update_state({status_filter: widget.getValue()});" noLang="true"></et2-select>
|
||||
<hrule/>
|
||||
<et2-calendar-owner id="owner" onchange="app.calendar.update_state({owner: widget.getValue()}); return false;" multiple="true" allowFreeEntries="false" autocompleteParams="{"checkgrants": true}"/>
|
||||
<et2-calendar-owner id="owner" onchange="app.calendar.update_state({owner: widget.getValue()}); return false;" multiple="true" allowFreeEntries="false" autocompleteParams="{"checkgrants": true}"/>
|
||||
<hrule/>
|
||||
<et2-box>
|
||||
<grid id="integration" disabled="!@integration" width="100%">
|
||||
|
Loading…
Reference in New Issue
Block a user