本文整理汇总了PHP中Activity::getMetadata方法的典型用法代码示例。如果您正苦于以下问题:PHP Activity::getMetadata方法的具体用法?PHP Activity::getMetadata怎么用?PHP Activity::getMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity::getMetadata方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addRelatedModelAccountToModel
/**
* Copy the account from a related model to a activity items
* @param RedBeanModel $model
* @param RedBeanModel $relatedModel
*/
protected function addRelatedModelAccountToModel(RedBeanModel $model, RedBeanModel $relatedModel)
{
$metadata = Activity::getMetadata();
if ($relatedModel->isRelation('account') && isset($relatedModel->account) && $relatedModel->account->id > 0 && in_array(get_class($relatedModel->account), $metadata['Activity']['activityItemsModelClassNames'])) {
$model->activityItems->add($relatedModel->account);
}
}
示例2: init
public function init()
{
$metadata = Activity::getMetadata();
$observedModelClassNames = $metadata['Activity']['activityItemsModelClassNames'];
if ($observedModelClassNames == null) {
return;
}
foreach ($observedModelClassNames as $modelClassName) {
$modelClassName::model()->attachEventHandler('onAfterDelete', array($this, 'deleteActivityItems'));
}
}
示例3: canUserPerformAction
/**
* Runs through relations and makes sure the user can access at least one relation. If at least one is
* accessible, true is returned.
*/
public function canUserPerformAction()
{
$metadata = Activity::getMetadata();
foreach ($metadata['Activity']['activityItemsModelClassNames'] as $modelClassName) {
if (is_subclass_of($modelClassName, 'Item') && $modelClassName::getModuleClassName() != null) {
if (RightsUtil::canUserAccessModule($modelClassName::getModuleClassName(), $this->user)) {
}
return true;
}
}
return false;
}
示例4: resolveNewModelByRelationInformation
/**
* Override to handle the special scenario of relations for an activity. Since relations are done in the
* ActivityItems, the relation information needs to handled in a specific way.
* @see ZurmoModuleController->resolveNewModelByRelationInformation
*/
protected function resolveNewModelByRelationInformation($model, $relationModelClassName, $relationModelId, $relationModuleId)
{
assert('$model instanceof Activity');
assert('is_string($relationModelClassName)');
assert('is_int($relationModelId)');
assert('is_string($relationModuleId)');
$metadata = Activity::getMetadata();
if (in_array($relationModelClassName, $metadata['Activity']['activityItemsModelClassNames'])) {
$model->activityItems->add($relationModelClassName::getById((int) $relationModelId));
} else {
throw new NotSupportedException();
}
return $model;
}
示例5: getActivityItemsDerivedAttributeTypesAndResolveAccessByCurrentUser
protected static function getActivityItemsDerivedAttributeTypesAndResolveAccessByCurrentUser()
{
$metadata = Activity::getMetadata();
$derivedAttributeTypes = array();
$activityItemsModelClassNames = $metadata['Activity']['activityItemsModelClassNames'];
foreach ($activityItemsModelClassNames as $modelClassName) {
$moduleClassName = $modelClassName::getModuleClassName();
if (RightsUtil::canUserAccessModule($moduleClassName, Yii::app()->user->userModel)) {
$derivedAttributeTypes[] = $modelClassName . 'Derived';
}
//todo: add support for leads.
}
return $derivedAttributeTypes;
}
示例6: resolveCustomMetadataAndLoad
public static function resolveCustomMetadataAndLoad()
{
$shouldSaveZurmoModuleMetadata = false;
$metadata = ZurmoModule::getMetadata();
if (!in_array('animals', $metadata['global']['tabMenuItemsModuleOrdering'])) {
$metadata['global']['tabMenuItemsModuleOrdering'][] = 'animals';
$shouldSaveZurmoModuleMetadata = true;
}
if ($shouldSaveZurmoModuleMetadata) {
ZurmoModule::setMetadata($metadata);
GeneralCache::forgetAll();
}
$metadata = Activity::getMetadata();
if (!in_array('Animal', $metadata['Activity']['activityItemsModelClassNames'])) {
$metadata['Activity']['activityItemsModelClassNames'][] = 'Animal';
Activity::setMetadata($metadata);
GeneralCache::forgetAll();
}
Yii::import('application.extensions.zurmoinc.framework.data.*');
Yii::import('application.modules.animals.data.*');
$defaultDataMaker = new AnimalsDefaultDataMaker();
$defaultDataMaker->make();
}
示例7: renderRelatedModelsByImportanceContent
/**
* Renders related models. But only renders one type of related model given that the $model supplied
* is connected to more than one type of activity item. There is an order of importance that is checked
* starting with Account, then Contact, then Opportunity. If none are found, then it grabs the first available.
* @see getActivityItemsStringContentByModelClassName
* @param RedBeanModel $model
*/
public function renderRelatedModelsByImportanceContent(RedBeanModel $model)
{
if ($model->activityItems->count() == 0) {
return;
}
$stringContent = self::getActivityItemsStringContentByModelClassName($model, 'Account');
if ($stringContent != null) {
return Zurmo::t('ActivitiesModule', 'for {relatedModelsStringContent}', array('{relatedModelsStringContent}' => $stringContent));
}
$stringContent = self::getActivityItemsStringContentByModelClassName($model, 'Contact', 'ContactsStateMetadataAdapter');
if ($stringContent != null) {
return Zurmo::t('ActivitiesModule', 'with {relatedContactsStringContent}', array('{relatedContactsStringContent}' => $stringContent));
}
$stringContent = self::getActivityItemsStringContentByModelClassName($model, 'Opportunity');
if ($stringContent != null) {
return Zurmo::t('ActivitiesModule', 'for {relatedModelsStringContent}', array('{relatedModelsStringContent}' => $stringContent));
}
$metadata = Activity::getMetadata();
$stringContent = self::getFirstActivityItemStringContent($metadata['Activity']['activityItemsModelClassNames'], $model);
if ($stringContent != null) {
return Zurmo::t('ActivitiesModule', 'for {relatedModelsStringContent}', array('{relatedModelsStringContent}' => $stringContent));
}
}
示例8: getActivityItemsModelClassNames
public static function getActivityItemsModelClassNames()
{
$metadata = Activity::getMetadata();
return $metadata['Activity']['activityItemsModelClassNames'];
}
示例9: getRelatedItemsModelClassNames
protected static function getRelatedItemsModelClassNames()
{
$metadata = Activity::getMetadata();
return $metadata['Activity']['activityItemsModelClassNames'];
}
示例10: __construct
public function __construct($relationModel)
{
$metadata = Activity::getMetadata();
assert('in_array(get_class($relationModel), $metadata["Activity"]["activityItemsModelClassNames"])');
parent::__construct($relationModel);
}
示例11: getActivityItemsModelClassNamesDataExcludingContacts
public static function getActivityItemsModelClassNamesDataExcludingContacts()
{
$metadata = Activity::getMetadata();
$activityItemsModelClassNamesData = $metadata['Activity']['activityItemsModelClassNames'];
foreach ($activityItemsModelClassNamesData as $index => $relationModelClassName) {
if ($relationModelClassName == 'Contact') {
unset($activityItemsModelClassNamesData[$index]);
}
}
return $activityItemsModelClassNamesData;
}