示例#1
0
    $storage_slot = "";
    if ($media_item_array['storage_slot_id']) {
        $storage_slot = "storage_slot='{$media_item_array['storage_slot_id']}'";
    }
    $html .= "\n\t<label for='storage_location_input'>Storage Location</label><a id='edit_storage_location_button' data-role='button' style='float:right; z-index: 10;' href='edit_storage_location.php' data-iconpos='notext' data-icon='gear'>Edit</a>\n\t<select name='storage_location_input' id='storage_location_input' {$storage_slot}>\n\t<option>None</option>\n\t";
    $query = "select * from storage_locations order by storage_title";
    $query_result = mysql_query($query) or $_SESSION['firephp']->error(mysql_error());
    $storage_locations = mysql2array($query_result);
    foreach ($storage_locations as $storage_location_row) {
        $selected = "";
        if ($media_item_array['storage_location_id'] == $storage_location_row['storage_location_id']) {
            $selected = "selected='selected'";
        }
        $html .= "<option {$selected} value='{$storage_location_row['storage_location_id']}'>{$storage_location_row['storage_title']}</option>";
    }
    $html .= "</select>\n\t<div data-role='fieldcontain' id='storage_slot_input_div'>\n\t<label for='storage_slot_id_input'>Storage Slot</label>\n\t<select id='storage_slot_id_input' name='storage_slot_id_input'>\n\t</select>\n\t</div>\n\t\n\t<div data-role='fieldcontain'>\n\t\t<fieldset data-role='controlgroup' data-type='horizontal'>\n\t\t<legend>Genre(s)</legend>";
    $query = "select * from genres order by genres.genre_title";
    $query_result = mysql_query($query) or die(mysql_error());
    $genres = mysql2array($query_result);
    foreach ($genres as $genre_row) {
        $checked = "";
        if ($genre_array[$genre_row['genre_id']]) {
            $checked = "checked='checked'";
        }
        $html .= "<input {$checked} type='checkbox' name='media_item_genre_input[]' id='media_item_genre_{$genre_row['genre_id']}' value='{$genre_row['genre_id']}'></input>\n\t\t\t<label for='media_item_genre_{$genre_row['genre_id']}'>{$genre_row['genre_title']}</label>";
    }
    $html .= "\n\t\t</fieldset>\n\t</div>\n\t\n\t<label for='media_item_notes_input'>Notes</label>\n\t<textarea name='media_item_notes_input' id='media_item_notes_input'>{$media_item_array['notes']}</textarea>\n\t\n\t<div data-role='fieldcontain'>\n\t\t<a href='all_media.php' data-direction='reverse' data-role='button' data-inline='true'>Cancel</a>\n\t\t<input type='submit' data-role='button' data-inline='true' data-theme='b' name='Save' value='Save'></submit>\n\t</div>\n\t\n\t</form>";
}
//end if Save
$html .= "\n  \t</div>\n  </div>\n  </body>\n  </html>";
echo $html;
示例#2
0
        $grouping_field = 'title';
        break;
}
switch ($_GET['sort']) {
    case 'slot':
        $query .= "order by media_items.storage_label,media_items.title";
        break;
    case 'none':
        $query .= "";
        break;
    default:
        $query .= "order by media_items.title";
        break;
}
$results = mysql_query($query) or $_SESSION['firephp']->error(mysql_error());
$results_array = mysql2array($results);
//   $_SESSION['firephp']->log($results_array,'results_array');
//   $_SESSION['firephp']->log($query,'query');
if (count($results_array)) {
    $html .= "<ul data-filter='true' data-role='listview' data-theme='d'>";
    //  	$html .= "<li data-icon='plus'><a href='add_media_item.php'>Add New</a></li>";
    $current_letter = substr($results_array[0][$grouping_field], 0, 1);
    foreach ($results_array as $result_row) {
        if (strtoupper(substr($result_row[$grouping_field], 0, 1)) != $current_letter) {
            $current_letter = strtoupper(substr($result_row[$grouping_field], 0, 1));
            $html .= "<li data-role='list-divider'>{$current_letter}</li>";
        }
        $thumbnail = "";
        if ($result_row['image_location'] && !preg_match('@^http://.*@', $result_row['image_location']) && file_exists("images/media_items/{$result_row['image_location']}") && !file_exists("images/media_items/thumbs/{$result_row['image_location']}")) {
            //   				$_SESSION['firephp']->log("images/media_items/{$result_row['image_location']} exists");
            //   				$_SESSION['firephp']->log("images/media_items/thumbs/{$result_row['image_location']} does not");
示例#3
0
/**
 * 
 * returns html for viewing the specified media item
 * @param int $media_item_id
 */
function mediaItemHtml($media_item_id)
{
    $media_item_array = array();
    $html = "";
    if ($media_item_id) {
        $media_id = addslashes($media_item_id);
        //just in case of potential injections
        //perform main media item query
        $query = "select * from  media_items \r\n\t\tleft outer join storage_slots on media_items.storage_slot_id = storage_slots.storage_slot_id \r\n\t\tleft outer join storage_locations on storage_slots.storage_location_id = storage_locations.storage_location_id\r\n\t\tleft outer join media_types on media_types.media_type_id = media_items.media_type_id\r\n\t\tleft outer join mediums on mediums.medium_id = media_items.medium_id\r\n\t  \twhere media_items.id = '{$media_id}'\r\n\t  \t";
        $results = mysql_query($query) or $_SESSION['firephp']->error(mysql_error());
        $results_array = mysql2array($results);
        $media_item_array = $results_array[0];
        $html .= "\r\n  \r\n\r\n\r\n\t";
        $query = "select genres.genre_title from genres left join media_genre on media_genre.genre_id = genres.genre_id\r\n\t  \twhere media_genre.media_item_id = {$media_id}";
        $result = mysql_query($query) or die(mysql_error());
        $genre_array = mysql2array($result);
        $image = "";
        $medium_html = $media_item_array['medium_title'];
        if ($media_item_array['medium_image_location']) {
            if (preg_match('@^http://.*@', $media_item_array['medium_image_location'])) {
                $medium_html = "<image src='{$media_item_array['medium_image_location']}' />";
            } else {
                $medium_html = "<image src='images/mediums/{$media_item_array['medium_image_location']}' />";
            }
        }
        if ($media_item_array['image_location']) {
            if (preg_match('@^http://.*@', $media_item_array['image_location'])) {
                $image = "<image class='media_item_image' src='{$media_item_array['image_location']}' />";
            } else {
                $image = "<image class='media_item_image' src='images/media_items/{$media_item_array['image_location']}' />";
            }
        }
        $html .= "\r\n\t  \t\t\t<h3>{$media_item_array['title']}</h3>\r\n\t  \t\t\t<ul data-role='listview' data-theme='d'>";
        if ($media_item_array['storage_title']) {
            $html .= "<li>{$media_item_array['storage_title']} [{$media_item_array['storage_slot_label']}]</li>";
        }
        if ($media_item_array['rating'] > 0) {
            $html .= "<li><div>";
            for ($i = 0; $i < $media_item_array['rating']; $i++) {
                $html .= "<img src='images/star.png' />";
            }
            $html .= "</div></li>";
        }
        if ($image) {
            $html .= "\r\n\t  \t\t\t\t<li><div>{$image}</div></li>\t  \t\t\r\n\t  \t\t";
        }
        $html .= "\r\n\t\t\t  \t\t<li>{$medium_html}{$media_item_array['media_type_desc']}\r\n\t\t\t  \t\t\t";
        if ($media_item_array['length']) {
            $html .= "<br />{$media_item_array['length']}";
        }
        if ($media_item_array['barcode']) {
            $html .= "<br />Barcode: {$media_item_array['barcode']}";
        }
        if ($media_item_array['isbn']) {
            $html .= "<br />ISBN: {$media_item_array['isbn']}";
        }
        if (count($genre_array)) {
            $html .= "<br /><br />Tags: ";
            foreach ($genre_array as $genre_row) {
                $html .= "<span class='media_item_genre_title'>{$genre_row['genre_title']}</span> ";
            }
            //  			$html .= "</span>";
        }
        if ($media_item_array['notes']) {
            $html .= "<li><p>" . preg_replace('/\\n/', '<br />', $media_item_array['notes']) . "</p></li>";
        }
        $html .= "\r\n\t  \t\t\t</li>\r\n\t\t  \t</ul>\r\n\t  ";
    }
    return $html;
}
示例#4
0
<html> 
	<head>
	<title>MediaMix Database</title>';
include_once 'includes/header.php';
$html .= '
	</head>
	<body>	
';
$html .= "<div data-role='page' data-title='MediaMix Database'>\n  \t<div data-role='header' data-position='inline'>\n  \t\t<h2>MediaMix</h2>\n  \t\t<a href='add_media_item.php' data-icon='plus'>Add New</a>\n  \t</div>\n  \t<div data-role='content'>\n  \t<ul data-role='listview' data-theme='g'>\n  \t<!-- <li><form><input id='search_titles' type='search'></input></form></li> -->\n  \t<li><a href='all_media.php'>All Items</a></li>\n  \t<li>Genre\n  \t\t<ul data-role='listview'>\n  \t";
$query = "select * from genres where genres.genre_id in (select media_genre.genre_id from media_genre) order by genres.genre_title";
$query_result = mysql_query($query) or die(mysql_error());
$genres = mysql2array($query_result);
foreach ($genres as $genre_row) {
    $html .= "<li><a class='query_link' href='all_media.php?table=media_genre&value={$genre_row['genre_id']}'>{$genre_row['genre_title']}</a></li>";
}
$html .= "\n  \t\t</ul>\n  \t</li>\n  \t<li>Media Type\n  \t\t<ul>";
$query = "select * from media_types order by media_type_desc";
$query_result = mysql_query($query) or $_SESSION['firephp']->error(mysql_error());
$media_types = mysql2array($query_result);
foreach ($media_types as $media_type_row) {
    $html .= "<li><a class='query_link' href='all_media.php?table=media_items&field=media_type_id&value={$media_type_row['media_type_id']}'>{$media_type_row['media_type_desc']}</a></li>";
}
$html .= "\n  \t\t</ul>\n  \t</li>\n  \t<li>\n  \t\tStorage Location\n  \t\t<ul data-role='listview'>\n  \t";
$query = "select * from storage_locations order by storage_locations.storage_title";
$query_result = mysql_query($query) or die(mysql_error());
$locations = mysql2array($query_result);
foreach ($locations as $location) {
    $html .= "<li><a class='query_link' href='all_media.php?table=storage_slots&value={$location['storage_location_id']}&sort=slot'>{$location['storage_title']}</a></li>";
}
$html .= "\n    \t</ul>\n  \t</li>\n    <li>\n    \tReports\n    \t<ul data-role='listview'>\n    \t\t<li><a class='query_link' href='all_media.php?table=report&report=dup_location&sort=none'>Duplicate Storage Locations</a></li>\n    \t\t<li><a class='query_link' href='all_media.php?table=report&report=empty_location'>Empty Storage Locations</a></li>\n    \t\t<li><a class='query_link' href='all_media.php?table=report&report=missing_rating'>No Rating</a></li>\n    \t\t<li><a class='query_link' href='all_media.php?table=report&report=missing_thumb'>No Thumbnail</a></li>\n    \t\t<li><a class='query_link' href='all_media.php?table=report&report=odd_time'>Odd Time</a></li>\n    \t</ul>\t\n    </li>\n  \t</ul>\n  \t\n  \t</div>\n  </div>\n  </body>\n  </html>\n  ";
echo $html;