[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8074]
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [8074] |
Date: |
Fri, 11 Nov 2011 06:39:48 +0000 |
Revision: 8074
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8074
Author: erikhl
Date: 2011-11-11 06:39:47 +0000 (Fri, 11 Nov 2011)
Log Message:
-----------
Modified Paths:
--------------
trunk/activitycalendar/inc/class.menu.inc.php
trunk/activitycalendar/inc/class.soactivity.inc.php
trunk/activitycalendar/inc/class.uiactivities.inc.php
trunk/activitycalendar/templates/base/activity_list_partial.php
Added Paths:
-----------
trunk/activitycalendar/inc/class.uidashboard.inc.php
trunk/activitycalendar/templates/base/dashboard.php
Modified: trunk/activitycalendar/inc/class.menu.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.menu.inc.php 2011-11-10 13:59:45 UTC
(rev 8073)
+++ trunk/activitycalendar/inc/class.menu.inc.php 2011-11-11 06:39:47 UTC
(rev 8074)
@@ -12,7 +12,7 @@
'activitycalendar' => array
(
'text' => lang('Activitycalendar'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'activitycalendar.uiactivities.index') ),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'activitycalendar.uidashboard.index') ),
'image' => array('property', 'location'),
'order' => 10,
'group' => 'office'
@@ -21,6 +21,12 @@
$menus['navigation'] = array
(
+ 'dashboard' => array
+ (
+ 'text' => lang('dashboard'),
+ 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction'=>
'activitycalendar.uidashboard.index') ),
+ 'image' => array('property', 'location_tenant'),
+ ),
'activities' => array
(
'text' => lang('Activities'),
Modified: trunk/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soactivity.inc.php 2011-11-10 13:59:45 UTC
(rev 8073)
+++ trunk/activitycalendar/inc/class.soactivity.inc.php 2011-11-11 06:39:47 UTC
(rev 8074)
@@ -144,6 +144,10 @@
$id =
$this->marshal($filters[$this->get_id_field_name()],'int');
$filter_clauses[] = "activity.id = {$id}";
}
+ if(isset($filters['new_activities']))
+ {
+ $filter_clauses = "activity.state=1";
+ }
if(isset($filters['activity_state']) &&
$filters['activity_state'] != 'all'){
$activity_state =
$this->marshal($filters['activity_state'],'int');
$filter_clauses[] = "activity.state =
{$activity_state}";
Modified: trunk/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiactivities.inc.php 2011-11-10
13:59:45 UTC (rev 8073)
+++ trunk/activitycalendar/inc/class.uiactivities.inc.php 2011-11-11
06:39:47 UTC (rev 8074)
@@ -281,6 +281,11 @@
switch($query_type)
{
+ case 'new_activities':
+ $filters = array('activity_state' => 1,
'activity_district' => phpgw::get_var('activity_district'), 'user_id' => $uid);
+ $result_objects =
activitycalendar_soactivity::get_instance()->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
+ $object_count =
activitycalendar_soactivity::get_instance()->get_count($search_for,
$search_type, $filters);
+ break;
case 'all_activities':
default:
$filters = array('activity_state' =>
phpgw::get_var('activity_state'), 'activity_district' =>
phpgw::get_var('activity_district'), 'user_id' => $uid);
Added: trunk/activitycalendar/inc/class.uidashboard.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uidashboard.inc.php
(rev 0)
+++ trunk/activitycalendar/inc/class.uidashboard.inc.php 2011-11-11
06:39:47 UTC (rev 8074)
@@ -0,0 +1,307 @@
+<?php
+phpgw::import_class('activitycalendar.uicommon');
+phpgw::import_class('activitycalendar.soorganization');
+phpgw::import_class('activitycalendar.sogroup');
+phpgw::import_class('activitycalendar.soactivity');
+
+include_class('activitycalendar', 'organization', 'inc/model/');
+include_class('activitycalendar', 'group', 'inc/model/');
+include_class('activitycalendar', 'activity', 'inc/model/');
+
+class activitycalendar_uidashboard extends activitycalendar_uicommon
+{
+ public $public_functions = array
+ (
+ 'index' => true
+ );
+
+ public function __construct()
+ {
+ parent::__construct();
+ self::set_active_menu('activitycalendar::dashboard');
+ $config = CreateObject('phpgwapi.config','activitycalendar');
+ $config->read();
+ }
+
+ public function index()
+ {
+ $this->render('dashboard.php');
+ }
+
+ public function changed_organizations()
+ {
+
self::set_active_menu('activitycalendar::organizationList::changed_organizations');
+ $this->render('organization_list_changed.php');
+ }
+
+ public function edit()
+ {
+ return false;
+ }
+
+ /**
+ * (non-PHPdoc)
+ * @see rental/inc/rental_uicommon#query()
+ */
+ public function query()
+ {
+
if($GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'] > 0)
+ {
+ $user_rows_per_page =
$GLOBALS['phpgw_info']['user']['preferences']['common']['maxmatchs'];
+ }
+ else {
+ $user_rows_per_page = 10;
+ }
+ // YUI variables for paging and sorting
+ $start_index = phpgw::get_var('startIndex', 'int');
+ $num_of_objects = phpgw::get_var('results', 'int', 'GET',
$user_rows_per_page);
+ $sort_field = phpgw::get_var('sort', 'string',
'GET', 'identifier');
+ $sort_ascending = phpgw::get_var('dir') == 'desc' ? false :
true;
+ // Form variables
+ $search_for = phpgw::get_var('query');
+ $search_type = phpgw::get_var('search_option');
+ // Create an empty result set
+ $result_objects = array();
+ $result_count = 0;
+
+ //Create an empty result set
+ $parties = array();
+
+ $exp_param = phpgw::get_var('export');
+ $export = false;
+ if(isset($exp_param)){
+ $export=true;
+ $num_of_objects = null;
+ }
+
+ //Retrieve the type of query and perform type specific logic
+ $type = phpgw::get_var('type');
+ $changed_org = false;
+ $changed_group = false;
+ switch($type)
+ {
+ case 'changed_organizations':
+ $filters = array('changed_orgs' => 'true');
+ $changed_org = true;
+ break;
+ case 'changed_groups':
+ $filters = array('changed_groups' => 'true');
+ $changed_group = true;
+ break;
+ default: // ... get all parties of a given type
+ //$filters = array('party_type' =>
phpgw::get_var('party_type'), 'active' => phpgw::get_var('active'));
+ break;
+ }
+ if($changed_group)
+ {
+ $result_objects =
activitycalendar_sogroup::get_instance()->get($start_index, $num_of_objects,
$sort_field, $sort_ascending, $search_for, $search_type, $filters);
+ $result_count =
activitycalendar_sogroup::get_instance()->get_count($search_for, $search_type,
$filters);
+ }
+ else
+ {
+ $result_objects =
activitycalendar_soorganization::get_instance()->get($start_index,
$num_of_objects, $sort_field, $sort_ascending, $search_for, $search_type,
$filters);
+ $result_count =
activitycalendar_soorganization::get_instance()->get_count($search_for,
$search_type, $filters);
+ }
+
+ //var_dump($result_objects);
+ // Create an empty row set
+ $rows = array();
+ foreach ($result_objects as $result) {
+ if(isset($result))
+ {
+ $res = $result->serialize();
+ $org_id = $result->get_id();
+ //$rows[] = $result->serialize();
+ $rows[] = $res;
+ if(!$changed_group && !$changed_org)
+ {
+ $filter_group = array('org_id' =>
$org_id);
+ $result_groups =
activitycalendar_sogroup::get_instance()->get(null, null, $sort_field,
$sort_ascending, $search_for, $search_type, $filter_group);
+ foreach ($result_groups as
$result_group) {
+ if(isset($result_group))
+ {
+ $res_g =
$result_group->serialize();
+ $rows[] = $res_g;
+ }
+ }
+ }
+ }
+ }
+ // ... add result data
+ $organization_data = array('results' => $rows, 'total_records'
=> $result_count);
+
+ $editable = phpgw::get_var('editable') == 'true' ? true : false;
+
+ if(!$export){
+ array_walk(
+ $organization_data['results'],
+ array($this, 'add_actions'),
+ array(
// Parameters
(non-object pointers)
+ $type
// [2] The type of
query
+ )
+ );
+ }
+
+
+ return $this->yui_results($organization_data, 'total_records',
'results');
+ }
+
+ public function get_organization_groups()
+ {
+ $GLOBALS['phpgw_info']['flags']['noheader'] = true;
+ $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+
+ $org_id = phpgw::get_var('orgid');
+ $group_id = phpgw::get_var('groupid');
+ $returnHTML = "<option value='0'>Ingen gruppe valgt</option>";
+ if($org_id)
+ {
+ $groups =
activitycalendar_sogroup::get_instance()->get(null, null, null, null, null,
null, array('org_id' => $org_id));
+ foreach ($groups as $group) {
+ if(isset($group))
+ {
+ //$res_g = $group->serialize();
+ $selected = "";
+ if($group_id && $group_id > 0)
+ {
+ $gr_id = (int)$group_id;
+ if($gr_id ==
(int)$group->get_id())
+ {
+ $selected_group = "
selected";
+ }
+ }
+ $group_html[] = "<option value='" .
$group->get_id() . "'". $selected_group . ">" . $group->get_name() .
"</option>";
+ }
+ }
+ $html = implode(' ' , $group_html);
+ $returnHTML = $returnHTML . ' ' . $html;
+ }
+
+
+ return $returnHTML;
+ //return "<option>Ingen gruppe valgt</option>";
+ }
+
+ /**
+ * Public method. Called when a user wants to view information about a
party.
+ * @param HTTP::id the party ID
+ */
+ public function view()
+ {
+ $GLOBALS['phpgw_info']['flags']['app_header'] .=
'::'.lang('view');
+ // Get the contract part id
+ $party_id = (int)phpgw::get_var('id');
+ if(isset($party_id) && $party_id > 0)
+ {
+ $party =
rental_soparty::get_instance()->get_single($party_id);
+ }
+ else
+ {
+ $this->render('permission_denied.php',array('error' =>
lang('invalid_request')));
+ return;
+ }
+
+ if(isset($party) && $party->has_permission(PHPGW_ACL_READ))
+ {
+ return $this->render(
+ 'party.php',
+ array (
+ 'party' => $party,
+ 'editable' => false,
+ 'cancel_link' =>
self::link(array('menuaction' => 'rental.uiparty.index', 'populate_form' =>
'yes')),
+ )
+ );
+ }
+ else
+ {
+ $this->render('permission_denied.php',array('error' =>
lang('permission_denied_view_party')));
+ }
+ }
+
+ public function download_agresso(){
+ $browser = CreateObject('phpgwapi.browser');
+ $browser->content_header('export.txt','text/plain');
+ print rental_soparty::get_instance()->get_export_data();
+ }
+
+ /**
+ * Add action links and labels for the context menu of the list items
+ *
+ * @param $value pointer to
+ * @param $key ?
+ * @param $params [composite_id, type of query, editable]
+ */
+ public function add_actions(&$value, $key, $params)
+ {
+ //Defining new columns
+ $value['ajax'] = array();
+ $value['actions'] = array();
+ $value['labels'] = array();
+
+ $query_type = $params[0];
+
+ switch($query_type)
+ {
+ case 'all_organizations':
+ $value['ajax'][] = false;
+ if($value['organization_id'] != '' &&
$value['organization_id'] != null){
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' => 'booking.uigroup.show',
'id' => $value['id'])));
+ }
+ else
+ {
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'booking.uiorganization.show', 'id' => $value['id'])));
+ }
+ $value['labels'][] = lang('show');
+ break;
+
+ case 'changed_organizations':
+ $value['ajax'][] = false;
+ if($value['organization_id'] != '' &&
$value['organization_id'] != null){
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'activitycalendar.uiorganization.show', 'id' => $value['id'], 'type' =>
'group')));
+ }
+ else
+ {
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'activitycalendar.uiorganization.show', 'id' => $value['id'])));
+ }
+ $value['labels'][] = lang('show');
+ if($value['transferred'] == false)
+ {
+ $value['ajax'][] = false;
+ if($value['organization_id'] != '' &&
$value['organization_id'] != null){
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'activitycalendar.uiorganization.show', 'id' => $value['id'], 'type' =>
'group')));
+ }
+ else
+ {
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'activitycalendar.uiorganization.edit', 'id' => $value['id'])));
+ }
+ $value['labels'][] = lang('edit');
+ }
+ break;
+ case 'changed_groups':
+ $value['ajax'][] = false;
+ if($value['organization_id'] != '' &&
$value['organization_id'] != null){
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'activitycalendar.uiorganization.show', 'id' => $value['id'], 'type' =>
'group')));
+ }
+ else
+ {
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'activitycalendar.uiorganization.show', 'id' => $value['id'])));
+ }
+ $value['labels'][] = lang('show');
+ if($value['transferred'] == false)
+ {
+ $value['ajax'][] = false;
+ if($value['organization_id'] != '' &&
$value['organization_id'] != null){
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'activitycalendar.uiorganization.edit', 'id' => $value['id'], 'type' =>
'group')));
+ }
+ else
+ {
+ $value['actions'][] =
html_entity_decode(self::link(array('menuaction' =>
'activitycalendar.uiorganization.edit', 'id' => $value['id'])));
+ }
+ $value['labels'][] = lang('edit');
+ }
+ break;
+ }
+ }
+}
+?>
\ No newline at end of file
Modified: trunk/activitycalendar/templates/base/activity_list_partial.php
===================================================================
--- trunk/activitycalendar/templates/base/activity_list_partial.php
2011-11-10 13:59:45 UTC (rev 8073)
+++ trunk/activitycalendar/templates/base/activity_list_partial.php
2011-11-11 06:39:47 UTC (rev 8074)
@@ -189,7 +189,7 @@
<label class="toolbar_element_label"
for="ctrl_toggle_activity_state"><?php echo lang('activity_state') ?></label>
<select name="activity_state" id="<?php echo $list_id
?>_ctrl_toggle_activity_state">
<option value="all"><?php echo lang('all') ?></option>
- <option value="1"><?php echo lang('new') ?></option>
+ <option value="1" <?php if($list_id ==
'new_activities'){ echo 'selected="selected"';}?>><?php echo lang('new')
?></option>
<option value="2" ><?php echo lang('change') ?></option>
<option value="3" ><?php echo lang('published')
?></option>
<option value="5" ><?php echo lang('rejected')
?></option>
@@ -214,7 +214,8 @@
<?php
}
?>
-
+<?php if($list_id != 'new_activities')
+{?>
<fieldset>
<h3><?php echo lang('export_to') ?></h3>
<?php
@@ -224,6 +225,7 @@
<a href="javascript:activity_export('<?php echo $list_id ?>')"
title="<?php echo lang('Download as excel') ?>"><img src="<?php echo
ACTIVITYCALENDAR_IMAGE_PATH
?>images/16x16/mimetypes/x-office-spreadsheet.png"/></a> <a
href="javascript:activity_email('<?php echo $list_id ?>')" title="<?php echo
lang('Send email to selection') ?>"><button><?php echo lang('Send mail to
selection') ?></button></a>
</div>
</fieldset>
+<?php }?>
<div id="<?php echo $list_id ?>_paginator" class="paginator"></div>
<div id="<?php echo $list_id ?>_container" class="datatable_container"></div>
Added: trunk/activitycalendar/templates/base/dashboard.php
===================================================================
--- trunk/activitycalendar/templates/base/dashboard.php
(rev 0)
+++ trunk/activitycalendar/templates/base/dashboard.php 2011-11-11 06:39:47 UTC
(rev 8074)
@@ -0,0 +1,31 @@
+<?php
+ include("common.php");
+?>
+
+<h1><img src="<?php echo ACTIVITYCALENDAR_IMAGE_PATH
?>images/32x32/x-office-address-book.png" /> <?php echo lang('dashboard')
?></h1>
+
+<h2><?php echo lang('organization')?></h2>
+<?php
+ $list_form = true;
+ $list_id = 'changed_organizations';
+ $url_add_on = '&type=changed_organizations';
+ $nosearch = true;
+ $extra_cols = array(array("key" => "change_type", "label" =>
lang('change_type'), "sortable" => true, "index" => 5));
+ include('organization_list_partial.php');
+?>
+<h2><?php echo lang('group')?></h2>
+<?php
+ $list_form = true;
+ $list_id = 'changed_groups';
+ $url_add_on = '&type=changed_groups';
+ $nosearch = true;
+ $extra_cols = array(array("key" => "change_type", "label" =>
lang('change_type'), "sortable" => true, "index" => 5));
+ include('organization_list_partial.php');
+?>
+<h2><?php echo lang('activities') ?></h2>
+<?php
+ $list_form = true;
+ $list_id = 'new_activities';
+ $url_add_on = '&type=new_activities';
+ include('activity_list_partial.php');
+?>
\ No newline at end of file
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8074],
Erik Holm-Larsen <=