aboutsummaryrefslogtreecommitdiff
path: root/mod/file/views/default/widgets
diff options
context:
space:
mode:
Diffstat (limited to 'mod/file/views/default/widgets')
-rw-r--r--mod/file/views/default/widgets/filerepo/content.php68
-rw-r--r--mod/file/views/default/widgets/filerepo/edit.php33
2 files changed, 26 insertions, 75 deletions
diff --git a/mod/file/views/default/widgets/filerepo/content.php b/mod/file/views/default/widgets/filerepo/content.php
index 130b5e3de..d2cd246ae 100644
--- a/mod/file/views/default/widgets/filerepo/content.php
+++ b/mod/file/views/default/widgets/filerepo/content.php
@@ -6,65 +6,27 @@
*/
-$owner_guid = $vars['entity']->owner_guid;
-$number = $vars['entity']->num_display;
+$num = $vars['entity']->num_display;
-//get the layout view which is set by the user in the edit panel
-$get_view = (int) $vars['entity']->gallery_list;
-if (!$get_view || $get_view == 1) {
- $view = "list";
-} else {
- $view = "gallery";
-}
-
-//get the user's files
$options = array(
'type' => 'object',
'subtype' => 'file',
- 'limit' => $number,
- 'container_guid' => $owner_guid
+ 'container_guid' => $vars['entity']->owner_guid,
+ 'limit' => $num,
+ 'full_view' => FALSE,
+ 'pagination' => FALSE,
);
-$files = elgg_get_entities($options);
-
-//if there are some files, go get them
-if ($files) {
-
- echo "<div id='filerepo_widget_layout'>";
-
- if ($view == "gallery") {
-
- echo "<div class='filerepo_widget_galleryview'>";
+$content = elgg_list_entities($options);
- //display in gallery mode
- foreach ($files as $f) {
+echo $content;
- $mime = $f->mimetype;
- echo "<a href=\"{$f->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $f->thumbnail, 'file_guid' => $f->guid)) . "</a>";
- }
-
- echo "</div>";
- } else {
-
- //display in list mode
- foreach ($files as $f) {
-
- $mime = $f->mimetype;
- echo "<div class='filerepo_widget_singleitem clearfix'>";
- echo "<div class='filerepo_listview_icon'><a href=\"{$f->getURL()}\">" . elgg_view("file/icon", array("mimetype" => $mime, 'thumbnail' => $f->thumbnail, 'file_guid' => $f->guid)) . "</a></div>";
- echo "<div class='filerepo_widget-content'>";
- echo "<div class='filerepo_listview_title'><p class='filerepo_title'>" . $f->title . "</p></div>";
- echo "<div class='filerepo_listview_date'><p class='filerepo_timestamp'><small>" . elgg_view_friendly_time($f->time_created) . "</small></p></div>";
- echo "</div></div>";
- }
- }
-
-
- //get a link to the users files
- $users_file_url = elgg_get_site_url() . "pg/file/" . get_user($f->owner_guid)->username;
-
- echo "<div class='filerepo_widget_singleitem_more'><a href=\"{$users_file_url}\">" . elgg_echo('file:more') . "</a></div>";
- echo "</div>";
+if ($content) {
+ $url = "pg/file/owner/" . elgg_get_page_owner()->username;
+ $more_link = elgg_view('output/url', array(
+ 'href' => $url,
+ 'text' => elgg_echo('file:more'),
+ ));
+ echo "<span class=\"elgg-widget-more\">$more_link</span>";
} else {
-
- echo "<p class='margin-top'>" . elgg_echo("file:none") . "</p>";
+ echo elgg_echo('file:none');
}
diff --git a/mod/file/views/default/widgets/filerepo/edit.php b/mod/file/views/default/widgets/filerepo/edit.php
index 0ee794dca..695d16afc 100644
--- a/mod/file/views/default/widgets/filerepo/edit.php
+++ b/mod/file/views/default/widgets/filerepo/edit.php
@@ -5,32 +5,21 @@
* @package ElggFile
*/
+
// set default value
if (!isset($vars['entity']->num_display)) {
$vars['entity']->num_display = 4;
}
-?>
-<p>
- <?php echo elgg_echo("file:num_files"); ?>:
- <select name="params[num_display]">
-<?php
-$options = array(1,2,3,4,5,6,7,8,9,10,15,20);
-foreach ($options as $option) {
- $selected = '';
- if ($vars['entity']->num_display == $option) {
- $selected = "selected='selected'";
- }
- echo " <option value='{$option}' $selected >{$option}</option>\n";
-}
-?>
- </select>
-</p>
+$params = array(
+ 'internalname' => 'params[num_display]',
+ 'value' => $vars['entity']->num_display,
+ 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 15, 20),
+);
+$dropdown = elgg_view('input/pulldown', $params);
+?>
<p>
- <?php echo elgg_echo("file:gallery_list"); ?>?
- <select name="params[gallery_list]">
- <option value="1" <?php if($vars['entity']->gallery_list == 1) echo "SELECTED"; ?>><?php echo elgg_echo("file:list"); ?></option>
- <option value="2" <?php if($vars['entity']->gallery_list == 2) echo "SELECTED"; ?>><?php echo elgg_echo("file:gallery"); ?></option>
- </select>
-</p> \ No newline at end of file
+ <?php echo elgg_echo('file:num_files'); ?>:
+ <?php echo $dropdown; ?>
+</p>