| 1 | <?php
|
|---|
| 2 |
|
|---|
| 3 | include_once(dirname(__FILE__).'/../../Base/View.php');
|
|---|
| 4 |
|
|---|
| 5 | class RealmView extends View
|
|---|
| 6 | {
|
|---|
| 7 | var $ItemFormClass = array(
|
|---|
| 8 | 'Title' => 'Nastavení světa',
|
|---|
| 9 | 'Table' => 'Realm',
|
|---|
| 10 | 'SubmitText' => 'Uložit',
|
|---|
| 11 | 'Items' => array(
|
|---|
| 12 | 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => 'WoW server'),
|
|---|
| 13 | 'Description' => array('Type' => 'Text', 'Caption' => 'Popis', 'Default' => ''),
|
|---|
| 14 | 'Type' => array('Type' => 'ServerType', 'Caption' => 'Typ', 'Default' => 0),
|
|---|
| 15 | 'Database' => array('Type' => 'Database', 'Caption' => 'Databáze', 'Default' => 0),
|
|---|
| 16 | 'Motd' => array('Type' => 'String', 'Caption' => 'Zpráva dne', 'Default' => 'Vítejte na free WoW serveru'),
|
|---|
| 17 | 'RealmId' => array('Type' => 'Hidden', 'Caption' => 'Id', 'Default' => 0),
|
|---|
| 18 | 'TimeCreate' => array('Type' => 'DateTime', 'Caption' => 'Datum založení', 'Default' => 'NOW()'),
|
|---|
| 19 | 'NetworkPortWorldd' => array('Type' => 'Integer', 'Caption' => 'Port realmd', 'Default' => ''),
|
|---|
| 20 | ),
|
|---|
| 21 | );
|
|---|
| 22 | var $ItemListFormClass = array(
|
|---|
| 23 | 'Title' => 'Světy',
|
|---|
| 24 | 'Table' => '(SELECT `Client`.`Version`, `Realm`.`Name`, `Realm`.`Id`, `Server`.`Name` AS `ServerName`, `Realm`.`NetworkPortWorldd`, Realm.Online, Realm.CharacterOnlineCount, Realm.CharacterCount FROM `Realm` JOIN `Server` ON `Server`.`Id` = `Realm`.`Server` JOIN `Database` ON `Database`.`Id` = `Realm`.`Database` JOIN `Emulator` ON `Emulator`.`Id` = `Database`.`Emulator` JOIN `Client` ON `Client`.`Id` = `Emulator`.`Client`)',
|
|---|
| 25 | 'Items' => array(
|
|---|
| 26 | 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => ''),
|
|---|
| 27 | 'NetworkPortWorldd' => array('Type' => 'Integer', 'Caption' => 'Realmlist', 'Default' => ''),
|
|---|
| 28 | 'Version' => array('Type' => 'Integer', 'Caption' => 'Verze', 'Default' => 0),
|
|---|
| 29 | 'Online' => array('Type' => 'OnlineState', 'Caption' => 'Stav', 'Default' => 0),
|
|---|
| 30 | 'CharacterOnlineCount' => array('Type' => 'Integer', 'Caption' => 'Hráčů online', 'Default' => 0),
|
|---|
| 31 | 'CharacterCount' => array('Type' => 'Integer', 'Caption' => 'Postav', 0),
|
|---|
| 32 | 'ServerName' => array('Type' => 'String', 'Caption' => 'Server', 'Default' => ''),
|
|---|
| 33 | ),
|
|---|
| 34 | );
|
|---|
| 35 | var $CreateFormClass = array(
|
|---|
| 36 | 'Title' => 'Nový svět',
|
|---|
| 37 | 'Table' => 'Realm',
|
|---|
| 38 | 'SubmitText' => 'Vytvořit',
|
|---|
| 39 | 'Items' => array(
|
|---|
| 40 | 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => 'Svět'),
|
|---|
| 41 | 'Description' => array('Type' => 'Text', 'Caption' => 'Popis', 'Default' => ''),
|
|---|
| 42 | 'Homepage' => array('Type' => 'Hyperlink', 'Caption' => 'Webové stránky', 'Default' => ''),
|
|---|
| 43 | 'Type' => array('Type' => 'ServerType', 'Caption' => 'Typ', 'Default' => 0),
|
|---|
| 44 | 'Database' => array('Type' => 'Database', 'Caption' => 'Databáze', 'Default' => 0),
|
|---|
| 45 | 'Motd' => array('Type' => 'String', 'Caption' => 'Zpráva dne', 'Default' => 'Vítejte na free WoW serveru'),
|
|---|
| 46 | ),
|
|---|
| 47 | );
|
|---|
| 48 | var $EditFormClass = array(
|
|---|
| 49 | 'Title' => 'Nastavení',
|
|---|
| 50 | 'Table' => 'Realm',
|
|---|
| 51 | 'SubmitText' => 'Uložit',
|
|---|
| 52 | 'Items' => array(
|
|---|
| 53 | 'Name' => array('Type' => 'String', 'Caption' => 'Název', 'Default' => 'WoW server'),
|
|---|
| 54 | 'Description' => array('Type' => 'Text', 'Caption' => 'Popis', 'Default' => ''),
|
|---|
| 55 | 'Homepage' => array('Type' => 'Hyperlink', 'Caption' => 'Webové stránky', 'Default' => ''),
|
|---|
| 56 | 'Type' => array('Type' => 'ServerType', 'Caption' => 'Typ', 'Default' => 0),
|
|---|
| 57 | 'Database' => array('Type' => 'Database', 'Caption' => 'Databáze', 'Default' => 0),
|
|---|
| 58 | 'Motd' => array('Type' => 'String', 'Caption' => 'Zpráva dne', 'Default' => 'Vítejte na free WoW serveru'),
|
|---|
| 59 | 'RealmId' => array('Type' => 'Hidden', 'Caption' => 'Id', 'Default' => 0),
|
|---|
| 60 | //'TimeCreation' => array('Type' => 'DateTime', 'Caption' => 'Datum založení', 'Default' => 'NOW()'),
|
|---|
| 61 | ),
|
|---|
| 62 | );
|
|---|
| 63 | var $SettingDetailedFormClass = array(
|
|---|
| 64 | 'Title' => 'Podrobné nastavení serveru',
|
|---|
| 65 | 'Table' => '',
|
|---|
| 66 | 'Items' => array(
|
|---|
| 67 | 'RealmId' => array('Type' => 'Hidden', 'Caption' => 'Id', 'Default' => 0),
|
|---|
| 68 | 'PlayerLimit' => array('Type' => 'Integer', 'Caption' => 'Max. počet hráčů online', 'Default' => 100),
|
|---|
| 69 | 'PlayerSaveInterval' => array('Type' => 'Integer', 'Caption' => 'Perioda ukládání postav hráčů do databáze', 'Default' => 60000),
|
|---|
| 70 | 'vmap_enableLOS' => array('Type' => 'Boolean', 'Caption' => 'Povolení systému Line-of-sight', 'Default' => 0),
|
|---|
| 71 | 'UpdateUptimeInterval' => array('Type' => 'Integer', 'Caption' => 'Perioda aktualizace doby běhu světa v databázi', 'Default' => 10),
|
|---|
| 72 | 'GameType' => array('Type' => 'GameType', 'Caption' => 'Typ světa', 'Default' => 0),
|
|---|
| 73 | 'Motd' => array('Type' => 'String', 'Caption' => 'Zpráva dne zobrazovaná hráčům při přihlášení', 'Default' => 'Vítej hráči!'),
|
|---|
| 74 | 'SkipCinematics' => array('Type' => 'SkipCinematics', 'Caption' => 'Zobrazovat úvodní video', 'Default' => ''),
|
|---|
| 75 | 'StartPlayerLevel' => array('Type' => 'Integer', 'Caption' => 'Počáteční úroveň hráčů', 'Default' => 1),
|
|---|
| 76 | 'MaxPlayerLevel' => array('Type' => 'Integer', 'Caption' => 'Max. úroveň hráčů', 'Default' => 80),
|
|---|
| 77 | 'StartHeroicPlayerLevel' => array('Type' => 'Integer', 'Caption' => 'Počáteční úroveň hrdinských postav', 'Default' => 55),
|
|---|
| 78 | 'StartPlayerMoney' => array('Type' => 'Integer', 'Caption' => 'Počáteční množství peněz', 'Default' => 0),
|
|---|
| 79 | 'StartHonorPoints' => array('Type' => 'Integer', 'Caption' => 'Počáteční počet bodů cti', 'Default' => 0),
|
|---|
| 80 | 'MaxHonorPoints' => array('Type' => 'Integer', 'Caption' => 'Max. počet bodů cti', 'Default' => 75000),
|
|---|
| 81 | 'StartArenaPoints' => array('Type' => 'Integer', 'Caption' => 'Počáteční počet bodů arén', 'Default' => 0),
|
|---|
| 82 | 'MaxArenaPoints' => array('Type' => 'Integer', 'Caption' => 'Max. počet bodů arén', 'Default' => 5000),
|
|---|
| 83 | 'MaxArenaPoints' => array('Type' => 'Integer', 'Caption' => 'Max. počet bodů arén', 'Default' => 5000),
|
|---|
| 84 | 'InstantLogout' => array('Type' => 'SecurityLevel', 'Caption' => 'Povolit okamžitého odhlášení', 'Default' => 1),
|
|---|
| 85 | 'DisableWaterBreath' => array('Type' => 'SecurityLevel', 'Caption' => 'Zakázat dýchání pod vodou', 'Default' => 1),
|
|---|
| 86 | 'AllFlightPaths' => array('Type' => 'Boolean', 'Caption' => 'Povoleny všechny létací cesty', 'Default' => 0),
|
|---|
| 87 | 'AlwaysMaxSkillForLevel' => array('Type' => 'Boolean', 'Caption' => 'Vždy max. dovednost na úroveň', 'Default' => 0),
|
|---|
| 88 | 'ActivateWeather' => array('Type' => 'Boolean', 'Caption' => 'Aktivní počasí', 'Default' => 1),
|
|---|
| 89 | 'CastUnstuck' => array('Type' => 'Boolean', 'Caption' => 'Povolit odblokovací kouzlo pomocí .start', 'Default' => 1),
|
|---|
| 90 | 'MinPetitionSigns' => array('Type' => 'Integer', 'Caption' => 'Min. počet podpisů k zápisu spolku', 'Default' => 9),
|
|---|
| 91 | 'MaxGroupXPDistance' => array('Type' => 'Integer', 'Caption' => 'Max. rozdíl XP ve skupině', 'Default' => 74),
|
|---|
| 92 | 'MailDeliveryDelay' => array('Type' => 'Integer', 'Caption' => 'Zpoždění doručení pošty', 'Default' => 3600),
|
|---|
| 93 | 'Event_Announce' => array('Type' => 'Boolean', 'Caption' => 'Ohlašování událostí', 'Default' => 0),
|
|---|
| 94 | 'AllowTwoSide_Accounts' => array('Type' => 'Boolean', 'Caption' => 'Povolit účty s postavami obou stran', 'Default' => 0),
|
|---|
| 95 | 'AllowTwoSide_Interaction_Chat' => array('Type' => 'Boolean', 'Caption' => 'Povolit komunikaci mezi stranami', 'Default' => 0),
|
|---|
| 96 | 'AllowTwoSide_Interaction_Channel' => array('Type' => 'Boolean', 'Caption' => 'Povolit kanály mezi stranami', 'Default' => 0),
|
|---|
| 97 | 'AllowTwoSide_WhoList' => array('Type' => 'Boolean', 'Caption' => 'Povolit obě strany v seznamu přítomných', 'Default' => 0),
|
|---|
| 98 | 'Rate_XP_Kill' => array('Type' => 'Integer', 'Caption' => 'Násobek získaných zkušeností za zabití', 'Default' => 1),
|
|---|
| 99 | 'Rate_XP_Quest' => array('Type' => 'Integer', 'Caption' => 'Násobek získaných zkušeností za dokončení výpravy', 'Default' => 1),
|
|---|
| 100 | 'Rate_XP_Explore' => array('Type' => 'Integer', 'Caption' => 'Násobek získaných zkušeností za objevení oblasti', 'Default' => 1),
|
|---|
| 101 | 'Ra_Enable' => array('Type' => 'Boolean', 'Caption' => 'Povolení vzdálená konzoly.', 'Default' => 0),
|
|---|
| 102 | ),
|
|---|
| 103 | );
|
|---|
| 104 |
|
|---|
| 105 | function ItemList()
|
|---|
| 106 | {
|
|---|
| 107 | if(array_key_exists('Id', $_GET)) $ServerId = $_GET['Id'];
|
|---|
| 108 |
|
|---|
| 109 | $Realm = new Realm($this->System, 0);
|
|---|
| 110 | //$Realm->UpdateServerList();
|
|---|
| 111 | $Output = '<h4>Seznam světů</h4>';
|
|---|
| 112 | $Table = new Table($this->ItemListFormClass, $this->System);
|
|---|
| 113 | //$Table->OnRow = array($this, 'ShowRealmListOnRow');
|
|---|
| 114 | $Table->Definition['Table'] = substr($Table->Definition['Table'], 0, -1).' WHERE `Realm`.`Server`='.$ServerId.')';
|
|---|
| 115 | $Table->Definition['Items']['Id'] = array('Type' => 'Hidden', 'Caption' => '', 'Default' => '');
|
|---|
| 116 | $Table->LoadValuesFromDatabase($this->Database);
|
|---|
| 117 | $Table->Definition['Items']['Actions'] = array('Type' => 'String', 'Caption' => '', 'Default' => '');
|
|---|
| 118 | foreach($Table->Values as $Index => $Item)
|
|---|
| 119 | {
|
|---|
| 120 | $Table->Values[$Index]['Actions'] = '<a href="?Module=Realm&Action=Show&Id='.$Item['Id'].'">Podrobnosti</a>';
|
|---|
| 121 | unset($Table->Values[$Index]['Id']);
|
|---|
| 122 | }
|
|---|
| 123 | $Output .= $Table->Show();
|
|---|
| 124 | if($this->System->Modules['Permission']->Check('Realm', 'Add'))
|
|---|
| 125 | {
|
|---|
| 126 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM Realm');
|
|---|
| 127 | $DbRow = $DbResult->fetch_row();
|
|---|
| 128 | $RealmCount = $DbRow[0];
|
|---|
| 129 | //$DbResult = $this->Database->query('SELECT COUNT(*) FROM Realm WHERE Server='.$this->System->Modules['User']->User['Id']);
|
|---|
| 130 | //$DbRow = $DbResult->fetch_row();
|
|---|
| 131 | if(($RealmCount < $this->Config['MaxRealmPerServerCount']))
|
|---|
| 132 | $Output .= '<br /><div style="text-align: center;"><a href="?Module=Realm&Action=Add">Vytvořit nový svět</a></dev>';
|
|---|
| 133 | }
|
|---|
| 134 | return($Output);
|
|---|
| 135 | }
|
|---|
| 136 |
|
|---|
| 137 | function Item()
|
|---|
| 138 | {
|
|---|
| 139 | $Id = $_GET['Id'];
|
|---|
| 140 | $Realm = new Realm($this->System, $Id);
|
|---|
| 141 | //if(isset($Server->Server))
|
|---|
| 142 | //{
|
|---|
| 143 | $Output = '<h4>Podrobnosti světa</h4>';
|
|---|
| 144 | $Form = new Form($this->System, $this->ItemFormClass);
|
|---|
| 145 | $Form->LoadValuesFromDatabase($Id);
|
|---|
| 146 | $Form->Definition['Items']['Uptime'] = array('Type' => 'String', 'Caption' => 'Doba běhu', 'Default' => '');
|
|---|
| 147 | $Form->Definition['Items']['UsedMemory'] = array('Type' => 'String', 'Caption' => 'Použitá paměť', 'Default' => '');
|
|---|
| 148 | $RealmStatus = $Realm->GetState();
|
|---|
| 149 | unset($Form->Definition['Items']['NetworkPortWorldd']);
|
|---|
| 150 | $Form->Values['Uptime'] = $this->System->AddPrefixMultipliers($RealmStatus['Uptime'], '', 4, 'Time');
|
|---|
| 151 | //$Form->Values['UsedMemory'] = $this->System->AddPrefixMultipliers($RealmStatus['UsedMemory'] * 1024, 'B', 4, 'Binary');
|
|---|
| 152 | $Output .= $Form->ShowTable();
|
|---|
| 153 | $Output .= '<div style="text-align: center">';
|
|---|
| 154 | if($this->System->Modules['Permission']->Check('Realm', 'Edit'))
|
|---|
| 155 | {
|
|---|
| 156 | $Output .= '<br /><a href="http://'.$this->System->Config['Web']['Host'].'/mysql/">Správa databáze</a> ';
|
|---|
| 157 | if(array_key_exists('Id', $Realm->Data['Database']) and ($Realm->Data['Lock'] == 0))
|
|---|
| 158 | {
|
|---|
| 159 | if($RealmStatus['WorlddPortState'] == true) $Output .= ' <a href="?Module=Realm&Action=Stop&Id='.$Realm->Id.'">Zastavit</a> <a href="?Module=Realm&Action=Restart&Id='.$Realm->Id.'">Restartovat</a>';
|
|---|
| 160 | else $Output .= ' <a href="?Module=Realm&Action=Start&Id='.$Realm->Id.'">Spustit</a>';
|
|---|
| 161 | }
|
|---|
| 162 | if($Realm->Data['Lock'] == 0)
|
|---|
| 163 | {
|
|---|
| 164 | $Output .= ' <a href="?Module=Realm&Action=Edit&Id='.$Realm->Id.'">Upravit základní nastavení</a>';
|
|---|
| 165 | $Output .= ' <a href="?Module=Realm&Action=EditDetailed&Id='.$Realm->Id.'">Upravit podrobné nastavení</a>';
|
|---|
| 166 | $Output .= ' <a href="?Module=Realm&Action=InitDatabase&Id='.$Realm->Id.'">Vynulovat databázi</a>';
|
|---|
| 167 | }
|
|---|
| 168 | $Output .= ' <a href="?Module=Debug&Action=ItemList&Id='.$Realm->Id.'">Ladící informace</a>';
|
|---|
| 169 | //$Output .= ' <a href="?Action=ServerDatabaseImport&Id='.$Server->Id.'">Načtení čisté databáze</a>';
|
|---|
| 170 | }
|
|---|
| 171 | $Output .= '</div>';
|
|---|
| 172 | return($Output);
|
|---|
| 173 | }
|
|---|
| 174 |
|
|---|
| 175 | function Add()
|
|---|
| 176 | {
|
|---|
| 177 | if(array_key_exists('Id', $_GET))
|
|---|
| 178 | {
|
|---|
| 179 | $ServerId = $_GET['Id'];
|
|---|
| 180 | $Output = '';
|
|---|
| 181 | if($this->System->Modules['Permission']->Check('Realm', 'Add'))
|
|---|
| 182 | {
|
|---|
| 183 | $DbResult = $this->Database->query('SELECT COUNT(*) FROM Realm');
|
|---|
| 184 | $DbRow = $DbResult->fetch_row();
|
|---|
| 185 | $RealmCount = $DbRow[0];
|
|---|
| 186 | if($RealmCount < $this->Config['MaxRealmCount'])
|
|---|
| 187 | {
|
|---|
| 188 | if($this->System->Modules['User']->RealmCount() >= $this->Config['MaxServerCountPerUser'])
|
|---|
| 189 | $Output .= $this->System->SystemMessage('Nový svět', 'Na jeden účet lze vytvořit maximálně '.
|
|---|
| 190 | $this->Config['MaxServerCountPerUser'].' světů');
|
|---|
| 191 | else
|
|---|
| 192 | {
|
|---|
| 193 | $Form = new Form($this->System, $this->CreateFormClass);
|
|---|
| 194 | $Form->LoadValuesFromForm();
|
|---|
| 195 | $Form->OnSubmit = '?Module=Realm&Action=Create&Id='.$ServerId;
|
|---|
| 196 | $Output .= 'Tento formulář vám umožní si vytvořit nový svět. Pečlivě vyplňte požadované údaje.';
|
|---|
| 197 | $Output .= $Form->ShowEditForm();
|
|---|
| 198 | }
|
|---|
| 199 | } else $Output .= $this->System->SystemMessage('Nový svět', 'Nelze vytvářet další světyservery');
|
|---|
| 200 | } else $Output .= USER_BAD_ROLE;
|
|---|
| 201 | } else $Output = $this->System->SystemMessage('Vytvoření světa', 'Nezadáno Id serveru');
|
|---|
| 202 | return($Output);
|
|---|
| 203 | }
|
|---|
| 204 |
|
|---|
| 205 | function Create()
|
|---|
| 206 | {
|
|---|
| 207 | if(array_key_exists('Id', $_GET))
|
|---|
| 208 | {
|
|---|
| 209 | $ServerId = $_GET['Id'];
|
|---|
| 210 | if($this->System->Modules['Permission']->Check('Realm', 'Add'))
|
|---|
| 211 | {
|
|---|
| 212 | if($this->System->Modules['User']->RealmCount() >= $this->Config['MaxServerCountPerUser'])
|
|---|
| 213 | $Output = $this->System->SystemMessage('Nový svět', 'Na jeden účet lze vytvořit maximálně '.
|
|---|
| 214 | $this->Config['MaxServerCountPerUser'].' světů');
|
|---|
| 215 | else
|
|---|
| 216 | {
|
|---|
| 217 | // Allocate unused network port for realm
|
|---|
| 218 | $DbResult = $this->Database->query('SELECT MAX(NetworkPortWorldd) FROM Realm');
|
|---|
| 219 | $DbRow = $DbResult->fetch_row();
|
|---|
| 220 | $NewPortWorldd = $DbRow[0] + 1;
|
|---|
| 221 | if($NewPortWorldd < $this->Config['BaseNetworkPortWorldd']) $NewPortWorldd = $this->Config['BaseNetworkPortWorldd'];
|
|---|
| 222 |
|
|---|
| 223 | $Form = new Form($this->System, $this->CreateFormClass, array());
|
|---|
| 224 | $Form->LoadValuesFromForm();
|
|---|
| 225 | $this->Database->insert('Realm', array('Name' => $Form->Values['Name'], 'Description' => $Form->Values['Description'], 'Server' => $ServerId, 'Motd' => $Form->Values['Motd'], 'Homepage' => $Form->Values['Homepage'], 'Type' => $Form->Values['Type'], 'Database' => $Form->Values['Database'], 'NetworkPortWorldd' => $NewPortWorldd, 'Lock' => 1, 'TimeCreate' => 'NOW()'));
|
|---|
| 226 | $LastInsertId = $this->Database->insert_id;
|
|---|
| 227 | $Realm = new Realm($this->System, $LastInsertId);
|
|---|
| 228 | $Realm->CreateDatabase();
|
|---|
| 229 | $Output = $this->System->SystemMessage('Vytvoření světu', $Realm->ImportDatabase(true));
|
|---|
| 230 | $TaskView = new TaskView($this->System);
|
|---|
| 231 | $Output .= $TaskView->ItemList();
|
|---|
| 232 | //$UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
|
|---|
| 233 | //$Form->OnSubmit = '?Action=ServerCreate';
|
|---|
| 234 | //$Output .= $Form->ShowEditForm();
|
|---|
| 235 | }
|
|---|
| 236 | } else $Output = USER_BAD_ROLE;
|
|---|
| 237 | } else $Output = $this->System->SystemMessage('Vytvoření světa', 'Nezadáno Id serveru');
|
|---|
| 238 | return($Output);
|
|---|
| 239 | }
|
|---|
| 240 |
|
|---|
| 241 | function Save()
|
|---|
| 242 | {
|
|---|
| 243 | $Output = '';
|
|---|
| 244 | $Realm = new Realm($this->System, $_POST['RealmId']);
|
|---|
| 245 | if($this->System->Modules['Permission']->Check('Realm', 'Save', $Realm->Id))
|
|---|
| 246 | {
|
|---|
| 247 | $Form = new Form($this->System, $this->EditFormClass, array());
|
|---|
| 248 | $Form->LoadValuesFromForm();
|
|---|
| 249 | $RealmId = $_POST['RealmId'];
|
|---|
| 250 | unset($Form->Values['RealmId']);
|
|---|
| 251 | $Output .= $this->System->SystemMessage('Upravit svět', 'Nastavení světa uloženo.');
|
|---|
| 252 | $Form->SaveValuesToDatabase($_POST['RealmId']);
|
|---|
| 253 | $Form->OnSubmit = '?Module=Realm&Action=Save';
|
|---|
| 254 |
|
|---|
| 255 | $Realm = new Realm($this->System, $_POST['RealmId']);
|
|---|
| 256 | $Realm->SaveConfiguration();
|
|---|
| 257 | $Form->Values['RealmId'] = $RealmId;
|
|---|
| 258 | $Output .= $Form->ShowEditForm();
|
|---|
| 259 | } else $Output = $this->System->SystemMessage('Nastavení serveru', 'Nemáte oprávnění');
|
|---|
| 260 | return($Output);
|
|---|
| 261 | }
|
|---|
| 262 |
|
|---|
| 263 | function Edit()
|
|---|
| 264 | {
|
|---|
| 265 | $Output = '';
|
|---|
| 266 | $Realm = new Realm($this->System, $_GET['Id']);
|
|---|
| 267 | if($this->System->Modules['Permission']->Check('Realm', 'Edit', $Realm->Id))
|
|---|
| 268 | {
|
|---|
| 269 | $Form = new Form($this->System, $this->EditFormClass);
|
|---|
| 270 | $Form->LoadValuesFromDatabase($_GET['Id']);
|
|---|
| 271 | $Form->Values['RealmId'] = $_GET['Id'];
|
|---|
| 272 | $Form->OnSubmit = '?Module=Realm&Action=Save';
|
|---|
| 273 | $Output .= $Form->ShowEditForm();
|
|---|
| 274 | } else $Output = $this->System->SystemMessage('Nastavení světa', 'Nemáte oprávnění');
|
|---|
| 275 | return($Output);
|
|---|
| 276 | }
|
|---|
| 277 |
|
|---|
| 278 | function EditDetailed()
|
|---|
| 279 | {
|
|---|
| 280 | $Output = '';
|
|---|
| 281 | $Realm = new Realm($this->System, $_GET['Id']);
|
|---|
| 282 | if($this->System->Modules['Permission']->Check('Realm', 'EditDetailed', $Realm->Id))
|
|---|
| 283 | {
|
|---|
| 284 | $Form = new Form($this->System, $this->SettingDetailedFormClass);
|
|---|
| 285 | $EmulatorConfig = new MangosConfigurationFile($this->System);
|
|---|
| 286 | $EmulatorConfig->Load('../realm/'.$Realm->Id.'/etc/mangosd.conf');
|
|---|
| 287 | $Form->Values = array();
|
|---|
| 288 | foreach($EmulatorConfig->ParameterList as $Index => $Item)
|
|---|
| 289 | $Form->Values[str_replace('.', '_', $Index)] = $Item;
|
|---|
| 290 | $Form->Values['RealmId'] = $_GET['Id'];
|
|---|
| 291 | $Form->OnSubmit = '?Module=Realm&Action=SaveDetailed';
|
|---|
| 292 | $Output .= $Form->ShowEditForm();
|
|---|
| 293 | } else $this->System->SystemMessage('Nastavení světa', 'Nemáte oprávnění');
|
|---|
| 294 | return($Output);
|
|---|
| 295 | }
|
|---|
| 296 |
|
|---|
| 297 | function SaveDetailed()
|
|---|
| 298 | {
|
|---|
| 299 | $Output = '';
|
|---|
| 300 | $Realm = new Realm($this->System, $_POST['RealmId']);
|
|---|
| 301 | if($this->System->Modules['Permission']->Check('Realm', 'SaveDetailed', $Realm->Id))
|
|---|
| 302 | {
|
|---|
| 303 | $Form = new Form($this->System, $this->SettingDetailedFormClass, array());
|
|---|
| 304 | $Form->LoadValuesFromForm();
|
|---|
| 305 | $EmulatorConfig = new MangosConfigurationFile($this->System);
|
|---|
| 306 | $EmulatorConfig->Load('../realm/'.$Realm->Id.'/etc/mangosd.conf');
|
|---|
| 307 | foreach($Form->Definition['Items'] as $Index => $Item)
|
|---|
| 308 | {
|
|---|
| 309 | if(!array_key_exists($Index, $Form->Values))
|
|---|
| 310 | $Form->Values[$Index] = 0;
|
|---|
| 311 | $EmulatorConfig->ParameterList[str_replace('_', '.', $Index)] = $Form->Values[$Index];
|
|---|
| 312 | }
|
|---|
| 313 | $EmulatorConfig->Save('../realm/'.$Realm->Id.'/etc/mangosd.conf');
|
|---|
| 314 | $RealmId = $_POST['RealmId'];
|
|---|
| 315 | unset($Form->Values['RealmId']);
|
|---|
| 316 | $Output .= $this->System->SystemMessage('Upravit svět', 'Nastavení světa uloženo.');
|
|---|
| 317 | //$Form->SaveValuesToDatabase($_POST['ServerId']);
|
|---|
| 318 | $Form->OnSubmit = '?Module=Realm&Action=SaveDetailed';
|
|---|
| 319 |
|
|---|
| 320 | $Realm = new Realm($this->System, $_POST['RealmId']);
|
|---|
| 321 | $Realm->SaveConfiguration();
|
|---|
| 322 | $Form->Values['RealmId'] = $RealmId;
|
|---|
| 323 | $Output .= $Form->ShowEditForm();
|
|---|
| 324 | } else $this->System->SystemMessage('Nastavení světa', 'Nemáte oprávnění');
|
|---|
| 325 | return($Output);
|
|---|
| 326 | }
|
|---|
| 327 |
|
|---|
| 328 | function Start()
|
|---|
| 329 | {
|
|---|
| 330 | $Output = '';
|
|---|
| 331 | $Realm = new Realm($this->System, $_GET['Id']);
|
|---|
| 332 | if($this->System->Modules['Permission']->Check('Realm', 'Start', $Realm->Id))
|
|---|
| 333 | {
|
|---|
| 334 | $Output .= $this->System->SystemMessage('Spuštění serveru', $Realm->Start());
|
|---|
| 335 | $TaskView = new TaskView($this->System);
|
|---|
| 336 | $Output .= $TaskView->ItemList();;
|
|---|
| 337 | } else $this->System->Modules['Permission']->AccessDenied();
|
|---|
| 338 | return($Output);
|
|---|
| 339 | }
|
|---|
| 340 |
|
|---|
| 341 | function Stop()
|
|---|
| 342 | {
|
|---|
| 343 | $Output = '';
|
|---|
| 344 | $Realm = new Realm($this->System, $_GET['Id']);
|
|---|
| 345 | if($this->System->Modules['Permission']->Check('Realm', 'Stop', $Realm->Id))
|
|---|
| 346 | {
|
|---|
| 347 | $Output .= $this->System->SystemMessage('Zastavení serveru', $Realm->Stop());
|
|---|
| 348 | $TaskView = new TaskView($this->System);
|
|---|
| 349 | $Output .= $TaskView->ItemList();;
|
|---|
| 350 | } else $this->System->Modules['Permission']->AccessDenied();
|
|---|
| 351 | return($Output);
|
|---|
| 352 | }
|
|---|
| 353 |
|
|---|
| 354 | function InitDatabase()
|
|---|
| 355 | {
|
|---|
| 356 | if(array_key_exists('Id', $_GET))
|
|---|
| 357 | {
|
|---|
| 358 | $RealmId = $_GET['Id'];
|
|---|
| 359 | $Realm = new Realm($this->System, $RealmId);
|
|---|
| 360 | if($this->System->Modules['Permission']->Check('Realm', 'InitDatabase', $Realm->Id))
|
|---|
| 361 | {
|
|---|
| 362 | $Output = $this->System->SystemMessage('Vynulování databáze', $Realm->ImportDatabase(true));
|
|---|
| 363 | $TaskView = new TaskView($this->System);
|
|---|
| 364 | $Output .= $TaskView->ItemList();
|
|---|
| 365 | //$UserOptions->LoadValuesFromDatabase($this->System->Modules['User']->User['Id']);
|
|---|
| 366 | //$Form->OnSubmit = '?Action=ServerCreate';
|
|---|
| 367 | //$Output .= $Form->ShowEditForm();
|
|---|
| 368 | } else $this->System->Modules['Permission']->AccessDenied();
|
|---|
| 369 | } else $Output = $this->System->SystemMessage('Vynulování databáze', 'Nezadáno Id serveru');
|
|---|
| 370 | return($Output);
|
|---|
| 371 | }
|
|---|
| 372 | }
|
|---|