public static function rebuild() { $index = self::create(); $itemTable = new Item(); $items = $itemTable->fetchAll(); foreach ($items as $item) { $tags = ''; foreach ($itemTable->findTags($item->id) as $tag) { $tags .= $tag->name . ' '; } self::_insert($index, $item, $tags); } }
public function editAction() { $this->logger->entering(); $this->logger->info('Loading most popular tags'); $toptags = Tag::findTopTags(); $this->logger->info('Loading the item by id'); $items = new Item(); $item = $items->find($this->_getParam('id'))->current(); $this->logger->info('Ensure user is item owner'); if ($item->owner_id != $this->session->user_id) { $this->logger->warn('User is not item owner'); $this->flash->notice = "Invalid Action"; $this->_redirect('/'); } $this->logger->info('Loading the view parameters'); $this->view->assign(array('title' => "Editing {$item->name}", 'item' => $item, 'tags' => Tag::joinTags($items->findTags($item->id)), 'toptags' => $toptags)); $this->logger->info('Rendering the application template'); /* echo $this->view->render('applicationTemplate.phtml'); */ $this->render(); $this->logger->exiting(); }