Documentación GVHIDRA 3.1.5
Referencia de la Clase LayersMenuCommon
Diagrama de herencias de LayersMenuCommon
LayersMenu PHPTreeMenu PlainMenu ProcessLayersMenu TreeMenu

Métodos públicos

 LayersMenuCommon ()
 setPrependedUrl ($prependedUrl)
 setDirrootCommon ($dirroot)
 setLibjsdir ($libjsdir)
 setImgdir ($imgdir)
 setImgwww ($imgwww)
 setIcondir ($icondir)
 setIconwww ($iconwww)
 setIconsize ($width, $height)
 unsetIconsize ()
 setTpldirCommon ($tpldir)
 setMenuStructureFile ($tree_file)
 setMenuStructureString ($tree_string)
 setSeparator ($separator)
 setDBConnParms ($dsn, $persistent=false)
 setTableName ($tableName)
 setTableName_i18n ($tableName_i18n)
 setTableFields ($tableFields)
 setTableFields_i18n ($tableFields_i18n)
 parseStructureForMenu ($menu_name= '')
 scanTableForMenu ($menu_name= '', $language= '')
 _getmicrotime ()
 _depthFirstSearch ($menu_name, $tmpArray, $parent_id=1, $level=1)
 _postParse ($menu_name= '')
 replaceStringInUrls ($menu_name, $string, $value)
 setLinksTargets ($menu_name, $target)
 setSelectedItemByCount ($menu_name, $count)
 setSelectedItemById ($menu_name, $id)
 setSelectedItemByUrl ($menu_name, $url)
 setSelectedItemByUrlEregi ($menu_name, $url_eregi)
 error ($errormsg)

Campos de datos

 $_packageName
 $version
 $copyright
 $author
 $prependedUrl = ''
 $haltOnError = 'yes'
 $dirroot
 $libjsdir
 $imgdir
 $imgwww
 $icondir
 $iconwww
 $iconsize = array()
 $issetIconsize = false
 $tpldir
 $menuStructure
 $_nodesCount
 $tree
 $treecnt
 $_maxLevel
 $_firstLevelCnt
 $_firstItem
 $_lastItem
 $dsn = 'pgsql://dbuser:dbpass@dbhost/dbname'
 $persistent = false
 $tableName = 'phplayersmenu'
 $tableName_i18n = 'phplayersmenu_i18n'
 $tableFields
 $tableFields_i18n
 $_tmpArray = array()

Descripción detallada

Definición en la línea 17 del archivo layersmenu-common.inc.php.


Documentación de las funciones miembro

_depthFirstSearch ( menu_name,
tmpArray,
parent_id = 1,
level = 1 
)

Recursive method to perform the depth-first search of the tree data taken from the current menu table private

Parámetros:
string$menu_namethe name to be attributed to the menu whose structure has to be parsed
array$tmpArraythe temporary array that stores data to perform the depth-first search
integer$parent_idid of the item whose children have to be searched for
integer$levelthe hierarchical level of children to be searched for
Devuelve:
void

Definición en la línea 755 del archivo layersmenu-common.inc.php.

{
        reset ($tmpArray);
        while (list($id, $foobar) = each($tmpArray)) {
                if ($foobar['parent_id'] == $parent_id) {
                        unset($tmpArray[$id]);
                        unset($this->_tmpArray[$id]);
                        $cnt = count($this->tree) + 1;
                        $this->tree[$cnt]['level'] = $level;
                        $this->tree[$cnt]['text'] = $foobar['text'];
                        $this->tree[$cnt]['href'] = $foobar['href'];
                        $this->tree[$cnt]['title'] = $foobar['title'];
                        $this->tree[$cnt]['icon'] = $foobar['icon'];
                        $this->tree[$cnt]['target'] = $foobar['target'];
                        $this->tree[$cnt]['expanded'] = $foobar['expanded'];
                        $this->treecnt[$menu_name][$id] = $cnt;
                        unset($foobar);
                        if ($id != $parent_id) {
                                $this->_depthFirstSearch($menu_name, $this->_tmpArray, $id, $level+1);
                        }
                }
        }
}
_getmicrotime ( )

Definición en la línea 737 del archivo layersmenu-common.inc.php.

{
        list($usec, $sec) = explode(' ', microtime());
        return ((float) $usec + (float) $sec);
}
_postParse ( menu_name = '')

A method providing parsing needed after both file/string parsing and DB table parsing private

Parámetros:
string$menu_namethe name of the menu for which the parsing has to be performed
Devuelve:
void

Definición en la línea 786 del archivo layersmenu-common.inc.php.

{
        for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) {  // this counter scans all nodes of the new menu
                $this->tree[$cnt]['child_of_root_node'] = ($this->tree[$cnt]['level'] == 1);
                $this->tree[$cnt]['parsed_text'] = stripslashes($this->tree[$cnt]['text']);
                $this->tree[$cnt]['parsed_href'] = (str_replace(' ', '', $this->tree[$cnt]['href']) == '') ? '#' : $this->prependedUrl . $this->tree[$cnt]['href'];
                $this->tree[$cnt]['parsed_title'] = ($this->tree[$cnt]['title'] == '') ? '' : ' title="' . stripslashes($this->tree[$cnt]['title']) . '"';
                $fooimg = $this->icondir . $this->tree[$cnt]['icon'];
                if ($this->tree[$cnt]['icon'] != '' && (substr($this->tree[$cnt]['icon'], 0, 7) == 'http://' || substr($this->tree[$cnt]['icon'], 0, 8) == 'https://')) {
                        $this->tree[$cnt]['parsed_icon'] = $this->tree[$cnt]['icon'];
                        if ($this->issetIconsize) {
                                $this->tree[$cnt]['iconwidth'] = $this->iconsize['width'];
                                $this->tree[$cnt]['iconheight'] = $this->iconsize['height'];
                        } else {
                                $foobar = getimagesize($this->tree[$cnt]['icon']);
                                $this->tree[$cnt]['iconwidth'] = $foobar[0];
                                $this->tree[$cnt]['iconheight'] = $foobar[1];
                        }
                } elseif ($this->tree[$cnt]['icon'] != '' && file_exists($fooimg)) {
                        $this->tree[$cnt]['parsed_icon'] = $this->iconwww . $this->tree[$cnt]['icon'];
                        if ($this->issetIconsize) {
                                $this->tree[$cnt]['iconwidth'] = $this->iconsize['width'];
                                $this->tree[$cnt]['iconheight'] = $this->iconsize['height'];
                        } else {
                                $foobar = getimagesize($fooimg);
                                $this->tree[$cnt]['iconwidth'] = $foobar[0];
                                $this->tree[$cnt]['iconheight'] = $foobar[1];
                        }
                } else {
                        $this->tree[$cnt]['parsed_icon'] = '';
                }
                $this->tree[$cnt]['parsed_target'] = ($this->tree[$cnt]['target'] == '') ? '' : ' target="' . $this->tree[$cnt]['target'] . '"';
//              $this->tree[$cnt]['expanded'] = ($this->tree[$cnt]['expanded'] == '') ? 0 : $this->tree[$cnt]['expanded'];
                $this->_maxLevel[$menu_name] = max($this->_maxLevel[$menu_name], $this->tree[$cnt]['level']);
                if ($this->tree[$cnt]['level'] == 1) {
                        $this->_firstLevelCnt[$menu_name]++;
                }
        }
}
error ( errormsg)

Method to handle errors private

Parámetros:
string$errormsgthe error message
Devuelve:
void

Definición en la línea 945 del archivo layersmenu-common.inc.php.

{
        print "<b>LayersMenu Error:</b> $errormsg<br />\n";
        if ($this->haltOnError == 'yes') {
                die("<b>Halted.</b><br />\n");
        }
}

The constructor method; it initializates the menu system

Devuelve:
void

Definición en la línea 233 del archivo layersmenu-common.inc.php.

{
        $this->_packageName = 'PHP Layers Menu';
        $this->version = '3.2.0-rc';
        $this->copyright = '(C) 2001-2004';
        $this->author = 'Marco Pratesi - http://www.marcopratesi.it/';

        $this->prependedUrl = '';

        $this->dirroot = './';
        $this->libjsdir = './libjs/';
        $this->imgdir = './menuimages/';
        $this->imgwww = 'menuimages/';
        $this->icondir = './menuicons/';
        $this->iconwww = 'menuicons/';
        $this->tpldir = './templates/';
        $this->menuStructure = '';
        $this->separator = '|';

        $this->_nodesCount = 0;
        $this->tree = array();
        $this->treecnt = array();
        $this->_maxLevel = array();
        $this->_firstLevelCnt = array();
        $this->_firstItem = array();
        $this->_lastItem = array();
}
parseStructureForMenu ( menu_name = '')

The method to parse the current menu structure and correspondingly update related variables public

Parámetros:
string$menu_namethe name to be attributed to the menu whose structure has to be parsed
Devuelve:
void

Definición en la línea 612 del archivo layersmenu-common.inc.php.

{
        $this->_maxLevel[$menu_name] = 0;
        $this->_firstLevelCnt[$menu_name] = 0;
        $this->_firstItem[$menu_name] = $this->_nodesCount + 1;
        $cnt = $this->_firstItem[$menu_name];
        $menuStructure = $this->menuStructure;

        /* *********************************************** */
        /* Partially based on a piece of code taken from   */
        /* TreeMenu 1.1 - Bjorge Dijkstra (bjorge@gmx.net) */
        /* *********************************************** */

        while ($menuStructure != '') {
                $before_cr = strcspn($menuStructure, "\n");
                $buffer = substr($menuStructure, 0, $before_cr);
                $menuStructure = substr($menuStructure, $before_cr+1);
                if (substr($buffer, 0, 1) == '#') {
                        continue;       // commented item line...
                }
                $tmp = rtrim($buffer);
                $node = explode($this->separator, $tmp);
                for ($i=count($node); $i<=6; $i++) {
                        $node[$i] = '';
                }
                $this->tree[$cnt]['level'] = strlen($node[0]);
                $this->tree[$cnt]['text'] = $node[1];
                $this->tree[$cnt]['href'] = $node[2];
                $this->tree[$cnt]['title'] = $node[3];
                $this->tree[$cnt]['icon'] = $node[4];
                $this->tree[$cnt]['target'] = $node[5];
                $this->tree[$cnt]['expanded'] = $node[6];
                $cnt++;
        }

        /* *********************************************** */

        $this->_lastItem[$menu_name] = count($this->tree);
        $this->_nodesCount = $this->_lastItem[$menu_name];
        $this->tree[$this->_lastItem[$menu_name]+1]['level'] = 0;
        $this->_postParse($menu_name);
}
replaceStringInUrls ( menu_name,
string,
value 
)

A method to replace strings in all URLs (hrefs) of a menu public

Parámetros:
string$menu_namethe name of the menu for which the replacement has to be performed
string$stringthe string to be replaced
string$valuethe replacement string
Devuelve:
void

Definición en la línea 837 del archivo layersmenu-common.inc.php.

{
        for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) {  // this counter scans all nodes of the new menu
                $this->tree[$cnt]['parsed_href'] = str_replace($string, $value, $this->tree[$cnt]['parsed_href']);
        }
}
scanTableForMenu ( menu_name = '',
language = '' 
)

The method to parse the current menu table and correspondingly update related variables public

Parámetros:
string$menu_namethe name to be attributed to the menu whose structure has to be parsed
string$languagei18n language; either omit it or pass an empty string ('') if you do not want to use any i18n table
Devuelve:
void

Definición en la línea 666 del archivo layersmenu-common.inc.php.

{
        $this->_maxLevel[$menu_name] = 0;
        $this->_firstLevelCnt[$menu_name] = 0;
        unset($this->tree[$this->_nodesCount+1]);
        $this->_firstItem[$menu_name] = $this->_nodesCount + 1;
/* BEGIN BENCHMARK CODE
$time_start = $this->_getmicrotime();
/* END BENCHMARK CODE */
        $db = DB::connect($this->dsn, $this->persistent);
        if (DB::isError($db)) {
                $this->error('scanTableForMenu: ' . $db->getMessage());
        }
        $dbresult = $db->query('
                SELECT ' .
                        $this->tableFields['id'] . ' AS id, ' .
                        $this->tableFields['parent_id'] . ' AS parent_id, ' .
                        $this->tableFields['text'] . ' AS text, ' .
                        $this->tableFields['href'] . ' AS href, ' .
                        $this->tableFields['title'] . ' AS title, ' .
                        $this->tableFields['icon'] . ' AS icon, ' .
                        $this->tableFields['target'] . ' AS target, ' .
                        $this->tableFields['expanded'] . ' AS expanded
                FROM ' . $this->tableName . '
                WHERE ' . $this->tableFields['id'] . ' <> 1
                ORDER BY ' . $this->tableFields['orderfield'] . ', ' . $this->tableFields['text'] . ' ASC
        ');
        $this->_tmpArray = array();
        while ($dbresult->fetchInto($row, DB_FETCHMODE_ASSOC)) {
                $this->_tmpArray[$row['id']]['parent_id'] = $row['parent_id'];
                $this->_tmpArray[$row['id']]['text'] = $row['text'];
                $this->_tmpArray[$row['id']]['href'] = $row['href'];
                $this->_tmpArray[$row['id']]['title'] = $row['title'];
                $this->_tmpArray[$row['id']]['icon'] = $row['icon'];
                $this->_tmpArray[$row['id']]['target'] = $row['target'];
                $this->_tmpArray[$row['id']]['expanded'] = $row['expanded'];
        }
        if ($language != '') {
                $dbresult = $db->query('
                        SELECT ' .
                                $this->tableFields_i18n['id'] . ' AS id, ' .
                                $this->tableFields_i18n['text'] . ' AS text, ' .
                                $this->tableFields_i18n['title'] . ' AS title
                        FROM ' . $this->tableName_i18n . '
                        WHERE ' . $this->tableFields_i18n['id'] . ' <> 1
                                AND ' . $this->tableFields_i18n['language'] . ' = ' . "'$language'" . '
                ');
                while ($dbresult->fetchInto($row, DB_FETCHMODE_ASSOC)) {
                        if (isset($this->_tmpArray[$row['id']])) {
                                $this->_tmpArray[$row['id']]['text'] = $row['text'];
                                $this->_tmpArray[$row['id']]['title'] = $row['title'];
                        }
                }
        }
        unset($dbresult);
        unset($row);
        $this->_depthFirstSearch($menu_name, $this->_tmpArray, 1, 1);
/* BEGIN BENCHMARK CODE
$time_end = $this->_getmicrotime();
$time = $time_end - $time_start;
print "TIME ELAPSED = $time\n<br>";
/* END BENCHMARK CODE */
        $this->_lastItem[$menu_name] = count($this->tree);
        $this->_nodesCount = $this->_lastItem[$menu_name];
        $this->tree[$this->_lastItem[$menu_name]+1]['level'] = 0;
        $this->_postParse($menu_name);
}
setDBConnParms ( dsn,
persistent = false 
)

The method to set parameters for the DB connection public

Parámetros:
string$dsnData Source Name: the connection string for PEAR DB
bool$persistentDB connections are either persistent or not persistent
Devuelve:
boolean

Definición en la línea 512 del archivo layersmenu-common.inc.php.

{
        if (!is_string($dsn)) {
                $this->error('initdb: $dsn is not an string.');
                return false;
        }
        if (!is_bool($persistent)) {
                $this->error('initdb: $persistent is not a boolean.');
                return false;
        }
        $this->dsn = $dsn;
        $this->persistent = $persistent;
        return true;
}
setDirrootCommon ( dirroot)

The method to set the dirroot directory public

Devuelve:
boolean

Definición en la línea 278 del archivo layersmenu-common.inc.php.

{
        if (!is_dir($dirroot)) {
                $this->error("setDirroot: $dirroot is not a directory.");
                return false;
        }
        if (substr($dirroot, -1) != '/') {
                $dirroot .= '/';
        }
        $oldlength = strlen($this->dirroot);
        $foobar = strpos($this->libjsdir, $this->dirroot);
        if (!($foobar === false || $foobar != 0)) {
                $this->libjsdir = $dirroot . substr($this->libjsdir, $oldlength);
        }
        $foobar = strpos($this->imgdir, $this->dirroot);
        if (!($foobar === false || $foobar != 0)) {
                $this->imgdir = $dirroot . substr($this->imgdir, $oldlength);
        }
        $foobar = strpos($this->icondir, $this->dirroot);
        if (!($foobar === false || $foobar != 0)) {
                $this->icondir = $dirroot . substr($this->icondir, $oldlength);
        }
        $foobar = strpos($this->tpldir, $this->dirroot);
        if (!($foobar === false || $foobar != 0)) {
                $this->tpldir = $dirroot . substr($this->tpldir, $oldlength);
        }
        $this->dirroot = $dirroot;
        return true;
}
setIcondir ( icondir)

The method to set the icondir directory public

Devuelve:
boolean

Definición en la línea 374 del archivo layersmenu-common.inc.php.

{
        if ($icondir != '' && substr($icondir, -1) != '/') {
                $icondir .= '/';
        }
        if ($icondir == '' || substr($icondir, 0, 1) != '/') {
                $foobar = strpos($icondir, $this->dirroot);
                if ($foobar === false || $foobar != 0) {
                        $icondir = $this->dirroot . $icondir;
                }
        }
        if (!is_dir($icondir)) {
                $this->error("setIcondir: $icondir is not a directory.");
                return false;
        }
        $this->icondir = $icondir;
        return true;
}
setIconsize ( width,
height 
)

The method to set the iconsize array public

Devuelve:
void

Definición en la línea 411 del archivo layersmenu-common.inc.php.

{
        $this->iconsize['width'] = ($width == (int) $width) ? $width : 0;
        $this->iconsize['height'] = ($height == (int) $height) ? $height : 0;
        $this->issetIconsize = true;
}
setIconwww ( iconwww)

The method to set iconwww public

Devuelve:
void

Definición en la línea 398 del archivo layersmenu-common.inc.php.

{
        if ($iconwww != '' && substr($iconwww, -1) != '/') {
                $iconwww .= '/';
        }
        $this->iconwww = $iconwww;
}
setImgdir ( imgdir)

The method to set the imgdir directory public

Devuelve:
boolean

Definición en la línea 337 del archivo layersmenu-common.inc.php.

{
        if ($imgdir != '' && substr($imgdir, -1) != '/') {
                $imgdir .= '/';
        }
        if ($imgdir == '' || substr($imgdir, 0, 1) != '/') {
                $foobar = strpos($imgdir, $this->dirroot);
                if ($foobar === false || $foobar != 0) {
                        $imgdir = $this->dirroot . $imgdir;
                }
        }
        if (!is_dir($imgdir)) {
                $this->error("setImgdir: $imgdir is not a directory.");
                return false;
        }
        $this->imgdir = $imgdir;
        return true;
}
setImgwww ( imgwww)

The method to set imgwww public

Devuelve:
void

Definición en la línea 361 del archivo layersmenu-common.inc.php.

{
        if ($imgwww != '' && substr($imgwww, -1) != '/') {
                $imgwww .= '/';
        }
        $this->imgwww = $imgwww;
}
setLibjsdir ( libjsdir)

The method to set the libjsdir directory public

Devuelve:
boolean

Definición en la línea 313 del archivo layersmenu-common.inc.php.

{
        if ($libjsdir != '' && substr($libjsdir, -1) != '/') {
                $libjsdir .= '/';
        }
        if ($libjsdir == '' || substr($libjsdir, 0, 1) != '/') {
                $foobar = strpos($libjsdir, $this->dirroot);
                if ($foobar === false || $foobar != 0) {
                        $libjsdir = $this->dirroot . $libjsdir;
                }
        }
        if (!is_dir($libjsdir)) {
                $this->error("setLibjsdir: $libjsdir is not a directory.");
                return false;
        }
        $this->libjsdir = $libjsdir;
        return true;
}
setLinksTargets ( menu_name,
target 
)

A method to set the same target for all links of a menu public

Parámetros:
string$menu_namethe name of the menu for which the targets have to be set
string$targetthe target to be set for all links of the $menu_name menu
Devuelve:
void

Definición en la línea 853 del archivo layersmenu-common.inc.php.

{
        for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) {  // this counter scans all nodes of the new menu
                $this->tree[$cnt]['parsed_target'] = ' target="' . $target . '"';
        }
}
setMenuStructureFile ( tree_file)

The method to read the menu structure from a file public

Parámetros:
string$tree_filethe menu structure file
Devuelve:
boolean

Definición en la línea 460 del archivo layersmenu-common.inc.php.

{
        if (!($fd = fopen($tree_file, 'r'))) {
                $this->error("setMenuStructureFile: unable to open file $tree_file.");
                return false;
        }
        $this->menuStructure = '';
        while ($buffer = fgets($fd, 4096)) {
                $buffer = str_replace(chr(13), '', $buffer);    // Microsoft Stupidity Suppression
                $this->menuStructure .= $buffer;
        }
        fclose($fd);
        if ($this->menuStructure == '') {
                $this->error("setMenuStructureFile: $tree_file is empty.");
                return false;
        }
        return true;
}
setMenuStructureString ( tree_string)

The method to set the menu structure passing it through a string public

Parámetros:
string$tree_stringthe menu structure string
Devuelve:
boolean

Definición en la línea 485 del archivo layersmenu-common.inc.php.

{
        $this->menuStructure = str_replace(chr(13), '', $tree_string);  // Microsoft Stupidity Suppression
        if ($this->menuStructure == '') {
                $this->error('setMenuStructureString: empty string.');
                return false;
        }
        return true;
}
setPrependedUrl ( prependedUrl)

The method to set the prepended URL public

Devuelve:
boolean

Definición en la línea 266 del archivo layersmenu-common.inc.php.

{
        // We do not perform any check
        $this->prependedUrl = $prependedUrl;
        return true;
}
setSelectedItemByCount ( menu_name,
count 
)

A method to select the current item of $menu_name in terms of $cnt, i.e., very likely, in terms of its line number in the corresponding menu structure file (excluding from the count commented out lines, if any) public

Parámetros:
string$menu_namethe name of the menu for which the current item has to be selected
integer$countthe line number of the current item in the corresponding menu structure file (excluding from the count commented out lines, if any)
Devuelve:
void

Definición en la línea 870 del archivo layersmenu-common.inc.php.

{
        if ($count < 1) {
                $this->error("setSelectedItemByCount: the \$count argument is $count, but \$count can not be lower than 1");
                return;
        }
        if ($count > $this->_lastItem[$menu_name] - $this->_firstItem[$menu_name] + 1) {
                $this->error("setSelectedItemByCount: the \$count argument is $count and is larger than the number of items of the '$menu_name' menu");
                return;
        }
        $cnt = $this->_firstItem[$menu_name] + $count - 1;
        $this->tree[$cnt]['selected'] = true;
}
setSelectedItemById ( menu_name,
id 
)

A method to select the current item of $menu_name in terms of the corresponding id (see the DB table structure); obviously, this method can be used only together with the DB support public

Parámetros:
string$menu_namethe name of the menu for which the current item has to be selected
integer$idthe id of the current item in the corresponding DB table
Devuelve:
void

Definición en la línea 892 del archivo layersmenu-common.inc.php.

{
        if (!isset($this->treecnt[$menu_name][$id])) {
                $this->error("setSelectedItemById: there is not any item with \$id = $id in the '$menu_name' menu");
                return;
        }
        $cnt = $this->treecnt[$menu_name][$id];
        $this->tree[$cnt]['selected'] = true;
}
setSelectedItemByUrl ( menu_name,
url 
)

A method to select the current item of $menu_name specifying a string that occurs in the current URL public

Parámetros:
string$menu_namethe name of the menu for which the current item has to be selected
string$urla string that occurs in the current URL
Devuelve:
void

Definición en la línea 910 del archivo layersmenu-common.inc.php.

{
        for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) {  // this counter scans all nodes of the new menu
                if (!(strpos($this->tree[$cnt]['parsed_href'], $url) === false)) {
                        $this->tree[$cnt]['selected'] = true;
                        break;
                }
        }
}
setSelectedItemByUrlEregi ( menu_name,
url_eregi 
)

A method to select the current item of $menu_name specifying a regular expression that matches (a substring of) the current URL; just the same as the setSelectedItemByUrl() method, but using eregi() instead of strpos() public

Parámetros:
string$menu_namethe name of the menu for which the current item has to be selected
string$url_eregithe regular expression that matches (a substring of) the current URL
Devuelve:
void

Definición en la línea 929 del archivo layersmenu-common.inc.php.

{
        for ($cnt=$this->_firstItem[$menu_name]; $cnt<=$this->_lastItem[$menu_name]; $cnt++) {  // this counter scans all nodes of the new menu
                if (eregi($url_eregi, $this->tree[$cnt]['parsed_href'])) {
                        $this->tree[$cnt]['selected'] = true;
                        break;
                }
        }
}
setSeparator ( separator)

The method to set the value of separator public

Devuelve:
void

Definición en la línea 500 del archivo layersmenu-common.inc.php.

{
        $this->separator = $separator;
}
setTableFields ( tableFields)

The method to set names of fields of the table storing data describing the menu public

Parámetros:
array
Devuelve:
boolean

Definición en la línea 565 del archivo layersmenu-common.inc.php.

{
        if (!is_array($tableFields)) {
                $this->error('setTableFields: $tableFields is not an array.');
                return false;
        }
        if (count($tableFields) == 0) {
                $this->error('setTableFields: $tableFields is a zero-length array.');
                return false;
        }
        reset ($tableFields);
        while (list($key, $value) = each($tableFields)) {
                $this->tableFields[$key] = ($value == '') ? "''" : $value;
        }
        return true;
}
setTableFields_i18n ( tableFields_i18n)

The method to set names of fields of the i18n table corresponding to $tableName public

Parámetros:
array
Devuelve:
boolean

Definición en la línea 588 del archivo layersmenu-common.inc.php.

{
        if (!is_array($tableFields_i18n)) {
                $this->error('setTableFields_i18n: $tableFields_i18n is not an array.');
                return false;
        }
        if (count($tableFields_i18n) == 0) {
                $this->error('setTableFields_i18n: $tableFields_i18n is a zero-length array.');
                return false;
        }
        reset ($tableFields_i18n);
        while (list($key, $value) = each($tableFields_i18n)) {
                $this->tableFields_i18n[$key] = ($value == '') ? "''" : $value;
        }
        return true;
}
setTableName ( tableName)

The method to set the name of the table storing data describing the menu public

Parámetros:
string
Devuelve:
boolean

Definición en la línea 533 del archivo layersmenu-common.inc.php.

{
        if (!is_string($tableName)) {
                $this->error('setTableName: $tableName is not a string.');
                return false;
        }
        $this->tableName = $tableName;
        return true;
}
setTableName_i18n ( tableName_i18n)

The method to set the name of the i18n table corresponding to $tableName public

Parámetros:
string
Devuelve:
boolean

Definición en la línea 549 del archivo layersmenu-common.inc.php.

{
        if (!is_string($tableName_i18n)) {
                $this->error('setTableName_i18n: $tableName_i18n is not a string.');
                return false;
        }
        $this->tableName_i18n = $tableName_i18n;
        return true;
}
setTpldirCommon ( tpldir)

The method to set the tpldir directory public

Devuelve:
boolean

Definición en la línea 435 del archivo layersmenu-common.inc.php.

{
        if ($tpldir != '' && substr($tpldir, -1) != '/') {
                $tpldir .= '/';
        }
        if ($tpldir == '' || substr($tpldir, 0, 1) != '/') {
                $foobar = strpos($tpldir, $this->dirroot);
                if ($foobar === false || $foobar != 0) {
                        $tpldir = $this->dirroot . $tpldir;
                }
        }
        if (!is_dir($tpldir)) {
                $this->error("setTpldir: $tpldir is not a directory.");
                return false;
        }
        $this->tpldir = $tpldir;
        return true;
}
unsetIconsize ( )

The method to unset the iconsize array public

Devuelve:
void

Definición en la línea 423 del archivo layersmenu-common.inc.php.

{
        unset($this->iconsize['width']);
        unset($this->iconsize['height']);
        $this->issetIconsize = false;
}

Documentación de los campos

$_firstItem

Definición en la línea 159 del archivo layersmenu-common.inc.php.

$_firstLevelCnt

Definición en la línea 153 del archivo layersmenu-common.inc.php.

$_lastItem

Definición en la línea 165 del archivo layersmenu-common.inc.php.

$_maxLevel

Definición en la línea 147 del archivo layersmenu-common.inc.php.

$_nodesCount

Definición en la línea 124 del archivo layersmenu-common.inc.php.

$_packageName

Definición en la línea 25 del archivo layersmenu-common.inc.php.

$_tmpArray = array()

Definición en la línea 227 del archivo layersmenu-common.inc.php.

$author

Definición en la línea 43 del archivo layersmenu-common.inc.php.

$copyright

Definición en la línea 37 del archivo layersmenu-common.inc.php.

$dirroot

Definición en la línea 63 del archivo layersmenu-common.inc.php.

$dsn = 'pgsql://dbuser:dbpass@dbhost/dbname'

Definición en la línea 172 del archivo layersmenu-common.inc.php.

$haltOnError = 'yes'

Definición en la línea 56 del archivo layersmenu-common.inc.php.

$icondir

Definición en la línea 87 del archivo layersmenu-common.inc.php.

$iconsize = array()

Definición en la línea 99 del archivo layersmenu-common.inc.php.

$iconwww

Definición en la línea 93 del archivo layersmenu-common.inc.php.

$imgdir

Definición en la línea 75 del archivo layersmenu-common.inc.php.

$imgwww

Definición en la línea 81 del archivo layersmenu-common.inc.php.

$issetIconsize = false

Definición en la línea 105 del archivo layersmenu-common.inc.php.

$libjsdir

Definición en la línea 69 del archivo layersmenu-common.inc.php.

$menuStructure

Definición en la línea 117 del archivo layersmenu-common.inc.php.

$persistent = false

Definición en la línea 178 del archivo layersmenu-common.inc.php.

$prependedUrl = ''

Definición en la línea 50 del archivo layersmenu-common.inc.php.

$tableFields
Valor inicial:
 array(
        'id'            => 'id',
        'parent_id'     => 'parent_id',
        'text'          => 'text',
        'href'          => 'href',
        'title'         => 'title',
        'icon'          => 'icon',
        'target'        => 'target',
        'orderfield'    => 'orderfield',
        'expanded'      => 'expanded'
)

Definición en la línea 200 del archivo layersmenu-common.inc.php.

$tableFields_i18n
Valor inicial:
 array(
        'language'      => 'language',
        'id'            => 'id',
        'text'          => 'text',
        'title'         => 'title'
)

Definición en la línea 216 del archivo layersmenu-common.inc.php.

$tableName = 'phplayersmenu'

Definición en la línea 184 del archivo layersmenu-common.inc.php.

$tableName_i18n = 'phplayersmenu_i18n'

Definición en la línea 190 del archivo layersmenu-common.inc.php.

$tpldir

Definición en la línea 111 del archivo layersmenu-common.inc.php.

$tree

Definición en la línea 130 del archivo layersmenu-common.inc.php.

$treecnt

Definición en la línea 141 del archivo layersmenu-common.inc.php.

$version

Definición en la línea 31 del archivo layersmenu-common.inc.php.


La documentación para esta clase fue generada a partir del siguiente fichero: