Example #1
0
function _display_search($image_query, $search_text)
{
    global $__dbc;
    global $number_of_columns;
    global $image_src;
    global $rating;
    global $table_format;
    $images = __query($image_query, "", "");
    echo mysql_info($__dbc);
    _page_sechead("search.png", "Search Results For: " . $search_text . ".  " . mysql_num_rows($images) . " images found.");
    echo $table_format;
    while ($row = mysql_fetch_array($images)) {
        $image_thumb = $row['iPhotoLibraryID'] . $row["GUID"] . 'T.' . _find_file_extension($row["ThumbPath"]);
        $image_full = $row['iPhotoLibraryID'] . $row["GUID"] . "." . _find_file_extension($row["ImagePath"]);
        $image_slimbox_caption = "Keywords: ";
        $keyword_query = "SELECT exhibit_Keywords.Keyword AS Keyword FROM " . "exhibit_Keywords LEFT JOIN " . "exhibit_ImageKeywords ON (exhibit_Keywords.iPhotoLibraryID = " . "exhibit_ImageKeywords.iPhotoLibraryID AND exhibit_Keywords.KeywordID" . "=exhibit_ImageKeywords.KeywordID) WHERE " . "exhibit_ImageKeywords.iPhotoLibraryID=" . $row["iPhotoLibraryID"] . " AND exhibit_ImageKeywords.ImageID=" . $row["ImageID"];
        $image_keywords = __query($keyword_query, "", "");
        while ($keyword_row = mysql_fetch_array($image_keywords)) {
            $image_slimbox_caption .= $keyword_row["Keyword"] . ", ";
        }
        $image_slimbox_caption = rtrim($image_slimbox_caption, ", ") . "<br />";
        if ($row["Comment"] != "") {
            $image_slimbox_caption .= "Comments: " . $row["Comment"] . "<br />";
        }
        $image_slimbox_caption .= "Date: " . $row["OriginalDate"] . "<br />";
        $image_slimbox_caption .= $rating[$row["Rating"]] . "<br />";
        $image_slimbox_caption .= "&lt;a href=&quot;" . $image_src . $image_full . "&quot;&gt;";
        if ($row["MediaType"] == "Image") {
            $image_slimbox_caption .= "(See Full-sized Image)&lt;/a&gt;";
        } else {
            $image_slimbox_caption .= "(See Video)&lt;/a&gt;";
        }
        $process_results[] = array("<a href=\"" . $image_src . $image_thumb . "\" rel=\"lightbox[" . $roll_name[0] . "]\" title=\"" . $image_slimbox_caption . "\"><img border=\"0\" class=\"exhibit\" " . "src=\"" . $image_src . $image_thumb . "\" /></a>", "<span class=\"exhibitcontent\">" . $row["Comment"] . "</span>", "<span class=\"exhibitcontent\">" . $row["OriginalDate"] . "</span>", "<span class=\"exhibitcontent\">" . $rating[$row["Rating"]] . "</span>");
        if (count($process_results) == $number_of_columns) {
            _print_row($process_results);
            unset($process_results);
            $process_results = array();
        }
    }
    if (count($process_results) != 0) {
        _print_row($process_results);
    }
    echo "\n\t\t\t\t\t</table>\n";
}
function _display_permissions()
{
    global $__dbc;
    global $image_src;
    global $table_format;
    $roll_query = "SELECT exhibit_Rolls.*, exhibit_Permissions.GroupID AS GroupID, " . "exhibit_Permissions.Public AS Public FROM exhibit_Rolls LEFT JOIN " . "exhibit_Permissions ON " . "(exhibit_Rolls.iPhotoLibraryID=exhibit_Permissions.iPhotoLibraryID AND" . " exhibit_Rolls.RollID=exhibit_Permissions.RollID) " . "ORDER BY RollDate DESC";
    $roll_results = __query($roll_query, "", "");
    $group_query = "SELECT * FROM exhibit_Groups";
    $group_results = __query($group_query, "", "");
    $groups = array();
    while ($row = mysql_fetch_array($group_results)) {
        $groups[$row['ID']] = array('GroupName' => $row['GroupName'], 'GroupDescription' => $row['GroupDescription']);
    }
    echo $table_format . "<td>Cover </td><td>Roll Name</td><td>Roll Date</td>" . "<td># of Photos&nbsp;&nbsp;</td>" . "<td>Public?&nbsp;&nbsp;</td>" . "<td>Group&nbsp;&nbsp;</td><td>&nbsp;</td>";
    $table = array();
    while ($row = mysql_fetch_array($roll_results)) {
        $query = "select GUID, ThumbPath from exhibit_Images where " . "iPhotoLibraryID = " . $row['iPhotoLibraryID'] . " AND " . "ImageID = " . $row['KeyPhoto'];
        $image = mysql_fetch_array(__query($query, "", ""));
        $image_thumb = "<td width=\"40px\"><a href=\"http://www.example.com" . $_SERVER[PHP_SELF] . "?library=" . $row["iPhotoLibraryID"] . "&roll=" . $row['RollID'] . "\"><img border=\"0\" " . " class=\"exhibitpermissions\" " . "src=\"" . $image_src . $row['iPhotoLibraryID'] . $image['GUID'] . 'T.' . _find_file_extension($image['ThumbPath']) . "\" /></a></td>";
        $photo_count = "<td><span class=\"exhibitcontent\">" . $row["PhotoCount"];
        if ($row["PhotoCount"] == 1) {
            $photo_count .= " photo</span></td>";
        } else {
            $photo_count .= " photos</span></td>";
        }
        $roll_name = "<td><span class=\"exhibitcontent\">" . $row['RollName'] . "</span></td>";
        $roll_date = "<td><span class=\"exhibitcontent\">" . $row['RollDate'] . "</span></td>";
        $public = "<td><form action=\"" . $_SERVER[PHP_SELF] . "\" method=\"post\">" . "<input type=\"hidden\" name=\"library\" " . "value=\"" . $row['iPhotoLibraryID'] . "\">" . "<input type=\"hidden\" name=\"roll\" " . "value=\"" . $row['RollID'] . "\">" . "<select name=\"public\" size=\"1\">";
        if ($row['Public'] == 1) {
            $public .= "<option value=\"0\">False</option>" . "<option selected value=\"1\">True</option></select></td>";
        } else {
            $public .= "<option selected value=\"0\">False</option>" . "<option value=\"1\">True</option></select></td>";
        }
        $group_list = "<td><select name=\"group\" size=\"1\">";
        if (!array_key_exists($row['GroupID'], $groups)) {
            $group_list .= "<option selected value=\"0\">None.</option>";
        } else {
            $group_list .= "<option value=\"0\">None.</option>";
        }
        foreach ($groups as $key => $value) {
            if ($row['GroupID'] == $key) {
                $group_list .= "<option selected value=\"" . $key . "\">" . $value['GroupName'] . "</option>";
            } else {
                $group_list .= "<option value=\"" . $key . "\">" . $value['GroupName'] . "</option>";
            }
        }
        $group_list .= "</select></td>";
        $edit = "<td><input type=\"submit\" value=\" UPDATE \"></form></td>";
        $table[] = array($image_thumb, $roll_name, $roll_date, $photo_count, $public, $group_list, $edit);
    }
    _print_rows($table);
    echo "\n\t\t\t\t\t</table>\n";
}