示例#1
0
 protected function setup()
 {
     $cardRepository = new CardRepository(TRUE);
     $cardRepository->setGroupBy('card_base_type');
     $cards = $cardRepository->getAll();
     MySmarty::assign('cards', $cards);
 }
示例#2
0
 public function getRelatedCards()
 {
     $characterRelatedCardRepository = new CharacterRelatedCardRepository();
     $characterRelatedCards = $characterRelatedCardRepository->getByCharakter($this['id']);
     $cardBaseTypes = array();
     foreach ($characterRelatedCards as $characterRelatedCard) {
         $cardBaseTypes[] = $characterRelatedCard['card_base_type'];
     }
     $cardRepository = new CardRepository();
     $cardRepository->setGroupBy('card_base_type');
     return $cardRepository->getByCardBaseType($cardBaseTypes);
 }
示例#3
0
 protected function setup()
 {
     // cards
     $cardBaseTypeRepository = new CardBaseTypeRepository(TRUE);
     $validCardBaseTypes = $cardBaseTypeRepository->getByValid(1);
     $validCardBaseTypesIdList = array();
     foreach ($validCardBaseTypes as $cardBaseType) {
         $validCardBaseTypesIdList[] = $cardBaseType['id'];
     }
     $cardRepository = new CardRepository(TRUE);
     $cardRepository->setGroupBy('card_base_type');
     $cards = $cardRepository->getAll();
     $validCards = array();
     $notValidCards = array();
     foreach ($cards as $card) {
         if (in_array($card['card_base_type'], $validCardBaseTypesIdList)) {
             $validCards[] = $card;
         } else {
             $notValidCards[] = $card;
         }
     }
     MySmarty::assign('validCards', $validCards);
     MySmarty::assign('notValidCards', $notValidCards);
     // characters
     $characterRepository = new CharacterRepository(TRUE);
     $characters = $characterRepository->getAll();
     $validCharacters = array();
     $notValidCharacters = array();
     foreach ($characters as $character) {
         if ($character['valid'] == 1) {
             $validCharacters[] = $character;
         } else {
             $notValidCharacters[] = $character;
         }
     }
     MySmarty::assign('validCharacters', $validCharacters);
     MySmarty::assign('notValidCharacters', $notValidCharacters);
 }
示例#4
0
文件: Card.php 项目: Tomeno/lulcobang
 /**
  * getter for related cards via common card_group_type of their cardBaseType
  *
  * @return	array<Card>
  */
 public function getRelatedCards()
 {
     $cardBaseType = $this->getAdditionalField('cardBaseType');
     if ($cardBaseType) {
         $cardBaseTypeRepository = new CardBaseTypeRepository();
         $cardBaseTypeRepository->addAdditionalWhere(array('column' => 'id', 'value' => $this['card_base_type'], 'xxx' => '!='));
         $cardBaseTypeList = $cardBaseTypeRepository->getByCardGroupType($cardBaseType['card_group_type']);
         $cardBaseTypes = array();
         foreach ($cardBaseTypeList as $oneCardBaseType) {
             $cardBaseTypes[] = $oneCardBaseType['id'];
         }
         $cardRepository = new CardRepository();
         $cardRepository->setGroupBy('card_base_type');
         return $cardRepository->getByCardBaseType($cardBaseTypes);
     }
 }