/** * Reorder a plugin * * @return void */ public function orderTask() { // Check for request forgeries Request::checkToken(); $id = Request::getVar('id', array(0), 'post', 'array'); \Hubzero\Utility\Arr::toInteger($id, array(0)); $uid = $id[0]; $inc = $this->_task == 'orderup' ? -1 : 1; $row = new Tables\Page($this->database); $row->load($uid); $row->move($inc, 'course_id=' . $this->database->Quote($row->course_id) . ' AND offering_id=' . $this->database->Quote($row->offering_id)); $row->reorder('course_id=' . $this->database->Quote($row->course_id) . ' AND offering_id=' . $this->database->Quote($row->offering_id)); $this->cancelTask(); }
/** * Get a list of pages for a course * * @param array $filters Filters to apply * @return array */ public function pages($filters = array()) { if (!isset($filters['course_id'])) { $filters['course_id'] = (int) $this->get('id'); } if (!isset($filters['offering_id'])) { $filters['offering_id'] = 0; } if (!isset($filters['sort'])) { $filters['sort'] = 'ordering'; } if (isset($filters['count']) && $filters['count']) { $tbl = new Tables\Page($this->_db); return $tbl->count($filters); } if (!isset($this->_pages) || !is_array($this->_pages)) { $tbl = new Tables\Page($this->_db); $results = array(); if ($data = $tbl->find($filters)) { foreach ($data as $key => $result) { $results[$result->url] = new Page($result); } } $this->_pages = $results; } return $this->_pages; }