setPageTitle(WT_I18N::translate('Media objects'));
$search = safe_GET('search');
$sortby = safe_GET('sortby', 'file', 'title');
if (!WT_USER_CAN_EDIT && !WT_USER_CAN_ACCEPT) {
$sortby='title';
}
$max = safe_GET('max', array('10', '20', '30', '40', '50', '75', '100', '125', '150', '200'), '20');
$start = safe_GET('start', WT_REGEX_INTEGER);
$folder = safe_GET('folder');
$build = 'no';
$reset = safe_GET('reset');
$apply_filter = safe_GET('apply_filter');
$filter1 = safe_GET('filter1');
$or = WT_I18N::translate('or');
$and = WT_I18N::translate('and');
$columns = safe_GET('columns', array('1', '2'), '2');
$subdirs = safe_GET('subdirs');
$currentdironly = ($subdirs=='on') ? false : true;
// reset all variables
if ($reset == 'Reset') {
$sortby = 'title';
$max = '20';
$folder = '';
$columns = '2';
$currentdironly = true;
$filter1 = '';
}
// A list of all subfolders used by this tree
$folders = WT_Query_Media::folderList();
// A list of all media objects matching the search criteria
$medialist = WT_Query_Media::mediaList(
$folder,
$currentdironly ? 'exclude' : 'include',
$sortby,
$filter1
);
$controller->pageHeader();
?>
getPageTitle(); ?>
$ct) $count = $ct-$start;
} else {
$ct = '0';
}
echo '
', WT_I18N::translate('Media Objects found'), ' ', $ct, '
';
if ($ct>0) {
$currentPage = ((int) ($start / $max)) + 1;
$lastPage = (int) (($ct + $max - 1) / $max);
echo '
';
// echo page back, page number, page forward controls
echo '';
echo '';
echo '';
echo '| ';
if ($TEXT_DIRECTION=='ltr') {
if ($ct>$max) {
if ($currentPage > 1) {
echo '';
}
if ($start>0) {
$newstart = $start-$max;
if ($start<0) $start = 0;
echo '';
}
}
} else {
if ($ct>$max) {
if ($currentPage < $lastPage) {
$lastStart = ((int) ($ct / $max)) * $max;
echo '';
}
if ($start+$max < $ct) {
$newstart = $start+$count;
if ($start<0) $start = 0;
echo '';
}
}
}
echo ' | ';
echo '', WT_I18N::translate('Page %s of %s', $currentPage, $lastPage), ' | ';
echo '';
if ($TEXT_DIRECTION=='ltr') {
if ($ct>$max) {
if ($start+$max < $ct) {
$newstart = $start+$count;
if ($start<0) $start = 0;
echo '';
}
if ($currentPage < $lastPage) {
$lastStart = ((int) ($ct / $max)) * $max;
echo '';
}
}
} else {
if ($ct>$max) {
if ($start>0) {
$newstart = $start-$max;
if ($start<0) $start = 0;
echo '';
}
if ($currentPage > 1) {
$lastStart = ((int) ($ct / $max)) * $max;
echo '';
}
}
}
echo ' | ';
echo ' |
';
echo '';
for ($i=$start, $n=0; $i<$start+$count; ++$i) {
$mediaobject = $medialist[$i];
if ($columns == '1') echo '| ';
if ($columns == '2') echo ' | ';
echo '| ';
echo $mediaobject->displayImage();
echo ' | ';
if (WT_USE_LIGHTBOX && WT_USER_CAN_EDIT) {
echo lightbox_WT_Module::getMediaListMenu($mediaobject);
}
// If sorting by title, highlight the title. If sorting by filename, highlight the filename
if ($sortby=='title') {
echo ' ';
echo $mediaobject->getFullName();
echo ' ';
} else {
echo '';
echo basename($mediaobject->getFilename());
echo ' ';
echo WT_Gedcom_Tag::getLabelValue('TITL', $mediaobject->getFullName());
}
// Show file details
if ($mediaobject->isExternal()) {
echo WT_Gedcom_Tag::getLabelValue('URL', $mediaobject->getFilename());
} else {
if ($mediaobject->fileExists()) {
if (WT_USER_CAN_EDIT || WT_USER_CAN_ACCEPT) {
echo WT_Gedcom_Tag::getLabelValue('FILE', $mediaobject->getFilename());
}
echo WT_Gedcom_Tag::getLabelValue('FORM', $mediaobject->mimeType());
echo WT_Gedcom_Tag::getLabelValue('__FILE_SIZE__', $mediaobject->getFilesize());
$imgsize = $mediaobject->getImageAttributes();
if ($imgsize['WxH']) {
echo WT_Gedcom_Tag::getLabelValue('__IMAGE_SIZE__', $imgsize['WxH']);
}
} else {
echo '', /* I18N: %s is a filename */ WT_I18N::translate('The file “%s” does not exist.', $mediaobject->getFilename()), ' ';
}
}
echo ' ';
echo '';
print_fact_sources($mediaobject->getGedcomRecord(), 1);
print_fact_notes($mediaobject->getGedcomRecord(), 1);
echo ' ';
foreach ($mediaobject->fetchLinkedIndividuals() as $individual) {
echo '' . WT_I18N::translate('View Person') . ' — ' . $individual->getFullname().' ';
}
foreach ($mediaobject->fetchLinkedFamilies() as $family) {
echo '' . WT_I18N::translate('View Family') . ' — ' . $family->getFullname().' ';
}
foreach ($mediaobject->fetchLinkedSources() as $source) {
echo '' . WT_I18N::translate('View Source') . ' — ' . $source->getFullname().' ';
}
echo ' | ';
echo ' | ';
if ((++$n) % $columns == 0) {
echo '
';
}
} // end media loop
echo '
';
// echo page back, page number, page forward controls
echo '';
echo '';
echo '';
echo '| ';
if ($TEXT_DIRECTION=='ltr') {
if ($ct>$max) {
if ($currentPage > 1) {
echo '';
}
if ($start>0) {
$newstart = $start-$max;
if ($start<0) $start = 0;
echo '';
}
}
} else {
if ($ct>$max) {
if ($currentPage < $lastPage) {
$lastStart = ((int) ($ct / $max)) * $max;
echo '';
}
if ($start+$max < $ct) {
$newstart = $start+$count;
if ($start<0) $start = 0;
echo '';
}
}
}
echo ' | ';
echo '', WT_I18N::translate('Page %s of %s', $currentPage, $lastPage), ' | ';
echo '';
if ($TEXT_DIRECTION=='ltr') {
if ($ct>$max) {
if ($start+$max < $ct) {
$newstart = $start+$count;
if ($start<0) $start = 0;
echo '';
}
if ($currentPage < $lastPage) {
$lastStart = ((int) ($ct / $max)) * $max;
echo '';
}
}
} else {
if ($ct>$max) {
if ($start>0) {
$newstart = $start-$max;
if ($start<0) $start = 0;
echo '';
}
if ($currentPage > 1) {
$lastStart = ((int) ($ct / $max)) * $max;
echo '';
}
}
}
echo ' | ';
echo ' |
';
echo '
';
}
echo '
';// close medialist-page
}