Legend:
- Unmodified
- Added
- Removed
-
base.php
r10 r11 32 32 $Output .= '<th>Akce</th></tr>'; 33 33 34 $Where = ' ';34 $Where = ' AND (t1.DeletionTime IS NULL)'; 35 35 36 36 if(($Column != '') and ($ColumnValue != 0)) … … 69 69 $TotalItemCount = $DbRow[0]; 70 70 71 $DbResult = $Database->query('SELECT t1.* FROM `'.$List['TableName'].'` AS t1 LEFT JOIN `'.$List['TableName'].'` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE t2.ItemId IS NULL'.$Where.' LIMIT '.($Page * $Config['Web']['ItemsPerPage']).', '.$Config['Web']['ItemsPerPage']);71 $DbResult = $Database->query('SELECT t1.* FROM `'.$List['TableName'].'` AS t1 LEFT JOIN `'.$List['TableName'].'` AS t2 ON t1.ItemId=t2.ItemId AND t1.Id < t2.Id WHERE (t2.ItemId IS NULL)'.$Where.' LIMIT '.($Page * $Config['Web']['ItemsPerPage']).', '.$Config['Web']['ItemsPerPage']); 72 72 //echo($Database->LastQuery.'<br>'); 73 73 while($DbRow = $DbResult->fetch_array()) … … 199 199 global $Database, $Types, $System; 200 200 201 $Values = array(); 202 foreach($List['Items'] as $Index => $Item) 203 { 204 if($Types[$Item['Type']]['BaseType'] != 'PointerOneToMany') 205 { 206 $Values[$Index] = $_POST[$Index]; 207 } 208 } 201 $DbResult = $Database->select($List['TableName'], '*', 'Id='.$Id); 202 while($DbRow = $DbResult->fetch_array()) 203 { 204 $DefinitionItems = array(); 205 foreach($List['Items'] as $Index => $Item) 206 { 207 if($Types[$Item['Type']]['BaseType'] != 'PointerOneToMany') 208 { 209 $DefinitionItems[] = array('Name' => $Index, 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 210 } 211 } 212 } 213 $Form = new Form(); 214 $Form->Definition = array 215 ( 216 'Title' => 'Titulek', 217 'SubmitBuffonText' => 'Uložit', 218 'Items' => $DefinitionItems, 219 ); 220 $Form->LoadValuesFromForm(); 221 209 222 $DbResult = $Database->select($List['TableName'], 'ItemId', 'Id='.$Id); 210 223 $DbRow = $DbResult->fetch_assoc(); 211 $ Values['ItemId'] = $DbRow['ItemId'];212 $ Values['Author'] = $System->Modules['User']->User['Id'];213 $ Values['CreationTime'] = 'NOW()';214 $ Values['ValidTimeFrom'] = 'NOW()';215 $Database->insert($List['TableName'], $ Values);224 $Form->Values['ItemId'] = $DbRow['ItemId']; 225 $Form->Values['Author'] = $System->Modules['User']->User['Id']; 226 $Form->Values['CreationTime'] = 'NOW()'; 227 $Form->Values['ValidTimeFrom'] = 'NOW()'; 228 $Database->insert($List['TableName'], $Form->Values); 216 229 //echo($Database->LastQuery); 217 230 $Output = 'Změny uloženy.'; 218 $Output .= ShowViewItem($List, $Id); 231 $Output .= ShowViewItem($List, $Database->insert_id); 232 $Form->Values['Column'] = $_POST['Column']; 233 ExecuteListEvent($List['TableName'], 'OnEdit', $Form->Values); 219 234 return($Output); 220 235 } … … 264 279 global $Database, $Types, $System; 265 280 266 $Values = array(); 267 foreach($List['Items'] as $Index => $Item) 268 { 269 if($Types[$Item['Type']]['BaseType'] != 'PointerOneToMany') 270 { 271 $Values[$Index] = $_POST[$Index]; 272 } 273 } 274 $Values['Author'] = $System->Modules['User']->User['Id']; 275 $Values['CreationTime'] = 'NOW()'; 276 $Values['ValidTimeFrom'] = 'NOW()'; 281 $DefinitionItems = array(); 282 $AfterTableOutput = ''; 283 foreach($List['Items'] as $Item) 284 { 285 //echo($Item['Name'].','); 286 if(($Types[$Item['Type']]['BaseType'] != 'PointerOneToMany') and ($Item['Name'] != $Column)) 287 { 288 if($Item['Required'] == 1) $Required = '*'; else $Required = ''; 289 $DefinitionItems[] = array('Name' => $Item['Name'], 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => '', 'SourceTable' => $List['TableName'], 'SourceItemId' => 0); 290 } else 291 if($Item['Name'] == $Column) 292 { 293 $DefinitionItems[] = array('Name' => $Column, 'Type' => 'Hidden', 'Caption' => '', 'Value' => $ColumnValue); 294 } 295 } 296 $DefinitionItems[] = array('Name' => 'Column', 'Type' => 'Hidden', 'Caption' => '', 'Value' => $Column); 297 298 $Form = new Form(); 299 $Form->Definition = array 300 ( 301 'Title' => 'Titulek', 302 'SubmitBuffonText' => 'Přidat', 303 'Items' => $DefinitionItems, 304 ); 305 $Form->LoadValuesFromForm(); 306 $Form->Values['Author'] = $System->Modules['User']->User['Id']; 307 $Form->Values['CreationTime'] = 'NOW()'; 308 $Form->Values['ValidTimeFrom'] = 'NOW()'; 277 309 $DbResult = $Database->select($List['TableName'], 'MAX(ItemId)'); 278 310 $DbRow = $DbResult->fetch_row(); 279 311 $AutoincrementId = $DbRow[0]; 280 $ Values['ItemId'] = $AutoincrementId + 1;281 $Database->insert($List['TableName'], $ Values);312 $Form->Values['ItemId'] = $AutoincrementId + 1; 313 $Database->insert($List['TableName'], $Form->Values); 282 314 //echo($Database->LastQuery); 283 315 $Output = 'Položka přidána'; 284 316 $Output .= ShowViewItem($List, $Database->insert_id); 285 $ Values['Column'] = $_POST['Column'];286 ExecuteListEvent($List['TableName'], 'OnAdd', $ Values);317 $Form->Values['Column'] = $_POST['Column']; 318 ExecuteListEvent($List['TableName'], 'OnAdd', $Form->Values); 287 319 return($Output); 288 320 } … … 336 368 function ShowDeleteItem($List, $Id) 337 369 { 338 global $Database ;339 340 $Database-> delete($List['TableName'], 'Id='.$Id);370 global $Database, $Lists; 371 372 $Database->update($List['TableName'], 'Id='.$Id, array('DeletionTime' => 'NOW()')); 341 373 $Output = 'Položka smazána.'; 374 $Output .= ShowList($Lists[$_SESSION['Table']], $Lists[$_SESSION['Column']], $Lists[$_SESSION['ColumnValue']]).'<br /><br />'; 342 375 return($Output); 343 376 } … … 431 464 function LoadTypeDefinition() 432 465 { 433 global $Database, $Types ;466 global $Database, $Types, $TypeNames; 434 467 435 468 $Types = array(); 469 $TypeNames = array(); 436 470 $DbResult = $Database->select('SystemType', '*'); 437 471 while($DbRow = $DbResult->fetch_assoc()) … … 440 474 $DbRow['BaseType'] = $DbRow['Name']; 441 475 $Types[$DbRow['Id']] = $DbRow; 476 $TypeNames[$DbRow['Name']] = $DbRow['Id']; 442 477 } 443 478 … … 474 509 } 475 510 511 function ModifyAllTables($Query) 512 { 513 global $Database; 514 515 $DbResult = $Database->select('SystemList', '*'); 516 while($DbRow = $DbResult->fetch_assoc()) 517 { 518 $Database->query($Query); 519 } 520 } 521 476 522 ?>
Note:
See TracChangeset
for help on using the changeset viewer.