Subversion-Projekte lars-tiefland.ci

Revision

Revision 381 | Zur aktuellen Revision | Blame | Vergleich mit vorheriger | Letzte Änderung | Log anzeigen | RSS feed

<?php

/**
 * @author Lars Tiefland
 * @copyright 2016
 */

function getPath($root, $return_locked_folders = false)
{
        $CI = &get_instance();
        $ini = $GLOBALS['INI'];
        $treeRoot = -1;
        if ($ini["treeRoot"])
        {
                $treeRoot = $ini["treeRoot"];
        }

        //check if memory table exsists
        $path = array();
        $father = $root;
        while ($father != -1 && !is_null($father))
        {
                $sql = "
            SELECT
                *
            FROM
                directory
            WHERE
                ID=$father
            AND
                language='".$ini["language"]."'
        ";
                $status_sql = "
            AND
                status=0
        ";
                if ($return_locked_folders === false)
                {
                        $sql .= $status_sql;
                }
                $res = $CI->db->query($sql);
                $row = $res->row_array();
                if (!is_array($row))
                {
                        return array();
                }
                $father = $row["Father"];
                foreach (array(
                        "",
                        "2",
                        "3") as $i)
                {
                        if ($row["bild_url".$i])
                        {
                                $row["bild_url".$i."_beurer"] = $ini['itemContainerKorrektur']["imagePath".$i].
                                        $row["bild_url".$i];
                                $row["bild_url".$i] = "<img src=".$ini['itemContainerKorrektur']["imagePath".$i].
                                        $row["bild_url".$i]." >";
                        }
                        else
                        {
                                $row["bild_url".$i] = "";
                        }
                }
                $path[] = $row;
        }
        $path = array_reverse($path);
        if ($path[0]["Father"] != $treeRoot)
        {
                unset($path[0]);
        }
        return $path;

}

?>