protected function _createEventsForJmcblack() { // James McBlack $monday = clone $this->_monday; $tuesday = clone $this->_tuesday; $wednesday = clone $this->_wednesday; $thursday = clone $this->_thursday; $friday = clone $this->_friday; $saturday = clone $this->_saturday; $sunday = clone $this->_sunday; $lastMonday = clone $this->_lastMonday; $lastFriday = clone $this->_lastFriday; $lastSaturday = clone $this->_lastSaturday; $lastSunday = clone $this->_lastSunday; $cal = $this->_calendars['jmcblack']; $user = $this->_personas['jmcblack']; $defaultEventData = array('container_id' => $cal->getId(), 'class' => 'PRIVATE', Tinebase_Model_Grants::GRANT_EDIT => true, 'attendee' => array(array('quantity' => "1", 'role' => "REQ", 'status' => "ACCEPTED", 'transp' => "OPAQUE", 'user_id' => $user->toArray(), 'user_type' => "user"))); $eventsData = array(array_merge_recursive($defaultEventData, array('summary' => static::$_de ? 'Catherines Geburtstag' : 'Catherine\'s Birthday', 'description' => static::$_de ? '' : '', 'dtstart' => $thursday->format('d-m-Y') . ' 00:00:00', 'dtend' => $thursday->format('d-m-Y') . ' 23:59:00', 'is_all_day_event' => true, 'alarms' => array(array('alarm_time' => $tuesday->format('d-m-Y') . " 12:00:00", 'minutes_before' => 2880, 'model' => "Calendar_Model_Event", 'options' => json_encode(array("custom" => false, "recurid" => null, "minutes_before" => "2880")), 'sent_message' => "", 'sent_status' => "pending")), 'rrule' => array("bymonth" => $thursday->format('m'), "bymonthday" => $thursday->format('d'), "freq" => "YEARLY", "interval" => "1"), 'rrule_until' => '')), array_merge_recursive($defaultEventData, array('summary' => static::$_de ? 'Alyssas Geburtstag' : 'Alyssa\'s Birthday', 'description' => static::$_de ? '' : '', 'dtstart' => $friday->format('d-m-Y') . ' 00:00:00', 'dtend' => $friday->format('d-m-Y') . ' 23:59:00', 'is_all_day_event' => true, 'alarms' => array(array('alarm_time' => $wednesday->format('d-m-Y') . " 12:00:00", 'minutes_before' => 2880, 'model' => "Calendar_Model_Event", 'options' => json_encode(array("custom" => false, "recurid" => null, "minutes_before" => "2880")), 'sent_message' => "", 'sent_status' => "pending")), 'rrule' => array("bymonth" => $friday->format('m'), "bymonthday" => $friday->format('d'), "freq" => "YEARLY", "interval" => "1"), 'rrule_until' => '')), array_merge_recursive($defaultEventData, array('summary' => static::$_de ? 'Brendas\' Geburtstag' : 'Brenda\'s Birthday', 'description' => static::$_de ? '' : '', 'dtstart' => $thursday->format('d-m-Y') . ' 00:00:00', 'dtend' => $thursday->format('d-m-Y') . ' 23:59:00', 'is_all_day_event' => true, 'alarms' => array(array('alarm_time' => $tuesday->format('d-m-Y') . " 12:00:00", 'minutes_before' => 2880, 'model' => "Calendar_Model_Event", 'options' => json_encode(array("custom" => false, "recurid" => null, "minutes_before" => "2880")), 'sent_message' => "", 'sent_status' => "pending")), 'rrule' => array("bymonth" => $thursday->format('m'), "bymonthday" => $thursday->format('d'), "freq" => "YEARLY", "interval" => "1"), 'rrule_until' => '')), array_merge_recursive($defaultEventData, array('summary' => static::$_de ? 'Automesse in Liverpool' : 'Auto fair in Liverpool', 'description' => static::$_de ? '' : '', 'dtstart' => $monday->format('d-m-Y') . ' 19:00:00', 'dtend' => $monday->format('d-m-Y') . ' 23:00:00')), array_merge_recursive($defaultEventData, array('summary' => static::$_de ? 'Weinverkostung auf der Burg' : 'Wine tasting at the castle', 'description' => static::$_de ? '' : '', 'dtstart' => $saturday->format('d-m-Y') . ' 15:00:00', 'dtend' => $saturday->format('d-m-Y') . ' 16:00:00')), array_merge_recursive($defaultEventData, array('summary' => static::$_de ? 'Eigentümerversammlung' : 'Owners\' meeting', 'description' => static::$_de ? '' : '', 'dtstart' => $tuesday->format('d-m-Y') . ' 17:00:00', 'dtend' => $tuesday->format('d-m-Y') . ' 18:00:00')), array_merge_recursive($defaultEventData, array('summary' => static::$_de ? 'Datamining Konferenz' : 'Data mining conference', 'description' => static::$_de ? '' : '', 'dtstart' => $thursday->format('d-m-Y') . ' 17:00:00', 'dtend' => $thursday->format('d-m-Y') . ' 18:00:00'))); foreach ($eventsData as $eData) { $event = new Calendar_Model_Event($eData); $this->_controller->create($event, false); } $cal = Tinebase_Container::getInstance()->addContainer(new Tinebase_Model_Container(array('name' => static::$_de ? 'Geschäftlich' : 'Business', 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'owner_id' => Tinebase_Core::getUser(), 'backend' => 'SQL', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Calendar')->getId(), 'color' => '#00CCFF'), true)); Tinebase_Container::getInstance()->addGrants($cal->getId(), 'user', $this->_personas['sclever']->getId(), $this->_secretaryGrants, true); Tinebase_Container::getInstance()->addGrants($cal->getId(), 'user', $this->_personas['rwright']->getId(), $this->_controllerGrants, true); $defaultEventData = array('container_id' => $cal->getId(), Tinebase_Model_Grants::GRANT_EDIT => true); $eventsData = array(array_merge_recursive($defaultEventData, array('summary' => static::$_de ? 'Projektbesprechung Projekt Gamma mit Herrn Pearson' : 'Project Gamma Meeting with Mr. Pearson', 'description' => static::$_de ? '' : '', 'dtstart' => $monday->format('d-m-Y') . ' 09:00:00', 'dtend' => $monday->format('d-m-Y') . ' 10:30:00')), array_merge_recursive($defaultEventData, array('summary' => static::$_de ? 'MDH Pitch' : 'MDH Pitch', 'description' => static::$_de ? '' : '', 'dtstart' => $monday->format('d-m-Y') . ' 10:30:00', 'dtend' => $monday->format('d-m-Y') . ' 12:00:00')), array_merge_recursive($defaultEventData, array('summary' => static::$_de ? 'Mitarbeitergespräch mit Jack' : 'employee appraisal with Jack', 'description' => static::$_de ? '' : '', 'dtstart' => $monday->format('d-m-Y') . ' 10:30:00', 'dtend' => $monday->format('d-m-Y') . ' 12:00:00'))); foreach ($eventsData as $eData) { $event = new Calendar_Model_Event($eData); $this->_controller->create($event, false); } }
/** * add one record * * @param Calendar_Model_Event $_record * @return Calendar_Model_Event * @throws Tinebase_Exception_AccessDenied * @throws Tinebase_Exception_Record_Validation */ public function create(Tinebase_Record_Interface $_event) { if ($_event->recurid) { throw new Tinebase_Exception_UnexpectedValue('recur event instances must be saved as part of the base event'); } $exceptions = $_event->exdate; $_event->exdate = NULL; $savedEvent = $this->_eventController->create($_event); if ($exceptions instanceof Tinebase_Record_RecordSet) { foreach ($exceptions as $exception) { $this->_prepareException($savedEvent, $exception); $this->_eventController->createRecurException($exception, !!$exception->is_deleted); } } return $this->_toiTIP($savedEvent); }
/** * add one record * * @param Calendar_Model_Event $_event * @return Calendar_Model_Event * @throws Tinebase_Exception_AccessDenied * @throws Tinebase_Exception_Record_Validation */ public function create(Tinebase_Record_Interface $_event) { if ($_event->recurid) { throw new Tinebase_Exception_UnexpectedValue('recur event instances must be saved as part of the base event'); } $this->_fromiTIP($_event, new Calendar_Model_Event(array(), TRUE)); $exceptions = $_event->exdate; $_event->exdate = NULL; $_event->assertAttendee($this->getCalendarUser()); $savedEvent = $this->_eventController->create($_event); if ($exceptions instanceof Tinebase_Record_RecordSet) { if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) { Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' About to create ' . count($exceptions) . ' exdates for event ' . $_event->summary . ' (' . $_event->dtstart . ')'); } foreach ($exceptions as $exception) { $exception->assertAttendee($this->getCalendarUser()); $this->_prepareException($savedEvent, $exception); $this->_eventController->createRecurException($exception, !!$exception->is_deleted); } } // NOTE: exdate creation changes baseEvent, so we need to refetch it here return $this->get($savedEvent->getId()); }