Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.
   1  <?php
   2  // This file is part of Moodle - http://moodle.org/
   3  //
   4  // Moodle is free software: you can redistribute it and/or modify
   5  // it under the terms of the GNU General Public License as published by
   6  // the Free Software Foundation, either version 3 of the License, or
   7  // (at your option) any later version.
   8  //
   9  // Moodle is distributed in the hope that it will be useful,
  10  // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  // GNU General Public License for more details.
  13  //
  14  // You should have received a copy of the GNU General Public License
  15  // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
  16  
  17  /**
  18  * @package    backup-convert
  19  * @subpackage cc-library
  20  * @copyright  2011 Darko Miletic <dmiletic@moodlerooms.com>
  21  * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
  22  */
  23  
  24  
  25  
  26   /**
  27     Defined as specified in CC 1.1
  28   */
  29  class intended_user_role {
  30      const LEARNER               = 'Learner';
  31      const INSTRUCTOR            = 'Instructor';
  32      const MENTOR                = 'Mentor';
  33  }
  34  
  35  class technical_role {
  36      const AUTHOR                = 'author';
  37      const PUBLISHER             = 'publisher';
  38      const UNKNOWN               = 'unknown';
  39      const INITIATOR             = 'initiator';
  40      const TERMINATOR            = 'terminator';
  41      const VALIDATOR             = 'validator';
  42      const EDITOR                = 'editor';
  43      const GRAPHICAL_DESIGNER    = 'graphical designer';
  44      const TECHNICAL_IMPLEMENTER = 'technical implementer';
  45      const CONTENT_PROVIDER      = 'content provider';
  46      const TECHNICAL_VALIDATOR   = 'technical validator';
  47      const EDUCATION_VALIDATOR   = 'educational validator';
  48      const SCRIPT_WRITER         = 'script writer';
  49      const INSTRUCTIONAL_DESIGNER= 'instructional designer';
  50      const SUBJET_MATTER_EXPERT  = 'subject matter expert';
  51  }
  52  
  53  
  54  class rights_copyright {
  55      const   YES                  = 'yes';
  56      const   NO                   = 'no';
  57  }
  58  
  59  
  60  class rights_cost {
  61      const   YES                  = 'yes';
  62      const   NO                   = 'no';
  63  }
  64  
  65  
  66  // Language identifier (as defined in ISO 639-1, ISO 639-2, and ISO 3166-1)
  67  class language_lom {
  68      const   US_ENGLISH           = 'en-US';
  69      const   GB_ENGLISH           = 'en-GB';
  70      const   AR_SPANISH           = 'es-AR';
  71      const   GR_GREEK             = 'el-GR';
  72  
  73  }
  74  
  75  
  76  
  77  /**
  78   * Metadata Manifest
  79   *
  80   */
  81  class cc_metadata_manifest implements cc_i_metadata_manifest {
  82  
  83  
  84      public  $arraygeneral   = array();
  85      public  $arraytech      = array();
  86      public  $arrayrights    = array();
  87      public  $arraylifecycle = array();
  88  
  89  
  90      public function add_metadata_general($obj){
  91          if (empty($obj)){
  92              throw new Exception('Medatada Object given is invalid or null!');
  93          }
  94          !is_null($obj->title)? $this->arraygeneral['title']=$obj->title:null;
  95          !is_null($obj->language)? $this->arraygeneral['language']=$obj->language:null;
  96          !is_null($obj->description)? $this->arraygeneral['description']=$obj->description:null;
  97          !is_null($obj->keyword)? $this->arraygeneral['keyword']=$obj->keyword:null;
  98          !is_null($obj->coverage)? $this->arraygeneral['coverage']=$obj->coverage:null;
  99          !is_null($obj->catalog)? $this->arraygeneral['catalog']=$obj->catalog:null;
 100          !is_null($obj->entry)? $this->arraygeneral['entry']=$obj->entry:null;
 101      }
 102  
 103      public function add_metadata_technical($obj){
 104          if (empty($obj)){
 105              throw new Exception('Medatada Object given is invalid or null!');
 106          }
 107          !is_null($obj->format)? $this->arraytech['format']=$obj->format:null;
 108      }
 109  
 110  
 111      public function add_metadata_rights($obj){
 112          if (empty($obj)){
 113              throw new Exception('Medatada Object given is invalid or null!');
 114          }
 115          !is_null($obj->copyright)? $this->arrayrights['copyrightAndOtherRestrictions']=$obj->copyright:null;
 116          !is_null($obj->description)? $this->arrayrights['description']=$obj->description:null;
 117          !is_null($obj->cost)? $this->arrayrights['cost']=$obj->cost:null;
 118  
 119      }
 120  
 121  
 122      public function add_metadata_lifecycle($obj){
 123          if (empty($obj)){
 124              throw new Exception('Medatada Object given is invalid or null!');
 125          }
 126          !is_null($obj->role)? $this->arraylifecycle['role']=$obj->role:null;
 127          !is_null($obj->entity)? $this->arraylifecycle['entity']=$obj->entity:null;
 128          !is_null($obj->date)? $this->arraylifecycle['date']=$obj->date:null;
 129  
 130      }
 131  
 132  }
 133  
 134  
 135  /**
 136   * Metadata Lifecycle Type
 137   *
 138   */
 139  class cc_metadata_lifecycle{
 140  
 141      public $role             = array();
 142      public $entity           = array();
 143      public $date             = array();
 144  
 145      public function set_role($role){
 146          $this->role[] = array($role);
 147      }
 148      public function set_entity($entity){
 149          $this->entity[] = array($entity);
 150      }
 151      public function set_date($date){
 152          $this->date[] = array($date);
 153      }
 154  
 155  
 156  }
 157  
 158  /**
 159   * Metadata Rights Type
 160   *
 161   */
 162  class cc_metadata_rights {
 163  
 164      public $copyright        = array();
 165      public $description      = array();
 166      public $cost             = array();
 167  
 168      public function set_copyright($copy){
 169          $this->copyright[] = array($copy);
 170      }
 171      public function set_description ($des,$language){
 172          $this->description[] = array($language,$des);
 173      }
 174      public function set_cost($cost){
 175          $this->cost[] = array($cost);
 176      }
 177  
 178  }
 179  
 180  
 181  /**
 182   * Metadata Technical Type
 183   *
 184   */
 185  class cc_metadata_technical {
 186  
 187      public  $format         = array();
 188  
 189  
 190      public function set_format($format){
 191          $this->format[] = array($format);
 192      }
 193  
 194  }
 195  
 196  
 197  /**
 198   * Metadata General Type
 199   *
 200   */
 201  class cc_metadata_general {
 202  
 203      public  $title          = array();
 204      public  $language       = array();
 205      public  $description    = array();
 206      public  $keyword        = array();
 207      public  $coverage       = array();
 208      public  $catalog        = array();
 209      public  $entry          = array();
 210  
 211  
 212  
 213      public function set_coverage ($coverage,$language){
 214          $this->coverage[] = array($language,$coverage);
 215      }
 216      public function set_description ($description,$language){
 217          $this->description[] = array($language,$description);
 218      }
 219      public function set_keyword ($keyword,$language){
 220          $this->keyword[] = array($language,$keyword);
 221      }
 222      public function set_language ($language){
 223          $this->language[] = array($language);
 224      }
 225      public function set_title ($title,$language){
 226          $this->title[] = array($language,$title);
 227      }
 228      public function set_catalog ($cat){
 229          $this->catalog[] = array($cat);
 230      }
 231      public function set_entry ($entry){
 232          $this->entry[] = array($entry);
 233      }
 234  
 235  
 236  }