Get all front page books

@param Bookboon $bookboon
@param array $bookTypes
@return BookboonResponse
@throws UsageException
@throws \Bookboon\Api\Exception\ApiDecodeException
344096
public static function get(Bookboon $bookboon, array $bookTypes = ['pdf']) : BookboonResponse
    {
        $bResponse = $bookboon->rawRequest("/frontpage", ['bookType' => join(',', $bookTypes)]);

        $bResponse->setEntityStore(
            new EntityStore(Frontpage::getEntitiesFromArray($bResponse->getReturnArray()))
        );

        return $bResponse;
    }
598157
public function getPages()
    {
        $pages = array();

        foreach ($this->children as $child) {
            if ($child instanceof SwatNoteBookChild) {
                $pages = array_merge($pages, $child->getPages());
            }
        }

        return $pages;
    }
64366
public function updateBook(Google_BooksCloudloadingResource $postBody, $optParams = array()) {
      $params = array('postBody' => $postBody);
      $params = array_merge($params, $optParams);
      $data = $this->__call('updateBook', array($params));
      if ($this->useObjects()) {
        return new Google_BooksCloudloadingResource($data);
      } else {
        return $data;
      }
    }
798854
public function getBookTerms( $url ) {
		$terms = [];

		foreach ( [ 'front-matter-type', 'chapter-type', 'back-matter-type', 'glossary-type' ] as $taxonomy ) {
			// Handle request (local or global)
			$response = $this->handleGetRequest(
				$url, 'pressbooks/v2', "$taxonomy", [
					'per_page' => 25,
				]
			);

			if ( is_wp_error( $response ) ) {
				continue;
			}

			// Remove links
			unset( $response['_links'] );

			// Process response
			$terms = array_merge( $terms, $response );
		}

		if ( empty( $terms ) ) {
			$_SESSION['pb_errors'][] = sprintf( '<p>%1$s</p>', __( 'The source book&rsquo;s taxonomies could not be read.', 'pressbooks' ) );
		}

		return $terms;
	}
828097
public static function get_books_by_courses($courseids = array()) {
        global $CFG;

        $returnedbooks = array();
        $warnings = array();

        $params = self::validate_parameters(self::get_books_by_courses_parameters(), array('courseids' => $courseids));

        $courses = array();
        if (empty($params['courseids'])) {
            $courses = enrol_get_my_courses();
            $params['courseids'] = array_keys($courses);
        }

        // Ensure there are courseids to loop through.
        if (!empty($params['courseids'])) {

            list($courses, $warnings) = external_util::validate_courses($params['courseids'], $courses);

            // Get the books in this course, this function checks users visibility permissions.
            // We can avoid then additional validate_context calls.
            $books = get_all_instances_in_courses("book", $courses);
            foreach ($books as $book) {
                $context = context_module::instance($book->coursemodule);
                // Entry to return.
                $bookdetails = array();
                // First, we return information that any user can see in the web interface.
                $bookdetails['id'] = $book->id;
                $bookdetails['coursemodule']      = $book->coursemodule;
                $bookdetails['course']            = $book->course;
                $bookdetails['name']              = external_format_string($book->name, $context->id);
                // Format intro.
                list($bookdetails['intro'], $bookdetails['introformat']) =
                    external_format_text($book->intro, $book->introformat, $context->id, 'mod_book', 'intro', null);
                $bookdetails['introfiles'] = external_util::get_area_files($context->id, 'mod_book', 'intro', false, false);
                $bookdetails['numbering']         = $book->numbering;
                $bookdetails['navstyle']          = $book->navstyle;
                $bookdetails['customtitles']      = $book->customtitles;

                if (has_capability('moodle/course:manageactivities', $context)) {
                    $bookdetails['revision']      = $book->revision;
                    $bookdetails['timecreated']   = $book->timecreated;
                    $bookdetails['timemodified']  = $book->timemodified;
                    $bookdetails['section']       = $book->section;
                    $bookdetails['visible']       = $book->visible;
                    $bookdetails['groupmode']     = $book->groupmode;
                    $bookdetails['groupingid']    = $book->groupingid;
                }
                $returnedbooks[] = $bookdetails;
            }
        }
        $result = array();
        $result['books'] = $returnedbooks;
        $result['warnings'] = $warnings;
        return $result;
    }
655320
public static function fetchAllPagesPageTypes()
    {
        $types = Symphony::Database()->fetch("SELECT `page_id`,`type` FROM `tbl_pages_types`");
        $page_types = array();

        if (is_array($types)) {
            foreach ($types as $type) {
                $page_types[$type['page_id']][] = $type['type'];
            }
        }

        return $page_types;
    }
60417
def get_child_classes(cls, slot, page, instance=None):
        """"""
        child_classes = super(BootstrapCardPlugin, cls).get_child_classes(slot, page, instance)
        # allow only one child of type Header, Body, Footer
        for child in instance.get_children():
            if child.plugin_type in child_classes:
                child_classes.remove(child.plugin_type)
        return child_classes
324173
protected function getTypesCollection()
    {
        if (null === $this->types) {
            $this->types = new Collection(
                array($this->type),
                $this->docblock ? $this->docblock->getContext() : null
            );
        }
        return $this->types;
    }
124353
protected function searchBooks( $request ) {

		if ( ! empty( $request['next'] ) ) {
			$this->lastKnownBookId = $request['next'];
		}

		$start_time = time();
		$searched_books = 0;
		$found_books = 0;
		$results = [];
		while ( $found_books < $request['per_page'] ) {
			$book_ids = $this->searchBookIds( $request );
			foreach ( $book_ids as $id ) {
				$node = $this->renderBook( $id, $request['search'] );
				if ( ! empty( $node ) ) {
					$response = rest_ensure_response( $node );
					$response->add_links( $this->linkCollector );
					$results[] = $this->prepare_response_for_collection( $response );
					$this->linkCollector = []; // re-initialize
					++$found_books;
				}
				++$searched_books;
				$this->lastKnownBookId = $id;
				if ( time() - $start_time > $this->maxSearchTime ) {
					break 2;
				}
			}
			if ( $searched_books >= $this->totalBooks ) {
				break;
			}
		}

		if ( ! $searched_books ) {
			$this->lastKnownBookId = 0;
		}

		return $results;
	}
760472
public function getPage($pageName, $pageType = PageTypes::NORMAL)
    {
        if ($this->pages->count() < 1) {
            return null;
        }

        /** @var \Rcm\Entity\Page $page */
        foreach ($this->pages as $page) {
            if ($page->getName() == $pageName
                && $page->getPageType() == $pageType
            ) {
                return $page;
            }
        }

        return null;
    }
22333
public function Pages()
    {
        $pages = SiteTree::get();
        $types = $this->PageTypes->getValue();
        if (count($types)) {
            $pages = $pages->filter('ClassName', $types);
        }

        $parents = $this->PageParents()->column('ID');
        if (count($parents)) {
            $pages = $pages->filter('ParentID', $parents);
        }

        return $pages;
    }
473188
public function submit(Bookboon $bookboon, string $bookId) : void
    {
        if (Entity::isValidUUID($bookId)) {
            $bookboon->rawRequest("/books/$bookId/review", $this->getData(), ClientInterface::HTTP_POST);
        }
    }
1284073
public static function recommendations(
        Bookboon $bookboon,
        array $bookIds = [],
        int $limit = 5,
        array $bookTypes = ['pdf']
    ) : BookboonResponse {
        $bResponse = $bookboon->rawRequest('/recommendations', ['limit' => $limit, 'book' => $bookIds, 'bookType' => join(',', $bookTypes)]);

        $bResponse->setEntityStore(
            new EntityStore(Book::getEntitiesFromArray($bResponse->getReturnArray()))
        );

        return $bResponse;
    }
155624
static function getAllSubsections( $book_structure ) {
		if ( Export::shouldParseSubsections() ) {
			$book_subsections_transient = \Pressbooks\Book::SUBSECTIONS_TRANSIENT;
			$subsection_processing_transient = \Pressbooks\Book::SUBSECTION_PROCESSING_TRANSIENT;
			$book_subsections = get_transient( $book_subsections_transient );
			if ( ! $book_subsections ) {
				$book_subsections = [];
				if ( ! get_transient( $subsection_processing_transient ) ) {
					set_transient( $subsection_processing_transient, 1, 5 * MINUTE_IN_SECONDS );
					foreach ( $book_structure['front-matter'] as $section ) {
						$subsections = \Pressbooks\Book::getSubsections( $section['ID'] );
						if ( $subsections ) {
							$book_subsections['front-matter'][ $section['ID'] ] = $subsections;
						}
					}
					foreach ( $book_structure['part'] as $key => $part ) {
						if ( ! empty( $part['chapters'] ) ) {
							foreach ( $part['chapters'] as $section ) {
								$subsections = \Pressbooks\Book::getSubsections( $section['ID'] );
								if ( $subsections ) {
									$book_subsections['chapters'][ $section['ID'] ] = $subsections;
								}
							}
						}
					}
					foreach ( $book_structure['back-matter'] as $section ) {
						$subsections = \Pressbooks\Book::getSubsections( $section['ID'] );
						if ( $subsections ) {
							$book_subsections['back-matter'][ $section['ID'] ] = $subsections;
						}
					}
					delete_transient( $subsection_processing_transient );
				}
			}
			set_transient( $book_subsections_transient, $book_subsections );
			return $book_subsections;
		}
		return [];
	}
557205
public static function getAll(Bookboon $bookboon) : BookboonResponse
    {
        $bResponse = $bookboon->rawRequest("/exams");

        $bResponse->setEntityStore(
            new EntityStore(static::getEntitiesFromArray($bResponse->getReturnArray()))
        );

        return $bResponse;
    }
929212
public function useBoostQueriesFromTypoScript(): QueryBuilder
    {
        $searchConfiguration = $this->typoScriptConfiguration->getSearchConfiguration();

        if (!empty($searchConfiguration['query.']['boostQuery'])) {
            return $this->useBoostQueries($searchConfiguration['query.']['boostQuery']);
        }

        if (!empty($searchConfiguration['query.']['boostQuery.'])) {
            $boostQueries = $searchConfiguration['query.']['boostQuery.'];
            return $this->useBoostQueries(array_values($boostQueries));
        }

        return $this;
    }
147860
public function getLastByMainnode(Page $page, $classnames = array())
    {
        try {
            $q = $this->createQueryBuilder('c');

            foreach ($classnames as $classname) {
                $q->orWhere('c INSTANCE OF '.  AbstractClassContent::getFullClassname($classname));
            }

            $q->andWhere('c._mainnode = :node')
                ->orderby('c._modified', 'desc')
                ->setMaxResults(1)
                ->setParameters(array('node' => $page))
            ;

            $entity = $q->getQuery()->getSingleResult();
        } catch (\Exception $e) {
            $entity = null;
        }

        return $entity;
    }