當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Item::getClassId方法代碼示例

本文整理匯總了PHP中Item::getClassId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Item::getClassId方法的具體用法?PHP Item::getClassId怎麽用?PHP Item::getClassId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Item的用法示例。


在下文中一共展示了Item::getClassId方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: resolveRelatedItemIdsByModelAndUser

 protected static function resolveRelatedItemIdsByModelAndUser(Item $model, &$relatedItemIds, User $user)
 {
     assert('is_array($relatedItemIds)');
     if (RightsUtil::canUserAccessModule($model::getModuleClassName(), $user)) {
         $itemId = $model->getClassId('Item');
         if (!in_array($itemId, $relatedItemIds)) {
             $relatedItemIds[] = $itemId;
         }
     }
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:10,代碼來源:ModelRollUpUtil.php

示例2: getAllByPersonIndexedByType

 /**
  * Given a Item (Either User or Person),  Try to find an existing models and index the returning array by
  * badge type.
  * @param Item $person
  */
 public static function getAllByPersonIndexedByType(Item $person)
 {
     assert('$person->id > 0');
     assert('$person instanceof Contact || $person instanceof User');
     $searchAttributeData = array();
     $searchAttributeData['clauses'] = array(1 => array('attributeName' => 'person', 'relatedAttributeName' => 'id', 'operatorType' => 'equals', 'value' => $person->getClassId('Item')));
     $searchAttributeData['structure'] = '1';
     $joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('GameBadge');
     $where = RedBeanModelDataProvider::makeWhere('GameBadge', $searchAttributeData, $joinTablesAdapter);
     $models = self::getSubset($joinTablesAdapter, null, null, $where, null);
     $indexedModels = array();
     foreach ($models as $gameBadge) {
         $indexedModels[$gameBadge->type] = $gameBadge;
     }
     return $indexedModels;
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:21,代碼來源:GameBadge.php

示例3: resolveByPerson

 /**
  * Given an Item (Either User or Person),  try to find an existing model. If the model does
  * not exist, create it and populate the Item.
  * @param Item $person
  * @return The found or created model.
  * @throws NotSupportedException
  */
 public static function resolveByPerson(Item $person)
 {
     assert('$person->id > 0');
     assert('$person instanceof Contact || $person instanceof User');
     $searchAttributeData = array();
     $searchAttributeData['clauses'] = array(1 => array('attributeName' => 'person', 'relatedAttributeName' => 'id', 'operatorType' => 'equals', 'value' => $person->getClassId('Item')));
     $searchAttributeData['structure'] = '1';
     $joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('GameCoin');
     $where = RedBeanModelDataProvider::makeWhere('GameCoin', $searchAttributeData, $joinTablesAdapter);
     $models = self::getSubset($joinTablesAdapter, null, 2, $where, null);
     if (count($models) > 1) {
         $logContent = 'Duplicate Game Coin for Person: ' . $person->id;
         GamificationUtil::logAndNotifyOnDuplicateGameModel($logContent);
         return $models[0];
     }
     if (count($models) == 0) {
         $gameCoin = new GameCoin();
         $gameCoin->person = $person;
         $gameCoin->value = 0;
         return $gameCoin;
     }
     return $models[0];
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:30,代碼來源:GameCoin.php

示例4: doNotificationSubscribersContainPerson

 public function doNotificationSubscribersContainPerson(Item $item)
 {
     foreach ($this->notificationSubscribers as $notificationSubscriber) {
         if ($notificationSubscriber->person->getClassId('Item') == $item->getClassId('Item')) {
             return true;
         }
     }
     return false;
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:9,代碼來源:Task.php

示例5: resolvePersonAndAvailableTypes

 /**
  * Given an  Item (Either User or Person),  try to find an existing model for each type. If the model does
  * not exist, create it and populate the Item and type. @return models found or created indexed by type.
  * @param Item $person
  * @param array $levelTypes - Level types
  */
 public static function resolvePersonAndAvailableTypes(Item $person, $levelTypes)
 {
     assert('$person->id > 0');
     assert('$person instanceof Contact || $person instanceof User');
     assert('is_array($levelTypes)');
     $searchAttributeData = array();
     $searchAttributeData['clauses'] = array(1 => array('attributeName' => 'person', 'relatedAttributeName' => 'id', 'operatorType' => 'equals', 'value' => $person->getClassId('Item')));
     $searchAttributeData['structure'] = '1';
     $joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('GameLevel');
     $where = RedBeanModelDataProvider::makeWhere('GameLevel', $searchAttributeData, $joinTablesAdapter);
     $models = self::getSubset($joinTablesAdapter, null, null, $where, null);
     $modelsByType = array();
     foreach ($levelTypes as $type) {
         $modelFound = false;
         foreach ($models as $model) {
             if ($model->type == $type) {
                 $modelsByType[$type] = $model;
                 $modelFound = true;
                 break;
             }
         }
         if (!$modelFound) {
             $gameLevel = new GameLevel();
             $gameLevel->type = $type;
             $gameLevel->person = $person;
             $gameLevel->value = 1;
             $modelsByType[$type] = $gameLevel;
         }
     }
     return $modelsByType;
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:37,代碼來源:GameLevel.php

示例6: getAllTasksByType

 /**
  * Get all tasks by kanban type
  * @param int $taskType
  * @param Item $childObjectOfItem
  * @return array of objects
  */
 public static function getAllTasksByType($taskType, Item $childObjectOfItem)
 {
     assert('is_int($taskType)');
     $searchAttributeData = array();
     $searchAttributeData['clauses'] = array(1 => array('attributeName' => 'type', 'operatorType' => 'equals', 'value' => intval($taskType)), 2 => array('attributeName' => 'kanbanRelatedItem', 'operatorType' => 'equals', 'value' => $childObjectOfItem->getClassId('Item')));
     $searchAttributeData['structure'] = '(1 and 2)';
     $joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter(get_called_class());
     $where = RedBeanModelDataProvider::makeWhere(get_called_class(), $searchAttributeData, $joinTablesAdapter);
     $models = self::getSubset($joinTablesAdapter, null, null, $where, 'sortOrder ASC');
     return $models;
 }
開發者ID:maruthisivaprasad,項目名稱:zurmo,代碼行數:17,代碼來源:KanbanItem.php

示例7: resolvePersonAndAvailableTypes

 /**
  * Given an  Item (Either User or Person),  try to find an existing model for each type. If the model does
  * not exist, create it and populate the Item and type. @return models found or created indexed by type.
  * @param Item $person
  * @param $collectionTypes
  * @return array
  * @throws FailedToSaveModelException
  */
 public static function resolvePersonAndAvailableTypes(Item $person, $collectionTypes)
 {
     assert('$person->id > 0');
     assert('$person instanceof Contact || $person instanceof User');
     assert('is_array($collectionTypes)');
     $searchAttributeData = array();
     $searchAttributeData['clauses'] = array(1 => array('attributeName' => 'person', 'relatedAttributeName' => 'id', 'operatorType' => 'equals', 'value' => $person->getClassId('Item')));
     $searchAttributeData['structure'] = '1';
     $joinTablesAdapter = new RedBeanModelJoinTablesQueryAdapter('GameCollection');
     $where = RedBeanModelDataProvider::makeWhere('GameCollection', $searchAttributeData, $joinTablesAdapter);
     $models = self::getSubset($joinTablesAdapter, null, null, $where, null);
     $modelsByType = array();
     foreach ($collectionTypes as $type) {
         $modelFound = false;
         foreach ($models as $model) {
             if ($model->type == $type) {
                 $modelsByType[$type] = $model;
                 $modelFound = true;
                 break;
             }
         }
         if (!$modelFound) {
             $gameCollectionRules = GameCollectionRulesFactory::createByType($type);
             $gameCollection = new GameCollection();
             $gameCollection->type = $type;
             $gameCollection->person = $person;
             $gameCollection->serializedData = serialize($gameCollectionRules::makeDefaultData());
             $saved = $gameCollection->save();
             if (!$saved) {
                 throw new FailedToSaveModelException();
             }
             $modelsByType[$type] = $gameCollection;
         }
     }
     return $modelsByType;
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:44,代碼來源:GameCollection.php


注:本文中的Item::getClassId方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。