コード例 #1
0
function selected_observation()
{
    global $instDir, $baseURL, $dateformat, $step, $loggedUser, $objUtil, $objPresentations;
    // creation of objects
    $observations = new CometObservations();
    $instruments = new Instruments();
    $observers = new Observers();
    $objects = new CometObjects();
    $util = $objUtil;
    // selection of all observations of one object
    echo "<div id=\"main\">";
    if (isset($_GET['objectname'])) {
        $queries = array("object" => $objects->getName($_GET['objectname']));
        // sql query
        $sort = "id";
        // standard sort on insertion date
        $obs = $observations->getObservationFromQuery($queries);
        if (sizeof($obs) > 0) {
            krsort($obs);
        }
        // save $obs as a session variable
        $_SESSION['obs'] = $obs;
        $_SESSION['observation_query'] = $obs;
        $count = 0;
        // counter for altering table colors
        $link = "" . $baseURL . "index.php?indexAction=comets_result_query_observations&amp;objectname=" . $_GET['objectname'];
        echo "<h4>" . LangSelectedObservationsTitle . $objects->getName($_GET['objectname']) . "</h4>";
        echo "<hr />";
        if (sizeof($obs) > 0) {
            echo "<table class=\"table sort-tablecometobservations table-condensed table-striped table-hover tablesorter custom-popup\">\n\t      <thead>\n\t\t  <tr>\n\t      <th>" . LangOverviewObservationsHeader1 . "</th>\n\t      <th>" . LangOverviewObservationsHeader2 . "</th>\n\t      <th>" . LangOverviewObservationsHeader4 . "</th>\n\t      <th>" . LangNewComet1 . "</th>\n\t      <th>" . LangViewObservationField3 . "</th>\n\t      <th>" . LangViewObservationField19 . "</th>\n\t      <th>" . LangViewObservationField18b . "</th>\n\t      <th>" . LangViewObservationField20b . "</th>\n\t      <th class=\"filter-false columnSelector-disable\" data-sorter=\"false\"></th>\n\t      </tr>\n\t      </thead>";
            while (list($key, $value) = each($obs)) {
                // OBJECT
                $object = $observations->getObjectId($value);
                // overhead as this is every time the same object?!
                // OUTPUT
                echo "<tr>\n\t            <td><a href=\"" . $baseURL . "index.php?indexAction=comets_detail_object&amp;object=" . urlencode($object) . "\">" . $objects->getName($object) . "</a></td>";
                // OBSERVER
                $observer = $observations->getObserverId($value);
                echo "<td>";
                echo "<a href=\"" . $baseURL . "index.php?indexAction=detail_observer&amp;user="******"\">" . $observers->getObserverProperty($observer, 'firstname') . "&nbsp;" . $observers->getObserverProperty($observer, 'name') . "</a>";
                echo "</td>";
                // DATE
                if ($observers->getObserverProperty($loggedUser, 'UT')) {
                    $date = sscanf($observations->getDate($value), "%4d%2d%2d");
                } else {
                    $date = sscanf($observations->getLocalDate($value), "%4d%2d%2d");
                }
                echo "<td>";
                echo date($dateformat, mktime(0, 0, 0, $date[1], $date[2], $date[0]));
                // TIME
                echo " (";
                if ($observers->getObserverProperty($loggedUser, 'UT')) {
                    $time = sscanf(sprintf("%04d", $observations->getTime($value)), "%2d%2d");
                } else {
                    $time = sscanf(sprintf("%04d", $observations->getLocalTime($value)), "%2d%2d");
                }
                printf("%02d", $time[0]);
                echo ":";
                printf("%02d", $time[1]);
                $time = sscanf(sprintf("%04d", $observations->getTime($value)), "%2d%2d");
                echo ")</td>";
                // INSTRUMENT
                $temp = $observations->getInstrumentId($value);
                $instrument = $instruments->getInstrumentPropertyFromId($temp, 'name');
                $instrumentsize = $instruments->getInstrumentPropertyFromId($temp, 'diameter');
                if ($instrument == "Naked eye") {
                    $instrument = InstrumentsNakedEye;
                }
                // MAGNITUDE
                $mag = $observations->getMagnitude($value);
                if ($mag < -90) {
                    $mag = '';
                } else {
                    $mag = sprintf("%01.1f", $observations->getMagnitude($value));
                }
                // COMA
                $coma = $observations->getComa($value);
                if ($coma < -90) {
                    $coma = '';
                } else {
                    $coma = $coma . "'";
                }
                // DC
                $dc = $observations->getDc($value);
                if ($dc < -90) {
                    $dc = '';
                }
                // TAIL
                $tail = $observations->getTail($value);
                if ($tail < -90) {
                    $tail = '';
                } else {
                    $tail = $tail . "'";
                }
                if ($instrument != InstrumentsNakedEye && $instrument != "") {
                    $instrument = $instrument . " (" . $instrumentsize . "&nbsp;mm" . ")";
                }
                echo " <td>{$mag}</td>\n\t            <td>{$instrument}</td>\n\t            <td>{$coma}</td>\n\t            <td>{$dc}</td>\n\t            <td>{$tail}</td>";
                // DETAILS
                echo "<td><a href=\"" . $baseURL . "index.php?indexAction=comets_detail_observation&amp;observation=" . $value . "\">details";
                // LINK TO DRAWING (IF AVAILABLE)
                echo "</a></td></tr>";
            }
            echo "</table>";
            $objUtil->addPager("cometobservations", sizeof($obs));
            echo "<hr />";
            echo "<a class=\"btn btn-success\" href=\"" . $baseURL . "cometobservations.pdf.php\" rel=\"external\"><span class=\"glyphicon glyphicon-download\"></span> " . LangExecuteQueryObjectsMessage4a . "</a>";
            echo "<br /><br />";
        } else {
            echo LangNoObservations;
        }
        echo "</div>";
    } elseif ($_GET['user']) {
        $query = array("observer" => $_GET['user']);
        $sort = "id";
        // standard sort on date
        $obs = $observations->getObservationFromQuery($query, $sort);
        if (sizeof($obs) > 0) {
            krsort($obs);
        }
        // save $obs as a session variable
        $_SESSION['obs'] = $obs;
        $_SESSION['observation_query'] = $obs;
        $link = "" . $baseURL . "index.php?indexAction=comets_result_query_observations&amp;user="******"<h4>" . LangSelectedObservationsTitle . $observers->getObserverProperty($_GET['user'], 'firstname') . "&nbsp;" . $observers->getObserverProperty($_GET['user'], 'name') . "</h4>";
        echo "<hr />";
        // NEW BEGIN
        if (sizeof($obs) > 0) {
            // OBJECT TABLE HEADERS
            echo "<table class=\"table sort-tablecometobservations table-condensed table-striped table-hover tablesorter custom-popup\">\n\t\t\t      <thead>\n\t\t\t\t  <tr>\n\t\t\t      <th>" . LangOverviewObservationsHeader1 . "</th>\n\t\t\t      <th>" . LangOverviewObservationsHeader4 . "</th>\n\t\t\t      <th>" . LangNewComet1 . "</th>\n\t\t\t      <th>" . LangViewObservationField3 . "</th>\n\t\t\t      <th>" . LangViewObservationField19 . "</th>\n\t\t\t      <th>" . LangViewObservationField18b . "</th>\n\t\t\t      <th>" . LangViewObservationField20b . "</th>\n\t\t\t      <th class=\"filter-false columnSelector-disable\" data-sorter=\"false\"></th>\n\t\t\t      </thead>\n\t\t\t      </tr>";
            while (list($key, $value) = each($obs)) {
                // OBJECT
                $object = $observations->getObjectId($value);
                // OUTPUT
                echo "<tr>\n\t\t\t            <td><a href=\"" . $baseURL . "index.php?indexAction=comets_detail_object&amp;object=" . urlencode($object) . "\">" . $objects->getName($object) . "</a></td>\n\t\t\t            <td>";
                // DATE
                if ($observers->getObserverProperty($loggedUser, 'UT')) {
                    $date = sscanf($observations->getDate($value), "%4d%2d%2d");
                } else {
                    $date = sscanf($observations->getLocalDate($value), "%4d%2d%2d");
                }
                echo date($dateformat, mktime(0, 0, 0, $date[1], $date[2], $date[0]));
                // TIME
                echo "&nbsp;(";
                if ($observers->getObserverProperty($loggedUser, 'UT')) {
                    $time = sscanf(sprintf("%04d", $observations->getTime($value)), "%2d%2d");
                } else {
                    $time = sscanf(sprintf("%04d", $observations->getLocalTime($value)), "%2d%2d");
                }
                printf("%02d", $time[0]);
                echo ":";
                printf("%02d", $time[1]);
                echo ")</td>";
                // INSTRUMENT
                $temp = $observations->getInstrumentId($value);
                $instrument = $instruments->getInstrumentPropertyFromId($temp, 'name');
                if ($instrument == "Naked eye") {
                    $instrument = InstrumentsNakedEye;
                }
                // MAGNITUDE
                $mag = $observations->getMagnitude($value);
                if ($mag < -90) {
                    $mag = '';
                }
                // COMA
                $coma = $observations->getComa($value);
                if ($coma < -90) {
                    $coma = '';
                } else {
                    $coma = $coma . "'";
                }
                // DC
                $dc = $observations->getDc($value);
                if ($dc < -90) {
                    $dc = '';
                }
                // TAIL
                $tail = $observations->getTail($value);
                if ($tail < -90) {
                    $tail = '';
                } else {
                    $tail = $tail . "'";
                }
                echo " <td>{$mag}</td>\n\t\t\t            <td>{$instrument}</td>\n\t\t\t            <td>{$coma}</td>\n\t\t\t            <td>{$dc}</td>\n\t\t\t            <td>{$tail}</td>";
                // DETAILS
                echo "<td><a href=\"" . $baseURL . "index.php?indexAction=comets_detail_observation&amp;observation=" . $value . "\">details";
                // LINK TO DRAWING (IF AVAILABLE)
                $upload_dir = 'cometdrawings';
                $dir = opendir($instDir . "comets/" . $upload_dir);
                while (FALSE !== ($file = readdir($dir))) {
                    if ("." == $file or ".." == $file) {
                        continue;
                        // skip current directory and directory above
                    }
                    if (fnmatch($value . "_resized.gif", $file) || fnmatch($value . "_resized.jpg", $file) || fnmatch($value . "_resized.png", $file)) {
                        echo "&nbsp;+&nbsp;";
                        echo LangDrawing;
                    }
                }
                echo "</a></td></tr>";
            }
            echo "</table>";
            $objUtil->addPager("cometobservations", sizeof($obs));
            echo "<hr />";
            $_SESSION['observation_query'] = $obs;
            echo "<a class=\"btn btn-success\" href=\"" . $baseURL . "cometobservations.pdf.php\" rel=\"external\"><span class=\"glyphicon glyphicon-download\"></span> " . LangExecuteQueryObjectsMessage4a . "</a>";
        }
        echo "<br /><br />";
        echo "</div>";
    }
}
コード例 #2
0
ファイル: util.php プロジェクト: Hermannhaf/DeepskyLog
 public function pdfCometObservations($result)
 {
     include_once "cometobjects.php";
     include_once "observers.php";
     include_once "instruments.php";
     include_once "locations.php";
     include_once "cometobservations.php";
     include_once "icqmethod.php";
     include_once "icqreferencekey.php";
     include_once "setup/vars.php";
     include_once "setup/databaseInfo.php";
     global $instDir, $objCometObject, $loggedUser, $dateformat;
     $result = $this->sortResult($result);
     $objects = new CometObjects();
     $observer = new Observers();
     $instrument = new Instruments();
     $observation = new CometObservations();
     $location = new Locations();
     $util = $this;
     $ICQMETHODS = new ICQMETHOD();
     $ICQREFERENCEKEYS = new ICQREFERENCEKEY();
     $_GET['pdfTitle'] = "CometObservations.pdf";
     // Create pdf file
     $pdf = new Cezpdf('a4', 'portrait');
     $pdf->ezStartPageNumbers(300, 30, 10);
     $fontdir = $instDir . 'lib/fonts/Helvetica.afm';
     $pdf->selectFont($fontdir);
     $pdf->ezText(utf8_decode(html_entity_decode(LangPDFTitle3)) . "\n");
     while (list($key, $value) = each($result)) {
         $objectname = $objCometObject->getName($observation->getObjectId($value));
         $pdf->ezText(utf8_decode($objectname), "14");
         $observerid = $observation->getObserverId($value);
         if ($observer->getObserverProperty($loggedUser, 'UT')) {
             $date = sscanf($observation->getDate($value), "%4d%2d%2d");
             $time = $observation->getTime($value);
         } else {
             $date = sscanf($observation->getLocalDate($value), "%4d%2d%2d");
             $time = $observation->getLocalTime($value);
         }
         $hour = (int) ($time / 100);
         $minute = $time - $hour * 100;
         $formattedDate = date($dateformat, mktime(0, 0, 0, $date[1], $date[2], $date[0]));
         if ($minute < 10) {
             $minute = "0" . $minute;
         }
         $observername = LangPDFMessage13 . $observer->getObserverProperty($observerid, 'firstname') . " " . $observer->getObserverProperty($observerid, 'name') . html_entity_decode(LangPDFMessage14) . $formattedDate . " (" . $hour . ":" . $minute . ")";
         $pdf->ezText(utf8_decode($observername), "12");
         // Location and instrument
         if ($observation->getLocationId($value) != 0 && $observation->getLocationId($value) != 1 || $observation->getInstrumentId($value) != 0) {
             if ($observation->getLocationId($value) != 0 && $observation->getLocationId($value) != 1) {
                 $locationname = LangPDFMessage10 . " : " . $location->getLocationPropertyFromId($observation->getLocationId($value), 'name');
                 $extra = ", ";
             } else {
                 $locationname = "";
             }
             if ($observation->getInstrumentId($value) != 0) {
                 $instr = $instrument->getInstrumentPropertyFromId($observation->getInstrumentId($value), 'name');
                 if ($instr == "Naked eye") {
                     $instr = InstrumentsNakedEye;
                 }
                 $locationname = $locationname . $extra . html_entity_decode(LangPDFMessage11) . " : " . $instr;
                 if (strcmp($observation->getMagnification($value), "") != 0) {
                     $locationname = $locationname . " (" . $observation->getMagnification($value) . " x)";
                 }
             }
             $pdf->ezText(utf8_decode($locationname), "12");
         }
         // Methode
         $method = $observation->getMethode($value);
         if (strcmp($method, "") != 0) {
             $methodstr = html_entity_decode(LangViewObservationField15) . " : " . $method . " - " . $ICQMETHODS->getDescription($method);
             $pdf->ezText(utf8_decode($methodstr), "12");
         }
         // Used chart
         $chart = $observation->getChart($value);
         if (strcmp($chart, "") != 0) {
             $chartstr = html_entity_decode(LangViewObservationField17) . " : " . $chart . " - " . $ICQREFERENCEKEYS->getDescription($chart);
             $pdf->ezText(utf8_decode($chartstr), "12");
         }
         // Magnitude
         $magnitude = $observation->getMagnitude($value);
         if ($magnitude != -99.90000000000001) {
             $magstr = "";
             if ($observation->getMagnitudeWeakerThan($value)) {
                 $magstr = $magstr . LangNewComet3 . " ";
             }
             $magstr = $magstr . html_entity_decode(LangViewObservationField16) . " : " . sprintf("%.01f", $magnitude);
             if ($observation->getMagnitudeUncertain($value)) {
                 $magstr = $magstr . " (" . LangNewComet2 . ")";
             }
             $pdf->ezText(utf8_decode($magstr), "12");
         }
         // Degree of condensation
         $dc = $observation->getDc($value);
         $coma = $observation->getComa($value);
         $dcstr = "";
         $extra = "";
         if (strcmp($dc, "") != 0 || $coma != -99) {
             if (strcmp($dc, "") != 0) {
                 $dcstr = $dcstr . html_entity_decode(LangNewComet8) . " : " . $dc;
                 $extra = ", ";
             }
             // Coma
             if ($coma != -99) {
                 $dcstr = $dcstr . $extra . html_entity_decode(LangNewComet9) . " : " . $coma . "'";
             }
             $pdf->ezText(utf8_decode($dcstr), "12");
         }
         // Tail
         $tail = $observation->getTail($value);
         $pa = $observation->getPa($value);
         $tailstr = "";
         $extra = "";
         if ($tail != -99 || $pa != -99) {
             if ($tail != -99) {
                 $tailstr = $tailstr . html_entity_decode(LangNewComet10) . " : " . $tail . "'";
                 $extra = ", ";
             }
             if ($pa != -99) {
                 $tailstr = $tailstr . $extra . html_entity_decode(LangNewComet11) . " : " . $pa . "";
             }
             $pdf->ezText(utf8_decode($tailstr), "12");
         }
         // Description
         $description = $observation->getDescription($value);
         if (strcmp($description, "") != 0) {
             $descstr = html_entity_decode(LangPDFMessage15) . " : " . strip_tags($description);
             $pdf->ezText(utf8_decode($descstr), "12");
         }
         $upload_dir = $instDir . 'comets/' . 'cometdrawings';
         $dir = opendir($upload_dir);
         while (FALSE !== ($file = readdir($dir))) {
             if ("." == $file or ".." == $file) {
                 continue;
                 // skip current directory and directory above
             }
             if (fnmatch($value . ".gif", $file) || fnmatch($value . ".jpg", $file) || fnmatch($value . ".png", $file)) {
                 $pdf->ezImage($upload_dir . "/" . $value . ".jpg", 0, 500, "none", "left");
             }
         }
         $pdf->ezText("");
     }
     $pdf->ezStream();
 }
コード例 #3
0
function selected_observations()
{
    global $instDir, $baseURL, $loggedUser, $step, $dateformat, $objPresentations, $objUtil;
    $observations = new CometObservations();
    $instruments = new Instruments();
    $observers = new Observers();
    $objects = new CometObjects();
    $util = $objUtil;
    // TITLE
    echo "<div id=\"main\">";
    $mindate = '';
    $maxdate = '';
    if ($_GET['observer'] || $_GET['instrument'] || $_GET['site'] || $_GET['minyear'] || $_GET['maxyear'] || $_GET['mindiameter'] && $_GET['mindiameterunits'] || $_GET['maxdiameter'] && $_GET['maxdiameterunits'] || $_GET['minmag'] || $_GET['maxmag'] || $_GET['description'] || $_GET['mindc'] || $_GET['maxdc'] || $_GET['mincoma'] || $_GET['maxcoma'] || $_GET['mintail'] || $_GET['maxtail'] || $_GET['object']) {
        if ($_GET['minyear'] && $_GET['minmonth'] && $_GET['minday']) {
            $mindate = $_GET['minyear'] . sprintf("%02d", $_GET['minmonth']) . sprintf("%02d", $_GET['minday']);
        } elseif ($_GET['minyear'] && $_GET['minmonth']) {
            $mindate = $_GET['minyear'] . sprintf("%02d", $_GET['minmonth']) . "00";
        } elseif ($_GET['minyear']) {
            $mindate = $_GET['minyear'] . "0000";
        }
        if ($_GET['maxyear'] && $_GET['maxmonth'] && $_GET['maxday']) {
            $maxdate = $_GET['maxyear'] . sprintf("%02d", $_GET['maxmonth']) . sprintf("%02d", $_GET['maxday']);
        } elseif ($_GET['maxyear'] && $_GET['maxmonth']) {
            $maxdate = $_GET['maxyear'] . sprintf("%02d", $_GET['maxmonth']) . "31";
        } elseif ($_GET['maxyear']) {
            $maxdate = $_GET['maxyear'] . "1231";
        }
        if ($_GET['mindiameter'] && $_GET['mindiameterunits'] == "inch") {
            $mindiam = $_GET['mindiameter'] * 25.4;
        } else {
            $mindiam = $_GET['mindiameter'];
        }
        if ($_GET['maxdiameter'] && $_GET['maxdiameterunits'] == "inch") {
            $maxdiam = $_GET['maxdiameter'] * 25.4;
        } else {
            $maxdiam = $_GET['maxdiameter'];
        }
        $maxmag = $_GET['maxmag'];
        $minmag = $_GET['minmag'];
        $description = $_GET['description'];
        $object = $_GET['object'];
        $mintail = $_GET['mintail'];
        $maxtail = $_GET['maxtail'];
        $mincoma = $_GET['mincoma'];
        $maxcoma = $_GET['maxcoma'];
        $mindc = $_GET['mindc'];
        $maxdc = $_GET['maxdc'];
        $observer = $_GET['observer'];
        if (array_key_exists('instrument', $_GET) && $_GET['instrument'] != "") {
            $instrument = $_GET['instrument'];
            $name = $instruments->getInstrumentPropertyFromId($instrument, 'name');
            $instrument = $instruments->getId($name, $loggedUser);
        } else {
            $instrument = '';
        }
        if (array_key_exists('site', $_GET) && $_GET['site'] != "") {
            $site = $_GET['site'];
            $name = $objLocation->getLocationPropertyFromId($site, 'name');
            $site = $objLocation->getLocationId($name, $loggedUser);
        } else {
            $site = '';
        }
        // QUERY
        $query = array("object" => $object, "observer" => $observer, "instrument" => $instrument, "location" => $site, "mindate" => $mindate, "maxdate" => $maxdate, "maxdiameter" => $maxdiam, "mindiameter" => $mindiam, "maxmag" => $maxmag, "minmag" => $minmag, "description" => $description, "mintail" => $mintail, "maxtail" => $maxtail, "mincoma" => $mincoma, "maxcoma" => $maxcoma, "mindc" => $mindc, "maxdc" => $maxdc);
        if (!$observers->getObserverProperty($loggedUser, 'UT')) {
            if ($mindate != "") {
                $mindate = $mindate - 1;
            }
            if ($maxdate != "") {
                $maxdate = $maxdate + 1;
            }
        }
        $sort = "date";
        if (isset($catalogsearch)) {
            if ($catalogsearch == "yes") {
                $obs = $observations->getObservationFromQuery($query, $sort, 0);
                // LIKE
            } else {
                $obs = $observations->getObservationFromQuery($query, $sort);
                // EXACT MATCH
            }
        } else {
            $obs = $observations->getObservationFromQuery($query, $sort);
            // EXACT MATCH
        }
        // Dates can changes when we use local time!
        if (!$observers->getObserverProperty($loggedUser, 'UT')) {
            if ($mindate != "" || $maxdate != "") {
                if ($mindate != "") {
                    $mindate = $mindate + 1;
                }
                if ($maxdate != "") {
                    $maxdate = $maxdate - 1;
                }
                $newkey = 0;
                $new_obs = array();
                while (list($key, $value) = each($obs)) {
                    $newdate = $observations->getLocalDate($value);
                    if ($mindate != "" && $maxdate != "") {
                        if ($newdate >= $mindate && $newdate <= $maxdate) {
                            $new_obs[$newkey] = $value;
                            $newkey++;
                        }
                    } else {
                        if ($maxdate != "") {
                            if ($newdate <= $maxdate) {
                                $new_obs[$newkey] = $value;
                                $newkey++;
                            }
                        } else {
                            if ($mindate != "") {
                                if ($newdate >= $mindate) {
                                    $new_obs[$newkey] = $value;
                                    $newkey++;
                                }
                            }
                        }
                    }
                }
                $obs = $new_obs;
            }
        }
        if (sizeof($obs) > 0) {
            $link = $baseURL . "index.php?indexAction=comets_result_selected_observations" . "&amp;object=" . urlencode($_GET['object']) . "&amp;instrument=" . urlencode($_GET['instrument']) . "&amp;observer=" . urlencode($_GET['observer']) . "&amp;site=" . urlencode($_GET['site']) . "&amp;minyear=" . $_GET['minyear'] . "&amp;minmonth=" . $_GET['minmonth'] . "&amp;minday=" . $_GET['minday'] . "&amp;maxyear=" . $_GET['maxyear'] . "&amp;maxmonth=" . $_GET['maxmonth'] . "&amp;maxday=" . $_GET['maxday'] . "&amp;maxdiameter=" . $_GET['maxdiameter'] . "&amp;maxdiameterunits=" . urlencode($_GET['maxdiameterunits']) . "&amp;mindiameter=" . $_GET['mindiameter'] . "&amp;mindiameterunits=" . urlencode($_GET['mindiameterunits']) . "&amp;maxmag=" . $_GET['maxmag'] . "&amp;minmag=" . $_GET['minmag'] . "&amp;description=" . $_GET['description'] . "&amp;mindc=" . $_GET['mindc'] . "&amp;maxdc=" . $_GET['maxdc'] . "&amp;mincoma=" . $_GET['mincoma'] . "&amp;maxcoma=" . $_GET['maxcoma'] . "&amp;mintail=" . $_GET['mintail'] . "&amp;maxtail=" . $_GET['maxtail'];
            echo "<h4>" . LangSelectedObservationsTitle2 . "</h4>";
            echo "<hr />";
            echo "<table class=\"table sort-tablecometobservations table-condensed table-striped table-hover tablesorter custom-popup\">";
            echo "<thead><tr>";
            // OBJECT NAME
            echo "<th>" . LangOverviewObservationsHeader1 . "</th>";
            // OBSERVER
            echo "<th>" . LangOverviewObservationsHeader2 . "</th>";
            // DATE
            echo "<th>" . LangOverviewObservationsHeader4 . "</th>";
            // MAGNITUDE
            echo "<th>" . LangNewComet1 . "</th>";
            // INSTRUMENT
            echo "<th>" . LangViewObservationField3 . "</th>";
            // COMA
            echo "<th>" . LangViewObservationField19 . "</th>";
            // DC
            echo "<th>" . LangViewObservationField18b . "</th>";
            // TAIL
            echo "<th>" . LangViewObservationField20b . "</td>";
            echo "<th class=\"filter-false columnSelector-disable\" data-sorter=\"false\"></th></tr></thead>";
            $count = 0;
            while (list($key, $value) = each($obs)) {
                // OBJECT
                $object = $observations->getObjectId($value);
                // OBSERVER
                $observer = $observations->getObserverId($value);
                // INSTRUMENT
                $temp = $observations->getInstrumentId($value);
                $instrument = $instruments->getInstrumentPropertyFromId($temp, 'name');
                $instrumentsize = $instruments->getInstrumentPropertyFromId($temp, 'diameter');
                if ($instrument == "Naked eye") {
                    $instrument = InstrumentsNakedEye;
                }
                // MAGNITUDE
                $mag = $observations->getMagnitude($value);
                if ($mag < -90) {
                    $mag = '';
                } else {
                    $mag = sprintf("%2.01f", $mag);
                }
                // COMA
                $coma = $observations->getComa($value);
                if ($coma < -90) {
                    $coma = '';
                } else {
                    $coma = $coma . "'";
                }
                // DC
                $dc = $observations->getDc($value);
                if ($dc < -90) {
                    $dc = '';
                }
                // TAIL
                $tail = $observations->getTail($value);
                if ($tail > -90) {
                    $tail = $tail . "'";
                } else {
                    $tail = '';
                }
                // OUTPUT
                echo "<tr>\n\t            <td><a href=\"" . $baseURL . "index.php?indexAction=comets_detail_object&amp;object=" . urlencode($object) . "\">" . $objects->getName($object) . "</a></td>\n\t            <td><a href=\"" . $baseURL . "index.php?indexAction=detail_observer&amp;user="******"\">" . $observers->getObserverProperty($observer, 'firstname') . "&nbsp;" . $observers->getObserverProperty($observer, 'name') . "</a></td>\n\t            <td>";
                if ($instrument != InstrumentsNakedEye && $instrument != "") {
                    $instrument = $instrument . " (" . $instrumentsize . "&nbsp;mm" . ")";
                }
                if (!$observers->getObserverProperty($loggedUser, 'UT')) {
                    $date = sscanf($observations->getLocalDate($value), "%4d%2d%2d");
                } else {
                    $date = sscanf($observations->getDate($value), "%4d%2d%2d");
                }
                echo date($dateformat, mktime(0, 0, 0, $date[1], $date[2], $date[0]));
                // TIME
                if (!$observers->getObserverProperty($loggedUser, 'UT')) {
                    $time = sscanf(sprintf("%04d", $observations->getLocalTime($value)), "%2d%2d");
                } else {
                    $time = sscanf(sprintf("%04d", $observations->getTime($value)), "%2d%2d");
                }
                echo "&nbsp;(";
                printf("%02d", $time[0]);
                echo ":";
                printf("%02d", $time[1]);
                $time = sscanf(sprintf("%04d", $observations->getTime($value)), "%2d%2d");
                echo ")";
                echo "</td>\n\t            <td>{$mag}</td>\n\t            <td>{$instrument}</td>\n\t            <td>{$coma}</td>\n\t            <td>{$dc}</td>\n\t            <td>{$tail}</td>\n\t            <td><a href=\"" . $baseURL . "index.php?indexAction=comets_detail_observation&amp;observation=" . $value . "\">details";
                // LINK TO DRAWING (IF AVAILABLE)
                $upload_dir = 'cometdrawings';
                $dir = opendir($instDir . "comets/" . $upload_dir);
                while (FALSE !== ($file = readdir($dir))) {
                    if ("." == $file or ".." == $file) {
                        continue;
                        // skip current directory and directory above
                    }
                    if (fnmatch($value . "_resized.gif", $file) || fnmatch($value . "_resized.jpg", $file) || fnmatch($value . "_resized.png", $file)) {
                        echo "&nbsp;+&nbsp;";
                        echo LangDrawing;
                    }
                }
                echo "</a></td></tr>";
                $count++;
            }
            echo "</table>";
            $objUtil->addPager("cometobservations", $count);
            echo "<hr />";
            $_SESSION['observation_query'] = $obs;
            echo "<p><a class=\"btn btn-primary\" href=\"" . $baseURL . "cometobservations.pdf.php\" rel=\"external\"><span class=\"glyphicon glyphicon-download\"></span> " . LangExecuteQueryObjectsMessage4a . "</a>";
            echo "  <a class=\"btn btn-primary\" href=\"" . $baseURL . "cometobservations.icq\" rel=\"external\"><span class=\"glyphicon glyphicon-download\"></span> " . LangExecuteQueryObjectsMessage7 . "</a></p>";
        } else {
            echo "<p>" . LangObservationNoResults . "</p>";
        }
        echo "<p><a class=\"btn btn-success\" href=\"" . $baseURL . "index.php?indexAction=comets_query_observations\">" . LangObservationQueryError2 . "</a></p>";
    } else {
        echo "<p>" . LangObservationQueryError1 . "</p>";
        echo "<p><a class=\"btn btn-success\" href=\"" . $baseURL . "index.php?indexAction=comets_query_observations\">" . LangObservationQueryError2 . "</a>";
        echo " " . LangObservationOR . " ";
        echo "<a class=\"btn btn-success\" href=\"" . $baseURL . "index.php?indexAction=comets_all_observations\">" . LangObservationQueryError3 . "</a></p>";
    }
    echo "</div>";
}