Changeset 514 for trunk/banners.php
- Timestamp:
- Feb 16, 2013, 8:31:12 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/banners.php
r504 r514 2 2 3 3 include('includes/global.php'); 4 5 function ParentWebs($Selected) 6 { 7 global $System; 8 9 $Output = '<select name="Parent">'; 10 $Output .= '<option value=""'; 11 if($Selected == '') 12 $Output .= ' selected="selected"'; 13 $Output .= '></option>'; 14 $DbResult = $System->Database->select('Referrer', '`Id`, `Web`', 'Parent IS NULL'); 15 while($Language = $DbResult->fetch_assoc()) 16 { 17 $Output .= '<option value="'.$Language['Id'].'"'; 18 if($Selected == $Language['Id']) 19 $Output .= ' selected="selected"'; 20 $Output .= '>'.$Language['Web'].'</option>'; 21 } 22 $Output .= '</select>'; 23 return($Output); 24 } 4 25 5 26 $MonthAge = 3; … … 22 43 23 44 45 if(!$User->Licence(LICENCE_ADMIN)) $Where = ' WHERE (`Show`=1) AND (`Parent` IS NULL)'; 46 else $Where = ''; 24 47 $Query = 'SELECT * FROM (SELECT *, (`Hits` + COALESCE((SELECT SUM(`Hits`) FROM '. 25 48 '`Referrer` AS `T1` WHERE `T1`.`Parent` = `T2`.`Id`), 0)) AS `TotalHits`, '. 26 49 'GREATEST(`DateLast`, COALESCE((SELECT MAX(`DateLast`) FROM '. 27 50 '`Referrer` AS `T1` WHERE `T1`.`Parent` = `T2`.`Id`), 0)) AS `MaxDateLast` FROM '. 28 '`Referrer` AS `T2` WHERE (`Show`=1) AND (`Parent` IS NULL)) AS `T3` '.51 '`Referrer` AS `T2`'.$Where.') AS `T3` '. 29 52 'WHERE (`T3`.`MaxDateLast` > (NOW() - INTERVAL '.$MonthAge.' MONTH))'; 30 53 31 54 32 55 $DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS T'); … … 42 65 array('Name' => 'TotalHits', 'Title' => 'Příchodů'), 43 66 ); 67 if($User->Licence(LICENCE_ADMIN)) 68 { 69 $TableColumns[] = array('Name' => 'Show', 'Title' => 'Viditelné'); 70 $TableColumns[] = array('Name' => 'Parent', 'Title' => 'Rodič'); 71 $TableColumns[] = array('Name' => 'Description', 'Title' => 'Komentář'); 72 $TableColumns[] = array('Name' => 'Action', 'Title' => 'Akce'); 73 } 44 74 $Order = GetOrderTableHeader($TableColumns, 'MaxDateLast', 1); 45 75 $Output .= $Order['Output']; … … 52 82 $Output .= '<tr><td><a href="'.$Line['LastURL'].'">'.$Line['Web'].'</a></td>'. 53 83 '<td>'.HumanDate($Line['MaxDateLast']).'</td>'. 54 '<td>'.$Line['TotalHits'].'</td></tr>'; 84 '<td>'.$Line['TotalHits'].'</td>'; 85 if($User->Licence(LICENCE_ADMIN)) 86 { 87 $Output .= 88 '<td>'.$Line['Show'].'</td>'. 89 '<td>'.$Line['Parent'].'</td>'. 90 '<td>'.$Line['Description'].'</td>'. 91 '<td><a href="?action=edit&id='.$Line['Id'].'">Upravit</a></td>'; 92 } 93 $Output .= '</tr>'; 55 94 } 56 95 $Output .= '</table>';
Note:
See TracChangeset
for help on using the changeset viewer.