Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/backup/cc/cc_lib/cc_converter_resource.php
Go to the documentation of this file.
00001 <?php
00002 // This file is part of Moodle - http://moodle.org/
00003 //
00004 // Moodle is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // Moodle is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00023 require_once 'cc_converters.php';
00024 require_once 'cc_general.php';
00025 
00026 class cc_converter_resource extends cc_converter {
00027 
00028     public function __construct(cc_i_item &$item, cc_i_manifest &$manifest, $rootpath, $path){
00029         $this->cc_type     = cc_version11::webcontent;
00030         $this->defaultfile = 'resource.xml';
00031         parent::__construct($item, $manifest, $rootpath, $path);
00032     }
00033 
00034     public function convert($outdir) {
00035         $title = $this->doc->nodeValue('/activity/resource/name');
00036         $contextid = $this->doc->nodeValue('/activity/@contextid');
00037         $files = cc_helpers::handle_resource_content($this->manifest,
00038                                                    $this->rootpath,
00039                                                    $contextid,
00040                                                    $outdir);
00041         $deps = null;
00042         $resvalue = null;
00043         foreach ($files as $vfile => $values) {
00044             if ($values[2]) {
00045                 $resvalue = $values[0];
00046                 break;
00047             }
00048         }
00049 
00050         $resitem = new cc_item();
00051         $resitem->identifierref = $resvalue;
00052         $resitem->title = $title;
00053         $this->item->add_child_item($resitem);
00054 
00055         return true;
00056     }
00057 
00058 }
00059 
 All Data Structures Namespaces Files Functions Variables Enumerations