Ejemplo n.º 1
0
 function process_actions($left, $right, $moveup, $movedown, $moveupcontext, $movedowncontext, $tocontext)
 {
     global $CFG;
     //parent::procces_actions redirects after any action
     parent::process_actions($left, $right, $moveup, $movedown);
     if ($tocontext == $this->context->id) {
         //only called on toplevel list
         if ($moveupcontext) {
             $cattomove = $moveupcontext;
             $totop = 0;
         } elseif ($movedowncontext) {
             $cattomove = $movedowncontext;
             $totop = 1;
         }
         $toparent = "0,{$this->context->id}";
         redirect($CFG->wwwroot . '/question/contextmove.php?' . $this->pageurl->get_query_string(compact('cattomove', 'totop', 'toparent')));
     }
 }
Ejemplo n.º 2
0
 public function __construct($type='ul', $attributes='', $editable = false, $pageurl=null, $page = 0, $pageparamname = 'page', $itemsperpage = 20, $context = null){
     parent::__construct('ul', '', $editable, $pageurl, $page, 'cpage', $itemsperpage);
     $this->context = $context;
 }
Ejemplo n.º 3
0
 /**
  * Returns html
  *
  * @param integer $indent
  * @param array $extraargs any extra data that is needed to print the list item
  *                            may be used by sub class.
  * @return string html
  */
 function to_html($indent = 0, $extraargs = array())
 {
     if (!$this->display) {
         return '';
     }
     $tabs = str_repeat("\t", $indent);
     if (isset($this->children)) {
         $childrenhtml = $this->children->to_html($indent + 1, $extraargs);
     } else {
         $childrenhtml = '';
     }
     return $this->item_html($extraargs) . ' ' . join($this->icons, '') . ($childrenhtml != '' ? "\n" . $childrenhtml : '');
 }
Ejemplo n.º 4
0
 /**
  * Recurse down tree creating list_items, called from moodle_list::list_from_records
  *
  * @param array $records
  * @param array $children
  * @param integer $thisrecordid
  */
 function create_children(&$records, &$children, $thisrecordid)
 {
     //keys where value is $thisrecordid
     $thischildren = array_keys($children, $thisrecordid);
     if (count($thischildren)) {
         foreach ($thischildren as $child) {
             $thisclass = get_class($this);
             $newlistitem =& new $thisclass($records[$child], $this->children, $this->attributes);
             $this->children->add_item($newlistitem);
             $newlistitem->create_children($records, $children, $records[$child]->id);
         }
     }
 }