added new filter for projects

This commit is contained in:
Stefan Becker 2009-09-19 13:58:24 +00:00
parent 8db94f2471
commit 051b00b199
5 changed files with 60 additions and 34 deletions

View File

@ -1413,4 +1413,26 @@ class infolog_bo
}
return false;
}
/**
* returns array with relation link_id and info_id (necessary for project-selection)
*
* @param int $pm_id ID of selected project
* @return array containing link_id and info_id
*/
function get_pm_infolog_links($pm_id=0)
{
if($pm_id && isset($GLOBALS['egw_info']['user']['apps']['projectmanager']))
{
$pm_ids = ExecMethod('projectmanager.projectmanager_bo.children',$pm_id);
$pm_ids[] = $pm_id;
$links = solink::get_links('projectmanager',$pm_ids,'infolog'); // solink::get_links not egw_links::get_links!
if ($links)
{
$links = array_unique(call_user_func_array('array_merge',$links));
}
return $links;
}
return array();
}
}

View File

@ -297,6 +297,22 @@ class infolog_ui
{
$query['csv_fields'] = $this->csv_export_fields($query['col_filter']['info_type']);
}
if ($query['col_filter']['pm_id'])
//search for projects (project manager filter)
if ((string)$query['col_filter']['pm_id'] != '')
{
$query['col_filter']['info_id'] = $this->bo->get_pm_infolog_links($query['col_filter']['pm_id']);
if (!$query['col_filter']['info_id']) $query['col_filter']['info_id'][] = 0;
$project = $query['col_filter']['pm_id'];
unset($query['col_filter']['pm_id']);
}
if ((string)$query['col_filter']['pm_id'] != '' && (string)$query['col_filter']['pm_id'] == '0')
{
$no_projects = true; //to select later the infologs without any projects
$project = $query['col_filter']['pm_id'];
unset($query['col_filter']['info_id']);
}
unset($query['col_filter']['pm_id']);
// check if we have a custom, type-specific template
unset($query['template']);
unset($query['custom_fields']);
@ -368,8 +384,17 @@ class infolog_ui
unset($info['info_des']);
}
}
$rows[] = $info;
if (!$no_projects) //searchfilter for projects
{
$rows[] = $info;
}
else
{
if (!$info['pm_id']) $rows[] = $info; //ony if we have no projects linked
}
}
if ($no_projects) $query['total'] = count($rows);
unset($no_projects);
unset($links);
if ($query['cat_id']) $rows['no_cat_id'] = true;
@ -422,7 +447,7 @@ class infolog_ui
}
// disable filemanager icon, if user has no access to it
$readonlys['filemanager/navbar'] = !isset($GLOBALS['egw_info']['user']['apps']['filemanager']);
$query['col_filter']['pm_id'] = $project; //add project back to the colfilter
return $query['total'];
}
@ -643,9 +668,11 @@ class infolog_ui
(($this->prefs['limit_des_lines'] ? $this->prefs['limit_des_lines'] : 5) * 1.35). // dono why em is not real lines
'em; overflow: auto; }}</style>';
}
return $this->tmpl->exec('infolog.infolog_ui.index',$values,array(
'info_type' => $this->bo->enums['type'],
),$readonlys,$persist,$return_html ? -1 : 0);
$sel_options = array(
'info_type' => $this->bo->enums['type'],
'pm_id' => array(lang('No project')),
);
return $this->tmpl->exec('infolog.infolog_ui.index',$values,$sel_options,$readonlys,$persist,$return_html ? -1 : 0);
}
/**

View File

@ -40,6 +40,7 @@ add timesheet entry infolog de Stundenzettel Eintrag hinzfügen
add: infolog de Hinzufügen:
all infolog de alle
all links and attachments infolog de alle Verknüpfungen und Anhänge
all projects infolog de Alle Projekte
allows to set the status of an entry, eg. set a todo to done if it's finished (values depend on entry-typ) infolog de erlaubt den Status eines Eintrags zu setzen, zB. eine Aufgabe auf erledigt wenn sie beendet ist (Werte hängen vom Type des Eintrags ab)
alternatives infolog de Alternativen
apply the changes infolog de Übernimmt die Änderungen
@ -214,6 +215,7 @@ no details infolog de Keine Details
no entries found, try again ... infolog de Kein Einträge gefunden, nochmal versuchen ...
no filter infolog de kein Filter
no links or attachments infolog de keine Verknüpfungen oder Anhänge
no project infolog de Kein Projekt
nonactive infolog de Nicht aktiv
none infolog de keine
normal infolog de normal

View File

@ -40,6 +40,7 @@ add timesheet entry infolog en Add timesheet entry
add: infolog en Add:
all infolog en All
all links and attachments infolog en all links and attachments
all projects infolog en All projects
allows to set the status of an entry, eg. set a todo to done if it's finished (values depend on entry-typ) infolog en allows to set the status of an entry, eg. set a ToDo to done if it's finished (values depend on entry-type)
alternatives infolog en Alternatives
apply the changes infolog en Apply the changes
@ -214,6 +215,7 @@ no details infolog en no details
no entries found, try again ... infolog en no entries found, try again ...
no filter infolog en no Filter
no links or attachments infolog en no links or attachments
no project infolog en No project
nonactive infolog en nonactive
none infolog en None
normal infolog en normal

File diff suppressed because one or more lines are too long