Esempio n. 1
0
 public function rssObservations()
 {
     global $objObservation, $objInstrument, $objLocation, $objPresentations, $objObserver, $baseURL, $objUtil;
     $dom = new DomDocument('1.0', 'US-ASCII');
     // add root fcga -> The header
     $rssInfo = $dom->createElement('rss');
     $rssDom = $dom->appendChild($rssInfo);
     $attr = $dom->createAttribute("version");
     $rssInfo->appendChild($attr);
     $attrText = $dom->createTextNode("2.0");
     $attr->appendChild($attrText);
     $attr = $dom->createAttribute("xmlns:content");
     $rssInfo->appendChild($attr);
     $attrText = $dom->createTextNode("http://purl.org/rss/1.0/modules/content/");
     $attr->appendChild($attrText);
     $attr = $dom->createAttribute("xmlns:dc");
     $rssInfo->appendChild($attr);
     $attrText = $dom->createTextNode("http://purl.org/dc/elements/1.1/");
     $attr->appendChild($attrText);
     $attr = $dom->createAttribute("xmlns:atom");
     $rssInfo->appendChild($attr);
     $attrText = $dom->createTextNode("http://www.w3.org/2005/Atom");
     $attr->appendChild($attrText);
     // add root - <channel>
     $channelDom = $rssDom->appendChild($dom->createElement('channel'));
     // add root - <channel> - <title>
     $titleDom = $channelDom->appendChild($dom->createElement('title'));
     $titleDom->appendChild($dom->createTextNode("DeepskyLog"));
     // add root - <channel> - <description>
     $descDom = $channelDom->appendChild($dom->createElement('description'));
     $descDom->appendChild($dom->createTextNode("DeepskyLog - visual deepsky and comets observations"));
     // add root - <channel> - <atom>
     $atomDom = $channelDom->appendChild($dom->createElement('atom:link'));
     $attr = $dom->createAttribute("href");
     $atomDom->appendChild($attr);
     $attrText = $dom->createTextNode($baseURL . "observations.rss");
     $attr->appendChild($attrText);
     $attr = $dom->createAttribute("rel");
     $atomDom->appendChild($attr);
     $attrText = $dom->createTextNode("self");
     $attr->appendChild($attrText);
     $attr = $dom->createAttribute("type");
     $atomDom->appendChild($attr);
     $attrText = $dom->createTextNode("application/rss+xml");
     $attr->appendChild($attrText);
     // add root - <channel> - <link>
     $linkDom = $channelDom->appendChild($dom->createElement('link'));
     $linkDom->appendChild($dom->createTextNode("http://www.deepskylog.org/"));
     $theDate = date('r');
     // add root - <channel> - <link>
     $lbdDom = $channelDom->appendChild($dom->createElement('lastBuildDate'));
     $lbdDom->appendChild($dom->createTextNode($theDate));
     // Get the new deepsky observations of the last month
     $theDate = date('Ymd', strtotime('-1 month'));
     $_GET['minyear'] = substr($theDate, 0, 4);
     $_GET['minmonth'] = substr($theDate, 4, 2);
     $_GET['minday'] = substr($theDate, 6, 2);
     $query = array("catalog" => '%', "mindate" => $objUtil->checkGetDate('minyear', 'minmonth', 'minday'));
     $result = $objObservation->getObservationFromQuery($query, 'A');
     while (list($key, $value) = each($result)) {
         // add root - <channel> - <item>
         $itemDom = $channelDom->appendChild($dom->createElement('item'));
         $titleDom = $itemDom->appendChild($dom->createElement('title'));
         $titleDom->appendChild($dom->createTextNode($value['observername'] . " : " . $value['objectname'] . " with " . htmlspecialchars_decode($objInstrument->getInstrumentPropertyFromId($value['instrumentid'], 'name')) . " from " . $objLocation->getLocationPropertyFromId($objObservation->getDsObservationProperty($value['observationid'], 'locationid'), 'name')));
         $linkDom = $itemDom->appendChild($dom->createElement('link'));
         $linkDom->appendChild($dom->createCDATASection($baseURL . "index.php?indexAction=detail_observation&observation=" . $value['observationid'] . "&QobsKey=0&dalm=D"));
         $descDom = $itemDom->appendChild($dom->createElement('description'));
         $descDom->appendChild($dom->createCDATASection($objPresentations->br2nl(utf8_encode($value['observationdescription']))));
         $authorDom = $itemDom->appendChild($dom->createElement('dc:creator'));
         $authorDom->appendChild($dom->createCDATASection($value['observername']));
         $guidDom = $itemDom->appendChild($dom->createElement('guid'));
         $guidDom->appendChild($dom->createTextNode("deepsky" . $value['observationid']));
         $attr = $dom->createAttribute("isPermaLink");
         $guidDom->appendChild($attr);
         $attrText = $dom->createTextNode("false");
         $attr->appendChild($attrText);
         $pubDateDom = $itemDom->appendChild($dom->createElement('pubDate'));
         date_default_timezone_set('UTC');
         $time = -999;
         $obs = $objObservation->getAllInfoDsObservation($value['observationid']);
         $time = $obs['time'];
         if ($time >= "0") {
             $hour = (int) ($time / 100);
             $minute = $time - 100 * $hour;
         } else {
             $hour = 0;
             $minute = 0;
         }
         $date = $value['observationdate'];
         $year = substr($date, 0, 4);
         $month = substr($date, 4, 2);
         $day = substr($date, 6, 2);
         $pubDateDom->appendChild($dom->createTextNode(date("r", mktime($hour, $minute, 0, $month, $day, $year))));
     }
     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";
     global $instDir, $objCometObject;
     $objects = new CometObjects();
     $observer = new Observers();
     $instrument = new Instruments();
     $observation = new CometObservations();
     $location = new Locations();
     $util = $this;
     $ICQMETHODS = new ICQMETHOD();
     $ICQREFERENCEKEYS = new ICQREFERENCEKEY();
     $cometsResult = $observation->getObservationFromQuery($query);
     while (list($key, $value) = each($cometsResult)) {
         $objectname = $objCometObject->getName($observation->getObjectId($value));
         // add root - <channel> - <item>
         $itemDom = $channelDom->appendChild($dom->createElement('item'));
         $title = htmlspecialchars_decode($objectname);
         // Location and instrument
         if ($observation->getLocationId($value) != 0 && $observation->getLocationId($value) != 1) {
             $title = $title . " from " . htmlspecialchars_decode($location->getLocationPropertyFromId($observation->getLocationId($value), 'name'));
         }
         if ($observation->getInstrumentId($value) != 0) {
             $title = $title . " with " . htmlspecialchars_decode($instrument->getInstrumentPropertyFromId($observation->getInstrumentId($value), 'name'));
         }
         $titleDom = $itemDom->appendChild($dom->createElement('title'));
         $titleDom->appendChild($dom->createTextNode($title));
         $linkDom = $itemDom->appendChild($dom->createElement('link'));
         $linkDom->appendChild($dom->createCDATASection($baseURL . "index.php?indexAction=comets_detail_observation&observation=" . $value));
         // Description
         $description = $observation->getDescription($value);
         if (strcmp($description, "") != 0) {
             $descDom = $itemDom->appendChild($dom->createElement('description'));
             $descDom->appendChild($dom->createCDATASection($objPresentations->br2nl(utf8_encode($description))));
         } else {
             $descDom = $itemDom->appendChild($dom->createElement('description'));
             $descDom->appendChild($dom->createCDATASection(""));
         }
         $observerid = $observation->getObserverId($value);
         $observername = $observer->getObserverProperty($observerid, 'firstname') . " " . $observer->getObserverProperty($observerid, 'name');
         $authorDom = $itemDom->appendChild($dom->createElement('dc:creator'));
         $authorDom->appendChild($dom->createCDATASection($observername));
         $guidDom = $itemDom->appendChild($dom->createElement('guid'));
         $guidDom->appendChild($dom->createTextNode("comet" . $value));
         $attr = $dom->createAttribute("isPermaLink");
         $guidDom->appendChild($attr);
         $attrText = $dom->createTextNode("false");
         $attr->appendChild($attrText);
         $pubDateDom = $itemDom->appendChild($dom->createElement('pubDate'));
         date_default_timezone_set('UTC');
         $date = sscanf($observation->getLocalDate($value), "%4d%2d%2d");
         $time = $observation->getLocalTime($value);
         $hour = (int) ($time / 100);
         $minute = $time - $hour * 100;
         $pubDateDom->appendChild($dom->createTextNode(date("r", mktime($hour, $minute, 0, $date[1], $date[2], $date[0]))));
     }
     // generate xml
     $dom->formatOutput = true;
     // set the formatOutput attribute of
     // domDocument to true
     // save XML as string or file
     $test1 = $dom->saveXML();
     // put string in test1
     print $test1;
 }
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>";
    }
}
<?php

$inIndex = true;
require_once "../lib/setup/databaseInfo.php";
require_once "../lib/database.php";
require_once "../lib/observers.php";
require_once "../lib/cometobservations.php";
require_once "../lib/accomplishments.php";
require_once "../lib/messages.php";
date_default_timezone_set('UTC');
$objDatabase = new Database();
$objObserver = new Observers();
$objCometObservation = new CometObservations();
$objAccomplishments = new Accomplishments();
$objMessages = new Messages();
print "Database update add a hasDrawing field to cometobservations.<br />\n";
$sql = "ALTER TABLE cometobservations ADD COLUMN hasDrawing INT(1) NOT NULL DEFAULT 0";
$run = $objDatabase->execSQL($sql);
$upload_dir = '../comets/cometdrawings';
$dir = opendir($upload_dir);
while (FALSE !== ($file = readdir($dir))) {
    if (!("." == $file or ".." == $file or ".svn" == $file) && strpos($file, 'resized') == 0) {
        $objCometObservation->setHasDrawing(substr($file, 0, strpos($file, '.jpg')));
    }
}
print "Database update add an accomplishments table and fill it for all users.<br />\n";
$sql = "DROP TABLE IF EXISTS accomplishments";
$run = $objDatabase->execSQL($sql);
$sql = "CREATE TABLE accomplishments (\n             observer                                   VARCHAR(255)            NOT NULL DEFAULT '',\n             messierBronze                              INT(1)                  NOT NULL DEFAULT 0,\n             messierSilver                              INT(1)                  NOT NULL DEFAULT 0,\n             messierGold                                INT(1)                  NOT NULL DEFAULT 0,\n             messierDrawingsBronze                      INT(1)                  NOT NULL DEFAULT 0,\n             messierDrawingsSilver                      INT(1)                  NOT NULL DEFAULT 0,\n             messierDrawingsGold                        INT(1)                  NOT NULL DEFAULT 0,\n             caldwellBronze                             INT(1)                  NOT NULL DEFAULT 0,\n             caldwellSilver                             INT(1)                  NOT NULL DEFAULT 0,\n             caldwellGold                               INT(1)                  NOT NULL DEFAULT 0,\n             caldwellDrawingsBronze                     INT(1)                  NOT NULL DEFAULT 0,\n             caldwellDrawingsSilver                     INT(1)                  NOT NULL DEFAULT 0,\n             caldwelldrawingsGold                       INT(1)                  NOT NULL DEFAULT 0,\n             herschelBronze                             INT(1)                  NOT NULL DEFAULT 0,\n             herschelSilver                             INT(1)                  NOT NULL DEFAULT 0,\n             herschelGold                               INT(1)                  NOT NULL DEFAULT 0,\n             herschelDiamond                            INT(1)                  NOT NULL DEFAULT 0,\n             herschelPlatina                            INT(1)                  NOT NULL DEFAULT 0,\n             herschelDrawingsBronze                     INT(1)                  NOT NULL DEFAULT 0,\n             herschelDrawingsSilver                     INT(1)                  NOT NULL DEFAULT 0,\n             herschelDrawingsGold                       INT(1)                  NOT NULL DEFAULT 0,\n             herschelDrawingsDiamond                    INT(1)                  NOT NULL DEFAULT 0,\n             herschelDrawingsPlatina                    INT(1)                  NOT NULL DEFAULT 0,\n             herschelIIBronze                           INT(1)                  NOT NULL DEFAULT 0,\n             herschelIISilver                           INT(1)                  NOT NULL DEFAULT 0,\n             herschelIIGold                             INT(1)                  NOT NULL DEFAULT 0,\n             herschelIIDiamond                          INT(1)                  NOT NULL DEFAULT 0,\n             herschelIIPlatina                          INT(1)                  NOT NULL DEFAULT 0,\n             herschelIIDrawingsBronze                   INT(1)                  NOT NULL DEFAULT 0,\n             herschelIIDrawingsSilver                   INT(1)                  NOT NULL DEFAULT 0,\n             herschelIIDrawingsGold                     INT(1)                  NOT NULL DEFAULT 0,\n             herschelIIDrawingsDiamond                  INT(1)                  NOT NULL DEFAULT 0,\n             herschelIIDrawingsPlatina                  INT(1)                  NOT NULL DEFAULT 0,\n             drawingsNewbie                             INT(1)                  NOT NULL DEFAULT 0,\n             drawingsRookie                             INT(1)                  NOT NULL DEFAULT 0,\n             drawingsBeginner                           INT(1)                  NOT NULL DEFAULT 0,\n             drawingsTalented                           INT(1)                  NOT NULL DEFAULT 0,\n             drawingsSkilled                            INT(1)                  NOT NULL DEFAULT 0,\n             drawingsIntermediate                       INT(1)                  NOT NULL DEFAULT 0,\n             drawingsExperienced                        INT(1)                  NOT NULL DEFAULT 0,\n             drawingsAdvanced                           INT(1)                  NOT NULL DEFAULT 0,\n             drawingsSenior                             INT(1)                  NOT NULL DEFAULT 0,\n             drawingsExpert                             INT(1)                  NOT NULL DEFAULT 0,\n             cometObservationsNewbie                    INT(1)                  NOT NULL DEFAULT 0,\n             cometObservationsRookie                    INT(1)                  NOT NULL DEFAULT 0,\n             cometObservationsBeginner                  INT(1)                  NOT NULL DEFAULT 0,\n             cometObservationsTalented                  INT(1)                  NOT NULL DEFAULT 0,\n             cometObservationsSkilled                   INT(1)                  NOT NULL DEFAULT 0,\n             cometObservationsIntermediate              INT(1)                  NOT NULL DEFAULT 0,\n             cometObservationsExperienced               INT(1)                  NOT NULL DEFAULT 0,\n             cometObservationsAdvanced                  INT(1)                  NOT NULL DEFAULT 0,\n             cometObservationsSenior                    INT(1)                  NOT NULL DEFAULT 0,\n             cometObservationsExpert                    INT(1)                  NOT NULL DEFAULT 0,\n             cometsObservedNewbie                       INT(1)                  NOT NULL DEFAULT 0,\n             cometsObservedRookie                       INT(1)                  NOT NULL DEFAULT 0,\n             cometsObservedBeginner                     INT(1)                  NOT NULL DEFAULT 0,\n             cometsObservedTalented                     INT(1)                  NOT NULL DEFAULT 0,\n             cometsObservedSkilled                      INT(1)                  NOT NULL DEFAULT 0,\n             cometsObservedIntermediate                 INT(1)                  NOT NULL DEFAULT 0,\n             cometsObservedExperienced                  INT(1)                  NOT NULL DEFAULT 0,\n             cometsObservedAdvanced                     INT(1)                  NOT NULL DEFAULT 0,\n             cometsObservedSenior                       INT(1)                  NOT NULL DEFAULT 0,\n             cometsObservedExpert                       INT(1)                  NOT NULL DEFAULT 0,\n             cometDrawingsNewbie                        INT(1)                  NOT NULL DEFAULT 0,\n             cometDrawingsRookie                        INT(1)                  NOT NULL DEFAULT 0,\n             cometDrawingsBeginner                      INT(1)                  NOT NULL DEFAULT 0,\n             cometDrawingsTalented                      INT(1)                  NOT NULL DEFAULT 0,\n             cometDrawingsSkilled                       INT(1)                  NOT NULL DEFAULT 0,\n             cometDrawingsIntermediate                  INT(1)                  NOT NULL DEFAULT 0,\n             cometDrawingsExperienced                   INT(1)                  NOT NULL DEFAULT 0,\n             cometDrawingsAdvanced                      INT(1)                  NOT NULL DEFAULT 0,\n             cometDrawingsSenior                        INT(1)                  NOT NULL DEFAULT 0,\n             cometDrawingsExpert                        INT(1)                  NOT NULL DEFAULT 0,\n             openClusterNewbie                          INT(1)                  NOT NULL DEFAULT 0,\n             openClusterRookie                          INT(1)                  NOT NULL DEFAULT 0,\n             openClusterBeginner                        INT(1)                  NOT NULL DEFAULT 0,\n             openClusterTalented                        INT(1)                  NOT NULL DEFAULT 0,\n             openClusterSkilled                         INT(1)                  NOT NULL DEFAULT 0,\n             openClusterIntermediate                    INT(1)                  NOT NULL DEFAULT 0,\n             openClusterExperienced                     INT(1)                  NOT NULL DEFAULT 0,\n             openClusterAdvanced                        INT(1)                  NOT NULL DEFAULT 0,\n             openClusterSenior                          INT(1)                  NOT NULL DEFAULT 0,\n             openClusterExpert                          INT(1)                  NOT NULL DEFAULT 0,\n             openClusterDrawingsNewbie                  INT(1)                  NOT NULL DEFAULT 0,\n             openClusterDrawingsRookie                  INT(1)                  NOT NULL DEFAULT 0,\n             openClusterDrawingsBeginner                INT(1)                  NOT NULL DEFAULT 0,\n             openClusterDrawingsTalented                INT(1)                  NOT NULL DEFAULT 0,\n             openClusterDrawingsSkilled                 INT(1)                  NOT NULL DEFAULT 0,\n             openClusterDrawingsIntermediate            INT(1)                  NOT NULL DEFAULT 0,\n             openClusterDrawingsExperienced             INT(1)                  NOT NULL DEFAULT 0,\n             openClusterDrawingsAdvanced                INT(1)                  NOT NULL DEFAULT 0,\n             openClusterDrawingsSenior                  INT(1)                  NOT NULL DEFAULT 0,\n             openClusterDrawingsExpert                  INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterNewbie                      INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterRookie                      INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterBeginner                    INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterTalented                    INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterSkilled                     INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterIntermediate                INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterExperienced                 INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterAdvanced                    INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterSenior                      INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterExpert                      INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterDrawingsNewbie              INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterDrawingsRookie              INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterDrawingsBeginner            INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterDrawingsTalented            INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterDrawingsSkilled             INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterDrawingsIntermediate        INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterDrawingsExperienced         INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterDrawingsAdvanced            INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterDrawingsSenior              INT(1)                  NOT NULL DEFAULT 0,\n             globularClusterDrawingsExpert              INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaNewbie                      INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaRookie                      INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaBeginner                    INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaTalented                    INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaSkilled                     INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaIntermediate                INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaExperienced                 INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaAdvanced                    INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaSenior                      INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaExpert                      INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaDrawingsNewbie              INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaDrawingsRookie              INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaDrawingsBeginner            INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaDrawingsTalented            INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaDrawingsSkilled             INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaDrawingsIntermediate        INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaDrawingsExperienced         INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaDrawingsAdvanced            INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaDrawingsSenior              INT(1)                  NOT NULL DEFAULT 0,\n             planetaryNebulaDrawingsExpert              INT(1)                  NOT NULL DEFAULT 0,\n             galaxyNewbie                               INT(1)                  NOT NULL DEFAULT 0,\n             galaxyRookie                               INT(1)                  NOT NULL DEFAULT 0,\n             galaxyBeginner                             INT(1)                  NOT NULL DEFAULT 0,\n             galaxyTalented                             INT(1)                  NOT NULL DEFAULT 0,\n             galaxySkilled                              INT(1)                  NOT NULL DEFAULT 0,\n             galaxyIntermediate                         INT(1)                  NOT NULL DEFAULT 0,\n             galaxyExperienced                          INT(1)                  NOT NULL DEFAULT 0,\n             galaxyAdvanced                             INT(1)                  NOT NULL DEFAULT 0,\n             galaxySenior                               INT(1)                  NOT NULL DEFAULT 0,\n             galaxyExpert                               INT(1)                  NOT NULL DEFAULT 0,\n             galaxyDrawingsNewbie                       INT(1)                  NOT NULL DEFAULT 0,\n             galaxyDrawingsRookie                       INT(1)                  NOT NULL DEFAULT 0,\n             galaxyDrawingsBeginner                     INT(1)                  NOT NULL DEFAULT 0,\n             galaxyDrawingsTalented                     INT(1)                  NOT NULL DEFAULT 0,\n             galaxyDrawingsSkilled                      INT(1)                  NOT NULL DEFAULT 0,\n             galaxyDrawingsIntermediate                 INT(1)                  NOT NULL DEFAULT 0,\n             galaxyDrawingsExperienced                  INT(1)                  NOT NULL DEFAULT 0,\n             galaxyDrawingsAdvanced                     INT(1)                  NOT NULL DEFAULT 0,\n             galaxyDrawingsSenior                       INT(1)                  NOT NULL DEFAULT 0,\n             galaxyDrawingsExpert                       INT(1)                  NOT NULL DEFAULT 0,\n             nebulaNewbie                               INT(1)                  NOT NULL DEFAULT 0,\n             nebulaRookie                               INT(1)                  NOT NULL DEFAULT 0,\n             nebulaBeginner                             INT(1)                  NOT NULL DEFAULT 0,\n             nebulaTalented                             INT(1)                  NOT NULL DEFAULT 0,\n             nebulaSkilled                              INT(1)                  NOT NULL DEFAULT 0,\n             nebulaIntermediate                         INT(1)                  NOT NULL DEFAULT 0,\n             nebulaExperienced                          INT(1)                  NOT NULL DEFAULT 0,\n             nebulaAdvanced                             INT(1)                  NOT NULL DEFAULT 0,\n             nebulaSenior                               INT(1)                  NOT NULL DEFAULT 0,\n             nebulaExpert                               INT(1)                  NOT NULL DEFAULT 0,\n             nebulaDrawingsNewbie                       INT(1)                  NOT NULL DEFAULT 0,\n             nebulaDrawingsRookie                       INT(1)                  NOT NULL DEFAULT 0,\n             nebulaDrawingsBeginner                     INT(1)                  NOT NULL DEFAULT 0,\n             nebulaDrawingsTalented                     INT(1)                  NOT NULL DEFAULT 0,\n             nebulaDrawingsSkilled                      INT(1)                  NOT NULL DEFAULT 0,\n             nebulaDrawingsIntermediate                 INT(1)                  NOT NULL DEFAULT 0,\n             nebulaDrawingsExperienced                  INT(1)                  NOT NULL DEFAULT 0,\n             nebulaDrawingsAdvanced                     INT(1)                  NOT NULL DEFAULT 0,\n             nebulaDrawingsSenior                       INT(1)                  NOT NULL DEFAULT 0,\n             nebulaDrawingsExpert                       INT(1)                  NOT NULL DEFAULT 0,\n             objectsNewbie                              INT(1)                  NOT NULL DEFAULT 0,\n             objectsRookie                              INT(1)                  NOT NULL DEFAULT 0,\n             objectsBeginner                            INT(1)                  NOT NULL DEFAULT 0,\n             objectsTalented                            INT(1)                  NOT NULL DEFAULT 0,\n             objectsSkilled                             INT(1)                  NOT NULL DEFAULT 0,\n             objectsIntermediate                        INT(1)                  NOT NULL DEFAULT 0,\n             objectsExperienced                         INT(1)                  NOT NULL DEFAULT 0,\n             objectsAdvanced                            INT(1)                  NOT NULL DEFAULT 0,\n             objectsSenior                              INT(1)                  NOT NULL DEFAULT 0,\n             objectsExpert                              INT(1)                  NOT NULL DEFAULT 0,\n             objectsDrawingsNewbie                      INT(1)                  NOT NULL DEFAULT 0,\n             objectsDrawingsRookie                      INT(1)                  NOT NULL DEFAULT 0,\n             objectsDrawingsBeginner                    INT(1)                  NOT NULL DEFAULT 0,\n             objectsDrawingsTalented                    INT(1)                  NOT NULL DEFAULT 0,\n             objectsDrawingsSkilled                     INT(1)                  NOT NULL DEFAULT 0,\n             objectsDrawingsIntermediate                INT(1)                  NOT NULL DEFAULT 0,\n             objectsDrawingsExperienced                 INT(1)                  NOT NULL DEFAULT 0,\n             objectsDrawingsAdvanced                    INT(1)                  NOT NULL DEFAULT 0,\n             objectsDrawingsSenior                      INT(1)                  NOT NULL DEFAULT 0,\n             objectsDrawingsExpert                      INT(1)                  NOT NULL DEFAULT 0,\n             PRIMARY KEY (observer)             \n             )";
$run = $objDatabase->execSQL($sql);
// We loop over all observers
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>";
}