Changeset 6
- Timestamp:
- Sep 16, 2008, 9:15:10 AM (16 years ago)
- Files:
-
- 2 added
- 1 deleted
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
base.php
r5 r6 1 1 <?php 2 2 include('database.php'); 3 include('types.php');4 include('lists.php');5 3 include('common.php'); 6 4 … … 14 12 include('types/Date.php'); 15 13 include('types/Password.php'); 16 17 function ShowList($List, $Column = '', $ParentId = 0) 14 include('types/Float.php'); 15 include('types/Hyperlink.php'); 16 17 function ShowList($List, $Column = '', $ColumnValue = 0) 18 18 { 19 19 global $Database, $Types, $Config; … … 27 27 $Output .= '<th>Akce</th></tr>'; 28 28 29 if(($Column != '') and ($ParentId != 0)) 30 $Where = $Column.'='.$ParentId; 31 else $Where = '1'; 29 if(($Column != '') and ($ColumnValue != 0)) 30 { 31 $Where = $Column.'='.$ColumnValue; 32 $ColumnSelection = '&Column='.$Column.'&ColumnValue='.$ColumnValue; 33 $FullListLink = '<a href="?Action=ViewList&Table='.$List['TableName'].'">Celkový seznam</a>'; 34 } else 35 { 36 $Where = '1'; 37 $ColumnSelection = ''; 38 $FullListLink = ''; 39 } 32 40 33 41 // Handle ordering … … 70 78 } 71 79 } 72 $Output .= '<td><a href="?Action=ViewItem&Table Id='.$List['TableName'].'&ItemId='.$DbRow['Id'].'">Zobrazit</a> <a href="?Action=EditItem&TableId='.$List['TableName'].'&ItemId='.$DbRow['Id'].'">Editovat</a> <a href="?Action=DeleteItem&TableId='.$List['TableName'].'&ItemId='.$DbRow['Id'].'">Smazat</a></td></tr>';80 $Output .= '<td><a href="?Action=ViewItem&Table='.$List['TableName'].'&Item='.$DbRow['Id'].'">Zobrazit</a> <a href="?Action=EditItem&Table='.$List['TableName'].'&Item='.$DbRow['Id'].'">Editovat</a> <a href="?Action=DeleteItem&Table='.$List['TableName'].'&Item='.$DbRow['Id'].'">Smazat</a></td></tr>'; 73 81 } 74 82 $Output .= '</table>'; 75 83 $Output .= PagesList($Page, $TotalItemCount); 76 $Output .= '<a href="?Action=AddItem&Table Id='.$List['TableName'].'">Přidat</a>';84 $Output .= '<a href="?Action=AddItem&Table='.$List['TableName'].$ColumnSelection.'">Přidat</a> '.$FullListLink; 77 85 return($Output); 78 86 } … … 82 90 global $Database, $Types; 83 91 84 $Output = '<form action="?Action=EditItemFinish&Item Id='.$Id.'" method="post"><table class="WideTable">';92 $Output = '<form action="?Action=EditItemFinish&Item='.$Id.'" method="post"><table class="WideTable">'; 85 93 $Output .= '<tr><th>Jméno položky</th><th>Hodnota</th></tr>'; 86 94 $DbResult = $Database->select($List['TableName'], '*', 'Id='.$Id); … … 103 111 } 104 112 } 105 $Output .= '</table><input type="submit" value="Uložit"></form><a href="?">Zpět</a>'; 113 $Output .= '</table><input type="submit" value="Uložit"></form>'; 114 if(($Column != '') and ($ColumnValue != 0)) 115 { 116 $Output .= '<a href="?Action=ShowList&Table='.$List['TableName'].'&Column='.$Column.'&ColumnValue='.$ColumnValue.'">Celkový seznam</a>'; 117 } else 118 { 119 $Output .= '<a href="?Action=ShowList&Table='.$List['TableName'].'">Celkový seznam</a>'; 120 } 121 106 122 return($Output); 107 123 } … … 127 143 } 128 144 129 function ShowAddItem($List )145 function ShowAddItem($List, $Column = '', $ColumnValue = 0) 130 146 { 131 147 global $Database, $Types; … … 133 149 $Output = '<form action="?Action=AddItemFinish" method="post"><table class="WideTable">'; 134 150 $Output .= '<tr><th>Jméno položky</th><th>Hodnota</th></tr>'; 135 151 $AfterTableOutput = ''; 136 152 foreach($List['Items'] as $Index => $Item) 137 153 { 138 154 $ItemType = explode(':', $Item['Type']); 139 if( $ItemType[0] != 'PointerOneToMany')155 if(($ItemType[0] != 'PointerOneToMany') and ($Item['Name'] != $Column)) 140 156 { 141 157 $Type = $Types[$ItemType[0]]; … … 147 163 if($Item['Required'] == 1) $Required = ' *'; else $Required = ''; 148 164 $Output .= '<tr><td>'.$Item['TextBefore'].':'.$Required.'</td><td title="'.$Item['Help'].'">'.$Value.'</td></tr>'; 149 } 150 } 151 $Output .= '</table><input type="submit" value="Přidat"></form><a href="?">Zpět</a>'; 165 } else 166 if($Item['Name'] == $Column) 167 { 168 $AfterTableOutput = '<input type="hidden" name="'.$Column.'" value="'.$ColumnValue.'" />'; 169 } 170 } 171 $Output .= '</table>'.$AfterTableOutput.'<input type="submit" value="Přidat"></form>'; 172 if(($Column != '') and ($ColumnValue != 0)) 173 { 174 $Output .= '<a href="?Action=ShowList&Table='.$List['TableName'].'&Column='.$Column.'&ColumnValue='.$ColumnValue.'">Celkový seznam</a>'; 175 } else 176 { 177 $Output .= '<a href="?Action=ShowList&Table='.$List['TableName'].'">Celkový seznam</a>'; 178 } 152 179 return($Output); 153 180 } … … 197 224 } 198 225 $Output .= '</table>'; 199 $Output .= '<a href="?Action=EditItem&ItemId='.$DbRow['Id'].'">Editovat</a>'; 200 $Output .= ' <a href="?Action=ShowList&ItemId='.$DbRow['Id'].'">Seznam</a>'; 226 $Output .= '<a href="?Action=EditItem&Table='.$List['TableName'].'&Item='.$DbRow['Id'].'">Editovat</a> '; 227 228 if(($Column != '') and ($ColumnValue != 0)) 229 { 230 $Output .= '<a href="?Action=ShowList&Table='.$List['TableName'].'&Column='.$Column.'&ColumnValue='.$ColumnValue.'">Celkový seznam</a>'; 231 } else 232 { 233 $Output .= '<a href="?Action=ShowList&Table='.$List['TableName'].'">Celkový seznam</a>'; 234 } 201 235 $Output .= '<div class="line"></div>'; 202 236 … … 232 266 { 233 267 if(($List['System'] == $System) and ($List['VisibleInMenu'] == 1)) 234 $Output .= '<a href="?Action=ShowList&Table Id='.$Index.'">'.$List['Title'].'</a><br />';268 $Output .= '<a href="?Action=ShowList&Table='.$Index.'">'.$List['Title'].'</a><br />'; 235 269 } 236 270 $Output .= '<br />'; … … 242 276 global $Lists; 243 277 244 $PermanentVar = array('Table Id', 'ItemId', 'ParentTable', 'ParentColumn', 'Action');278 $PermanentVar = array('Table', 'Item', 'Column', 'ColumnValue', 'Action'); 245 279 foreach($PermanentVar as $Var) 246 280 { … … 249 283 250 284 $Output = ''; 251 if(array_key_exists('Table Id', $_SESSION) and array_key_exists($_SESSION['TableId'], $Lists))252 { 253 $List = $Lists[$_SESSION['Table Id']];285 if(array_key_exists('Table', $_SESSION) and array_key_exists($_SESSION['Table'], $Lists)) 286 { 287 $List = $Lists[$_SESSION['Table']]; 254 288 if(array_key_exists('Action', $_SESSION)) 255 289 { … … 257 291 { 258 292 case 'EditItem': 259 $Output = ShowEditItem($List, $_SESSION['Item Id']);293 $Output = ShowEditItem($List, $_SESSION['Item']); 260 294 break; 261 295 case 'EditItemFinish': 262 $Output = ShowEditItemFinish($List, $_SESSION['Item Id']);296 $Output = ShowEditItemFinish($List, $_SESSION['Item']); 263 297 break; 264 298 case 'DeleteItem': 265 $Output = ShowDeleteItem($List, $_SESSION['Item Id']);299 $Output = ShowDeleteItem($List, $_SESSION['Item']); 266 300 break; 267 301 case 'ViewItem': 268 $Output = ShowViewItem($List, $_SESSION['Item Id']);302 $Output = ShowViewItem($List, $_SESSION['Item']); 269 303 break; 270 304 case 'AddItem': 271 $Output = ShowAddItem($List );305 $Output = ShowAddItem($List, $_SESSION['Column'], $_SESSION['ColumnValue']); 272 306 break; 273 307 case 'AddItemFinish': -
types/PointerOneToOne.php
r5 r6 15 15 { 16 16 $DbRow = $DbResult->fetch_array(); 17 $Output = '<a href="?Action=ViewItem&Table Id='.$Type['Parameter'].'&ItemId='.$DbRow['Id'].'">'.$DbRow['Name'].'</a>';17 $Output = '<a href="?Action=ViewItem&Table='.$Type['Parameter'].'&Item='.$DbRow['Id'].'">'.$DbRow['Name'].'</a>'; 18 18 } 19 19 return($Output);
Note:
See TracChangeset
for help on using the changeset viewer.