Changeset 514 for trunk/banners.php


Ignore:
Timestamp:
Feb 16, 2013, 8:31:12 PM (12 years ago)
Author:
chronos
Message:
  • Upraveno: Částečna snaha o správu odkazů tabulky propagace. Bude potřeba zajistit nejdříve obecný formulářový systém.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/banners.php

    r504 r514  
    22
    33include('includes/global.php');
     4
     5function 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}
    425
    526$MonthAge = 3;
     
    2243
    2344
     45if(!$User->Licence(LICENCE_ADMIN)) $Where = ' WHERE (`Show`=1) AND (`Parent` IS NULL)';
     46  else $Where = '';
    2447$Query = 'SELECT * FROM (SELECT *, (`Hits` + COALESCE((SELECT SUM(`Hits`) FROM '.
    2548'`Referrer` AS `T1` WHERE `T1`.`Parent` = `T2`.`Id`), 0)) AS `TotalHits`, '.
    2649'GREATEST(`DateLast`, COALESCE((SELECT MAX(`DateLast`) FROM '.
    2750'`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` '.
    2952'WHERE (`T3`.`MaxDateLast` > (NOW() - INTERVAL '.$MonthAge.' MONTH))';
    30   
     53 
    3154
    3255$DbResult = $System->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS T');
     
    4265  array('Name' => 'TotalHits', 'Title' => 'Příchodů'),
    4366);
     67if($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}
    4474$Order = GetOrderTableHeader($TableColumns, 'MaxDateLast', 1);
    4575$Output .= $Order['Output'];
     
    5282  $Output .= '<tr><td><a href="'.$Line['LastURL'].'">'.$Line['Web'].'</a></td>'.
    5383    '<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&amp;id='.$Line['Id'].'">Upravit</a></td>';
     92    }
     93    $Output .= '</tr>';
    5594}
    5695$Output .= '</table>';
Note: See TracChangeset for help on using the changeset viewer.