Subversion-Projekte lars-tiefland.ci

Revision

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

<?php

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

/**
 * Shop_position_model
 * 
 * @package WebanOS CI
 * @author Lars Tiefland
 * @copyright 2016
 * @version $Id$
 * @access public
 */
class Shop_position_model extends CI_Model
{
        private $position = array();
        /**
         * Shop_position_model::__construct()
         * zeit auf allen Shop-Seiten den Pfad zur aktuellen Seite an.
         * 
         * @return
         */
        public function __construct()
        {
                parent::__construct();
                $this->load->model('category_model', 'category');
        }

        /**
         * Shop_position_model::get_position()
         * 
         * Liest die aktuelle Positon aus und gibt diese zurück
         * 
         * @param mixed $father
         * @return
         */
        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["link"] = $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["link"] = $this->category->get_link($id, 2);
                        $pos[] = $row;
                }
                $this->position = array_reverse($pos);
                return $this->position;
        }
}

?>