本文整理汇总了PHP中Tinebase_Record_Abstract::has方法的典型用法代码示例。如果您正苦于以下问题:PHP Tinebase_Record_Abstract::has方法的具体用法?PHP Tinebase_Record_Abstract::has怎么用?PHP Tinebase_Record_Abstract::has使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Tinebase_Record_Abstract
的用法示例。
在下文中一共展示了Tinebase_Record_Abstract::has方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _resolveClientRecordTags
/**
* resolve tag ids to tag record
*
* @todo find a generic solution for this!
*/
protected function _resolveClientRecordTags()
{
if (!$this->_clientRecord->has('tags') || empty($this->_clientRecord->tags)) {
return;
}
$tags = new Tinebase_Record_RecordSet('Tinebase_Model_Tag');
foreach ($this->_clientRecord->tags as $tag) {
if (is_string($tag)) {
$tag = Tinebase_Tags::getInstance()->get($tag);
}
$tags->addRecord($tag);
}
$this->_clientRecord->tags = $tags;
}
示例2: _dependentRecordsFromJson
/**
* creates recordsets for depedent records or records instead of arrays for records on record fields
* and sets timezone of these records to utc
*
* @param Tinebase_Record_Abstract $record
*/
protected function _dependentRecordsFromJson(&$record)
{
$config = $record::getConfiguration();
if ($config) {
$recordsFields = $config->recordsFields;
if ($recordsFields) {
foreach (array_keys($recordsFields) as $property) {
$rcn = $recordsFields[$property]['config']['recordClassName'];
if ($record->has($property) && $record->{$property} && is_array($record->{$property})) {
$recordSet = new Tinebase_Record_RecordSet($rcn);
foreach ($record->{$property} as $recordArray) {
if (is_array($recordArray)) {
$srecord = new $rcn(array(), true);
$srecord->setFromJsonInUsersTimezone($recordArray);
$recordSet->addRecord($srecord);
} else {
if (Tinebase_Core::isLogLevel(Zend_Log::ERR)) {
Tinebase_Core::getLogger()->err(__METHOD__ . '::' . __LINE__ . ' Record array expected, got: ' . $recordArray);
}
throw new Tinebase_Exception_InvalidArgument('Record array expected');
}
$record->{$property} = $recordSet;
}
}
}
}
}
}
示例3: resolveContainerOfRecord
/**
* resolves container_id property
*
* @param Tinebase_Record_Abstract $_record
* @param string $_containerProperty
*/
public static function resolveContainerOfRecord($_record, $_containerProperty = 'container_id')
{
if (!$_record instanceof Tinebase_Record_Abstract) {
return;
}
if (!$_record->has($_containerProperty) || empty($_record->{$_containerProperty})) {
return;
}
try {
$container = Tinebase_Container::getInstance()->getContainerById($_record->{$_containerProperty});
} catch (Tinebase_Exception_NotFound $tenf) {
if (Tinebase_Core::isLogLevel(Zend_Log::NOTICE)) {
Tinebase_Core::getLogger()->notice(__METHOD__ . '::' . __LINE__ . ' ' . $tenf);
}
return;
}
$container->resolveGrantsAndPath();
$_record->{$_containerProperty} = $container;
}
示例4: setRecordMetaData
/**
* sets record modification data and protects it from spoofing
*
* @param Tinebase_Record_Abstract $_newRecord record from user data
* @param string $_action one of {create|update|delete}
* @param Tinebase_Record_Abstract $_curRecord record from storage
* @throws Tinebase_Exception_InvalidArgument
*/
public static function setRecordMetaData($_newRecord, $_action, $_curRecord = NULL)
{
// disable validation as this is slow and we are setting valid data here
$bypassFilters = $_newRecord->bypassFilters;
$_newRecord->bypassFilters = TRUE;
list($currentAccountId, $currentTime) = self::getCurrentAccountIdAndTime();
// spoofing protection
$_newRecord->created_by = $_curRecord ? $_curRecord->created_by : NULL;
$_newRecord->creation_time = $_curRecord ? $_curRecord->creation_time : NULL;
$_newRecord->last_modified_by = $_curRecord ? $_curRecord->last_modified_by : NULL;
$_newRecord->last_modified_time = $_curRecord ? $_curRecord->last_modified_time : NULL;
if ($_newRecord->has('is_deleted')) {
$_newRecord->is_deleted = $_curRecord ? $_curRecord->is_deleted : 0;
$_newRecord->deleted_time = $_curRecord ? $_curRecord->deleted_time : NULL;
$_newRecord->deleted_by = $_curRecord ? $_curRecord->deleted_by : NULL;
}
switch ($_action) {
case 'create':
$_newRecord->created_by = $currentAccountId;
$_newRecord->creation_time = $currentTime;
if ($_newRecord->has('seq')) {
$_newRecord->seq = 1;
}
break;
case 'update':
$_newRecord->last_modified_by = $currentAccountId;
$_newRecord->last_modified_time = $currentTime;
self::increaseRecordSequence($_newRecord, $_curRecord);
break;
case 'delete':
$_newRecord->deleted_by = $currentAccountId;
$_newRecord->deleted_time = $currentTime;
$_newRecord->is_deleted = true;
self::increaseRecordSequence($_newRecord, $_curRecord);
break;
default:
throw new Tinebase_Exception_InvalidArgument('Action must be one of {create|update|delete}.');
break;
}
$_newRecord->bypassFilters = $bypassFilters;
}