Subversion-Projekte lars-tiefland.ci

Revision

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

<?php

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

class Shop_position_model extends CI_Model
{
        private $position = array();
        public function __construct()
        {
                parent::__construct();
                $this->load->model('category_model', 'category');
        }

        public function get_position($father)
        {
                $pos = array();
                $sql = 'SELECT
                                *
                        FROM
                                directory
                        WHERE
                                ID = ?
                        AND
                                language="DE"
                ';
                $res = $this->db->query($sql, array($father));
                $row = $res->row_array();
                $id = $row["ID"];
                $father = $row["Father"];
                $row["dirLink"] = $this->category->get_link($id, 2);
                $pos[] = $row;
                while ($father != -1)
                {
                        $res = $this->db->query($sql, array($father));
                        $row = $res->row_array();
                        $id = $row["ID"];
                        $father = $row["Father"];
                        $row["dirLink"] = $this->category->get_link($id, 2);
                        $pos[] = $row;
                }
                $this->position = array_reverse($pos);
                return $this->position;
        }
}

?>