[ Index ]
 

Code source de Claroline 188

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/claroline/linker/ -> CourseResolver.php (source)

   1  <?php // $Id: CourseResolver.php,v 1.10 2006/12/19 08:18:07 moosh Exp $
   2  if ( count( get_included_files() ) == 1 ) die( '---' );
   3  /**
   4   * CLAROLINE
   5   *
   6   * @version 1.8 $Revision: 1.10 $
   7   * @copyright (c) 2001-2006 Universite catholique de Louvain (UCL)
   8   *
   9   * @license http://www.gnu.org/copyleft/gpl.html (GPL) GENERAL PUBLIC LICENSE
  10   *
  11   * @author claroline Team <cvs@claroline.net>
  12   * @author Renaud Fallier <renaud.claroline@gmail.com>
  13   * @author Frédéric Minne <minne@ipm.ucl.ac.be>
  14   *
  15   * @package CLLINKER
  16   *
  17   */
  18  require_once  ('resolver.lib.php');
  19  
  20  /**
  21      * Class Resolver
  22      * is a abstact class
  23      * @package CLLINKER
  24      *
  25      */
  26  class CourseResolver extends Resolver
  27  {
  28      /*-------------------------
  29      variable
  30      ------------------------*/
  31      var $_basePath;
  32  
  33      /*----------------------------
  34      public method
  35      ---------------------------*/
  36  
  37      /**
  38           * constructor
  39           *
  40           * @param string $basePath string path root directory of courses
  41           */
  42      function CourseResolver($basePath)
  43      {
  44          global $coursesRepositoryAppend;
  45  
  46          $this->_basePath = get_path('rootWeb');
  47  
  48      }
  49  
  50      /**
  51          * translated a crl into valid URL
  52          *
  53          * @param $CRL string a crl
  54          * @return string a url valide who corresponds to the crl
  55          */
  56      function resolve($crl)
  57      {
  58          global $tbl_course;
  59  
  60          $elementCRLArray = CRLTool::parseCRL($crl);
  61  
  62          if (  isset( $elementCRLArray['course_sys_code'] ) &&
  63          !isset( $elementCRLArray['tool_name'] ) &&
  64          !isset( $elementCRLArray['team'] ) &&
  65          !isset( $elementCRLArray['resource_id']) )
  66          {
  67              $url = $this->_basePath . 'claroline/course/index.php?cidReq=' 
  68                  . $elementCRLArray['course_sys_code']
  69                  ;
  70  
  71              return $url;
  72  
  73          }
  74          else
  75          {
  76              trigger_error('Error: missing course sys code',E_USER_ERROR);
  77          }
  78      }
  79  
  80      /**
  81          * the name of the resource which will be posted
  82          *
  83          * @param $crl a string who cotains the crl
  84          * @return string who contains the name of the resource
  85          * @throw  E_USER_ERROR if it isn't for tool chat
  86          **/
  87      function getResourceName($crl)
  88      {
  89          $elementCRLArray = CRLTool::parseCRL($crl);
  90          if (  isset( $elementCRLArray['course_sys_code'] ) &&
  91          !isset( $elementCRLArray['tool_name'] ) &&
  92          !isset( $elementCRLArray['team'] ) &&
  93          !isset( $elementCRLArray['resource_id']) )
  94          {
  95              $title  = get_toolname_title($elementCRLArray);
  96  
  97              return $title;
  98          }
  99          else
 100          {
 101              trigger_error('Error: missing course sys code',E_USER_ERROR);
 102          }
 103      }
 104  }


Généré le : Thu Nov 29 14:38:42 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics