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


PHP Tinebase_Record_RecordSet类代码示例

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


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

示例1: 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

示例2: 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);
         if (!$record->grants instanceof Tinebase_Record_RecordSet) {
             $record->grants = new Tinebase_Record_RecordSet($this->_modelName);
         }
         $record->grants->addRecord($recordGrant);
     }
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Records with grants: ' . print_r($records->toArray(), true));
     }
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:38,代码来源:Grants.php

示例3: processIteration

 /**
  * @param Tinebase_Record_RecordSet $_records
  * @throws Tinebase_Exception_NotImplemented
  */
 public function processIteration($_records)
 {
     $record = $_records->getFirstRecord();
     $converter = Tinebase_Convert_Factory::factory($record);
     $resolved = $converter->fromTine20Model($record);
     $this->_docTemplate->setValue('salutation_letter', $this->_getSalutation($resolved));
     $this->_docTemplate->setValue('salutation_resolved', $this->_getShortSalutation($resolved));
     parent::processIteration($_records);
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:13,代码来源:Doc.php

示例4: getLastOpenItem

 public function getLastOpenItem(Tinebase_Record_RecordSet $batchJobMonitionItems)
 {
     if ($batchJobMonitionItems->getCount() == 0) {
         throw new Billing_Exception_OpenItem('Recordset does not contain any monition open items and therefore no related order.');
     }
     $batchJobMonitionItems->sort('open_item_id', 'DESC');
     $record = $batchJobMonitionItems->getFirstRecord();
     $openItem = $record->getForeignRecord('open_item_id', Billing_Controller_OpenItem::getInstance());
     return $openItem;
 }
开发者ID:carriercomm,项目名称:Billing-5,代码行数:10,代码来源:BatchJobMonitionItem.php

示例5: 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

示例6: 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

示例7: _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

示例8: createMissingAccounts

 /**
  * creates missing accounts for all employees having a valid contract
  * if a year is given, missing accounts for this year will be built, otherwise the current and following year will be used
  *
  * @param integer $year
  * @param HumanResources_Model_Employee
  * @param boolean $useBackend Use Backend instead of this Controller (may called by setup also, skips rigts, creating modlog etc.)
  */
 public function createMissingAccounts($year = NULL, $employee = NULL, $useBackend = FALSE)
 {
     // if no year is given, call myself with this year and just go on with the next year
     if (!$year) {
         $date = new Tinebase_DateTime();
         $year = (int) $date->format('Y');
         $this->createMissingAccounts($year, $employee);
         $date->addYear(1);
         $year = (int) $date->format('Y');
     }
     // tine20 should last a hundred years :)
     if ($year < 2006 || $year >= 2106 || !is_int($year)) {
         throw new Tinebase_Exception_Data('The year must be between 2006 and 2106');
     }
     // borders
     $year_starts = new Tinebase_DateTime($year . '-01-01 00:00:00');
     $year_ends = new Tinebase_DateTime($year . '-12-31 23:59:59');
     $validEmployeeIds = array_unique($this->_contractController->getValidContracts($year_starts, $year_ends, $employee)->employee_id);
     $existingFilter = new HumanResources_Model_AccountFilter(array(array('field' => 'year', 'operator' => 'equals', 'value' => $year)));
     $existingFilter->addFilter(new Tinebase_Model_Filter_Text(array('field' => 'employee_id', 'operator' => 'in', 'value' => $validEmployeeIds)));
     $result = $this->search($existingFilter)->employee_id;
     $validEmployeeIds = array_diff($validEmployeeIds, $result);
     $createdAccounts = new Tinebase_Record_RecordSet('HumanResources_Model_Account');
     if ($useBackend) {
         $be = new HumanResources_Backend_Account();
         foreach ($validEmployeeIds as $id) {
             $createdAccounts->addRecord($be->create(new HumanResources_Model_Account(array('employee_id' => $id, 'year' => $year))));
         }
     } else {
         foreach ($validEmployeeIds as $id) {
             $createdAccounts->addRecord($this->create(new HumanResources_Model_Account(array('employee_id' => $id, 'year' => $year))));
         }
     }
     return $createdAccounts;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:43,代码来源:Account.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: 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

示例11: _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

示例12: search

 /**
  * get list of records
  *
  * @param Tinebase_Model_Filter_FilterGroup|optional $_filter
  * @param Tinebase_Model_Pagination|optional $_pagination
  * @param boolean|array $_getRelations
  * @param boolean $_onlyIds
  * @param string $_action for right/acl check
  * @return Tinebase_Record_RecordSet|array
  */
 public function search(Tinebase_Model_Filter_FilterGroup $_filter = NULL, Tinebase_Record_Interface $_pagination = NULL, $_getRelations = FALSE, $_onlyIds = FALSE, $_action = 'get')
 {
     //@TODO support more appfilter combinations when needed
     $appFilter = $_filter->getFilter('application_id');
     $app = Tinebase_Application::getInstance()->getApplicationById($appFilter->getValue());
     $appname = $app->name;
     if (!Tinebase_Core::getUser()->hasRight($appname, 'admin')) {
         throw new Tinebase_Exception_AccessDenied("You do not have admin rights for {$appname}");
     }
     $configRecords = new Tinebase_Record_RecordSet('Tinebase_Model_Config');
     $appConfigObject = Tinebase_Config::getAppConfig($appname);
     $appConfigDefinitions = $appConfigObject->getProperties();
     $appDBConfig = $this->_configBackend->search($_filter);
     foreach ($appConfigDefinitions as $name => $definition) {
         if (array_key_exists('setByAdminModule', $definition) && $definition['setByAdminModule']) {
             $configFromFile = $appConfigObject->getConfigFileSection($name);
             $configFromDb = $appDBConfig->filter('name', $name)->getFirstRecord();
             if ($configFromDb && !$configFromFile) {
                 $configRecord = $this->_mergeDefinition($configFromDb, $definition);
                 $configRecord->source = Tinebase_Model_Config::SOURCE_DB;
             } else {
                 $definition['id'] = 'virtual-' . $name;
                 $definition['application_id'] = $app->getId();
                 $definition['name'] = $name;
                 $definition['value'] = json_encode($configFromFile);
                 $definition['source'] = is_null($configFromFile) ? Tinebase_Model_Config::SOURCE_DEFAULT : Tinebase_Model_Config::SOURCE_FILE;
                 $configRecord = new Tinebase_Model_Config($definition);
             }
             // exclude config's which the admin can't set
             if ($configRecord->source != Tinebase_Model_Config::SOURCE_FILE) {
                 $configRecords->addRecord($configRecord);
             }
         }
     }
     return $configRecords;
 }
开发者ID:hernot,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:46,代码来源:Config.php

示例13: getPathsForRecords

 /**
  * getPathsForRecords
  *
  * @param Tinebase_Record_Interface|Tinebase_Record_RecordSet $records
  * @return Tinebase_Record_RecordSet
  * @throws Tinebase_Exception_NotFound
  */
 public function getPathsForRecords($records)
 {
     $ids = $records instanceof Tinebase_Record_Interface ? array($records->getId()) : $records->getArrayOfIds();
     return $this->search(new Tinebase_Model_PathFilter(array(array('field' => 'record_id', 'operator' => 'in', 'value' => $ids))));
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:12,代码来源:Path.php

示例14: importAddressbook

 /**
  * import the addressbook from egw14
  *
  * @param string $_oldTableName [OPTIONAL]
  * @param int $_useOldId [OPTIONAL]
  * 
  * @todo    use old group name for the (shared) container ?
  * @todo    add more config params (
  */
 public function importAddressbook($_oldTableName = NULL, $_useOldId = TRUE)
 {
     // did nothing
     //@set_time_limit (120);
     $sharedContactsGroupId = -15;
     $sharedContactsContainerName = "Metaways Kontakte";
     $setFileasFromName = TRUE;
     $tableName = $_oldTableName != NULL ? $_oldTableName : $this->oldTablePrefix . 'addressbook';
     $contactsTable = new Tinebase_Db_Table(array('name' => $tableName));
     // get contacts
     $contacts = $contactsTable->fetchAll();
     // get categories
     $categories = $this->getCategories();
     echo "Import Contacts from table " . $tableName . " ... <br/>";
     foreach ($contacts as $contact) {
         echo "importing " . $contact->n_given . " " . $contact->n_family . " ...";
         /******************** add container ************************/
         if ($contact->contact_owner > 0) {
             // personal container for owner
             try {
                 $container = Tinebase_Container::getInstance()->getContainerByName('Addressbook', 'Personal Contacts', Tinebase_Model_Container::TYPE_PERSONAL, Tinebase_Core::getUser());
             } catch (Tinebase_Exception_NotFound $e) {
                 $container = new Tinebase_Model_Container(array('name' => 'Personal Contacts', 'type' => Tinebase_Model_Container::TYPE_PERSONAL, 'owner_id' => Tinebase_Core::getUser(), 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Addressbook')->getId()));
                 $container = Tinebase_Container::getInstance()->addContainer($container, NULL, TRUE);
             }
         } else {
             if ($contact->contact_owner == $sharedContactsGroupId) {
                 // default users group -> shared container
                 $userGroup = Tinebase_Group::getInstance()->getGroupByName('Users');
                 try {
                     $container = Tinebase_Container::getInstance()->getContainerByName('Addressbook', $sharedContactsContainerName, Tinebase_Model_Container::TYPE_SHARED);
                 } catch (Tinebase_Exception_NotFound $e) {
                     $container = new Tinebase_Model_Container(array('name' => $sharedContactsContainerName, 'type' => Tinebase_Model_Container::TYPE_SHARED, 'backend' => 'Sql', 'application_id' => Tinebase_Application::getInstance()->getApplicationByName('Addressbook')->getId()));
                     $container = Tinebase_Container::getInstance()->addContainer($container, NULL, TRUE);
                     Tinebase_Container::getInstance()->addGrants($container, Tinebase_Acl_Rights::ACCOUNT_TYPE_GROUP, $userGroup, array(Tinebase_Model_Grants::GRANT_READ, Tinebase_Model_Grants::GRANT_ADD, Tinebase_Model_Grants::GRANT_EDIT, Tinebase_Model_Grants::GRANT_DELETE), TRUE);
                 }
             } else {
                 echo "skipped.<br/>";
                 continue;
             }
         }
         $containerId = $container->getId();
         /******************** set fileas ************************/
         if ($setFileasFromName) {
             $fileas = "";
             if (!empty($contact->n_family)) {
                 if (!empty($contact->n_given)) {
                     $fileas = $contact->n_family . ", " . $contact->n_given;
                 } else {
                     $fileas = $contact->n_family;
                 }
             } else {
                 $fileas = $contact->n_given;
             }
             if (empty($fileas)) {
                 $fileas = $contact->org_name;
             } elseif (!empty($contact->n_middle)) {
                 $fileas .= " " . $contact->n_middle;
             }
         } else {
             $fileas = empty($contact->n_fileas) ? $contact->org_name : $contact->n_fileas;
         }
         /******************** set urls (add 'http://' if missing) ************************/
         if (!preg_match("/https*:\\/\\//i", $contact->contact_url) && !empty($contact->contact_url)) {
             $url = "http://" . $contact->contact_url;
         } else {
             $url = $contact->contact_url;
         }
         if (!preg_match("/https*:\\/\\//i", $contact->contact_url_home) && !empty($contact->contact_url_home)) {
             $urlHome = "http://" . $contact->contact_url_home;
         } else {
             $urlHome = $contact->contact_url_home;
         }
         /******************** create contact record ************************/
         $tineContact = new Addressbook_Model_Contact(array('id' => $_useOldId ? $contact->contact_id : 0, 'account_id' => $contact->account_id, 'owner' => $containerId, 'n_family' => empty($contact->n_family) ? 'imported' : $contact->n_family, 'n_fileas' => $fileas, 'n_fn' => empty($contact->n_fn) ? 'imported' : $contact->n_fn, 'adr_one_countryname' => isset($this->countryMapping[$contact->adr_one_countryname]) ? $this->countryMapping[$contact->adr_one_countryname] : "", 'adr_one_locality' => $contact->adr_one_locality, 'adr_one_postalcode' => $contact->adr_one_postalcode, 'adr_one_region' => $contact->adr_one_region, 'adr_one_street' => $contact->adr_one_street, 'adr_one_street2' => $contact->adr_one_street2, 'adr_two_countryname' => isset($this->countryMapping[$contact->adr_two_countryname]) ? $this->countryMapping[$contact->adr_two_countryname] : "", 'adr_two_locality' => $contact->adr_two_locality, 'adr_two_postalcode' => $contact->adr_two_postalcode, 'adr_two_region' => $contact->adr_two_region, 'adr_two_street' => $contact->adr_two_street, 'adr_two_street2' => $contact->adr_two_street2, 'last_modified_time' => new Tinebase_DateTime($contact->contact_modified), 'assistent' => $contact->contact_assistent, 'bday' => $contact->contact_bday, 'email' => $contact->contact_email, 'email_home' => $contact->contact_email_home, 'note' => $contact->contact_note, 'role' => $contact->contact_role, 'title' => $contact->contact_title, 'url' => $url, 'url_home' => $urlHome, 'n_given' => $contact->n_given, 'n_middle' => $contact->n_middle, 'n_prefix' => $contact->n_prefix, 'n_suffix' => $contact->n_suffix, 'org_name' => $contact->org_name, 'org_unit' => $contact->org_unit, 'tel_assistent' => $contact->tel_assistent, 'tel_car' => $contact->tel_car, 'tel_cell' => $contact->tel_cell, 'tel_cell_private' => $contact->tel_cell_private, 'tel_fax' => $contact->tel_fax, 'tel_fax_home' => $contact->tel_fax_home, 'tel_home' => $contact->tel_home, 'tel_pager' => $contact->tel_pager, 'tel_work' => $contact->tel_work, 'tags' => array()));
         $tineContact = Addressbook_Controller_Contact::getInstance()->create($tineContact);
         echo " ok.<br/>";
         // get categories -> tags
         if (!empty($contact->cat_id)) {
             $catIds = explode(',', $contact->cat_id);
             $filter = new Tinebase_Model_TagFilter(array('name' => '%', 'application' => 'Addressbook'));
             $paging = new Tinebase_Model_Pagination();
             $contactTags = new Tinebase_Record_RecordSet('Tinebase_Model_Tag');
             foreach ($catIds as $catId) {
                 if (isset($categories[$catId])) {
                     $filter->name = $categories[$catId]->cat_name;
                     $tags = Tinebase_Tags::getInstance()->searchTags($filter, $paging)->toArray();
                     if (empty($tags)) {
                         $tag = new Tinebase_Model_Tag(array('type' => Tinebase_Model_Tag::TYPE_SHARED, 'name' => $categories[$catId]->cat_name));
                         $tag = Tinebase_Tags::getInstance()->createTag($tag);
                         $contactTags->addRecord($tag);
//.........这里部分代码省略.........
开发者ID:rodrigofns,项目名称:ExpressoLivre3,代码行数:101,代码来源:Egw14.php

示例15: _testFullFixtures

 protected function _testFullFixtures()
 {
     $this->assertEquals(4, $this->_customerRecords->count());
     $this->assertEquals(12, $this->_addressRecords->count());
     $this->assertEquals(4, $this->_contractRecords->count());
     $this->assertEquals(20, $this->_contactRecords->count());
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:7,代码来源:InvoiceTestCase.php


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