Moosh\Command\Moodle26\Category\CategoryImport::start_element PHP Method

start_element() public method

public start_element ( $parser, $name, $attrs )
    public function start_element($parser, $name, $attrs)
    {
        $current = end($this->categorystack);
        if ($name == 'CATEGORY') {
            echo "Creating new category " . $attrs['NAME'] . " under {$current}\n";
            $category = new \stdClass();
            $category->name = $attrs['NAME'];
            $category->parent = $current;
            $newcat = $this->create_category($category);
            if (isset($attrs['OLDID'])) {
                $this->coursesmap[$attrs['OLDID']] = $newcat->id;
            }
            $this->categorystack[] = $newcat->id;
        }
    }