Ejemplo n.º 1
0
 public static function create($identity, $data = null)
 {
     $founder = $data['founder'] ? $data['founder'] : null;
     $desc = $data['description'] ? $data['description'] : '';
     $url = isset($data['clan_avatar_url']) ? $data['clan_avatar_url'] : null;
     $name = $identity;
     $new_clan_id = insert_query('insert into clan (clan_name, clan_avatar_url, clan_founder, description) values (:name, :url, :founder, :desc)', [':name' => $name, ':url' => $url, ':founder' => $founder, ':desc' => $desc], 'clan_clan_id_seq');
     if (!positive_int($new_clan_id)) {
         throw new \Exception('Clan not inserted into database properly!');
     }
     return ClanFactory::find($new_clan_id);
 }
Ejemplo n.º 2
0
 /**
  * Sends a request to a clan leader for the current user to join a clan
  *
  * @return Array The viewspec
  */
 public function join()
 {
     $clanID = (int) in('clan_id', null);
     $clan = ClanFactory::find($clanID);
     $this->sendClanJoinRequest(self_char_id(), $clanID);
     $leader = $clan->getLeaderInfo();
     return $this->render(['action_message' => "Your request to join {$clan->getName()} has been sent to {$leader['uname']}", 'title' => 'Viewing a clan', 'clan' => $clan, 'pageParts' => ['reminder-no-clan', 'info', 'member-list']]);
 }
Ejemplo n.º 3
0
 function testGetClanObjectNumericRating()
 {
     $this->markTestIncomplete('Clan rating is not yet implemented');
     $player1 = new Player($this->char_id);
     $clan = ClanFactory::find($this->clan_id);
     $this->assertTrue($clan->addMember($player1, $player1));
     $this->assertTrue($clan->addMember(new Player($this->char_id_2), $player1));
     $this->assertTrue($clan->rating());
 }