[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10314] logistic: menuitem as favorites
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10314] logistic: menuitem as favorites |
Date: |
Tue, 23 Oct 2012 12:41:15 +0000 |
Revision: 10314
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10314
Author: sigurdne
Date: 2012-10-23 12:41:15 +0000 (Tue, 23 Oct 2012)
Log Message:
-----------
logistic: menuitem as favorites
Modified Paths:
--------------
trunk/logistic/inc/class.menu.inc.php
trunk/logistic/inc/class.uiactivity.inc.php
trunk/logistic/setup/phpgw_no.lang
Modified: trunk/logistic/inc/class.menu.inc.php
===================================================================
--- trunk/logistic/inc/class.menu.inc.php 2012-10-23 11:02:22 UTC (rev
10313)
+++ trunk/logistic/inc/class.menu.inc.php 2012-10-23 12:41:15 UTC (rev
10314)
@@ -41,19 +41,38 @@
(
'text' => lang('logistic'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'logistic.uiproject.index') ),
- 'image' => array('property', 'location'),
+ 'image' => array('property',
'location'),
'order' => 10,
'group' => 'office'
)
);
+
+ $favorites_children = array();
+
if(isset($GLOBALS['phpgw_info']['user']['preferences']['logistic']['menu_favorites'])
&& $GLOBALS['phpgw_info']['user']['preferences']['logistic']['menu_favorites'])
+ {
+ $menu_favorites =
$GLOBALS['phpgw_info']['user']['preferences']['logistic']['menu_favorites'];
+ foreach ($menu_favorites as $type => $targets)
+ {
+ foreach ($targets as $target =>
$target_name)
+ {
+
$favorites_children["{$type}{$target}"] = array
+ (
+ 'text' => $target_name,
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
"logistic.ui{$type}.index", 'filter' =>$target ) ),
+ 'image' =>
array('property', 'location_tenant')
+ );
+ }
+ }
+ }
+
$menus['navigation'] = array
(
'project' => array
(
'text' => lang('project'),
'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'logistic.uiproject.index') ),
- 'image' => array('property', 'location_tenant'),
+ 'image' => array('property',
'location_tenant'),
'children' => array(
'activity' => array
(
@@ -74,6 +93,13 @@
'image' => array('property', 'location_tenant'),
),*/
)
+ ),
+ 'favorites' => array
+ (
+ 'text' => lang('favorites'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'logistic.uiactivity.index') ),
+ 'image' => array('property',
'location_tenant'),
+ 'children' => $favorites_children
)
);
@@ -126,4 +152,4 @@
return $menus;
}
- }
\ No newline at end of file
+ }
Modified: trunk/logistic/inc/class.uiactivity.inc.php
===================================================================
--- trunk/logistic/inc/class.uiactivity.inc.php 2012-10-23 11:02:22 UTC (rev
10313)
+++ trunk/logistic/inc/class.uiactivity.inc.php 2012-10-23 12:41:15 UTC (rev
10314)
@@ -38,12 +38,13 @@
private $so;
private $so_project;
public $public_functions = array(
- 'query' => true,
- 'add' => true,
- 'edit' => true,
- 'view' => true,
- 'index' => true,
- 'save' => true
+ 'query' => true,
+ 'add' => true,
+ 'edit' => true,
+ 'view' => true,
+ 'index' => true,
+ 'save' => true,
+ 'edit_favorite' => true
);
public function __construct()
@@ -211,6 +212,18 @@
'parameters' =>
json_encode($parameters)
);
+ $data['datatable']['actions'][] = array
+ (
+ 'my_name' =>
'add_favorite',
+ 'text' =>
lang('toggle as favorite'),
+ 'action' =>
$GLOBALS['phpgw']->link('/index.php',array
+ (
+ 'menuaction' =>
'logistic.uiactivity.edit_favorite'
+ )),
+ 'parameters' =>
json_encode($parameters)
+ );
+
+
self::render_template_xsl(array('datatable_common'),
$data);
}
@@ -441,6 +454,39 @@
}
}
+ public function edit_favorite()
+ {
+ if($activity_id = phpgw::get_var('activity_id'))
+ {
+ $activity = $this->so->get_single($activity_id);
+
+
if(isset($GLOBALS['phpgw_info']['user']['preferences']['logistic']['menu_favorites'])
&& $GLOBALS['phpgw_info']['user']['preferences']['logistic']['menu_favorites'])
+ {
+ $menu_favorites =
$GLOBALS['phpgw_info']['user']['preferences']['logistic']['menu_favorites'];
+ }
+ else
+ {
+ $menu_favorites = array();
+ }
+
+
if(isset($menu_favorites['activity'][$activity_id]))
+ {
+
unset($menu_favorites['activity'][$activity_id]);
+ }
+ else
+ {
+
$menu_favorites['activity'][$activity_id] = $activity->get_name();
+ }
+
+ $GLOBALS['phpgw']->preferences->account_id =
$GLOBALS['phpgw_info']['user']['account_id'];
+ $GLOBALS['phpgw']->preferences->read();
+
$GLOBALS['phpgw']->preferences->add('logistic','menu_favorites',$menu_favorites,'user');
+
$GLOBALS['phpgw']->preferences->save_repository();
+ execMethod('phpgwapi.menu.clear');
+ }
+ $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'logistic.uiactivity.index'));
+ }
+
private function get_user_array()
{
$user_array = array();
@@ -456,4 +502,4 @@
return $user_array;
}
- }
\ No newline at end of file
+ }
Modified: trunk/logistic/setup/phpgw_no.lang
===================================================================
--- trunk/logistic/setup/phpgw_no.lang 2012-10-23 11:02:22 UTC (rev 10313)
+++ trunk/logistic/setup/phpgw_no.lang 2012-10-23 12:41:15 UTC (rev 10314)
@@ -61,4 +61,6 @@
error_msg_2 logistic no Vennligst velg en verdi i listen
error_msg_3 logistic no Vennligst angi sluttdato etter startdato
Criterias logistic no Kriterier
-Add criterias logistic no Legg til kriterier
\ No newline at end of file
+Add criterias logistic no Legg til kriterier
+favorites logistic no Favoritter
+toggle as favorite logistic no Legg til / fjern som favoritt
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10314] logistic: menuitem as favorites,
Sigurd Nes <=