From aa58708ffd7cbc8d270e6eac5c92dcbddb35905a Mon Sep 17 00:00:00 2001 From: Ralf Becker Date: Tue, 19 Jun 2012 14:44:13 +0000 Subject: [PATCH] * ProjectManager/InfoLog: visualisation if InfoLog has a parent or sub-entries (up-arrow or right-arrow like in InfoLog) --- infolog/inc/class.infolog_bo.inc.php | 31 ++++++++++++++++------- infolog/inc/class.infolog_so.inc.php | 37 +++------------------------- 2 files changed, 26 insertions(+), 42 deletions(-) diff --git a/infolog/inc/class.infolog_bo.inc.php b/infolog/inc/class.infolog_bo.inc.php index b3c7d66cd3..e7695ef19a 100644 --- a/infolog/inc/class.infolog_bo.inc.php +++ b/infolog/inc/class.infolog_bo.inc.php @@ -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; diff --git a/infolog/inc/class.infolog_so.inc.php b/infolog/inc/class.infolog_so.inc.php index 4af8960c14..d6d09108b6 100644 --- a/infolog/inc/class.infolog_so.inc.php +++ b/infolog/inc/class.infolog_so.inc.php @@ -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"."
"; do