fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8144]


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [8144]
Date: Mon, 21 Nov 2011 09:23:15 +0000

Revision: 8144
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8144
Author:   erikhl
Date:     2011-11-21 09:23:14 +0000 (Mon, 21 Nov 2011)
Log Message:
-----------


Modified Paths:
--------------
    trunk/activitycalendar/inc/class.sogroup.inc.php
    trunk/activitycalendar/inc/class.soorganization.inc.php
    trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php
    trunk/activitycalendarfrontend/templates/base/activity.php

Modified: trunk/activitycalendar/inc/class.sogroup.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.sogroup.inc.php    2011-11-21 08:49:43 UTC 
(rev 8143)
+++ trunk/activitycalendar/inc/class.sogroup.inc.php    2011-11-21 09:23:14 UTC 
(rev 8144)
@@ -239,6 +239,27 @@
                return $contacts;
        }
        
+       function get_contacts_as_objects($group_id)
+       {
+               $contacts = array();
+       if(isset($group_id)){
+               $q1="SELECT * FROM bb_group_contact WHERE group_id={$group_id}";
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $contact_person = new 
activitycalendar_contact_person((int) $this->db->f('id'));
+                               
$contact_person->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                               
$contact_person->set_group_id($this->unmarshal($this->db->f('group_id'), 
'int'));
+                               
$contact_person->set_name($this->unmarshal($this->db->f('name'), 'string'));
+                               
$contact_person->set_phone($this->unmarshal($this->db->f('phone'), 'string'));
+                               
$contact_person->set_email($this->unmarshal($this->db->f('email'), 'string'));
+                               $contacts[] = $contact_person;
+                       }
+                       //$result = $contacts;
+       }
+               
+               return $contacts;
+       }
+       
        function get_contacts_local($group_id)
        {
                $contacts = array();
@@ -254,6 +275,27 @@
                return $contacts;
        }
        
+       function get_contacts_local_as_objects($group_id)
+       {
+               $contacts = array();
+       if(isset($group_id)){
+               $q1="SELECT * FROM activity_contact_person WHERE 
group_id='{$group_id}'";
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $contact_person = new 
activitycalendar_contact_person((int) $this->db->f('id'));
+                               
$contact_person->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                               
$contact_person->set_group_id($this->unmarshal($this->db->f('group_id'), 
'int'));
+                               
$contact_person->set_name($this->unmarshal($this->db->f('name'), 'string'));
+                               
$contact_person->set_phone($this->unmarshal($this->db->f('phone'), 'string'));
+                               
$contact_person->set_email($this->unmarshal($this->db->f('email'), 'string'));
+                               $contacts[] = $contact_person;
+                       }
+                       //$result = $contacts;
+       }
+               
+               return $contacts;
+       }
+       
        function get_description($group_id)
        {
        if(isset($group_id)){

Modified: trunk/activitycalendar/inc/class.soorganization.inc.php
===================================================================
--- trunk/activitycalendar/inc/class.soorganization.inc.php     2011-11-21 
08:49:43 UTC (rev 8143)
+++ trunk/activitycalendar/inc/class.soorganization.inc.php     2011-11-21 
09:23:14 UTC (rev 8144)
@@ -281,6 +281,26 @@
                return $contacts;
        }
        
+       function get_contacts_local_as_objects($organization_id)
+       {
+               $contacts = array();
+       if(isset($organization_id)){
+               $q1="SELECT * FROM activity_contact_person WHERE 
organization_id='{$organization_id}'";
+               //var_dump($q1);
+                       $this->db->query($q1, __LINE__, __FILE__);
+                       while($this->db->next_record()){
+                               $contact_person = new 
activitycalendar_contact_person((int) $this->db->f('id'));
+                               
$contact_person->set_organization_id($this->unmarshal($this->db->f('organization_id'),
 'int'));
+                               
$contact_person->set_group_id($this->unmarshal($this->db->f('group_id'), 
'int'));
+                               
$contact_person->set_name($this->unmarshal($this->db->f('name'), 'string'));
+                               
$contact_person->set_phone($this->unmarshal($this->db->f('phone'), 'string'));
+                               
$contact_person->set_email($this->unmarshal($this->db->f('email'), 'string'));
+                               $contacts[] = $contact_person;
+                       }
+       }
+               return $contacts;
+       }
+       
        function get_description($organization_id)
        {
        if(isset($organization_id)){
@@ -536,26 +556,12 @@
        
        function get_organization_local($org_id)
        {
-               $columns[] = 'org.id';
-               $columns[] = 'org.name';
-               $columns[] = 'org.homepage';
-               $columns[] = 'org.phone';
-               $columns[] = 'org.email';
-               $columns[] = 'org.description';
-               $columns[] = 'org.address';
-               $columns[] = 'org.district';
-               $columns[] = 'org.change_type';
-               $columns[] = 'org.transferred';
-               $columns[] = 'org.orgno AS organization_number';
-                               
-               $cols = implode(',',$columns);  
-               $table = "activity_organization org";
-               
-               $sql = "SELECT ${cols} FROM {$table} WHERE org.id={$org_id}";
-               $result = $this->db->query($sql, __LINE__, __FILE__);
-               if(isset($result))
+               $sql = "SELECT * FROM activity_organization WHERE id={$org_id}";
+               //var_dump($sql);
+               $this->db->query($sql, __LINE__, __FILE__);
+               while($this->db->next_record())
                {
-                       $organization = new activitycalendar_organization((int) 
$org_id);
+                       $organization = new activitycalendar_organization((int) 
$this->db->f('id'));
        
                        
$organization->set_name($this->unmarshal($this->db->f('name'), 'string'));
                        
$organization->set_organization_number($this->unmarshal($this->db->f('organization_number'),
 'int'));

Modified: trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php
===================================================================
--- trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php 2011-11-21 
08:49:43 UTC (rev 8143)
+++ trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php 2011-11-21 
09:23:14 UTC (rev 8144)
@@ -156,9 +156,17 @@
                                        $contact2['group_id'] = 0;
                                        
$this->so_activity->add_contact_person_local($contact2);
                                        
-                                       $persons = 
$this->so_organization->get_contacts_local($o_id);
+                                       //$persons = 
$this->so_organization->get_contacts_local_as_objects($o_id);
+                                       //var_dump($persons);
+                                       $person_arr = 
$this->so_contact->get_local_contact_persons($o_id);
+                                       foreach($person_arr as $p)
+                                       {
+                                               //var_dump($p);
+                                               $persons[] = $p;
+                                       }
                                        $desc = 
phpgw::get_var('org_description');
                                        $organization = 
$this->so_organization->get_organization_local($o_id);
+                                       //var_dump($organization);
                                }
                                else if(is_numeric($o_id) && $o_id > 0)
                                {
@@ -187,20 +195,38 @@
                                                $contact2['group_id'] = $g_id;
                                                
$this->so_activity->add_contact_person_local($contact2);
                                                
-                                               $persons = 
$this->so_group->get_contacts_local($g_id);
+                                               //$persons = 
$this->so_group->get_contacts_local_as_objects($g_id);
+                                               $person_arr = 
$this->so_contact->get_local_contact_persons($g_id, true);
+                                               foreach($person_arr as $p)
+                                               {
+                                                       //var_dump($p);
+                                                       $persons[] = $p;
+                                               }
                                                $desc = 
phpgw::get_var('group_description');
                                                $group = 
$this->so_group>get_group_local($g_id);
                                        }
                                        else if(isset($g_id) && 
is_numeric($g_id) && $g_id > 0)
                                        {
-                                               $persons = 
$this->so_group->get_contacts($g_id);
+                                               //$persons = 
$this->so_group->get_contacts_as_objects($g_id);
+                                               $person_arr = 
$this->so_contact->get_local_contact_persons($g_id, true);
+                                               foreach($person_arr as $p)
+                                               {
+                                                       //var_dump($p);
+                                                       $persons[] = $p;
+                                               }
                                                $desc = 
$this->so_group->get_description($g_id);
                                                $organization = 
$this->so_organization->get_single($o_id);
                                                $group = 
$this->so_group->get_single($g_id);
                                        }
                                        else if(isset($o_id) && 
is_numeric($o_id) && $o_id > 0)
                                        {
-                                               $persons = 
$this->so_organization->get_contacts($o_id);
+                                               //$persons = 
$this->so_organization->get_contacts_as_objects($o_id);
+                                               $person_arr = 
$this->so_contact->get_local_contact_persons($o_id);
+                                               foreach($person_arr as $p)
+                                               {
+                                                       //var_dump($p);
+                                                       $persons[] = $p;
+                                               }
                                                $desc = 
$this->so_organization->get_description($o_id);
                                                $organization = 
$this->so_organization->get_single($o_id);
                                        }

Modified: trunk/activitycalendarfrontend/templates/base/activity.php
===================================================================
--- trunk/activitycalendarfrontend/templates/base/activity.php  2011-11-21 
08:49:43 UTC (rev 8143)
+++ trunk/activitycalendarfrontend/templates/base/activity.php  2011-11-21 
09:23:14 UTC (rev 8144)
@@ -22,6 +22,7 @@
                <form action="#" method="post">
                        <input type="hidden" name="id" value="<?php 
if($activity->get_id()){ echo $activity->get_id(); } else { echo '0'; }  ?>"/>
                        <dl class="proplist-col" style="width: 60%">
+                               <h2><?php echo lang('what')?></h2>
                                <dt>
                                        <label for="title"><?php echo 
lang('title') ?></label>
                                </dt>
@@ -29,26 +30,61 @@
                                        <?php echo $activity->get_title();?>
                                </dd>
                                <dt>
-                                       <label for="organization_id"><?php echo 
lang('organization') ?></label>
+                                       <label for="description"><?php echo 
lang('description') ?></label>
                                </dt>
                                <dd>
+                                       <?php echo 
$activity->get_description(); ?>
+                               </dd>
+                               
+                               <dt>
+                                       <label for="category"><?php echo 
lang('category') ?></label>
+                               </dt>
+                               <dd>
                                        <?php
-                                       if($activity->get_organization_id()){
-                                               echo 
activitycalendar_soorganization::get_instance()->get_organization_name($activity->get_organization_id());
-                                       }
+                                               if($activity->get_category()){
+                                                       echo 
$act_so->get_category_name($activity->get_category());
+                                               }
                                        ?>
                                </dd>
                                <dt>
-                                       <label for="group_id" 
id="group_label"><?php echo lang('group') ?></label>
+                                       <label for="target"><?php echo 
lang('target') ?></label>
                                </dt>
                                <dd>
-                                       <?php 
-                                       if($activity->get_group_id()){
-                                               echo 
activitycalendar_sogroup::get_instance()->get_group_name($activity->get_group_id());
+                                       <?php
+                                               if($activity->get_target()){
+                                                       $current_target_ids = 
$activity->get_target();
+                                                       
$current_target_id_array=explode(",", $current_target_ids);
+                                                       
foreach($current_target_id_array as $curr_target)
+                                                       {
+                                                               echo 
$act_so->get_target_name($curr_target).'<br/>';
+                                                       }
+                                               }
+                                       ?>
+                               </dd>
+                               <dt>
+                                       <label for="district"><?php echo 
lang('district') ?></label>
+                               </dt>
+                               <dd>
+                                       <?php
+                                       if($activity->get_district()){
+                                               $current_district_ids = 
$activity->get_district();
+                                               
$current_district_id_array=explode(",", $current_district_ids);
+                                               
foreach($current_district_id_array as $curr_district)
+                                               {
+                                                       echo 
$act_so->get_district_name($curr_district).'<br/>';
+                                               }
                                        }
                                        ?>
                                </dd>
                                <dt>
+                                       <label for="special_adaptation"><?php 
echo lang('special_adaptation') ?></label>
+                               </dt>
+                               <dd>
+                                       <input type="checkbox" 
name="special_adaptation" id="special_adaptation"<?php echo 
$activity->get_special_adaptation() ? ' checked="checked"' : '' ?> 
disabled="disabled" />
+                               </dd>
+                               <hr />
+                               <h2><?php echo lang('where_when')?></h2>
+                               <dt>
                                        <?php 
if($activity->get_internal_arena()) { ?>
                                        <label for="arena"><?php echo 
lang('building') ?></label>
                                        <?php }?>
@@ -72,34 +108,13 @@
                                                }
                                        ?>
                                </dd>
-                       </dl>
-                       <dl class="proplist-col">
                                <dt>
-                                       <label for="category"><?php echo 
lang('category') ?></label>
+                                       <label for="time"><?php echo 
lang('time') ?></label>
                                </dt>
                                <dd>
-                                       <?php
-                                               if($activity->get_category()){
-                                                       echo 
$act_so->get_category_name($activity->get_category());
-                                               }
-                                       ?>
+                                       <?php echo $activity->get_time();?>
                                </dd>
                                <dt>
-                                       <label for="target"><?php echo 
lang('target') ?></label>
-                               </dt>
-                               <dd>
-                                       <?php
-                                               if($activity->get_target()){
-                                                       $current_target_ids = 
$activity->get_target();
-                                                       
$current_target_id_array=explode(",", $current_target_ids);
-                                                       
foreach($current_target_id_array as $curr_target)
-                                                       {
-                                                               echo 
$act_so->get_target_name($curr_target).'<br/>';
-                                                       }
-                                               }
-                                       ?>
-                               </dd>
-                               <dt>
                                        <label for="office"><?php echo 
lang('office') ?></label>
                                </dt>
                                <dd>
@@ -109,49 +124,36 @@
                                                }
                                        ?>
                                </dd>
+                               <hr />
+                               <h2><?php echo lang('who')?></h2>
                                <dt>
-                                       <label for="district"><?php echo 
lang('district') ?></label>
+                                       <label for="organization_id"><?php echo 
lang('organization') ?></label>
                                </dt>
                                <dd>
-                                       <?php
-                                       if($activity->get_district()){
-                                               $current_district_ids = 
$activity->get_district();
-                                               
$current_district_id_array=explode(",", $current_district_ids);
-                                               
foreach($current_district_id_array as $curr_district)
-                                               {
-                                                       echo 
$act_so->get_district_name($curr_district).'<br/>';
-                                               }
-                                       }
-                                       ?>
+                                       <?php echo $organization->get_name();?>
                                </dd>
                                <dt>
-                                       <label for="description"><?php echo 
lang('description') ?></label>
+                                       <label for="group_id" 
id="group_label"><?php echo lang('group') ?></label>
                                </dt>
                                <dd>
-                                       <?php echo 
$activity->get_description(); ?>
+                                       <?php 
+                                       if($activity->get_group_id()){
+                                               echo $group->get_name();
+                                       }
+                                       ?>
                                </dd>
                                <dt>
-                                       <label for="time"><?php echo 
lang('time') ?></label>
-                               </dt>
-                               <dd>
-                                       <?php echo $activity->get_time();?>
-                               </dd>
-                               <dt>
                                        <?php 
if($activity->get_contact_person_1()) { ?>
                                        <label for="contact_person_1"><?php 
echo lang('contact_person_1') ?></label>
                                        <?php  } ?>
                                </dt>
                                <dd>
-                                       <?php
-                                               if($activity->get_group_id())
-                                               {
-                                                       echo 
$contpers_so->get_group_contact_name($activity->get_contact_person_1());
-                                               }
-                                               else 
if($activity->get_organization_id())
-                                               {
-                                                       echo 
$contpers_so->get_org_contact_name($activity->get_contact_person_1());
-                                               }
-                                       ?>
+                                       <label for="contact1_name">Navn</label>
+                                       <?php echo 
isset($contact1)?$contact1->get_name():''?><br/>
+                                       <label 
for="contact1_phone">Telefon</label>
+                                       <?php echo 
isset($contact1)?$contact1->get_phone():''?><br/>
+                                       <label 
for="contact1_mail">E-post</label>
+                                       <?php echo 
isset($contact1)?$contact1->get_email():''?><br/>
                                </dd>
                                <dt>
                                        <?php 
if($activity->get_contact_person_2()) { ?>
@@ -159,23 +161,14 @@
                                        <?php  } ?>
                                </dt>
                                <dd>
-                                       <?php
-                                               if($activity->get_group_id())
-                                               {
-                                                       echo 
$contpers_so->get_group_contact_name($activity->get_contact_person_2());
-                                               }
-                                               else 
if($activity->get_organization_id())
-                                               {
-                                                       echo 
$contpers_so->get_org_contact_name($activity->get_contact_person_2());
-                                               }
-                                       ?>
+                                       <label for="contact2_name">Navn</label>
+                                       <?php echo 
isset($contact2)?$contact2->get_name():''?><br/>
+                                       <label 
for="contact2_phone">Telefon</label>
+                                       <?php echo 
isset($contact2)?$contact2->get_phone():''?><br/>
+                                       <label 
for="contact2_mail">E-post</label>
+                                       <?php echo 
isset($contact2)?$contact2->get_email():''?><br/>
                                </dd>
-                           <dt>
-                                       <label for="special_adaptation"><?php 
echo lang('special_adaptation') ?></label>
-                               </dt>
-                               <dd>
-                                       <input type="checkbox" 
name="special_adaptation" id="special_adaptation"<?php echo 
$activity->get_special_adaptation() ? ' checked="checked"' : '' ?> 
disabled="disabled" />
-                               </dd>
+                           
                        </dl>
                        <div class="form-buttons">
                                <?php




reply via email to

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