Source for file MED_CATEGORY.phpclass
Documentation is available at MED_CATEGORY.phpclass
* Class file MED_CATEGORY.phpclass
* @project Open CSP-Management
* @category category-tree
* @author Peter Krebs (pk) <p.krebs@lvus.at>
* @copyright (c) 2002-2003 by Peter Krebs and Landesverlag Unternehmensservice
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
require_once __OCSP_PHPINCPATH__.
"db/dbms_tree.phpclass";
require_once __OCSP_PHPINCPATH__.
"default_config/media.conf.phpinc";
require_once $GLOBALS['MED']['PHPINCPATH'].
"MED_MIMETYPE.phpclass";
require_once $GLOBALS['MED']['PHPINCPATH'].
"MED_CATEGORY_NODE.phpclass";
* @var string $myGlobalTreeKey index in $GLOABLS['DBMS_TREE'][]
* @staticvar string $myTable
* @staticvar string $myIdFld id column = root
* @staticvar string $myParentFld name of the parent column
* @staticvar string $mySortFld name of the sort field
* @var string $myChildClass
* @var int $projId CMS_PROJECT (-1 == all)
* @var boolean $addDefaultProj show project and default project (PROJ_ID=0)
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// object var access methods
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
* returns if we have set a projId
if ($this->projId > -
1) return TRUE;
* @param boolean $onOff on TRUE off =FALSE
* @param &DBMS_TREE_NODE $child
$child->set_projId($this->projId);
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
function populate($useCache=
TRUE,$debug=
FALSE,$filtered=
FALSE) {
if ($debug) echo
"<hr /><p><b>DBMS_TREE::populate(".
($useCache ?
"USECACHE" :
"NOCACHE").
")</b> (".
get_class($this).
")</p><blockquote>";
$s_query =
"SELECT * FROM ".
$this->myTable;
$s_query.=
" WHERE ".
$this->myParentFld.
"=".
$this->getRootId(); // IDs are integer COLUMNS and VALUES
foreach($keyCols as $col) {
$s_query.=
" AND ".
$col.
" = ".
$GLOBALS[$this->get_gDBIDX()]->qs_getSlashedValue($this->getKey($col));
$s_query.=
" OR PROJ_ID=0";
$s_query.=
" AND ".
$s_Col.
"=".
$GLOBALS[$this->get_gDBIDX()]->qs_getSlashedValue($s_Val);
if ($debug) echo
"<pre sytle='font-size:10px'>DB: ".
$this->get_gDBIDX().
"\n$s_query</pre>";
if ($cursor=
$GLOBALS[$this->get_gDBIDX()]->query($s_query)) {
while($row =
$cursor->fetchArrayFld()) {
if ($debug) echo
"<p>using <b>cached object</b></p>";
// send 0 as id to avoid reselecting the node from the database
$cmd=
"\$tmpObj=new ".
$this->myChildClass.
"(0,\"".
$this->get_gDBIDX().
"\",".
($debug ?
"TRUE" :
"FALSE").
");"; /* <pk-04-12-21 /> */
if ($debug) echo
"<pre style='font-size:10px;'>CHILD NEW:\n$cmd</pre><blockquote>";
if ($debug) echo
"</blockquote>";
if ($debug) echo
"<p>Object Nr $noc created<br />".
print_r(implode(";",$row),TRUE).
"</p>";
$tmpObj->setDBRow($row,TRUE,FALSE); // no debug
$tmpObj->setOrderNr($noc);
if ($debug) echo
"<blockquote><pre>".
print_r($tmpObj->getDBVal()).
"</pre></blockquote>";
if ($debug) echo
"<p style='font-size: 11px;'>Setting GLOBALS['DBMS_TREE'][".
$this->getGlobalTreeKey().
"][".
$row[$this->myIdFld].
"]</p>";
// copies tmpObj -> do not manipulate $tmpObj from here !!!!!
if ($debug) echo
"</blockquote>";
* returns a html code to use in select elements
* @param MED_CATEGORY_NODE $rootNode
if ($debug) echo
"<hr><blockquote><pre>".
pcf_print_r($nodeArr,TRUE,3).
"</pre></blockquote>";
$ret.=
"<option value=".
$rootNode->getId().
">".
$rootNode->getDBField("MEC_NAME").
"</option>\n";
foreach($nodeArr as $node) {
$ret.=
"<option value=".
$node['NODEID'];
if ($selectedId==
$node['NODEID']) $ret.=
" selected";
$ret.=
">".
$node['INTEND'].
$node['INDEX'].
" ".
$node['NODENAME'].
"</option>\n";
Documentation generated on Thu, 08 Jan 2009 17:44:38 +0100 by phpDocumentor 1.4.0a2