diff --git a/lib/listlib.php b/lib/listlib.php index 7f6994f6c9f..5d8bc55c560 100644 --- a/lib/listlib.php +++ b/lib/listlib.php @@ -109,10 +109,11 @@ class moodle_list{ if ($pageurl === null){ $this->pageurl = new moodle_url(); + $this->pageurl->params(array($this->pageparamname => $this->page)); } else { $this->pageurl = $pageurl; } - $this->pageurl->params(array($this->pageparamname => $this->page)); + } /** @@ -244,7 +245,7 @@ class moodle_list{ */ function display_page_numbers() { if (!empty($this->page) && ($this->pagecount>1)){ - echo "
' . $category->name . '('.$category->questioncount.')'. '';
@@ -63,15 +58,15 @@ class question_category_list_item extends list_item {
if (!empty($category->publish)) {
- $item .= '
+ $item .= '
';
} else {
- $item .= '
+ $item .= '
';
}
if ($category->id != $extraargs['defaultcategory']->id) {
- $item .= '
+ $item .= '
';
}
@@ -105,15 +100,17 @@ class question_category_object {
var $categorystrings;
var $defaultcategory;
//------------------------------------------------------
+ /**
+ * @var moodle_url Object representing url for this page
+ */
var $pageurl;
- var $pageparams = array();
/**
* Constructor
*
* Gets necessary strings and sets relevant path information
*/
- function question_category_object($page) {
+ function question_category_object($page, $pageurl) {
global $CFG, $COURSE;
$this->tab = str_repeat(' ', $this->tabsize);
@@ -141,62 +138,14 @@ class question_category_object {
$this->str->page = get_string('page');
$this->pixpath = $CFG->pixpath;
- $this->editlist = new question_category_list('ul', '', true, $page);
+ $this->editlist = new question_category_list('ul', '', true, $page, $pageurl, 'cpage');
- $this->add_page_params(array('courseid'=>$COURSE->id, 'page' => $this->page));
- $this->pageurl = strip_querystring(qualified_me());//default
+ $this->pageurl = $pageurl;
$this->initialize();
}
- /**
- * Add an array of params to the params for this page.
- *
- * @param unknown_type $params
- */
- function add_page_params($params){
- $this->pageparams = $params + $this->pageparams;
- $this->editlist->add_page_params($params);
- }
-
- /**
- * Get url and query string for an action on this page (get_url() + sesskey)
- *
- * @param array $overrideparams an array of params which override $this->pageparams
- * @return string
- */
- function get_action_url($overrideparams = array()){
- global $USER;
-
- $arr = array();
- $paramarray = $overrideparams + $this->pageparams + array('sesskey'=>$USER->sesskey);
- foreach ($paramarray as $key => $val){
- $arr[] = urlencode($key)."=".urlencode($val);
- }
- $params = implode($arr, "&");
-
- return $this->pageurl.'?'.$params;
- }
-
- /**
- * Get url and query string for this page
- *
- * @param array $overrideparams an array of params which override $this->pageparams
- * @return string
- */
- function get_url($overrideparams = array()){
-
- $arr = array();
- $paramarray = $overrideparams + $this->pageparams;
- foreach ($paramarray as $key => $val){
- $arr[] = urlencode($key)."=".urlencode($val);
- }
- $params = implode($arr, "&");
-
- return $this->pageurl.'?'.$params;
- }
-
/**
* Displays the user interface
*
@@ -284,7 +233,7 @@ class question_category_object {
echo '