本文整理汇总了PHP中Tinebase_Record_RecordSet::getRecordClassName方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Record_RecordSet::getRecordClassName方法的具体用法?PHP Tinebase_Record_RecordSet::getRecordClassName怎么用?PHP Tinebase_Record_RecordSet::getRecordClassName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_Record_RecordSet
的用法示例。
在下文中一共展示了Tinebase_Record_RecordSet::getRecordClassName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _multipleRecordsToJson
/**
* returns multiple records prepared for json transport
*
* @param Tinebase_Record_RecordSet $_records Tinebase_Record_Abstract
* @param Tinebase_Model_Filter_FilterGroup $_filter
* @param Tinebase_Model_Pagination $_pagination needed for sorting
* @return array data
*
* @todo perhaps we need to resolveContainerTagsUsers() before mergeAndRemoveNonMatchingRecurrences(), but i'm not sure about that
* @todo use Calendar_Convert_Event_Json
*/
protected function _multipleRecordsToJson(Tinebase_Record_RecordSet $_records, $_filter = NULL, $_pagination = NULL)
{
if ($_records->getRecordClassName() == 'Calendar_Model_Event') {
if (is_null($_filter)) {
throw new Tinebase_Exception_InvalidArgument('Required argument $_filter is missing');
}
Tinebase_Notes::getInstance()->getMultipleNotesOfRecords($_records);
Calendar_Model_Attender::resolveAttendee($_records->attendee, TRUE, $_records);
Calendar_Convert_Event_Json::resolveOrganizer($_records);
Calendar_Convert_Event_Json::resolveRrule($_records);
Calendar_Controller_Event::getInstance()->getAlarms($_records);
Calendar_Model_Rrule::mergeAndRemoveNonMatchingRecurrences($_records, $_filter);
$_records->sortByPagination($_pagination);
$eventsData = parent::_multipleRecordsToJson($_records);
foreach ($eventsData as $eventData) {
if (!array_key_exists(Tinebase_Model_Grants::GRANT_READ, $eventData) || !$eventData[Tinebase_Model_Grants::GRANT_READ]) {
$eventData['notes'] = array();
$eventData['tags'] = array();
}
}
return $eventsData;
}
return parent::_multipleRecordsToJson($_records);
}
示例2: _multipleRecordsToJson
/**
* returns multiple records prepared for json transport
*
* @param Tinebase_Record_RecordSet $_records Tinebase_Record_Abstract
* @param Tinebase_Model_Filter_FilterGroup $_filter
* @param Tinebase_Model_Pagination $_pagination
* @return array data
*/
protected function _multipleRecordsToJson(Tinebase_Record_RecordSet $_records, $_filter = NULL, $_pagination = null)
{
switch ($_records->getRecordClassName()) {
case 'Sipgate_Model_Connection':
Sipgate_Controller_Line::getInstance()->resolveMultipleLines($_records);
$this->_resolveMultipleContacts($_records);
break;
case 'Sipgate_Model_Line':
Sipgate_Controller_Account::getInstance()->resolveMultipleAccounts($_records);
Tinebase_User::getInstance()->resolveMultipleUsers($_records, $this->_resolveUserFields['Sipgate_Model_Line']);
break;
}
return parent::_multipleRecordsToJson($_records);
}
示例3: _multipleRecordsToJson
/**
* returns multiple records prepared for json transport
*
* @param Tinebase_Record_RecordSet $_records Tinebase_Record_Abstract
* @param Tinebase_Model_Filter_FilterGroup $_filter
* @return array data
*/
protected function _multipleRecordsToJson(Tinebase_Record_RecordSet $_records, $_filter = NULL)
{
switch ($_records->getRecordClassName()) {
case 'Tinebase_Model_AccessLog':
// TODO use _resolveUserFields and remove this
foreach ($_records as $record) {
if (!empty($record->account_id)) {
try {
$record->account_id = Admin_Controller_User::getInstance()->get($record->account_id)->toArray();
} catch (Tinebase_Exception_NotFound $e) {
$record->account_id = Tinebase_User::getInstance()->getNonExistentUser('Tinebase_Model_FullUser')->toArray();
}
}
}
break;
case 'Tinebase_Model_Container':
case 'Tinebase_Model_CustomField_Config':
$applications = Tinebase_Application::getInstance()->getApplications();
foreach ($_records as $record) {
$idx = $applications->getIndexById($record->application_id);
if ($idx !== FALSE) {
$record->application_id = $applications[$idx];
}
}
break;
}
$result = parent::_multipleRecordsToJson($_records, $_filter);
return $result;
}
示例4: diff
/**
* compares two recordsets / only compares the ids / returns all records that are different in an array:
* - removed -> all records that are in $this but not in $_recordSet
* - added -> all records that are in $_recordSet but not in $this
* - modified -> array of diffs for all different records that are in both record sets
*
* @param Tinebase_Record_RecordSet $recordSet
* @return Tinebase_Record_RecordSetDiff
*/
public function diff($recordSet)
{
if (!$recordSet instanceof Tinebase_Record_RecordSet) {
if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) {
Tinebase_Core::getLogger()->debug(__METHOD__ . '::' . __LINE__ . ' Did not get Tinebase_Record_RecordSet, skipping diff(' . $this->_recordClass . ')');
}
return new Tinebase_Record_RecordSetDiff(array('model' => $this->getRecordClassName()));
}
if ($this->getRecordClassName() !== $recordSet->getRecordClassName()) {
throw new Tinebase_Exception_InvalidArgument('can only compare recordsets with the same type of records');
}
$existingRecordsIds = $this->getArrayOfIds();
$toCompareWithRecordsIds = $recordSet->getArrayOfIds();
$removedIds = array_diff($existingRecordsIds, $toCompareWithRecordsIds);
$addedIds = array_diff($toCompareWithRecordsIds, $existingRecordsIds);
$modifiedIds = array_intersect($existingRecordsIds, $toCompareWithRecordsIds);
$removed = new Tinebase_Record_RecordSet($this->getRecordClassName());
$added = new Tinebase_Record_RecordSet($this->getRecordClassName());
$modified = new Tinebase_Record_RecordSet('Tinebase_Record_Diff');
foreach ($addedIds as $id) {
$added->addRecord($recordSet->getById($id));
}
// consider records without id, too
foreach ($recordSet->getIdLessIndexes() as $index) {
$added->addRecord($recordSet->getByIndex($index));
}
foreach ($removedIds as $id) {
$removed->addRecord($this->getById($id));
}
// consider records without id, too
foreach ($this->getIdLessIndexes() as $index) {
$removed->addRecord($this->getByIndex($index));
}
foreach ($modifiedIds as $id) {
$diff = $this->getById($id)->diff($recordSet->getById($id));
if (!$diff->isEmpty()) {
$modified->addRecord($diff);
}
}
$result = new Tinebase_Record_RecordSetDiff(array('model' => $this->getRecordClassName(), 'added' => $added, 'removed' => $removed, 'modified' => $modified));
return $result;
}
示例5: _multipleRecordsToJson
/**
* returns multiple records prepared for json transport
*
* @param Tinebase_Record_RecordSet $_records Tinebase_Record_Abstract
* @param Tinebase_Model_Filter_FilterGroup
* @return array data
*/
protected function _multipleRecordsToJson(Tinebase_Record_RecordSet $_records, $_filter = NULL)
{
if ($_records->getRecordClassName() == 'Tasks_Model_Task') {
// NOTE: in contrast to calendar, organizers in tasks are accounts atm.
Tinebase_User::getInstance()->resolveMultipleUsers($_records, 'organizer', true);
}
//if (Tinebase_Core::isLogLevel(Zend_Log::DEBUG)) Tinebase_Core::getLogger()->debug(print_r($_records->toArray(), true));
return parent::_multipleRecordsToJson($_records);
}
示例6: resolveMultipleIdFields
/**
* resolves multiple records (fallback)
*
* @deprecated use Tinebase_ModelConfiguration to configure your models, so this won't be used anymore
* @param Tinebase_Record_RecordSet $records the records
* @param array $resolveFields
*/
public static function resolveMultipleIdFields($records, $resolveFields = NULL)
{
if (!$records instanceof Tinebase_Record_RecordSet || !$records->count()) {
return;
}
/** @var Tinebase_Record_Interface $ownRecordClass */
$ownRecordClass = $records->getRecordClassName();
if ($resolveFields === NULL) {
$resolveFields = $ownRecordClass::getResolveForeignIdFields();
}
if (Tinebase_Core::isLogLevel(Zend_Log::TRACE)) {
Tinebase_Core::getLogger()->trace(__METHOD__ . '::' . __LINE__ . ' Resolving ' . $ownRecordClass . ' fields: ' . print_r($resolveFields, TRUE));
}
foreach ((array) $resolveFields as $foreignRecordClassName => $fields) {
if ($foreignRecordClassName === 'recursive') {
foreach ($fields as $field => $model) {
foreach ($records->{$field} as $subRecords) {
self::resolveMultipleIdFields($subRecords);
}
}
} else {
self::_resolveForeignIdFields($records, $foreignRecordClassName, (array) $fields);
}
}
}