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


PHP Tinebase_Record_RecordSet::removeRecords方法代码示例

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


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

示例1: _getSpecialFieldValue

 /**
  * get special field value
  *
  * @param Tinebase_Record_Interface $_record
  * @param array $_param
  * @param string $_key
  * @param string $_cellType
  * @return string
  */
 protected function _getSpecialFieldValue(Tinebase_Record_Interface $_record, $_param, $_key = NULL, &$_cellType = NULL)
 {
     $supplierId = $_record->getId();
     if (!isset($this->_supplierAddresses[$supplierId])) {
         $all = $this->_addresses->filter('customer_id', $supplierId);
         $this->_addresses->removeRecords($all);
         $this->_supplierAddresses[$supplierId] = array('postal' => $all->filter('type', 'postal')->getFirstRecord(), 'billing' => array('records' => $all->filter('type', 'billing'), 'index' => 0), 'delivery' => array('records' => $all->filter('type', 'delivery'), 'index' => 0));
     }
     switch ($_param['type']) {
         case 'postal':
             $address = $this->_supplierAddresses[$supplierId]['postal'];
             break;
         default:
             if (isset($this->_supplierAddresses[$supplierId][$_param['type']]['records'])) {
                 $address = $this->_supplierAddresses[$supplierId][$_param['type']]['records']->getByIndex($this->_supplierAddresses[$supplierId][$_param['type']]['index']);
                 $this->_supplierAddresses[$supplierId][$_param['type']]['index']++;
             }
     }
     return $address ? $this->_renderAddress($address, $_param['type']) : '';
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:29,代码来源:Supplier.php

示例2: _moveMessagesByFolder

 /**
  * move messages from one folder to another
  * 
  * @param Tinebase_Record_RecordSet $_messages
  * @param string $_folderId
  * @param Expressomail_Model_Folder|string $_targetFolder
  * @return boolean did we move messages?
  */
 protected function _moveMessagesByFolder(Tinebase_Record_RecordSet $_messages, $_folderId, $_targetFolder)
 {
     $messagesInFolder = $_messages->filter('folder_id', $_folderId);
     if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
         Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Moving messages: ' . print_r($messagesInFolder->getArrayOfIds(), TRUE));
     }
     $result = TRUE;
     if ($_targetFolder === Expressomail_Model_Folder::FOLDER_TRASH) {
         $result = $this->_moveMessagesToTrash($messagesInFolder, $_folderId);
     } else {
         if ($_folderId === $_targetFolder->getId()) {
             // no need to move
             $result = FALSE;
         } else {
             if ($messagesInFolder->getFirstRecord()->account_id == $_targetFolder->account_id) {
                 $this->_moveMessagesInFolderOnSameAccount($messagesInFolder, $_targetFolder);
             } else {
                 $this->_moveMessagesToAnotherAccount($messagesInFolder, $_targetFolder);
             }
         }
     }
     if (!$result) {
         $_messages->removeRecords($messagesInFolder);
     }
     return $result;
 }
开发者ID:ingoratsdorf,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:34,代码来源:Move.php

示例3: resolveAppRecords

 /**
  * resolved app records and fills the related_record property with the corresponding record
  * 
  * NOTE: With this, READ ACL is implicitly checked as non readable records won't get retuned!
  * 
  * @param  Tinebase_Record_RecordSet $_relations of Tinebase_Model_Relation
  * @param  boolean $_ignoreACL 
  * @return void
  * 
  * @todo    make getApplicationInstance work for tinebase record (Tinebase_Model_User for example)
  */
 protected function resolveAppRecords($_relations, $_ignoreACL = FALSE)
 {
     // separate relations by model
     $modelMap = array();
     foreach ($_relations as $relation) {
         if (!(isset($modelMap[$relation->related_model]) || array_key_exists($relation->related_model, $modelMap))) {
             $modelMap[$relation->related_model] = new Tinebase_Record_RecordSet('Tinebase_Model_Relation');
         }
         $modelMap[$relation->related_model]->addRecord($relation);
     }
     // fill related_record
     foreach ($modelMap as $modelName => $relations) {
         // check right
         $split = explode('_Model_', $modelName);
         $rightClass = $split[0] . '_Acl_Rights';
         $rightName = 'manage_' . strtolower($split[1]) . 's';
         if (class_exists($rightClass)) {
             $ref = new ReflectionClass($rightClass);
             $u = Tinebase_Core::getUser();
             // if a manage right is defined and the user has no manage_record or admin right, remove relations having this record class as related model
             if (is_object($u) && $ref->hasConstant(strtoupper($rightName)) && !$u->hasRight($split[0], $rightName) && !$u->hasRight($split[0], Tinebase_Acl_Rights::ADMIN)) {
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                     $_relations->removeRecords($relations);
                     Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Skipping relation due to no manage right: ' . $modelName);
                 }
                 continue;
             }
         }
         $getMultipleMethod = 'getMultiple';
         if ($modelName === 'Tinebase_Model_User') {
             // @todo add related backend here
             //$appController = Tinebase_User::factory($relations->related_backend);
             $appController = Tinebase_User::factory(Tinebase_User::getConfiguredBackend());
             $records = $appController->{$getMultipleMethod}($relations->related_id);
         } else {
             try {
                 $appController = Tinebase_Core::getApplicationInstance($modelName);
                 if (method_exists($appController, $getMultipleMethod)) {
                     $records = $appController->{$getMultipleMethod}($relations->related_id, $_ignoreACL);
                     // resolve record alarms
                     if (count($records) > 0 && $records->getFirstRecord()->has('alarms')) {
                         $appController->getAlarms($records);
                     }
                 } else {
                     throw new Tinebase_Exception_AccessDenied('Controller ' . get_class($appController) . ' has no method ' . $getMultipleMethod);
                 }
             } catch (Tinebase_Exception_AccessDenied $tea) {
                 if (Tinebase_Core::isLogLevel(Zend_Log::INFO)) {
                     Tinebase_Core::getLogger()->info(__METHOD__ . '::' . __LINE__ . ' Removing relations from result. Got exception: ' . $tea->getMessage());
                 }
                 $_relations->removeRecords($relations);
                 continue;
             }
         }
         if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
             Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " Resolving " . count($relations) . " relations");
         }
         foreach ($relations as $relation) {
             $recordIndex = $records->getIndexById($relation->related_id);
             $relationIndex = $_relations->getIndexById($relation->getId());
             if ($recordIndex !== false) {
                 $_relations[$relationIndex]->related_record = $records[$recordIndex];
             } else {
                 // delete relation from set, as READ ACL is obviously not granted
                 if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
                     Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . " removing {$relation->related_model} {$relation->related_backend} {$relation->related_id} (ACL)");
                 }
                 unset($_relations[$relationIndex]);
             }
         }
     }
 }
开发者ID:bitExpert,项目名称:Tine-2.0-Open-Source-Groupware-and-CRM,代码行数:83,代码来源:Relations.php


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