Changeset 9
- Timestamp:
- Oct 11, 2008, 11:06:21 PM (16 years ago)
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
base.php
r8 r9 27 27 $Output .= '<th>Akce</th></tr>'; 28 28 29 $Where = ''; 30 29 31 if(($Column != '') and ($ColumnValue != 0)) 30 32 { 31 $Where = $Column.'='.$ColumnValue;33 $Where .= ' AND (t1.'.$Column.'='.$ColumnValue.')'; 32 34 $ColumnSelection = '&Column='.$Column.'&ColumnValue='.$ColumnValue; 33 35 $FullListLink = '<a href="?Action=ViewList&Table='.$List['TableName'].'">Celkový seznam</a>'; 34 } else 35 { 36 $Where = '1'; 36 } else 37 { 37 38 $ColumnSelection = ''; 38 39 $FullListLink = ''; … … 52 53 { 53 54 $OrderDirection = array('ASC', 'DESC'); 54 $Order = 'ORDER BY `'.$_SESSION['OrderColumn'].'` '.$OrderDirection[$_SESSION['OrderDirection']];55 $Order = 'ORDER BY t1.`'.$_SESSION['OrderColumn'].'` '.$OrderDirection[$_SESSION['OrderDirection']]; 55 56 } else $Order = ''; 56 57 … … 58 59 //$Where .= ' AND (ValidFromTime <= NOW()) AND ((ValidToTime >= NOW()) OR (ValidToTime IS NULL))'; 59 60 $Where .= ' '.$Order; 60 $DbResult = $Database-> select($List['TableName'], 'COUNT(*)', $Where);61 //echo($Database->LastQuery );61 $DbResult = $Database->query('SELECT COUNT(t2.Id) AS Count FROM (SELECT DISTINCT(ItemId) as Id FROM `'.$List['TableName'].'` as t1 WHERE 1'.$Where.') as t2'); 62 //echo($Database->LastQuery.'<br>'); 62 63 $DbRow = $DbResult->fetch_array(); 63 64 $TotalItemCount = $DbRow[0]; 64 65 65 $DbResult = $Database->select($List['TableName'], '*', $Where.' LIMIT '.($Page * $Config['Web']['ItemsPerPage']).', '.$Config['Web']['ItemsPerPage']); 66 $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']); 67 //echo($Database->LastQuery.'<br>'); 66 68 while($DbRow = $DbResult->fetch_array()) 67 69 { … … 87 89 } 88 90 91 function ShowHistory($List, $Id, $Title = '') 92 { 93 global $Database, $Types, $Config; 94 95 if($Title == '') $Output = '<div>'.$List['Title'].'</div>'; 96 else $Output = '<div>'.$Title.'</div>'; 97 $Output .= '<table class="WideTable"><tr>'; 98 foreach($List['Items'] as $Item) 99 { 100 if($Item['VisibleInList'] == 1) 101 $Output .= '<th><a href="?OrderColumn='.$Item['Name'].'">'.$Item['TextBefore'].'</a></th>'; 102 } 103 $Output .= '<th>Akce</th></tr>'; 104 105 $Where = ' AND (ItemId='.$Id.')'; 106 107 // Handle ordering 108 if(array_key_exists('OrderColumn', $_GET)) 109 { 110 if($_SESSION['OrderColumn'] == $_GET['OrderColumn']) // Same column => reverse orded 111 $_SESSION['OrderDirection'] = ($_SESSION['OrderDirection'] + 1) % 2; 112 if($_SESSION['OrderTable'] != $List['TableName']) // Different table => set ascending order 113 $_SESSION['OrderDirection'] = 0; 114 $_SESSION['OrderColumn'] = $_GET['OrderColumn']; 115 $_SESSION['OrderTable'] = $List['TableName']; 116 } 117 if(array_key_exists('OrderColumn', $_SESSION) and ($_SESSION['OrderTable'] == $List['TableName'])) 118 { 119 $OrderDirection = array('ASC', 'DESC'); 120 $Order = 'ORDER BY t1.`'.$_SESSION['OrderColumn'].'` '.$OrderDirection[$_SESSION['OrderDirection']]; 121 } else $Order = ''; 122 123 if(array_key_exists('Page', $_GET)) $Page = $_GET['Page']; else $Page = 0; 124 //$Where .= ' AND (ValidFromTime <= NOW()) AND ((ValidToTime >= NOW()) OR (ValidToTime IS NULL))'; 125 $Where .= ' '.$Order; 126 $DbResult = $Database->query('SELECT COUNT(t2.Id) AS Count FROM (SELECT DISTINCT(ItemId) as Id FROM `'.$List['TableName'].'` as t1 WHERE 1'.$Where.') as t2'); 127 //echo($Database->LastQuery.'<br>'); 128 $DbRow = $DbResult->fetch_array(); 129 $TotalItemCount = $DbRow[0]; 130 131 $DbResult = $Database->query('SELECT * FROM `'.$List['TableName'].'` WHERE 1'.$Where.' LIMIT '.($Page * $Config['Web']['ItemsPerPage']).', '.$Config['Web']['ItemsPerPage']); 132 //echo($Database->LastQuery.'<br>'); 133 while($DbRow = $DbResult->fetch_array()) 134 { 135 $Output .= '<tr>'; 136 foreach($List['Items'] as $Index => $Item) 137 { 138 if($Item['VisibleInList'] == 1) 139 { 140 $ItemType = explode(':', $Item['Type']); 141 $Type = $Types[$ItemType[0]]; 142 $ItemDefinition = array('Name' => $Index, 'Value' => $DbRow[$Index], 'SourceTable' => $List['TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 143 if(is_callable($Type['CallbackView'])) $Value = $Type['CallbackView']($Type, $ItemDefinition); 144 else $Value = $Type['CallbackView']; 145 $Output .= '<td>'.$Value.'</td>'; 146 } 147 } 148 $Output .= '<td><a href="?Action=ViewItem&Table='.$List['TableName'].'&Item='.$DbRow['Id'].'">Zobrazit</a> </td></tr>'; 149 } 150 $Output .= '</table>'; 151 $Output .= PagesList($Page, $TotalItemCount); 152 $Output .= '<a href="?Action=AddItem&Table='.$List['TableName'].$ColumnSelection.'">Přidat</a> '.$FullListLink; 153 return($Output); 154 } 155 89 156 function ShowEditItem($List, $Id) 90 157 { 91 158 global $Database, $Types; 92 159 93 $Output = '<form action="?Action=EditItemFinish&Item='.$Id.'" method="post"><table class="WideTable">';94 $Output .= '<tr><th>Jméno položky</th><th>Hodnota</th></tr>';95 160 $DbResult = $Database->select($List['TableName'], '*', 'Id='.$Id); 96 161 while($DbRow = $DbResult->fetch_array()) 97 162 { 163 $DefinitionItems = array(); 98 164 foreach($List['Items'] as $Index => $Item) 99 165 { … … 101 167 if($ItemType[0] != 'PointerOneToMany') 102 168 { 103 $Type = $Types[$ItemType[0]]; 104 $ItemDefinition = array('Name' => $Index, 'Value' => $DbRow[$Index], 'SourceTable' => $List['TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 105 if(is_callable($Type['CallbackEdit'])) $Value = $Type['CallbackEdit']($Type, $ItemDefinition); 106 else $Value = $Type['CallbackEdit']; 107 if($Item['Required'] == 1) $Required = '*'; else $Required = ''; 108 $Output .= '<tr><td>'.$Item['TextBefore'].':'.$Required.'</td><td title="'.$Item['Help'].'">'.$Value.'</td></tr>'; 109 } 110 } 111 } 112 $Output .= '</table><input type="submit" value="Uložit"></form>'; 169 $DefinitionItems[] = array('Name' => $Index, 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 170 } 171 } 172 } 173 $Form = new Form(); 174 $Form->Definition = array 175 ( 176 'Title' => 'Titulek', 177 'SubmitBuffonText' => 'Uložit', 178 'Items' => $DefinitionItems, 179 ); 180 $Form->OnSubmit = '?Action=EditItemFinish&Item='.$Id; 181 $Output .= $Form->ShowEditForm(); 113 182 if(($Column != '') and ($ColumnValue != 0)) 114 183 { … … 118 187 $Output .= '<a href="?Action=ShowList&Table='.$List['TableName'].'">Celkový seznam</a>'; 119 188 } 120 121 189 return($Output); 122 190 } … … 124 192 function ShowEditItemFinish($List, $Id) 125 193 { 126 global $Database, $Types ;194 global $Database, $Types, $System; 127 195 128 196 $Values = array(); … … 135 203 } 136 204 } 137 $Database->update($List['TableName'], 'Id='.$Id, $Values); 205 $DbResult = $Database->select($List['TableName'], 'ItemId', 'Id='.$Id); 206 $DbRow = $DbResult->fetch_assoc(); 207 $Values['ItemId'] = $DbRow['ItemId']; 208 $Values['Author'] = $System->Modules['User']->User['Id']; 209 $Values['CreationTime'] = 'NOW()'; 210 $Values['ValidTimeFrom'] = 'NOW()'; 211 $Database->insert($List['TableName'], $Values); 138 212 //echo($Database->LastQuery); 139 213 $Output = 'Změny uloženy.'; … … 182 256 function ShowAddItemFinish($List) 183 257 { 184 global $Database, $Types ;258 global $Database, $Types, $System; 185 259 186 260 $Values = array(); … … 193 267 } 194 268 } 269 $Values['Author'] = $System->Modules['User']->User['Id']; 270 $Values['CreationTime'] = 'NOW()'; 271 $Values['ValidTimeFrom'] = 'NOW()'; 272 $DbResult = $Database->select($List['TableName'], 'MAX(ItemId)'); 273 $DbRow = $DbResult->fetch_row(); 274 $AutoincrementId = $DbRow[0]; 275 $Values['ItemId'] = $AutoincrementId + 1; 195 276 $Database->insert($List['TableName'], $Values); 196 277 //echo($Database->LastQuery); … … 208 289 while($DbRow = $DbResult->fetch_array()) 209 290 { 210 $Output = '<table class="WideTable">'; 211 $Output .= '<tr><th>Jméno položky</th><th>Hodnota</th></tr>'; 291 $DefinitionItems = array(); 212 292 foreach($List['Items'] as $Index => $Item) 213 293 { … … 215 295 if($ItemType[0] != 'PointerOneToMany') 216 296 { 217 $Type = $Types[$ItemType[0]]; 218 $ItemDefinition = array('Name' => $Index, 'Value' => $DbRow[$Index], 'SourceTable' => $List['TableName'], 'SourceItemId' => $DbRow['Id'], 'Type' => $Item['Type']); 219 if(is_callable($Type['CallbackView'])) $Value = $Type['CallbackView']($Type, $ItemDefinition); 220 else $Value = $Type['CallbackView']; 221 $Output .= '<tr><td>'.$Item['TextBefore'].':</td><td title="'.$Item['Help'].'">'.$Value.'</td></tr>'; 222 } 223 } 224 $Output .= '</table>'; 297 $DefinitionItems[] = array('Name' => $Index, 'Type' => $Item['Type'], 'Caption' => $Item['TextBefore'].$Required, 'Value' => $DbRow[$Index], 'SourceTable' => $List['TableName'], 'SourceItemId' => 0); 298 } 299 } 300 $Form = new Form(); 301 $Form->Definition = array 302 ( 303 'Title' => 'Titulek', 304 'Items' => $DefinitionItems, 305 ); 306 $Output .= $Form->ShowReadOnlyForm(); 225 307 $Output .= '<a href="?Action=EditItem&Table='.$List['TableName'].'&Item='.$DbRow['Id'].'">Editovat</a> '; 226 308 … … 232 314 $Output .= '<a href="?Action=ShowList&Table='.$List['TableName'].'">Celkový seznam</a>'; 233 315 } 316 $Output .= ' <a href="?Action=ShowHistory&Table='.$List['TableName'].'&Item='.$DbRow['ItemId'].'">Historie</a>'; 234 317 $Output .= '<div class="line"></div>'; 235 236 318 foreach($List['Items'] as $Index => $Item) 237 319 { … … 306 388 case 'AddItemFinish': 307 389 $Output = ShowAddItemFinish($List); 390 break; 391 case 'ShowHistory': 392 $Output = ShowHistory($List, $_SESSION['Item']); 308 393 break; 309 394 case 'ShowList': -
database.php
r1 r9 11 11 function query($Query) 12 12 { 13 $this->LastQuery = $Query; 14 return(parent::query($Query)); 13 $this->LastQuery = $Query; 14 return(parent::query($Query)); 15 15 } 16 16 … … 18 18 { 19 19 $this->LastQuery = "SELECT ".$What." FROM `".$this->Prefix.$Table."` WHERE ".$Condition; 20 return($this->query($this->LastQuery)); 20 return($this->query($this->LastQuery)); 21 21 } 22 22 … … 24 24 { 25 25 $this->LastQuery = "DELETE FROM `".$this->Prefix.$Table."` WHERE ".$Condition; 26 $this->query($this->LastQuery); 26 $this->query($this->LastQuery); 27 27 } 28 28 … … 41 41 $Values = substr($Values, 1); 42 42 $this->LastQuery = 'INSERT INTO `'.$this->Prefix.$Table.'` ('.$Name.') VALUES('.$Values.')'; 43 $this->query($this->LastQuery); 43 $this->query($this->LastQuery); 44 44 } 45 45 -
forms.php
r8 r9 33 33 if(!array_key_exists($Index, $this->Values) and isset($Item['Value'])) $this->Values[$Index] = $Item['Value']; 34 34 if(is_callable($Type['CallbackEdit'])) $Edit = $Type['CallbackEdit']($Type, $Item); 35 else $Edit = $Type['CallbackEdit']; 36 /* 37 switch($Type[0]) 38 { 39 case 'Boolean': 40 if($this->Values[$Index] == 0) $Checked = ''; else $Checked = ' CHECKED'; 41 $Edit = '<input type="checkbox" name="'.$Context.$Index.'"'.$Checked.'>'; 42 break; 43 case 'String': 44 $Edit = '<input type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'">'; 45 break; 46 case 'Password': 47 $Edit = '<input type="password" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'">'; 48 break; 49 case 'Integer': 50 $Edit = '<input type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'">'; 51 break; 52 case 'Float': 53 $Edit = '<input type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'">'; 54 break; 55 case 'Time': 56 if($this->Values[$Index] == 'Now') $this->Values[$Index] = date('j.n.Y'); 57 $Edit = '<input type="text" name="'.$Context.$Index.'" value="'.$this->Values[$Index].'">'; 58 break; 59 case 'Array': 60 $Form = new Form($Item['ItemClass']); 61 $Edit = '<script type="text/javascript" id="syndication">'. 62 "var Count = 0;". 63 "function AddItem() {". 64 "Count = Count + 1;". 65 "var newcontent = document.createElement('div');". 66 "newcontent.id = '".$Context.$Item['ItemClass']."-' + Count;". 67 "newcontent.innerHTML = '<input type=\"hidden\" name=\"".$Context.$Item['ItemClass']."-' + Count + '\">".$Form->ShowEditBlock($Context.$Item['ItemClass']."-' + Count + '")."';". 68 "var scr = document.getElementById('syndication');". 69 "scr.parentNode.insertBefore(newcontent, scr); }". 70 '</script>'; 71 $Edit .= '<form><input type="button" onclick="AddItem();" value="Přidat položku"></form>'; 72 break; 73 default: 74 if(array_key_exists($Item['Type'], $FormTypes)) 75 { 76 // Custom types 77 switch($FormTypes[$Item['Type']]['Type']) 78 { 79 case 'Enumeration': 80 $Edit = '<select name="'.$Context.$Index.'">'; 81 foreach($FormTypes[$Item['Type']]['States'] as $StateIndex => $StateName) 82 $Edit .= '<option value="'.$StateIndex.'">'.$StateName.'</option>'; 83 $Edit .= '</select>'; 84 break; 85 case 'Reference': 86 $Edit = '<select name="'.$Context.$Index.'">'; 87 $DbResult = $Database->select($FormTypes[$Item['Type']]['Table'], $FormTypes[$Item['Type']]['Id'].' as Id, '.$FormTypes[$Item['Type']]['Name'].' as Name', $FormTypes[$Item['Type']]['Filter'].' ORDER BY Name'); 88 while($Row = $DbResult->fetch_array()) 89 $Edit .= '<option value="'.$Row['Id'].'">'.$Row['Name'].'</option>'; 90 $Edit .= '</select>'; 91 break; 92 default: 93 $Edit = 'Neznámý typ'; 94 } 95 } else $Edit = 'Neznámý typ'; 96 } 97 */ 35 else $Edit = $Type['CallbackEdit']; 36 array_push($Table['Rows'], array($Item['Caption'].':', $Edit)); 37 } 38 return($Table); 39 } 40 41 function ShowReadOnlyForm() 42 { 43 $Output = '<center><div align="center">'; 44 $Table = $this->ShowReadOnlyBlock(); 45 $Output .= $this->Definition['Title'].Table($Table).'</div></form>'; 46 return($Output); 47 } 48 49 function ShowReadOnlyBlock($Context = '') 50 { 51 global $Database, $Types; 52 53 $Table = array( 54 'Header' => array('Položka', 'Hodnota'), 55 'Rows' => array(), 56 ); 57 if($Context != '') $Context = $Context.'-'; 58 foreach($this->Definition['Items'] as $Item) 59 { 60 $ItemType = explode(':', $Item['Type']); 61 $Index = $Item['Name']; 62 $Type = $Types[$ItemType[0]]; 63 if(!array_key_exists($Index, $this->Values) and isset($Item['Value'])) $this->Values[$Index] = $Item['Value']; 64 if(is_callable($Type['CallbackView'])) $Edit = $Type['CallbackView']($Type, $Item); 65 else $Edit = $Type['CallbackView']; 98 66 array_push($Table['Rows'], array($Item['Caption'].':', $Edit)); 99 67 } -
global.php
r8 r9 15 15 include_once('page.php'); 16 16 include_once('forms.php'); 17 include_once('base.php'); 17 18 18 19 class System extends Module … … 43 44 $System->AddModule(new User()); 44 45 $System->Modules['User']->Check(); 46 LoadTypeDefinition(); 47 LoadListDefinition(); 45 48 46 49 $MonthNames = array('', 'Leden', 'Únor', 'Březen', 'Duben', 'Květen', 'Červen', 'Červenec', 'Srpen', 'Září', 'Říjen', 'Listopad', 'Prosinec'); -
index.php
r8 r9 2 2 3 3 include_once('global.php'); 4 include('base.php');5 4 6 5 class IndexPage extends Page … … 30 29 array('Name' => 'Password2', 'Type' => 'Password', 'Caption' => 'Potvrzení hesla', 'Value' => ''), 31 30 array('Name' => 'Email', 'Type' => 'String', 'Caption' => 'E-mail', 'Value' => ''), 32 array('N Ame' => 'FirstName', 'Type' => 'String', 'Caption' => 'Křestní jméno', 'Value' => ''),31 array('Name' => 'FirstName', 'Type' => 'String', 'Caption' => 'Křestní jméno', 'Value' => ''), 33 32 array('Name' => 'SecondName', 'Type' => 'String', 'Caption' => 'Příjmení', 'Value' => ''), 34 33 ), … … 45 44 { 46 45 $Output .= $this->SystemMessage('Odhlášení', $this->System->Modules['User']->Logout()); 46 } else 47 if($_GET['Action'] == 'LoginForm') 48 { 49 $Form = new Form(); 50 $Form->Definition = $FormUserLogin; 51 $Form->OnSubmit = '?Action=Login'; 52 $Output .= $Form->ShowEditForm(); 47 53 } else 48 54 if($_GET['Action'] == 'UserRegister') … … 69 75 if(!array_key_exists('Action', $_GET)) 70 76 { 71 $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=LoginForm">Přihlášení</a> 77 $Output .= '<a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=LoginForm">Přihlášení</a><br /><a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=UserRegister">Registrace</a>'; 72 78 $Form = new Form(); 73 79 $Form->Definition = $FormUserLogin; … … 80 86 $Output .= $this->System->Modules['User']->User['UserName'].' <a href="'.$this->System->Config['Web']['RootFolder'].'/?Action=Logout">Odhlásit</a>'; 81 87 $Output .= '<br /><br />'; 82 LoadTypeDefinition();83 LoadListDefinition();84 88 $Output .= TableList(1); 85 89 $Output .= TableList(0); -
page.php
r8 r9 70 70 $Output = $this->ShowHeader($this->FullTitle, $this->ShortTitle).$Output; 71 71 //$Output .= $this->ShowFooter(); 72 // echo($this->FormatOutput($Output));72 //$Output = $this->FormatOutput($Output); 73 73 echo($Output); 74 74 } -
style.css
r8 r9 34 34 .main div 35 35 { 36 font-weight: bold;37 36 } 38 37 -
types/Hyperlink.php
r8 r9 3 3 function TypeHyperlinkViewHtml($Type, $Item) 4 4 { 5 $Output = '<a href="'.$Item[' Name'].'">'.$Item['Value'].'</a>';5 $Output = '<a href="'.$Item['Value'].'">'.$Item['Value'].'</a>'; 6 6 return($Output); 7 7 } 8 8 9 function TypeHyperlinkEditHtml($Type, $ Parameter, $Table, $Id)9 function TypeHyperlinkEditHtml($Type, $Item) 10 10 { 11 11 $Output = '<input type="text" name="'.$Item['Name'].'" value="'.$Item['Value'].'">'; -
types/Password.php
r8 r9 1 1 <?php 2 2 3 function TypePasswordViewHtml($Type, $ Parameter, $Table, $Id)3 function TypePasswordViewHtml($Type, $Item) 4 4 { 5 5 $Output = ''; … … 9 9 } 10 10 11 function TypePasswordEditHtml($Type, $ Parameter, $Table, $Id)11 function TypePasswordEditHtml($Type, $Item) 12 12 { 13 13 $Output = '<input type="password" name="'.$Item['Name'].'" value="'.$Item['Value'].'">'; -
types/PointerOneToOne.php
r8 r9 1 1 <?php 2 2 3 function TypePointerOneToOneViewHtml($Type, $Item)3 function GetTablePointerName($Type, $Item) 4 4 { 5 5 global $Database, $Lists; 6 6 7 //print_r($Type);8 $Output = '';9 7 $Columns = ''; 10 8 $ItemType = explode(':', $Item['Type']); … … 18 16 if($DbResult->num_rows > 0) 19 17 { 20 $DbRow = $DbResult->fetch_array(); 21 $Output = '<a href="?Action=ViewItem&Table='.$TargetTable.'&Item='.$DbRow['Id'].'">'.$DbRow['Name'].'</a>'; 22 } 18 return($DbResult->fetch_assoc()); 19 } else return(''); 20 } 21 22 function GetTablePointerNameList($Type, $Item) 23 { 24 global $Database, $Lists; 25 26 $Columns = ''; 27 $ItemType = explode(':', $Item['Type']); 28 $TargetTable = $ItemType[1]; 29 30 foreach($Lists[$TargetTable]['Items'] as $ListItem) 31 if($ListItem['VisibleInPointer'] == 1) $Columns .= '`'.$ListItem['Name'].'`," ",'; 32 $Columns = 'CONCAT('.substr($Columns, 0, -1).') AS Name, Id'; 33 $DbResult = $Database->select($TargetTable, $Columns); 34 //echo($Database->LastQuery); 35 if($DbResult->num_rows > 0) 36 { 37 $Result = array(); 38 while($DbRow = $DbResult->fetch_assoc()) 39 $Result[] = $DbRow; 40 return($Result); 41 } else return(array()); 42 } 43 44 function TypePointerOneToOneViewHtml($Type, $Item) 45 { 46 global $Database, $Lists; 47 48 $ItemType = explode(':', $Item['Type']); 49 $TargetTable = $ItemType[1]; 50 $TargetName = GetTablePointerName($Type, $Item); 51 $Output = '<a href="?Action=ViewItem&Table='.$TargetTable.'&Item='.$TargetName['Id'].'">'.$TargetName['Name'].'</a>'; 23 52 return($Output); 24 53 } … … 29 58 30 59 $Output = '<select name="'.$Item['Name'].'">'; 31 $Columns = ''; 32 $ItemType = explode(':', $Item['Type']); 33 $TargetTable = $ItemType[1]; 34 foreach($Lists[$TargetTable]['Items'] as $ListItem) 35 if($ListItem['VisibleInPointer'] == 1) $Columns .= '`'.$ListItem['Name'].'`," ",'; 36 $Columns = 'CONCAT('.substr($Columns, 0, -1).') AS Name, Id'; 37 $DbResult = $Database->select($TargetTable, $Columns); 60 $TargetNameList = GetTablePointerNameList($Type, $Item); 38 61 //echo($Database->LastQuery); 39 while($DbRow = $DbResult->fetch_array())62 foreach($TargetNameList as $TargetName) 40 63 { 41 if($ Parameter == $DbRow['Id']) $Selected = ' selected="1"'; else $Selected = '';42 $Output .= '<option value="'.$ DbRow['Id'].'"'.$Selected.'>'.$DbRow['Name'].'</option>';64 if($Item['Value'] == $TargetName['Id']) $Selected = ' selected="1"'; else $Selected = ''; 65 $Output .= '<option value="'.$TargetName['Id'].'"'.$Selected.'>'.$TargetName['Name'].'</option>'; 43 66 } 44 67 $Output .= '</select>'; -
user.php
r8 r9 68 68 while($DbRow = $DbResult->fetch_array()) 69 69 { 70 $this->Database->delete($this->TableUserOnline, ' Id='.$DbRow['User']);70 $this->Database->delete($this->TableUserOnline, 'User='.$DbRow['User']); 71 71 $this->System->Modules['Log']->NewRecord('User', 'Logout'); 72 72 } … … 96 96 $this->Database->insert($this->TableUser, array('Name' => $Nick, 'FirstName' => $FirstName, 'SecondName' => $SecondName, 'Password' => sha1($Password), 'Email' => $Email, 'RegistrationTime' => 'NOW()', 'Locked' => 1)); 97 97 $UserId = $this->Database->insert_id; 98 98 99 99 $Subject = FromUTF8('Registrace nového účtu', 'iso2'); 100 100 $Message = 'Provedli jste registraci nového účtu na serveru <a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'">http://'.$Config['Web']['Host'].$Config['Web']['RootFolder']."</a>.<br>\nPokud jste tak neučinili, měli by jste tento email ignorovat.<br><br>\n\nVáš účet je: ".$Nick."\n<br>Pro dokončení registrace klikněte na ".'<a href="http://'.$Config['Web']['Host'].$Config['Web']['RootFolder'].'/?Action=UserRegisterConfirm&User='.$UserId.'&H='.sha1($Password).'">tento odkaz</a>.'."\n<br> \n\n<br><br>Na tento email neodpovídejte.";
Note:
See TracChangeset
for help on using the changeset viewer.