예제 #1
0
  public function testModifyParticipationStateMail() {
    $event = OBM_EventFactory::getInstance()->getById(1);
    $users = $event->get('user');
    $resources = $event->get('resource');
    $user = $users[0];
    $res = $resources[0];

    $user->set('state', 'NEEDS-ACTION');
    OBM_EventFactory::getInstance()->store($event,OBM_EventFactory::getInstance()->getById(1));
    $mailData = Stato_StaticTransport::getMailQ();
    $this->assertEquals('Participation updated on OBM: Title',$mailData[0]['subject']);
    $this->assertEquals("domainezz.com Admin <*****@*****.**>", $mailData[0]['to']);
    $this->assertContains("NEEDS-ACTION",$mailData[0]['content']);

    $user->set('state', 'DECLINED');
    OBM_EventFactory::getInstance()->store($event,OBM_EventFactory::getInstance()->getById(1));
    $mailData = Stato_StaticTransport::getMailQ();
    $this->assertEquals('Participation updated on OBM: Title',$mailData[1]['subject']);
    $this->assertEquals("domainezz.com Admin <*****@*****.**>", $mailData[1]['to']);
    $this->assertContains("DECLINED",$mailData[1]['content']);  

    $user->set('state', 'ACCEPTED');
    OBM_EventFactory::getInstance()->store($event,OBM_EventFactory::getInstance()->getById(1));
    $mailData = Stato_StaticTransport::getMailQ();
    $this->assertNull($mailData[2]);

    $res->set('state', 'DECLINED');
    OBM_EventFactory::getInstance()->store($event,OBM_EventFactory::getInstance()->getById(1));
    $mailData = Stato_StaticTransport::getMailQ();
    $this->assertEquals('Resource participation updated on OBM: Title',$mailData[2]['subject']);
    $this->assertEquals("domainezz.com Admin <*****@*****.**>", $mailData[2]['to']);
    $this->assertContains("DECLINED",$mailData[2]['content']);  

    $res->set('state', 'NEEDS-ACTION');
    OBM_EventFactory::getInstance()->store($event,OBM_EventFactory::getInstance()->getById(1));
    $mailData = Stato_StaticTransport::getMailQ();
    $this->assertEquals('Resource participation updated on OBM: Title',$mailData[3]['subject']);
    $this->assertEquals("domainezz.com Admin <*****@*****.**>", $mailData[3]['to']);
    $this->assertContains("NEEDS-ACTION",$mailData[3]['content']);  

    $res->set('state', 'ACCEPTED');
    OBM_EventFactory::getInstance()->store($event,OBM_EventFactory::getInstance()->getById(1));
    $mailData = Stato_StaticTransport::getMailQ();
    $this->assertNull($mailData[4]);
  }
예제 #2
0
  $calendar_user_objects = $calendar_entity['user'];
  $writable_calendars = run_query_writable_calendars($obm['uid'], array_values($calendar_user_objects));
  if (count($writable_calendars) > 0) {
    $default_writable_calendar = $writable_calendars[0];
  }
}

get_calendar_action();
update_calendar_action();
$perm->check_permissions($module, $action);

page_close();

OBM_EventFactory::getInstance()->attach(new OBM_EventMailObserver());
if( isset($GLOBALS['ccalendar_ics_eventStompObserver']) && $GLOBALS['ccalendar_ics_eventStompObserver']) {
  OBM_EventFactory::getInstance()->attach(new OBM_EventStompObserver());
}
// For debugging purpose, this observer outputs in /tmp/debug
// OBM_EventFactory::getInstance()->attach(new OBM_EventDebugObserver());


// Category Filter 
if (($action == 'insert') || ($action == 'update') 
  || ($action == 'perform_meeting')) {
    $cal_category_filter = '';
  } elseif ( isset($params['category_filter'])) {
    $cal_category_filter = str_replace($c_all,'',$current_view->get_category());
  }
// We copy the entity array structure to the parameter hash
$params['category_filter'] = $cal_category_filter;
예제 #3
0
 /**
  * Singleton pattern 
  * 
  * @static
  * @access public
  * @return void
  */
 public static function getInstance() {
   if (!self::$instance instanceof self) { 
     self::$instance = new self;
   }
   return self::$instance;
 }
예제 #4
0
$extra_js_include[] = 'calendar.js';
$extra_js_include[] = 'colorchooser.js';

require('calendar_display.inc');
require_once('calendar_js.inc');
require("$obminclude/of/of_right.inc");
require_once("$obminclude/of/of_category.inc");
require('calendar_mailer.php');
require('event_observer.php');
require('../contact/addressbook.php');
get_calendar_action();
$perm->check_permissions($module, $action);

page_close();

OBM_EventFactory::getInstance();


// If no user or resource selected, we select the connected user
$users = $current_view->get_users();
$resources = $current_view->get_resources();
if (empty($users) && empty($resources)) {
  $current_view->add_entity($GLOBALS['token']['entity'],$GLOBALS['token']['entityId']);
}

$params['category_filter'] = $c_all;

///////////////////////////////////////////////////////////////////////////////
// Main Program                                                              //
///////////////////////////////////////////////////////////////////////////////
예제 #5
0
파일: EventTest.php 프로젝트: Kervinou/OBM
 public function testStore() {
   $data = array ( 
     'title' => 'Title' ,
     'owner' => '2' ,
     'location' => 'Location' ,
     'category1' => '9' ,
     'privacy' => 1,
     'date_begin' => new Of_Date('2009-03-24 08:00:00'),
     'date_end' => new Of_Date('2009-03-24 09:00:00'),
     'priority' => '2' ,
     'color' => '#cc3333' ,
     'repeat_kind' => 'daily' ,
     'repeatfrequency' => '1' ,
     'repeat_end' => new Of_Date('2009-04-30'),
     'date_exception' => array (0 => new Of_Date('2009-03-25 08:00:00')),
     'description' => 'Description' ,
     'duration' => 3600,
     'repeat_days' => '0000000', 
     'user' => array (0 => '4'),
     'resource' => array(0 => 1),
     'contact' => array()
   );    
   $event = OBM_EventFactory::getInstance()->getById(1);
   foreach($data as $key => $value) {
     $event->set($key, $value);
   }
   OBM_EventFactory::getInstance()->store($event,OBM_EventFactory::getInstance()->getById(1));
   $event = OBM_EventFactory::getInstance()->getById(1);
   foreach($data as $key => $value) {
     if($value instanceof Of_Date) {
       $this->assertTrue($value->equals($event->get($key)));
     } elseif(is_array($value)) {
       foreach($value as $subkey => $subvalue) {
         $eventVal = $event->get($key);
         $eventVal = $eventVal[$subkey];          
         if($subvalue instanceof Of_Date) {
           $this->assertTrue($subvalue->equals($eventVal));
         } elseif($eventVal instanceof OBM_EventAttendee) {
           $this->assertEquals($subvalue, $eventVal->__toString());
         } else {
           $this->assertEquals($eventVal,$subvalue);
         }
       }        
     } elseif($event->get($key) instanceof OBM_EventAttendee) {
       $this->assertEquals($value, $event->get($key)->__toString());
     } else {
       $this->assertEquals($event->get($key),$value);
     }
   }        
 }