1<?php 2 3class module_bookmarks extends Module 4{ 5 var $template; 6 var $startlevel; 7 8 function module_bookmarks() 9 { 10 $this->title = lang('Bookmarks'); 11 $this->description = lang('This module displays bookmarks in a javascript based tree'); 12 $this->cookie = array('expanded'); 13 $this->arguments = array( 14 'category' => array( 15 'type' => 'select', 16 'label' => lang('Choose the categories to display'), 17 'options' => array(), 18 'multiple' => True 19 ) 20 ); 21 } 22 23 function get_user_interface() 24 { 25 $cat = createobject('phpgwapi.categories','','bookmarks'); 26 $cats = $cat->return_array('all',0,False,'','cat_name','',True); 27 $cat_ids = array(); 28 while (list(,$category) = @each($cats)) 29 { 30 $cat_ids[$category['id']] = $GLOBALS['phpgw']->strip_html($category['name']); 31 } 32 $this->arguments['category']['options'] = $cat_ids; 33 return parent::get_user_interface(); 34 } 35 36 function set_block(&$block,$produce=False) 37 { 38 parent::set_block($block,$produce); 39 40 if ($produce) 41 { 42 require_once(PHPGW_INCLUDE_ROOT . SEP . 'sitemgr' . SEP . 'inc' . SEP . 'class.xslt_transform.inc.php'); 43 $this->add_transformer(new xslt_transform( 44 $this->find_template_dir() . SEP . 'xbel.xsl', 45 array('blockid' => $this->block->id) 46 )); 47 } 48 } 49 50 function get_content(&$arguments,$properties) 51 { 52 if ($arguments['expanded']) 53 { 54 $expandedcats = array_keys($arguments['expanded']); 55 } 56 else 57 { 58 $expandedcats = Array(); 59 } 60 $bo = createobject('bookmarks.bo'); 61 return $bo->export($arguments['category'],'xbel',$expandedcats); 62 } 63} 64