Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function action_details($id = NULL) {
- if (is_null($id)) {
- throw new \MissingParamException('Missing book ID');
- }
- $book = $this->books->get_details($id, 'array');
- $this->data['id'] = $id;
- $this->data['title'] = $book['title'];
- if (\Arr::in_array_recursive('authors', $book)) {
- $author = $book['authors'];
- foreach ($author as $a) {
- \Arr::insert($tmp_a, $a->name, 0);
- }
- $this->data['authors'] = implode(',', $tmp_a);
- }
- if (\Arr::in_array_recursive('tags', $book)) {
- $tags = $book['tags'];
- $tmp_t = array();
- foreach ($tags as $t) {
- \Arr::insert($tmp_t, $t->name, 0);
- }
- $this->data['tags'] = implode(',', $tmp_t);
- }
- if (\Arr::in_array_recursive('genres', $book)) {
- $tmp_g = array();
- $genre = $book['genres'];
- foreach ($genre as $g) {
- \Arr::insert($tmp_g, $g->name, 0);
- }
- $this->data['genres'] = implode(',', $tmp_g);
- }
- \Debug::dump($book);
- \Debug::dump($this->data);
- return View::forge('owmx5/books/details.twig', $this->data);
- }
Advertisement
Add Comment
Please, Sign In to add comment