Changeset 765 for trunk/includes
- Timestamp:
- Jan 27, 2014, 10:01:33 PM (11 years ago)
- Location:
- trunk/includes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/Database.php
r709 r765 2 2 3 3 // Extended database class 4 // Date: 2011-11-25 5 4 // Date: 2014-01-27 6 5 7 6 class DatabaseResult … … 170 169 { 171 170 return($this->PDO->quote($Text)); 171 } 172 173 function __sleep() 174 { 175 return array('LastQuery'); 176 } 177 178 function __wakeup() 179 { 172 180 } 173 181 } -
trunk/includes/Page.php
r639 r765 31 31 var $Table; 32 32 var $Definition; 33 var $ItemActions; 33 34 34 35 function __construct($System) … … 37 38 $this->Table = ''; 38 39 $this->Definition = array(); 40 $this->ItemActions = array( 41 array('Name' => T('View'), 'URL' => '?action=view&id=#Id'), 42 array('Name' => T('Delete'), 'URL' => '?action=remove&id=#Id'), 43 ); 39 44 } 40 45 … … 46 51 if($_GET['action'] == 'add') $Output .= $this->AddItem(); 47 52 else if($_GET['action'] == 'view') $Output .= $this->ViewItem(); 53 else if($_GET['action'] == 'edit') $Output .= $this->ModifyItem(); 48 54 else if($_GET['action'] == 'remove') $Output .= $this->RemoveItem(); 49 55 else if($_GET['action'] == 'delete') $Output .= $this->DeleteItem(); … … 55 61 function ViewItem() 56 62 { 57 $Output = ''; 58 return($Output); 63 $DbResult = $this->Database->query('SELECT * FROM ('.$this->TableSQL.') AS `T` WHERE `Id`='.$_GET['id']); 64 if($DbResult->num_rows > 0) 65 { 66 $DbRow = $DbResult->fetch_assoc(); 67 68 $Output = T('Item'). 69 '<table>'; 70 foreach($this->Definition as $DefIndex => $Def) 71 { 72 $Output .= '<tr><td>'.$Def['Title'].':</td><td>'.$this->ViewControl($Def['Type'], $DefIndex, $DbRow[$DefIndex]).'</tr>'; 73 } 74 $Output .= '<tr>'. 75 '</table>'; 76 } else $Output = ShowMessage(T('Item not found'), MESSAGE_CRITICAL); 77 $Output .= '<a href="?action=add">'.T('Add').'</a> '; 78 $Output .= '<a href="?action=edit&id='.$_GET['id'].'">'.T('Edit').'</a> '; 79 $Output .= '<a href="?action=delete&id='.$_GET['id'].'">'.T('Add').'</a> '; 80 $Output .= '<a href="?">'.T('List').'</a><br/>'; 81 return($Output); 59 82 } 60 83 … … 69 92 $TableColumns = array(); 70 93 foreach($this->Definition as $Index => $Def) 71 $TableColumns[] = array('Name' => $Index, 'Title' => $Def['Title']); 94 if($Def['InList']) 95 $TableColumns[] = array('Name' => $Index, 'Title' => $Def['Title']); 96 if(count($this->ItemActions) > 0) 97 $TableColumns[] = array('Name' => '', 'Title' => 'Akce'); 72 98 73 99 $Order = GetOrderTableHeader($TableColumns, 'Name', 0); … … 79 105 $Output .= '<tr>'; 80 106 foreach($this->Definition as $Index => $Def) 107 if($Def['InList']) 81 108 { 82 109 if($Def['Type'] == 'URL') $Output .= '<td><a href="'.$Item[$Index].'">'.$Item[$Index].'</a></td>'; 83 110 else $Output .= '<td>'.$Item[$Index].'</td>'; 84 111 } 112 if(count($this->ItemActions) > 0) 113 { 114 $Output .= '<td>'; 115 foreach($this->ItemActions as $Index => $Action) 116 { 117 $URL = $Action['URL']; 118 if(strpos($URL, '#Id')) $URL = str_replace('#Id', $Item['Id'], $URL); 119 $Output .= '<a href="'.$URL.'">'.$Action['Name'].'</a> '; 120 } 121 $Output .= '</td>'; 122 } 85 123 $Output .= '</tr>'; 86 124 } 87 $Output .= '</table>'; 125 $Output .= '</table>'; 126 $Output .= '<a href="?action=add">'.T('Add').'</a><br/>'; 88 127 return($Output); 89 128 } … … 105 144 } else 106 145 { 107 $Output .= '<form action="?action=add&finish=1" method="post">'.108 '<fieldset><legend>'.T('New item').'</legend>'.109 '<table>';110 foreach($this->Definition as $DefIndex => $Def)111 {112 $Output .= '<tr><td>'.$Def['Title'].'</td><td>'.$this->GetControl($Def['Type'], $DefIndex).'</tr>';113 }114 $Output .= '<tr><td colspan="2"><input type="submit" value="'.T('Add').'" /></td></tr>'.115 '</table>'.116 '</fieldset>'.117 '</form>';146 $Output .= '<form action="?action=add&finish=1" method="post">'. 147 '<fieldset><legend>'.T('New item').'</legend>'. 148 '<table>'; 149 foreach($this->Definition as $DefIndex => $Def) 150 { 151 $Output .= '<tr><td>'.$Def['Title'].':</td><td>'.$this->GetControl($Def['Type'], $DefIndex, '').'</tr>'; 152 } 153 $Output .= '<tr><td colspan="2"><input type="submit" value="'.T('Add').'" /></td></tr>'. 154 '</table>'. 155 '</fieldset>'. 156 '</form>'; 118 157 } 119 158 } else $Output .= ShowMessage(T('Access denied'), MESSAGE_CRITICAL); 120 159 return($Output); 121 } 122 160 } 123 161 124 162 function DeleteItem() … … 132 170 } 133 171 134 function GetControl($Type, $Name )172 function GetControl($Type, $Name, $Value) 135 173 { 136 if($Type == 'Text') $Output = '<input type="text" name="'.$Name.'" />';174 if($Type == 'Text') $Output = '<input type="text" name="'.$Name.'" value="'.$Value.'"/>'; 137 175 else if($Type == 'Boolean') $Output = '<input type="checkbox" name="'.$Name.'"/>'; 138 else $Output = '<input type="text" name="'.$Name.'"/>'; 176 else $Output = '<input type="text" name="'.$Name.'" value="'.$Value.'"/>'; 177 return($Output); 178 } 179 180 function ViewControl($Type, $Name, $Value) 181 { 182 if($Type == 'Text') $Output = $Value; 183 else if($Type == 'URL') $Output = '<a href="'.$Value.'">'.$Value.'</a>'; 184 else if($Type == 'Boolean') $Output = $Value; 185 else $Output = $Value; 186 return($Output); 139 187 } 140 188 } -
trunk/includes/Version.php
r764 r765 6 6 // and system will need database update. 7 7 8 $Revision = 76 4; // Subversion revision8 $Revision = 766; // Subversion revision 9 9 $DatabaseRevision = 748; // Database structure revision 10 $ReleaseTime = '2014-01-2 6';10 $ReleaseTime = '2014-01-27'; -
trunk/includes/system.php
r748 r765 389 389 '<meta http-equiv="content-type" content="application/xhtml+xml; charset='.$this->System->Config['Web']['Charset'].'" />'. 390 390 '<meta name="keywords" content="wow, quest, questy, questů, preklad, mangos, překlad, překládání, přeložený, přeložení, čeština, world of warcraft, open source, free, addon" />'. 391 '<meta name="description" content="'.$this->System->Config['Web'][' Title'].'" />'.391 '<meta name="description" content="'.$this->System->Config['Web']['Description'].'" />'. 392 392 '<meta name="robots" content="all" />'. 393 393 '<link rel="stylesheet" href="'.$this->System->Link('/style/style.css').'" type="text/css" media="all" />'.
Note:
See TracChangeset
for help on using the changeset viewer.