diff options
| author | Nigel Osborne <kiwi3685@me.com> | 2011-11-24 02:32:59 +0000 |
|---|---|---|
| committer | Nigel Osborne <kiwi3685@me.com> | 2011-11-24 02:32:59 +0000 |
| commit | 2c0675211afbb5237d36232048444d3d7b8abfd0 (patch) | |
| tree | 86d025f391798691309d8360a06e149529bef354 | |
| parent | 1a44bf466f3dea2fa701bc865bb978f7453fd8fd (diff) | |
| download | webtrees-2c0675211afbb5237d36232048444d3d7b8abfd0.tar.gz webtrees-2c0675211afbb5237d36232048444d3d7b8abfd0.tar.bz2 webtrees-2c0675211afbb5237d36232048444d3d7b8abfd0.zip | |
Change media-list function to use a variable rather than echoing every cell
| -rw-r--r-- | includes/functions/functions_print_lists.php | 66 | ||||
| -rw-r--r-- | medialist.php | 5 | ||||
| -rw-r--r-- | note.php | 2 | ||||
| -rw-r--r-- | source.php | 2 |
4 files changed, 38 insertions, 37 deletions
diff --git a/includes/functions/functions_print_lists.php b/includes/functions/functions_print_lists.php index d385b43d91..b2b1a4e387 100644 --- a/includes/functions/functions_print_lists.php +++ b/includes/functions/functions_print_lists.php @@ -1219,9 +1219,9 @@ function format_repo_table($repos) { } // print a table of media objects -function print_media_table($datalist) { +function format_media_table($datalist) { global $SHOW_LAST_CHANGE, $WT_IMAGES, $controller; - + $html = ''; $table_id = 'ID'.floor(microtime()*1000000); // lists requires a unique ID in case there are multiple lists per page $controller ->addExternalJavaScript(WT_STATIC_URL.'js/jquery/jquery.dataTables.min.js') @@ -1253,22 +1253,22 @@ function print_media_table($datalist) { '); //--table wrapper - echo '<div class="loading-image"> </div>'; - echo '<div class="media-list">'; + $html .= '<div class="loading-image"> </div>'; + $html .= '<div class="media-list">'; //-- table header - echo '<table id="', $table_id, '"><thead><tr>'; - echo '<th>', WT_I18N::translate('Media'), '</th>'; - echo '<th>', WT_Gedcom_Tag::getLabel('TITL'), '</th>'; - echo '<th>', WT_I18N::translate('Individuals'), '</th>'; - echo '<th>#INDI</th>'; - echo '<th>', WT_I18N::translate('Families'), '</th>'; - echo '<th>#FAM</th>'; - echo '<th>', WT_I18N::translate('Sources'), '</th>'; - echo '<th>#SOUR</th>'; - echo '<th>', WT_Gedcom_Tag::getLabel('CHAN'), '</th>'; - echo '</tr></thead>'; + $html .= '<table id="'. $table_id. '"><thead><tr>'; + $html .= '<th>'. WT_I18N::translate('Media'). '</th>'; + $html .= '<th>'. WT_Gedcom_Tag::getLabel('TITL'). '</th>'; + $html .= '<th>'. WT_I18N::translate('Individuals'). '</th>'; + $html .= '<th>#INDI</th>'; + $html .= '<th>'. WT_I18N::translate('Families'). '</th>'; + $html .= '<th>#FAM</th>'; + $html .= '<th>'. WT_I18N::translate('Sources'). '</th>'; + $html .= '<th>#SOUR</th>'; + $html .= '<th>'. WT_Gedcom_Tag::getLabel('CHAN'). '</th>'; + $html .= '</tr></thead>'; //-- table body - echo '<tbody>'; + $html .= '<tbody>'; $n = 0; foreach ($datalist as $key => $value) { if (is_object($value)) { // Array of objects @@ -1280,39 +1280,39 @@ function print_media_table($datalist) { } if ($media->canDisplayDetails()) { $name = $media->getFullName(); - echo "<tr>"; + $html .= "<tr>"; //-- Object thumbnail - echo '<td><img src="', $media->getThumbnail(), '" alt="', htmlspecialchars(strip_tags($name)), '" /></td>'; + $html .= '<td><img src="'. $media->getThumbnail(). '" alt="'. htmlspecialchars(strip_tags($name)). '" /></td>'; //-- Object name(s) - echo '<td>'; - echo '<a href="', $media->getHtmlUrl(), '" class="list_item name2">'; - echo highlight_search_hits($name), '</a>'; + $html .= '<td>'; + $html .= '<a href="'. $media->getHtmlUrl(). '" class="list_item name2">'; + $html .= highlight_search_hits($name). '</a>'; if (WT_USER_CAN_EDIT || WT_USER_CAN_ACCEPT) - echo '<br /><a href="', $media->getHtmlUrl(), '">', basename($media->getFilename()), '</a>'; - if ($media->getNote()) echo '<br />', print_fact_notes('1 NOTE '.$media->getNote(), 1); - echo '</td>'; + $html .= '<br /><a href="'. $media->getHtmlUrl(). '">'. basename($media->getFilename()). '</a>'; + if ($media->getNote()) $html .= '<br />'. print_fact_notes('1 NOTE ', $media->getNote(), 1); + $html .= '</td>'; //-- Linked INDIs $num=$media->countLinkedIndividuals(); - echo '<td>', WT_I18N::number($num), '</td><td>', $num, '</td>'; + $html .= '<td>'. WT_I18N::number($num). '</td><td>'. $num. '</td>'; //-- Linked FAMs $num=$media->countLinkedfamilies(); - echo '<td>', WT_I18N::number($num), '</td><td>', $num, '</td>'; + $html .= '<td>'. WT_I18N::number($num). '</td><td>'. $num. '</td>'; //-- Linked SOURces $num=$media->countLinkedSources(); - echo '<td>', WT_I18N::number($num), '</td><td>', $num, '</td>'; + $html .= '<td>'. WT_I18N::number($num). '</td><td>'. $num. '</td>'; //-- Last change if ($SHOW_LAST_CHANGE) { - echo '<td>', $media->LastChangeTimestamp(empty($SEARCH_SPIDER)), '</td>'; + $html .= '<td>'. $media->LastChangeTimestamp(empty($SEARCH_SPIDER)). '</td>'; } else { - echo '<td> </td>'; + $html .= '<td> </td>'; } - echo '</tr>'; + $html .= '</tr>'; } } - echo '</tbody>', - '</table>', - '</div>'; + $html .= '</tbody></table></div>'; + + return $html; } // Print a table of surnames, for the top surnames block, the indi/fam lists, etc. diff --git a/medialist.php b/medialist.php index 34366780cb..b9cbb0e3d4 100644 --- a/medialist.php +++ b/medialist.php @@ -170,7 +170,7 @@ if ($build == 'yes') { $controller->pageHeader(); -echo '<div id="media-list-page"><h2>', $controller->getPageTitle(), '</h2></div>'; +echo '<div id="media-list-page"><h2>', $controller->getPageTitle(), '</h2>'; if (WT_USE_LIGHTBOX) { require WT_ROOT.WT_MODULES_DIR.'lightbox/functions/lb_call_js.php'; } @@ -561,5 +561,6 @@ Plus other Media Options - MediaViewer page'), '" />'; echo '</tr></table></td></tr>'; echo '</table><br />'; } - echo '</div>'; + echo '</div> + </div>';// close media-list-page } @@ -171,7 +171,7 @@ echo '<div id="note-tabs"> // Media Items linked to this shared note if ($controller->record->countLinkedMedia()) { echo '<div id="media-note">'; - print_media_table($controller->record->fetchLinkedMedia(), $controller->record->getFullName()); + echo format_media_table($controller->record->fetchLinkedMedia(), $controller->record->getFullName()); echo '</div>'; //close "media-note" } // Sources linked to this shared note diff --git a/source.php b/source.php index 7c57fe4566..d5cf5b1d2b 100644 --- a/source.php +++ b/source.php @@ -154,7 +154,7 @@ echo '<div id="source-tabs"> // Media Items linked to this source if ($controller->record->countLinkedMedia()) { echo '<div id="media-sources">'; - print_media_table($controller->record->fetchLinkedMedia(), $controller->record->getFullName()); + echo format_media_table($controller->record->fetchLinkedMedia(), $controller->record->getFullName()); echo '</div>'; //close "media-sources" } // Shared Notes linked to this source |
