123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- <?php
- class ProcessLayersMenu extends LayersMenuCommon
- {
- function ProcessLayersMenu()
- {
- $this->LayersMenuCommon();
- }
- function setDirroot($dirroot)
- {
- return $this->setDirrootCommon($dirroot);
- }
- function getMenuStructure(
- $menu_name = '', // non consistent default...
- $separator = '|'
- )
- {
- $menuStructure = '';
- for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) {
- $menuStructure .= str_repeat('.', $this->tree[$cnt]['level']);
- $menuStructure .= $separator;
- $menuStructure .= $this->tree[$cnt]['text'];
- $menuStructure .= $separator;
- $menuStructure .= $this->tree[$cnt]['href'];
- $menuStructure .= $separator;
- $menuStructure .= $this->tree[$cnt]['title'];
- $menuStructure .= $separator;
- $menuStructure .= $this->tree[$cnt]['icon'];
- $menuStructure .= $separator;
- $menuStructure .= $this->tree[$cnt]['target'];
- $menuStructure .= $separator;
- $menuStructure .= $this->tree[$cnt]['expanded'];
- $menuStructure .= "\n";
- }
- return $menuStructure;
- }
- function getSQLDump(
- $menu_name = '', // non consistent default...
- $db_type = ''
- )
- {
- $SQLDump = '';
- for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) {
- $current_node[$this->tree[$cnt]['level']] = $cnt;
- if (!$this->tree[$cnt]['child_of_root_node']) {
- $this->tree[$cnt]['father_node'] = $current_node[$this->tree[$cnt]['level']-1];
- }
- $VALUES = '';
- $SQLDump .= 'INSERT INTO ';
- $SQLDump .= $this->tableName;
- $SQLDump .= ' (';
- $SQLDump .= $this->tableFields['id'] . ', ';
- $VALUES .= "'" . 10*$cnt . "', ";
- $SQLDump .= $this->tableFields['parent_id'] . ', ';
- if (isset($this->tree[$cnt]['father_node']) && $this->tree[$cnt]['father_node'] != 0) {
- $VALUES .= "'" . 10*$this->tree[$cnt]['father_node'] . "', ";
- } else {
- $VALUES .= "'1', ";
- }
- $SQLDump .= $this->tableFields['text'] . ', ';
- $foobar = $this->tree[$cnt]['text'];
- if ($foobar != '') {
- if ($db_type != 'sqlite') {
- $foobar = addslashes($foobar);
- } else {
- $foobar = sqlite_escape_string($foobar);
- }
- }
- $VALUES .= "'$foobar', ";
- $SQLDump .= $this->tableFields['href'] . ', ';
- $VALUES .= "'" . $this->tree[$cnt]['href'] . "', ";
- if ($this->tableFields['title'] != "''") {
- $SQLDump .= $this->tableFields['title'] . ', ';
- $foobar = $this->tree[$cnt]['title'];
- if ($foobar != '') {
- if ($db_type != 'sqlite') {
- $foobar = addslashes($foobar);
- } else {
- $foobar = sqlite_escape_string($foobar);
- }
- }
- $VALUES .= "'$foobar', ";
- }
- if ($this->tableFields['icon'] != "''") {
- $SQLDump .= $this->tableFields['icon'] . ', ';
- $VALUES .= "'" . $this->tree[$cnt]['icon'] . "', ";
- }
- if ($this->tableFields['target'] != "''") {
- $SQLDump .= $this->tableFields['target'] . ', ';
- $VALUES .= "'" . $this->tree[$cnt]['target'] . "', ";
- }
- if ($this->tableFields['orderfield'] != "''") {
- $SQLDump .= $this->tableFields['orderfield'] . ', ';
- $VALUES .= "'" . 10*$cnt . "', ";
- }
- if ($this->tableFields['expanded'] != "''") {
- $SQLDump .= $this->tableFields['expanded'] . ', ';
- $this->tree[$cnt]['expanded'] = (int) $this->tree[$cnt]['expanded'];
- $VALUES .= "'" . $this->tree[$cnt]['expanded'] . "', ";
- }
- $SQLDump = substr($SQLDump, 0, -2);
- $VALUES = substr($VALUES, 0, -2);
- $SQLDump .= ") VALUES ($VALUES);\n";
- }
- return $SQLDump;
- }
- }
- ?>
|