Merge branch 'MDL-28509_master' of git://github.com/marxjohnson/moodle
authorAparup Banerjee <aparup@moodle.com>
Tue, 23 Aug 2011 06:07:08 +0000 (14:07 +0800)
committerAparup Banerjee <aparup@moodle.com>
Tue, 23 Aug 2011 06:07:08 +0000 (14:07 +0800)
repository/youtube/lang/en/repository_youtube.php
repository/youtube/lib.php

index 22d80e8..dfee1f8 100644 (file)
@@ -27,3 +27,8 @@ $string['pluginname'] = 'Youtube videos';
 $string['search'] = 'Search videos';
 $string['youtube:view'] = 'Use youtube in file picker';
 $string['configplugin'] = 'YouTube repository type configuration';
+$string['sortby'] = 'Sort By';
+$string['sortpublished'] = 'Date Published';
+$string['sortrating'] = 'Rating';
+$string['sortrelevance'] = 'Relevance';
+$string['sortviewcount'] = 'View Count';
index 67166df..30a5f07 100644 (file)
@@ -31,7 +31,7 @@ class repository_youtube extends repository {
         $this->keyword = optional_param('youtube_keyword', '', PARAM_RAW);
         $this->start =1;
         $this->max = 27;
-        $this->sort = 'published';
+        $this->sort = optional_param('youtube_sort', '', PARAM_TEXT);
         parent::__construct($repositoryid, $context, $options);
     }
 
@@ -92,7 +92,30 @@ class repository_youtube extends repository {
         $search->id   = 'youtube_search';
         $search->name = 'youtube_keyword';
         $search->label = get_string('search', 'repository_youtube').': ';
-        $ret['login'] = array($search);
+        $sort = new stdClass();
+        $sort->type = 'select';
+        $sort->options = array(
+            (object)array(
+                'value' => 'relevance',
+                'label' => get_string('sortrelevance', 'repository_youtube')
+            ),
+            (object)array(
+                'value' => 'published',
+                'label' => get_string('sortpublished', 'repository_youtube')
+            ),
+            (object)array(
+                'value' => 'rating',
+                'label' => get_string('sortrating', 'repository_youtube')
+            ),
+            (object)array(
+                'value' => 'viewCount',
+                'label' => get_string('sortviewcount', 'repository_youtube')
+            )
+        );
+        $sort->id = 'youtube_sort';
+        $sort->name = 'youtube_sort';
+        $sort->label = get_string('sortby', 'repository_youtube').': ';
+        $ret['login'] = array($search, $sort);
         $ret['login_btn_label'] = get_string('search');
         $ret['login_btn_action'] = 'search';
         return $ret;