mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-03 13:25:05 +01:00
* Calendar: Added category filter for events without a category set
This commit is contained in:
parent
2c98cdde04
commit
d0932e7cc0
@ -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;
|
||||
$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 .= ') ';
|
||||
}
|
||||
|
@ -18,7 +18,9 @@ Egroupware
|
||||
<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-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}"/>
|
||||
|
Loading…
Reference in New Issue
Block a user