[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9942] whitespace-fix (formatting)
From: |
Erik Holm-Larsen |
Subject: |
[Fmsystem-commits] [9942] whitespace-fix (formatting) |
Date: |
Fri, 31 Aug 2012 07:42:37 +0000 |
Revision: 9942
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9942
Author: erikhl
Date: 2012-08-31 07:42:36 +0000 (Fri, 31 Aug 2012)
Log Message:
-----------
whitespace-fix (formatting)
Modified Paths:
--------------
trunk/activitycalendarfrontend/inc/class.menu.inc.php
trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php
trunk/activitycalendarfrontend/templates/base/activity.php
trunk/activitycalendarfrontend/templates/base/activity_edit.php
trunk/activitycalendarfrontend/templates/base/activity_edit_step_1.php
trunk/activitycalendarfrontend/templates/base/activity_new.php
trunk/activitycalendarfrontend/templates/base/activity_new_org.php
trunk/activitycalendarfrontend/templates/base/activity_new_step_1.php
trunk/activitycalendarfrontend/templates/base/organization_edit.php
trunk/activitycalendarfrontend/templates/base/organization_reciept.php
Modified: trunk/activitycalendarfrontend/inc/class.menu.inc.php
===================================================================
--- trunk/activitycalendarfrontend/inc/class.menu.inc.php 2012-08-31
05:52:26 UTC (rev 9941)
+++ trunk/activitycalendarfrontend/inc/class.menu.inc.php 2012-08-31
07:42:36 UTC (rev 9942)
@@ -1,27 +1,27 @@
<?php
- class activitycalendarfrontend_menu
- {
- function get_menu()
- {
- $incoming_app =
$GLOBALS['phpgw_info']['flags']['currentapp'];
- $GLOBALS['phpgw_info']['flags']['currentapp'] =
'activitycalendarfrontend';
- $menus = array();
+class activitycalendarfrontend_menu {
- if ( $GLOBALS['phpgw']->acl->check('run',
phpgwapi_acl::READ, 'admin')
- || $GLOBALS['phpgw']->acl->check('admin',
phpgwapi_acl::ADD, 'activitycalendarfrontend'))
- {
- $menus['admin'] = array
- (
- 'index' => array
- (
- 'text' =>
lang('Configuration'),
- 'url' =>
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'admin.uiconfig.index', 'appname' => 'activitycalendarfrontend') )
- ),
- );
- }
+ function get_menu() {
+ $incoming_app = $GLOBALS['phpgw_info']['flags']['currentapp'];
+ $GLOBALS['phpgw_info']['flags']['currentapp'] = 'activitycalendarfrontend';
- $GLOBALS['phpgw_info']['flags']['currentapp'] =
$incoming_app;
- return $menus;
- }
- }
+ $menus = array();
+
+ if ($GLOBALS['phpgw']->acl->check('run', phpgwapi_acl::READ, 'admin')
+ || $GLOBALS['phpgw']->acl->check('admin', phpgwapi_acl::ADD,
'activitycalendarfrontend')) {
+ $menus['admin'] = array
+ (
+ 'index' => array
+ (
+ 'text' => lang('Configuration'),
+ 'url' => $GLOBALS['phpgw']->link('/index.php',
array('menuaction' => 'admin.uiconfig.index', 'appname' =>
'activitycalendarfrontend'))
+ ),
+ );
+ }
+
+ $GLOBALS['phpgw_info']['flags']['currentapp'] = $incoming_app;
+ return $menus;
+ }
+
+}
Modified: trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php
===================================================================
--- trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php 2012-08-31
05:52:26 UTC (rev 9941)
+++ trunk/activitycalendarfrontend/inc/class.uiactivity.inc.php 2012-08-31
07:42:36 UTC (rev 9942)
@@ -1,977 +1,871 @@
<?php
- phpgw::import_class('activitycalendar.uiactivities');
- phpgw::import_class('activitycalendar.soactivity');
- phpgw::import_class('activitycalendar.sogroup');
- phpgw::import_class('activitycalendar.soarena');
- phpgw::import_class('activitycalendar.soorganization');
- phpgw::import_class('activitycalendar.socontactperson');
-
- include_class('activitycalendar', 'activity', 'inc/model/');
- include_class('activitycalendar', 'group', 'inc/model/');
- include_class('activitycalendar', 'organization', 'inc/model/');
- include_class('activitycalendar', 'arena', 'inc/model/');
- class activitycalendarfrontend_uiactivity extends
activitycalendar_uiactivities
- {
- private $so_organization;
-
- public $public_functions = array
- (
- 'add' => true,
- 'edit' => true,
- 'view' => true,
- 'index' => true,
- 'get_organization_groups' => true,
- 'get_address_search' => true,
- 'edit_organization_values' => true,
- 'get_organization_activities' => true
- );
-
- public function __construct()
- {
- parent::__construct();
- $this->so_organization =
activitycalendar_soorganization::get_instance();
- }
-
- /**
- * Public method. Add new activity.
- */
- public function add()
- {
-
//$GLOBALS['phpgw']->redirect_link('/activitycalendarfrontend/index.php',
array('menuaction' => 'activitycalendarfrontend.uiactivity.edit', 'action' =>
'new_activity'));
- $GLOBALS['phpgw']->js->validate_file( 'json', 'json',
'phpgwapi' );
- $c =
createobject('phpgwapi.config','activitycalendarfrontend');
- $c->read();
- $config = $c->config_data;
-
- $ajaxUrl = $c->config_data['AJAXURL'];
+phpgw::import_class('activitycalendar.uiactivities');
+phpgw::import_class('activitycalendar.soactivity');
+phpgw::import_class('activitycalendar.sogroup');
+phpgw::import_class('activitycalendar.soarena');
+phpgw::import_class('activitycalendar.soorganization');
+phpgw::import_class('activitycalendar.socontactperson');
- $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);
- $organizations = $this->so_organization->get(null,
null, 'org.name', true, null, null, null);
-
- $activity = new activitycalendar_activity();
-
- $o_id = phpgw::get_var('organization_id');
- $o_id_new = phpgw::get_var('organization_id_hidden');
-
- if(isset($_POST['step_1'])) //activity shall be
registred on a new organization
- {
- if($o_id_new == "new_org")
- {
- //add new organization to internal
activitycalendar organization register
- $org_homepage = phpgw::get_var('homepage');
- if($org_homepage == 'http://')
- {
- $org_homepage = "";
- }
- $org_info['name'] =
phpgw::get_var('orgname');
- $org_info['orgnr'] =
phpgw::get_var('orgno');
- $org_info['homepage'] = $org_homepage;
- $org_info['street'] =
phpgw::get_var('address');
- $org_info['streetnumber'] =
phpgw::get_var('number');
- $org_info['zip'] =
phpgw::get_var('postzip');
- $org_info['postaddress'] =
phpgw::get_var('postaddress');
- $org_info['status'] = "new";
- $o_id =
$this->so_activity->add_organization_local($org_info);
+include_class('activitycalendar', 'activity', 'inc/model/');
+include_class('activitycalendar', 'group', 'inc/model/');
+include_class('activitycalendar', 'organization', 'inc/model/');
+include_class('activitycalendar', 'arena', 'inc/model/');
- //add contact persons
- $contact1 = array();
- $contact1['name'] =
phpgw::get_var('org_contact1_name');
- $contact1['phone'] =
phpgw::get_var('org_contact1_phone');
- $contact1['mail'] =
phpgw::get_var('org_contact1_mail');
- $contact1['org_id'] = $o_id;
- $contact1['group_id'] = 0;
-
$this->so_activity->add_contact_person_local($contact1);
+class activitycalendarfrontend_uiactivity extends
activitycalendar_uiactivities {
- $person_arr =
$this->so_contact->get_local_contact_persons($o_id);
- foreach($person_arr as $p)
- {
- $persons[] = $p;
- }
+ private $so_organization;
+ public $public_functions = array
+ (
+ 'add' => true,
+ 'edit' => true,
+ 'view' => true,
+ 'index' => true,
+ 'get_organization_groups' => true,
+ 'get_address_search' => true,
+ 'edit_organization_values' => true,
+ 'get_organization_activities' => true
+ );
- $person_ids =
$this->so_organization->get_contacts_local($o_id);
- $desc = phpgw::get_var('org_description');
- $organization =
$this->so_organization->get_organization_local($o_id);
- $new_org = true;
+ public function __construct() {
+ parent::__construct();
+ $this->so_organization = activitycalendar_soorganization::get_instance();
+ }
- $organization =
$this->so_organization->get_organization_local($o_id);
- $person_arr =
$this->so_organization->get_contacts_local_as_objects($o_id);
- foreach($person_arr as $p)
- {
- //var_dump($p);
- $persons[] = $p;
- }
+ /**
+ * Public method. Add new activity.
+ */
+ public function add() {
+ //$GLOBALS['phpgw']->redirect_link('/activitycalendarfrontend/index.php',
array('menuaction' => 'activitycalendarfrontend.uiactivity.edit', 'action' =>
'new_activity'));
+ $GLOBALS['phpgw']->js->validate_file('json', 'json', 'phpgwapi');
+ $c = createobject('phpgwapi.config', 'activitycalendarfrontend');
+ $c->read();
+ $config = $c->config_data;
- $message = lang('organization_saved_form');
+ $ajaxUrl = $c->config_data['AJAXURL'];
- $this->render('activity_new.php', array
- (
- 'activity' =>
$activity,
- 'new_organization' => true,
- 'organization' =>
$organization,
- 'contact1' => $persons[0],
- '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'),
- 'ajaxURL' => $ajaxUrl
- )
- );
- }
- else
- {
- $new_org = false;
- $organization =
$this->so_organization->get_single($o_id);
- $person_arr =
$this->so_contact->get(null, null, null, null, null, null,
array('organization_id' => $o_id));
- foreach($person_arr as $p)
- {
- //var_dump($p);
- $persons[] = $p;
- }
-
-
- $activity->set_organization_id($o_id);
-
$activity->set_description($organization->get_description());
- $activity->set_contact_persons($pers);
-
- $this->render('activity_new.php', array
- (
- 'activity' =>
$activity,
- 'new_organization' =>
false,
- 'organization' =>
$organization,
- 'contact1' =>
$persons[0],
- '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'),
- 'ajaxURL' => $ajaxUrl
- )
- );
- }
- }
- else if(isset($_POST['save_activity']))
- {
- $get_org_from_local = false;
- $new_org_group = false;
- $new_org = phpgw::get_var('new_organization');
- if($new_org != null && $new_org == 'yes')
- {
- $get_org_from_local = true;
- }
-
- if($get_org_from_local)
- {
- $activity->set_new_org(true);
- //$person_arr =
$this->so_contact->get_local_contact_persons($o_id);
- //foreach($person_arr as $p)
- //{
- //$persons[] = $p;
- //}
- //$person_ids =
$this->so_organization->get_contacts_local($o_id);
- //$desc =
$this->so_organization->get_description_local($o_id);
- $organization =
$this->so_organization->get_organization_local($o_id);
- $new_org = true;
- //$new_org_group = true;
-
- //Add new group for the activity
- $group_info['name'] =
phpgw::get_var('title');
- $group_info['organization_id'] = $o_id;
- $group_info['description'] =
phpgw::get_var('description');
- $group_info['status'] = "new";
- $g_id =
$this->so_activity->add_group_local($group_info);
-
- //add contact persons
- $contact1 = array();
- $contact1['name'] =
phpgw::get_var('contact_name');
- $contact1['phone'] =
phpgw::get_var('contact_phone');
- $contact1['mail'] =
phpgw::get_var('contact_mail');
- $contact1['org_id'] = $o_id;
- $contact1['group_id'] = $g_id;
-
$this->so_activity->add_contact_person_local($contact1);
-
- $person_arr =
$this->so_contact->get_local_contact_persons($g_id, true);
- foreach($person_arr as $p)
- {
- $persons[] = $p;
- }
- $desc = phpgw::get_var('description');
- $group =
$this->so_group->get_group_local($g_id);
- $person_ids =
$this->so_group->get_contacts_local($g_id);
- $new_group = true;
- }
- else if(is_numeric($o_id) && $o_id > 0)
- {
- $group_info['name'] =
phpgw::get_var('title');
- $group_info['organization_id'] = $o_id;
- $group_info['description'] =
phpgw::get_var('description');
- $group_info['status'] = "new";
- $g_id =
$this->so_activity->add_group_local($group_info);
-
- //add contact persons
- $contact1 = array();
- $contact1['name'] =
phpgw::get_var('contact_name');
- $contact1['phone'] =
phpgw::get_var('contact_phone');
- $contact1['mail'] =
phpgw::get_var('contact_mail');
- $contact1['org_id'] = 0;
- $contact1['group_id'] = $g_id;
-
$this->so_activity->add_contact_person_local($contact1);
-
- $person_arr =
$this->so_contact->get_local_contact_persons($g_id, true);
- foreach($person_arr as $p)
- {
- $persons[] = $p;
- }
- $desc = phpgw::get_var('description');
- $group =
$this->so_group->get_group_local($g_id);
- $person_ids =
$this->so_group->get_contacts_local($g_id);
- $organization =
$this->so_organization->get_single($o_id);
- $new_group = true;
- }
-
- if(strlen($desc) > 254)
- {
- $desc = substr($desc,0,254);
- }
-
- $arena_id = phpgw::get_var('internal_arena_id');
- $new_arena = phpgw::get_var('new_arena_hidden');
- if($new_arena != null && $new_arena ==
'new_arena')
- {
- $arena = new activitycalendar_arena();
- $arena_name =
phpgw::get_var('arena_name');
- $arena_address =
phpgw::get_var('arena_address');
- $arena_addressnumber =
phpgw::get_var('arena_number');
- $arena_zip_code =
phpgw::get_var('arena_zip_code');
- $arena_city =
phpgw::get_var('arena_city');
-
- $arena->set_arena_name($arena_name);
- $arena->set_address($arena_address);
-
$arena->set_addressnumber($arena_addressnumber);
- $arena->set_zip_code($arena_zip_code);
- $arena->set_city($arena_city);
- $arena->set_active(true);
-
- // All is good, store arena
- if ($this->so_arena->store($arena)) {
- $arena_id = $arena->get_id();
- $activity->set_arena($arena_id);
- }
- }
- else
- {
- $arena_arr = explode("_",$arena_id);
- if($arena_arr[0] == 'i')
- {
-
$activity->set_internal_arena($arena_arr[1]);
- }
- else
- {
- $activity->set_arena($arena_arr[1]);
- }
- }
+ $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);
+ $organizations = $this->so_organization->get(null, null, 'org.name', true,
null, null, null);
- //... set all parameters
- $activity->set_title(phpgw::get_var('title'));
- $activity->set_organization_id($o_id);
- $activity->set_group_id($g_id);
-
$activity->set_district(phpgw::get_var('district'));
- $activity->set_office(phpgw::get_var('office'));
- $activity->set_state(1);
-
$activity->set_category(phpgw::get_var('category'));
- $target_array = phpgw::get_var('target');
- $activity->set_target(implode(",",
$target_array));
- $activity->set_description($desc);
- $activity->set_time(phpgw::get_var('time'));
- $activity->set_contact_persons($persons);
-
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
-
$activity->set_contact_person_2_address(phpgw::get_var('contact2_address') . ",
" . phpgw::get_var('contact2_number'));
-
$activity->set_contact_person_2_zip(phpgw::get_var('contact2_postaddress'));
- $activity->set_frontend(true);
- $activity->set_new_org($new_org);
- $activity->set_new_group($new_group);
- $target_ok = false;
- $district_ok = false;
-
- if($get_org_from_local)
- {
- //update new organization with district-id
from activity.
-
$this->so_organization->update_org_district_local($organization->get_id(),
$activity->get_district());
- }
-
- if($activity->get_target() &&
$activity->get_target() != '')
- {
- $target_ok = true;
- }
- if($activity->get_district() &&
$activity->get_district() != '')
- {
- $district_ok = true;
- }
-
- if($target_ok && $district_ok)
- {
-
if($this->so_activity->store($activity)) // ... and then try to store the object
- {
- $message =
lang('messages_saved_form');
- }
- else
- {
- $error =
lang('messages_form_error');
- }
- //$org_info_edit_url =
self::link('/index.php' ,array('menuaction' =>
'activitycalendarfrontend.uiactivity.edit_organization_values'));
+ $activity = new activitycalendar_activity();
-
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+ $o_id = phpgw::get_var('organization_id');
+ $o_id_new = phpgw::get_var('organization_id_hidden');
- $this->render('activity.php', array
- (
-
'activity' => $activity,
-
'organization' => $organization,
- 'group'
=> $group,
-
'contact1' => $persons[0],
-
'arenas' => $arenas,
-
'buildings' => $buildings,
-
'categories' => $categories,
-
'targets' => $targets,
-
'districts' => $districts,
-
'offices' => $offices,
-
'message' => isset($message) ? $message : phpgw::get_var('message'),
- 'error'
=> isset($error) ? $error : phpgw::get_var('error'),
-
'ajaxURL' => $ajaxUrl
- )
- );
- }
- else
- {
- if(!$target_ok)
- {
- $error .= "<br/>" .
lang('target_not_selected');
- }
- if(!$district_ok)
- {
- $error .= "<br/>" .
lang('district_not_selected');
- }
- return
$this->render('activity_new.php', array
- (
- 'activity' =>
$activity,
- 'organizations' =>
$organizations,
- 'organization' =>
$organization,
- 'contact1' =>
$persons[0],
- 'contact2' =>
$persons[1],
- 'org_name' => $org_name,
- 'new_org' => $new_org,
- 'groups' => $groups,
- 'arenas' => $arenas,
- 'buildings' =>
$buildings,
- 'categories' =>
$categories,
- 'targets' => $targets,
- 'districts' =>
$districts,
- 'offices' => $offices,
- 'editable' => true,
- 'cancel_link' =>
$cancel_link,
- 'message' =>
isset($message) ? $message : phpgw::get_var('message'),
- 'error' =>
isset($error) ? $error : phpgw::get_var('error'),
- 'ajaxURL' => $ajaxUrl
- )
- );
- }
- }
- else
- {
- return $this->render('activity_new_step_1.php',
array
- (
- 'organizations' =>
$organizations,
- 'ajaxURL' => $ajaxUrl
- )
- );
- }
- }
-
- function view()
- {
- $errorMsgs = array();
- $infoMsgs = array();
- $activity =
$this->so_activity->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
- );
-
- $GLOBALS['phpgw_info']['flags']['noframework'] = true;
- $this->render('activity.php', $data);
- //self::render_template('activity_tmp',
array('activity' => $activity, 'frontend'=>'true'));
- }
+ if (isset($_POST['step_1'])) { //activity shall be registred on a new
organization
+ if ($o_id_new == "new_org") {
+ //add new organization to internal activitycalendar organization
register
+ $org_homepage = phpgw::get_var('homepage');
+ if ($org_homepage == 'http://') {
+ $org_homepage = "";
+ }
+ $org_info['name'] = phpgw::get_var('orgname');
+ $org_info['orgnr'] = phpgw::get_var('orgno');
+ $org_info['homepage'] = $org_homepage;
+ $org_info['street'] = phpgw::get_var('address');
+ $org_info['streetnumber'] = phpgw::get_var('number');
+ $org_info['zip'] = phpgw::get_var('postzip');
+ $org_info['postaddress'] = phpgw::get_var('postaddress');
+ $org_info['status'] = "new";
+ $o_id = $this->so_activity->add_organization_local($org_info);
- function edit()
- {
- $GLOBALS['phpgw']->js->validate_file( 'json', 'json',
'phpgwapi' );
+ //add contact persons
+ $contact1 = array();
+ $contact1['name'] = phpgw::get_var('org_contact1_name');
+ $contact1['phone'] = phpgw::get_var('org_contact1_phone');
+ $contact1['mail'] = phpgw::get_var('org_contact1_mail');
+ $contact1['org_id'] = $o_id;
+ $contact1['group_id'] = 0;
+ $this->so_activity->add_contact_person_local($contact1);
- $c =
createobject('phpgwapi.config','activitycalendarfrontend');
- $c->read();
- $config = $c->config_data;
-
- $ajaxUrl = $c->config_data['AJAXURL'];
-
- $id = intval(phpgw::get_var('id', 'GET'));
+ $person_arr = $this->so_contact->get_local_contact_persons($o_id);
+ foreach ($person_arr as $p) {
+ $persons[] = $p;
+ }
- $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
- {
- $activity_id = phpgw::get_var('activity_id');
- $activity =
$this->so_activity->get_single($activity_id);
- $org =
$this->so_organization->get_single($activity->get_organization_id());
-
-
- //store update-request
- //$activity->set_state(2);
- //if($this->so_activity->store($activity))
- //{
-
$this->send_email_to_selection(array($activity));
- $message = lang('update_request_sent',
$activity->get_title(), $org->get_name());
- return
$this->render('activity_edit_step_1.php', array
- (
- 'activities' =>
$activities,
- 'message' => $message,
- 'ajaxURL' => $ajaxUrl
- )
- );
- //}
- }
- else
- {
- $secret_param = phpgw::get_var('secret', 'GET');
- if(!isset($id) || $id == '')
- {
- //select activity to edit
- $activities =
$this->so_activity->get(null, null, 'title', true, null, null,
array('activity_state' => 3));
- $organizations =
$this->so_organization->get(null, null, 'org.name', true, null, null,
array('edit_from_frontend' => 'yes'));
- return
$this->render('activity_edit_step_1.php', array
- (
- 'activities' =>
$activities,
- 'organizations' =>
$organizations,
- 'ajaxURL' => $ajaxUrl
- )
- );
- }
- 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
- (
- 'activities' =>
$activities,
- 'ajaxURL' => $ajaxUrl
- )
- );
- }
- else
- {
- // Retrieve the activity object or
create a new one
- if(isset($id) && $id > 0)
- {
- $activity =
$this->so_activity->get_single($id);
- }
- else
- {
- $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,
- 'ajaxURL' =>
$ajaxUrl
- )
- );
- }
-
- if($activity->get_secret() !=
phpgw::get_var('secret', 'GET'))
- {
- //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,
- 'ajaxURL' =>
$ajaxUrl
- )
- );
- }
-
- if($activity->get_group_id())
- {
- $person_arr =
$this->so_contact->get_booking_contact_persons($activity->get_group_id(), true);
- foreach($person_arr as $p)
- {
- $persons_array[] = $p;
- }
- $desc =
$this->so_group->get_description($activity->get_group_id());
- $group =
$this->so_group->get_single($activity->get_group_id());
- $person_ids =
$this->so_group->get_contacts($activity->get_group_id());
- }
- else
if($activity->get_organization_id())
- {
- $person_arr =
$this->so_contact->get_booking_contact_persons($activity->get_organization_id());
- foreach($person_arr as $p)
- {
- $persons_array[] = $p;
- }
- $desc =
$this->so_organization->get_description($activity->get_organization_id());
- $person_ids =
$this->so_organization->get_contacts($activity->get_organization_id());
- }
- if(strlen($desc) > 254)
- {
- $desc = substr($desc,0,254);
- }
- $organization =
$this->so_organization->get_single($activity->get_organization_id());
-
- $change_activity_request = FALSE;
- if(isset($_POST['save_activity'])) //
The user has pressed the save button
- {
- if(isset($activity)) // If an
activity object is created
- {
- $act_description =
phpgw::get_var('description');
- $old_state =
$activity->get_state();
- $new_state =
phpgw::get_var('state');
- // ... set all parameters
- $activity->set_state(2);
-
$activity->set_title(phpgw::get_var('title'));
- $arena_id =
phpgw::get_var('internal_arena_id');
- $arena_arr =
explode("_",$arena_id);
- if($arena_arr[0] == 'i')
- {
-
$activity->set_internal_arena($arena_arr[1]);
-
$activity->set_arena(0);
- }
- else
- {
-
$activity->set_internal_arena(0);
-
$activity->set_arena($arena_arr[1]);
- }
- //$district_array =
phpgw::get_var('district');
-
$activity->set_district(phpgw::get_var('district'));
-
$activity->set_office(phpgw::get_var('office'));
- $activity->set_state(2);
-
$activity->set_category(phpgw::get_var('category'));
- $target_array =
phpgw::get_var('target');
-
$activity->set_target(implode(",", $target_array));
-
$activity->set_description($act_description);
-
$activity->set_time(phpgw::get_var('time'));
-
$activity->set_contact_persons($persons);
-
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
-
$activity->set_frontend(true);
+ $person_ids = $this->so_organization->get_contacts_local($o_id);
+ $desc = phpgw::get_var('org_description');
+ $organization = $this->so_organization->get_organization_local($o_id);
+ $new_org = true;
- $contact_person = array();
- $cp_tmp =
$persons_array[0];
-
$contact_person['original_id'] = $cp_tmp->get_id();
- $contact_person['name'] =
phpgw::get_var('contact_name');
- $contact_person['phone'] =
phpgw::get_var('contact_phone');
- $contact_person['mail'] =
phpgw::get_var('contact_mail');
-
$contact_person['group_id'] = $activity->get_group_id();
+ $organization = $this->so_organization->get_organization_local($o_id);
+ $person_arr =
$this->so_organization->get_contacts_local_as_objects($o_id);
+ foreach ($person_arr as $p) {
+ //var_dump($p);
+ $persons[] = $p;
+ }
+ $message = lang('organization_saved_form');
- $target_ok = false;
- $district_ok = false;
- if($activity->get_target()
&& $activity->get_target() != '')
- {
- $target_ok = true;
- }
-
if($activity->get_district() && $activity->get_district() != '')
- {
- $district_ok =
true;
- }
+ $this->render('activity_new.php', array
+ (
+ 'activity' => $activity,
+ 'new_organization' => true,
+ 'organization' => $organization,
+ 'contact1' => $persons[0],
+ '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'),
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ } else {
+ $new_org = false;
+ $organization = $this->so_organization->get_single($o_id);
+ $person_arr = $this->so_contact->get(null, null, null, null, null,
null, array('organization_id' => $o_id));
+ foreach ($person_arr as $p) {
+ //var_dump($p);
+ $persons[] = $p;
+ }
- if($target_ok &&
$district_ok)
- {
-
if($this->so_activity->store($activity)) // ... and then try to store the object
- {
- $message =
lang('messages_saved_form');
- //update
group description
-
if($activity->get_group_id())
- {
-
$this->so_group->update_group_description($activity->get_group_id(),
$act_description);
-
$this->so_group->update_group_contact($contact_person);
-
-
$person_arr_tmp =
$this->so_contact->get_booking_contact_persons($activity->get_group_id(), true);
-
foreach($person_arr_tmp as $p_t)
- {
-
$persons_array_tmp[] = $p_t;
- }
- }
- }
- else
- {
- $error =
lang('messages_form_error');
- }
+ $activity->set_organization_id($o_id);
+ $activity->set_description($organization->get_description());
+ $activity->set_contact_persons($pers);
-
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+ $this->render('activity_new.php', array
+ (
+ 'activity' => $activity,
+ 'new_organization' => false,
+ 'organization' => $organization,
+ 'contact1' => $persons[0],
+ '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'),
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ }
+ } else if (isset($_POST['save_activity'])) {
+ $get_org_from_local = false;
+ $new_org_group = false;
+ $new_org = phpgw::get_var('new_organization');
+ if ($new_org != null && $new_org == 'yes') {
+ $get_org_from_local = true;
+ }
-
$this->render('activity.php', array
-
(
-
'activity' => $activity,
-
'organization' => $organization,
-
'group' => $group,
-
'contact1' => $persons_array_tmp[0],
-
'arenas' => $arenas,
-
'buildings' => $buildings,
-
'categories' => $categories,
-
'targets' => $targets,
-
'districts' => $districts,
-
'offices' => $offices,
-
'message' => isset($message) ? $message :
phpgw::get_var('message'),
-
'error' => isset($error) ? $error : phpgw::get_var('error'),
-
'ajaxURL' => $ajaxUrl
-
)
- );
- }
- else
- {
- if(!$target_ok)
- {
- $error .=
"<br/>" . lang('target_not_selected');
- }
- if(!$district_ok)
- {
- $error .=
"<br/>" . lang('district_not_selected');
- }
- return
$this->render('activity_edit.php', array
- (
-
'activity' => $activity,
-
'organization' => $organization,
-
'contact1' => $persons_array[0],
-
'org_name' => $org_name,
-
'group' => $group,
-
'arenas' => $arenas,
-
'buildings' => $buildings,
-
'categories' => $categories,
-
'targets' => $targets,
-
'districts' => $districts,
-
'offices' => $offices,
-
'editable' => true,
-
'cancel_link' => $cancel_link,
-
'message' => isset($message) ? $message : phpgw::get_var('message'),
-
'error' => isset($error) ? $error : phpgw::get_var('error'),
-
'ajaxURL' => $ajaxUrl
- )
- );
- }
- }
- }
- else if(isset($_POST['change_request']))
- {
-
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+ if ($get_org_from_local) {
+ $activity->set_new_org(true);
+ //$person_arr = $this->so_contact->get_local_contact_persons($o_id);
+ //foreach($person_arr as $p)
+ //{
+ //$persons[] = $p;
+ //}
+ //$person_ids = $this->so_organization->get_contacts_local($o_id);
+ //$desc = $this->so_organization->get_description_local($o_id);
+ $organization = $this->so_organization->get_organization_local($o_id);
+ $new_org = true;
+ //$new_org_group = true;
+ //Add new group for the activity
+ $group_info['name'] = phpgw::get_var('title');
+ $group_info['organization_id'] = $o_id;
+ $group_info['description'] = phpgw::get_var('description');
+ $group_info['status'] = "new";
+ $g_id = $this->so_activity->add_group_local($group_info);
- $this->render('activity_edit.php',
array
- (
-
'activity' => $activity,
-
'organization' => $organization,
-
'group' => $group,
-
'contact1' => $persons_array[0],
-
'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'),
-
'ajaxURL' => $ajaxUrl
- )
- );
- }
- else if(isset($_POST['activity_ok'])) //
The user has pressed the save button
- {
- if(isset($activity)) // If an activity
object is created
- {
- $activity->set_frontend(true);
+ //add contact persons
+ $contact1 = array();
+ $contact1['name'] = phpgw::get_var('contact_name');
+ $contact1['phone'] = phpgw::get_var('contact_phone');
+ $contact1['mail'] = phpgw::get_var('contact_mail');
+ $contact1['org_id'] = $o_id;
+ $contact1['group_id'] = $g_id;
+ $this->so_activity->add_contact_person_local($contact1);
-
if($this->so_activity->save_with_no_changes($activity)) // ... and then try to
store the object
- {
- $message =
lang('activity_ok_message');
- }
-
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
-
- $this->render('activity.php', array
- (
-
'activity' => $activity,
-
'organization' => $organization,
-
'group' => $group,
-
'contact1' => $persons_array[0],
-
'arenas' => $arenas,
-
'buildings' => $buildings,
-
'categories' => $categories,
-
'targets' => $targets,
-
'districts' => $districts,
-
'offices' => $offices,
-
'message' => isset($message) ? $message : phpgw::get_var('message'),
-
'error' => isset($error) ? $error : phpgw::get_var('error'),
-
'ajaxURL' => $ajaxUrl
- )
- );
- }
- }
- else
- {
-
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
+ $person_arr = $this->so_contact->get_local_contact_persons($g_id,
true);
+ foreach ($person_arr as $p) {
+ $persons[] = $p;
+ }
+ $desc = phpgw::get_var('description');
+ $group = $this->so_group->get_group_local($g_id);
+ $person_ids = $this->so_group->get_contacts_local($g_id);
+ $new_group = true;
+ } else if (is_numeric($o_id) && $o_id > 0) {
+ $group_info['name'] = phpgw::get_var('title');
+ $group_info['organization_id'] = $o_id;
+ $group_info['description'] = phpgw::get_var('description');
+ $group_info['status'] = "new";
+ $g_id = $this->so_activity->add_group_local($group_info);
- $this->render('activity.php', array
- (
-
'activity' => $activity,
-
'organization' => $organization,
-
'group' => $group,
-
'contact1' => $persons_array[0],
-
'arenas' => $arenas,
-
'buildings' => $buildings,
-
'categories' => $categories,
-
'targets' => $targets,
-
'districts' => $districts,
-
'offices' => $offices,
-
'editable' => false,
-
'change_request' => true,
-
'message' => isset($message) ? $message : phpgw::get_var('message'),
-
'error' => isset($error) ? $error : phpgw::get_var('error'),
-
'ajaxURL' => $ajaxUrl
- )
- );
- }
- }
- }
- }
-
- function index()
- {
- $GLOBALS['phpgw']->redirect_link('/index.php',
array('menuaction' => 'activitycalendarfrontend.uiactivity.add'));
- }
-
- function get_organization_groups()
- {
- $GLOBALS['phpgw_info']['flags']['noheader'] = true;
- $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
-
- $org_id = phpgw::get_var('orgid');
- $group_id = phpgw::get_var('groupid');
- $returnHTML = "<option value='0'>Ingen gruppe
valgt</option>";
- if($org_id)
- {
- $group_html[] = "<option value='new_group'>Ny
gruppe</option>";
- $groups =
activitycalendar_sogroup::get_instance()->get(null, null, null, null, null,
null, array('org_id' => $org_id));
- foreach ($groups as $group) {
- if(isset($group))
- {
- //$res_g = $group->serialize();
- $selected = "";
- if($group_id && $group_id > 0)
- {
- $gr_id =
(int)$group_id;
- if($gr_id ==
(int)$group->get_id())
- {
- $selected_group
= " selected";
- }
- }
- $group_html[] = "<option
value='" . $group->get_id() . "'". $selected_group . ">" . $group->get_name() .
"</option>";
- }
- }
- $html = implode(' ' , $group_html);
- $returnHTML = $returnHTML . ' ' . $html;
- }
-
-
- return $returnHTML;
- //return "<option>Ingen gruppe valgt</option>";
- }
-
- /**
- * Public method.
- */
- function get_address_search()
- {
- $search_string = phpgw::get_var('search');
- //var_dump($search_string);
- return
activitycalendar_soarena::get_instance()->get_address($search_string);
- }
-
- function edit_organization_values()
- {
- $org_id = phpgw::get_var('organization_id');
- if(isset($org_id))
- {
- if(isset($_POST['save_org'])) //save updated
organization info
- {
- $organization =
$this->so_organization->get_single($org_id);
-
- $org_info['name'] =
phpgw::get_var('orgname');
- $org_info['orgnr'] =
phpgw::get_var('orgno');
- $org_info['homepage'] =
phpgw::get_var('homepage');
- $org_info['street'] =
phpgw::get_var('address');
- $org_info['streetnumber'] =
phpgw::get_var('number');
- $org_info['zip'] =
phpgw::get_var('postzip');
- $org_info['postaddress'] =
phpgw::get_var('postaddress');
- $org_info['district'] =
$organization->get_district();
- $org_info['status'] = "change";
- $org_info['original_org_id'] = $org_id;
- $o_id =
$this->so_activity->add_organization_local($org_info);
-
- //add contact persons
- $contact1 = array();
- $contact1['name'] =
phpgw::get_var('org_contact1_name');
- $contact1['phone'] =
phpgw::get_var('org_contact1_phone');
- $contact1['mail'] =
phpgw::get_var('org_contact1_mail');
- $contact1['org_id'] = $o_id;
- $contact1['group_id'] = 0;
-
$this->so_activity->add_contact_person_local($contact1);
-
- $message = lang('change_request_ok',
$org_info['name']);
-
-
$this->render('organization_reciept.php', array
- (
- 'message' =>
isset($message) ? $message : phpgw::get_var('message'),
- 'error' =>
isset($error) ? $error : phpgw::get_var('error')
- )
- );
-
- }
- else
- {
- $c =
createobject('phpgwapi.config','activitycalendarfrontend');
- $c->read();
- $config = $c->config_data;
+ //add contact persons
+ $contact1 = array();
+ $contact1['name'] = phpgw::get_var('contact_name');
+ $contact1['phone'] = phpgw::get_var('contact_phone');
+ $contact1['mail'] = phpgw::get_var('contact_mail');
+ $contact1['org_id'] = 0;
+ $contact1['group_id'] = $g_id;
+ $this->so_activity->add_contact_person_local($contact1);
- $ajaxUrl = $c->config_data['AJAXURL'];
- $organization =
$this->so_organization->get_single($org_id);
- $person_arr =
$this->so_contact->get(null, null, null, null, null, null,
array('organization_id' => $org_id));
- foreach($person_arr as $p)
- {
- $persons[] = $p;
- }
-
- $this->render('organization_edit.php',
array
- (
- 'organization' =>
$organization,
- 'contact1' =>
$persons[0],
- 'editable' => true,
- 'message' =>
isset($message) ? $message : phpgw::get_var('message'),
- 'error' =>
isset($error) ? $error : phpgw::get_var('error'),
- 'ajaxURL' => $ajaxUrl
- )
- );
- }
- }
- }
-
- function edit_group_values()
- {
- $group_id = phpgw::get_var('group_id');
- if(isset($group_id))
- {
- if(isset($_POST['save_group'])) //save updated
organization info
- {
- $group =
$this->so_group->get_single($group_id);
-
- $group_info['name'] =
phpgw::get_var('groupname');
- $group_info['organization_id'] =
phpgw::get_var('orgid');
- $group_info['description'] =
phpgw::get_var('org_description');
- $group_info['status'] = "change";
- $group_info['original_group_id'] =
$group_id;
- $g_id =
$this->so_activity->add_group_local($group_info);
-
- //add contact persons
- $contact1 = array();
- $contact1['name'] =
phpgw::get_var('group_contact1_name');
- $contact1['phone'] =
phpgw::get_var('group_contact1_phone');
- $contact1['mail'] =
phpgw::get_var('group_contact1_email');
- $contact1['org_id'] = 0;
- $contact1['group_id'] = $g_id;
-
$this->so_activity->add_contact_person_local($contact1);
-
- $contact2 = array();
- $contact2['name'] =
phpgw::get_var('group_contact2_name');
- $contact2['phone'] =
phpgw::get_var('group_contact2_phone');
- $contact2['mail'] =
phpgw::get_var('group_contact2_email');
- $contact2['org_id'] = 0;
- $contact2['group_id'] = $g_id;
-
$this->so_activity->add_contact_person_local($contact2);
-
- $message = lang('change_request_ok',
$group_info['name']);
-
- $this->render('group_reciept.php', array
- (
- 'message' =>
isset($message) ? $message : phpgw::get_var('message'),
- 'error' =>
isset($error) ? $error : phpgw::get_var('error')
- )
- );
-
- }
- else
- {
- $group =
$this->so_group->get_single($group_id);
- $person_arr =
$this->so_contact->get(null, null, null, null, null, null, array('group_id' =>
$group_id));
- foreach($person_arr as $p)
- {
- $persons[] = $p;
- }
-
- $this->render('group_edit.php', array
- (
- 'group' => $group,
- 'contact1' =>
$persons[0],
- 'contact2' =>
$persons[1],
- 'editable' => true,
- 'message' =>
isset($message) ? $message : phpgw::get_var('message'),
- 'error' =>
isset($error) ? $error : phpgw::get_var('error')
- )
- );
- }
- }
- }
-
- public function get_organization_activities()
- {
- $GLOBALS['phpgw_info']['flags']['noheader'] = true;
- $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
- $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
-
- $org_id = phpgw::get_var('orgid');
- $returnHTML = "<option value='0'>Ingen aktivitet
valgt</option>";
- if($org_id)
- {
- $activities = $this->so_activity->get(null,
null, 'title', true, null, null, array('activity_state' => 3, 'activity_org' =>
$org_id));
- foreach ($activities as $act) {
- if(isset($act))
- {
- //$res_g = $group->serialize();
- $activity_html[] = "<option
value='" . $act->get_id() . "'>" . $act->get_title() . "</option>";
- }
- }
- $html = implode(' ' , $activity_html);
- $returnHTML = $returnHTML . ' ' . $html;
- }
-
-
- return $returnHTML;
- }
- }
+ $person_arr = $this->so_contact->get_local_contact_persons($g_id,
true);
+ foreach ($person_arr as $p) {
+ $persons[] = $p;
+ }
+ $desc = phpgw::get_var('description');
+ $group = $this->so_group->get_group_local($g_id);
+ $person_ids = $this->so_group->get_contacts_local($g_id);
+ $organization = $this->so_organization->get_single($o_id);
+ $new_group = true;
+ }
+
+ if (strlen($desc) > 254) {
+ $desc = substr($desc, 0, 254);
+ }
+
+ $arena_id = phpgw::get_var('internal_arena_id');
+ $new_arena = phpgw::get_var('new_arena_hidden');
+ if ($new_arena != null && $new_arena == 'new_arena') {
+ $arena = new activitycalendar_arena();
+ $arena_name = phpgw::get_var('arena_name');
+ $arena_address = phpgw::get_var('arena_address');
+ $arena_addressnumber = phpgw::get_var('arena_number');
+ $arena_zip_code = phpgw::get_var('arena_zip_code');
+ $arena_city = phpgw::get_var('arena_city');
+
+ $arena->set_arena_name($arena_name);
+ $arena->set_address($arena_address);
+ $arena->set_addressnumber($arena_addressnumber);
+ $arena->set_zip_code($arena_zip_code);
+ $arena->set_city($arena_city);
+ $arena->set_active(true);
+
+ // All is good, store arena
+ if ($this->so_arena->store($arena)) {
+ $arena_id = $arena->get_id();
+ $activity->set_arena($arena_id);
+ }
+ } else {
+ $arena_arr = explode("_", $arena_id);
+ if ($arena_arr[0] == 'i') {
+ $activity->set_internal_arena($arena_arr[1]);
+ } else {
+ $activity->set_arena($arena_arr[1]);
+ }
+ }
+
+ //... set all parameters
+ $activity->set_title(phpgw::get_var('title'));
+ $activity->set_organization_id($o_id);
+ $activity->set_group_id($g_id);
+ $activity->set_district(phpgw::get_var('district'));
+ $activity->set_office(phpgw::get_var('office'));
+ $activity->set_state(1);
+ $activity->set_category(phpgw::get_var('category'));
+ $target_array = phpgw::get_var('target');
+ $activity->set_target(implode(",", $target_array));
+ $activity->set_description($desc);
+ $activity->set_time(phpgw::get_var('time'));
+ $activity->set_contact_persons($persons);
+ $activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
+
$activity->set_contact_person_2_address(phpgw::get_var('contact2_address') . ",
" . phpgw::get_var('contact2_number'));
+
$activity->set_contact_person_2_zip(phpgw::get_var('contact2_postaddress'));
+ $activity->set_frontend(true);
+ $activity->set_new_org($new_org);
+ $activity->set_new_group($new_group);
+ $target_ok = false;
+ $district_ok = false;
+
+ if ($get_org_from_local) {
+ //update new organization with district-id from activity.
+
$this->so_organization->update_org_district_local($organization->get_id(),
$activity->get_district());
+ }
+
+ if ($activity->get_target() && $activity->get_target() != '') {
+ $target_ok = true;
+ }
+ if ($activity->get_district() && $activity->get_district() != '') {
+ $district_ok = true;
+ }
+
+ if ($target_ok && $district_ok) {
+ if ($this->so_activity->store($activity)) { // ... and then try to
store the object
+ $message = lang('messages_saved_form');
+ } else {
+ $error = lang('messages_form_error');
+ }
+ //$org_info_edit_url = self::link('/index.php' ,array('menuaction' =>
'activitycalendarfrontend.uiactivity.edit_organization_values'));
+
+ $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+
+ $this->render('activity.php', array
+ (
+ 'activity' => $activity,
+ 'organization' => $organization,
+ 'group' => $group,
+ 'contact1' => $persons[0],
+ 'arenas' => $arenas,
+ 'buildings' => $buildings,
+ 'categories' => $categories,
+ 'targets' => $targets,
+ 'districts' => $districts,
+ 'offices' => $offices,
+ 'message' => isset($message) ? $message :
phpgw::get_var('message'),
+ 'error' => isset($error) ? $error : phpgw::get_var('error'),
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ } else {
+ if (!$target_ok) {
+ $error .= "<br/>" . lang('target_not_selected');
+ }
+ if (!$district_ok) {
+ $error .= "<br/>" . lang('district_not_selected');
+ }
+ return $this->render('activity_new.php', array
+ (
+ 'activity' => $activity,
+ 'organizations' => $organizations,
+ 'organization' => $organization,
+ 'contact1' => $persons[0],
+ 'contact2' => $persons[1],
+ 'org_name' => $org_name,
+ 'new_org' => $new_org,
+ 'groups' => $groups,
+ 'arenas' => $arenas,
+ 'buildings' => $buildings,
+ 'categories' => $categories,
+ 'targets' => $targets,
+ 'districts' => $districts,
+ 'offices' => $offices,
+ 'editable' => true,
+ 'cancel_link' => $cancel_link,
+ 'message' => isset($message) ? $message :
phpgw::get_var('message'),
+ 'error' => isset($error) ? $error :
phpgw::get_var('error'),
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ }
+ } else {
+ return $this->render('activity_new_step_1.php', array
+ (
+ 'organizations' => $organizations,
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ }
+ }
+
+ function view() {
+ $errorMsgs = array();
+ $infoMsgs = array();
+ $activity = $this->so_activity->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
+ );
+
+ $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+ $this->render('activity.php', $data);
+ //self::render_template('activity_tmp', array('activity' => $activity,
'frontend'=>'true'));
+ }
+
+ function edit() {
+ $GLOBALS['phpgw']->js->validate_file('json', 'json', 'phpgwapi');
+
+ $c = createobject('phpgwapi.config', 'activitycalendarfrontend');
+ $c->read();
+ $config = $c->config_data;
+
+ $ajaxUrl = $c->config_data['AJAXURL'];
+
+ $id = intval(phpgw::get_var('id', 'GET'));
+
+ $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
+ $activity_id = phpgw::get_var('activity_id');
+ $activity = $this->so_activity->get_single($activity_id);
+ $org =
$this->so_organization->get_single($activity->get_organization_id());
+
+
+ //store update-request
+ //$activity->set_state(2);
+ //if($this->so_activity->store($activity))
+ //{
+ $this->send_email_to_selection(array($activity));
+ $message = lang('update_request_sent', $activity->get_title(),
$org->get_name());
+ return $this->render('activity_edit_step_1.php', array
+ (
+ 'activities' => $activities,
+ 'message' => $message,
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ //}
+ } else {
+ $secret_param = phpgw::get_var('secret', 'GET');
+ if (!isset($id) || $id == '') {
+ //select activity to edit
+ $activities = $this->so_activity->get(null, null, 'title', true, null,
null, array('activity_state' => 3));
+ $organizations = $this->so_organization->get(null, null, 'org.name',
true, null, null, array('edit_from_frontend' => 'yes'));
+ return $this->render('activity_edit_step_1.php', array
+ (
+ 'activities' => $activities,
+ 'organizations' => $organizations,
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ }
+ 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
+ (
+ 'activities' => $activities,
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ } else {
+ // Retrieve the activity object or create a new one
+ if (isset($id) && $id > 0) {
+ $activity = $this->so_activity->get_single($id);
+ } else {
+ $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,
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ }
+
+ if ($activity->get_secret() != phpgw::get_var('secret', 'GET')) {
+ //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,
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ }
+
+ if ($activity->get_group_id()) {
+ $person_arr =
$this->so_contact->get_booking_contact_persons($activity->get_group_id(), true);
+ foreach ($person_arr as $p) {
+ $persons_array[] = $p;
+ }
+ $desc = $this->so_group->get_description($activity->get_group_id());
+ $group = $this->so_group->get_single($activity->get_group_id());
+ $person_ids =
$this->so_group->get_contacts($activity->get_group_id());
+ } else if ($activity->get_organization_id()) {
+ $person_arr =
$this->so_contact->get_booking_contact_persons($activity->get_organization_id());
+ foreach ($person_arr as $p) {
+ $persons_array[] = $p;
+ }
+ $desc =
$this->so_organization->get_description($activity->get_organization_id());
+ $person_ids =
$this->so_organization->get_contacts($activity->get_organization_id());
+ }
+ if (strlen($desc) > 254) {
+ $desc = substr($desc, 0, 254);
+ }
+ $organization =
$this->so_organization->get_single($activity->get_organization_id());
+
+ $change_activity_request = FALSE;
+ if (isset($_POST['save_activity'])) { // The user has pressed the save
button
+ if (isset($activity)) { // If an activity object is created
+ $act_description = phpgw::get_var('description');
+ $old_state = $activity->get_state();
+ $new_state = phpgw::get_var('state');
+ // ... set all parameters
+ $activity->set_state(2);
+ $activity->set_title(phpgw::get_var('title'));
+ $arena_id = phpgw::get_var('internal_arena_id');
+ $arena_arr = explode("_", $arena_id);
+ if ($arena_arr[0] == 'i') {
+ $activity->set_internal_arena($arena_arr[1]);
+ $activity->set_arena(0);
+ } else {
+ $activity->set_internal_arena(0);
+ $activity->set_arena($arena_arr[1]);
+ }
+ //$district_array = phpgw::get_var('district');
+ $activity->set_district(phpgw::get_var('district'));
+ $activity->set_office(phpgw::get_var('office'));
+ $activity->set_state(2);
+ $activity->set_category(phpgw::get_var('category'));
+ $target_array = phpgw::get_var('target');
+ $activity->set_target(implode(",", $target_array));
+ $activity->set_description($act_description);
+ $activity->set_time(phpgw::get_var('time'));
+ $activity->set_contact_persons($persons);
+
$activity->set_special_adaptation(phpgw::get_var('special_adaptation'));
+ $activity->set_frontend(true);
+
+ $contact_person = array();
+ $cp_tmp = $persons_array[0];
+ $contact_person['original_id'] = $cp_tmp->get_id();
+ $contact_person['name'] = phpgw::get_var('contact_name');
+ $contact_person['phone'] = phpgw::get_var('contact_phone');
+ $contact_person['mail'] = phpgw::get_var('contact_mail');
+ $contact_person['group_id'] = $activity->get_group_id();
+
+
+ $target_ok = false;
+ $district_ok = false;
+ if ($activity->get_target() && $activity->get_target() != '') {
+ $target_ok = true;
+ }
+ if ($activity->get_district() && $activity->get_district() != '') {
+ $district_ok = true;
+ }
+
+ if ($target_ok && $district_ok) {
+
+ if ($this->so_activity->store($activity)) { // ... and then try
to store the object
+ $message = lang('messages_saved_form');
+ //update group description
+ if ($activity->get_group_id()) {
+
$this->so_group->update_group_description($activity->get_group_id(),
$act_description);
+ $this->so_group->update_group_contact($contact_person);
+
+ $person_arr_tmp =
$this->so_contact->get_booking_contact_persons($activity->get_group_id(), true);
+ foreach ($person_arr_tmp as $p_t) {
+ $persons_array_tmp[] = $p_t;
+ }
+ }
+ } else {
+ $error = lang('messages_form_error');
+ }
+
+ $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+
+ $this->render('activity.php', array
+ (
+ 'activity' => $activity,
+ 'organization' => $organization,
+ 'group' => $group,
+ 'contact1' => $persons_array_tmp[0],
+ 'arenas' => $arenas,
+ 'buildings' => $buildings,
+ 'categories' => $categories,
+ 'targets' => $targets,
+ 'districts' => $districts,
+ 'offices' => $offices,
+ 'message' => isset($message) ? $message :
phpgw::get_var('message'),
+ 'error' => isset($error) ? $error : phpgw::get_var('error'),
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ } else {
+ if (!$target_ok) {
+ $error .= "<br/>" . lang('target_not_selected');
+ }
+ if (!$district_ok) {
+ $error .= "<br/>" . lang('district_not_selected');
+ }
+ return $this->render('activity_edit.php', array
+ (
+ 'activity' => $activity,
+ 'organization' => $organization,
+ 'contact1' => $persons_array[0],
+ 'org_name' => $org_name,
+ 'group' => $group,
+ 'arenas' => $arenas,
+ 'buildings' => $buildings,
+ 'categories' => $categories,
+ 'targets' => $targets,
+ 'districts' => $districts,
+ 'offices' => $offices,
+ 'editable' => true,
+ 'cancel_link' => $cancel_link,
+ 'message' => isset($message) ? $message :
phpgw::get_var('message'),
+ 'error' => isset($error) ? $error :
phpgw::get_var('error'),
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ }
+ }
+ } else if (isset($_POST['change_request'])) {
+ $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+
+ $this->render('activity_edit.php', array
+ (
+ 'activity' => $activity,
+ 'organization' => $organization,
+ 'group' => $group,
+ 'contact1' => $persons_array[0],
+ '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'),
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ } else if (isset($_POST['activity_ok'])) { // The user has pressed the
save button
+ if (isset($activity)) { // If an activity object is created
+ $activity->set_frontend(true);
+
+ if ($this->so_activity->save_with_no_changes($activity)) { // ...
and then try to store the object
+ $message = lang('activity_ok_message');
+ }
+ $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+
+ $this->render('activity.php', array
+ (
+ 'activity' => $activity,
+ 'organization' => $organization,
+ 'group' => $group,
+ 'contact1' => $persons_array[0],
+ 'arenas' => $arenas,
+ 'buildings' => $buildings,
+ 'categories' => $categories,
+ 'targets' => $targets,
+ 'districts' => $districts,
+ 'offices' => $offices,
+ 'message' => isset($message) ? $message :
phpgw::get_var('message'),
+ 'error' => isset($error) ? $error : phpgw::get_var('error'),
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ }
+ } else {
+ $GLOBALS['phpgw_info']['flags']['noframework'] = true;
+
+ $this->render('activity.php', array
+ (
+ 'activity' => $activity,
+ 'organization' => $organization,
+ 'group' => $group,
+ 'contact1' => $persons_array[0],
+ 'arenas' => $arenas,
+ 'buildings' => $buildings,
+ 'categories' => $categories,
+ 'targets' => $targets,
+ 'districts' => $districts,
+ 'offices' => $offices,
+ 'editable' => false,
+ 'change_request' => true,
+ 'message' => isset($message) ? $message :
phpgw::get_var('message'),
+ 'error' => isset($error) ? $error : phpgw::get_var('error'),
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ }
+ }
+ }
+ }
+
+ function index() {
+ $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' =>
'activitycalendarfrontend.uiactivity.add'));
+ }
+
+ function get_organization_groups() {
+ $GLOBALS['phpgw_info']['flags']['noheader'] = true;
+ $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+
+ $org_id = phpgw::get_var('orgid');
+ $group_id = phpgw::get_var('groupid');
+ $returnHTML = "<option value='0'>Ingen gruppe valgt</option>";
+ if ($org_id) {
+ $group_html[] = "<option value='new_group'>Ny gruppe</option>";
+ $groups = activitycalendar_sogroup::get_instance()->get(null, null,
null, null, null, null, array('org_id' => $org_id));
+ foreach ($groups as $group) {
+ if (isset($group)) {
+ //$res_g = $group->serialize();
+ $selected = "";
+ if ($group_id && $group_id > 0) {
+ $gr_id = (int) $group_id;
+ if ($gr_id == (int) $group->get_id()) {
+ $selected_group = " selected";
+ }
+ }
+ $group_html[] = "<option value='" . $group->get_id() . "'" .
$selected_group . ">" . $group->get_name() . "</option>";
+ }
+ }
+ $html = implode(' ', $group_html);
+ $returnHTML = $returnHTML . ' ' . $html;
+ }
+
+
+ return $returnHTML;
+ //return "<option>Ingen gruppe valgt</option>";
+ }
+
+ /**
+ * Public method.
+ */
+ function get_address_search() {
+ $search_string = phpgw::get_var('search');
+ //var_dump($search_string);
+ return
activitycalendar_soarena::get_instance()->get_address($search_string);
+ }
+
+ function edit_organization_values() {
+ $org_id = phpgw::get_var('organization_id');
+ if (isset($org_id)) {
+ if (isset($_POST['save_org'])) { //save updated organization info
+ $organization = $this->so_organization->get_single($org_id);
+
+ $org_info['name'] = phpgw::get_var('orgname');
+ $org_info['orgnr'] = phpgw::get_var('orgno');
+ $org_info['homepage'] = phpgw::get_var('homepage');
+ $org_info['street'] = phpgw::get_var('address');
+ $org_info['streetnumber'] = phpgw::get_var('number');
+ $org_info['zip'] = phpgw::get_var('postzip');
+ $org_info['postaddress'] = phpgw::get_var('postaddress');
+ $org_info['district'] = $organization->get_district();
+ $org_info['status'] = "change";
+ $org_info['original_org_id'] = $org_id;
+ $o_id = $this->so_activity->add_organization_local($org_info);
+
+ //add contact persons
+ $contact1 = array();
+ $contact1['name'] = phpgw::get_var('org_contact1_name');
+ $contact1['phone'] = phpgw::get_var('org_contact1_phone');
+ $contact1['mail'] = phpgw::get_var('org_contact1_mail');
+ $contact1['org_id'] = $o_id;
+ $contact1['group_id'] = 0;
+ $this->so_activity->add_contact_person_local($contact1);
+
+ $message = lang('change_request_ok', $org_info['name']);
+
+ $this->render('organization_reciept.php', array
+ (
+ 'message' => isset($message) ? $message :
phpgw::get_var('message'),
+ 'error' => isset($error) ? $error : phpgw::get_var('error')
+ )
+ );
+ } else {
+ $c = createobject('phpgwapi.config', 'activitycalendarfrontend');
+ $c->read();
+ $config = $c->config_data;
+
+ $ajaxUrl = $c->config_data['AJAXURL'];
+ $organization = $this->so_organization->get_single($org_id);
+ $person_arr = $this->so_contact->get(null, null, null, null, null,
null, array('organization_id' => $org_id));
+ foreach ($person_arr as $p) {
+ $persons[] = $p;
+ }
+
+ $this->render('organization_edit.php', array
+ (
+ 'organization' => $organization,
+ 'contact1' => $persons[0],
+ 'editable' => true,
+ 'message' => isset($message) ? $message :
phpgw::get_var('message'),
+ 'error' => isset($error) ? $error : phpgw::get_var('error'),
+ 'ajaxURL' => $ajaxUrl
+ )
+ );
+ }
+ }
+ }
+
+ function edit_group_values() {
+ $group_id = phpgw::get_var('group_id');
+ if (isset($group_id)) {
+ if (isset($_POST['save_group'])) { //save updated organization info
+ $group = $this->so_group->get_single($group_id);
+
+ $group_info['name'] = phpgw::get_var('groupname');
+ $group_info['organization_id'] = phpgw::get_var('orgid');
+ $group_info['description'] = phpgw::get_var('org_description');
+ $group_info['status'] = "change";
+ $group_info['original_group_id'] = $group_id;
+ $g_id = $this->so_activity->add_group_local($group_info);
+
+ //add contact persons
+ $contact1 = array();
+ $contact1['name'] = phpgw::get_var('group_contact1_name');
+ $contact1['phone'] = phpgw::get_var('group_contact1_phone');
+ $contact1['mail'] = phpgw::get_var('group_contact1_email');
+ $contact1['org_id'] = 0;
+ $contact1['group_id'] = $g_id;
+ $this->so_activity->add_contact_person_local($contact1);
+
+ $contact2 = array();
+ $contact2['name'] = phpgw::get_var('group_contact2_name');
+ $contact2['phone'] = phpgw::get_var('group_contact2_phone');
+ $contact2['mail'] = phpgw::get_var('group_contact2_email');
+ $contact2['org_id'] = 0;
+ $contact2['group_id'] = $g_id;
+ $this->so_activity->add_contact_person_local($contact2);
+
+ $message = lang('change_request_ok', $group_info['name']);
+
+ $this->render('group_reciept.php', array
+ (
+ 'message' => isset($message) ? $message :
phpgw::get_var('message'),
+ 'error' => isset($error) ? $error : phpgw::get_var('error')
+ )
+ );
+ } else {
+ $group = $this->so_group->get_single($group_id);
+ $person_arr = $this->so_contact->get(null, null, null, null, null,
null, array('group_id' => $group_id));
+ foreach ($person_arr as $p) {
+ $persons[] = $p;
+ }
+
+ $this->render('group_edit.php', array
+ (
+ 'group' => $group,
+ 'contact1' => $persons[0],
+ 'contact2' => $persons[1],
+ 'editable' => true,
+ 'message' => isset($message) ? $message :
phpgw::get_var('message'),
+ 'error' => isset($error) ? $error : phpgw::get_var('error')
+ )
+ );
+ }
+ }
+ }
+
+ public function get_organization_activities() {
+ $GLOBALS['phpgw_info']['flags']['noheader'] = true;
+ $GLOBALS['phpgw_info']['flags']['nofooter'] = true;
+ $GLOBALS['phpgw_info']['flags']['xslt_app'] = false;
+
+ $org_id = phpgw::get_var('orgid');
+ $returnHTML = "<option value='0'>Ingen aktivitet valgt</option>";
+ if ($org_id) {
+ $activities = $this->so_activity->get(null, null, 'title', true, null,
null, array('activity_state' => 3, 'activity_org' => $org_id));
+ foreach ($activities as $act) {
+ if (isset($act)) {
+ //$res_g = $group->serialize();
+ $activity_html[] = "<option value='" . $act->get_id() . "'>" .
$act->get_title() . "</option>";
+ }
+ }
+ $html = implode(' ', $activity_html);
+ $returnHTML = $returnHTML . ' ' . $html;
+ }
+
+
+ return $returnHTML;
+ }
+
+}
Modified: trunk/activitycalendarfrontend/templates/base/activity.php
===================================================================
--- trunk/activitycalendarfrontend/templates/base/activity.php 2012-08-31
05:52:26 UTC (rev 9941)
+++ trunk/activitycalendarfrontend/templates/base/activity.php 2012-08-31
07:42:36 UTC (rev 9942)
@@ -1,170 +1,172 @@
<?php
- //include common logic for all templates
+//include common logic for all templates
// include("common.php");
- $act_so = activitycalendar_soactivity::get_instance();
- $contpers_so = activitycalendar_socontactperson::get_instance();
+$act_so = activitycalendar_soactivity::get_instance();
+$contpers_so = activitycalendar_socontactperson::get_instance();
?>
<div class="yui-content">
- <div id="details">
- <?php if($message){?>
- <div class="success">
- <?php echo $message;?>
- </div>
- <?php }else if($error){?>
- <div class="error">
- <?php echo $error;?>
- </div>
- <?php }?>
- </div>
- <DIV class="pageTop">
- <h1><?php echo lang('activity') ?></h1>
- </DIV>
- <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">
- <div class="form-buttons">
- <?php
- if ($change_request) {?>
- <input type="submit" name="activity_ok"
value="<?php echo lang('activity_ok')?>" />
- <input type="submit" name="change_request"
value="<?php echo lang('change_activity')?>" />
- <?php }
- ?>
- </div>
- <FIELDSET title="Hva">
- <LEGEND>Hva</LEGEND>
- <dt>
- <label for="title"><?php echo
lang('activity_title') ?></label>
- </dt>
- <dd>
- <?php echo $activity->get_title();?>
- </dd>
- <dt>
- <label for="description"><?php echo
lang('description') ?></label>
- </dt>
- <dd>
- <?php echo
$activity->get_description(); ?>
- </dd>
-
- <dt>
- <label for="category"><?php echo
lang('category') ?></label>
- </dt>
- <dd>
- <?php
- if($activity->get_category()){
- echo
$act_so->get_category_name($activity->get_category());
- }
- ?>
- </dd>
- </FIELDSET>
- <FIELDSET id="hvem"><legend>For hvem</legend>
- <dt>
- <label for="target"><?php echo
lang('target') ?></label>
- </dt>
- <dd>
- <?php
- if($activity->get_target()){
- $current_target_ids =
$activity->get_target();
-
$current_target_id_array=explode(",", $current_target_ids);
-
foreach($current_target_id_array as $curr_target)
- {
- echo
$act_so->get_target_name($curr_target).'<br/>';
- }
- }
- ?>
- </dd>
- <dt>
- <input type="checkbox"
name="special_adaptation" id="special_adaptation"<?php echo
$activity->get_special_adaptation() ? ' checked="checked"' : '' ?>
disabled="disabled" /><label for="special_adaptation"><?php echo
lang('special_adaptation') ?></label>
- </dt>
- </FIELDSET>
- <FIELDSET title="hvor">
- <LEGEND>Hvor og når</LEGEND>
- <?php if($activity->get_internal_arena()) { ?>
- <dt>
- <label for="arena"><?php echo
lang('building') ?></label>
- </dt>
- <dd>
- <?php echo
activitycalendar_soarena::get_instance()->get_building_name($activity->get_internal_arena());
?>
- </dd>
- <?php }?>
- <?php if($activity->get_arena()) { ?>
- <dt>
- <label for="arena"><?php echo
lang('arena') ?></label>
- </dt>
- <dd>
- <?php echo
activitycalendar_soarena::get_instance()->get_arena_name($activity->get_arena());
?>
- </dd>
- <?php } ?>
- <dt>
- <label for="district"><?php echo
lang('district') ?></label>
- </dt>
- <dd>
- <?php
- if($activity->get_district()){
- $current_district_ids =
$activity->get_district();
-
$current_district_id_array=explode(",", $current_district_ids);
-
foreach($current_district_id_array as $curr_district)
- {
- echo
$act_so->get_district_name($curr_district).'<br/>';
- }
- }
- ?>
- </dd>
- <dt>
- <label for="time"><?php echo
lang('time') ?></label>
- </dt>
- <dd>
- <?php echo $activity->get_time();?>
- </dd>
- </FIELDSET>
- <FIELDSET id="arr">
- <legend>Arrangør</legend>
- <dd>
- <?php echo $organization->get_name();?>
- <?php if(!$change_request)
- {
- if(!$activity->get_new_org()){?>
- <a
href="index.php?menuaction=activitycalendarfrontend.uiactivity.edit_organization_values&organization_id=<?php
echo $organization->get_id();?>" target="_blank"><?php echo
lang('edit_organization');?></a>
- <?php }
- }?>
- </dd>
- <br/>
- <LEGEND>Kontaktperson</LEGEND>
- <dt>
- <?php
if($activity->get_contact_person_1()) { ?>
- <label for="contact_person_1"><?php
echo lang('contact_person') ?></label>
- <?php } ?>
- </dt>
- <dd>
- <label for="contact1_name">Navn</label>
- <?php echo
isset($contact1)?$contact1->get_name():''?><br/>
- <label
for="contact1_phone">Telefon</label>
- <?php echo
isset($contact1)?$contact1->get_phone():''?><br/>
- <label
for="contact1_mail">E-post</label>
- <?php echo
isset($contact1)?$contact1->get_email():''?>
- </dd>
- </FIELDSET>
- <FIELDSET>
- <BR>
- <dt>
- <LABEL for="office">Kulturkontor</label>
- </dt>
- <dd>
- <?php
- if($activity->get_office()){
- echo
$act_so->get_office_name($activity->get_office());
- }
- ?>
- </dd>
- </FIELDSET>
- <br/><br/>
- <div class="form-buttons">
- <?php
- if ($change_request) {?>
- <input type="submit" name="activity_ok"
value="<?php echo lang('activity_ok')?>" />
- <input type="submit" name="change_request"
value="<?php echo lang('change_activity')?>" />
- <?php }
- ?>
- </div>
- </dl>
- </form>
+ <div id="details">
+ <?php if ($message) { ?>
+ <div class="success">
+ <?php echo $message; ?>
+ </div>
+ <?php } else if ($error) { ?>
+ <div class="error">
+ <?php echo $error; ?>
+ </div>
+ <?php } ?>
+ </div>
+ <DIV class="pageTop">
+ <h1><?php echo lang('activity') ?></h1>
+ </DIV>
+ <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">
+ <div class="form-buttons">
+ <?php if ($change_request) { ?>
+ <input type="submit" name="activity_ok" value="<?php echo
lang('activity_ok') ?>" />
+ <input type="submit" name="change_request" value="<?php echo
lang('change_activity') ?>" />
+<?php }
+?>
+ </div>
+ <FIELDSET title="Hva">
+ <LEGEND>Hva</LEGEND>
+ <dt>
+ <label for="title"><?php echo lang('activity_title') ?></label>
+ </dt>
+ <dd>
+ <?php echo $activity->get_title(); ?>
+ </dd>
+ <dt>
+ <label for="description"><?php echo lang('description') ?></label>
+ </dt>
+ <dd>
+ <?php echo $activity->get_description(); ?>
+ </dd>
+
+ <dt>
+ <label for="category"><?php echo lang('category') ?></label>
+ </dt>
+ <dd>
+ <?php
+ if ($activity->get_category()) {
+ echo $act_so->get_category_name($activity->get_category());
+ }
+ ?>
+ </dd>
+ </FIELDSET>
+ <FIELDSET id="hvem"><legend>For hvem</legend>
+ <dt>
+ <label for="target"><?php echo lang('target') ?></label>
+ </dt>
+ <dd>
+ <?php
+ if ($activity->get_target()) {
+ $current_target_ids = $activity->get_target();
+ $current_target_id_array = explode(",", $current_target_ids);
+ foreach ($current_target_id_array as $curr_target) {
+ echo $act_so->get_target_name($curr_target) . '<br/>';
+ }
+ }
+ ?>
+ </dd>
+ <dt>
+ <input type="checkbox" name="special_adaptation"
id="special_adaptation"<?php echo $activity->get_special_adaptation() ? '
checked="checked"' : '' ?> disabled="disabled" /><label
for="special_adaptation"><?php echo lang('special_adaptation') ?></label>
+ </dt>
+ </FIELDSET>
+ <FIELDSET title="hvor">
+ <LEGEND>Hvor og når</LEGEND>
+<?php if ($activity->get_internal_arena()) { ?>
+ <dt>
+ <label for="arena"><?php echo lang('building') ?></label>
+ </dt>
+ <dd>
+ <?php echo
activitycalendar_soarena::get_instance()->get_building_name($activity->get_internal_arena());
?>
+ </dd>
+<?php } ?>
+<?php if ($activity->get_arena()) { ?>
+ <dt>
+ <label for="arena"><?php echo lang('arena') ?></label>
+ </dt>
+ <dd>
+ <?php echo
activitycalendar_soarena::get_instance()->get_arena_name($activity->get_arena());
?>
+ </dd>
+<?php } ?>
+ <dt>
+ <label for="district"><?php echo lang('district') ?></label>
+ </dt>
+ <dd>
+ <?php
+ if ($activity->get_district()) {
+ $current_district_ids = $activity->get_district();
+ $current_district_id_array = explode(",", $current_district_ids);
+ foreach ($current_district_id_array as $curr_district) {
+ echo $act_so->get_district_name($curr_district) . '<br/>';
+ }
+ }
+ ?>
+ </dd>
+ <dt>
+ <label for="time"><?php echo lang('time') ?></label>
+ </dt>
+ <dd>
+<?php echo $activity->get_time(); ?>
+ </dd>
+ </FIELDSET>
+ <FIELDSET id="arr">
+ <legend>Arrangør</legend>
+ <dd>
+ <?php echo $organization->get_name(); ?>
+ <?php
+ if (!$change_request) {
+ if (!$activity->get_new_org()) {
+ ?>
+ <a
href="index.php?menuaction=activitycalendarfrontend.uiactivity.edit_organization_values&organization_id=<?php
echo $organization->get_id(); ?>" target="_blank"><?php echo
lang('edit_organization'); ?></a>
+ <?php }
+}
+?>
+ </dd>
+ <br/>
+ <LEGEND>Kontaktperson</LEGEND>
+ <dt>
+<?php if ($activity->get_contact_person_1()) { ?>
+ <label for="contact_person_1"><?php echo lang('contact_person')
?></label>
+ <?php } ?>
+ </dt>
+ <dd>
+ <label for="contact1_name">Navn</label>
+ <?php echo isset($contact1) ? $contact1->get_name() : '' ?><br/>
+ <label for="contact1_phone">Telefon</label>
+<?php echo isset($contact1) ? $contact1->get_phone() : '' ?><br/>
+ <label for="contact1_mail">E-post</label>
+<?php echo isset($contact1) ? $contact1->get_email() : '' ?>
+ </dd>
+ </FIELDSET>
+ <FIELDSET>
+ <BR>
+ <dt>
+ <LABEL for="office">Kulturkontor</LABEL>
+ </dt>
+ <dd>
+ <?php
+ if ($activity->get_office()) {
+ echo $act_so->get_office_name($activity->get_office());
+ }
+ ?>
+ </dd>
+ </FIELDSET>
+ <br/><br/>
+ <div class="form-buttons">
+ <?php if ($change_request) { ?>
+ <input type="submit" name="activity_ok" value="<?php echo
lang('activity_ok') ?>" />
+ <input type="submit" name="change_request" value="<?php echo
lang('change_activity') ?>" />
+<?php }
+?>
+ </div>
+ </dl>
+ </form>
</div>
\ No newline at end of file
Modified: trunk/activitycalendarfrontend/templates/base/activity_edit.php
===================================================================
--- trunk/activitycalendarfrontend/templates/base/activity_edit.php
2012-08-31 05:52:26 UTC (rev 9941)
+++ trunk/activitycalendarfrontend/templates/base/activity_edit.php
2012-08-31 07:42:36 UTC (rev 9942)
@@ -1,395 +1,392 @@
<?php
- //include common logic for all templates
+//include common logic for all templates
// include("common.php");
- $act_so = activitycalendar_soactivity::get_instance();
- $contpers_so = activitycalendar_socontactperson::get_instance();
+$act_so = activitycalendar_soactivity::get_instance();
+$contpers_so = activitycalendar_socontactperson::get_instance();
?>
<script type="text/javascript">
-function get_available_groups()
-{
- var org_id = document.getElementById('organization_id').value;
- var div_select = document.getElementById('group_select');
+ function get_available_groups()
+ {
+ var org_id = document.getElementById('organization_id').value;
+ var div_select = document.getElementById('group_select');
-<?php if($activity->get_group_id()){?>
- //url =
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_organization_groups&phpgw_return_as=json&orgid="
+ org_id + "&groupid=" + <?php echo $activity->get_group_id();?>;
- url = "<?php echo
$ajaxURL?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_organization_groups&phpgw_return_as=json&orgid="
+ org_id + "&groupid=" + <?php echo $activity->get_group_id();?>;
-<?php }else{?>
- //url =
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_organization_groups&phpgw_return_as=json&orgid="
+ org_id;
- url = "<?php echo
$ajaxURL?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_organization_groups&phpgw_return_as=json&orgid="
+ org_id;
-<?php }?>
+<?php if ($activity->get_group_id()) { ?>
+ //url =
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_organization_groups&phpgw_return_as=json&orgid="
+ org_id + "&groupid=" + <?php echo $activity->get_group_id(); ?>;
+ url = "<?php echo $ajaxURL
?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_organization_groups&phpgw_return_as=json&orgid="
+ org_id + "&groupid=" + <?php echo $activity->get_group_id(); ?>;
+<?php } else { ?>
+ //url =
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_organization_groups&phpgw_return_as=json&orgid="
+ org_id;
+ url = "<?php echo $ajaxURL
?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_organization_groups&phpgw_return_as=json&orgid="
+ org_id;
+<?php } ?>
- if(org_id != null && org_id == 'new_org')
- {
- //alert('new_org');
- document.getElementById('new_org').style.display = "block";
- document.getElementById('new_org_fields').style.display =
"block";
- document.getElementById('group_label').style.display = "none";
- document.getElementById('group_select').style.display = "none";
- }
- else if(org_id != null && org_id == 'change_org')
- {
- document.getElementById('new_org').style.display = "block";
- document.getElementById('new_org_fields').style.display =
"none";
- document.getElementById('change_org_fields').style.display =
"block";
- document.getElementById('group_label').style.display = "none";
- document.getElementById('group_select').style.display = "none";
- }
- else
- {
- document.getElementById('new_org').style.display = "none";
- document.getElementById('new_org_fields').style.display =
"none";
- document.getElementById('change_org_fields').style.display =
"none";
- var divcontent_start = "<select name=\"group_id\"
id=\"group_id\" onchange=\"javascript:checkNewGroup()\">";
- var divcontent_end = "</select>";
+ if(org_id != null && org_id == 'new_org')
+ {
+ //alert('new_org');
+ document.getElementById('new_org').style.display = "block";
+ document.getElementById('new_org_fields').style.display = "block";
+ document.getElementById('group_label').style.display = "none";
+ document.getElementById('group_select').style.display = "none";
+ }
+ else if(org_id != null && org_id == 'change_org')
+ {
+ document.getElementById('new_org').style.display = "block";
+ document.getElementById('new_org_fields').style.display = "none";
+ document.getElementById('change_org_fields').style.display = "block";
+ document.getElementById('group_label').style.display = "none";
+ document.getElementById('group_select').style.display = "none";
+ }
+ else
+ {
+ document.getElementById('new_org').style.display = "none";
+ document.getElementById('new_org_fields').style.display = "none";
+ document.getElementById('change_org_fields').style.display = "none";
+ var divcontent_start = "<select name=\"group_id\" id=\"group_id\"
onchange=\"javascript:checkNewGroup()\">";
+ var divcontent_end = "</select>";
- var callback = {
- success: function(response){
- div_select.innerHTML =
divcontent_start + JSON.parse(response.responseText) + divcontent_end;
- },
- failure: function(o) {
- alert("AJAX doesn't work");
//FAILURE
- }
- }
- var trans = YAHOO.util.Connect.asyncRequest('GET', url,
callback, null);
- }
-}
+ var callback = {
+ success: function(response){
+ div_select.innerHTML = divcontent_start +
JSON.parse(response.responseText) + divcontent_end;
+ },
+ failure: function(o) {
+ alert("AJAX doesn't work"); //FAILURE
+ }
+ }
+ var trans = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
+ }
+ }
-YAHOO.util.Event.onDOMReady(function()
-{
- get_available_groups();
-});
+ YAHOO.util.Event.onDOMReady(function()
+ {
+ get_available_groups();
+ });
-function checkNewGroup()
-{
- var group_selected = document.getElementById('group_id').value;
- if(group_selected == 'new_group')
- {
- document.getElementById('new_group').style.display = "block";
- document.getElementById('new_group_fields').style.display =
"block";
- }
- else
- {
- document.getElementById('new_group').style.display = "none";
- document.getElementById('new_group_fields').style.display =
"none";
- }
-}
+ function checkNewGroup()
+ {
+ var group_selected = document.getElementById('group_id').value;
+ if(group_selected == 'new_group')
+ {
+ document.getElementById('new_group').style.display = "block";
+ document.getElementById('new_group_fields').style.display = "block";
+ }
+ else
+ {
+ document.getElementById('new_group').style.display = "none";
+ document.getElementById('new_group_fields').style.display = "none";
+ }
+ }
-function get_address_search()
-{
- var address = document.getElementById('address').value;
- var div_address = document.getElementById('address_container');
- div_address.style.display="block";
+ function get_address_search()
+ {
+ var address = document.getElementById('address').value;
+ var div_address = document.getElementById('address_container');
+ div_address.style.display="block";
- //url =
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
- url = "<?php echo
$ajaxURL?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
+ //url =
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
+ url = "<?php echo $ajaxURL
?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
- var divcontent_start = "<select name=\"address_select\" id=\"address\"
size=\"5\" onChange='setAddressValue(this)'>";
- var divcontent_end = "</select>";
+ var divcontent_start = "<select name=\"address_select\" id=\"address\"
size=\"5\" onChange='setAddressValue(this)'>";
+ var divcontent_end = "</select>";
- var callback = {
- success: function(response){
- div_address.innerHTML =
divcontent_start + JSON.parse(response.responseText) + divcontent_end;
- },
- failure: function(o) {
- alert("AJAX doesn't work"); //FAILURE
- }
- }
- var trans = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
+ var callback = {
+ success: function(response){
+ div_address.innerHTML = divcontent_start +
JSON.parse(response.responseText) + divcontent_end;
+ },
+ failure: function(o) {
+ alert("AJAX doesn't work"); //FAILURE
+ }
+ }
+ var trans = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
-}
+ }
-function get_address_search_cp2()
-{
- var address = document.getElementById('contact2_address').value;
- var div_address = document.getElementById('contact2_address_container');
- div_address.style.display="block";
+ function get_address_search_cp2()
+ {
+ var address = document.getElementById('contact2_address').value;
+ var div_address = document.getElementById('contact2_address_container');
+ div_address.style.display="block";
- //url =
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
- url = "<?php echo
$ajaxURL?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
+ //url =
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
+ url = "<?php echo $ajaxURL
?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
- var divcontent_start = "<select name=\"contact2_address_select\"
id=\"address_cp2\" size=\"5\" onChange='setAddressValue(this)'>";
- var divcontent_end = "</select>";
+ var divcontent_start = "<select name=\"contact2_address_select\"
id=\"address_cp2\" size=\"5\" onChange='setAddressValue(this)'>";
+ var divcontent_end = "</select>";
- var callback = {
- success: function(response){
- div_address.innerHTML =
divcontent_start + JSON.parse(response.responseText) + divcontent_end;
- },
- failure: function(o) {
- alert("AJAX doesn't work"); //FAILURE
- }
- }
- var trans = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
+ var callback = {
+ success: function(response){
+ div_address.innerHTML = divcontent_start +
JSON.parse(response.responseText) + divcontent_end;
+ },
+ failure: function(o) {
+ alert("AJAX doesn't work"); //FAILURE
+ }
+ }
+ var trans = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
-}
+ }
-function setAddressValue(field)
-{
- if(field.name == 'contact2_address_select')
- {
- var address = document.getElementById('contact2_address');
- var div_address = document.getElementById('contact2_address_container');
+ function setAddressValue(field)
+ {
+ if(field.name == 'contact2_address_select')
+ {
+ var address = document.getElementById('contact2_address');
+ var div_address = document.getElementById('contact2_address_container');
- address.value=field.value;
- div_address.style.display="none";
- }
- else
- {
- var address = document.getElementById('address');
- var div_address = document.getElementById('address_container');
+ address.value=field.value;
+ div_address.style.display="none";
+ }
+ else
+ {
+ var address = document.getElementById('address');
+ var div_address = document.getElementById('address_container');
- address.value=field.value;
- div_address.style.display="none";
- }
-}
+ address.value=field.value;
+ div_address.style.display="none";
+ }
+ }
-function allOK()
-{
- if(document.getElementById('title').value == null ||
document.getElementById('title').value == '')
- {
- alert("Tittel må fylles ut!");
- return false;
- }
- if(document.getElementsByTagName('textarea')[0].value == null ||
document.getElementsByTagName('textarea')[0].value == '')
- {
- alert("Beskrivelse må fylles ut!");
- return false;
- }
- if(document.getElementById('category').value == null ||
document.getElementById('category').value == 0)
- {
- alert("Kategori må fylles ut!");
- return false;
- }
- if((document.getElementById('internal_arena_id').value == null ||
document.getElementById('internal_arena_id').value == 0))
- {
- alert("Lokale må fylles ut!");
- return false;
- }
- if(document.getElementById('time').value == null ||
document.getElementById('time').value == '')
- {
- alert("Dag og tid må fylles ut!");
- return false;
- }
- if(document.getElementById('contact_name').value == null ||
document.getElementById('contact_name').value == '')
- {
- alert("Navn på kontaktperson må fylles ut!");
- return false;
- }
- if(document.getElementById('contact_phone').value == null ||
document.getElementById('contact_phone').value == '')
- {
- alert("Telefonnummer til kontaktperson må fylles ut!");
- return false;
- }
- if(document.getElementById('contact_phone').value != null &&
document.getElementById('contact_phone').value.length < 8)
- {
- alert("Telefonnummer må inneholde minst 8 siffer!");
- return false;
- }
- if(document.getElementById('contact_mail').value == null ||
document.getElementById('contact_mail').value == '')
- {
- alert("E-postadresse til kontaktperson må fylles ut!");
- return false;
- }
- if(document.getElementById('contact_mail2').value == null ||
document.getElementById('contact_mail2').value == '')
- {
- alert("Begge felter for E-post må fylles ut!");
- return false;
- }
- if(document.getElementById('contact_mail').value !=
document.getElementById('contact_mail2').value)
- {
- alert("E-post må være den samme i begge felt!");
- return false;
- }
- if(document.getElementById('office').value == null ||
document.getElementById('office').value == 0)
- {
- alert("Hovedansvarlig kulturkontor må fylles ut!");
- return false;
- }
- else
- return true;
-}
+ function allOK()
+ {
+ if(document.getElementById('title').value == null ||
document.getElementById('title').value == '')
+ {
+ alert("Tittel må fylles ut!");
+ return false;
+ }
+ if(document.getElementsByTagName('textarea')[0].value == null ||
document.getElementsByTagName('textarea')[0].value == '')
+ {
+ alert("Beskrivelse må fylles ut!");
+ return false;
+ }
+ if(document.getElementById('category').value == null ||
document.getElementById('category').value == 0)
+ {
+ alert("Kategori må fylles ut!");
+ return false;
+ }
+ if((document.getElementById('internal_arena_id').value == null ||
document.getElementById('internal_arena_id').value == 0))
+ {
+ alert("Lokale må fylles ut!");
+ return false;
+ }
+ if(document.getElementById('time').value == null ||
document.getElementById('time').value == '')
+ {
+ alert("Dag og tid må fylles ut!");
+ return false;
+ }
+ if(document.getElementById('contact_name').value == null ||
document.getElementById('contact_name').value == '')
+ {
+ alert("Navn på kontaktperson må fylles ut!");
+ return false;
+ }
+ if(document.getElementById('contact_phone').value == null ||
document.getElementById('contact_phone').value == '')
+ {
+ alert("Telefonnummer til kontaktperson må fylles ut!");
+ return false;
+ }
+ if(document.getElementById('contact_phone').value != null &&
document.getElementById('contact_phone').value.length < 8)
+ {
+ alert("Telefonnummer må inneholde minst 8 siffer!");
+ return false;
+ }
+ if(document.getElementById('contact_mail').value == null ||
document.getElementById('contact_mail').value == '')
+ {
+ alert("E-postadresse til kontaktperson må fylles ut!");
+ return false;
+ }
+ if(document.getElementById('contact_mail2').value == null ||
document.getElementById('contact_mail2').value == '')
+ {
+ alert("Begge felter for E-post må fylles ut!");
+ return false;
+ }
+ if(document.getElementById('contact_mail').value !=
document.getElementById('contact_mail2').value)
+ {
+ alert("E-post må være den samme i begge felt!");
+ return false;
+ }
+ if(document.getElementById('office').value == null ||
document.getElementById('office').value == 0)
+ {
+ alert("Hovedansvarlig kulturkontor må fylles ut!");
+ return false;
+ }
+ else
+ return true;
+ }
</script>
<div class="yui-content">
- <div id="details">
-
- <?php if($message){?>
- <div class="success">
- <?php echo $message;?>
- </div>
- <?php }else if($error){?>
- <div class="error">
- <?php echo $error;?>
- </div>
- <?php }?>
- </div>
- <div class="pageTop">
- <h1><?php echo lang('activity') ?></h1>
- <div>
- <?php echo lang('required_fields')?>
- </div>
- </div>
- <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">
- <fieldset title="<?php echo lang('what')?>">
- <legend>Hva</legend>
- <dt>
- <label for="title"><?php echo
lang('activity_title') ?> (*) <a onclick="alert('<?php echo
lang('help_new_activity_title')?>'); return false;" href="#"><img alt="Hjelp"
src="/aktivitetsoversikt/images/hjelp.gif"></a></label>
- </dt>
- <dd>
- <input type="text" name="title"
id="title" value="<?php echo $activity->get_title() ?>" size="83"/>
- </dd>
- <DT>
- <LABEL for="org_description"><?php echo
lang('description')?> (*) <a onclick="alert('<?php echo
lang('help_new_activity_description')?>'); return false;" href="#"><img
alt="Hjelp" src="/aktivitetsoversikt/images/hjelp.gif"></a></LABEL></DT>
- <DD><TEXTAREA cols="80" rows="4" name="description"
id="description"><?php echo $activity->get_description() ?></TEXTAREA></DD>
- <dt>
- <label for="category"><?php echo
lang('category') ?> (*) <a onclick="alert('<?php echo
lang('help_new_activity_category')?>'); return false;" href="#"><img
alt="Hjelp" src="/aktivitetsoversikt/images/hjelp.gif"></a></label>
- </dt>
- <dd>
- <?php
- $current_category_id =
$activity->get_category();
- ?>
- <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>
- </dd>
- </fieldset>
- <fieldset id="hvem"><legend>For hvem</legend>
- <dt>
- <label for="target"><?php echo
lang('target') ?> (*) <a onclick="alert('<?php echo
lang('help_new_activity_target')?>'); return false;" href="#"><img alt="Hjelp"
src="/aktivitetsoversikt/images/hjelp.gif"></a>
- </label>
- </dt>
- <dd>
- <?php
- $current_target_ids =
$activity->get_target();
- $current_target_id_array=explode(",",
$current_target_ids);
- 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
- }
- ?>
- </dd>
- <dt>
- <input type="checkbox"
name="special_adaptation" id="special_adaptation" <?php echo
$activity->get_special_adaptation() ? ' checked="checked"' : '' ?>/>
- <label for="special_adaptation"><?php
echo lang('special_adaptation') ?></label>
- <a onclick="alert('<?php echo
lang('help_new_activity_spec_adapt')?>'); return false;" href="#"><img
alt="Hjelp" src="/aktivitetsoversikt/images/hjelp.gif"></a>
- </dt>
- </fieldset>
- <fieldset title="hvor">
- <LEGEND>Hvor og når</LEGEND>
- <dt>
- <br/>
- <label for="arena"><?php echo
lang('location') ?> (*) <a onclick="alert('<?php echo
lang('help_edit_activity_location')?>'); return false;" href="#"><img
alt="Hjelp" src="/aktivitetsoversikt/images/hjelp.gif"></a>
- </label>
- <br/>
- </dt>
- <dd>
- <?php
- $internal_arena_id =
$activity->get_internal_arena();
- $arena_id = $activity->get_arena();
- ?>
- <select name="internal_arena_id"
id="internal_arena_id" style="width: 200px;">
- <option
value="0">Lokale ikke valgt</option>
- <optgroup label="<?php
echo lang('building') ?>">
- <?php
- foreach($buildings as
$building_id => $building_name)
- {
-
if($internal_arena_id && $internal_arena_id == $building_id)
- $selected =
"selected";
- else
- $selected = "";
- echo "<option
value=\"i_{$building_id}\" {$selected}>".$building_name."</option>";
- }
- ?>
- </optgroup>
- <optgroup label="<?php
echo lang('external_arena') ?>">
- <?php
- foreach($arenas as
$arena)
- {
- if($arena_id &&
$arena_id == $arena->get_id())
- $selected =
"selected";
- else
- $selected = "";
- echo "<option
value=\"e_{$arena->get_id()}\" title=\"{$arena->get_arena_name()}\"
{$selected}>".$arena->get_arena_name()."</option>";
- }
- ?>
- </optgroup>
- </select>
- <BR>
- </dd>
- <dt>
- <label for="district"><?php echo
lang('district') ?> (*) <a onclick="alert('<?php echo
lang('help_new_activity_district')?>'); return false;" href="#"><img
alt="Hjelp" src="/aktivitetsoversikt/images/hjelp.gif"></a>
- </label>
- </dt>
- <dd>
- <?php
- $current_district_id =
$activity->get_district();
-
//$current_district_id_array=explode(",", $current_district_ids);
- foreach($districts as $d)
- {
- ?>
- <input name="district"
type="radio" value="<?php echo $d['part_of_town_id']?>" <?php echo
($d['part_of_town_id'] == $current_district_id) ? 'checked' : "" ?>/><?php echo
$d['name']?><br/>
- <?php
- }
- ?>
- </dd>
- <dt>
- <label for="time"><?php echo
lang('time') ?> (*) <a onclick="alert('<?php echo
lang('help_new_activity_time')?>'); return false;" href="#"><img alt="Hjelp"
src="/aktivitetsoversikt/images/hjelp.gif"></a>
- </label>
- </dt>
- <dd>
- <input type="text" name="time"
id="time" value="<?php echo $activity->get_time() ?>" size="80" />
- </dd>
- </fieldset>
- <FIELDSET id="arr">
- <LEGEND>Kontaktperson</LEGEND><BR>
- Kontaktperson for aktiviteten <a
onclick="alert('<?php echo lang('help_new_activity_contact_person')?>'); return
false;" href="#"><img alt="Hjelp"
src="/aktivitetsoversikt/images/hjelp.gif"></a><BR>
- <DT><LABEL for="contact_name">Navn
(*)</LABEL></DT>
- <DD><INPUT name="contact_name" id="contact_name"
size="80" type="text" value="<?php echo $contact1->get_name()?>"></DD>
- <DT><LABEL for="contact_phone">Telefon (*)</LABEL></DT>
- <DD><INPUT name="contact_phone" id="contact_phone"
type="text" value="<?php echo $contact1->get_phone()?>"></DD>
- <DT><LABEL for="contact_mail">E-post (*)</LABEL></DT>
- <DD><INPUT name="contact_mail" id="contact_mail"
size="50" type="text" value="<?php echo $contact1->get_email()?>"></DD>
- <DT><LABEL for="contact2_mail2">Gjenta e-post
(*)</LABEL></DT>
- <DD><INPUT name="contact_mail2" id="contact_mail2"
size="50" type="text" value="<?php echo $contact1->get_email()?>"></DD>
- </FIELDSET>
- <FIELDSET>
- <BR>
- <DT><LABEL for="office">Hvilket kulturkontor skal motta
registreringen (*) <a onclick="alert('<?php echo
lang('help_new_activity_office')?>'); return false;" href="#"><img alt="Hjelp"
src="/aktivitetsoversikt/images/hjelp.gif"></a></LABEL></DT>
- <dd>
- <?php
- $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>
- </dd>
- </FIELDSET>
- <div class="form-buttons">
- <?php
- if ($editable) {?>
- <input type="submit"
name="save_activity" value="<?php echo lang('save')?>" onclick="return
allOK();"/>
- <?php }
- ?>
- </div>
- </dl>
- </form>
- </div>
+ <div id="details">
+
+ <?php if ($message) { ?>
+ <div class="success">
+ <?php echo $message; ?>
+ </div>
+ <?php } else if ($error) { ?>
+ <div class="error">
+ <?php echo $error; ?>
+ </div>
+ <?php } ?>
+ </div>
+ <div class="pageTop">
+ <h1><?php echo lang('activity') ?></h1>
+ <div>
+ <?php echo lang('required_fields') ?>
+ </div>
+ </div>
+ <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">
+ <fieldset title="<?php echo lang('what') ?>">
+ <legend>Hva</legend>
+ <dt>
+ <label for="title"><?php echo lang('activity_title') ?> (*) <a
onclick="alert('<?php echo lang('help_new_activity_title') ?>'); return false;"
href="#"><img alt="Hjelp"
src="/aktivitetsoversikt/images/hjelp.gif"></a></label>
+ </dt>
+ <dd>
+ <input type="text" name="title" id="title" value="<?php echo
$activity->get_title() ?>" size="83"/>
+ </dd>
+ <DT>
+ <LABEL for="org_description"><?php echo lang('description') ?> (*)
<a onclick="alert('<?php echo lang('help_new_activity_description') ?>');
return false;" href="#"><img alt="Hjelp"
src="/aktivitetsoversikt/images/hjelp.gif"></a></LABEL></DT>
+ <DD><TEXTAREA cols="80" rows="4" name="description"
id="description"><?php echo $activity->get_description() ?></TEXTAREA></DD>
+ <dt>
+ <label for="category"><?php echo lang('category') ?> (*) <a
onclick="alert('<?php echo lang('help_new_activity_category') ?>'); return
false;" href="#"><img alt="Hjelp"
src="/aktivitetsoversikt/images/hjelp.gif"></a></label>
+ </dt>
+ <dd>
+ <?php
+ $current_category_id = $activity->get_category();
+ ?>
+ <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>
+ </dd>
+ </fieldset>
+ <fieldset id="hvem"><legend>For hvem</legend>
+ <dt>
+ <label for="target"><?php echo lang('target') ?> (*) <a
onclick="alert('<?php echo lang('help_new_activity_target') ?>'); return
false;" href="#"><img alt="Hjelp"
src="/aktivitetsoversikt/images/hjelp.gif"></a>
+ </label>
+ </dt>
+ <dd>
+ <?php
+ $current_target_ids = $activity->get_target();
+ $current_target_id_array = explode(",", $current_target_ids);
+ 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
+ }
+ ?>
+ </dd>
+ <dt>
+ <input type="checkbox" name="special_adaptation"
id="special_adaptation" <?php echo $activity->get_special_adaptation() ? '
checked="checked"' : '' ?>/>
+ <label for="special_adaptation"><?php echo
lang('special_adaptation') ?></label>
+ <a onclick="alert('<?php echo lang('help_new_activity_spec_adapt')
?>'); return false;" href="#"><img alt="Hjelp"
src="/aktivitetsoversikt/images/hjelp.gif"></a>
+ </dt>
+ </fieldset>
+ <fieldset title="hvor">
+ <LEGEND>Hvor og når</LEGEND>
+ <dt>
+ <br/>
+ <label for="arena"><?php echo lang('location') ?> (*) <a
onclick="alert('<?php echo lang('help_edit_activity_location') ?>'); return
false;" href="#"><img alt="Hjelp"
src="/aktivitetsoversikt/images/hjelp.gif"></a>
+ </label>
+ <br/>
+ </dt>
+ <dd>
+ <?php
+ $internal_arena_id = $activity->get_internal_arena();
+ $arena_id = $activity->get_arena();
+ ?>
+ <select name="internal_arena_id" id="internal_arena_id"
style="width: 200px;">
+ <option value="0">Lokale ikke valgt</option>
+ <optgroup label="<?php echo lang('building') ?>">
+ <?php
+ foreach ($buildings as $building_id => $building_name) {
+ if ($internal_arena_id && $internal_arena_id == $building_id)
+ $selected = "selected";
+ else
+ $selected = "";
+ echo "<option value=\"i_{$building_id}\" {$selected}>" .
$building_name . "</option>";
+ }
+ ?>
+ </optgroup>
+ <optgroup label="<?php echo lang('external_arena') ?>">
+ <?php
+ foreach ($arenas as $arena) {
+ if ($arena_id && $arena_id == $arena->get_id())
+ $selected = "selected";
+ else
+ $selected = "";
+ echo "<option value=\"e_{$arena->get_id()}\"
title=\"{$arena->get_arena_name()}\" {$selected}>" . $arena->get_arena_name() .
"</option>";
+ }
+ ?>
+ </optgroup>
+ </select>
+ <BR>
+ </dd>
+ <dt>
+ <label for="district"><?php echo lang('district') ?> (*) <a
onclick="alert('<?php echo lang('help_new_activity_district') ?>'); return
false;" href="#"><img alt="Hjelp"
src="/aktivitetsoversikt/images/hjelp.gif"></a>
+ </label>
+ </dt>
+ <dd>
+ <?php
+ $current_district_id = $activity->get_district();
+ //$current_district_id_array=explode(",", $current_district_ids);
+ foreach ($districts as $d) {
+ ?>
+ <input name="district" type="radio" value="<?php echo
$d['part_of_town_id'] ?>" <?php echo ($d['part_of_town_id'] ==
$current_district_id) ? 'checked' : "" ?>/><?php echo $d['name'] ?><br/>
+ <?php
+ }
+ ?>
+ </dd>
+ <dt>
+ <label for="time"><?php echo lang('time') ?> (*) <a
onclick="alert('<?php echo lang('help_new_activity_time') ?>'); return false;"
href="#"><img alt="Hjelp" src="/aktivitetsoversikt/images/hjelp.gif"></a>
+ </label>
+ </dt>
+ <dd>
+ <input type="text" name="time" id="time" value="<?php echo
$activity->get_time() ?>" size="80" />
+ </dd>
+ </fieldset>
+ <FIELDSET id="arr">
+ <LEGEND>Kontaktperson</LEGEND><BR>
+ Kontaktperson for aktiviteten <a onclick="alert('<?php echo
lang('help_new_activity_contact_person') ?>'); return false;" href="#"><img
alt="Hjelp" src="/aktivitetsoversikt/images/hjelp.gif"></a><BR>
+ <DT><LABEL for="contact_name">Navn (*)</LABEL></DT>
+ <DD><INPUT name="contact_name" id="contact_name" size="80" type="text"
value="<?php echo $contact1->get_name() ?>"></DD>
+ <DT><LABEL for="contact_phone">Telefon (*)</LABEL></DT>
+ <DD><INPUT name="contact_phone" id="contact_phone" type="text"
value="<?php echo $contact1->get_phone() ?>"></DD>
+ <DT><LABEL for="contact_mail">E-post (*)</LABEL></DT>
+ <DD><INPUT name="contact_mail" id="contact_mail" size="50" type="text"
value="<?php echo $contact1->get_email() ?>"></DD>
+ <DT><LABEL for="contact2_mail2">Gjenta e-post (*)</LABEL></DT>
+ <DD><INPUT name="contact_mail2" id="contact_mail2" size="50"
type="text" value="<?php echo $contact1->get_email() ?>"></DD>
+ </FIELDSET>
+ <FIELDSET>
+ <BR>
+ <DT><LABEL for="office">Hvilket kulturkontor skal motta registreringen
(*) <a onclick="alert('<?php echo lang('help_new_activity_office') ?>'); return
false;" href="#"><img alt="Hjelp"
src="/aktivitetsoversikt/images/hjelp.gif"></a></LABEL></DT>
+ <dd>
+ <?php
+ $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>
+ </dd>
+ </FIELDSET>
+ <div class="form-buttons">
+<?php if ($editable) { ?>
+ <input type="submit" name="save_activity" value="<?php echo
lang('save') ?>" onclick="return allOK();"/>
+ <?php }
+ ?>
+ </div>
+ </dl>
+ </form>
+</div>
</div>
\ No newline at end of file
Modified: trunk/activitycalendarfrontend/templates/base/activity_edit_step_1.php
===================================================================
--- trunk/activitycalendarfrontend/templates/base/activity_edit_step_1.php
2012-08-31 05:52:26 UTC (rev 9941)
+++ trunk/activitycalendarfrontend/templates/base/activity_edit_step_1.php
2012-08-31 07:42:36 UTC (rev 9942)
@@ -1,86 +1,85 @@
<?php ?>
<script type="text/javascript">
-function isOK()
-{
- if(document.getElementById('activity_id').value == null ||
document.getElementById('activity_id').value == '' ||
document.getElementById('activity_id').value == 0)
- {
- alert("Du må velge en aktivitet som skal endres!");
- return false;
- }
- else
- {
- return true;
- }
-}
-function get_activities()
-{
- var org_id = document.getElementById('organization_id').value;
- var div_select = document.getElementById('activity_select');
+ function isOK()
+ {
+ if(document.getElementById('activity_id').value == null ||
document.getElementById('activity_id').value == '' ||
document.getElementById('activity_id').value == 0)
+ {
+ alert("Du må velge en aktivitet som skal endres!");
+ return false;
+ }
+ else
+ {
+ return true;
+ }
+ }
+ function get_activities()
+ {
+ var org_id = document.getElementById('organization_id').value;
+ var div_select = document.getElementById('activity_select');
- url = "<?php echo
$ajaxURL?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_organization_activities&phpgw_return_as=json&orgid="
+ org_id;
+ url = "<?php echo $ajaxURL
?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_organization_activities&phpgw_return_as=json&orgid="
+ org_id;
-var divcontent_start = "<select name=\"activity_id\" id=\"activity_id\">";
-var divcontent_end = "</select>";
+ var divcontent_start = "<select name=\"activity_id\" id=\"activity_id\">";
+ var divcontent_end = "</select>";
- var callback = {
- success: function(response){
- div_select.innerHTML = divcontent_start
+ JSON.parse(response.responseText) + divcontent_end;
- },
- failure: function(o) {
- alert("AJAX doesn't work"); //FAILURE
- }
- }
- var trans = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
+ var callback = {
+ success: function(response){
+ div_select.innerHTML = divcontent_start +
JSON.parse(response.responseText) + divcontent_end;
+ },
+ failure: function(o) {
+ alert("AJAX doesn't work"); //FAILURE
+ }
+ }
+ var trans = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
-}
+ }
-YAHOO.util.Event.onDOMReady(function()
-{
- get_activities();
-});
+ YAHOO.util.Event.onDOMReady(function()
+ {
+ get_activities();
+ });
</script>
<div class="yui-content" style="width: 100%;">
- <div class="pageTop">
- <h1><?php echo lang('edit_activity');?></h1>
- <form action="#" method="post">
- <dl class="proplist-col" style="width: 200%">
- <dt>
- <?php if($message){?>
- <?php echo $message;?>
- <?php }else{?>
- <?php echo
lang('activity_edit_helptext_step1')?><br/><br/>
- <?php }?>
- </dt>
- <?php if(!$message){?>
- <dd>
- <select name="organization_id"
id="organization_id" onchange="javascript: get_activities();">
- <option value="">Ingen organisasjon
valgt</option>
- <?php
- foreach($organizations as $organization)
- {
- echo "<option
value=\"{$organization->get_id()}\">".$organization->get_name()."</option>";
- }
- ?>
- </select>
- </dd>
- <dt>
-
- </dt>
- <dd>
- <div id="activity_select">
- <select name="activity_id"
id="activity_id">
- <option value="0">Ingen
aktivitet valgt</option>
- </select>
- </div>
- <br/><br/>
- </dd>
- <div class="form-buttons">
- <input type="submit" name="step_1" value="<?php
echo lang('send_change_request') ?>" onclick="return isOK();"/>
- </div>
- <?php }?>
- </dl>
-
- </form>
- </div>
+ <div class="pageTop">
+ <h1><?php echo lang('edit_activity'); ?></h1>
+ <form action="#" method="post">
+ <dl class="proplist-col" style="width: 200%">
+ <dt>
+ <?php if ($message) { ?>
+ <?php echo $message; ?>
+ <?php } else { ?>
+ <?php echo lang('activity_edit_helptext_step1') ?><br/><br/>
+ <?php } ?>
+ </dt>
+ <?php if (!$message) { ?>
+ <dd>
+ <select name="organization_id" id="organization_id"
onchange="javascript: get_activities();">
+ <option value="">Ingen organisasjon valgt</option>
+ <?php
+ foreach ($organizations as $organization) {
+ echo "<option value=\"{$organization->get_id()}\">" .
$organization->get_name() . "</option>";
+ }
+ ?>
+ </select>
+ </dd>
+ <dt>
+
+ </dt>
+ <dd>
+ <div id="activity_select">
+ <select name="activity_id" id="activity_id">
+ <option value="0">Ingen aktivitet valgt</option>
+ </select>
+ </div>
+ <br/><br/>
+ </dd>
+ <div class="form-buttons">
+ <input type="submit" name="step_1" value="<?php echo
lang('send_change_request') ?>" onclick="return isOK();"/>
+ </div>
+ <?php } ?>
+ </dl>
+
+ </form>
+ </div>
</div>
\ No newline at end of file
Modified: trunk/activitycalendarfrontend/templates/base/activity_new.php
===================================================================
--- trunk/activitycalendarfrontend/templates/base/activity_new.php
2012-08-31 05:52:26 UTC (rev 9941)
+++ trunk/activitycalendarfrontend/templates/base/activity_new.php
2012-08-31 07:42:36 UTC (rev 9942)
@@ -1,440 +1,447 @@
<?php
- //include common logic for all templates
+//include common logic for all templates
// include("common.php");
- $act_so = activitycalendar_soactivity::get_instance();
- $contpers_so = activitycalendar_socontactperson::get_instance();
+$act_so = activitycalendar_soactivity::get_instance();
+$contpers_so = activitycalendar_socontactperson::get_instance();
?>
<script type="text/javascript">
-$(document).ready(function(){
+ $(document).ready(function(){
var text = document.getElementById("displayText");
//ele.hide();
$("#toggleText").hide();
text.innerHTML = "Ikke i listen? Registrer nytt lokale";
- });
+ });
-function toggle() {
- var ele = document.getElementById("toggleText");
- var text = document.getElementById("displayText");
- var arenahidden = document.getElementById("new_arena_hidden");
- if(ele.style.display == "block") {
- ele.style.display = "none";
- text.innerHTML = "Registrer nytt lokale";
- }
- else {
- ele.style.display = "block";
- text.innerHTML = "";
- arenahidden.value="new_arena";
- }
-}
+ function toggle() {
+ var ele = document.getElementById("toggleText");
+ var text = document.getElementById("displayText");
+ var arenahidden = document.getElementById("new_arena_hidden");
+ if(ele.style.display == "block") {
+ ele.style.display = "none";
+ text.innerHTML = "Registrer nytt lokale";
+ }
+ else {
+ ele.style.display = "block";
+ text.innerHTML = "";
+ arenahidden.value="new_arena";
+ }
+ }
-function showhide(id)
-{
+ function showhide(id)
+ {
if(id == "org")
{
- document.getElementById('orgf').style.display = "block";
- document.getElementById('no_orgf').style.display = "none";
+ document.getElementById('orgf').style.display = "block";
+ document.getElementById('no_orgf').style.display = "none";
}
else
{
- document.getElementById('orgf').style.display = "none";
- document.getElementById('no_orgf').style.display = "block";
+ document.getElementById('orgf').style.display = "none";
+ document.getElementById('no_orgf').style.display = "block";
}
-}
+ }
-function get_address_search()
-{
- var address = document.getElementById('address').value;
- var div_address = document.getElementById('address_container');
- div_address.style.display="block";
+ function get_address_search()
+ {
+ var address = document.getElementById('address').value;
+ var div_address = document.getElementById('address_container');
+ div_address.style.display="block";
- //url =
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
- url = "<?php echo
$ajaxURL?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
+ //url =
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
+ url = "<?php echo $ajaxURL
?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
-var divcontent_start = "<select name=\"address\" id=\"address\" size=\"5\"
onChange='setAddressValue(this)'>";
-var divcontent_end = "</select>";
+ var divcontent_start = "<select name=\"address\" id=\"address\" size=\"5\"
onChange='setAddressValue(this)'>";
+ var divcontent_end = "</select>";
- var callback = {
- success: function(response){
- div_address.innerHTML =
divcontent_start + JSON.parse(response.responseText) + divcontent_end;
- },
- failure: function(o) {
- alert("AJAX doesn't work"); //FAILURE
- }
- }
- var trans = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
+ var callback = {
+ success: function(response){
+ div_address.innerHTML = divcontent_start +
JSON.parse(response.responseText) + divcontent_end;
+ },
+ failure: function(o) {
+ alert("AJAX doesn't work"); //FAILURE
+ }
+ }
+ var trans = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
-}
+ }
-function get_address_search_arena()
-{
- var address = document.getElementById('arena_address').value;
- var div_address = document.getElementById('arena_address_container');
- div_address.style.display="block";
+ function get_address_search_arena()
+ {
+ var address = document.getElementById('arena_address').value;
+ var div_address = document.getElementById('arena_address_container');
+ div_address.style.display="block";
- //url =
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
- url = "<?php echo
$ajaxURL?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
+ //url =
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
+ url = "<?php echo $ajaxURL
?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
-var divcontent_start = "<select name=\"arena_address_select\"
id=\"arena_address\" size=\"5\" onChange='setAddressValue(this)'>";
-var divcontent_end = "</select>";
+ var divcontent_start = "<select name=\"arena_address_select\"
id=\"arena_address\" size=\"5\" onChange='setAddressValue(this)'>";
+ var divcontent_end = "</select>";
- var callback = {
- success: function(response){
- div_address.innerHTML =
divcontent_start + JSON.parse(response.responseText) + divcontent_end;
- },
- failure: function(o) {
- alert("AJAX doesn't work"); //FAILURE
- }
- }
- var trans = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
+ var callback = {
+ success: function(response){
+ div_address.innerHTML = divcontent_start +
JSON.parse(response.responseText) + divcontent_end;
+ },
+ failure: function(o) {
+ alert("AJAX doesn't work"); //FAILURE
+ }
+ }
+ var trans = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
-}
+ }
-function get_address_search_cp2()
-{
- var address = document.getElementById('contact2_address').value;
- var div_address = document.getElementById('contact2_address_container');
- div_address.style.display="block";
+ function get_address_search_cp2()
+ {
+ var address = document.getElementById('contact2_address').value;
+ var div_address = document.getElementById('contact2_address_container');
+ div_address.style.display="block";
- //url =
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
- url = "<?php echo
$ajaxURL?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
+ //url =
"/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
+ url = "<?php echo $ajaxURL
?>index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&phpgw_return_as=json&search="
+ address;
-var divcontent_start = "<select name=\"contact2_address_select\"
id=\"address_cp2\" size=\"5\" onChange='setAddressValue(this)'>";
-var divcontent_end = "</select>";
+ var divcontent_start = "<select name=\"contact2_address_select\"
id=\"address_cp2\" size=\"5\" onChange='setAddressValue(this)'>";
+ var divcontent_end = "</select>";
- var callback = {
- success: function(response){
- div_address.innerHTML =
divcontent_start + JSON.parse(response.responseText) + divcontent_end;
- },
- failure: function(o) {
- alert("AJAX doesn't work"); //FAILURE
- }
- }
- var trans = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
+ var callback = {
+ success: function(response){
+ div_address.innerHTML = divcontent_start +
JSON.parse(response.responseText) + divcontent_end;
+ },
+ failure: function(o) {
+ alert("AJAX doesn't work"); //FAILURE
+ }
+ }
+ var trans = YAHOO.util.Connect.asyncRequest('GET', url, callback, null);
-}
+ }
-function setAddressValue(field)
-{
- if(field.name == 'contact2_address_select')
- {
- var address = document.getElementById('contact2_address');
- var div_address = document.getElementById('contact2_address_container');
+ function setAddressValue(field)
+ {
+ if(field.name == 'contact2_address_select')
+ {
+ var address = document.getElementById('contact2_address');
+ var div_address = document.getElementById('contact2_address_container');
- address.value=field.value;
- div_address.style.display="none";
- }
- else if(field.name == 'arena_address_select')
- {
- var address = document.getElementById('arena_address');
- var div_address = document.getElementById('arena_address_container');
+ address.value=field.value;
+ div_address.style.display="none";
+ }
+ else if(field.name == 'arena_address_select')
+ {
+ var address = document.getElementById('arena_address');
+ var div_address = document.getElementById('arena_address_container');
- address.value=field.value;
- div_address.style.display="none";
- }
- else
- {
- var address = document.getElementById('address');
- var div_address = document.getElementById('address_container');
+ address.value=field.value;
+ div_address.style.display="none";
+ }
+ else
+ {
+ var address = document.getElementById('address');
+ var div_address = document.getElementById('address_container');
- address.value=field.value;
- div_address.style.display="none";
- }
-}
+ address.value=field.value;
+ div_address.style.display="none";
+ }
+ }
-function allOK()
-{
- if(document.getElementById('title').value == null ||
document.getElementById('title').value == '')
- {
- alert("Navn på aktivitet må fylles ut!");
- return false;
- }
- if(document.getElementById('description').value == null ||
document.getElementById('description').value == '')
- {
- alert("Beskrivelse må fylles ut!");
- return false;
- }
- if(document.getElementById('category').value == null ||
document.getElementById('category').value == 0)
- {
- alert("Kategori må fylles ut!");
- return false;
- }
- var malgrupper = document.getElementsByName('target[]');
- var malgruppe_ok = false;
- for(i=0;i<malgrupper.length;i++)
- {
- if(!malgruppe_ok)
- {
- if(malgrupper[i].checked)
- {malgruppe_ok = true;}
- }
- }
- if(!malgruppe_ok)
- {
- alert("Målgruppe må fylles ut!");
- return false;
- }
- if((document.getElementById('internal_arena_id').value == null ||
document.getElementById('internal_arena_id').value == 0) &&
(document.getElementById('new_arena_hidden').value==null ||
document.getElementById('new_arena_hidden').value==''))
- {
- alert("Lokale må fylles ut!");
- return false;
- }
- var distrikter = document.getElementsByName('district');
- var distrikt_ok = false;
- for(i=0;i<distrikter.length;i++)
- {
- if(!distrikt_ok)
- {
- if(distrikter[i].checked)
- {distrikt_ok = true;}
- }
- }
- if(!distrikt_ok)
- {
- alert("Bydel må fylles ut!");
- return false;
- }
- if(document.getElementById('time').value == null ||
document.getElementById('time').value == '')
- {
- alert("Dag og tid må fylles ut!");
- return false;
- }
- if(document.getElementById('contact_name').value == null ||
document.getElementById('contact_name').value == '')
- {
- alert("Navn på kontaktperson må fylles ut!");
- return false;
- }
- if(document.getElementById('contact_phone').value == null ||
document.getElementById('contact_phone').value == '')
- {
- alert("Telefonnummer til kontaktperson må fylles ut!");
- return false;
- }
- if(document.getElementById('contact_phone').value != null &&
document.getElementById('contact_phone').value.length < 8)
- {
- alert("Telefonnummer må inneholde minst 8 siffer!");
- return false;
- }
- if(document.getElementById('contact_mail').value == null ||
document.getElementById('contact_mail').value == '')
- {
- alert("E-postadresse til kontaktperson må fylles ut!");
- return false;
- }
- if(document.getElementById('contact_mail2').value == null ||
document.getElementById('contact_mail2').value == '')
- {
- alert("Begge felter for E-post må fylles ut!");
- return false;
- }
- if(document.getElementById('contact_mail').value !=
document.getElementById('contact_mail2').value)
- {
- alert("E-post må være den samme i begge felt!");
- return false;
- }
- if(document.getElementById('office').value == null ||
document.getElementById('office').value == 0)
- {
- alert("Hovedansvarlig kulturkontor må fylles ut!");
- return false;
- }
- else
- return true;
-}
+ function allOK()
+ {
+ if(document.getElementById('title').value == null ||
document.getElementById('title').value == '')
+ {
+ alert("Navn på aktivitet må fylles ut!");
+ return false;
+ }
+ if(document.getElementById('description').value == null ||
document.getElementById('description').value == '')
+ {
+ alert("Beskrivelse må fylles ut!");
+ return false;
+ }
+ if(document.getElementById('category').value == null ||
document.getElementById('category').value == 0)
+ {
+ alert("Kategori må fylles ut!");
+ return false;
+ }
+ var malgrupper = document.getElementsByName('target[]');
+ var malgruppe_ok = false;
+ for(i=0;i<malgrupper.length;i++)
+ {
+ if(!malgruppe_ok)
+ {
+ if(malgrupper[i].checked)
+ {malgruppe_ok = true;}
+ }
+ }
+ if(!malgruppe_ok)
+ {
+ alert("Målgruppe må fylles ut!");
+ return false;
+ }
+ if((document.getElementById('internal_arena_id').value == null ||
document.getElementById('internal_arena_id').value == 0) &&
(document.getElementById('new_arena_hidden').value==null ||
document.getElementById('new_arena_hidden').value==''))
+ {
+ alert("Lokale må fylles ut!");
+ return false;
+ }
+ var distrikter = document.getElementsByName('district');
+ var distrikt_ok = false;
+ for(i=0;i<distrikter.length;i++)
+ {
+ if(!distrikt_ok)
+ {
+ if(distrikter[i].checked)
+ {distrikt_ok = true;}
+ }
+ }
+ if(!distrikt_ok)
+ {
+ alert("Bydel må fylles ut!");
+ return false;
+ }
+ if(document.getElementById('time').value == null ||
document.getElementById('time').value == '')
+ {
+ alert("Dag og tid må fylles ut!");
+ return false;
+ }
+ if(document.getElementById('contact_name').value == null ||
document.getElementById('contact_name').value == '')
+ {
+ alert("Navn på kontaktperson må fylles ut!");
+ return false;
+ }
+ if(document.getElementById('contact_phone').value == null ||
document.getElementById('contact_phone').value == '')
+ {
+ alert("Telefonnummer til kontaktperson må fylles ut!");
+ return false;
+ }
+ if(document.getElementById('contact_phone').value != null &&
document.getElementById('contact_phone').value.length < 8)
+ {
+ alert("Telefonnummer må inneholde minst 8 siffer!");
+ return false;
+ }
+ if(document.getElementById('contact_mail').value == null ||
document.getElementById('contact_mail').value == '')
+ {
+ alert("E-postadresse til kontaktperson må fylles ut!");
+ return false;
+ }
+ if(document.getElementById('contact_mail2').value == null ||
document.getElementById('contact_mail2').value == '')
+ {
+ alert("Begge felter for E-post må fylles ut!");
+ return false;
+ }
+ if(document.getElementById('contact_mail').value !=
document.getElementById('contact_mail2').value)
+ {
+ alert("E-post må være den samme i begge felt!");
+ return false;
+ }
+ if(document.getElementById('office').value == null ||
document.getElementById('office').value == 0)
+ {
+ alert("Hovedansvarlig kulturkontor må fylles ut!");
+ return false;
+ }
+ else
+ return true;
+ }
</script>
<div class="yui-content">
- <div id="details">
-
- <?php if($message){?>
- <div class="success">
- <?php echo $message;?>
- </div>
- <?php }else if($error){?>
- <div class="error">
- <?php echo $error;?>
- </div>
- <?php }?>
- </div>
- <div class="pageTop">
- <h1><?php echo lang('new_activity') ?></h1>
- <div>
- <?php echo lang('required_fields')?>
- </div>
- </div>
- <form action="#" method="post">
- <input type="hidden" name="id" value="<?php
if($activity->get_id()){ echo $activity->get_id(); } else { echo '0'; } ?>"/>
- <input type="hidden" name="organization_id"
value="<?php echo $organization->get_id() ?>"/>
- <?php if($new_organization){?>
- <input type="hidden" name="new_organization"
value="yes"/>
- <?php }?>
- <input type="hidden" name="new_arena_hidden"
id="new_arena_hidden" value=""/>
- <dl class="proplist-col">
- <fieldset title="<?php echo lang('what')?>">
- <legend>Hva</legend>
- <dt>
- <label for="title"><?php echo
lang('activity_title') ?> (*) <a onclick="alert('<?php echo
lang('help_new_activity_title')?>'); return false;" href="#"><img alt="Hjelp"
src="/aktivitetsoversikt/images/hjelp.gif"></a></label>
- </dt>
- <dd>
- <input type="text" name="title"
id="title" value="<?php echo $activity->get_title() ?>" size="83"/>
- </dd>
- <DT><LABEL for="org_description"><?php echo
lang('description')?> (*) <a onclick="alert('<?php echo
lang('help_new_activity_description')?>'); return false;" href="#"><img
alt="Hjelp" src="/aktivitetsoversikt/images/hjelp.gif"></a></LABEL></DT>
- <DD><TEXTAREA cols="80" rows="4"
name="description" id="description"></TEXTAREA></DD>
- <dt>
- <label for="category"><?php echo
lang('category') ?> (*) <a onclick="alert('<?php echo
lang('help_new_activity_category')?>'); return false;" href="#"><img
alt="Hjelp" src="/aktivitetsoversikt/images/hjelp.gif"></a></label>
- </dt>
- <dd>
- <?php
- $current_category_id =
$activity->get_category();
- ?>
- <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>
- </dd>
- </fieldset>
- <fieldset id="hvem"><legend>For hvem</legend>
- <dt>
- <label for="target"><?php echo
lang('target') ?> (*) <a onclick="alert('<?php echo
lang('help_new_activity_target')?>'); return false;" href="#"><img alt="Hjelp"
src="/aktivitetsoversikt/images/hjelp.gif"></a>
- </label>
- </dt>
- <dd>
- <?php
- $current_target_ids =
$activity->get_target();
@@ Diff output truncated at 153600 characters. @@
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9942] whitespace-fix (formatting),
Erik Holm-Larsen <=