fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [7476]


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [7476]
Date: Fri, 15 Jul 2011 09:57:56 +0000

Revision: 7476
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7476
Author:   erikhl
Date:     2011-07-15 09:57:55 +0000 (Fri, 15 Jul 2011)
Log Message:
-----------


Modified Paths:
--------------
    trunk/activitycalendar/inc/class.soactivity.inc.php
    trunk/activitycalendar/inc/class.soorganization.inc.php
    trunk/activitycalendar/inc/class.uiactivities.inc.php
    trunk/activitycalendar/inc/class.uiarena.inc.php
    trunk/activitycalendar/inc/class.uiimport.inc.php
    trunk/activitycalendar/inc/model/class.organization.inc.php
    trunk/activitycalendar/setup/phpgw_no.lang
    trunk/activitycalendar/templates/base/activity_list_partial.php
    trunk/activitycalendar/templates/base/arena_list_partial.php
    trunk/activitycalendar/templates/base/organization_list_partial.php

Added Paths:
-----------
    trunk/activitycalendar/templates/base/organization_list_changed.php

Modified: trunk/activitycalendar/inc/class.soactivity.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soactivity.inc.php 2011-07-06 12:47:07 UTC 
(rev 7475)
+++ trunk/activitycalendar/inc/class.soactivity.inc.php 2011-07-15 09:57:55 UTC 
(rev 7476)
@@ -148,10 +148,21 @@
                        $activity_state = 
$this->marshal($filters['activity_state'],'int');
                        $filter_clauses[] = "activity.state = 
{$activity_state}";
                }
-               if(isset($filters['activity_district']) && 
$filters['activity_district'] != 'all'){
-                       $activity_district = 
$this->marshal($filters['activity_district'],'int');
-                       $filter_clauses[] = "activity.office = 
'{$activity_district}'";
+               if(isset($filters['activity_district'])){
+                       if($filters['activity_district'] != 'all')
+                       {
+                               $activity_district = 
$this->marshal($filters['activity_district'],'int');
+                               $filter_clauses[] = "activity.office = 
'{$activity_district}'";
+                       }
                }
+               else
+               {
+                       $activity_district = 
$this->get_office_from_user($filters['user_id']);
+                       if($activity_district && $activity_district != '')
+                       {
+                               $filter_clauses[] = "activity.office = 
'{$activity_district}'";
+                       }
+               }
                
                if(count($filter_clauses))
                {
@@ -452,6 +463,22 @@
                return $district;
        }
        
+       
+       function get_office_from_user($user_id)
+       {
+               if(user_id)
+               {
+                       $user_id = (int)$user_id;
+                       $q1="SELECT office FROM bb_office_user WHERE 
account_id={$user_id}";
+                       //var_dump($q1);
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $office_id = $this->db->f('office');
+                       }
+               }
+               return $office_id;
+       }
+       
        function get_office_name($district_id)
        {
                $result = "Ingen";

Modified: trunk/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soorganization.inc.php     2011-07-06 
12:47:07 UTC (rev 7475)
+++ trunk/activitycalendar/inc/class.soorganization.inc.php     2011-07-15 
09:57:55 UTC (rev 7476)
@@ -230,6 +230,30 @@
        }
                return $desc;
        }
+       
+       function get_district_from_name($name)
+       {
+               $this->db->query("SELECT part_of_town_id FROM fm_part_of_town 
where name like UPPER('%{$name}%') ", __LINE__, __FILE__);
+               while($this->db->next_record()){
+                       $result = $this->db->f('part_of_town_id');
+               }       
+               return $result;
+       }
+       
+       function get_office_from_district($district_id)
+       {
+               if($district_id)
+               {
+                       $district_id = (int)$district_id;
+                       $q1="SELECT fm_district.descr FROM 
fm_part_of_town,fm_district WHERE 
fm_part_of_town.part_of_town_id={$district_id} AND fm_district.id = 
fm_part_of_town.district_id";
+                       //var_dump($q1);
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $office_name = $this->db->f('descr');
+                       }
+               }
+               return $office_name;
+       }
 
        /**
         * Function for adding a new party to the database. Updates the party 
object.

Modified: trunk/activitycalendar/inc/class.uiactivities.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiactivities.inc.php       2011-07-06 
12:47:07 UTC (rev 7475)
+++ trunk/activitycalendar/inc/class.uiactivities.inc.php       2011-07-15 
09:57:55 UTC (rev 7476)
@@ -239,11 +239,19 @@
                        $num_of_objects = null;
                }
                
+               $email_param = phpgw::get_var('email');
+               $email = false;
+               if(isset($email_param)){
+                       $email=true;
+               }
+               
+               $uid = $GLOBALS['phpgw_info']['user']['account_id'];
+               
                switch($query_type)
                {
                        case 'all_activities':
                        default:
-                               $filters = array('activity_state' => 
phpgw::get_var('activity_state'), 'activity_district' => 
phpgw::get_var('activity_district'));
+                               $filters = array('activity_state' => 
phpgw::get_var('activity_state'), '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;
@@ -251,24 +259,32 @@
                
                //Create an empty row set
                $rows = array();
+               $mail_rows = array();
                foreach($result_objects as $result) {
                        //var_dump($result);
                        if(isset($result))
                        {
                                // ... add a serialized result
                                $rows[] = $result->serialize();
+                               $mail_rows[] = $result;
                        }
                }
                
                // ... add result data
                $result_data = array('results' => $rows, 'total_records' => 
$object_count);
                
-               if(!$export){
+               if(!$export && !$email){
                        //Add action column to each row in result table
                        array_walk($result_data['results'], array($this, 
'add_actions'), array($query_type));
                }
-
-               return $this->yui_results($result_data, 'total_records', 
'results');
+               if($email)
+               {
+                       $this->send_email_to_selection($mail_rows);     
+               }
+               else
+               {
+                       return $this->yui_results($result_data, 
'total_records', 'results');
+               }
        }
                
        /**
@@ -303,6 +319,37 @@
                }
     }
     
+    private function send_email_to_selection($activities)
+    {
+       foreach($activities as $activity)
+       {
+               
+               //$activity = 
activitycalendar_soactivity::get_instance()->get_single($activity_id);
+               $subject = lang('mail_subject_update');
+               $body = lang('mail_body_update', $activity->get_id() . ', ' . 
$activity->get_title());
+               
+               //var_dump($subject);
+               //var_dump($body);
+               //var_dump($activity->get_organization_id() . " ; " . 
$activity->get_group_id());
+               
+               if($activity->get_group_id() && $activity->get_group_id() > 0)
+               {
+                       //var_dump("group!");
+                       //$contact_person2 = 
activitycalendar_socontactperson::get_instance()->get_group_contact2($activity>get_group_id());
+                       
activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_2(),
 $subject, $body);
+               }
+               else if($activity->get_organization_id() && 
$activity->get_organization_id() > 0)
+               {
+                       //var_dump("org!");
+                       //$contact_person2 = 
activitycalendar_socontactperson::get_instance()->get_oup_contact2($activity>get_group_id());
+                       
activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_2(),
 $subject, $body);
+               }
+           }
+       
+       //$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 
'activitycalendar.uiactivities.index', 'message' => 'E-post sendt'));
+       
+    }
+    
     public function send_mail()
     {
        $activity_id = (int)phpgw::get_var('activity_id');

Modified: trunk/activitycalendar/inc/class.uiarena.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiarena.inc.php    2011-07-06 12:47:07 UTC 
(rev 7475)
+++ trunk/activitycalendar/inc/class.uiarena.inc.php    2011-07-15 09:57:55 UTC 
(rev 7476)
@@ -13,6 +13,7 @@
                'view'                      => true,
                'add'                           => true,
                'edit'                          => true,
+               'download'                      => true,
                'get_address_search'    => true
        );
        
@@ -215,11 +216,11 @@
                {
                        case 'all_arenas':
                                $value['ajax'][] = false;
+                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiarena.edit', 'id' => $value['id'])));
+                               $value['labels'][] = lang('edit');
+                               $value['ajax'][] = false;
                                $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiarena.view', 'id' => $value['id'])));
                                $value['labels'][] = lang('show');
-                               $value['ajax'][] = false;
-                               $value['actions'][] = 
html_entity_decode(self::link(array('menuaction' => 
'activitycalendar.uiarena.edit', 'id' => $value['id'])));
-                               $value['labels'][] = lang('edit');
                                break;
                }
     }

Modified: trunk/activitycalendar/inc/class.uiimport.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.uiimport.inc.php   2011-07-06 12:47:07 UTC 
(rev 7475)
+++ trunk/activitycalendar/inc/class.uiimport.inc.php   2011-07-15 09:57:55 UTC 
(rev 7476)
@@ -211,11 +211,17 @@
                                unset($act_targets);
                                unset($activity_persons);
                                unset($activity_description);
+                               unset($org_info);
+                               unset($contact_person);
+                               unset($contact1);
+                               unset($contact2);
+                               unset($contact3);
+                               unset($contact4);
                                
                                $arena = new activitycalendar_arena();
                                //8: sted, 9:adresse
-                               $arena_name = $this->decode($data[7]);
-                               $arena_address = $this->decode($data[8]);
+                               $arena_name = $this->decode($data[8]);
+                               $arena_address = $this->decode($data[9]);
                                $curr_arena_id = 0;
 
                                if($arena_name){
@@ -224,10 +230,10 @@
        
                                        // All is good, store notification
                                        if ($soarena->store($arena)) {
-                                               $this->messages[] = 
"Successfully imported arena: Name ({$this->decode($data[7])})";
+                                               $this->messages[] = 
"Successfully imported arena: Name ({$arena_name})";
                                                $curr_arena_id = 
$arena->get_id();
                                        } else {
-                                               $this->errors[] = "Error 
importing arena: Name ({$this->decode($data[7])})";
+                                               $this->errors[] = "Error 
importing arena: Name ({$arena_name})";
                                                $curr_arena_id = 0;
                                                $arenaOK = false;
                                        }
@@ -240,12 +246,93 @@
                                
                                $activity = new activitycalendar_activity();
                                $activity_title = $this->decode($data[1]);
-                               $activity_org = $this->decode($data[2]);
+                               $activity_group = $this->decode($data[2]);
+                               $activity_org = $this->decode($data[3]);
+                               $activity_category = $this->decode($data[5]);
+                               if($activity_category)
+                               {
+                                       $activity_category = 
$soactivity->get_category_from_name($activity_category);
+                               }
+                               
                                if($activity_org)
                                {
                                        $activity_org = 
$soactivity->get_orgid_from_orgno($activity_org);
                                        if($activity_org)
                                        {
+                                               //update the organization found
+                                               $org_info = array();
+                                               $org_info['orgid'] = 
$activity_org;
+                                               $org_info['name'] = 
$this->decode($data[2]); //new
+                                               $org_info['homepage'] = 
$this->decode($data[15]);
+                                               $org_info['phone'] = 
$this->decode($data[13]);
+                                               $org_info['email'] = 
$this->decode($data[12]);
+                                               $org_info['description'] = 
$this->decode($data[6]);
+                                               $org_info['street'] = 
$this->decode($data[9]);
+                                               $org_info['zip'] = 
$this->decode($data[18]);
+                                               $org_info['activity_id'] = 
$activity_category;
+                                               $org_info['district'] = 
$this->decode($data[22]); 
+                                               
$soactivity->update_organization($org_info);
+                                               //$new_org_id = $activity_org;
+                                               
+                                               
$soactivity->delete_contact_persons($activity_org);
+                                               
+                                               $contact1 = array();
+                                               $contact1['name'] = 
$this->decode($data[12]);
+                                               $contact1['phone'] = 
$this->decode($data[13]);
+                                               $contact1['mail'] = 
$this->decode($data[14]);
+                                               $contact1['org_id'] = 
$this->decode($activity_org);
+                                               
$soactivity->add_contact_person_org($contact1);
+                                               
+                                               $contact2 = array();
+                                               $contact2['name'] = 
$this->decode($data[16]);
+                                               $contact2['phone'] = 
$this->decode($data[19]);
+                                               $contact2['mail'] = 
$this->decode($data[20]);
+                                               $contact2['org_id'] = 
$this->decode($activity_org);
+                                               
$soactivity->add_contact_person_org($contact2);
+                                               
+                                               //group-stuff:
+                                               if($activity_group)
+                                               {
+                                                       $group_info = array();
+                                                       
$group_info['organization_id'] = $activity_org;
+                                                       
$group_info['description'] = $this->decode($data[6]);
+                                                       $group_info['name'] = 
$this->decode($data[1]);
+                                                       
$group_info['activity_id'] = $activity_category;
+                                                       $new_group_id = 
$soactivity->add_group($group_info);
+                                                       
+                                                       $contact3 = array();
+                                                       $contact3['name'] = 
$this->decode($data[12]);
+                                                       $contact3['phone'] = 
$this->decode($data[13]);
+                                                       $contact3['mail'] = 
$this->decode($data[14]);
+                                                       $contact3['group_id'] = 
$this->decode($new_group_id);
+                                                       
$soactivity->add_contact_person_group($contact3);
+                                                       
+                                                       $contact4 = array();
+                                                       $contact4['name'] = 
$this->decode($data[16]);
+                                                       $contact4['phone'] = 
$this->decode($data[19]);
+                                                       $contact4['mail'] = 
$this->decode($data[20]);
+                                                       $contact4['group_id'] = 
$this->decode($new_group_id);
+                                                       
$soactivity->add_contact_person_group($contact4);
+                                                       
+                                                       $activity_persons = 
activitycalendar_sogroup::get_instance()->get_contacts($new_group_id);
+                                               }
+                                               else
+                                               {
+                                                       $activity_persons = 
activitycalendar_soorganization::get_instance()->get_contacts($activity_org);
+                                               }
+/*                                             
+                                               foreach($activity_persons as 
$pers)
+                                               {
+                                                       unset($contact_person);
+                                                       $contact_person['id'] = 
$pers;
+                                                       $contact_person['name'] 
= $this->decode($data[11]);
+                                                       
$contact_person['phone'] = $this->decode($data[12]);
+                                                       $contact_person['mail'] 
= $this->decode($data[13]);
+                                                       
$contact_person['org_id'] = $this->decode($new_org_id);
+                                                       
$soactivity->update_contact_person_org($contact_person);                        
                                
+                                               }                               
                
+*/                                             
+                                               /*
                                                
$soactivity->set_org_active($activity_org);
                                                $activity_description = 
$this->decode($data[5]);
                                                if($activity_description)
@@ -256,18 +343,143 @@
                                                        
//if(strlen($activity_description) > 255)
                                                        //{
                                                                
//$activity_description = substr($activity_description,0,254);
-                                                       //}
+                                                       //} 
                                                }
-                                               $activity_persons = 
activitycalendar_soorganization::get_instance()->get_contacts($activity_org);
+                                               */
+                                               //$activity_persons = 
activitycalendar_soorganization::get_instance()->get_contacts($activity_org);
                                        }
+                                       else    //add org unit
+                                       {
+                                               $org_info = array();
+                                               $org_info['name'] = 
$this->decode($data[2]); //new
+                                               $org_info['orgnr'] = 
$this->decode($data[3]);
+                                               $org_info['homepage'] = 
$this->decode($data[15]);
+                                               $org_info['phone'] = 
$this->decode($data[13]);
+                                               $org_info['email'] = 
$this->decode($data[14]);
+                                               $org_info['description'] = 
$this->decode($data[6]);
+                                               $org_info['street'] = 
$this->decode($data[9]);
+                                               $org_info['zip'] = 
$this->decode($data[18]);
+                                               $org_info['activity_id'] = 
$activity_category;
+                                               $org_info['district'] = 
$this->decode($data[22]); 
+                                               $new_org_id = 
$soactivity->add_organization($org_info);
+                                               
+                                               $contact1 = array();
+                                               $contact1['name'] = 
$this->decode($data[12]);
+                                               $contact1['phone'] = 
$this->decode($data[13]);
+                                               $contact1['mail'] = 
$this->decode($data[14]);
+                                               $contact1['org_id'] = 
$this->decode($new_org_id);
+                                               
$soactivity->add_contact_person_org($contact1);
+                                               
+                                               $contact2 = array();
+                                               $contact2['name'] = 
$this->decode($data[16]);
+                                               $contact2['phone'] = 
$this->decode($data[19]);
+                                               $contact2['mail'] = 
$this->decode($data[20]);
+                                               $contact2['org_id'] = 
$this->decode($new_org_id);
+                                               
$soactivity->add_contact_person_org($contact2);
+                                               
+                                               //group-stuff:
+                                               if($activity_group)
+                                               {
+                                                       $group_info = array();
+                                                       
$group_info['organization_id'] = $new_org_id;
+                                                       
$group_info['description'] = $this->decode($data[6]);
+                                                       $group_info['name'] = 
$this->decode($data[1]);
+                                                       
$group_info['activity_id'] = $activity_category;
+                                                       $new_group_id = 
$soactivity->add_group($group_info);
+                                                       
+                                                       $contact3 = array();
+                                                       $contact3['name'] = 
$this->decode($data[12]);
+                                                       $contact3['phone'] = 
$this->decode($data[13]);
+                                                       $contact3['mail'] = 
$this->decode($data[14]);
+                                                       $contact3['group_id'] = 
$this->decode($new_group_id);
+                                                       
$soactivity->add_contact_person_group($contact3);
+                                                       
+                                                       $contact4 = array();
+                                                       $contact4['name'] = 
$this->decode($data[16]);
+                                                       $contact4['phone'] = 
$this->decode($data[19]);
+                                                       $contact4['mail'] = 
$this->decode($data[20]);
+                                                       $contact4['group_id'] = 
$this->decode($new_group_id);
+                                                       
$soactivity->add_contact_person_group($contact4);
+                                                       
+                                                       $activity_persons = 
activitycalendar_sogroup::get_instance()->get_contacts($new_group_id);
+                                               }
+                                               else
+                                               {
+                                                       $activity_persons = 
activitycalendar_soorganization::get_instance()->get_contacts($new_org_id);
+                                               }
+                                       }
                                }
-                               $activity_adapted = $this->decode($data[3]);
-                               $activity_category = $this->decode($data[4]);
-                               if($activity_category)
+                               else    //add org unit without org no
                                {
-                                       $activity_category = 
$soactivity->get_category_from_name($activity_category);
+                                       $org_info = array();
+                                       if($activity_group && !$activity_group 
== '')
+                                       {
+                                               $org_info['name'] = 
$activity_group;
+                                       }
+                                       else
+                                       {
+                                               $org_info['name'] = 
$this->decode($data[1]);
+                                       }
+                                        
+                                       //$org_info['orgnr'] = 
$this->decode($data[2]);
+                                       $org_info['homepage'] = 
$this->decode($data[15]);
+                                       $org_info['phone'] = 
$this->decode($data[13]);
+                                       $org_info['email'] = 
$this->decode($data[14]);
+                                       $org_info['description'] = 
$this->decode($data[6]);
+                                       $org_info['street'] = 
$this->decode($data[9]);
+                                       $org_info['zip'] = 
$this->decode($data[18]);
+                                       $org_info['activity_id'] = 
$activity_category;
+                                       $org_info['district'] = 
$this->decode($data[22]); 
+                                       $new_org_id = 
$soactivity->add_organization($org_info);
+                                               
+                                       $contact1 = array();
+                                       $contact1['name'] = 
$this->decode($data[12]);
+                                       $contact1['phone'] = 
$this->decode($data[13]);
+                                       $contact1['mail'] = 
$this->decode($data[14]);
+                                       $contact1['org_id'] = 
$this->decode($new_org_id);
+                                       
$soactivity->add_contact_person_org($contact1);
+                                       
+                                       $contact2 = array();
+                                       $contact2['name'] = 
$this->decode($data[16]);
+                                       $contact2['phone'] = 
$this->decode($data[19]);
+                                       $contact2['mail'] = 
$this->decode($data[20]);
+                                       $contact2['org_id'] = 
$this->decode($new_org_id);
+                                       
$soactivity->add_contact_person_org($contact2);
+                                       
+                                       //group-stuff:
+                                       if($activity_group)
+                                       {
+                                               $group_info = array();
+                                               $group_info['organization_id'] 
= $org_id;
+                                               $group_info['description'] = 
$this->decode($data[6]);
+                                               $group_info['name'] = 
$this->decode($data[1]);
+                                               $group_info['activity_id'] = 
$activity_category;
+                                               $new_group_id = 
$soactivity->add_group($group_info);
+                                               
+                                               $contact3 = array();
+                                               $contact3['name'] = 
$this->decode($data[12]);
+                                               $contact3['phone'] = 
$this->decode($data[13]);
+                                               $contact3['mail'] = 
$this->decode($data[14]);
+                                               $contact3['group_id'] = 
$this->decode($new_group_id);
+                                               
$soactivity->add_contact_person_group($contact3);
+                                               
+                                               $contact4 = array();
+                                               $contact4['name'] = 
$this->decode($data[16]);
+                                               $contact4['phone'] = 
$this->decode($data[19]);
+                                               $contact4['mail'] = 
$this->decode($data[20]);
+                                               $contact4['group_id'] = 
$this->decode($new_group_id);
+                                               
$soactivity->add_contact_person_group($contact4);
+                                               
+                                               $activity_persons = 
activitycalendar_sogroup::get_instance()->get_contacts($new_group_id);
+                                       }
+                                       else
+                                       {
+                                               $activity_persons = 
activitycalendar_soorganization::get_instance()->get_contacts($new_org_id);
+                                       }
                                }
-                               $activity_target = $this->decode($data[6]);
+                               
+                               $activity_adapted = $this->decode($data[4]);
+                               $activity_target = $this->decode($data[7]);
                                //var_dump($activity_target);
                                if($activity_target)
                                {
@@ -279,9 +491,9 @@
                                        $activity_target = implode(",", 
$act_targets);
                                }
 
-                               $activity_day = $this->decode($data[9]);
-                               $activity_time = $this->decode($data[10]);
-                               $activity_update_date = 
$this->decode($data[20]);
+                               $activity_day = $this->decode($data[10]);
+                               $activity_time = $this->decode($data[11]);
+                               $activity_update_date = 
$this->decode($data[21]);
                                if($activity_update_date)
                                {
                                        $act_update_array = explode(".", 
$activity_update_date);
@@ -294,7 +506,7 @@
                                                
//var_dump($activity_updated_date);
                                        }
                                }
-                               $activity_district = $this->decode($data[21]);
+                               $activity_district = $this->decode($data[22]);
                                if($activity_district)
                                {
                                        $activity_district = 
$soactivity->get_district_from_name($activity_district);
@@ -303,10 +515,12 @@
                                if($activity_title){
                                        $activity->set_title($activity_title);
                                        
$activity->set_organization_id($activity_org);
+                                       $activity->set_group_id($new_group_id);
                                        
$activity->set_category($activity_category);
                                        $activity->set_target($activity_target);
                                        
$activity->set_description($activity_description);
                                        $activity->set_arena($curr_arena_id);
+                                       $activity->set_state(3);
                                        $activity->set_time($activity_day.' 
'.$activity_time);
                                        if($activity_adapted)
                                        {

Modified: trunk/activitycalendar/inc/model/class.organization.inc.php
===================================================================
--- trunk/activitycalendar/inc/model/class.organization.inc.php 2011-07-06 
12:47:07 UTC (rev 7475)
+++ trunk/activitycalendar/inc/model/class.organization.inc.php 2011-07-15 
09:57:55 UTC (rev 7476)
@@ -107,6 +107,7 @@
                
                public function serialize()
                {
+                       $so_org = 
activitycalendar_soorganization::get_instance();
                        return array(
                                'id' => $this->get_id(),
                                'name' => $this->get_name(),
@@ -118,7 +119,8 @@
                                'phone' =>      $this->get_phone(),
                                'address'       =>      $this->get_address(),
                                'show_in_portal' => $this->get_show_in_portal(),
-                               'change_type' => $this->get_change_type()
+                               'change_type' => $this->get_change_type(),
+                               'office' => 
$so_org->get_office_from_district($so_org->get_district_from_name($this->get_district()))
                        );
                }
                

Modified: trunk/activitycalendar/setup/phpgw_no.lang
===================================================================
--- trunk/activitycalendar/setup/phpgw_no.lang  2011-07-06 12:47:07 UTC (rev 
7475)
+++ trunk/activitycalendar/setup/phpgw_no.lang  2011-07-15 09:57:55 UTC (rev 
7476)
@@ -382,4 +382,7 @@
 address_number activitycalendar        no      Nummer
 changed_organizations_groups   activitycalendar        no      Endrede 
organisasjoner/grupper
 changed_org_group      activitycalendar        no      Endringer
-building       activitycalendar        no      Kommunale bygg
\ No newline at end of file
+building       activitycalendar        no      Kommunale bygg
+Download as excel      activitycalendar        no      Last ned i Excel-format
+arena_name     activitycalendar        no      Navn
+Send mail to selection activitycalendar        no      Send E-post til utvalg
\ No newline at end of file

Modified: trunk/activitycalendar/templates/base/activity_list_partial.php
===================================================================
--- trunk/activitycalendar/templates/base/activity_list_partial.php     
2011-07-06 12:47:07 UTC (rev 7475)
+++ trunk/activitycalendar/templates/base/activity_list_partial.php     
2011-07-15 09:57:55 UTC (rev 7476)
@@ -130,6 +130,8 @@
     function activity_export(ptype) {
 
         var query = document.getElementById('<?php echo $list_id 
?>_ctrl_search_query').value;
+        var office = document.getElementById('<?php echo $list_id 
?>_ctrl_toggle_activity_state').value;
+        var state = document.getElementById('<?php echo $list_id 
?>_ctrl_toggle_activity_district').value;
         <?php
         /* FIXME Search queries will affect ALL data tables listed on one page 
(of that type) when exporting
          * even though the search only affects one of the data tables.
@@ -140,14 +142,37 @@
         window.location = 
'index.php?menuaction=activitycalendar.uiactivities.download'+
             '<?php echo $url_add_on; ?>'+
             '&amp;query='+query+
-            '&amp;search_option='+sOption+
+            '&amp;activity_district='+office+
+            '&amp;activity_state='+state+
                '&amp;export=true';
     }
 
+    function activity_email(ptype) {
+
+        var query = document.getElementById('<?php echo $list_id 
?>_ctrl_search_query').value;
+        var office = document.getElementById('<?php echo $list_id 
?>_ctrl_toggle_activity_state').value;
+        var state = document.getElementById('<?php echo $list_id 
?>_ctrl_toggle_activity_district').value;
+        <?php
+        /* FIXME Search queries will affect ALL data tables listed on one page 
(of that type) when exporting
+         * even though the search only affects one of the data tables.
+         * F.ex on /index.php?menuaction=rental.uicontract.edit&id=1 -> Parties
+         */
+        ?>
+        
+        window.location = 
'index.php?menuaction=activitycalendar.uiactivities.query'+
+            '<?php echo $url_add_on; ?>'+
+            '&amp;query='+query+
+            '&amp;activity_district='+office+
+            '&amp;activity_state='+state+
+               '&amp;email=true';
+    }
+
 </script>
 <?php
        if($list_form)
        {
+               $uid = $GLOBALS['phpgw_info']['user']['account_id'];
+               $user_office =  
activitycalendar_soactivity::get_instance()->get_office_from_user($uid);
 ?>
 
 <form id="<?php echo $list_id ?>_form" method="GET">
@@ -161,12 +186,6 @@
 
        <fieldset>
                <!-- Filters -->
-<!--   <label class="toolbar_element_label" 
for="ctrl_toggle_activity_type"><?php //echo lang('activity_type') ?></label>
-               <select name="activity_type" id="<?php //echo $list_id 
?>_ctrl_toggle_activity_type">
-                       <option value="all"><?php //echo lang('all') ?></option>
-                       <option value="1"><?php //echo lang('internal') 
?></option>
-                       <option value="2" ><?php //echo lang('not_internal') 
?></option>
-               </select> -->
                <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>
@@ -185,7 +204,7 @@
                        <?php
                        foreach($districts as $district)
                        {
-                               echo "<option 
value=\"{$district['id']}\">".$district['name']."</option>";
+                               echo "<option value=\"{$district['id']}\"". 
($user_office == $district['id']? 'selected':'') . 
">".$district['name']."</option>";
                        }
                        ?>
                </select>
@@ -197,5 +216,15 @@
        }
 ?>
 
+<fieldset>
+       <h3><?php echo lang('export_to') ?></h3>
+       <?php 
+       $export_format = 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['export_format'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['export_format'] 
? $GLOBALS['phpgw_info']['user']['preferences']['property']['export_format'] : 
'csv';
+       ?>
+       <div id="export">
+               <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>&nbsp;&nbsp;<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>
+
 <div id="<?php echo $list_id ?>_paginator" class="paginator"></div>
 <div id="<?php echo $list_id ?>_container" class="datatable_container"></div>

Modified: trunk/activitycalendar/templates/base/arena_list_partial.php
===================================================================
--- trunk/activitycalendar/templates/base/arena_list_partial.php        
2011-07-06 12:47:07 UTC (rev 7475)
+++ trunk/activitycalendar/templates/base/arena_list_partial.php        
2011-07-15 09:57:55 UTC (rev 7476)
@@ -80,6 +80,8 @@
     function arena_export(ptype) {
 
         var query = document.getElementById('<?php echo $list_id 
?>_ctrl_search_query').value;
+        var aType = document.getElementById('<?php echo $list_id 
?>_ctrl_toggle_arena_type').value;
+        var active = document.getElementById('<?php echo $list_id 
?>_ctrl_toggle_active').value;
         <?php
         /* FIXME Search queries will affect ALL data tables listed on one page 
(of that type) when exporting
          * even though the search only affects one of the data tables.
@@ -90,7 +92,8 @@
         window.location = 
'index.php?menuaction=activitycalendar.uiarena.download'+
             '<?php echo $url_add_on; ?>'+
             '&amp;query='+query+
-            '&amp;search_option='+sOption+
+            '&amp;arena_type='+aType+
+            '&amp;active='+active+
                '&amp;export=true';
     }
 
@@ -136,9 +139,7 @@
        $export_format = 
isset($GLOBALS['phpgw_info']['user']['preferences']['property']['export_format'])
 && $GLOBALS['phpgw_info']['user']['preferences']['property']['export_format'] 
? $GLOBALS['phpgw_info']['user']['preferences']['property']['export_format'] : 
'csv';
        ?>
        <div id="export">
-               <a href="javascript:arena_export('<?php echo $list_id ?>')" 
title="<?php echo lang('Download as %1', $export_format) ?>"><img src="<?php 
echo RENTAL_TEMPLATE_PATH 
?>images/16x16/mimetypes/x-office-spreadsheet.png"/></a>
-               &amp;nbsp;&amp;nbsp;
-               <a href="index.php?menuaction=rental.uiarena.download_agresso" 
title="<?php echo lang('Download Agresso import file') ?>"><img src="<?php echo 
RENTAL_TEMPLATE_PATH ?>images/16x16/mimetypes/x-office-document.png"/></a>
+               <a href="javascript:arena_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>
        </div>
 </fieldset>
 

Added: trunk/activitycalendar/templates/base/organization_list_changed.php
===================================================================
--- trunk/activitycalendar/templates/base/organization_list_changed.php         
                (rev 0)
+++ trunk/activitycalendar/templates/base/organization_list_changed.php 
2011-07-15 09:57:55 UTC (rev 7476)
@@ -0,0 +1,24 @@
+<?php
+       include("common.php");
+?>
+
+<h1><img src="<?php echo ACTIVITYCALENDAR_IMAGE_PATH 
?>images/32x32/x-office-address-book.png" /> <?php echo 
lang('changed_organizations_groups') ?></h1>
+
+<h2><?php echo lang('organization')?></h2>
+<?php
+       $list_form = true;
+       $list_id = 'changed_organizations';
+       $url_add_on = '&amp;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 = '&amp;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');
+?>
\ No newline at end of file

Modified: trunk/activitycalendar/templates/base/organization_list_partial.php
===================================================================
--- trunk/activitycalendar/templates/base/organization_list_partial.php 
2011-07-06 12:47:07 UTC (rev 7475)
+++ trunk/activitycalendar/templates/base/organization_list_partial.php 
2011-07-15 09:57:55 UTC (rev 7476)
@@ -27,6 +27,11 @@
            sortable: true
        },
        {
+               key: "office",
+               label: "<?php echo lang('office') ?>",
+           sortable: true
+       },
+       {
                key: "description",
                label: "<?php echo lang('description') ?>",
            sortable: true




reply via email to

[Prev in Thread] Current Thread [Next in Thread]