kohjhjhصثقص5572hjkhk7872ثقصثقgdfgdg
Ele57885fddfg872782782782 hjkhj782dfgfghgقفغفغفقhfg555434536
/
home4
/
kisgavwq
/
gpplenergy.com
/
includes
/
classes
/
Upload FileeE
HOME
<?php class Menus extends SiteData { function showParent($menu_pid, $ar) { $sql= "SELECT * from ".MENU." where menu_id='$menu_pid'"; $res = $this->getData($sql); if($res['NO_OF_ITEMS']>0) { $data = $res['oDATA'][0]; $menu_id = outText($data['menu_id']); $menu_pid = outText($data['menu_pid']); $menu_name = outText($data['menu_name']); $menu_url = outText($data['menu_url']); $ar[] = $menu_url; return $this->showParent($menu_pid, $ar); }else { return $ar; } } function getCompleteURL($menu_id) { $sql= "SELECT * from ".MENU." where menu_id='$menu_id'"; $res = $this->getData($sql); $data = $res['oDATA'][0]; $menu_id = outText($data['menu_id']); $menu_pid = outText($data['menu_pid']); $menu_name = outText($data['menu_name']); $menu_url = outText($data['menu_url']); $CompleteURL = array($menu_url); $URL = $this->showParent($menu_pid,$CompleteURL); return $URL; } function showChild($menu_id) { $sql= "SELECT * from ".MENU." where menu_pid='$menu_id' order by menu_position asc, menu_name asc"; $res = $this->getData($sql); if($res['NO_OF_ITEMS']>0) { echo '<ul class="dropdown-menu"><li><div class="row dropdown-product" >'; for($i=0;$i<$res['NO_OF_ITEMS'];$i++) { $data = $res['oDATA'][$i]; $menu_id = outText($data['menu_id']); $menu_name = outText($data['menu_name']); $menu_page = outText($data['menu_page']); $menu_target = outText($data['menu_target']); $menu_image = outText($data['menu_image']); $menu_type = outText($data['menu_type']); $imgurl="images/menuimg/".$menu_image; if(is_numeric($menu_page)) { $sql_1 = "SELECT a.page_url from ".PAGES." a where a.page_id='$menu_page'"; $res_1 = $this->getData($sql_1); if($res_1['NO_OF_ITEMS']>0){ $url = getPageUrl(outText($res_1['oDATA'][0]['page_url'])); }else{ $url = "javascript: void(0)"; } } else { $url = SITE_HOME.$menu_page; } if($menu_image!='') { $abcd = '<a href="'.$url.'" /><img src="'.$imgurl.'" alt="Alcon Link Network Camera and NVR for Security Surveillance System" title="Alcon Link Network Camera and NVR for Security Surveillance System" /></a> <h6 class="title" align="center">'.$menu_name.'</h6>'; } else { $abcd = '<a href="'.$url.'"/>'.$menu_name.'</a>'; } if($menu_target) { if($menu_image!='') { $abcd = '<a href="'.$url.'" /><img src="image/menuimg/'.$menu_image.'" alt="Alcon Link Network Camera and NVR for Security Surveillance System" title="Alcon Link Network Camera and NVR for Security Surveillance System" /></a> <h6 class="title" align="center">'.$menu_name.'</h6>'; } else { $abcd = '<a href="'.$url.'" target="_blank"/>'.$menu_name.'</a>'; } } $menu_status = outText($data['menu_status']); if($menu_status=="1") { echo '<div class="col-sm-2"> <div class="page-links"> <div>'.$abcd; $this->showChild($menu_id); echo "</div></div></div>"; } } echo "</div></li></ul>"; } } function showChild1($menu_id) { $sql= "SELECT * from ".MENU." where menu_pid='$menu_id' order by menu_position asc, menu_name asc"; $res = $this->getData($sql); if($res['NO_OF_ITEMS']>0) { echo '<ul class="dropdown-menu">'; for($i=0;$i<$res['NO_OF_ITEMS'];$i++) { $data = $res['oDATA'][$i]; $menu_id = outText($data['menu_id']); $menu_name = outText($data['menu_name']); $menu_page = outText($data['menu_page']); $menu_target = outText($data['menu_target']); if(is_numeric($menu_page)) { $sql_1 = "SELECT a.page_url from ".PAGES." a where a.page_id='$menu_page'"; $res_1 = $this->getData($sql_1); if($res_1['NO_OF_ITEMS']>0){ $url = getPageUrl(outText($res_1['oDATA'][0]['page_url'])); }else{ $url = "javascript: void(0)"; } } else { $url = $menu_page; } $abcd = '<a href="'.$url.'"/>'.$menu_name.'</a>'; if($menu_target) { $abcd = '<a href="'.$url.'" target="_blank"/>'.$menu_name.'</a>'; } $menu_status = outText($data['menu_status']); if($menu_status=="1") { echo '<li>'.$abcd; $this->showChild1($menu_id); echo "</li>"; } } echo "</ul>"; } } function getMenuTree() { $sql= "SELECT * from ".MENU." where menu_pid=0 order by menu_position asc, menu_name asc"; $res = $this->getData($sql); echo '<ul class="nav navbar-nav">'; for($i=0;$i<$res['NO_OF_ITEMS'];$i++) { $data = $res['oDATA'][$i]; $menu_id = outText($data['menu_id']); $menu_name = outText($data['menu_name']); $menu_page = outText($data['menu_page']); $menu_target = outText($data['menu_target']); $menu_type = outText($data['menu_type']); if(is_numeric($menu_page)) { $sql_1 = "SELECT a.page_url,a.page_name from ".PAGES." a where a.page_id='$menu_page'"; $res_1 = $this->getData($sql_1); if($res_1['NO_OF_ITEMS']>0) $url =getPageUrl(outText($res_1['oDATA'][0]['page_url'])); else $url = "javascript: void(0)"; } else { $url = $menu_page; } if($menu_name == "HOME" || $menu_name == "home" || $menu_name == "Home" ){ $abcd = '<a href="'.$url.'"/>'.$menu_name.' </a>'; }else{ if($menu_type == 0) { $abcd = '<a href="'.$url.'" c/>'.$menu_name.'</a>'; } else { $abcd = '<a href="'.$url.'" c/>'.$menu_name.'<i class="fa fa-angle-down" style="font-weight:800"></i> </a>'; } } if($menu_target ) { $abcd = '<a href="'.$url.'" target="_blank"/>'.$menu_name.' </a>'; } $menu_status = outText($data['menu_status']); if($menu_status=="1") { if ($menu_type == 1) { echo '<li class="mega-menu">'.$abcd; $this->showChild($menu_id); echo "</li>"; } else { echo '<li>'.$abcd; $this->showChild1($menu_id); echo "</li>"; } } } echo "<li class='hidden-767' style='display:none'> <a href='pagesearch.php' class='header-search'> <span> <i class='fa fa-search'></i> </span> </a> </li>"; echo "</ul></div>"; } function getTotalMenu($menu_pid=0) { $menu_pid = (int)$menu_pid; $sql = "SELECT count(*) as total from ".MENU." m where menu_pid='$menu_pid'"; $res = $this->getData($sql); return $res['oDATA'][0]['total']; } function getMenu($menu_pid=0, $page=0, $orderby="m.menu_id", $order="desc") { $menu_pid = (int)$menu_pid; $sql = "SELECT m.* from ".MENU." m where m.menu_pid='$menu_pid' order by $orderby $order limit $page,".PAGE_LIMIT; $res = $this->getData($sql); return $res; } function getMenuDetails($menu_id) { $sql = "SELECT m.*,p.page_name,p.page_id from ".MENU." m LEFT JOIN ".PAGES." p ON m.menu_page=p.page_id where m.menu_id=$menu_id and m.menu_status='1'"; $res = $this->getData($sql); return $res; } function getMenuName($menu_id) { $menu_id = (int)$menu_id; $sql = "SELECT m.menu_name from ".MENU." m where m.menu_id='$menu_id'"; $res = $this->getData($sql); return $res['oDATA'][0]['menu_name']; } function getSubMenuDetails($menu_pid) { $sql = "SELECT m.*,p.page_name,p.page_id,p.page_url from ".MENU." m LEFT JOIN ".PAGES." p ON m.menu_page=p.page_id where m.menu_pid=$menu_pid and m.menu_status='1' order by m.menu_position,m.menu_name Asc"; $res = $this->getData($sql); return $res; } function getParentMenuURL($menu_id) { $sql = "SELECT m.menu_url from ".MENU." m where m.menu_id = (SELECT m.menu_pid from ".MENU." m where m.menu_id='$menu_id')"; $res = $this->getData($sql); return $res; } function getParentMenuID($mid) { $menu_pid = (int)$mid; $sql = "SELECT menu_pid from ".MENU." where menu_id='$menu_pid'"; $res = $this->getData($sql); return $res['oDATA'][0]['menu_pid']; } function getParentMenuName($mid) { $menu_pid = (int)$mid; $sql = "SELECT menu_name from ".MENU." where menu_pid='$menu_pid'"; $res = $this->getData($sql); return $res['oDATA'][0]['menu_name']; } function addMenu($request) { $menu_pid = (int)$request['menu_pid']; $menu_name = inText($request['menu_name']); $menu_position = (int)$request['menu_position']; $menu_target = inText($request['menu_target']); if ($_FILES['img']['name'] != "") { $path2 = "../images/menuimg"; $delpath = $path2 . "/" . $_POST['T2']; @unlink($delpath); $s1 = rand(); $realname = $_FILES['img']['name']; $realname = $s1 . "_" . $realname; $dest = $path2 . "/" . $realname; move_uploaded_file($_FILES['img']['tmp_name'], $dest); $img_name = trim($realname); $img = $img_name; } else { $img = trim($_POST['T2']); } if($request['menu_link']!="") { $menu_page = inText($request['menu_link']); } else{ $menu_page= inText($request['menu_page_id']); } $sql = "INSERT INTO ".MENU." (menu_id, menu_pid, menu_name, menu_position, menu_page, menu_image, menu_target, menu_status) VALUES (NULL, '$menu_pid', '$menu_name', '$menu_position', '$menu_page','$img', '$menu_target', '1')"; $res = $this->inserttoDB($sql); $msg = 'New Menu Added.'; setMessage($msg, "correct"); } function updateMenu($request) { $menu_id = (int)$request['menu_id']; $menu_pid = (int)$request['menu_pid']; $menu_name = inText($request['menu_name']); $menu_position = (int)$request['menu_position']; $menu_target = inText($request['menu_target']); if ($_FILES['img']['name'] != "") { $path2 = "../images/menuimg"; $delpath = $path2 . "/" . $_POST['T2']; @unlink($delpath); $s1 = rand(); $realname = $_FILES['img']['name']; $realname = $s1 . "_" . $realname; $dest = $path2 . "/" . $realname; move_uploaded_file($_FILES['img']['tmp_name'], $dest); $img_name = trim($realname); $img = $img_name; } else { $img = trim($_POST['T2']); } if($request['menu_link']!="") { $menu_page = inText($request['menu_link']); } else{ $menu_page= inText($request['menu_page_id']); } $sql = "UPDATE ".MENU." set menu_name='$menu_name', menu_position=$menu_position, menu_page='$menu_page',menu_image='$img', menu_target='$menu_target' where menu_id='$menu_id'"; $res = $this->update($sql); $msg = 'Menu Updated.'; setMessage($msg, "correct"); } function deleteMenu($menu_id) { $menu_id = (int)$menu_id; if($menu_id) { $sql = "DELETE from ".MENU." where menu_id='$menu_id'"; $res = $this->deleterecord($sql); $msg = 'Menu Deleted.'; setMessage($msg, "correct"); } } } ?>