config = $config; $this->collections = $collections; $this->msg = $msg; } public function get_config_form(){ //A surcharger } public function get_config_form_script() { //A surcharger } protected function get_collections_tree(){ global $charset; global $base_path; if(empty($this->config['tree'])){ $this->config['tree'] = array(); } $result="
"; foreach($this->config['tree'] as $pos => $elem){ $result.=" "; } $result.="
".htmlentities($this->collections[$elem], ENT_QUOTES, $charset)."
"; return $result; } public function get_collections_tree_script() { global $base_path; return " var nb_tree_elems = ".count($this->config['tree'])."; function load_tree_elem(elem){ var selected_option = elem.selectedOptions[0]; if(selected_option.value){ var tr = document.createElement('tr'); document.getElementById('tree').appendChild(tr); tr.setAttribute('id','tree_elem_tr'+nb_tree_elems); var td = document.createElement('td'); td.setAttribute('recept','yes'); td.setAttribute('recepttype','tree_elem'); td.setAttribute('highlight','tree_elem_show_recept'); td.setAttribute('downlight','tree_elem_hide_recept'); td.setAttribute('id','tree_elem_td'+nb_tree_elems); td.setAttribute('draggable','yes'); td.setAttribute('callback_after','move_tree_elem'); td.setAttribute('dragtype','tree_elem'); td.setAttribute('dragicon','".get_url_icon('icone_drag_notice.png')."'); td.setAttribute('dragtext',selected_option.innerHTML); td.innerHTML = ' '+selected_option.innerHTML; tr.appendChild(td); var td = document.createElement('td'); td.setAttribute('onclick','tree_elem_delete(\"tree_elem_tr'+nb_tree_elems+'\")'); td.innerHTML = ''; tr.appendChild(td); nb_tree_elems++; init_drag(); document.getElementById('select_tree_elem').selectedIndex=0; } } function move_tree_elem(elem,evt,target){ if(target != 'false' || target != 'null'){ elem = elem.parentNode; target = document.getElementById(target).parentNode; parent = target.parentNode; parent.insertBefore(elem,target); } } function tree_elem_show_recept(obj){ obj.style.background='#DDD'; } function tree_elem_hide_recept(obj){ obj.style.background=''; } function tree_elem_delete(id){ document.getElementById(id).parentNode.removeChild(document.getElementById(id)); }"; } public static function update_config_from_form(){ global $tree; return array( 'tree' => $tree ); } }