Book module local lib functions
Copyright: | 2010-2011 Petr Skoda {@link http://skodak.org} |
License: | http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later |
File Size: | 706 lines (28 kb) |
Included or required: | 11 times |
Referenced: | 5 times |
Includes or requires: | 1 file mod/book/lib.php |
book_file_info:: (10 methods):
__construct()
get_params()
get_visible_name()
is_writable()
is_directory()
get_children()
get_filtered_children()
get_non_empty_children()
count_non_empty_children()
get_parent()
Class: book_file_info - X-Ref
File browsing support class__construct($browser, $course, $cm, $context, $areas, $filearea) X-Ref |
Constructor param: file_browser $browser file_browser instance param: stdClass $course course object param: stdClass $cm course module object param: stdClass $context module context param: array $areas available file areas param: string $filearea file area to browse |
get_params() X-Ref |
Returns list of standard virtual file/directory identification. The difference from stored_file parameters is that null values are allowed in all fields return: array with keys contextid, filearea, itemid, filepath and filename |
get_visible_name() X-Ref |
Returns localised visible name. return: string |
is_writable() X-Ref |
Can I add new files or directories? return: bool |
is_directory() X-Ref |
Is directory? return: bool |
get_children() X-Ref |
Returns list of children. return: array of file_info instances |
get_filtered_children($extensions = '*', $countonly = false, $returnemptyfolders = false) X-Ref |
Help function to return files matching extensions or their count param: string|array $extensions, either '*' or array of lowercase extensions, i.e. array('.gif','.jpg') param: bool|int $countonly if false returns the children, if an int returns just the param: bool $returnemptyfolders if true returns items that don't have matching files inside return: array|int array of file_info instances or the count |
get_non_empty_children($extensions = '*') X-Ref |
Returns list of children which are either files matching the specified extensions or folders that contain at least one such file. param: string|array $extensions, either '*' or array of lowercase extensions, i.e. array('.gif','.jpg') return: array of file_info instances |
count_non_empty_children($extensions = '*', $limit = 1) X-Ref |
Returns the number of children which are either files matching the specified extensions or folders containing at least one such file. param: string|array $extensions, for example '*' or array('.gif','.jpg') param: int $limit stop counting after at least $limit non-empty children are found return: int |
get_parent() X-Ref |
Returns parent file_info instance return: file_info or null for root |
book_preload_chapters($book) X-Ref |
Preload book chapters and fix toc structure if necessary. Returns array of chapters with standard 'pagenum', 'id, pagenum, subchapter, title, content, contentformat, hidden' and extra 'parent, number, subchapters, prev, next'. Please note the content/text of chapters is not included. param: stdClass $book return: array of id=>chapter |
book_get_chapter_title($chid, $chapters, $book, $context) X-Ref |
Returns the title for a given chapter param: int $chid param: array $chapters param: stdClass $book param: context_module $context return: string |
book_add_fake_block($chapters, $chapter, $book, $cm, $edit = null) X-Ref |
Add the book TOC sticky block to the default region. param: array $chapters The Chapters in the book param: stdClass $chapter The current chapter param: stdClass $book The book param: stdClass $cm The course module param: bool|null $edit Whether the user is editing |
book_get_toc($chapters, $chapter, $book, $cm, $edit) X-Ref |
Generate toc structure param: array $chapters param: stdClass $chapter param: stdClass $book param: stdClass $cm param: bool $edit return: string |
mod_book_get_tagged_chapters($tag, $exclusivemode = false, $fromctx = 0, $ctx = 0, $rec = true, $page = 0) X-Ref |
Returns book chapters tagged with a specified tag. This is a callback used by the tag area mod_book/book_chapters to search for book chapters tagged with a specific tag. param: core_tag_tag $tag param: bool $exclusivemode if set to true it means that no other entities tagged with this tag param: int $fromctx context id where the link was displayed, may be used by callbacks param: int $ctx context id where to search for records param: bool $rec search in subcontexts as well param: int $page 0-based number of page being displayed return: \core_tag\output\tagindex |