]> git.mjollnir.org Git - moodle.git/commitdiff
MDL-15402: add skeleton comments to all repository plugins
authorjerome <jerome>
Thu, 18 Sep 2008 05:33:44 +0000 (05:33 +0000)
committerjerome <jerome>
Thu, 18 Sep 2008 05:33:44 +0000 (05:33 +0000)
repository/boxnet/repository.class.php
repository/flickr/repository.class.php
repository/flickr_public/repository.class.php
repository/local/repository.class.php
repository/upload/repository.class.php

index 1d13885b52ca52bf5d0183d24c5405c75c2efc93..12e088932785f18f08ce21dc28727199b2840044 100755 (executable)
 
 require_once($CFG->libdir.'/boxlib.php');
 
+/**
+ *
+ */
 class repository_boxnet extends repository {
     private $box;
 
+    /**
+     *
+     * @global <type> $SESSION
+     * @param <type> $repositoryid
+     * @param <type> $context
+     * @param <type> $options
+     */
     public function __construct($repositoryid, $context = SITEID, $options = array()) {
         global $SESSION;
         $options['username']   = optional_param('boxusername', '', PARAM_RAW);
@@ -43,17 +53,32 @@ class repository_boxnet extends repository {
         }
     }
 
+    /**
+     *
+     * @global <type> $SESSION
+     * @return <type>
+     */
     public function check_login() {
         global $SESSION;
         return !empty($SESSION->{$this->sess_name});
     }
 
+    /**
+     *
+     * @global <type> $SESSION
+     * @return <type>
+     */
     public function logout() {
         global $SESSION;
         unset($SESSION->{$this->sess_name});
         return $this->print_login();
     }
 
+    /**
+     *
+     * @param <type> $options
+     * @return <type>
+     */
     public function set_option($options = array()) {
         if (!empty($options['api_key'])) {
             set_config('api_key', trim($options['api_key']), 'boxnet');
@@ -63,6 +88,11 @@ class repository_boxnet extends repository {
         return $ret;
     }
 
+    /**
+     *
+     * @param <type> $config
+     * @return <type>
+     */
     public function get_option($config = '') {
         if($config==='api_key') {
             return trim(get_config('boxnet', 'api_key'));
@@ -73,6 +103,11 @@ class repository_boxnet extends repository {
         return $options;
     }
 
+    /**
+     *
+     * @global <type> $SESSION
+     * @return <type>
+     */
     public function global_search() {
         global $SESSION;
         if (empty($SESSION->{$this->sess_name})) {
@@ -82,6 +117,11 @@ class repository_boxnet extends repository {
         }
     }
 
+    /**
+     *
+     * @global <type> $DB
+     * @return <type>
+     */
     public function get_login() {
         global $DB;
         if ($entry = $DB->get_record('repository_instances', array('id'=>$this->id))) {
@@ -93,6 +133,13 @@ class repository_boxnet extends repository {
         }
         return $ret;
     }
+
+    /**
+     *
+     * @global <type> $CFG
+     * @param <type> $search_text
+     * @return <type>
+     */
     public function search($search_text) {
         global $CFG;
         $list = array();
@@ -118,6 +165,13 @@ class repository_boxnet extends repository {
         $ret['list'] = $list;
         return $ret;
     }
+
+    /**
+     *
+     * @global <type> $CFG
+     * @param <type> $path
+     * @return <type>
+     */
     public function get_listing($path = '/'){
         global $CFG;
         $list = array();
@@ -132,6 +186,10 @@ class repository_boxnet extends repository {
         return $ret;
     }
 
+    /**
+     *
+     * @return <type>
+     */
     public function print_login(){
         $t = $this->box->getTicket();
         $ret = $this->get_login();
@@ -157,10 +215,18 @@ class repository_boxnet extends repository {
         }
     }
 
+    /**
+     *
+     * @return <type>
+     */
     public static function get_type_option_names() {
         return array('api_key');
     }
 
+    /**
+     *
+     * @param <type> $
+     */
     public function type_config_form(&$mform) {
         $public_account = get_config('boxnet', 'public_account');
         $api_key = get_config('boxnet', 'api_key');
@@ -173,5 +239,4 @@ class repository_boxnet extends repository {
         $mform->addElement('static', null, '',  get_string('information','repository_boxnet'));
     }
 }
-
-?>
+?>
\ No newline at end of file
index 4a99dc7e843905f34d1f5a1ea6061621f2b5c83a..e0e04a3d234c7f0f2e0ec4f8bb141bc9c9ab550e 100755 (executable)
 
 require_once($CFG->libdir.'/flickrlib.php');
 
+/**
+ *
+ */
 class repository_flickr extends repository {
     private $flickr;
     public $photos;
 
+    /**
+     *
+     * @global <type> $SESSION
+     * @global <type> $CFG
+     * @param <type> $repositoryid
+     * @param <type> $context
+     * @param <type> $options
+     */
     public function __construct($repositoryid, $context = SITEID, $options = array()) {
         global $SESSION, $CFG;
         $options['page']    = optional_param('p', 1, PARAM_INT);
@@ -39,9 +50,19 @@ class repository_flickr extends repository {
         }
 
     }
+
+    /**
+     *
+     * @return <type>
+     */
     public function check_login() {
         return !empty($this->token);
     }
+
+    /**
+     *
+     * @return <type>
+     */
     public function logout() {
         set_user_preference($this->setting, '');
         set_user_preference($this->setting.'_nsid', '');
@@ -49,6 +70,12 @@ class repository_flickr extends repository {
         $this->nsid  = '';
         return $this->print_login();
     }
+
+    /**
+     *
+     * @param <type> $options
+     * @return <type>
+     */
     public function set_option($options = array()) {
         if (!empty($options['api_key'])) {
             set_config('api_key', trim($options['api_key']), 'flickr');
@@ -62,6 +89,11 @@ class repository_flickr extends repository {
         return $ret;
     }
 
+    /**
+     *
+     * @param <type> $config
+     * @return <type>
+     */
     public function get_option($config = '') {
         if ($config==='api_key') {
             return trim(get_config('flickr', 'api_key'));
@@ -75,6 +107,10 @@ class repository_flickr extends repository {
         return $options;
     }
 
+    /**
+     *
+     * @return <type>
+     */
     public function global_search() {
         if (empty($this->token)) {
             return false;
@@ -82,6 +118,12 @@ class repository_flickr extends repository {
             return true;
         }
     }
+
+    /**
+     *
+     * @param <type> $ajax
+     * @return <type>
+     */
     public function print_login($ajax = true) {
         if ($ajax) {
             $ret = array();
@@ -92,6 +134,13 @@ class repository_flickr extends repository {
             return $ret;
         }
     }
+
+    /**
+     *
+     * @param <type> $photos
+     * @param <type> $path
+     * @return <type>
+     */
     private function build_list($photos, $path = 1) {
         $photos_url = $this->flickr->urls_getUserPhotos($this->nsid);
         $ret = array();
@@ -120,6 +169,12 @@ class repository_flickr extends repository {
         }
         return $ret;
     }
+
+    /**
+     *
+     * @param <type> $search_text
+     * @return <type>
+     */
     public function search($search_text) {
         $photos = $this->flickr->photos_search(array(
             'user_id'=>$this->nsid,
@@ -129,6 +184,12 @@ class repository_flickr extends repository {
             ));
         return $this->build_list($photos);
     }
+
+    /**
+     *
+     * @param <type> $path
+     * @return <type>
+     */
     public function get_listing($path = '1') {
         $photos_url = $this->flickr->urls_getUserPhotos($this->nsid);
 
@@ -140,9 +201,22 @@ class repository_flickr extends repository {
             ));
         return $this->build_list($photos, $path);
     }
+
+    /**
+     *
+     * @return <type>
+     */
     public function print_listing() {
         return false;
     }
+
+    /**
+     *
+     * @global <type> $CFG
+     * @param <type> $photo_id
+     * @param <type> $file
+     * @return <type>
+     */
     public function get_file($photo_id, $file = '') {
         global $CFG;
         $result = $this->flickr->photos_getSizes($photo_id);
@@ -175,6 +249,11 @@ class repository_flickr extends repository {
         return $dir.$file;
     }
 
+    /**
+     *
+     * @global <type> $CFG
+     * @param <type> $
+     */
     public function type_config_form(&$mform) {
         global $CFG;
         $api_key = get_config('flickr', 'api_key');
@@ -206,8 +285,11 @@ class repository_flickr extends repository {
         $mform->addRule('secret', $strrequired, 'required', null, 'client');
     }
 
+    /**
+     *
+     * @return <type>
+     */
     public static function get_type_option_names() {
         return array('api_key', 'secret');
     }
-
-}
+}
\ No newline at end of file
index 735f4677cf9ea85c3161e454e54d6e40a8fb9045..510946f5e18e12bd38291e4b1f7779c35fb2d0f6 100644 (file)
 
 require_once($CFG->libdir.'/flickrlib.php');
 
+/**
+ *
+ */
 class repository_flickr_public extends repository {
     private $flickr;
     public $photos;
 
+    /**
+     *
+     * @param <type> $options
+     * @return <type>
+     */
     public function set_option($options = array()) {
         if (!empty($options['api_key'])) {
             set_config('api_key', trim($options['api_key']), 'flickr_public');
@@ -25,6 +33,11 @@ class repository_flickr_public extends repository {
         return $ret;
     }
 
+    /**
+     *
+     * @param <type> $config
+     * @return <type>
+     */
     public function get_option($config = '') {
         if ($config==='api_key') {
             return trim(get_config('flickr_public', 'api_key'));
@@ -35,6 +48,10 @@ class repository_flickr_public extends repository {
         return $options;
     }
 
+    /**
+     *
+     * @return <type>
+     */
     public function global_search() {
         if (empty($this->flickr_account)) {
             return false;
@@ -43,6 +60,14 @@ class repository_flickr_public extends repository {
         }
     }
 
+    /**
+     *
+     * @global <type> $CFG
+     * @param <type> $repositoryid
+     * @param <type> $context
+     * @param <type> $options
+     * @param <type> $readonly
+     */
     public function __construct($repositoryid, $context = SITEID, $options = array(), $readonly=0) {
         global $CFG;
         $options['page'] = optional_param('p', 1, PARAM_INT);
@@ -63,9 +88,20 @@ class repository_flickr_public extends repository {
             }
         }
     }
+
+    /**
+     *
+     * @return <type>
+     */
     public function check_login() {
         return !empty($this->flickr_account);
     }
+
+    /**
+     *
+     * @param <type> $ajax
+     * @return <type>
+     */
     public function print_login($ajax = true) {
         if ($ajax) {
             $ret = array();
@@ -77,6 +113,12 @@ class repository_flickr_public extends repository {
             return $ret;
         }
     }
+
+    /**
+     *
+     * @param <type> $search_text
+     * @return <type>
+     */
     public function search($search_text) {
         $people = $this->flickr->people_findByEmail($this->flickr_account);
         $this->nsid = $people['nsid'];
@@ -92,6 +134,12 @@ class repository_flickr_public extends repository {
         }
         return $this->build_list($photos);
     }
+
+    /**
+     *
+     * @param <type> $path
+     * @return <type>
+     */
     public function get_listing($path = '1') {
         $people = $this->flickr->people_findByEmail($this->flickr_account);
         $this->nsid = $people['nsid'];
@@ -99,6 +147,13 @@ class repository_flickr_public extends repository {
 
         return $this->build_list($photos, $path);
     }
+
+    /**
+     *
+     * @param <type> $photos
+     * @param <type> $path
+     * @return <type>
+     */
     private function build_list($photos, $path = 1) {
         $photos_url = $this->flickr->urls_getUserPhotos($this->nsid);
         $ret = array();
@@ -128,16 +183,31 @@ class repository_flickr_public extends repository {
         return $ret;
     }
 
+    /**
+     *
+     * @return <type>
+     */
     public function print_listing() {
         return false;
     }
 
+    /**
+     *
+     * @return <type>
+     */
     public function print_search() {
         parent::print_search();
         echo '<label>Tag: </label><br /><input type="text" name="tag" /><br />';
         return true;
     }
 
+    /**
+     *
+     * @global <type> $CFG
+     * @param <type> $photo_id
+     * @param <type> $file
+     * @return <type>
+     */
     public function get_file($photo_id, $file = '') {
         global $CFG;
         $result = $this->flickr->photos_getSizes($photo_id);
@@ -169,15 +239,27 @@ class repository_flickr_public extends repository {
         return $dir.$file;
     }
 
+    /**
+     *
+     * @param <type> $
+     */
     public function instance_config_form(&$mform) {
         $mform->addElement('text', 'email_address', get_string('emailaddress', 'repository_flickr_public'));
         $mform->addRule('email_address', get_string('required'), 'required', null, 'client');
     }
 
+    /**
+     *
+     * @return <type>
+     */
     public static function get_instance_option_names() {
         return array('email_address');
     }
 
+    /**
+     *
+     * @param <type> $
+     */
     public function type_config_form(&$mform) {
         $api_key = get_config('flickr_public', 'api_key');
         if (empty($api_key)) {
@@ -189,11 +271,17 @@ class repository_flickr_public extends repository {
         $mform->addElement('static', null, '',  get_string('information','repository_flickr_public'));
     }
 
+    /**
+     *
+     * @return <type>
+     */
     public static function get_type_option_names() {
         return array('api_key');
     }
 
-
+    /**
+     * 
+     */
     public static function plugin_init() {
         //here we create a default instance for this type
         repository_static_function('flickr_public','create', 'flickr_public', 0, get_system_context(), array('name' => 'default instance','email_address' => null),1);
index 0a82b27de9eeb26fa9cce83bb2ff49a599b9dbef..dfe599bd827bb208b54622abfd1181f57642f32e 100755 (executable)
@@ -7,8 +7,20 @@
  * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
  */
 
+/**
+ *
+ */
 class repository_local extends repository {
 
+    /**
+     *
+     * @global <type> $SESSION
+     * @global <type> $action
+     * @global <type> $CFG
+     * @param <type> $repositoryid
+     * @param <type> $context
+     * @param <type> $options
+     */
     public function __construct($repositoryid, $context = SITEID, $options = array()) {
         global $SESSION, $action, $CFG;
         parent::__construct($repositoryid, $context, $options);
@@ -19,6 +31,12 @@ class repository_local extends repository {
         // You can use $_FILES to find that file
     }
 
+    /**
+     *
+     * @global <type> $SESSION
+     * @param <type> $ajax
+     * @return <type>
+     */
     public function print_login($ajax = true) {
         global $SESSION;
         // TODO
@@ -26,10 +44,22 @@ class repository_local extends repository {
         return $this->get_listing();
     }
 
+    /**
+     *
+     * @param <type> $filearea
+     * @param <type> $path
+     * @param <type> $visiblename
+     * @return <type>
+     */
     private function _encode_path($filearea, $path, $visiblename) {
         return array('path'=>serialize(array($filearea, $path)), 'name'=>$visiblename);
     }
 
+    /**
+     *
+     * @param <type> $path
+     * @return <type>
+     */
     private function _decode_path($path) {
         $filearea = '';
         $path = '';
@@ -40,10 +70,22 @@ class repository_local extends repository {
         return array('filearea' => $filearea, 'path' => $path);
     }
 
+    /**
+     *
+     * @param <type> $search_text
+     * @return <type>
+     */
     public function search($search_text) {
         return $this->get_listing('', $search_text);
     }
 
+    /**
+     *
+     * @global <type> $CFG
+     * @param <type> $encodedpath
+     * @param <type> $search
+     * @return <type>
+     */
     public function get_listing($encodedpath = '', $search = '') {
         global $CFG;
         $ret = array();
@@ -180,12 +222,19 @@ class repository_local extends repository {
         return $filecount;
     }
 
+    /**
+     *
+     */
     public function print_listing() {
         // will be used in non-javascript file picker
     }
+
+    /**
+     *
+     * @return <type>
+     */
     public function get_name(){
         return get_string('repositoryname', 'repository_local');;
     }
 }
-?>
+?>
\ No newline at end of file
index 1ea7aa27675c15e17669debb76428661585e5f59..31e50e5496a557a46499bf35f9688aeb81cbef5c 100755 (executable)
@@ -7,8 +7,20 @@
  * @license http://www.gnu.org/copyleft/gpl.html GNU Public License
  */
 
+/**
+ *
+ */
 class repository_upload extends repository {
 
+    /**
+     *
+     * @global <type> $SESSION
+     * @global <type> $action
+     * @global <type> $CFG
+     * @param <type> $repositoryid
+     * @param <type> $context
+     * @param <type> $options
+     */
     public function __construct($repositoryid, $context = SITEID, $options = array()){
         global $SESSION, $action, $CFG;
         parent::__construct($repositoryid, $context, $options);
@@ -18,11 +30,25 @@ class repository_upload extends repository {
         }
     }
 
+    /**
+     *
+     * @global <type> $SESSION
+     * @param <type> $ajax
+     * @return <type>
+     */
     public function print_login($ajax = true) {
         global $SESSION;
         return $this->get_listing();
     }
 
+    /**
+     *
+     * @global <type> $CFG
+     * @global <type> $action
+     * @param <type> $path
+     * @param <type> $search
+     * @return <type>
+     */
     public function get_listing($path='', $search='') {
         global $CFG, $action;
         if($action=='upload'){
@@ -40,13 +66,24 @@ class repository_upload extends repository {
         }
     }
 
+    /**
+     *
+     */
     public function print_listing() {
     }
 
+    /**
+     *
+     * @return <type>
+     */
     public function print_search() {
         return true;
     }
 
+    /**
+     *
+     * @return <type> 
+     */
     public function get_name(){
         return get_string('repositoryname', 'repository_upload');;
     }