Viewing file: m_ummenu.php (1.56 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
include_once("da_ummenu.php");
class M_ummenu extends Da_ummenu {
/* * aOrderBy = array('fieldname' => 'ASC|DESC', ... ) */ function get_all($aOrderBy=""){ $orderBy = ""; if ( is_array($aOrderBy) ) { $orderBy.= "ORDER BY "; foreach ($aOrderBy as $key => $value) { $orderBy.= "$key $value, "; } $orderBy = substr($orderBy, 0, strlen($orderBy)-2); } $sql = "SELECT * FROM ".$this->ums_db.".ummenu $orderBy"; $query = $this->db->query($sql); return $query; } /* * create array of pk field and value for generate select list in view, must edit PK_FIELD and FIELD_NAME manually * the first line of select list is '-----เลือก-----' by default. * if you do not need the first list of select list is '-----เลือก-----', please pass $optional parameter to other values. * you can delete this function if it not necessary. */ function get_options($optional='y') { $qry = $this->get_all(); if ($optional=='y') $opt[''] = '-----เลือก-----'; foreach ($qry->result() as $row) { $opt[$row->PK_FIELD] = $row->FIELD_NAME; } return $opt; } // add your functions here
function get_menu() { $sql = "SELECT * FROM ".$this->ums_db.".ummenu WHERE MnStID = ? ORDER BY MnSeq ASC "; $query = $this->db->query($sql,array($this->MnStID)); return $query; }
function get_link_menu() { $sql = "SELECT * FROM ".$this->ums_db.".ummenu WHERE MnStID = ? AND MnID = ?"; $query = $this->db->query($sql,array($this->MnStID,$this->MnID)); return $query; }
} // end class M_ummenu ?>
|