コード例 #1
0
 /**
  * testCreateEvent
  */
 public function testCreateEvent()
 {
     $scleverDisplayContainerId = Tinebase_Core::getPreference('Calendar')->getValueForUser(Calendar_Preference::DEFAULTCALENDAR, $this->_personas['sclever']->getId());
     $contentSeqBefore = Tinebase_Container::getInstance()->getContentSequence($scleverDisplayContainerId);
     $eventData = $this->_getEvent()->toArray();
     $tag = Tinebase_Tags::getInstance()->createTag(new Tinebase_Model_Tag(array('name' => 'phpunit-' . substr(Tinebase_Record_Abstract::generateUID(), 0, 10), 'type' => Tinebase_Model_Tag::TYPE_PERSONAL)));
     $eventData['tags'] = array($tag->toArray());
     $note = new Tinebase_Model_Note(array('note' => 'very important note!', 'note_type_id' => Tinebase_Notes::getInstance()->getNoteTypes()->getFirstRecord()->getId()));
     $eventData['notes'] = array($note->toArray());
     $persistentEventData = $this->_uit->saveEvent($eventData);
     $loadedEventData = $this->_uit->getEvent($persistentEventData['id']);
     $this->_assertJsonEvent($eventData, $loadedEventData, 'failed to create/load event');
     $contentSeqAfter = Tinebase_Container::getInstance()->getContentSequence($scleverDisplayContainerId);
     $this->assertEquals($contentSeqBefore + 1, $contentSeqAfter, 'content sequence of display container should be increased by 1:' . $contentSeqAfter);
     $this->assertEquals($contentSeqAfter, Tinebase_Container::getInstance()->get($scleverDisplayContainerId)->content_seq);
     return $loadedEventData;
 }
コード例 #2
0
 /**
  * add new note
  *
  * @param Tinebase_Model_Note $_note
  */
 public function addNote(Tinebase_Model_Note $_note)
 {
     if (!$_note->getId()) {
         $id = $_note->generateUID();
         $_note->setId($id);
     }
     Tinebase_Timemachine_ModificationLog::getInstance()->setRecordMetaData($_note, 'create');
     $data = $_note->toArray(FALSE, FALSE);
     $this->_notesTable->insert($data);
 }
コード例 #3
0
 /**
  * add new note
  *
  * @param Tinebase_Model_Note $_note
  */
 public function addNote(Tinebase_Model_Note $_note)
 {
     if (!$_note->getId()) {
         $id = $_note->generateUID();
         $_note->setId($id);
     }
     Tinebase_Timemachine_ModificationLog::getInstance()->setRecordMetaData($_note, 'create');
     $data = $_note->toArray(FALSE, FALSE);
     //if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' ' . print_r($data, TRUE));
     $this->_notesTable->insert($data);
 }