dokeos-backup
[ class tree: dokeos-backup ] [ index: dokeos-backup ] [ all elements ]

Source for file Course.class.php

Documentation is available at Course.class.php

  1. <?php // $Id: Course.class.php 12645 2007-06-18 20:46:16Z elixir_inter $
  2. /*
  3. ============================================================================== 
  4.     Dokeos - elearning and course management software
  5.     
  6.     Copyright (c) 2004 Dokeos S.A.
  7.     Copyright (c) 2003 Ghent University (UGent)
  8.     Copyright (c) 2001 Universite catholique de Louvain (UCL)
  9.     Copyright (c) Bart Mollet (bart.mollet@hogent.be)
  10.     
  11.     For a full list of contributors, see "credits.txt".
  12.     The full license can be read in "license.txt".
  13.     
  14.     This program is free software; you can redistribute it and/or
  15.     modify it under the terms of the GNU General Public License
  16.     as published by the Free Software Foundation; either version 2
  17.     of the License, or (at your option) any later version.
  18.     
  19.     See the GNU General Public License for more details.
  20.     
  21.     Contact address: Dokeos, 44 rue des palais, B-1030 Brussels, Belgium
  22.     Mail: info@dokeos.com
  23. ============================================================================== 
  24. */
  25. require_once ('LinkCategory.class.php');
  26. require_once ('Announcement.class.php');
  27. require_once ('Event.class.php');
  28. /**
  29.  * A course-object to use in Export/Import/Backup/Copy
  30.  * @author Bart Mollet <bart.mollet@hogent.be>
  31.  * @package dokeos.backup
  32.  */
  33. class Course
  34. {
  35.     var $resources;
  36.     var $code;
  37.     var $path;
  38.     var $destination_path;
  39.     var $destination_db;
  40.     /**
  41.      * Create a new Course-object
  42.      */
  43.     function Course()
  44.     {
  45.         $this->resources = array ();
  46.         $this->code = '';
  47.         $this->path = '';
  48.         $this->backup_path '';
  49.     }
  50.     /**
  51.      * Check if a resource links to the given resource
  52.      */
  53.     function is_linked_resource($resource_to_check)
  54.     {
  55.         foreach($this->resources as $type => $resources)
  56.         {
  57.             foreach($resources as $id => $resource)
  58.             {
  59.                 if$resource->links_to($resource_to_check) )
  60.                 {
  61.                     return true;    
  62.                 }    
  63.             }    
  64.             if$type == RESOURCE_LEARNPATH && get_class($resource)=='Learnpath')
  65.             {
  66.                 if($resource->has_item($resource_to_check))
  67.                 {
  68.                     return true;    
  69.                 }    
  70.             }
  71.         }
  72.         return false;
  73.     }
  74.     /**
  75.      * Add a resource from a given type to this course
  76.      */
  77.     function add_resource($resource)
  78.     {
  79.         $this->resources[$resource->get_type()][$resource->get_id()$resource;
  80.     }
  81.     /**
  82.      * Does this course has resources?
  83.      * @param const $resource_type Check if this course has resources of the
  84.      *  given type. If no type is given, check if course has resources of any
  85.      *  type.
  86.      */
  87.     function has_resources($resource_type null)
  88.     {
  89.         if$resource_type != null)
  90.         {
  91.             return is_array($this->resources[$resource_type]&& count($this->resources[$resource_type]);    
  92.         }
  93.         return (count($this->resources0);
  94.     }
  95.     /**
  96.      * Show this course resources
  97.      */
  98.     function show()
  99.     {
  100.         echo '<pre>';
  101.         print_r($this);
  102.         echo '</pre>';
  103.  
  104. //        foreach ($this->resources as $id => $resources)
  105. //        {
  106. //            foreach ($resources as $type => $resource)
  107. //            {
  108. //                $resource->show();
  109. //            }
  110. //        }
  111.     }
  112.  
  113. }
  114. ?>

Documentation generated on Thu, 12 Jun 2008 13:09:48 -0500 by phpDocumentor 1.4.1