当前位置: 首页>>代码示例>>PHP>>正文


PHP Tinebase_Record_RecordSet::addRecord方法代码示例

本文整理汇总了PHP中Tinebase_Record_RecordSet::addRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Record_RecordSet::addRecord方法的具体用法?PHP Tinebase_Record_RecordSet::addRecord怎么用?PHP Tinebase_Record_RecordSet::addRecord使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Tinebase_Record_RecordSet的用法示例。


在下文中一共展示了Tinebase_Record_RecordSet::addRecord方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: setRelations

 /**
  * set all relations of a given record
  * 
  * NOTE: given relation data is expected to be an array atm.
  * @todo check read ACL for new relations to existing records.
  * 
  * @param  string $_model           own model to get relations for
  * @param  string $_backend         own backend to get relations for
  * @param  string $_id              own id to get relations for 
  * @param  array  $_relationData    data for relations to create
  * @param  bool   $_ignoreACL       create relations without checking permissions
  * @param  bool   $_inspectRelated  do update/create related records on the fly
  * @return void
  */
 public function setRelations($_model, $_backend, $_id, $_relationData, $_ignoreACL = FALSE, $_inspectRelated = FALSE)
 {
     $relations = new Tinebase_Record_RecordSet('Tinebase_Model_Relation');
     foreach ((array) $_relationData as $relationData) {
         if ($relationData instanceof Tinebase_Model_Relation) {
             $relations->addRecord($relationData);
         } else {
             $relation = new Tinebase_Model_Relation(NULL, TRUE);
             $relation->setFromJsonInUsersTimezone($relationData);
             $relations->addRecord($relation);
         }
     }
     // own id sanitising
     $relations->own_model = $_model;
     $relations->own_backend = $_backend;
     $relations->own_id = $_id;
     // convert related_record to record objects
     // @todo move this to a relation json class / or to model->setFromJson
     $this->_relatedRecordToObject($relations);
     // compute relations to add/delete
     $currentRelations = $this->getRelations($_model, $_backend, $_id, NULL, array(), $_ignoreACL);
     $currentIds = $currentRelations->getArrayOfIds();
     $relationsIds = $relations->getArrayOfIds();
     $toAdd = $relations->getIdLessIndexes();
     $toDel = array_diff($currentIds, $relationsIds);
     $toUpdate = array_intersect($currentIds, $relationsIds);
     $this->_validateConstraintsConfig($_model, $relations, $toDel, $toUpdate);
     // break relations
     foreach ($toDel as $relationId) {
         $this->_backend->breakRelation($relationId);
     }
     // add new relations
     foreach ($toAdd as $idx) {
         if (empty($relations[$idx]->related_id)) {
             $this->_setAppRecord($relations[$idx]);
         }
         $this->_addRelation($relations[$idx]);
     }
     // update relations
     foreach ($toUpdate as $relationId) {
         $current = $currentRelations[$currentRelations->getIndexById($relationId)];
         $update = $relations[$relations->getIndexById($relationId)];
         // update related records if explicitly needed
         if ($_inspectRelated) {
             // @todo do we need to omit so many fields?
             if (!$current->related_record->isEqual($update->related_record, array('jpegphoto', 'creation_time', 'last_modified_time', 'created_by', 'last_modified_by', 'is_deleted', 'deleted_by', 'deleted_time', 'tags', 'notes'))) {
                 if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
                     Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Related record diff: ' . print_r($current->related_record->diff($update->related_record)->toArray(), true));
                 }
                 $this->_setAppRecord($update);
             }
         }
         if (!$current->isEqual($update, array('related_record'))) {
             if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
                 Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Relation diff: ' . print_r($current->diff($update)->toArray(), true));
             }
             $this->_updateRelation($update);
         }
     }
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:74,代码来源:Relations.php

示例2: getTestEvent

 public function getTestEvent()
 {
     $event = $this->_getEvent();
     $event->rrule = 'FREQ=DAILY;INTERVAL=1';
     $exceptions = new Tinebase_Record_RecordSet('Calendar_Model_Event');
     $event->attendee[1]->transp = Calendar_Model_Event::TRANSP_TRANSP;
     $event->alarms = new Tinebase_Record_RecordSet('Tinebase_Model_Alarm', array(array('minutes_before' => 15), array('minutes_before' => 30), array('minutes_before' => 'custom', 'alarm_time' => '2009-03-25 04:33:00'), array('minutes_before' => 60), array('minutes_before' => 90)), TRUE);
     $event->alarms[0]->setOption('skip', array(array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getTestUserContact()->getId(), 'organizer' => Tinebase_Core::getUser()->contact_id)));
     $event->alarms[1]->setOption('attendee', array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getTestUserContact()->getId(), 'organizer' => Tinebase_Core::getUser()->contact_id));
     $event->alarms[2]->setOption('skip', array(array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId(), 'organizer' => Tinebase_Core::getUser()->contact_id)));
     $event->alarms[3]->setOption('attendee', array('user_type' => Calendar_Model_Attender::USERTYPE_USER, 'user_id' => $this->_getPersonasContacts('sclever')->getId(), 'organizer' => Tinebase_Core::getUser()->contact_id));
     $persistentException = clone $event;
     $persistentException->recurid = clone $persistentException->dtstart;
     $persistentException->recurid->addDay(1);
     $persistentException->dtstart->addDay(1)->addHour(2);
     $persistentException->dtend->addDay(1)->addHour(2);
     $persistentException->summary = 'exception';
     $exceptions->addRecord($persistentException);
     $deletedInstance = clone $event;
     $deletedInstance->dtstart->addDay(2);
     $deletedInstance->dtend->addDay(2);
     $deletedInstance->recurid = clone $deletedInstance->dtstart;
     $deletedInstance->is_deleted = TRUE;
     $exceptions->addRecord($deletedInstance);
     $event->exdate = $exceptions;
     return $event;
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:27,代码来源:MSEventFacadeTest.php

示例3: setUp

 /**
  * Lets update a record tree times
  *
  * @access protected
  */
 protected function setUp()
 {
     $now = new Tinebase_DateTime();
     $this->_modLogClass = Tinebase_Timemachine_ModificationLog::getInstance();
     $this->_persistantLogEntries = new Tinebase_Record_RecordSet('Tinebase_Model_ModificationLog');
     $this->_recordIds = array('5dea69be9c72ea3d263613277c3b02d529fbd8bc');
     $tinebaseApp = Tinebase_Application::getInstance()->getApplicationByName('Tinebase');
     $this->_logEntries = new Tinebase_Record_RecordSet('Tinebase_Model_ModificationLog', array(array('application_id' => $tinebaseApp, 'record_id' => $this->_recordIds[0], 'record_type' => 'TestType', 'record_backend' => 'TestBackend', 'modification_time' => $this->Cloner($now)->addDay(-2), 'modification_account' => 7, 'modified_attribute' => 'FirstTestAttribute', 'old_value' => 'Hamburg', 'new_value' => 'Bremen'), array('application_id' => $tinebaseApp, 'record_id' => $this->_recordIds[0], 'record_type' => 'TestType', 'record_backend' => 'TestBackend', 'modification_time' => $this->Cloner($now)->addDay(-1), 'modification_account' => 7, 'modified_attribute' => 'FirstTestAttribute', 'old_value' => 'Bremen', 'new_value' => 'Frankfurt'), array('application_id' => $tinebaseApp, 'record_id' => $this->_recordIds[0], 'record_type' => 'TestType', 'record_backend' => 'TestBackend', 'modification_time' => $this->Cloner($now), 'modification_account' => 7, 'modified_attribute' => 'FirstTestAttribute', 'old_value' => 'Frankfurt', 'new_value' => 'Stuttgart'), array('application_id' => $tinebaseApp, 'record_id' => $this->_recordIds[0], 'record_type' => 'TestType', 'record_backend' => 'TestBackend', 'modification_time' => $this->Cloner($now)->addDay(-2), 'modification_account' => 7, 'modified_attribute' => 'SecondTestAttribute', 'old_value' => 'Deutschland', 'new_value' => 'Östereich'), array('application_id' => $tinebaseApp, 'record_id' => $this->_recordIds[0], 'record_type' => 'TestType', 'record_backend' => 'TestBackend', 'modification_time' => $this->Cloner($now)->addDay(-1)->addSecond(1), 'modification_account' => 7, 'modified_attribute' => 'SecondTestAttribute', 'old_value' => 'Östereich', 'new_value' => 'Schweitz'), array('application_id' => $tinebaseApp->getId(), 'record_id' => $this->_recordIds[0], 'record_type' => 'TestType', 'record_backend' => 'TestBackend', 'modification_time' => $this->Cloner($now), 'modification_account' => 7, 'modified_attribute' => 'SecondTestAttribute', 'old_value' => 'Schweitz', 'new_value' => 'Italien')), true, false);
     foreach ($this->_logEntries as $logEntry) {
         $id = $this->_modLogClass->setModification($logEntry);
         $this->_persistantLogEntries->addRecord($this->_modLogClass->getModification($id));
     }
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:18,代码来源:ModificationLogTest.php

示例4: _importHelper

 /**
  * import file
  * 
  * @param string $_filename
  * @param Tinebase_Model_ImportExportDefinition $_definition
  * @param boolean $_useJsonImportFn
  * @param boolean $removeGroupList
  * @return array course data
  */
 protected function _importHelper($_filename, Tinebase_Model_ImportExportDefinition $_definition = NULL, $_useJsonImportFn = FALSE, $removeGroupList = FALSE)
 {
     $definition = $_definition !== NULL ? $_definition : $this->_getCourseImportDefinition();
     $course = $this->_getCourseData();
     $courseData = $this->_json->saveCourse($course);
     $this->_groupsToDelete->addRecord(Tinebase_Group::getInstance()->getGroupById($courseData['group_id']));
     if ($removeGroupList) {
         $group = Admin_Controller_Group::getInstance()->get($courseData['group_id']);
         Addressbook_Controller_List::getInstance()->delete($group->list_id);
     }
     if ($_useJsonImportFn) {
         $tempFileBackend = new Tinebase_TempFile();
         $tempFile = $tempFileBackend->createTempFile($_filename);
         Courses_Config::getInstance()->set(Courses_Config::STUDENTS_IMPORT_DEFINITION, $definition->name);
         $result = $this->_json->importMembers($tempFile->getId(), $courseData['group_id'], $courseData['id']);
         $this->assertGreaterThan(0, $result['results']);
     } else {
         $maildomain = TestServer::getPrimaryMailDomain();
         $importer = call_user_func($definition->plugin . '::createFromDefinition', $definition, array('group_id' => $courseData['group_id'], 'accountHomeDirectoryPrefix' => '//base/school/' . $courseData['name'] . '/', 'accountEmailDomain' => $maildomain, 'password' => $courseData['name'], 'samba' => array('homePath' => '//basehome/', 'homeDrive' => 'H:', 'logonScript' => 'logon.bat', 'profilePath' => '\\\\profile\\')));
         $tempFilename = TestServer::replaceEmailDomainInFile($_filename);
         $importer->importFile($tempFilename);
     }
     $courseData = $this->_json->getCourse($courseData['id']);
     return $courseData;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:34,代码来源:JsonTest.php

示例5: _resolveUsers

 /**
  * resolves an array with usernames to an array of user ids
  * 
  * @param array $users
  */
 protected function _resolveUsers($users)
 {
     if (!$this->_userRecords) {
         $this->_userRecords = new Tinebase_Record_RecordSet('Tinebase_Model_User');
     }
     $resolved = array();
     if (is_array($users) && !empty($users)) {
         foreach ($users as $userName) {
             $user = $this->_userRecords->filter('name', $userName)->getFirstRecord();
             if (!$user) {
                 try {
                     $user = Tinebase_User::getInstance()->getUserByLoginName($userName);
                 } catch (Tinebase_Exception_NotFound $tenf) {
                     if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                         Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Skipping user ' . $userName);
                     }
                     Tinebase_Exception::log($tenf);
                     continue;
                 }
                 $this->_userRecords->addRecord($user);
             }
             $resolved[] = $user->getId();
         }
     }
     return $resolved;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:31,代码来源:Csv.php

示例6: getTestEvent

 public function getTestEvent()
 {
     $event = $this->_getEvent();
     $event->rrule = 'FREQ=DAILY;INTERVAL=1';
     $exceptions = new Tinebase_Record_RecordSet('Calendar_Model_Event');
     $persistentException = clone $event;
     $persistentException->recurid = clone $persistentException->dtstart;
     $persistentException->recurid->addDay(1);
     $persistentException->dtstart->addDay(1)->addHour(2);
     $persistentException->dtend->addDay(1)->addHour(2);
     $persistentException->summary = 'exception';
     $exceptions->addRecord($persistentException);
     $deletedInstance = clone $event;
     $deletedInstance->dtstart->addDay(2);
     $deletedInstance->dtend->addDay(2);
     $deletedInstance->recurid = clone $deletedInstance->dtstart;
     $deletedInstance->is_deleted = TRUE;
     $exceptions->addRecord($deletedInstance);
     $event->exdate = $exceptions;
     return $event;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:21,代码来源:MSEventFacadeTest.php

示例7: getByReceiptId

 public function getByReceiptId($receiptId)
 {
     $recordSet = $this->getMultipleByProperty($receiptId, 'receipt_id', false, 'position_nr');
     $resultRecordSet = new Tinebase_Record_RecordSet('Billing_Model_OrderPosition');
     if ($recordSet instanceof Tinebase_Record_RecordSet && $recordSet->count() > 0) {
         $it = $recordSet->getIterator();
         foreach ($it as $key => $record) {
             $resultRecordSet->addRecord($this->loadOrderPosition($record));
         }
     }
     return $resultRecordSet;
 }
开发者ID:carriercomm,项目名称:Billing-5,代码行数:12,代码来源:ReceiptPosition.php

示例8: searchAndCacheMessage

 /**
  * search message by header (X-Tine20TestMessage) and add it to cache
  *
  * @param string $_testHeaderValue
  * @param Felamimail_Model_Folder $_folder
  * @return Felamimail_Model_Message
  */
 public function searchAndCacheMessage($_testHeaderValue, $_folder = NULL)
 {
     $folder = $_folder !== NULL ? $_folder : $this->_folder;
     $message = $this->_searchMessage($_testHeaderValue, $folder);
     $cachedMessage = $this->_cache->addMessage($message, $folder);
     if ($cachedMessage === FALSE) {
         // try to add message again (it had a duplicate)
         $this->_cache->clear($folder);
         $cachedMessage = $this->_cache->addMessage($message, $folder);
     }
     $this->assertTrue($cachedMessage instanceof Felamimail_Model_Message, 'could not add message to cache');
     $this->_createdMessages->addRecord($cachedMessage);
     return $cachedMessage;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:21,代码来源:MessageTest.php

示例9: getFolderStatus

 /**
  * get folder status and return all folders where something needs to be done
  *
  * @param Felamimail_Model_FolderFilter  $_filter
  * @return Tinebase_Record_RecordSet
  */
 public function getFolderStatus(Felamimail_Model_FolderFilter $_filter)
 {
     $this->_availableUpdateTime = NULL;
     // add user account ids to filter and use the folder backend to search as the folder controller has some special handling in its search function
     $_filter->createFilter(array('field' => 'account_id', 'operator' => 'in', 'value' => Felamimail_Controller_Account::getInstance()->search()->getArrayOfIds()));
     $folderBackend = Felamimail_Backend_Folder::getInstance();
     $folders = $folderBackend->search($_filter);
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . print_r($_filter->toArray(), TRUE));
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
         Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . " Checking status of " . count($folders) . ' folders.');
     }
     $result = new Tinebase_Record_RecordSet('Felamimail_Model_Folder');
     foreach ($folders as $folder) {
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Checking folder ' . $folder->globalname);
         }
         if ($this->_doNotUpdateCache($folder, FALSE)) {
             continue;
         }
         $imap = Felamimail_Backend_ImapFactory::factory($folder->account_id);
         $folder = Felamimail_Controller_Cache_Folder::getInstance()->getIMAPFolderCounter($folder);
         if ($this->_cacheIsInvalid($folder) || $this->_messagesInCacheButNotOnIMAP($folder)) {
             $result->addRecord($folder);
             continue;
         }
         if ($folder->imap_totalcount > 0) {
             try {
                 $this->_updateMessageSequence($folder, $imap);
             } catch (Felamimail_Exception_IMAPMessageNotFound $feimnf) {
                 $result->addRecord($folder);
                 continue;
             }
             if ($this->_messagesDeletedOnIMAP($folder) || $this->_messagesToBeAddedToCache($folder) || $this->_messagesMissingFromCache($folder)) {
                 $result->addRecord($folder);
                 continue;
             }
         }
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
         Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . " Found " . count($result) . ' folders that need an update.');
     }
     return $result;
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:51,代码来源:Message.php

示例10: testSendMail

 /**
  * test (plain text) mail sending via ActiveSync_Command_SendMail
  */
 public function testSendMail()
 {
     $email = file_get_contents(dirname(__FILE__) . '/../../Felamimail/files/text_plain.eml');
     $email = str_replace('gentoo-dev@lists.gentoo.org, webmaster@changchung.org', $this->_emailTestClass->getEmailAddress(), $email);
     $stream = fopen('data://text/plain;base64,' . base64_encode($email), 'r');
     $sendMail = new Syncope_Command_SendMail($stream);
     $sendMail->handle();
     $sendMail->getResponse();
     // check if mail is in INBOX of test account
     $inbox = $this->_emailTestClass->getFolder('INBOX');
     $testHeaderValue = 'text/plain';
     $message = $this->_emailTestClass->searchAndCacheMessage($testHeaderValue, $inbox);
     $this->_createdMessages->addRecord($message);
     $this->assertEquals("Re: [gentoo-dev] `paludis --info' is not like `emerge --info'", $message->subject);
     // check duplicate headers
     $completeMessage = Felamimail_Controller_Message::getInstance()->getCompleteMessage($message);
     $this->assertEquals(1, count($completeMessage->headers['mime-version']));
     $this->assertEquals(1, count($completeMessage->headers['content-type']));
 }
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:22,代码来源:SendMailTests.php

示例11: _createTimesheets

 /**
  * 
  * @param array $recordData
  * @return Tinebase_Record_RecordSet
  */
 protected function _createTimesheets($recordData = NULL)
 {
     $this->_timesheetController = Timetracker_Controller_Timesheet::getInstance();
     if (!$this->_timesheetRecords) {
         $this->_timesheetRecords = new Tinebase_Record_RecordSet('Timetracker_Model_Timesheet');
     }
     if (!$recordData) {
         if (!$this->_timeaccountRecords) {
             $this->_createTimeaccounts();
         }
         $tsDate = clone $this->_referenceDate;
         $tsDate->addMonth(4)->addDay(5);
         // this is a ts on 20xx-05-06
         $timesheet = new Timetracker_Model_Timesheet(array('account_id' => Tinebase_Core::getUser()->getId(), 'timeaccount_id' => $this->_timeaccountRecords->filter('title', 'TA-for-Customer3')->getFirstRecord()->getId(), 'start_date' => $tsDate, 'duration' => 105, 'description' => 'ts from ' . (string) $tsDate));
         $this->_timesheetRecords->addRecord($this->_timesheetController->create($timesheet));
         // this is a ts on 20xx-05-07
         $timesheet->id = NULL;
         $timesheet->start_date = $tsDate->addDay(1);
         $timesheet->description = 'ts from ' . (string) $tsDate;
         $this->_timesheetRecords->addRecord($this->_timesheetController->create($timesheet));
         // this is a ts on 20xx-09-07
         $timesheet->id = NULL;
         $timesheet->start_date = $tsDate->addMonth(4);
         $timesheet->description = 'ts from ' . (string) $tsDate;
         $this->_timesheetRecords->addRecord($this->_timesheetController->create($timesheet));
         // this is a ts on 20xx-09-08
         $timesheet->id = NULL;
         $timesheet->start_date = $tsDate->addDay(1);
         $timesheet->description = 'ts from ' . (string) $tsDate;
         $this->_timesheetRecords->addRecord($this->_timesheetController->create($timesheet));
     } else {
         foreach ($recordData as $tsData) {
             $timesheet = new Timetracker_Model_Timesheet($tsData);
             $this->_timesheetRecords->addRecord($this->_timesheetController->create($timesheet));
         }
     }
     return $this->_timesheetRecords;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:43,代码来源:InvoiceTestCase.php

示例12: getGrantsForRecords

 /**
  * get grants for records
  * 
  * @param Tinebase_Record_RecordSet $records
  */
 public function getGrantsForRecords(Tinebase_Record_RecordSet $records)
 {
     $recordIds = $records->getArrayOfIds();
     if (empty($recordIds)) {
         return;
     }
     $select = $this->_getAclSelectByRecordIds($recordIds)->group(array('record_id', 'account_type', 'account_id'));
     Tinebase_Backend_Sql_Abstract::traitGroup($select);
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' ' . $select);
     }
     $stmt = $this->_db->query($select);
     $grantsData = $stmt->fetchAll(Zend_Db::FETCH_ASSOC);
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' grantsData: ' . print_r($grantsData, true));
     }
     foreach ($grantsData as $grantData) {
         $givenGrants = explode(',', $grantData['account_grants']);
         foreach ($givenGrants as $grant) {
             $grantData[$grant] = TRUE;
         }
         $recordGrant = new $this->_modelName($grantData, true);
         unset($recordGrant->account_grant);
         $record = $records->getById($recordGrant->record_id);
         $records->removeRecord($record);
         if (!$record->grants instanceof Tinebase_Record_RecordSet) {
             $record->grants = new Tinebase_Record_RecordSet($this->_modelName);
         }
         $record->grants->addRecord($recordGrant);
         // NOTICE: this is strange - we have to remove the record and add it
         //   again to make sure that grants are updated ...
         //   maybe we should add a "replace" method?
         $records->addRecord($record);
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Records with grants: ' . print_r($records->toArray(), true));
     }
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:43,代码来源:Grants.php

示例13: _inspectBeforeCreate

 /**
  * inspect creation of one record (before create)
  *
  * @param   Tinebase_Record_Interface $_record
  * @return  void
  */
 protected function _inspectBeforeCreate(Tinebase_Record_Interface $_record)
 {
     $this->_freedaysToCreate = new Tinebase_Record_RecordSet('HumanResources_Model_FreeDay');
     if (is_array($_record->employee_id)) {
         $_record->employee_id = $_record->employee_id['id'];
     }
     if ($_record->freedays && !empty($_record->freedays)) {
         foreach ($_record->freedays as $fd) {
             if (!$fd instanceof HumanResources_Model_FreeDay) {
                 $fd = new HumanResources_Model_FreeDay($fd);
             }
             $this->_freedaysToCreate->addRecord($fd);
         }
         // normalize first-,  last date and days_count
         $this->_freedaysToCreate->sort('date', 'ASC');
         $_record->firstday_date = $this->_freedaysToCreate->getFirstRecord()->date;
         $this->_freedaysToCreate->sort('date', 'DESC');
         $_record->lastday_date = $this->_freedaysToCreate->getFirstRecord()->date;
         $_record->days_count = $this->_freedaysToCreate->count();
     } else {
         $_record->firstday_date = NULL;
     }
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:29,代码来源:FreeTime.php

示例14: testSearchWithCache

 /**
  * test search with cache
  * - test text_plain.eml message
  * - test from header
  */
 public function testSearchWithCache()
 {
     // get inbox folder id
     Expressomail_Controller_Folder::getInstance()->update($this->_account->getId());
     $folderBackend = new Expressomail_Backend_Folder();
     $folder = Expressomail_Controller_Folder::getInstance()->getByBackendAndGlobalName($this->_account->getId(), $this->_testFolderName);
     // clear empty folder
     Expressomail_Controller_Folder::getInstance()->emptyFolder($folder->getId());
     // append message
     $this->_appendMessage('text_plain.eml', $this->_folder);
     // search messages in test folder
     $result = $this->_controller->search($this->_getFilter($folder->getId()));
     //print_r($result->toArray());
     // check result
     $firstMessage = $result->getFirstRecord();
     $this->_createdMessages->addRecord($firstMessage);
     $this->assertGreaterThan(0, count($result));
     $this->assertEquals($folder->getId(), $firstMessage->folder_id);
     $this->assertEquals("Re: [gentoo-dev] `paludis --info' is not like `emerge --info'", $firstMessage->subject);
     $this->assertEquals('Pipping, Sebastian (Luxembourg)', $firstMessage->from_name);
     $this->assertEquals('webmaster@changchung.org', $firstMessage->from_email);
     $this->assertEquals(array('gentoo-dev@lists.gentoo.org', 'webmaster@changchung.org'), $firstMessage->to);
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:28,代码来源:MessageTest.php

示例15: addRecurrence

 /**
  * add given recurrence to given set and to nessesary adoptions
  * 
  * @param Calendar_Model_Event      $_recurrence
  * @param Tinebase_Record_RecordSet $_eventSet
  */
 protected static function addRecurrence($_recurrence, $_eventSet)
 {
     $_recurrence->setId('fakeid' . $_recurrence->uid . $_recurrence->dtstart->getTimeStamp());
     // adjust alarms
     if ($_recurrence->alarms instanceof Tinebase_Record_RecordSet) {
         foreach ($_recurrence->alarms as $alarm) {
             $alarm->alarm_time = clone $_recurrence->dtstart;
             $alarm->alarm_time->subMinute($alarm->getOption('minutes_before'));
         }
     }
     $_eventSet->addRecord($_recurrence);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:18,代码来源:Rrule.php


注:本文中的Tinebase_Record_RecordSet::addRecord方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。