/**
  * Get a static reference to the storage object associated with this model object
  *
  * @return rental_soparty the storage object
  */
 public static function get_instance()
 {
     if (self::$so == null) {
         self::$so = CreateObject('activitycalendar.soactivity');
     }
     return self::$so;
 }
Пример #2
0
 public function serialize_for_export()
 {
     $so_org = activitycalendar_soorganization::get_instance();
     $date_format = $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
     if (isset($this->group_id) && $this->get_group_id() > 0) {
         if ($this->get_new_group()) {
             $group_name = activitycalendar_sogroup::get_instance()->get_group_name_local($this->get_group_id());
             $this->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_local_contact_persons($this->get_group_id(), true));
             $contact_1 = activitycalendar_socontactperson::get_instance()->get_group_contact_name_local($this->get_contact_person_1()->get_id());
             if ($this->get_contact_person_2()) {
                 $contact_2 = activitycalendar_socontactperson::get_instance()->get_group_contact_name_local($this->get_contact_person_2()->get_id());
             } else {
                 $contact_2 = null;
             }
             $desc = activitycalendar_sogroup::get_instance()->get_description_local($this->get_group_id());
         } else {
             $group_name = activitycalendar_sogroup::get_instance()->get_group_name($this->get_group_id());
             $this->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($this->get_group_id(), true));
             $contact_1 = activitycalendar_socontactperson::get_instance()->get_group_contact_name($this->get_contact_person_1()->get_id());
             if ($this->get_contact_person_2()) {
                 $contact_2 = activitycalendar_socontactperson::get_instance()->get_group_contact_name($this->get_contact_person_2()->get_id());
             } else {
                 $contact_2 = null;
             }
             $desc = activitycalendar_sogroup::get_instance()->get_description($this->get_group_id());
         }
         $o_id = $this->get_organization_id();
         if ($this->get_new_org()) {
             $org_name = $so_org->get_organization_name_local($o_id);
             $org_homepage = $so_org->get_organization_homepage_local($o_id);
         } else {
             $org_name = $so_org->get_organization_name($o_id);
             $org_homepage = $so_org->get_organization_homepage($o_id);
         }
     } else {
         if (isset($this->organization_id) && $this->get_organization_id() > 0) {
             if ($this->get_new_org()) {
                 $org_name = activitycalendar_soorganization::get_instance()->get_organization_name_local($this->get_organization_id());
                 $org_homepage = $so_org->get_organization_homepage_local($this->get_organization_id());
                 $this->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_local_contact_persons($this->get_organization_id()));
                 $contact_1 = activitycalendar_socontactperson::get_instance()->get_org_contact_name_local($this->get_contact_person_1()->get_id());
                 if ($this->get_contact_person_2()) {
                     $contact_2 = activitycalendar_socontactperson::get_instance()->get_org_contact_name_local($this->get_contact_person_2()->get_id());
                 } else {
                     $contact_2 = null;
                 }
                 $desc = activitycalendar_soorganization::get_instance()->get_description_local($this->get_organization_id());
             } else {
                 $org_name = activitycalendar_soorganization::get_instance()->get_organization_name($this->get_organization_id());
                 $org_homepage = $so_org->get_organization_homepage($this->get_organization_id());
                 $this->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($this->get_organization_id()));
                 $contact_1 = activitycalendar_socontactperson::get_instance()->get_org_contact_name($this->get_contact_person_1()->get_id());
                 if ($this->get_contact_person_2()) {
                     $contact_2 = activitycalendar_socontactperson::get_instance()->get_org_contact_name($this->get_contact_person_2()->get_id());
                 } else {
                     $contact_2 = null;
                 }
                 $desc = activitycalendar_soorganization::get_instance()->get_description($this->get_organization_id());
             }
         } else {
             $contact_1 = "";
             $contact_2 = "";
         }
     }
     if ($this->get_internal_arena() && $this->get_internal_arena() > 0) {
         $arena_name = activitycalendar_soarena::get_instance()->get_building_name($this->get_internal_arena());
     } else {
         $arena_name = activitycalendar_soarena::get_instance()->get_arena_name($this->get_arena());
     }
     $activity_district = $this->get_so()->get_district_name($this->get_district());
     $contact_person_1_name = $this->get_contact_person_1() ? $this->get_contact_person_1()->get_name() : '';
     $contact_person_1_phone = $this->get_contact_person_1() ? $this->get_contact_person_1()->get_phone() : '';
     $contact_person_1_mail = $this->get_contact_person_1() ? $this->get_contact_person_1()->get_email() : '';
     $contact_person_2_name = $this->get_contact_person_2() ? $this->get_contact_person_2()->get_name() : '';
     $contact_person_2_phone = $this->get_contact_person_2() ? $this->get_contact_person_2()->get_phone() : '';
     $contact_person_2_mail = $this->get_contact_person_2() ? $this->get_contact_person_2()->get_email() : '';
     return array('id' => $this->get_id(), 'title' => $this->get_title(), 'organization_id' => $org_name, 'organization_homepage' => $org_homepage, 'group_id' => $group_name, 'district' => $activity_district, 'office' => activitycalendar_soactivity::get_instance()->get_office_name($this->get_office()), 'category' => $this->get_so()->get_category_name($this->get_category()), 'state' => lang('state_' . $this->get_state()), 'description' => $desc, 'arena' => $arena_name, 'time' => $this->get_time(), 'contact_person_1_name' => $contact_person_1_name, 'contact_person_1_phone' => $contact_person_1_phone, 'contact_person_1_mail' => $contact_person_1_mail, 'contact_person_2_name' => $contact_person_2_name, 'contact_person_2_phone' => $contact_person_2_phone, 'contact_person_2_mail' => $contact_person_2_mail, 'special_adaptation' => $this->get_special_adaptation(), 'last_change_date' => $this->get_last_change_date() != NULL ? date($date_format, $this->get_last_change_date()) : '', 'frontend' => $this->get_frontend());
 }
Пример #3
0
					</select>
				<?php 
} else {
    if ($organization->get_change_type() == 'new') {
        if ($organization->get_district()) {
            ?>
							<?php 
            echo activitycalendar_soactivity::get_instance()->get_district_from_id($organization->get_district());
            ?>
					<?php 
        }
    } else {
        if ($organization->get_district() && is_numeric($organization->get_district())) {
            ?>
								<?php 
            echo activitycalendar_soactivity::get_instance()->get_district_from_id($organization->get_district());
            ?>
					<?php 
        } else {
            ?>
								<?php 
            echo $organization->get_district();
            ?>
					<?php 
        }
    }
    ?>
				<?php 
}
?>
				</dd>
Пример #4
0
<?php

//include common logic for all templates
//	include("common.php");
$act_so = activitycalendar_soactivity::get_instance();
$contpers_so = activitycalendar_socontactperson::get_instance();
?>

<script type="text/javascript">

	function checkNewGroup()
	{
		var group_selected = document.getElementById('group_id').value;
		if(group_selected == 'new_group')
		{
			document.getElementById('new_group_fields').style.display = "block";
		}
		else
		{
			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";

		//url = "/aktivby/registreringsskjema/ny/index.php?menuaction=activitycalendarfrontend.uiactivity.get_address_search&amp;phpgw_return_as=json&amp;search=" + address;
		url = "<?php 
 public function serialize()
 {
     $so_org = activitycalendar_soorganization::get_instance();
     $so_act = activitycalendar_soactivity::get_instance();
     return array('id' => $this->get_id(), 'name' => $this->get_name(), 'organization_number' => $this->get_organization_number(), 'district' => ($this->get_change_type() == "new" || $this->get_change_type() == "change") && $this->get_district() && is_numeric($this->get_district()) ? $so_act->get_district_from_id($this->get_district()) : $this->get_district(), 'description' => $this->get_description(), 'homepage' => $this->get_homepage(), 'email' => $this->get_email(), 'phone' => $this->get_phone(), 'address' => $this->get_address(), 'addressnumber' => $this->get_addressnumber(), 'zip_code' => $this->get_zip_code(), 'city' => $this->get_city(), 'show_in_portal' => $this->get_show_in_portal(), 'change_type' => lang($this->get_change_type()), 'transferred' => $this->get_transferred(), 'office' => $so_org->get_office_from_district($so_org->get_district_from_name($this->get_district())));
 }
 public function send_mail()
 {
     $c = createobject('phpgwapi.config', 'activitycalendarfrontend');
     $c->read();
     $config = $c->config_data;
     $mailBaseURL = $c->config_data['mailBaseURL'];
     $activity_id = (int) phpgw::get_var('activity_id');
     $activity = activitycalendar_soactivity::get_instance()->get_single($activity_id);
     $message_type = phpgw::get_var('message_type');
     if ($message_type) {
         //$subject = lang('mail_subject_update', $avtivity->get_id() . '-' . $activity->get_title(), $activity->get_link());
         $subject = lang('mail_subject_update');
         //$link_text = "http://www.bergen.kommune.no/aktivby/registreringsskjema/ny/?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}";
         //$link_text = "{$mailBaseURL}?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}";
         //$link_text = "http://www.bergen.kommune.no/aktivitetsoversikt/?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}";
         $link_text = "<a href='http://www.bergen.kommune.no/aktivitetsoversikt/?menuaction=activitycalendarfrontend.uiactivity.edit&amp;id={$activity->get_id()}&amp;secret={$activity->get_secret()}'>Rediger opplysninger for {$activity->get_title()}</a>";
         $office_name = activitycalendar_soactivity::get_instance()->get_office_name($activity->get_office());
         $office_id = $activity->get_office();
         if ($office_id == 1) {
             $office_id_new = 2;
         } else {
             if ($office_id == 2) {
                 $office_id_new = 1;
             } else {
                 $office_id_new = (int) $office_id;
             }
         }
         $office_footer = activitycalendar_soactivity::get_instance()->get_office_description($office_id_new);
         $body = lang('mail_body_update', $activity->get_title(), $link_text, $office_footer, $office_name);
     } else {
         $subject = "dette er en test";
         $body = "testmelding fra Aktivitetsoversikt";
     }
     //    	var_dump($subject);
     //    	var_dump($body);
     //    	var_dump($activity->get_organization_id() . " ; " . $activity->get_group_id());
     if ($activity->get_group_id() && $activity->get_group_id() > 0) {
         //$contact_person2 = activitycalendar_socontactperson::get_instance()->get_group_contact2($activity>get_group_id());
         $activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_group_id(), true));
         /*    		if($activity->get_contact_person_2() && $activity->get_contact_person_2()->get_email())
                         activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_2(), $subject, $body);
                 else */
         if ($activity->get_contact_person_1() && $activity->get_contact_person_1()->get_email()) {
             activitycalendar_uiactivities::send_mailnotification_to_group($activity->get_contact_person_1(), $subject, $body);
         }
     } else {
         if ($activity->get_organization_id() && $activity->get_organization_id() > 0) {
             //$contact_person2 = activitycalendar_socontactperson::get_instance()->get_oup_contact2($activity>get_group_id());
             $activity->set_contact_persons(activitycalendar_socontactperson::get_instance()->get_booking_contact_persons($activity->get_organization_id()));
             /*    		if($activity->get_contact_person_2() && $activity->get_contact_person_2()->get_email())
                                     activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_2(), $subject, $body);
                     else */
             if ($activity->get_contact_person_1() && $activity->get_contact_person_1()->get_email()) {
                 activitycalendar_uiactivities::send_mailnotification_to_organization($activity->get_contact_person_1(), $subject, $body);
             }
         }
     }
     $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 'activitycalendar.uiactivities.index', 'message' => 'E-post sendt'));
 }
 public function edit()
 {
     $GLOBALS['phpgw_info']['flags']['app_header'] .= '::' . lang('edit');
     $id = (int) phpgw::get_var('id');
     $type = phpgw::get_var('type');
     $cancel_link = self::link(array('menuaction' => 'activitycalendar.uiorganization.changed_organizations'));
     unset($org_info);
     unset($contact1);
     unset($contact2);
     $so_org = activitycalendar_soorganization::get_instance();
     $so_activity = activitycalendar_soactivity::get_instance();
     $so_contact = activitycalendar_socontactperson::get_instance();
     $org_array = $so_org->get(null, null, null, null, null, null, array('id' => $id, 'changed_orgs' => 'true'));
     if (count($org_array) > 0) {
         $keys = array_keys($org_array);
         $org = $org_array[$keys[0]];
     }
     //var_dump($org);
     $districts = $so_activity->get_districts();
     if (isset($_POST['store_organization'])) {
         $orgno = phpgw::get_var('orgno');
         $district = phpgw::get_var('org_district');
         if (isset($district) && is_numeric($district)) {
             //get district name before storing to booking
             $district_name = $so_activity->get_district_from_id($district);
         } else {
             $district_name = "";
         }
         $homepage = phpgw::get_var('homepage');
         $email = phpgw::get_var('email');
         $phone = phpgw::get_var('phone');
         $address = phpgw::get_var('address');
         $zip = phpgw::get_var('zip_code');
         $city = phpgw::get_var('city');
         //phpgw::get_var('address') . ' ' . phpgw::get_var('number') . ', ' . phpgw::get_var('postaddress');
         //$address_array = explode(",",$address_tmp);
         $desc = phpgw::get_var('org_description');
         $org_info = array();
         $org_info['name'] = $org->get_name();
         //new
         $orgno_tmp = $orgno;
         if (strlen($orgno_tmp) > 9) {
             $orgno_tmp = NULL;
         }
         $org_info['orgnr'] = $orgno_tmp;
         $org_info['homepage'] = $homepage;
         $org_info['phone'] = $phone;
         $org_info['email'] = $email;
         $org_info['description'] = $desc;
         $org_info['street'] = $address;
         $org_info['zip'] = $zip;
         $org_info['postaddress'] = $city;
         $org_info['activity_id'] = '';
         $org_info['district'] = $district_name;
         $contact1_id = phpgw::get_var('contact1_id');
         $contact2_id = phpgw::get_var('contact2_id');
         $contact1_name = phpgw::get_var('contact1_name');
         $contact1_phone = phpgw::get_var('contact1_phone');
         $contact1_email = phpgw::get_var('contact1_email');
         $contact2_name = phpgw::get_var('contact2_name');
         $contact2_phone = phpgw::get_var('contact2_phone');
         $contact2_email = phpgw::get_var('contact2_email');
         $new_org_id = $so_org->transfer_organization($org_info);
         if ($new_org_id) {
             //update activity with new org id
             //add contact persons to booking
             $contact1 = array();
             $contact1['name'] = $contact1_name;
             $contact1['phone'] = $contact1_phone;
             $contact1['mail'] = $contact1_email;
             $contact1['org_id'] = $new_org_id;
             $so_activity->add_contact_person_org($contact1);
             $message = lang('messages_saved_form');
             //get affected activities and update with new org id
             $update_activities = $so_activity->get_activities_for_update($id);
             //var_dump($update_activities);
             foreach ($update_activities as $act_id) {
                 $act = $so_activity->get_single($act_id);
                 $act->set_organization_id($new_org_id);
                 $act->set_new_org(false);
                 $so_activity->store($act);
             }
             //set local organization as stored
             $org->set_change_type("added");
             $org->set_transferred(true);
             $so_org->update_local($org);
         } else {
             $error = lang('messages_form_error');
         }
         $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 'activitycalendar.uidashboard.index'));
     }
     if (isset($_POST['reject_organization'])) {
         $reject_org_id = $id;
         if ($so_org->reject_organization($reject_org_id)) {
             $update_activities = $so_activity->get_activities_for_update($reject_org_id);
             //var_dump($update_activities);
             foreach ($update_activities as $act_id) {
                 $act = $so_activity->get_single($act_id);
                 $act->set_state(5);
                 $so_activity->store($act);
             }
         } else {
             $error = lang('messages_form_error');
         }
         $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 'activitycalendar.uidashboard.index'));
     }
     if (isset($_POST['reject_organization_update'])) {
         $reject_org_id = $id;
         $so_org->reject_organization($reject_org_id);
         $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 'activitycalendar.uidashboard.index'));
     } else {
         if (isset($_POST['update_organization'])) {
             $original_org_id = phpgw::get_var('original_org_id');
             $orgno = phpgw::get_var('orgno');
             $district = phpgw::get_var('org_district');
             if (isset($district) && is_numeric($district)) {
                 //get district name before storing to booking
                 $district_name = $so_activity->get_district_from_id($district);
             } else {
                 $district_name = "";
             }
             $homepage = phpgw::get_var('homepage');
             $email = phpgw::get_var('email');
             $phone = phpgw::get_var('phone');
             $address = phpgw::get_var('address');
             $zip = phpgw::get_var('zip_code');
             $city = phpgw::get_var('city');
             $desc = phpgw::get_var('org_description');
             $org_info = array();
             $org_info['name'] = $org->get_name();
             //new
             $orgno_tmp = $orgno;
             if (strlen($orgno_tmp) > 9) {
                 $orgno_tmp = NULL;
             }
             $org_info['orgnr'] = $orgno_tmp;
             $org_info['homepage'] = $homepage;
             $org_info['phone'] = $phone;
             $org_info['email'] = $email;
             $org_info['description'] = $desc;
             $org_info['street'] = $address;
             $org_info['zip_code'] = $zip;
             $org_info['city'] = $city;
             $org_info['activity_id'] = '';
             $org_info['district'] = $district_name;
             $org_info['orgid'] = $original_org_id;
             $contact1_id = phpgw::get_var('contact1_id');
             $contact2_id = phpgw::get_var('contact2_id');
             $contact1_name = phpgw::get_var('contact1_name');
             $contact1_phone = phpgw::get_var('contact1_phone');
             $contact1_email = phpgw::get_var('contact1_email');
             $contact2_name = phpgw::get_var('contact2_name');
             $contact2_phone = phpgw::get_var('contact2_phone');
             $contact2_email = phpgw::get_var('contact2_email');
             $so_org->update_organization($org_info);
             $so_activity->delete_contact_persons($original_org_id);
             //add contact persons to booking
             $contact1 = array();
             $contact1['name'] = $contact1_name;
             $contact1['phone'] = $contact1_phone;
             $contact1['mail'] = $contact1_email;
             $contact1['org_id'] = $original_org_id;
             $so_activity->add_contact_person_org($contact1);
             $contact2 = array();
             $contact2['name'] = $contact2_name;
             $contact2['phone'] = $contact2_phone;
             $contact2['mail'] = $contact_mail_2;
             $contact2['org_id'] = $original_org_id;
             $so_activity->add_contact_person_org($contact2);
             $message = lang('messages_saved_form');
             //set local organization as stored
             $org->set_change_type("added");
             $org->set_transferred(true);
             $so_org->update_local($org);
             $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 'activitycalendar.uidashboard.index'));
         }
     }
     $contact_persons = $so_contact->get_local_contact_persons($org->get_id());
     $cp1 = $contact_persons[0];
     $cp2 = $contact_persons[1];
     $data = array('organization' => $org, 'districts' => $districts, 'contactperson1' => $cp1, 'contactperson2' => $cp2, 'cancel_link' => $cancel_link, 'editable' => true, 'errorMsgs' => $errorMsgs, 'infoMsgs' => $infoMsgs);
     return $this->render('organization.php', $data);
 }
			<option value="all"><?php 
    echo lang('all');
    ?>
</option>
			<?php 
    foreach ($districts as $district) {
        echo "<option value=\"{$district['id']}\"" . ($user_office == $district['id'] ? 'selected' : '') . ">" . $district['name'] . "</option>";
    }
    ?>
		</select>
		<label class="toolbar_element_label" for="ctrl_toggle_activity_category"><?php 
    echo lang('category');
    ?>
</label>
		<?php 
    $categories = activitycalendar_soactivity::get_instance()->get_categories();
    ?>
		<select name="activity_category" id="<?php 
    echo $list_id;
    ?>
_ctrl_toggle_activity_category">
			<option value="all"><?php 
    echo lang('all');
    ?>
</option>
			<?php 
    foreach ($categories as $category) {
        echo "<option value=\"{$category->get_id()}\">" . $category->get_name() . "</option>";
    }
    ?>
		</select>
Пример #9
0
 protected function import_organizations()
 {
     $soactivity = activitycalendar_soactivity::get_instance();
     $datalines = $this->csvdata;
     $this->messages[] = "Read 'import_all.csv' file in " . (time() - $start_time) . " seconds";
     $this->messages[] = "'importfile.csv' contained " . count($datalines) . " lines";
     $db_activity = $soactivity->get_db();
     $db_activity->transaction_begin();
     foreach ($datalines as $data) {
         $activityOK = true;
         unset($activity_persons);
         unset($activity_description);
         unset($org_info);
         unset($contact_person);
         unset($contact1);
         unset($contact2);
         unset($contact3);
         unset($contact4);
         unset($new_org_id);
         $activity_id = $this->decode($data[0]);
         $org_name_tmp = $this->decode($data[1]);
         if (strlen($org_name_tmp) > 50) {
             $org_name_tmp = substr($org_name_tmp, 0, 49);
         }
         $org_email = $this->decode($data[5]);
         if (strlen($org_email) > 50) {
             $org_email = substr($org_email, 0, 49);
         }
         $org_phone = $this->decode($data[4]);
         if (strlen($org_phone) > 50) {
             $org_phone = substr($org_phone, 0, 49);
         }
         $contact_mail_2 = $this->decode($data[11]);
         if (strlen($contact_mail_2) > 50) {
             $contact_mail_2 = substr($contact_mail_2, 0, 49);
         }
         $contact1_name = $this->decode($data[3]);
         if (strlen($contact1_name) > 50) {
             $contact1_name = substr($contact1_name, 0, 49);
         }
         $contact1_phone = $this->decode($data[4]);
         if (strlen($contact1_phone) > 50) {
             $contact1_phone = substr($contact1_phone, 0, 49);
         }
         $contact2_name = $this->decode($data[7]);
         if (strlen($contact2_name) > 50) {
             $contact2_name = substr($contact2_name, 0, 49);
         }
         $contact2_phone = $this->decode($data[10]);
         if (strlen($contact2_phone) > 50) {
             $contact2_phone = substr($contact2_phone, 0, 49);
         }
         $activity = $soactivity->get_single($activity_id);
         $org_info = array();
         $org_info['name'] = $org_name_tmp;
         $org_info['homepage'] = $this->decode($data[6]);
         $org_info['phone'] = $org_phone;
         $org_info['email'] = $org_email;
         $org_info['description'] = $this->decode($data[2]);
         $org_info['street'] = $this->decode($data[8]);
         $org_info['zip'] = $this->decode($data[9]);
         $org_info['activity_id'] = "";
         $org_info['district'] = $this->decode($data[12]);
         $new_org_id = $soactivity->add_organization($org_info);
         $contact1 = array();
         $contact1['name'] = $contact1_name;
         $contact1['phone'] = $contact1_phone;
         $contact1['mail'] = $org_email;
         $contact1['org_id'] = $new_org_id;
         $soactivity->add_contact_person_org($contact1);
         $contact2 = array();
         $contact2['name'] = $contact2_name;
         $contact2['phone'] = $contact2_phone;
         $contact2['mail'] = $contact_mail_2;
         $contact2['org_id'] = $new_org_id;
         $soactivity->add_contact_person_org($contact2);
         $activity_persons = activitycalendar_soorganization::get_instance()->get_contacts($new_org_id);
         $activity_contact_person_2_address = $this->decode($data[8]);
         $activity_contact_person_2_zip = $this->decode($data[9]);
         if ($activity) {
             $activity->set_organization_id($new_org_id);
             //$activity->set_description($activity_description);
             $activity->set_contact_person_2_address($activity_contact_person_2_address);
             $activity->set_contact_person_2_zip($activity_contact_person_2_zip);
             if ($activity_persons) {
                 //set contact persons
                 $activity->set_contact_persons($activity_persons);
             }
             if ($soactivity->store($activity)) {
                 $this->messages[] = "Successfully updated activity: Title ({$activity->get_title()})";
             } else {
                 $this->errors[] = "Error updating activity: Title ({$activity->get_title()})";
                 $activityOK = false;
             }
         }
     }
     if ($activityOK) {
         $this->messages[] = "Imported activities. (" . (time() - $start_time) . " seconds)";
         $db_activity->transaction_commit();
         return true;
     } else {
         if (!$activityOK) {
             $this->messages[] = "Import of activities failed. (" . (time() - $start_time) . " seconds)";
         } else {
             $this->messages[] = "Import of activities/arenas failed. (" . (time() - $start_time) . " seconds)";
         }
         $db_activity->transaction_abort();
         return false;
     }
 }
Пример #10
0
echo ACTIVITYCALENDAR_IMAGE_PATH;
?>
images/32x32/actions/document-save.png" /> <?php 
echo lang('activity_import');
?>
</h1>

<div id="messageHolder"></div>

<form action="index.php?menuaction=activitycalendar.uiimport.index" method="post" enctype="multipart/form-data">
	<fieldset>
		<label for="file">Choose activities file:</label> <input type="file" name="file" id="file" />
		<label for="district">Location for the imported activities:</label>
		<select name="district" id="district">
			<?php 
$districts = activitycalendar_soactivity::get_instance()->select_district_list();
foreach ($districts as $district) {
    echo "<option value=\"{$district['id']}\">" . $district['name'] . "</option>";
}
?>
		</select>
		<input type="submit" name="importsubmit" value="<?php 
echo $button_label;
?>
" <?php 
if ($button_label == "Import done") {
    echo ' disabled="disabled"';
}
?>
 />