/**
  * 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.socontactperson');
     }
     return self::$so;
 }
Exemplo n.º 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());
 }
Exemplo n.º 3
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 
 function send_mailnotification_to_group($contact_person, $subject, $body)
 {
     if (!is_object($GLOBALS['phpgw']->send)) {
         $GLOBALS['phpgw']->send = CreateObject('phpgwapi.send');
     }
     $config = $this->config_booking;
     $from = isset($config->config_data['email_sender']) && $config->config_data['email_sender'] ? $config->config_data['email_sender'] : "noreply<noreply@{$GLOBALS['phpgw_info']['server']['hostname']}>";
     //$from = "*****@*****.**";
     if (strlen(trim($body)) == 0) {
         return false;
     }
     $mailtoAddress = trim(activitycalendar_socontactperson::get_instance()->get_mailaddress_for_group_contact($contact_person->get_id()));
     //$mailtoaddress = "*****@*****.**";
     //var_dump($mailtoAddress.';'.$from.';'.$subject);
     if (strlen($mailtoAddress) > 0) {
         if (!$this->validator->check_email_address($mailtoAddress)) {
             $GLOBALS['phpgw']->log->error(array('text' => 'uiactivities::send_mailnotification_to_group() : not a valid address.: %1', 'p1' => $mailtoAddress, 'line' => __LINE__, 'file' => __FILE__));
             $msg = "Overskrift: \"{$subject}\"; Adressen feiler på validering:\"{$mailtoAddress}\"";
             _debug_array($msg);
             return false;
         }
         _debug_array($mailtoAddress);
         _debug_array($subject);
         if ($this->debug) {
             return false;
         }
         try {
             $GLOBALS['phpgw']->send->msg('email', $mailtoAddress, $subject, $body, '', '', '', $from, '', 'html');
         } catch (phpmailerException $e) {
             if ($e) {
                 $GLOBALS['phpgw']->log->error(array('text' => 'uiactivities::send_mailnotification_to_group() : error when trying to execute %1. Error: %2', 'p1' => 'send()', 'p2' => $e->getMessage(), 'line' => __LINE__, 'file' => __FILE__));
             }
         }
     }
 }
 public function show()
 {
     $GLOBALS['phpgw_info']['flags']['app_header'] .= '::' . lang('view');
     $id = (int) phpgw::get_var('id');
     $type = phpgw::get_var('type');
     $cancel_link = self::link(array('menuaction' => 'activitycalendar.uiorganization.changed_organizations'));
     $socontact = activitycalendar_socontactperson::get_instance();
     /*		if($type)
     		{
     			if(isset($_POST['edit_group'])) // The user has pressed the save button
     			{
     				$GLOBALS['phpgw']->redirect_link('/index.php', (array('menuaction' => 'activitycalendar.uiorganization.edit', 'id' => phpgw::get_var('id'), 'type' => phpgw::get_var('type'))));
     			}
     			$saved_OK = phpgw::get_var('saved_ok');
     			if($saved_OK)
     			{
     				$message = lang('group_saved_form');
     			}
     			//var_dump($type);
     			//$edit_link = self::link(array('menuaction' => 'activitycalendar.uiorganization.changed_organizations', 'id' => $id, 'type' => $type));
     			$so = activitycalendar_sogroup::get_instance();
     			$group_array = $so->get(null, null, null, null, null, null, array('id' => $id, 'changed_groups' => 'true'));
     			if(count($group_array) > 0){
     				$keys = array_keys($group_array);
     				$group = $group_array[$keys[0]];
     //				_debug_array($group);
     			}
     			$contact_persons = $socontact->get_local_contact_persons($group->get_id(), true);
     			$cp1 = $contact_persons[0];
     			$cp2 = $contact_persons[1];
     
     			$data = array
     			(
     				'group' 	=> $group,
     				'contactperson1' => $cp1,
     				'contactperson2' => $cp2,
     				'cancel_link' => $cancel_link,
     				'message' => $message,
     				'errorMsgs' => $errorMsgs,
     				'infoMsgs' => $infoMsgs
     			);
     			return $this->render('group.php', $data);
     		}
     		else
     		{*/
     //var_dump('org');
     if (isset($_POST['edit_organization'])) {
         $GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 'activitycalendar.uiorganization.edit', 'id' => phpgw::get_var('id')));
     }
     $saved_OK = phpgw::get_var('saved_ok');
     if ($saved_OK) {
         $message = lang('organization_saved_form');
     }
     //$edit_link = self::link(array('menuaction' => 'activitycalendar.uiorganization.changed_organizations', 'id' => $id));
     $so = activitycalendar_soorganization::get_instance();
     $org_array = $so->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]];
     }
     $contact_persons = $socontact->get_local_contact_persons($org->get_id());
     $cp1 = $contact_persons[0];
     $cp2 = $contact_persons[1];
     $data = array('organization' => $org, 'contactperson1' => $cp1, 'contactperson2' => $cp2, 'cancel_link' => $cancel_link, 'message' => $message, 'errorMsgs' => $errorMsgs, 'infoMsgs' => $infoMsgs);
     return $this->render('organization.php', $data);
     //}
 }