public function actionIndex()
 {
     $model = new Ranks('search');
     $model->unsetAttributes();
     // clear any default values
     if (isset($_GET['Ranks'])) {
         $model->attributes = $_GET['Ranks'];
     }
     $this->render('admin', array('model' => $model));
 }
 /**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer $id the ID of the model to be loaded
  * @return Ranks the loaded model
  * @throws CHttpException
  */
 public function loadModel($id)
 {
     $model = Ranks::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Пример #3
0
 /**
  * inserts a new guild to database
  *
  * we always add guilds with an id greater than zero. this way, the guild with id=zero is the "guildless" guild
  * the zero guild is added by default in a new install.
  * do not delete the zero record in the guild table or you will see that guildless members
  * become invisible in the roster and in the memberlist or in any list member selection that makes
  * an inner join with the guild table.
  */
 public function MakeGuild()
 {
     global $cache, $user, $db, $phpEx, $phpbb_root_path;
     if ($this->name == null || $this->realm == null) {
         trigger_error($user->lang['ERROR_GUILDEMPTY'], E_USER_WARNING);
     }
     $cache->destroy('sql', GUILD_TABLE);
     // check existing guild-realmname
     $result = $db->sql_query("SELECT count(*) as evcount from " . GUILD_TABLE . "\n\t\t\tWHERE id !=0 AND UPPER(name) = '" . strtoupper($db->sql_escape($this->name)) . "'\n\t\t\tAND UPPER(realm) = '" . strtoupper($db->sql_escape($this->realm)) . "'");
     $grow = $db->sql_fetchrow($result);
     if ($grow['evcount'] != 0) {
         trigger_error($user->lang['ERROR_GUILDTAKEN'], E_USER_WARNING);
     }
     $result = $db->sql_query("SELECT MAX(id) as id FROM " . GUILD_TABLE . ";");
     $row = $db->sql_fetchrow($result);
     $this->guildid = (int) $row['id'] + 1;
     //@todo complete this
     $this->aionlegionid = 0;
     $this->aionserverid = 0;
     $query = $db->sql_build_array('INSERT', array('game_id' => $this->game_id, 'id' => $this->guildid, 'name' => $this->name, 'realm' => $this->realm, 'region' => $this->region, 'roster' => $this->showroster, 'aion_legion_id' => $this->aionlegionid, 'aion_server_id' => $this->aionserverid, 'min_armory' => $this->min_armory, 'guilddefault' => $this->guilddefault, 'armory_enabled' => $this->armory_enabled, 'rec_status' => $this->recstatus, 'recruitforum' => $this->recruitforum, 'members' => 0));
     $db->sql_query('INSERT INTO ' . GUILD_TABLE . $query);
     //add a default rank
     if (!class_exists('\\bbdkp\\controller\\guilds\\Ranks')) {
         require "{$phpbb_root_path}includes/bbdkp/controller/guilds/Ranks.{$phpEx}";
     }
     $newrank = new Ranks($this->guildid);
     // add guildleader rank
     $newrank->RankName = $user->lang['GUILDLEADER'];
     $newrank->RankId = 0;
     $newrank->RankHide = 0;
     $newrank->RankPrefix = '';
     $newrank->RankSuffix = '';
     $newrank->Makerank();
     $log_action = array('header' => 'L_ACTION_GUILD_ADDED', 'id' => $this->guildid, 'L_USER' => $user->data['user_id'], 'L_USERCOLOUR' => $user->data['user_colour'], 'L_NAME' => $this->name, 'L_REALM' => $this->realm, 'L_ADDED_BY' => $user->data['username']);
     $this->log_insert(array('log_type' => $log_action['header'], 'log_action' => $log_action));
     $this->ApiUpdateBattleNet($this->GetApiInfo(array()), array());
     return true;
 }
 protected function processPage($url, $pageContent)
 {
     $bookPage = $pageContent;
     list($rank_best_sell, $info_best_sell, $info_ranks, $title, $isbn_10, $isbn_13) = $this->getPageInfos($bookPage);
     if (empty($title) || empty($rank_best_sell)) {
         return false;
     }
     if (empty($isbn_13) && empty($isbn_10)) {
         printf("This has not isbn:\"%s\"\n", $url);
         return false;
     }
     list($main_image, $thumb_image) = $this->getImages($bookPage);
     $rank = Ranks::model()->find('url=:url', array('url' => $url));
     if (empty($rank)) {
         $rank = new Ranks();
     }
     $rank->url = $url;
     $rank->rank_best_sell = $rank_best_sell;
     $rank->info_best_sell = $info_best_sell;
     $rank->info_ranks = $info_ranks;
     $rank->title = $title;
     $rank->isbn_10 = $isbn_10;
     $rank->isbn_13 = $isbn_13;
     $rank->main_image = $main_image;
     $rank->thumb_image = $thumb_image;
     $rank->utime = date("Y-m-d H:i:s");
     try {
         $rank->save();
     } catch (Exception $e) {
         $this->printException($e);
     }
     return true;
 }