Changeset 19641


Ignore:
Timestamp:
09/15/19 14:37:52 (5 years ago)
Author:
Daniela Dorner
Message:
replace ATel in comment by link to ATel
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/www/flare_alerts/sent.php

    r19633 r19641  
    146146        }
    147147        echo "<tr>\n";
     148        foreach ($colnames as $key)
     149        {
     150            if ($key=="Comment")
     151            {
     152                if (strpos($row[$key],"ATel") !== false)
     153                    echo "<td>".preg_replace("/ATel\ \#(\d{4,5})/", "<a href='http://www.astronomerstelegram.org/?read=$1'>ATel #$1</a>", $row[$key])."</td>\n";
     154                else
     155                    echo "<td>".$row[$key]."</td>\n";
     156            }
     157            else
     158                echo "<td>".$row[$key]."</td>\n";
     159        }
     160        echo "</tr>\n";
     161    }
     162    echo "</table><br>\n";
     163
     164    echo "<hr>\n";
     165    echo "<hr>\n";
     166    echo "<h2>Alert Statistics: </h2>";
     167    $query="SELECT fRecepientName AS 'To', Count(*) AS 'count' FROM Sent LEFT JOIN Recepient USING (fRecepientKey) WHERE fSentTime BETWEEN ".$start." AND ".$stop;
     168    if ($source != -1)
     169        $query.=" AND fSourceKey=".$source;
     170    if ($type != -1)
     171        $query.=" AND fRecepientKey=".$type;
     172    $query.=" GROUP BY fRecepientName ORDER BY count DESC";
     173
     174    echo "<table border='1' style='border-collapse:collapse'>\n";
     175    $first_row = 0;
     176    $colnames = "";
     177    $result = $db->query($query)->fetchAll(PDO::FETCH_ASSOC);
     178    foreach($result as $row)
     179    {
     180        if ($first_row == 0)
     181        {
     182            $first_row = 1;
     183            echo "<tr>\n";
     184            $colnames = array_keys($row);
     185            foreach($colnames as $colname){
     186                echo "<th>".$colname."</th>\n";
     187            }
     188            echo "</tr>\n";
     189        }
     190        echo "<tr>\n";
    148191        foreach ($colnames as $key) {
    149192           
     
    152195        echo "</tr>\n";
    153196    }
    154     echo "</table><br>\n";
    155 
    156     echo "<hr>\n";
    157     echo "<hr>\n";
    158     echo "<h2>Alert Statistics: </h2>";
    159     $query="SELECT fRecepientName AS 'To', Count(*) AS 'count' FROM Sent LEFT JOIN Recepient USING (fRecepientKey) WHERE fSentTime BETWEEN ".$start." AND ".$stop;
    160     if ($source != -1)
    161         $query.=" AND fSourceKey=".$source;
    162     if ($type != -1)
    163         $query.=" AND fRecepientKey=".$type;
    164     $query.=" GROUP BY fRecepientName ORDER BY count DESC";
     197    echo "</table>\n";
     198
     199    echo "<hr>\n";
     200    $query="SELECT fSourceName AS 'Source', Count(*) AS 'count' FROM Sent LEFT JOIN factdata.Source USING (fSourceKey) ";
     201    $query.="WHERE fSentTime BETWEEN ".$start." AND ".$stop;
     202    if ($source != -1)
     203        $query.=" AND fSourceKey=".$source;
     204    if ($type != -1)
     205        $query.=" AND fRecepientKey=".$type;
     206    $query.=" GROUP BY fSourceName ORDER BY count DESC";
     207
    165208
    166209    echo "<table border='1' style='border-collapse:collapse'>\n";
     
    190233
    191234    echo "<hr>\n";
    192     $query="SELECT fSourceName AS 'Source', Count(*) AS 'count' FROM Sent LEFT JOIN factdata.Source USING (fSourceKey) ";
     235    $query="SELECT fSourceName AS 'Source', fRecepientName AS 'To', Count(*) AS 'count' FROM Sent ";
     236    $query.="LEFT JOIN Recepient USING (fRecepientKey) LEFT JOIN factdata.Source USING (fSourceKey) ";
    193237    $query.="WHERE fSentTime BETWEEN ".$start." AND ".$stop;
    194238    if ($source != -1)
     
    196240    if ($type != -1)
    197241        $query.=" AND fRecepientKey=".$type;
    198     $query.=" GROUP BY fSourceName ORDER BY count DESC";
     242    $query.=" GROUP BY fRecepientName, fSourceName ORDER BY fRecepientName ";
    199243
    200244
     
    224268    echo "</table>\n";
    225269
    226     echo "<hr>\n";
    227     $query="SELECT fSourceName AS 'Source', fRecepientName AS 'To', Count(*) AS 'count' FROM Sent ";
    228     $query.="LEFT JOIN Recepient USING (fRecepientKey) LEFT JOIN factdata.Source USING (fSourceKey) ";
    229     $query.="WHERE fSentTime BETWEEN ".$start." AND ".$stop;
    230     if ($source != -1)
    231         $query.=" AND fSourceKey=".$source;
    232     if ($type != -1)
    233         $query.=" AND fRecepientKey=".$type;
    234     $query.=" GROUP BY fRecepientName, fSourceName ORDER BY fRecepientName ";
    235 
    236 
    237     echo "<table border='1' style='border-collapse:collapse'>\n";
    238     $first_row = 0;
    239     $colnames = "";
    240     $result = $db->query($query)->fetchAll(PDO::FETCH_ASSOC);
    241     foreach($result as $row)
    242     {
    243         if ($first_row == 0)
    244         {
    245             $first_row = 1;
    246             echo "<tr>\n";
    247             $colnames = array_keys($row);
    248             foreach($colnames as $colname){
    249                 echo "<th>".$colname."</th>\n";
    250             }
    251             echo "</tr>\n";
    252         }
    253         echo "<tr>\n";
    254         foreach ($colnames as $key) {
    255            
    256             echo "<td>".$row[$key]."</td>\n";
    257         }
    258         echo "</tr>\n";
    259     }
    260     echo "</table>\n";
    261 
    262270    echo "<hr size='2px' style='border-width:5px'>\n";
    263271
Note: See TracChangeset for help on using the changeset viewer.