public function onPreInit($param)
 {
     //parent::onPreInit($param);
     if (isset($_GET['idtm_organisation'])) {
         $openItem = $_GET['idtm_organisation'];
     } else {
         $openItem = 0;
     }
     $this->setUserStartId($this->user->getStartNode($this->user->getUserId($this->user->Name), "tm_organisation", $openItem));
     $res = mysql_connect($this->Application->Parameters['Host'], $this->Application->getModule('db1')->database->getUsername(), $this->Application->getModule('db1')->database->getPassword());
     mysql_select_db($this->Application->Parameters['Database']);
     //$tree = new TreeConnector($this->DBConnection);
     $tree = new TreeConnector($res);
     $tree->set_encoding("UTF-8");
     $tree->enable_log("temp.log", true);
     $mySQL = "SELECT idtm_organisation,parent_idtm_organisation,CONCAT(org_name,' ',IF(ISNULL(org_vorname),'',org_vorname)) AS org_name,idta_organisation_type FROM tm_organisation";
     $mySQLOrderBy = " ORDER BY parent_idtm_organisation";
     $this->load_all_cats($mySQL . $mySQLOrderBy);
     //the start ID
     $mySQLcond1 = "idtm_organisation IN (" . $this->subCategory_list($this->subcats, $this->UserStartId) . "," . $this->parentCategory_list($this->parentcats, $this->UserStartId) . ")";
     function custom_format($data)
     {
         $data->set_image("org" . $data->get_value("idta_organisation_type") . ".gif");
         //$data->setUserData("open",$data->get_value("idtm_organisation")==$openItem?"1":"0");
     }
     $tree->event->attach("beforeRender", custom_format);
     $SQLComp = $mySQL . " WHERE " . $mySQLcond1 . " AND org_aktiv = 1";
     //.$mySQLOrderBy
     $tree->dynamic_loading(true);
     //$tree->render_table("tm_struktur", "idtm_struktur", "struktur_name", "parent_idtm_struktur");
     $tree->render_sql($SQLComp, "idtm_organisation", "org_name,idta_organisation_type", "", "parent_idtm_organisation");
 }
 public function onPreInit($param)
 {
     //$UserStartId = $this->setUserStartId($this->user->getStartNode($this->user->getUserId($this->user->Name),"ta_perioden"));
     $res = mysql_connect($this->Application->Parameters['Host'], $this->Application->getModule('db1')->database->getUsername(), $this->Application->getModule('db1')->database->getPassword());
     mysql_select_db($this->Application->Parameters['Database']);
     $tree = new TreeConnector($res);
     $tree->set_encoding("UTF-8");
     $tree->enable_log("temp.log", false);
     $mySQL = "SELECT idta_perioden,parent_idta_perioden,per_extern FROM ta_perioden";
     $mySQLOrderBy = " ORDER BY parent_idta_perioden ASC,per_intern ASC";
     $SQLComp = $mySQL . $mySQLOrderBy;
     //$tree->dynamic_loading(true);
     //$tree->render_table("tm_struktur", "idtm_struktur", "struktur_name", "parent_idtm_struktur");
     $tree->render_sql($SQLComp, "idta_perioden", "per_extern", "", "parent_idta_perioden");
 }
 public function __construct($res, $type = false, $item_type = false, $data_type = false, $render_type = false)
 {
     if (!$render_type) {
         $render_type = "GroupRenderStrategy";
     }
     parent::__construct($res, $type, $item_type, $data_type, $render_type);
 }
 public function __construct($res, $type = false, $item_type = false, $data_type = false)
 {
     $data_type = "TreeDataProcessor";
     parent::__construct($res, $type, $item_type, $data_type);
     $this->event->attach("beforeProcessing", array($this, 'id_translate_before'));
     $this->event->attach("afterProcessing", array($this, 'id_translate_after'));
 }
 public function onPreInit($param)
 {
     parent::onPreInit($param);
     if (isset($_GET['idtm_activity'])) {
         $openItem = $_GET['idtm_activity'];
     } else {
         $openItem = 1;
     }
     if (isset($_GET['idta_activity_type'])) {
         if ($_GET['idta_activity_type'] != '') {
             $mySQLcond1 = "idta_activity_type = " . $_GET['idta_activity_type'] . " AND ";
         } else {
             $mySQLcond1 = '';
         }
     } else {
         $mySQLcond1 = '';
     }
     if (isset($_GET['idtm_activity_start'])) {
         $this->setUserStartId($_GET['idtm_activity_start']);
     } else {
         $this->setUserStartId($this->user->getStartNode($this->user->getUserId($this->user->Name), "tm_activity"));
     }
     //        $this->DBConnection = new TDbConnection($this->Application->getModule('db1')->database->getConnectionString(),$this->Application->getModule('db1')->database->getUsername(),$this->Application->getModule('db1')->database->getPassword());
     //        $this->DBConnection->Active = true;
     $res = mysql_connect($this->Application->Parameters['Host'], $this->Application->getModule('db1')->database->getUsername(), $this->Application->getModule('db1')->database->getPassword());
     mysql_select_db($this->Application->Parameters['Database']);
     //$tree = new TreeConnector($this->DBConnection);
     $tree = new TreeConnector($res);
     $tree->set_encoding("UTF-8");
     $tree->enable_log("temp.log", false);
     $mySQL = "SELECT idtm_activity,parent_idtm_activity,act_name,idta_activity_type FROM tm_activity";
     $mySQLOrderBy = " ORDER BY parent_idtm_activity ASC,act_name ASC,act_step";
     $this->load_all_cats($mySQL . $mySQLOrderBy);
     //the start ID
     $mySQLcond1 .= "idtm_activity IN (" . $this->subCategory_list($this->subcats, $this->UserStartId) . "," . $this->parentCategory_list($this->parentcats, $this->UserStartId) . ")";
     function custom_format($data)
     {
         $data->set_image("s" . $data->get_value("idta_activity_type") . ".gif");
         //$data->setUserData("open",$data->get_value("idtm_organisation")==$openItem?"1":"0");
     }
     $tree->event->attach("beforeRender", custom_format);
     $SQLComp = $mySQL . " WHERE " . $mySQLcond1 . $mySQLOrderBy;
     $tree->dynamic_loading(true);
     //$tree->render_table("tm_struktur", "idtm_struktur", "struktur_name", "parent_idtm_struktur");
     $tree->render_sql($SQLComp, "idtm_activity", "act_name,idta_activity_type", "", "parent_idtm_activity");
 }
<?php

require_once "../config.php";
$res = mysql_connect($mysql_server, $mysql_user, $mysql_pass);
mysql_select_db($mysql_db);
function child_setter($data)
{
    //the check is kind of lame, in real table you most probably may have some more stable way to detect is item have childs or not
    if ($data->get_value("taskId") % 100 > 1) {
        $data->set_kids(false);
    } else {
        $data->set_kids(true);
    }
}
require "../../codebase/tree_connector.php";
$tree = new TreeConnector($res);
$tree->enable_log("temp.log", true);
$tree->event->attach("beforeRender", "child_setter");
$tree->render_table("tasks", "taskId", "taskName", "", "parentId");
 public function render()
 {
     $this->dload = true;
     return parent::render();
 }
 public function __construct($res, $type = false, $item_type = false, $data_type = false)
 {
     parent::__construct($res, $type, $item_type, $data_type);
     $this->event->attach("beforeProcessing", array($this, 'check_id'));
 }
<?php

require_once "../config.php";
$res = mysql_connect($mysql_server, $mysql_user, $mysql_pass);
mysql_select_db($mysql_db);
require "../../codebase/tree_connector.php";
$tree = new TreeConnector($res);
//
function my_check($action)
{
    if (strlen($action->get_value("taskName")) < 5) {
        $action->invalid();
    }
}
$tree->event->attach("beforeProcessing", my_check);
$tree->render_table("tasks", "taskId", "taskName", "", "parentId");
<?php

require_once "../config.php";
$res = mysql_connect($mysql_server, $mysql_user, $mysql_pass);
mysql_select_db($mysql_db);
require "../../codebase/tree_connector.php";
$tree = new TreeConnector($res);
//
$tree->dynamic_loading(true);
$tree->render_table("tasks", "taskId", "taskName", "", "parentId");
<?php

require_once "../config.php";
$res = mysql_connect($mysql_server, $mysql_user, $mysql_pass);
mysql_select_db($mysql_db);
require "../../codebase/tree_connector.php";
$tree = new TreeConnector($res);
//
$tree->render_sql("SELECT taskId,taskName from tasks WHERE complete>49", "taskId", "taskName", "", "parentId");
 public function onPreInit($param)
 {
     //parent::onPreInit($param);
     if (isset($_GET['idta_stammdatensicht'])) {
         $openItem = $_GET['idta_stammdatensicht'];
     } else {
         $openItem = 1;
     }
     $this->setUserStartId($this->user->getStartNode($this->user->getUserId($this->user->Name), "tm_struktur", $openItem));
     $res = mysql_connect($this->Application->Parameters['Host'], $this->Application->getModule('db1')->database->getUsername(), $this->Application->getModule('db1')->database->getPassword());
     mysql_select_db($this->Application->Parameters['Database']);
     //$tree = new TreeConnector($this->DBConnection);
     $tree = new TreeConnector($res);
     $tree->set_encoding("UTF-8");
     $tree->enable_log("temp.log", false);
     $mySQL = "SELECT idtm_struktur,parent_idtm_struktur,struktur_name,idta_struktur_type,(struktur_rgt - struktur_lft) AS struktur_rgt FROM vv_struktur";
     $mySQLOrderBy = " ORDER BY idta_struktur_type, struktur_name";
     $mySQLcond1 = "";
     //the start ID
     $numberofstructureelements = StrukturRecord::finder()->count();
     if ($numberofstructureelements > 1) {
         $MaxRecord = StrukturRecord::finder()->findBySql('SELECT MAX(struktur_rgt) AS struktur_rgt FROM tm_struktur');
         if (is_Object($MaxRecord)) {
             $maxrgtvalue = $MaxRecord->struktur_rgt;
         } else {
             $maxrgtvalue = 0;
         }
         if ($numberofstructureelements * 2 <= $maxrgtvalue) {
             $StrStartRecord = StrukturRecord::finder()->findByidtm_struktur($this->UserStartId);
             $mySQLcond1 = "(struktur_lft BETWEEN " . $StrStartRecord->struktur_lft . " AND " . $StrStartRecord->struktur_rgt . ")";
             $mySQLcond1 .= " OR idtm_struktur IN ( " . $this->parentCategory_list_Nested($this->UserStartId) . ")";
         } else {
             $this->load_all_cats($mySQL . $mySQLOrderBy);
             $mySQLcond1 = "idtm_struktur IN (" . $this->subCategory_list($this->subcats, $this->UserStartId) . "," . $this->parentCategory_list($this->parentcats, $this->UserStartId) . ")";
         }
         $tmp_Strukturfilter = $this->user->getStartNode($this->user->getUserId($this->user->Name), "ta_stammdaten_group");
         if ($tmp_Strukturfilter > 0 and $tmp_Strukturfilter != StammdatenGroupRecord::finder()->findByparent_idta_stammdaten_group(0)->idta_stammdaten_group) {
             $tsgroup = "";
             $loopcounter = 0;
             while ($this->checkMyParent($tmp_Strukturfilter) > 0) {
                 if ($loopcounter == 0) {
                     $tsgroup .= $tmp_Strukturfilter;
                 } else {
                     $tsgroup .= "," . $tmp_Strukturfilter;
                 }
                 $loopcounter++;
                 $tmp_Strukturfilter = $this->checkMyParent($tmp_Strukturfilter);
             }
             $mySQLcond1 .= " AND idta_stammdaten_group IN (" . $tsgroup . ", " . StammdatenGroupRecord::finder()->findByparent_idta_stammdaten_group(0)->idta_stammdaten_group . ")";
         }
     }
     function custom_format($item)
     {
         $item->set_image("s" . $item->get_value("idta_struktur_type") . ".gif");
         if ($item->get_value("struktur_rgt") > 1) {
             $item->set_kids(true);
         } else {
             $item->set_kids(false);
         }
     }
     $tree->event->attach("beforeRender", 'custom_format');
     $SQLComp = $mySQL;
     if ($mySQLcond1 != '') {
         $SQLComp .= " WHERE (" . $mySQLcond1 . ") AND idta_stammdatensicht = " . $openItem;
         //.$mySQLOrderBy
     } else {
         $SQLComp .= " WHERE idta_stammdatensicht = " . $openItem;
     }
     $tree->dynamic_loading(true);
     //$tree->render_table("tm_struktur", "idtm_struktur", "struktur_name", "parent_idtm_struktur");
     $tree->render_sql($SQLComp, "idtm_struktur", "struktur_name,idta_struktur_type", "", "parent_idtm_struktur");
 }
<?php

require_once "../config.php";
$res = mysql_connect($mysql_server, $mysql_user, $mysql_pass);
mysql_select_db($mysql_db);
require "../../codebase/tree_connector.php";
$tree = new TreeConnector($res);
$tree->enable_log("temp.log", true);
$tree->render_sql("SELECT taskId,taskName from tasks WHERE complete>49", "taskId", "taskName", "", "parentId");
<?php

require_once "../config.php";
$res = mysql_connect($mysql_server, $mysql_user, $mysql_pass);
mysql_select_db($mysql_db);
require "../../codebase/tree_connector.php";
$tree = new TreeConnector($res);
$tree->enable_live_update('actions_table');
$tree->enable_log("temp.log", true);
$tree->render_table("tasks", "taskId", "taskName", "", "parentId");