fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [8145]


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [8145]
Date: Mon, 21 Nov 2011 11:52:29 +0000

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


Modified Paths:
--------------
    trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php
    trunk/activitycalendarfrontend/templates/base/activity_edit.php

Modified: trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php
===================================================================
--- trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php 2011-11-21 
09:23:14 UTC (rev 8144)
+++ trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php 2011-11-21 
11:52:28 UTC (rev 8145)
@@ -362,17 +362,12 @@
 
                        $id = intval(phpgw::get_var('id', 'GET'));
 
-                       $so_activity = 
activitycalendar_soactivity::get_instance();
-                       $so_arena = activitycalendar_soarena::get_instance();
-
-                       $categories = $so_activity->get_categories();
-                       $targets = $so_activity->get_targets();
-                       $offices = $so_activity->select_district_list();
-                       $districts = $so_activity->get_districts();
-                       $buildings = $so_arena->get_buildings();
-                       $arenas = $so_arena->get(null, null, 
'arena.arena_name', true, null, null, null);
-                       $organizations = 
activitycalendar_soorganization::get_instance()->get(null, null, 'org.name', 
true, null, null, null);
-                       $groups = 
activitycalendar_sogroup::get_instance()->get(null, null, null, null, null, 
null, null);
+                       $categories = $this->so_activity->get_categories();
+                       $targets = $this->so_activity->get_targets();
+                       $offices = $this->so_activity->select_district_list();
+                       $districts = $this->so_activity->get_districts();
+                       $buildings = $this->so_arena->get_buildings();
+                       $arenas = $this->so_arena->get(null, null, 
'arena.arena_name', true, null, null, null);
                        
                        if(isset($_POST['step_1'])) //change_request
                        {
@@ -381,7 +376,7 @@
                                
                                //store update-request
                                $activity->set_state(2);
-                               if($so_activity->store($activity))
+                               if($this->so_activity->store($activity))
                                {
                                        $message = lang('update_request_sent', 
$activity->get_title());
                                        return 
$this->render('activity_edit_step_1.php', array
@@ -405,7 +400,7 @@
                                                )       
                                        );
                                }
-                               if(isset($secret_param) && $secret_param != ''){
+                               if(!isset($secret_param) || $secret_param == 
''){
                                        //select activity to edit
                                        $activities = 
$this->so_activity->get(null, null, 'title', true, null, null, 
array('activity_state' => 3));
                                        return 
$this->render('activity_edit_step_1.php', array
@@ -419,155 +414,50 @@
                                        // Retrieve the activity object or 
create a new one
                                        if(isset($id) && $id > 0)
                                        {       
-                                               $activity = 
$so_activity->get_single($id); 
+                                               $activity = 
$this->so_activity->get_single($id); 
                                        }
                                        else
                                        {
-                                               
$this->redirect(array('menuaction' => 'bookingfrontend.uisearch.index'));
+                                               $activities = 
$this->so_activity->get(null, null, 'title', true, null, null, 
array('activity_state' => 3));
+                                               return 
$this->render('activity_edit_step_1.php', array
+                                                       (
+                                                               'activities' => 
$activities
+                                                       )       
+                                               );
                                        }
                                        
                                        if($activity->get_secret() != 
phpgw::get_var('secret', 'GET'))
                                        {
-                                               
$this->redirect(array('menuaction' => 'bookingfrontend.uisearch.index'));
+                                               //select activity to edit
+                                               $activities = 
$this->so_activity->get(null, null, 'title', true, null, null, 
array('activity_state' => 3));
+                                               return 
$this->render('activity_edit_step_1.php', array
+                                                       (
+                                                               'activities' => 
$activities
+                                                       )       
+                                               );
                                        }
                                        
-                                       $g_id = phpgw::get_var('group_id');
-                                       $o_id = 
phpgw::get_var('organization_id');
-                                       if(isset($g_id) && is_numeric($g_id) && 
$g_id > 0)
+                                       if($activity->get_group_id())
                                        {
-                                               $persons = 
activitycalendar_sogroup::get_instance()->get_contacts($g_id);
-                                               $desc = 
activitycalendar_sogroup::get_instance()->get_description($g_id);
+                                               /*$person_arr = 
$this->so_contact->get_booking_contact_persons($activity->get_group_id(), true);
+                                               foreach($person_arr as $p)
+                                               {
+                                                       $persons[] = $p;
+                                               }*/
+                                               $desc = 
$this->so_group->get_description($activity->get_group_id());
+                                               $group = 
$this->so_group->get_single($activity->get_group_id());
                                        }
-                                       else if(isset($o_id))
+                                       else 
if($activity->get_organization_id())
                                        {
-                                               if($o_id == "new_org")
+                                               /*$person_arr = 
$this->so_contact->get_booking_contact_persons($activity->get_organization_id());
+                                               foreach($person_arr as $p)
                                                {
-                                                       
$activity->set_new_org(true);
-                                                       //add new organization 
to internal activitycalendar organization register
-                                                       $org_info['name'] = 
phpgw::get_var('orgname');
-                                                       $org_info['orgnr'] = 
phpgw::get_var('orgno');
-                                                       $org_info['homepage'] = 
phpgw::get_var('homepage');
-                                                       $org_info['phone'] = 
phpgw::get_var('phone');
-                                                       $org_info['email'] = 
phpgw::get_var('email');
-                                                       
$org_info['description'] = phpgw::get_var('org_description');
-                                                       $org_info['street'] = 
phpgw::get_var('address') . ' ' . phpgw::get_var('number') . ', ' . 
phpgw::get_var('postaddress');
-                                                       //$org_info['zip'] = 
phpgw::get_var('postaddress');
-                                                       $org_info['district'] = 
phpgw::get_var('org_district'); 
-                                                       $org_info['status'] = 
"new";
-                                                       $o_id = 
$so_activity->add_organization_local($org_info);
-                                                       
-                                                       //add contact persons
-                                                       $contact1 = array();
-                                                       $contact1['name'] = 
phpgw::get_var('contact1_name');
-                                                       $contact1['phone'] = 
phpgw::get_var('contact1_phone');
-                                                       $contact1['mail'] = 
phpgw::get_var('contact1_email');
-                                                       $contact1['org_id'] = 
$o_id;
-                                                       $contact1['group_id'] = 
0;
-                                                       
$so_activity->add_contact_person_local($contact1);
-                                                       
-                                                       $contact2 = array();
-                                                       $contact2['name'] = 
phpgw::get_var('contact2_name');
-                                                       $contact2['phone'] = 
phpgw::get_var('contact2_phone');
-                                                       $contact2['mail'] = 
phpgw::get_var('contact2_email');
-                                                       $contact2['org_id'] = 
$o_id;
-                                                       $contact2['group_id'] = 
0;
-                                                       
$so_activity->add_contact_person_local($contact2);
-                                                       
-                                                       $persons = 
activitycalendar_soorganization::get_instance()->get_contacts_local($o_id);
-                                                       $desc = 
phpgw::get_var('org_description');
-               
-                                               }
-                                               else if($o_id == "change_org")
-                                               {
-                                                       $change_org_id = 
phpgw::get_var('change_organization_id');
-                                                       $organization = 
activitycalendar_soorganization::get_instance()->get_single($change_org_id);
-                                               
-                                                       $org_info['name'] = 
$organization->get_name();
-                                                       $org_info['orgnr'] = 
$organization->get_organization_number();
-                                                       $org_info['homepage'] = 
$organization->get_homepage();
-                                                       $org_info['phone'] = 
$organization->get_phone();
-                                                       $org_info['email'] = 
$organization->get_email();
-                                                       
$org_info['description'] = $organization->get_description();
-                                                       $org_info['street'] = 
$organization->get_address();
-                                                       $org_info['district'] = 
$organization->get_district(); 
-                                                       $org_info['status'] = 
"change";
-                                                       $o_id = 
$so_activity->add_organization_local($org_info);
-                                                       
-                                                       //add contact persons
-                                                       $contact1 = array();
-                                                       $contact1['name'] = 
phpgw::get_var('contact1_name');
-                                                       $contact1['phone'] = 
phpgw::get_var('contact1_phone');
-                                                       $contact1['mail'] = 
phpgw::get_var('contact1_email');
-                                                       $contact1['org_id'] = 
$o_id;
-                                                       $contact1['group_id'] = 
0;
-                                                       
$so_activity->add_contact_person_local($contact1);
-                                                       
-                                                       $contact2 = array();
-                                                       $contact2['name'] = 
phpgw::get_var('contact2_name');
-                                                       $contact2['phone'] = 
phpgw::get_var('contact2_phone');
-                                                       $contact2['mail'] = 
phpgw::get_var('contact2_email');
-                                                       $contact2['org_id'] = 
$o_id;
-                                                       $contact2['group_id'] = 
0;
-                                                       
$so_activity->add_contact_person_local($contact2);
-                                                       
-                                                       $message = 
lang('change_request_ok', $organization->get_name());
-                                                       
-                                                       
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
-               
-                                                       
$this->render('activity_edit.php', array
-                                                               (
-                                                                       
'activity'      => $activity,
-                                                                       
'organizations' => $organizations,
-                                                                       
'groups' => $groups,
-                                                                       
'arenas' => $arenas,
-                                                                       
'buildings' => $buildings,
-                                                                       
'categories' => $categories,
-                                                                       
'targets' => $targets,
-                                                                       
'districts' => $districts,
-                                                                       
'offices' => $offices,
-                                                                       
'editable' => true,
-                                                                       
'message' => isset($message) ? $message : phpgw::get_var('message'),
-                                                                       'error' 
=> isset($error) ? $error : phpgw::get_var('error')
-                                                               )
-                                       );
-                                               }
-                                               else if(is_numeric($o_id) && 
$o_id > 0)
-                                               {
-                                                       if(isset($g_id) && 
$g_id == "new_group")
-                                                       {
-                                                               
$group_info['name'] = phpgw::get_var('groupname');
-                                                               
$group_info['organization_id'] = $o_id;
-                                                               
$group_info['description'] = phpgw::get_var('group_description');
-                                                               
$group_info['status'] = "new";
-                                                               $g_id = 
$so_activity->add_group_local($group_info);
-                                                               
-                                                               //add contact 
persons
-                                                               $contact1 = 
array();
-                                                               
$contact1['name'] = phpgw::get_var('contact1_name');
-                                                               
$contact1['phone'] = phpgw::get_var('contact1_phone');
-                                                               
$contact1['mail'] = phpgw::get_var('contact1_email');
-                                                               
$contact1['org_id'] = 0;
-                                                               
$contact1['group_id'] = $g_id;
-                                                               
$so_activity->add_contact_person_local($contact1);
-                                                               
-                                                               $contact2 = 
array();
-                                                               
$contact2['name'] = phpgw::get_var('contact2_name');
-                                                               
$contact2['phone'] = phpgw::get_var('contact2_phone');
-                                                               
$contact2['mail'] = phpgw::get_var('contact2_email');
-                                                               
$contact2['org_id'] = 0;
-                                                               
$contact2['group_id'] = $g_id;
-                                                               
$so_activity->add_contact_person_local($contact2);
-                                                               
-                                                               
$activity_persons = 
activitycalendar_sogroup::get_instance()->get_contacts_local($g_id);
-                                                               $desc = 
phpgw::get_var('group_description');
-                                                       }
-                                                       else
-                                                       {
-                                                               $persons = 
activitycalendar_soorganization::get_instance()->get_contacts($o_id);
-                                                               $desc = 
activitycalendar_soorganization::get_instance()->get_description($o_id);
-                                                       }
-                                               }
+                                                       $persons[] = $p;
+                                               }*/
+                                               $desc = 
$this->so_organization->get_description($activity->get_organization_id());
                                        }
+                                       $organization = 
$this->so_organization->get_single($activity->get_organization_id());
+                                       
var_dump($activity->get_organization_id());
                                        
                                        if(isset($_POST['save_activity'])) // 
The user has pressed the save button
                                        {
@@ -578,8 +468,6 @@
                                                        $new_state = 
phpgw::get_var('state');
                                                        // ... set all 
parameters
                                                        
$activity->set_title(phpgw::get_var('title'));
-                                                       
$activity->set_organization_id($o_id);
-                                                       
$activity->set_group_id($g_id);
                                                        
$activity->set_arena(phpgw::get_var('arena_id'));
                                                        
$activity->set_internal_arena(phpgw::get_var('internal_arena_id'));
                                                        $district_array = 
phpgw::get_var('district');
@@ -609,7 +497,7 @@
                                                        if($target_ok && 
$district_ok)
                                                        {
                                                                
-                                                               
if($so_activity->store($activity)) // ... and then try to store the object
+                                                               
if($this->so_activity->store($activity)) // ... and then try to store the object
                                                                {
                                                                        
$message = lang('messages_saved_form'); 
                                                                }
@@ -623,8 +511,8 @@
                                                                
$this->render('activity.php', array
                                                                                
        (
                                                                                
                'activity'      => $activity,
-                                                                               
                'organizations' => $organizations,
-                                                                               
                'groups' => $groups,
+                                                                               
                'organization' => $organization,
+                                                                               
                'group' => $group,
                                                                                
                'arenas' => $arenas,
                                                                                
                'buildings' => $buildings,
                                                                                
                'categories' => $categories,
@@ -649,9 +537,9 @@
                                                                return 
$this->render('activity_edit.php', array
                                                                        (
                                                                                
'activity'      => $activity,
-                                                                               
'organizations' => $organizations,
+                                                                               
'organization' => $organization,
                                                                                
'org_name' => $org_name,
-                                                                               
'groups' => $groups,
+                                                                               
'group' => $group,
                                                                                
'arenas' => $arenas,
                                                                                
'buildings' => $buildings,
                                                                                
'categories' => $categories,
@@ -667,25 +555,27 @@
                                                        }
                                                }
                                        }
-                                       
-                                       
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
-               
-                                       $this->render('activity_edit.php', array
-                                                               (
-                                                                       
'activity'      => $activity,
-                                                                       
'organizations' => $organizations,
-                                                                       
'groups' => $groups,
-                                                                       
'arenas' => $arenas,
-                                                                       
'buildings' => $buildings,
-                                                                       
'categories' => $categories,
-                                                                       
'targets' => $targets,
-                                                                       
'districts' => $districts,
-                                                                       
'offices' => $offices,
-                                                                       
'editable' => true,
-                                                                       
'message' => isset($message) ? $message : phpgw::get_var('message'),
-                                                                       'error' 
=> isset($error) ? $error : phpgw::get_var('error')
-                                                               )
-                                       );
+                                       else
+                                       {
+                                               
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+                       
+                                               
$this->render('activity_edit.php', array
+                                                                       (
+                                                                               
'activity'      => $activity,
+                                                                               
'organization' => $organization,
+                                                                               
'group' => $group,
+                                                                               
'arenas' => $arenas,
+                                                                               
'buildings' => $buildings,
+                                                                               
'categories' => $categories,
+                                                                               
'targets' => $targets,
+                                                                               
'districts' => $districts,
+                                                                               
'offices' => $offices,
+                                                                               
'editable' => true,
+                                                                               
'message' => isset($message) ? $message : phpgw::get_var('message'),
+                                                                               
'error' => isset($error) ? $error : phpgw::get_var('error')
+                                                                       )
+                                               );
+                                       }
                                }
                        }
                }
@@ -695,7 +585,7 @@
                        $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'activitycalendarfrontend.uiactivity.add'));
                }
                
-               public function get_organization_groups()
+               function get_organization_groups()
                {
                        $GLOBALS['phpgw_info']['flags']['noheader'] = true; 
                        $GLOBALS['phpgw_info']['flags']['nofooter'] = true; 
@@ -736,7 +626,7 @@
                /**
                 * Public method.
                 */
-               public function get_address_search()
+               function get_address_search()
                {
                        $search_string = phpgw::get_var('search');
                        //var_dump($search_string);

Modified: trunk/activitycalendarfrontend/templates/base/activity_edit.php
===================================================================
--- trunk/activitycalendarfrontend/templates/base/activity_edit.php     
2011-11-21 09:23:14 UTC (rev 8144)
+++ trunk/activitycalendarfrontend/templates/base/activity_edit.php     
2011-11-21 11:52:28 UTC (rev 8145)
@@ -125,11 +125,6 @@
                alert("Tittel må fylles ut!");
                return false;
        } 
-       if(document.getElementById('organization_id').value == null || 
document.getElementById('organization_id').value == '')
-       {
-               alert("Organisasjon må fylles ut!");
-               return false;
-       }
        if(document.getElementById('internal_arena_id').value == null || 
document.getElementById('internal_arena_id').value == 0)
        {
                if(document.getElementById('arena_id').value == null || 
document.getElementById('arena_id').value == 0)
@@ -175,472 +170,179 @@
                <h1><?php echo lang('activity') ?></h1>
                <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%">
+                       <dl class="proplist-col" style="width: 200%">
+                               <h2><?php echo lang('what')?></h2>
                                <dt>
-                                       <?php if($activity->get_title() || 
$editable) { ?>
                                        <label for="title"><?php echo 
lang('title') ?></label>
-                                       <?php  } ?>
                                </dt>
                                <dd>
-                                       <?php
-                                       if ($editable)
-                                       {
-                                       ?>
-                                               <?php echo 
lang('title_helptext')?><br/>
-                                               <input type="text" name="title" 
id="title" value="<?php echo $activity->get_title() ?>" size="60"/>
-                                       <?php
-                                       }
-                                       else
-                                       {
-                                               echo $activity->get_title();
-                                       }
-                                       ?>
+                                       <?php echo lang('title_helptext')?><br/>
+                                       <input type="text" name="title" 
id="title" value="<?php echo $activity->get_title() ?>" size="60"/>
                                </dd>
                                <dt>
-                                       <?php 
if($activity->get_organization_id() || $editable) { ?>
-                                       <label for="organization_id"><?php echo 
lang('organization') ?></label>
-                                       <?php } ?>
+                                       <label for="category"><?php echo 
lang('category') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                       $current_organization_id = 
$activity->get_organization_id();
-                                       if ($editable)
-                                       {
-                                               ?>
-                                               <?php echo 
lang('org_helptext')?><br/>
-                                               <select name="organization_id" 
id="organization_id" onchange="javascript:get_available_groups();">
-                                                       <option value="">Ingen 
organisasjon valgt</option>
-                                                       <option 
value="new_org">Ny organisasjon</option>
-                                                       <option 
value="change_org">Endre organisasjon</option>
-                                                       <?php
-                                                       foreach($organizations 
as $organization)
-                                                       {
-                                                               echo "<option 
".($current_organization_id == $organization->get_id() ? 'selected="selected"' 
: "")." 
value=\"{$organization->get_id()}\">".$organization->get_name()."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                               <?php
+                                       $current_category_id = 
$activity->get_category();
                                        ?>
-                                       <?php
-                                       }
-                                       else
-                                       {
-                                               
if($activity->get_organization_id()){
-                                                       echo 
activitycalendar_soorganization::get_instance()->get_organization_name($activity->get_organization_id());
-                                               }
-                                       }
-                                       ?>
-                               </dd>
-                               <div id="new_org" style="display: none;">
-                                       <hr/>
-                                       <div id="change_org_fields" 
style="display: none;">
-                                               <select 
name="change_organization_id" id="change_organization_id" >
-                                                       <option value="">Ingen 
organisasjon valgt</option>
-                                                       <?php
-                                                       foreach($organizations 
as $organization)
-                                                       {
-                                                               echo "<option 
".($current_organization_id == $organization->get_id() ? 'selected="selected"' 
: "")." 
value=\"{$organization->get_id()}\">".$organization->get_name()."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                       </div>
-                                       <div id="new_org_fields" 
style="display: none;">
-                                               <label 
for="orgname">Organisasjonsnavn</label>
-                                               <input type="text" 
name="orgname"/><br/>
-                                               <label 
for="orgno">Organisasjonsnummer</label>
-                                               <input type="text" 
name="orgno"/><br/>
-                                               <label 
for="district">Bydel</label>
-                                                       <select 
name="org_district">
-                                                               <option 
value="0">Ingen bydel valgt</option>
-                                               <?php 
-                                               foreach($districts as $d)
+                                       <select name="category" id="category">
+                                               <option value="0">Ingen 
kategori valgt</option>
+                                               <?php
+                                               foreach($categories as 
$category)
                                                {
+                                                       echo "<option 
".($current_category_id == $category->get_id() ? 'selected="selected"' : "")." 
value=\"{$category->get_id()}\">".$category->get_name()."</option>";
+                                               }
                                                ?>
-                                                       <option value="<?php 
echo $d['part_of_town_id']?>"><?php echo $d['name']?></option>
-                                               <?php
-                                               }?>
-                                                       </select><br/>
-                                               <label 
for="homepage">Hjemmeside</label>
-                                               <input type="text" 
name="homepage"/><br/>
-                                               <label 
for="email">E-post</label>
-                                               <input type="text" 
name="email"/><br/>
-                                               <label 
for="phone">Telefon</label>
-                                               <input type="text" 
name="phone"/><br/>
-                                               <label for="street">Gate</label>
-                                               <input type="text" 
name="address_txt" id="address_txt" onkeyup="javascript:get_address_search()"/>
-                                               <div 
id="address_container"></div><br/>
-                                               <label 
for="number">Nummer</label>
-                                               <input type="text" 
name="number"/><br/>
-                                               <label 
for="postaddress">Postnummer og Sted</label>
-                                               <input type="text" 
name="postaddress"/>
-                                               <label 
for="org_description">Beskrivelse</label>
-                                               <textarea rows="10" cols="100" 
name="org_description"></textarea>
-                                       </div>
-                                       <hr/>
-                                       <b>Kontaktperson 1</b><br/>
-                                       <label for="contact1_name">Navn</label>
-                                       <input type="text" 
name="contact1_name"/><br/>
-                                       <label 
for="contact1_phone">Telefon</label>
-                                       <input type="text" 
name="contact1_phone"/><br/>
-                                       <label 
for="contact1_mail">E-post</label>
-                                       <input type="text" 
name="contact1_mail"/><br/>
-                                       <b>Kontaktperson 2</b><br/>
-                                       <label for="contact2_name">Navn</label>
-                                       <input type="text" 
name="contact2_name"/><br/>
-                                       <label 
for="contact2_phone">Telefon</label>
-                                       <input type="text" 
name="contact2_phone"/><br/>
-                                       <label 
for="contact2_mail">E-post</label>
-                                       <input type="text" 
name="contact2_mail"/><br/>
-                                       <label 
for="contact2_address">Adresse</label>
-                                       <input type="text" 
name="contact2_address_txt" id="contact2_address_txt" 
onkeyup="javascript:get_address_search_cp2()"/>
-                                       <div 
id="contact2_address_container"></div><br/>
-                                       <label 
for="contact2_number">Nummer</label>
-                                       <input type="text" 
name="contact2_number"/><br/>
-                                       <label 
for="contact2_postaddress">Postnummer og Sted</label>
-                                       <input type="text" 
name="contact2_postaddress"/>
-                                       <hr/>
-                               </div>
+                                       </select>
+                               </dd>
                                <dt>
-                                       <?php if($activity->get_group_id() || 
$editable) { ?>
-                                       <label for="group_id" 
id="group_label"><?php echo lang('group') ?></label>
-                                       <?php } ?>
+                                       <label for="target"><?php echo 
lang('target') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                       $current_group_id = 
$activity->get_group_id();
-                                       if ($editable)
+                                       $current_target_ids = 
$activity->get_target();
+                                       $current_target_id_array=explode(",", 
$current_target_ids);
+                                       foreach($targets as $t)
                                        {
-                                               ?>
-                                               <?php echo 
lang('group_helptext')?><br/>
-                                               <div id="group_select">
-                                                       <select name="group_id" 
id="group_id">
-                                                               <option 
value="0">Ingen gruppe valgt</option>
-                                                       </select>
-                                               </div>
-                                               <?php
                                        ?>
+                                               <input name="target[]" 
type="checkbox" value="<?php echo $t->get_id()?>" <?php echo 
(in_array($t->get_id(), $current_target_id_array) ? 'checked' : "")?>/><?php 
echo $t->get_name()?><br/>
                                        <?php
                                        }
-                                       else
-                                       {
-                                               if($activity->get_group_id()){
-                                                       echo 
activitycalendar_sogroup::get_instance()->get_group_name($activity->get_group_id());
-                                               }
-                                       }
                                        ?>
                                </dd>
-                               <div id="new_group" style="display: none;">
-                                       <hr/>
-                                       <div id="new_group_fields" 
style="display: none;">
-                                               <label 
for="groupname">Gruppenavn</label>
-                                               <input type="text" 
name="groupname"/><br/>
-                                               <label 
for="group_description">Beskrivelse</label>
-                                               <textarea rows="10" cols="100" 
name="group_description"></textarea>
-                                       </div>
-                                       <hr/>
-                                       <b>Kontaktperson 1</b><br/>
-                                       <label for="contact1_name">Navn</label>
-                                       <input type="text" 
name="contact1_name"/><br/>
-                                       <label 
for="contact1_phone">Telefon</label>
-                                       <input type="text" 
name="contact1_phone"/><br/>
-                                       <label 
for="contact1_mail">E-post</label>
-                                       <input type="text" 
name="contact1_mail"/><br/>
-                                       <b>Kontaktperson 2</b><br/>
-                                       <label for="contact2_name">Navn</label>
-                                       <input type="text" 
name="contact2_name"/><br/>
-                                       <label 
for="contact2_phone">Telefon</label>
-                                       <input type="text" 
name="contact2_phone"/><br/>
-                                       <label 
for="contact2_mail">E-post</label>
-                                       <input type="text" 
name="contact2_mail"/><br/>
-                                       <label 
for="contact2_address">Adresse</label>
-                                       <input type="text" 
name="contact2_address_txt" id="contact2_address_txt" 
onkeyup="javascript:get_address_search_cp2()"/>
-                                       <div 
id="contact2_address_container"></div><br/>
-                                       <label 
for="contact2_number">Nummer</label>
-                                       <input type="text" 
name="contact2_number"/><br/>
-                                       <label 
for="contact2_postaddress">Postnummer / Sted</label>
-                                       <input type="text" 
name="contact2_postaddress"/>
-                                       <hr/>
-                               </div>
                                <dt>
-                                       <?php 
if($activity->get_internal_arena() || $editable) { ?>
-                                       <label for="arena"><?php echo 
lang('building') ?></label>
-                                       <?php  } ?>
+                                       <label for="district"><?php echo 
lang('district') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                       $current_internal_arena_id = 
$activity->get_internal_arena();
-                                       if ($editable)
+                                       $current_district_ids = 
$activity->get_district();
+                                       $current_district_id_array=explode(",", 
$current_district_ids);
+                                       foreach($districts as $d)
                                        {
-                                               ?>
-                                               <?php echo 
lang('int_arena_helptext')?><br/>
-                                               <select 
name="internal_arena_id" id="internal_arena_id">
-                                                       <option value="0">Ingen 
kommunale bygg valgt</option>
-                                                       <?php
-                                                       foreach($buildings as 
$building_id => $building_name)
-                                                       {
-                                                               echo "<option 
".($current_internal_arena_id == $building_id? 'selected="selected"' : "")." 
value=\"{$building_id}\">".$building_name."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                               <?php
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_arena()){
-                                                       echo 
activitycalendar_soarena::get_instance()->get_building_name($activity->get_internal_arena());
-                                               }
-                                       }
                                        ?>
-                               </dd>
-                               <dt>
-                                       <?php if($activity->get_arena() || 
$editable) { ?>
-                                       <label for="arena"><?php echo 
lang('arena') ?></label>
-                                       <?php  } ?>
-                               </dt>
-                               <dd>
+                                               <input name="district[]" 
type="checkbox" value="<?php echo $d['part_of_town_id']?>" <?php echo 
(in_array($d['part_of_town_id'], $current_district_id_array) ? 'checked' : 
"")?>/><?php echo $d['name']?><br/>
                                        <?php
-                                       $current_arena_id = 
$activity->get_arena();
-                                       if ($editable)
-                                       {
-                                               ?>
-                                               <?php echo 
lang('arena_helptext')?><br/>
-                                               <select name="arena_id" 
id="arena_id" style="width: 60%">
-                                                       <option value="0">Ingen 
arena valgt</option>
-                                                       <?php
-                                                       foreach($arenas as 
$arena)
-                                                       {
-                                                               echo "<option 
".($current_arena_id == $arena->get_id() ? 'selected="selected"' : "")." 
value=\"{$arena->get_id()}\">".$arena->get_arena_name()."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                               <?php
                                        }
-                                       else
-                                       {
-                                               if($activity->get_arena()){
-                                                       echo 
activitycalendar_soarena::get_instance()->get_arena_name($activity->get_arena());
-                                               }
-                                       }
                                        ?>
                                </dd>
                                <dt>
-                                       <?php if($activity->get_state() || 
$editable) { ?>
-                                       <label for="state"><?php echo 
lang('state') ?></label>
-                                       <?php  } ?>
+                                       <label for="special_adaptation"><?php 
echo lang('special_adaptation') ?></label>
                                </dt>
                                <dd>
-                                       <?php
-                                       if ($editable)
-                                       {
-                                               $selected_state = 
$activity->get_state();
-                                       ?>
-                                               <select name="state">
-                                                       <option value="1" <?php 
echo ($selected_state == 1 ? 'selected="selected"' : "")?>><?php echo 
lang('new') ?></option>
-                                                       <option value="2" <?php 
echo ($selected_state == 2 ? 'selected="selected"' : "")?>><?php echo 
lang('change') ?></option>
-                                               </select>
-                                       <?php
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_state() && 
$activity->get_state() > 0){
-                                                       echo 
lang('state_'.$activity->get_state());
-                                               }
-                                       }
-                                       ?>
+                                       <input type="checkbox" 
name="special_adaptation" id="special_adaptation" />
                                </dd>
-                       </dl>
-                       <dl class="proplist-col">
+                               <hr />
+                               <h2><?php echo lang('where_when')?></h2>
                                <dt>
-                                       <?php if($activity->get_category() || 
$editable) { ?>
-                                       <label for="category"><?php echo 
lang('category') ?></label>
-                                       <?php  } ?>
+                                       <label for="arena"><?php echo 
lang('arena') ?></label>
+                                       <br/><?php echo lang('arena_helptext')?>
                                </dt>
+                               <dt>
+                                       <label for="internal_arena_id"><?php 
echo lang('building') ?></label>
+                               </dt>
                                <dd>
                                        <?php
-                                       $current_category_id = 
$activity->get_category();
-                                       if ($editable)
-                                       {
-                                               ?>
-                                               <select name="category" 
id="category">
-                                                       <option value="0">Ingen 
kategori valgt</option>
-                                                       <?php
-                                                       foreach($categories as 
$category)
-                                                       {
-                                                               echo "<option 
".($current_category_id == $category->get_id() ? 'selected="selected"' : "")." 
value=\"{$category->get_id()}\">".$category->get_name()."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
+                                       $current_internal_arena_id = 
$activity->get_internal_arena();
+                                       ?>
+                                       <select name="internal_arena_id" 
id="internal_arena_id" onchange="javascript: check_internal();">
+                                               <option value="0">Ingen 
kommunale bygg valgt</option>
                                                <?php
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_category()){
-                                                       echo 
$act_so->get_category_name($activity->get_category());
+                                               foreach($buildings as 
$building_id => $building_name)
+                                               {
+                                                       echo "<option 
".($current_internal_arena_id == $building_id? 'selected="selected"' : "")." 
value=\"{$building_id}\">".$building_name."</option>";
                                                }
-                                       }
-                                       ?>
+                                               ?>
+                                       </select>
                                </dd>
                                <dt>
-                                       <?php if($activity->get_target() || 
$editable) { ?>
-                                       <label for="target"><?php echo 
lang('target') ?></label>
-                                       <?php  } ?>
+                                       <label for="arena_id"><?php echo 
lang('external_arena') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                       $current_target_ids = 
$activity->get_target();
-                                       $current_target_id_array=explode(",", 
$current_target_ids);
-                                       //echo 
$current_target_id_array[0]."*".$current_target_id_array[1];
-                                       if ($editable)
-                                       {
-                                               foreach($targets as $t)
-                                               {
-                                               ?>
-                                                       <input name="target[]" 
type="checkbox" value="<?php echo $t->get_id()?>" <?php echo 
(in_array($t->get_id(), $current_target_id_array) ? 'checked' : "")?>/><?php 
echo $t->get_name()?><br/>
+                                       $current_arena_id = 
$activity->get_arena();
+                                       ?>
+                                       <select name="arena_id" id="arena_id" 
onchange="javascript: check_external();">
+                                               <option value="0">Ingen arena 
valgt</option>
                                                <?php
+                                               foreach($arenas as $arena)
+                                               {
+                                                       echo "<option 
".($current_arena_id == $arena->get_id() ? 'selected="selected"' : "")." 
value=\"{$arena->get_id()}\">".$arena->get_arena_name()."</option>";
                                                }
-                                       }
-                                       else
-                                       {
-                                               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/>';
-                                                       }
-                                               }
-                                       }
-                                       ?>
+                                               ?>
+                                       </select>
                                </dd>
                                <dt>
-                                       <?php if($activity->get_office() || 
$editable) { ?>
-                                       <label for="office"><?php echo 
lang('office') ?></label>
-                                       <?php  } ?>
+                                       <label for="time"><?php echo 
lang('time') ?></label>
                                </dt>
                                <dd>
-                                       <?php
-                                       if ($editable)
-                                       {
-                                               $selected_office = 
$activity->get_office();
-                                       ?>
-                                               <select name="office" 
id="office">
-                                                       <option value="0">Ingen 
kontor valgt</option>
-                                                       <?php
-                                                       foreach($offices as 
$office)
-                                                       {
-                                                               echo "<option 
".($selected_office == $office['id'] ? 'selected="selected"' : "")." 
value=\"{$office['id']}\">".$office['name']."</option>";
-                                                       }
-                                                       ?>
-                                               </select>
-                                       <?php
-                                       }
-                                       else
-                                       {
-                                               if($activity->get_office()){
-                                                       echo 
$act_so->get_office_name($activity->get_office());
-                                               }
-                                       }
-                                       ?>
+                                       <input type="text" name="time" 
id="time" value="<?php echo $activity->get_time() ?>" />
                                </dd>
                                <dt>
-                                       <?php if($activity->get_district() || 
$editable) { ?>
-                                       <label for="district"><?php echo 
lang('district') ?></label>
-                                       <?php  } ?>
+                                       <label for="office"><?php echo 
lang('office') ?></label>
                                </dt>
                                <dd>
                                        <?php
-                                       $current_district_ids = 
$activity->get_district();
-                                       $current_district_id_array=explode(",", 
$current_district_ids);
-                                       //echo 
$current_target_id_array[0]."*".$current_target_id_array[1];
-                                       if ($editable)
-                                       {
-                                               foreach($districts as $d)
-                                               {
-                                               ?>
-                                                       <input 
name="district[]" type="checkbox" value="<?php echo $d['part_of_town_id']?>" 
<?php echo (in_array($d['part_of_town_id'], $current_district_id_array) ? 
'checked' : "")?>/><?php echo $d['name']?><br/>
+                                       $selected_office = 
$activity->get_office();
+                                       ?>
+                                       <select name="office" id="office">
+                                               <option value="0">Ingen kontor 
valgt</option>
                                                <?php
+                                               foreach($offices as $office)
+                                               {
+                                                       echo "<option 
".($selected_office == $office['id'] ? 'selected="selected"' : "")." 
value=\"{$office['id']}\">".$office['name']."</option>";
                                                }
-                                       }
-                                       else
-                                       {
-                                               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/>';
-                                                       }
-                                               }
-                                       }
-                                       ?>
+                                               ?>
+                                       </select>
                                </dd>
+                               <hr />
+                               <h2><?php echo lang('who')?></h2>
                                <dt>
-                                       <?php if($activity->get_description()) 
{ ?>
-                                       <label for="description"><?php echo 
lang('description') ?></label>
-                                       <?php  } ?>
+                                       <label for="organization_id"><?php echo 
lang('organization') ?></label>
                                </dt>
-                               <dd>
-                                       <?php echo 
$activity->get_description(); ?>
-                               </dd>
+                               <input type="hidden" name="organization_id" 
id="organization_id" value="<?php echo $organization->get_id()?>" />
+                               <dd><label 
for="orgname">Organisasjonsnavn</label>:
+                               <?php echo $organization->get_name()?></dd>
+                               <dd><label 
for="orgno">Organisasjonsnummer</label>:
+                               <?php echo 
$organization->get_organization_number()?></dd>
+                               <dd><label for="homepage">Hjemmeside</label>:
+                               <?php echo $organization->get_homepage()?></dd>
+                               <dd><label for="email">E-post</label>:
+                               <?php echo $organization->get_email()?></dd>
+                               <dd><label for="phone">Telefon</label>:
+                               <?php echo $organization->get_phone()?></dd>
+                               <dd><label for="street">Adresse</label>:
+                               <?php echo $organization->get_address()?></dd>
+                               <dd><label 
for="org_description">Beskrivelse</label>:<br/>
+                               <textarea rows="10" cols="100" 
name="org_description" size="254"><?php echo 
$organization->get_description()?></textarea></dd>
                                <dt>
-                                       <?php if($activity->get_time() || 
$editable) { ?>
-                                       <label for="time"><?php echo 
lang('time') ?></label>
-                                       <?php  } ?>
+                                       <?php if($activity->get_group_id() || 
$editable) { ?>
+                                       <label for="group_id" 
id="group_label"><?php echo lang('group') ?></label>
+                                       <?php } ?>
                                </dt>
                                <dd>
                                        <?php
-                                       if ($editable)
-                                       {
+                                               if($activity->get_group_id()){
+                                                       echo $group->get_name();
+                                               }
                                        ?>
-                                               <input type="text" name="time" 
id="time" value="<?php echo $activity->get_time() ?>" />
-                                       <?php
-                                       }
-                                       else
-                                       {
-                                               echo $activity->get_time();
-                                       }
-                                       ?>
                                </dd>
                                <dt>
-                                       <?php 
if($activity->get_contact_person_1() || $editable) { ?>
+                                       <?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());
-                                               }
-                                       ?>
-                               </dd>
+                               <dd><label 
for="contact1_name">Navn</label>:<?php echo 
isset($contact1)?$contact1->get_name():''?></dd>
+                               <dd><label 
for="contact1_phone">Telefon</label>:<?php echo 
isset($contact1)?$contact1->get_phone():''?></dd>
+                               <dd><label 
for="contact1_mail">E-post</label>:<?php echo 
isset($contact1)?$contact1->get_email():''?></dd>
                                <dt>
-                                       <?php 
if($activity->get_contact_person_2() || $editable) { ?>
+                                       <?php 
if($activity->get_contact_person_2()) { ?>
                                        <label for="contact_person_2"><?php 
echo lang('contact_person_2') ?></label>
                                        <?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());
-                                               }
-                                       ?>
-                               </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"' : '' ?> <?php echo 
!$editable ? ' disabled="disabled"' : '' ?>/>
-                               </dd>
+                               <dd><label 
for="contact2_name">Navn</label>:<?php echo 
isset($contact2)?$contact2->get_name():''?></dd>
+                               <dd><label 
for="contact2_phone">Telefon</label>:<?php echo 
isset($contact2)?$contact2->get_phone():''?></dd>
+                               <dd><label 
for="contact2_mail">E-post</label>:<?php echo 
isset($contact2)?$contact2->get_email():''?></dd>
                        </dl>
                        <div class="form-buttons">
                                <?php




reply via email to

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