function __construct(Doc_Book $book, array $chapter, $filename) { $this->book = $book; parent::__construct($chapter['subject'], $book->source_dir, $filename); if (!empty($chapter['sections']) && is_array($chapter['sections'])) { foreach ($chapter['sections'] as $sec_filename => $sec_subject) { if (is_array($sec_subject)) { $this->has_groups = true; $group_name = trim($sec_filename, '"'); $sections_t = $sec_subject; foreach ($sections_t as $sec_filename => $sec_subject) { $sec_filename = $filename . '-' . $sec_filename; $section = new Doc_Section($this, $sec_subject, $sec_filename, $group_name); $this->sections[] = $section; $this->book->sections[] = $section; $this->groups[$group_name][] = $section; } } else { $sec_filename = $filename . '-' . $sec_filename; $section = new Doc_Section($this, $sec_subject, $sec_filename); $this->sections[] = $section; $this->groups['default'][] = $section; $this->book->sections[] = $section; } } } }
function __construct(array $book, $source_dir) { parent::__construct($book['subject'], $source_dir, 'cover'); $this->name = $book['name']; if (isset($book['columns'])) { $this->columns = $book['columns']; } foreach ($book['chapters'] as $filename => $chapter) { $this->chapters[] = new Doc_Chapter($this, $chapter, $filename); } }
function __construct(Doc_Chapter $chapter, $subject, $filename, $group_name = '') { $this->chapter = $chapter; $this->group_name = trim($group_name, '"'); parent::__construct($subject, $chapter->source_dir, $filename); }