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 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); 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"); }