Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/backup/util/xml/parser/processors/findpaths_parser_processor.class.php
Go to the documentation of this file.
00001 <?php
00002 
00003 // This file is part of Moodle - http://moodle.org/
00004 //
00005 // Moodle is free software: you can redistribute it and/or modify
00006 // it under the terms of the GNU General Public License as published by
00007 // the Free Software Foundation, either version 3 of the License, or
00008 // (at your option) any later version.
00009 //
00010 // Moodle is distributed in the hope that it will be useful,
00011 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 // GNU General Public License for more details.
00014 //
00015 // You should have received a copy of the GNU General Public License
00016 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00017 
00025 require_once($CFG->dirroot.'/backup/util/xml/parser/processors/progressive_parser_processor.class.php');
00026 
00031 class findpaths_parser_processor extends progressive_parser_processor {
00032 
00033    protected $foundpaths; // array of paths foudn in the chunks received from the parser
00034 
00035    public function __construct() {
00036        parent::__construct();
00037        $this->foundpaths = array();
00038    }
00039 
00040    public function process_chunk($data) {
00041        if (isset($data['tags'])) {
00042            foreach ($data['tags'] as $tag) {
00043                $tagpath = $data['path'] . '/' . $tag['name'];
00044                if (!array_key_exists($tagpath, $this->foundpaths)) {
00045                    $this->foundpaths[$tagpath] = 1;
00046                } else {
00047                    $this->foundpaths[$tagpath]++;
00048                }
00049            }
00050        }
00051    }
00052 
00053    public function debug_info() {
00054        $debug = array();
00055        foreach($this->foundpaths as $path => $chunks) {
00056            $debug['paths'][$path] = $chunks;
00057        }
00058        return array_merge($debug, parent::debug_info());
00059    }
00060 }
 All Data Structures Namespaces Files Functions Variables Enumerations