Viewing file: m_ummenu.php (3.86 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include_once("da_ummenu.php"); class M_Ummenu extends Da_ummenu { //=== add your functions below
function getAll($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 ummenu $orderBy"; $query = $this->db->query($sql); return $query ; }
function RSByStIDPrIDLv($stid,$mnid,$lv){ $sql = "SELECT * FROM ummenu WHERE MnStID = ? AND MnParentMnID LIKE ? AND MnLevel = ? ORDER BY MnID"; $result = $this->db->query($sql, array($stid,$mnid,$lv)); // echo $this->db->last_query(); return $result; }
function RSByStIDGpIDUsIDPrIDLv($stid,$gpid,$usid,$mnid,$lv){ $sql = "SELECT * FROM ummenu JOIN umsystem ON MnStID = StID WHERE MnStID = ? AND (MnParentMnID = ? OR MnParentMnID IS NULL) AND MnLevel = ? AND MnID NOT IN ( SELECT distinct gp.gpMnID FROM umgpermission gp join ummenu mn ON gp.gpMnID = mn.MnID WHERE gp.gpGpID = ? AND mn.MnLevel = ? AND gp.gpX = 0 ) AND MnID NOT IN ( SELECT distinct pm.pmMnID FROM umpermission pm JOIN ummenu mn ON pm.pmMnID = mn.MnID WHERE pm.pmUsID = ? AND mn.MnLevel = ? AND pm.pmX = 0 ) ORDER BY MnSeq"; $result = $this->db->query($sql, array($stid,$mnid,$lv,$gpid,$lv,$usid,$lv)); return $result; }
function SearchByMnID($mnid){ $sql = "SELECT * FROM ummenu JOIN umsystem ON MnStID = StID WHERE MnID LIKE ? "; $result = $this->db->query($sql, array($mnid)); // echo $this->db->last_query(); if($result->num_rows()<>0){ return $result->row_array(); }else{ return false; } }
function RSByParentMn($MnID,$MnStID=-1){ $condition = "MnParentMnID = $MnID"; if($MnID==0){ $condition = "(MnParentMnID = $MnID OR MnParentMnID IS NULL)"; } if($MnStID>=0){ $condition .= " AND MnStID = $MnStID"; } $sql = "select * from ummenu where $condition order by MnSeq ASC"; $result = $this->db->query($sql); return $result; } function updateMenu(){ $sql = "UPDATE ummenu SET MnNameT = ?, MnNameE = ?, MnURL = ?, MnDesc = ? WHERE MnID = ? "; $this->db->query($sql, array($this->MnNameT, $this->MnNameE, $this->MnURL, $this->MnDesc, $this->MnID)); } function lastMnID(){ $sql = "SELECT * FROM ummenu WHERE MnStID = ? ORDER BY MnID DESC"; $query = $this->db->query($sql,array($this->MnStID)); if($query->num_rows()==0){ return 0; } else { return $query->row()->MnID; } } function deleteMenu() { $sql = "DELETE FROM ummenu WHERE MnID = ? OR MnParentMnID = ? "; $this->db->query($sql,array($this->MnID,$this->MnID)); } function deleteSystem() { $sql = "DELETE FROM ummenu WHERE MnStID = ?"; $this->db->query($sql,array($this->MnStID)); } function SaveSeq(){ $sql = "UPDATE ummenu SET MnSeq = ? WHERE MnID = ? "; $this->db->query($sql,array($this->MnSeq,$this->MnID)); } /* * get menu for permission group * @author beeroma * @use group/umGroupPermissionRe * @return query * @Create Date 2554-10-27 */ function RSByParentMnPermissionGroup($MnID,$MnStID=-1,$GpID){ $condition = "MnParentMnID = $MnID"; if($MnID==0){ $condition = "(MnParentMnID = $MnID OR MnParentMnID IS NULL)"; } if($MnStID>=0){ $condition .= " AND MnStID = $MnStID"; } $sql = "SELECT * FROM ummenu LEFT JOIN umgpermission ON ummenu.MnID = umgpermission.gpMnID AND umgpermission.gpGpID = {$GpID} WHERE $condition ORDER BY MnIcon,MnSeq ASC"; $result = $this->db->query($sql); return $result; }
function get_menu() { $sql = "SELECT * FROM ummenu WHERE MnStID = ? ORDER BY MnSeq ASC "; $query = $this->db->query($sql,array($this->MnStID)); return $query; }
} //=== end class Ummenu
|