22
Old modules using xoopstree may not have classes and being so, they are not able to use tree.php (requires objects/classes).
In the new mytabs, plugins must use tree.php. Xoopstube(for example) does not have a class so I had to make a quick fix! Here is how I did it (I added a fake class):
function xoopstube_catinfo($option, $selected_cat = 0)
{
global $xoopsDB;
include_once XOOPS_ROOT_PATH.'/modules/mytabs/class/tree.php';
$sql = "SELECT * FROM " . $xoopsDB->prefix( 'xoopstube_cat' );
$result = $xoopsDB->query($sql);
while ($row = $xoopsDB->fetchArray($result)) {
$allTopics[] = new XoopstubeTemp($row);
}
$topic_tree = new MytabsObjectTree($allTopics, 'cid', 'pid');
$ret = $topic_tree->makeSelBox($option, 'title', '-- ', $selected_cat, false, 0, true);
return $ret;
}
//we need a class for our MytabsObjectTree so let us create a simple one!
class XoopstubeTemp extends XoopsObject
{
/**
* constructor
*/
function XoopstubeTemp($row)
{
$this->XoopsObject();
$this->initVar("cid", XOBJ_DTYPE_INT, $row['cid']);
$this->initVar("pid", XOBJ_DTYPE_INT, $row['pid']);
$this->initVar('title', XOBJ_DTYPE_TXTBOX, $row['title']);
}
}