Subversion-Projekte lars-tiefland.ci

Revision

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

<?php

/**
 *
 * @package WebanOS CI
 * @author Lars Tiefland <ltiefland@gmail.com> 
 * @copyright 2016
 * @version $Rev: 1836 $
 */

/**
 * Auspraegung_model
 * 
 * @package WebanOS CI
 * @author Lars Tiefland
 * @copyright 2016
 * @version $Id: Directory_to_auspraegung_model.php 1836 2016-12-21 22:48:38Z lars $
 * @access public
 */
class Directory_to_auspraegung_model extends CI_Model
{
        /**
         * Auspraegung_model::__construct()
         * 
         * @return
         */
        public function __construct()
        {
                parent::__construct();
        }

        /**
         * Auspraegung_model::get_list()
         * 
         * @return
         */
        public function get_list($dir)
        {
                $sql = "SELECT DISTINCT
                                auspraegung AS id
                        FROM
                                directory_to_auspraegung
                        WHERE
                                directory_id=".$dir."
                ";
                $res = $this->db->query($sql);
                $rows = array();
                while ($row = $res->unbuffered_row('array'))
                {
                        $row = $this->get($row["id"]);
                        $row["wertebereich"] = $this->get_werte($row["id"], $dir);
                        $rows[] = $row;
                }
                return $rows;
        }

        public function get($ausp)
        {
                $sql = "SELECT
                                *
                        FROM
                                auspraegung
                        WHERE
                                id=".$ausp."
                ";
                $res = $this->db->query($sql);
                $row = $res->unbuffered_row('array');
                return $row;
        }

        /**
         * Auspraegung_model::get()
         * 
         * @param mixed $id
         * @return
         */
        public function get_werte($id, $father)
        {
                $path = array_reverse(getPath($father));
                $werte = array();
                foreach ($path as $dir)
                {
                        $directory = $dir["ID"];
                        $sql = "SELECT
                                        dta.wertebereich
                                FROM
                                        directory_to_auspraegung dta
                                WHERE
                                        auspraegung=".$id."
                                AND
                                        directory=".$directory."
                        ";
                        $res = $this->db->query($sql);
                        while ($row = $res->unbuffered_row('array'))
                        {
                                $werte[] = $row["wertebereich"];
                        }
                }
                return $werte;
        }
}

?>