[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10068] added display of project name and responsible
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [10068] added display of project name and responsible user on activity list |
Date: |
Mon, 01 Oct 2012 10:13:20 +0000 |
Revision: 10068
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10068
Author: erikhl
Date: 2012-10-01 10:13:20 +0000 (Mon, 01 Oct 2012)
Log Message:
-----------
added display of project name and responsible user on activity list
Modified Paths:
--------------
trunk/logistic/inc/class.soactivity.inc.php
trunk/logistic/inc/class.uiactivity.inc.php
trunk/logistic/inc/model/class.activity.inc.php
Modified: trunk/logistic/inc/class.soactivity.inc.php
===================================================================
--- trunk/logistic/inc/class.soactivity.inc.php 2012-10-01 08:53:59 UTC (rev
10067)
+++ trunk/logistic/inc/class.soactivity.inc.php 2012-10-01 10:13:20 UTC (rev
10068)
@@ -51,7 +51,7 @@
protected function add(&$activity)
{
$cols = array(
- 'parent_activity_id',
+ 'parent_activity_id',
'name',
'project_id',
'start_date',
@@ -65,12 +65,12 @@
{
$activity->set_project_id(1);
}
-
+
if( $activity->get_responsible_user_id() == '')
{
$activity->set_responsible_user_id(1);
}
-
+
$values = array(
$this->marshal($activity->get_parent_id(),
'int'),
$this->marshal($activity->get_name(), 'string'),
@@ -84,7 +84,7 @@
$sql = 'INSERT INTO lg_activity (' . join(',', $cols) .
') VALUES (' . join(',', $values) . ')';
$result = $this->db->query($sql, __LINE__,__FILE__);
-
+
if($result)
{
// Return the new activity ID
@@ -222,4 +222,34 @@
return $activity;
}
+
+ public function get_project_name($id)
+ {
+ if($id && is_numeric($id))
+ {
+ $result = $this->db->query('SELECT name FROM
lg_project WHERE id='.$id, __LINE__,__FILE__);
+
+ while($this->db->next_record())
+ {
+ // Return the new activity ID
+ return $this->db->f('name');
+ }
+ }
+ }
+
+ public function get_responsible_user($user_id)
+ {
+ if($user_id && is_numeric($user_id))
+ {
+ $account =
$GLOBALS['phpgw']->accounts->get($user_id);
+ if(isset($account))
+ {
+ return $account->__toString();
+ }
+ else
+ {
+ return lang('nobody');
+ }
+ }
+ }
}
\ No newline at end of file
Modified: trunk/logistic/inc/class.uiactivity.inc.php
===================================================================
--- trunk/logistic/inc/class.uiactivity.inc.php 2012-10-01 08:53:59 UTC (rev
10067)
+++ trunk/logistic/inc/class.uiactivity.inc.php 2012-10-01 10:13:20 UTC (rev
10068)
@@ -29,7 +29,7 @@
*/
phpgw::import_class('phpgwapi.uicommon');
phpgw::import_class('logistic.soactivity');
-
+
include_class('logistic', 'actvity');
class logistic_uiactivity extends phpgwapi_uicommon
@@ -91,12 +91,6 @@
'name' =>
'search',
'value' =>
lang('Search')
),
- array(
- 'type' =>
'link',
- 'value' =>
lang('t_new_activity'),
- 'href' =>
self::link(array('menuaction' => 'logistic.uiactivity.add')),
- 'class' =>
'new_item'
- ),
),
),
),
@@ -232,7 +226,7 @@
return $this->yui_results($result_data);
}
-
+
public function add()
{
$GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiactivity.edit'));
@@ -251,14 +245,14 @@
}
$activity->set_project_id(phpgw::get_var('project_id'));
-
+
if (isset($_POST['save_activity']))
{
$user_id = $GLOBALS['phpgw_info']['user']['id'];
$activity->set_id(phpgw::get_var('id'));
$activity->set_name(phpgw::get_var('name'));
$activity->set_update_user($user_id);
-
+
if(phpgw::get_var('start_date','string') != '')
{
$start_date_ts =
phpgwapi_datetime::date_to_timestamp( phpgw::get_var('start_date','string') );
@@ -268,7 +262,7 @@
{
$activity->set_start_date(0);
}
-
+
if( phpgw::get_var('end_date','string') != '')
{
$end_date_ts =
phpgwapi_datetime::date_to_timestamp( phpgw::get_var('end_date','string') );
@@ -278,9 +272,9 @@
{
$activity->set_end_date(0);
}
-
+
$activity_id = $this->so->store($activity);
-
+
$GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiactivity.view', 'id' => $activity_id,
'project_id' => $activity->get_project_id()));
}
else if (isset($_POST['cancel_activity']))
@@ -298,15 +292,15 @@
$this->use_yui_editor('description');
$GLOBALS['phpgw_info']['flags']['app_header'] =
lang('logistic') . '::' . lang('Add activity');
-
+
$GLOBALS['phpgw']->jqcal->add_listener('start_date');
$GLOBALS['phpgw']->jqcal->add_listener('end_date');
-
+
self::render_template_xsl(array('activity_item'), $data);
}
}
-
+
public function view()
{
$activity_id = phpgw::get_var('id');
@@ -333,7 +327,7 @@
$msgbox_data =
$GLOBALS['phpgw']->common->msgbox_data($this->flash_msgs);
$msgbox_data =
$GLOBALS['phpgw']->common->msgbox($msgbox_data);
}
-
+
$activity->set_project_id($project_id);
$data = array
@@ -347,7 +341,7 @@
self::render_template_xsl(array('activity_item'), $data);
}
}
-
+
private function get_user_array()
{
$user_array = array();
Modified: trunk/logistic/inc/model/class.activity.inc.php
===================================================================
--- trunk/logistic/inc/model/class.activity.inc.php 2012-10-01 08:53:59 UTC
(rev 10067)
+++ trunk/logistic/inc/model/class.activity.inc.php 2012-10-01 10:13:20 UTC
(rev 10068)
@@ -161,14 +161,19 @@
public function serialize()
{
+ $date_format =
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+ $project_name =
$this->get_so()->get_project_name($this->get_project_id());
+ $responsible_user =
$this->get_so()->get_responsible_user($this->get_responsible_user_id());
+
return array(
'id' => $this->get_id(),
'parent_id' =>
$this->get_parent_id(),
'name' => $this->get_name(),
'project_id' =>
$this->get_project_id(),
- 'start_date' =>
$this->get_start_date(),
- 'end_date' =>
$this->get_end_date(),
- 'responsible_user_id' =>
$this->get_responsible_user_id()
+ 'project_name' => $project_name,
+ 'start_date' =>
$this->get_start_date() ? date($date_format, $this->get_start_date()): '',
+ 'end_date' =>
$this->get_end_date() ? date($date_format, $this->get_end_date()): '',
+ 'responsible_user_id' =>
$responsible_user
);
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10068] added display of project name and responsible user on activity list,
Erik Holm-Larsen <=