Subversion-Projekte lars-tiefland.ci

Revision

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

<?php

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

/**
 * Herstellerkatalog_model
 * 
 * @package WebanOS CI
 * @author Lars Tiefland
 * @copyright 2016
 * @version $Id: Herstellerkatalog_model.php 1958 2017-01-20 21:48:38Z lars $
 * @access public
 */
class Herstellerkatalog_model extends CI_Model
{
        /**
         * Herstellerkatalog_model::__construct()
         * 
         * @return
         */
        public function __construct()
        {
                parent::__construct();
                $this->load->model('metatags_model', 'metatags');
        }

        /**
         * Herstellerkatalog_model::get_info()
         * 
         * Infos zu einem Hersteller
         * 
         * @param mixed $hId
         * @return
         */
        public function get_list($mode = 'list')
        {
                $result = array();
                switch ($mode)
                {
                        case "list":
                                $sql = "SELECT
                                                id,
                                                name
                                        FROM
                                                Herstellerkatalog
                                        ORDER BY
                                                name
                                ";
                                $res = $this->db->query($sql);
                                while ($row = $res->unbuffered_row('array'))
                                {
                                        $row["metatags"] = $this->metatags->get($row["id"], 'Herstellerkatalog');
                                        $result[] = $row;
                                }
                                break;
                        case "dropdown":
                                $result[0] = "--- Bitte wählen ---";
                                $sql = "SELECT
                                                id,
                                                name
                                        FROM
                                                Herstellerkatalog
                                        ORDER BY
                                                name
                                ";
                                $res = $this->db->query($sql);
                                while ($row = $res->unbuffered_row('array'))
                                {
                                        $result[$row["id"]] = $row["name"];
                                }
                                break;
                }
                return $result;
        }
        
        public function get($id)
        {
                $sql = "SELECT
                                *
                        FROM
                                Herstellerkatalog
                        WHERE
                                id=".$id."
                ";
                $res = $this->db->query($sql);
                $row = $res->unbuffered_row('array');
                $row["metatags"] = $this->metatags->get($row["ID"], 'Hersrtellerkatalog');
                return $row;
        }
}

?>