fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [7345] Added show/edit of activity


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [7345] Added show/edit of activity
Date: Mon, 06 Jun 2011 07:04:23 +0000

Revision: 7345
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7345
Author:   erikhl
Date:     2011-06-06 07:04:23 +0000 (Mon, 06 Jun 2011)
Log Message:
-----------
Added show/edit of activity

Modified Paths:
--------------
    trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php
    trunk/activitycalendarfrontend/setup/phpgw_no.lang

Added Paths:
-----------
    trunk/activitycalendarfrontend/templates/base/
    trunk/activitycalendarfrontend/templates/base/activity.php

Modified: trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php
===================================================================
--- trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php 2011-06-06 
06:52:29 UTC (rev 7344)
+++ trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php 2011-06-06 
07:04:23 UTC (rev 7345)
@@ -1,6 +1,8 @@
 <?php
        phpgw::import_class('activitycalendar.uiactivities');
        phpgw::import_class('activitycalendar.soactivity');
+       
+       include_class('activitycalendar', 'activity', 'inc/model/');
 
        class activitycalendarfrontend_uiactivity extends 
activitycalendar_uiactivities
        {
@@ -11,19 +13,43 @@
                        'view'                  =>      true,
                        'index'                 =>      true
                );
+               
+               function view()
+               {
+                       $errorMsgs = array();
+                       $infoMsgs = array();
+                       $activity = 
activitycalendar_soactivity::get_instance()->get_single((int)phpgw::get_var('id'));
+                       
+                       if($activity == null) // Not found
+                       {
+                               $errorMsgs[] = lang('Could not find specified 
activity.');
+                       }
+       
+                       $data = array
+                       (
+                               'activity' => $activity,
+                               'errorMsgs' => $errorMsgs,
+                               'infoMsgs' => $infoMsgs
+                       );
+                       $this->render('activity.php', $data);
+               }
 
                function edit()
                {
                        $id = intval(phpgw::get_var('id', 'GET'));
-                       var_dump($id);
+                       //var_dump($id);
                        $so = activitycalendar_soactivity::get_instance();
                        $activity = $so->get_single($id);
+                       
+                       //var_dump(phpgw::get_var('secret', 'GET'));
+                       //var_dump($activity->get_secret());
 
                        if($activity->get_secret() != phpgw::get_var('secret', 
'GET'))
                        {
                                $this->redirect(array('menuaction' => 
'bookingfrontend.uisearch.index'));
                        }
                        
+                       //var_dump($activity->get_title());
                        //$this->redirect(array('menuaction' => 
'activitycalendar.uiactivities.edit', 'id' => $id, 'frontend' => 'true'));
                                                
 /*                     $application['resource_ids'] = $resource_ids;
@@ -33,6 +59,29 @@
                        $audience = $audience['results'];
                        self::render_template('application', 
array('application' => $application, 'audience' => $audience, 'agegroups' => 
$agegroups, 'frontend'=>'true'));
 */
+                       $categories = $so->get_categories();
+                       $targets = $so->get_targets();
+                       $offices = $so->select_district_list();
+                       $districts = $so->get_districts();
+                       $arenas = 
activitycalendar_soarena::get_instance()->get(null, null, null, null, null, 
null, null);
+                       $organizations = 
activitycalendar_soorganization::get_instance()->get(null, null, null, null, 
null, null, null);
+                       $groups = 
activitycalendar_sogroup::get_instance()->get(null, null, null, null, null, 
null, null);
+
+                       $this->render('activity.php', array
+                                               (
+                                                       'activity'      => 
$activity,
+                                                       'organizations' => 
$organizations,
+                                                       'groups' => $groups,
+                                                       'arenas' => $arenas,
+                                                       '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')
+                                               )
+                       );
                }
                
                function index()

Modified: trunk/activitycalendarfrontend/setup/phpgw_no.lang
===================================================================
--- trunk/activitycalendarfrontend/setup/phpgw_no.lang  2011-06-06 06:52:29 UTC 
(rev 7344)
+++ trunk/activitycalendarfrontend/setup/phpgw_no.lang  2011-06-06 07:04:23 UTC 
(rev 7345)
@@ -1,2 +1,48 @@
 activitycalendarfrontend       common  no      Aktivitetsoversikt Frontend
-Activitycalendarfrontend       common  no      Aktivitetsoversikt Frontend
\ No newline at end of file
+Activitycalendarfrontend       common  no      Aktivitetsoversikt Frontend
+office activitycalendarfrontend        no      Kontor
+arena  activitycalendarfrontend        no      Arena
+description    activitycalendarfrontend        no      Beskrivelse
+date_start     activitycalendarfrontend        no      Startdato
+date_end       activitycalendarfrontend        no      Sluttdato
+special_adaptation     activitycalendarfrontend        no      Spesielt 
tilpasset for utviklingshemmede
+target activitycalendarfrontend        no      Målgruppe
+contact_person_1       activitycalendarfrontend        no      Kontaktperson 1
+contact_person_2       activitycalendarfrontend        no      Kontaktperson 2
+Activities     activitycalendarfrontend        no      Aktiviteter
+activities     activitycalendarfrontend        no      Aktiviteter
+Arena  activitycalendarfrontend        no      Arena
+arenas activitycalendarfrontend        no      Arena
+OrganizationList       activitycalendarfrontend        no      
Organisasjoner/Grupper
+f_new_activity activitycalendarfrontend        no      Ny aktivitet
+f_new_arena    activitycalendarfrontend        no      Ny arena
+search_for     activitycalendarfrontend        no      Søk etter
+activity_type  activitycalendarfrontend        no      Aktivitetstype
+all    activitycalendarfrontend        no      Alle
+not_internal   activitycalendarfrontend        no      Ikke intern
+organization_id        activitycalendarfrontend        no      Organisasjon ID
+arena_type     activitycalendarfrontend        no      Arenatype
+internal_arena_id      activitycalendarfrontend        no      Intern arena ID
+reset  activitycalendarfrontend        no      Nullstill
+organization_number    activitycalendarfrontend        no      
Organisasjonsnummer
+elements_pr_page       activitycalendarfrontend        no      elementer per 
side
+shows_from     activitycalendarfrontend        no      Viser fra
+of_total       activitycalendarfrontend        no      av totalt
+DATATABLE_MSG_EMPTY    activitycalendarfrontend        no      Ingen elementer
+export_to      activitycalendarfrontend        no      Eksporter til
+activity_state activitycalendarfrontend        no      Status
+processed      activitycalendarfrontend        no      Behandlet
+show   activitycalendarfrontend        no      Vis
+last_change_date       activitycalendarfrontend        no      Sist endret
+first  activitycalendarfrontend        no      Første
+last   activitycalendarfrontend        no      Siste
+previous       activitycalendarfrontend        no      Forrige
+state  activitycalendarfrontend        no      Status
+state_0        activitycalendarfrontend        no      Ingen
+state_1        activitycalendarfrontend        no      Ny
+state_2        activitycalendarfrontend        no      Endring
+state_3        activitycalendarfrontend        no      Akseptert
+state_4        activitycalendarfrontend        no      Behandlet
+state_5        activitycalendarfrontend        no      Avvist
+district       activitycalendarfrontend        no      Bydel
+title  activitycalendarfrontend        no      Tittel
\ No newline at end of file

Added: trunk/activitycalendarfrontend/templates/base/activity.php
===================================================================
--- trunk/activitycalendarfrontend/templates/base/activity.php                  
        (rev 0)
+++ trunk/activitycalendarfrontend/templates/base/activity.php  2011-06-06 
07:04:23 UTC (rev 7345)
@@ -0,0 +1,360 @@
+<?php
+       //include common logic for all templates
+//     include("common.php");
+       $act_so = activitycalendar_soactivity::get_instance();
+       $contpers_so = activitycalendar_socontactperson::get_instance();
+?>
+
+<div class="yui-content">
+       <div id="details">
+               <h1><img src="<?php echo ACTIVITYCALENDAR_IMAGE_PATH 
?>images/32x32/custom/contact.png" /><?php echo lang('activity') ?></h1>
+               <h4><?php if($editable){echo lang('activity_helptext');}?></h4>
+               <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">
+                               <dt>
+                                       <?php if($activity->get_title() || 
$editable) { ?>
+                                       <label for="title"><?php echo 
lang('title') ?></label>
+                                       <?php  } ?>
+                               </dt>
+                               <dd>
+                                       <?php
+                                       if ($editable)
+                                       {
+                                       ?>
+                                               <input type="text" name="title" 
id="title" value="<?php echo $activity->get_title() ?>" />
+                                       <?php
+                                       }
+                                       else
+                                       {
+                                               echo $activity->get_title();
+                                       }
+                                       ?>
+                               </dd>
+                               <dt>
+                                       <?php 
if($activity->get_organization_id() || $editable) { ?>
+                                       <label for="organization_id"><?php echo 
lang('organization') ?></label>
+                                       <?php } ?>
+                               </dt>
+                               <dd>
+                                       <?php
+                                       $current_organization_id = 
$activity->get_organization_id();
+                                       if ($editable)
+                                       {
+                                               ?>
+                                               <select name="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>
+                                               <?php
+                                       ?>
+                                       <?php
+                                       }
+                                       else
+                                       {
+                                               
if($activity->get_organization_id()){
+                                                       echo 
activitycalendar_soorganization::get_instance()->get_organization_name($activity->get_organization_id());
+                                               }
+                                       }
+                                       ?>
+                               </dd>
+                               <dt>
+                                       <?php if($activity->get_group_id() || 
$editable) { ?>
+                                       <label for="group_id"><?php echo 
lang('group') ?></label>
+                                       <?php } ?>
+                               </dt>
+                               <dd>
+                                       <?php
+                                       $current_group_id = 
$activity->get_group_id();
+                                       if ($editable)
+                                       {
+                                               ?>
+                                               <select name="group_id">
+                                                       <option value="0">Ingen 
gruppe valgt</option>
+                                                       <?php
+                                                       foreach($groups as 
$group)
+                                                       {
+                                                               echo "<option 
".($current_group_id == $group->get_id() ? 'selected="selected"' : "")." 
value=\"{$group->get_id()}\">".$group->get_name()."</option>";
+                                                       }
+                                                       ?>
+                                               </select>
+                                               <?php
+                                       ?>
+                                       <?php
+                                       }
+                                       else
+                                       {
+                                               if($activity->get_group_id()){
+                                                       echo 
activitycalendar_sogroup::get_instance()->get_group_name($activity->get_group_id());
+                                               }
+                                       }
+                                       ?>
+                               </dd>
+                               <dt>
+                                       <?php if($activity->get_arena() || 
$editable) { ?>
+                                       <label for="arena"><?php echo 
lang('arena') ?></label>
+                                       <?php  } ?>
+                               </dt>
+                               <dd>
+                                       <?php
+                                       $current_arena_id = 
$activity->get_arena();
+                                       if ($editable)
+                                       {
+                                               ?>
+                                               <select name="arena_id">
+                                                       <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  } ?>
+                               </dt>
+                               <dd>
+                                       <?php
+                                       if ($editable)
+                                       {
+                                               $selected_state = 
$activity->get_state();
+                                       ?>
+                                               <select name="state">
+                                                       <option value="0" <?php 
echo ($selected_state == 0 ? 'selected="selected"' : "")?>>Ingen status 
valgt</option>
+                                                       <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>
+                                                       <option value="3" <?php 
echo ($selected_state == 3 ? 'selected="selected"' : "")?>><?php echo 
lang('accepted') ?></option>
+                                                       <option value="4" <?php 
echo ($selected_state == 4 ? 'selected="selected"' : "")?>><?php echo 
lang('processed') ?></option>
+                                                       <option value="5" <?php 
echo ($selected_state == 5 ? 'selected="selected"' : "")?>><?php echo 
lang('rejected') ?></option>
+                                               </select>
+                                       <?php
+                                       }
+                                       else
+                                       {
+                                               if($activity->get_state() && 
$activity->get_state() > 0){
+                                                       echo 
lang('state_'.$activity->get_state());
+                                               }
+                                       }
+                                       ?>
+                               </dd>
+                               <dt>
+                                       <?php if($activity->get_category() || 
$editable) { ?>
+                                       <label for="category"><?php echo 
lang('category') ?></label>
+                                       <?php  } ?>
+                               </dt>
+                               <dd>
+                                       <?php
+                                       $current_category_id = 
$activity->get_category();
+                                       if ($editable)
+                                       {
+                                               ?>
+                                               <select name="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>
+                                               <?php
+                                       }
+                                       else
+                                       {
+                                               if($activity->get_category()){
+                                                       echo 
$act_so->get_category_name($activity->get_category());
+                                               }
+                                       }
+                                       ?>
+                               </dd>
+                               <dt>
+                                       <?php if($activity->get_target() || 
$editable) { ?>
+                                       <label for="target"><?php echo 
lang('target') ?></label>
+                                       <?php  } ?>
+                               </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/>
+                                               <?php
+                                               }
+                                       }
+                                       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/>';
+                                                       }
+                                               }
+                                       }
+                                       ?>
+                               </dd>
+                               <dt>
+                                       <?php if($activity->get_office() || 
$editable) { ?>
+                                       <label for="office"><?php echo 
lang('office') ?></label>
+                                       <?php  } ?>
+                               </dt>
+                               <dd>
+                                       <?php
+                                       if ($editable)
+                                       {
+                                               $selected_office = 
$activity->get_office();
+                                       ?>
+                                               <select name="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());
+                                               }
+                                       }
+                                       ?>
+                               </dd>
+                               <dt>
+                                       <?php if($activity->get_district() || 
$editable) { ?>
+                                       <label for="district"><?php echo 
lang('district') ?></label>
+                                       <?php  } ?>
+                               </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/>
+                                               <?php
+                                               }
+                                       }
+                                       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/>';
+                                                       }
+                                               }
+                                       }
+                                       ?>
+                               </dd>
+                               <dt>
+                                       <?php if($activity->get_description()) 
{ ?>
+                                       <label for="description"><?php echo 
lang('description') ?></label>
+                                       <?php  } ?>
+                               </dt>
+                               <dd>
+                                       <?php echo 
$activity->get_description(); ?>
+                               </dd>
+                               <dt>
+                                       <?php if($activity->get_time() || 
$editable) { ?>
+                                       <label for="time"><?php echo 
lang('time') ?></label>
+                                       <?php  } ?>
+                               </dt>
+                               <dd>
+                                       <?php
+                                       if ($editable)
+                                       {
+                                       ?>
+                                               <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) { ?>
+                                       <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>
+                               <dt>
+                                       <?php 
if($activity->get_contact_person_2() || $editable) { ?>
+                                       <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>
+                       </dl>
+                       <div class="form-buttons">
+                               <?php
+                                       if ($editable) {
+                                               echo '<input type="submit" 
name="save_activity" value="' . lang('save') . '"/>';
+                                       }
+                               ?>
+                       </div>
+                       
+               </form>
+               
+       </div>
+</div>
\ No newline at end of file




reply via email to

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