Changeset 9 for trunk/www/index.php
- Timestamp:
- Jun 11, 2009, 11:26:18 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/www/index.php
r6 r9 10 10 function ShowServerList() 11 11 { 12 global $Config; 13 12 14 $OnlineState = array(false => 'Neaktivní', true => 'Aktivní'); 13 15 $Output = '<h4>Seznam serverů</h4>'; … … 21 23 } 22 24 $Output .= '</table>'; 23 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) $Output .= '<br /><div style="text-align: center;"><a href="?Action=ServerAdd">Vytvořit nový server</a></dev>'; 25 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 26 { 27 $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server'); 28 $DbRow = $DbResult->fetch_row(); 29 $ServerCount = $DbRow[0]; 30 if($ServerCount < $Config['MaxServerCount']) 31 $Output .= '<br /><div style="text-align: center;"><a href="?Action=ServerAdd">Vytvořit nový server</a></dev>'; 32 } 24 33 return($Output); 25 34 } … … 147 156 } 148 157 } else 149 if($_GET['Action'] == 'MemberOptions')150 {151 $UserOptions = new Form('MemberOptions');152 $DbResult = $this->Database->query('SELECT Member.Id, Member.InternetTariffNextMonth, Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Modules['User']->User['Member']);153 $DbRow = $DbResult->fetch_array();154 foreach($UserOptions->Definition['Items'] as $Index => $Item)155 {156 $UserOptions->Values[$Index] = $DbRow[$Index];157 }158 $UserOptions->OnSubmit = '?Action=MemberOptionsSave';159 $Output .= $UserOptions->ShowEditForm();160 } else161 if($_GET['Action'] == 'MemberOptionsSave')162 {163 $UserOptions = new Form('MemberOptions');164 $UserOptions->LoadValuesFromForm();165 if($UserOptions->Values['FamilyMemberCount'] < 0)166 $UserOptions->Values['FamilyMemberCount'] = 0;167 if($UserOptions->Values['BillingPeriodNext'] < 2)168 $UserOptions->Values['BillingPeriodNext'] = 2;169 170 $DbResult = $this->Database->update('Member', 'Id='.$this->System->Modules['User']->User['Member'], array('InternetTariffNextMonth' => $UserOptions->Values['InternetTariffNextMonth'], 'FamilyMemberCount' => $UserOptions->Values['FamilyMemberCount'], 'BillingPeriodNext' => $UserOptions->Values['BillingPeriodNext']));171 $DbResult = $this->Database->query('SELECT Subject FROM Member WHERE Id='.$this->System->Modules['User']->User['Member']);172 $Member = $DbResult->fetch_assoc();173 $DbResult = $this->Database->update('Subject', 'Id='.$Member['Subject'], array('Name' => $UserOptions->Values['Name'], 'AddressStreet' => $UserOptions->Values['AddressStreet'], 'AddressTown' => $UserOptions->Values['AddressTown'], 'AddressPSC' => $UserOptions->Values['AddressPSC'], 'IC' => $UserOptions->Values['IC'], 'DIC' => $UserOptions->Values['DIC']));174 $Output .= $this->SystemMessage('Nastavení', 'Nastavení domácnosti uloženo.');175 $this->System->Modules['Log']->NewRecord('Member+Subject', 'Nastavení člena/subjektu změněno', $UserOptions->Values['Name']);176 $DbResult = $this->Database->query('SELECT Member.Id, Member.InternetTariffNextMonth, Member.FamilyMemberCount, Member.BillingPeriodNext, Subject.Name, Subject.AddressStreet, Subject.AddressTown, Subject.AddressPSC, Subject.IC, Subject.DIC FROM Member JOIN Subject ON Subject.Id = Member.Subject WHERE Member.Id='.$this->System->Modules['User']->User['Member']);177 $DbRow = $DbResult->fetch_array();178 foreach($UserOptions->Definition['Items'] as $Index => $Item)179 {180 $UserOptions->Values[$Index] = $DbRow[$Index];181 }182 $UserOptions->OnSubmit = '?Action=MemberOptionsSave';183 $Output .= $UserOptions->ShowEditForm();184 } else185 158 if($_GET['Action'] == 'ServerAdd') 186 159 { 187 160 if($this->System->Modules['User']->User['Role'] >= USER_ROLE_USER) 188 161 { 189 $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->User['Id']);162 $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server'); 190 163 $DbRow = $DbResult->fetch_row(); 191 if($DbRow[0] > 0) $Output .= $this->SystemMessage('Nový server', 'Lze vytvořit pouze jeden server pro každý uživatelský účet.');192 else164 $ServerCount = $DbRow[0]; 165 if($ServerCount < $Config['MaxServerCount']) 193 166 { 194 $Form = new Form('NewServer'); 195 $Form->LoadValuesFromForm(); 196 $Form->OnSubmit = '?Action=ServerCreate'; 197 $Output .= 'Tento formulář vám umožní si vytvořit nový server. Pečlivě vyplňte požadované údaje.'; 198 $Output .= $Form->ShowEditForm(); 199 } 167 $DbResult = $this->Database->query('SELECT COUNT(*) FROM Server WHERE User='.$this->System->Modules['User']->User['Id']); 168 $DbRow = $DbResult->fetch_row(); 169 if($DbRow[0] > 0) $Output .= $this->SystemMessage('Nový server', 'Lze vytvořit pouze jeden server pro každý uživatelský účet.'); 170 else 171 { 172 $Form = new Form('NewServer'); 173 $Form->LoadValuesFromForm(); 174 $Form->OnSubmit = '?Action=ServerCreate'; 175 $Output .= 'Tento formulář vám umožní si vytvořit nový server. Pečlivě vyplňte požadované údaje.'; 176 $Output .= $Form->ShowEditForm(); 177 } 178 } else $Output .= $this->SystemMessage('Nový serve', 'Nelze vytvářet další servery'); 200 179 } else $Output .= USER_BAD_ROLE; 201 180 } else
Note:
See TracChangeset
for help on using the changeset viewer.