public function showall_by_tags() { global $db; // get the tag being passed $tag = new expTag($this->params['tag']); // find all the id's of the blog posts for this blog module $item_ids = $db->selectColumn('filedownloads', 'id', $this->aggregateWhereClause()); // find all the blogs that this tag is attached to $items = $tag->findWhereAttachedTo('filedownload'); // loop the blogs for this tag and find out which ones belong to this module $items_by_tags = array(); foreach ($items as $item) { if (in_array($item->id, $item_ids)) { $items_by_tags[] = $item; } } // create a pagination object for the blog posts and render the action $order = 'created_at'; $limit = empty($this->config['limit']) ? 10 : $this->config['limit']; $page = new expPaginator(array('records' => $items_by_tags, 'limit' => $limit, 'order' => $order, 'controller' => $this->baseclassname, 'action' => $this->params['action'], 'columns' => array('Title' => 'title'))); assign_to_template(array('page' => $page, 'moduletitle' => 'File Downloads by tag "' . $this->params['tag'] . '"')); }
public function showall_by_tags() { global $db; // set history expHistory::set('viewable', $this->params); // get the tag being passed $tag = new expTag($this->params['tag']); // find all the id's of the blog posts for this blog module $port_ids = $db->selectColumn('portfolio', 'id', $this->aggregateWhereClause()); // find all the blogs that this tag is attached to $ports = $tag->findWhereAttachedTo('portfolio'); // loop the blogs for this tag and find out which ones belong to this module $ports_by_tags = array(); foreach ($ports as $port) { if (in_array($port->id, $port_ids)) { $ports_by_tags[] = $port; } } // create a pagination object for the blog posts and render the action $order = 'created_at'; $limit = empty($this->config['limit']) ? 10 : $this->config['limit']; $page = new expPaginator(array('records' => $ports_by_tags, 'limit' => $limit, 'order' => $order, 'controller' => $this->baseclassname, 'action' => $this->params['action'], 'columns' => array('Title' => 'title'))); $page->records = expSorter::sort(array('array' => $page->records, 'sortby' => 'rank', 'order' => 'ASC', 'ignore_case' => true)); assign_to_template(array('page' => $page)); }