function show_media_rows() { global $dbh; $query = "SELECT * FROM `directus_media` WHERE `active` = '1' "; if ($_GET['range'] && $_GET['range'] != 'all') { if ($_GET['range'] == 'week') { $query .= "AND `uploaded` >= DATE_SUB(NOW(), INTERVAL 7 DAY) "; } elseif ($_GET['range'] == 'month') { $query .= "AND `uploaded` >= DATE_SUB(NOW(), INTERVAL 1 MONTH) "; } elseif ($_GET['range'] == 'year') { $query .= "AND `uploaded` >= DATE_SUB(NOW(), INTERVAL 1 YEAR) "; } } $sql_order = $_GET['order'] == 'desc' ? 'ASC' : 'DESC'; if ($_GET['sort'] == 'title' || $_GET['sort'] == 'extension' || $_GET['sort'] == 'file_size' || $_GET['sort'] == 'caption' || $_GET['sort'] == 'user') { $sql_sort = $_GET['sort']; } else { $sql_sort = 'uploaded'; } $query .= "ORDER BY `{$sql_sort}` {$sql_order} "; foreach ($dbh->query($query) as $media) { echo generate_media_item($media['id'], $media['title'], $media['extension'], $media['source'], $media['height'], $media['width'], $media['file_size'], $media['uploaded'], $media['user'], strip_tags($media['caption']), false, $media['tags']); } // Empty row echo '<tr class="item no_rows"><td colspan="8" raw="NULL">No media</td></tr>'; }
<th width="10%" class="field_type"><div class="wrap">Type<span class="ui-icon"></span></div></th> <th width="10%" class="field_size"><div class="wrap">Size<span class="ui-icon"></span></div></th> <th class="field_caption"><div class="wrap">Caption<span class="ui-icon"></span></div></th> <th width="10%" class="field_user"><div class="wrap">User<span class="ui-icon"></span></div></th> <th width="10%" class="field_date"><div class="wrap">Uploaded<span class="ui-icon"></span></div></th> </tr> </thead> <tbody> <?php // Loop through and show all media that is not a thumbnail $sth = $dbh->prepare("SELECT * FROM `directus_media` WHERE `active` = '1' {$extension_sql} ORDER BY `uploaded` DESC LIMIT 1000"); $sth->bindParam(':extension', $_GET['extensions']); $sth->execute(); while ($media = $sth->fetch()) { echo generate_media_item($media['id'], $media['title'], $media['extension'], $media['source'], $media['height'], $media['width'], $media['file_size'], $media['uploaded'], $media['user'], strip_tags($media['caption']), $search = false, $tags = '', true); } ?> </tbody> </table> </div> <?php } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ?> </div> <div class="modal_window_actions"> <div class="pad_full_small">
foreach ($files_added as $media) { ?> <img src="<?php echo $temp_path . '/' . $media['source']; ?> " alt="<?php echo str_replace('"', "'", $media['title']); ?> " width="<?php echo $media['width']; ?> " height="<?php echo $media['height']; ?> " /><?php } } elseif ($_POST['type'] == 'relational') { echo '<table>'; foreach ($files_added as $media) { generate_media_relational($media['id'], $media['title'], $_POST['parent_item'], $media['extension'], $media['source'], $media['height'], $media['width'], $media['file_size']); } echo '</table>'; } else { echo generate_media_item($file_info['id'], $file_info['title'], $file_info['extension'], $file_info['source'], $file_info['height'], $file_info['width'], $file_info['file_size'], CMS_TIME, CMS_USER_ID, $file_info['caption'], $search = false); } ////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// ?> </div> </body> </html>