* ProjectManager/InfoLog: visualisation if InfoLog has a parent or sub-entries (up-arrow or right-arrow like in InfoLog)

This commit is contained in:
Ralf Becker 2012-06-19 14:44:13 +00:00
parent f40c008dd8
commit aa58708ffd
2 changed files with 26 additions and 42 deletions

View File

@ -1363,27 +1363,40 @@ class infolog_bo
}
/**
* Returm InfoLog (custom) status icons for projectmanager
* Returm InfoLog (custom) information for projectmanager: status icon, type icon, css class
*
* @param array $args array with id's in $args['infolog']
* @return array with id => icon pairs
* @return array with id => array with values for keys 'status', 'icon', 'class'
*/
function pm_icons($args)
{
if (isset($args['infolog']) && count($args['infolog']))
{
$icons = $this->so->get_status($args['infolog']);
foreach ((array) $icons as $id => $status)
$query = array(
'col_filter' => array('info_id' => $args['infolog']),
'subs' => true,
'cols' => 'info_id,info_type,info_status,info_percent,info_id_parent',
);
$ids = $infos = array();
foreach($this->search($query) as $row)
{
if ($status && substr($status,-1) != '%')
$infos[$row['info_id']] = array(
'status' => $row['info_type'] != 'phone' && $row['info_status'] == 'ongoing' ?
$row['info_percent'].'%' : 'infolog/'.$this->status[$row['info_type']][$row['info_status']],
'class' => $row['info_id_parent'] ? 'rowHasParent' : null,
);
if (common::image('infolog', $icon=$row['info_type'].'_element') ||
common::image('infolog', $icon=$row['info_type']))
{
list($type,$status) = explode('-', $status);
$status = $this->status[$type][$status];
$icons[$id] = 'infolog/'.$status;
$infos[$row['info_id']]['icon'] = 'infolog/'.$icon;
}
}
foreach($this->anzSubs(array_keys($infos)) as $info_id => $subs)
{
if ($subs) $infos[$info_id]['class'] .= ' rowHasSubs';
}
return $icons;
}
return $infos;
}
var $categories;

View File

@ -406,33 +406,6 @@ class infolog_so
return $this->data;
}
/**
* Read the status of the given infolog-ids
*
* @param array $ids array with id's
* @return array with id => status pairs
*/
function get_status($ids)
{
foreach($this->db->select($this->info_table,'info_id,info_type,info_status,info_percent',array('info_id'=>$ids),__LINE__,__FILE__) as $info)
{
switch ($info['info_type'].'-'.$info['info_status'])
{
case 'phone-not-started':
$status = 'call';
break;
case 'phone-ongoing':
$status = 'will-call';
break;
default:
$status = $info['info_status'] == 'ongoing' ? $info['info_percent'].'%' :
$info['info_type'].'-'.$info['info_status'];
}
$stati[$info['info_id']] = $status;
}
return $stati;
}
/**
* delete InfoLog entry $info_id AND the links to it
*
@ -481,12 +454,10 @@ class infolog_so
*/
function get_children($info_id)
{
$this->db->select($this->info_table,'info_id,info_owner',array(
'info_id_parent' => $info_id,
),__LINE__,__FILE__);
$children = array();
while (($row = $this->db->row(true)))
foreach($this->db->select($this->info_table, 'info_id,info_owner', array(
'info_id_parent' => $info_id,
),__LINE__,__FILE__) as $row)
{
$children[$row['info_id']] = $row['info_owner'];
}
@ -880,7 +851,7 @@ class infolog_so
$info_customfield = '';
if ($sortbycf != '')
{
$info_customfield = ", (SELECT DISTINCT info_extra_value FROM $this->extra_table sub2 where sub2.info_id=main.info_id AND info_extra_name=".$this->db->quote($sortbycf).") AS cfsortcrit ";
$info_customfield = ", (SELECT DISTINCT info_extra_value FROM $this->extra_table sub2 WHERE sub2.info_id=main.info_id AND info_extra_name=".$this->db->quote($sortbycf).") AS cfsortcrit ";
}
//echo "SELECT $distinct main.* $info_customfield $sql_query $ordermethod"."<br>";
do