Tryag File Manager
Home
||
Turbo Force
||
B-F Config_Cpanel
Current Path :
/
home
/
cts.eemo.co.kr
/
public_html
/
src
/
library
/
CTS
/
Or
Select Your Path :
Upload File :
New :
File
Dir
/home/cts.eemo.co.kr/public_html/src/library/CTS/Mobile.php
<?php require_once '../../library/MeekroDB/DB.php'; class Mobile { static public function insertInfo($title, $contents, $writer, $tableName) { $sql = "INSERT INTO $tableName($tableName"."_title ,$tableName"."_contents, $tableName"."_writer, $tableName"."_date) VALUES ('$title','$contents','$writer',now());"; \DB::query($sql); } static public function getLastInfo($tableName){ $sql = "select * from $tableName ORDER BY $tableName"."_idx DESC limit 1"; return \DB::query($sql); } static public function updateInfo($title, $contents, $writer, $tableName, $index) { $sql = "UPDATE $tableName SET info_title = '$title', info_contents = '$contents' WHERE info_idx = $index"; \DB::query($sql); } static public function get_contents($tableName, $idx){ $sql = "select * from $tableName where $tableName" . "_idx = $idx"; return \DB::query($sql); } static public function deleteInfo($tableName, $index) { $sql = "DELETE FROM $tableName WHERE $tableName"."_idx=$index"; \DB::query($sql); } static public function getContentsList($tableName){ $sql = "select * from $tableName"; return \DB::query($sql); } static public function getContentsPage($page, $tableName, $title="", $writer=""){ $page = ($page*10-10) .', '.($page*10); // select * from info where info_title like '1%' and info_writer like '%' order by info_idx desc limit 0, 10 if($title != ""){ $title = "and $tableName"."_title like '%$title%'"; } $sql = "select * from $tableName where $tableName"."_writer like '$writer%' $title order by $tableName"."_idx desc limit $page"; // \DB::debugMode(); return \DB::query($sql); } static public function getContentsPageSearch($tableName, $title="", $writer=""){ if($title != ""){ $title = "and $tableName"."_title like '%$title%'"; } $sql = "select * from $tableName where $tableName"."_writer like '$writer%' $title order by $tableName"."_idx desc"; // \DB::debugMode(); return \DB::query($sql); } static public function getContentsPagination($page, $tableName, $title, $writer) { $count_arr = count(\Mobile::getContentsPageSearch( $tableName, $title, $writer)); $top = "<div class='float-right pagination'> <ul class='pagination'> <li class='page-item page-pre'> <a class='page-link' href='#'>‹</a> </li>"; $bottom = "<li class='page-item page-next'> <a class='page-link' href='#'>›</a> </li> </ul> </div>"; echo $top; $pageCount = (int)($count_arr / 10 == 1 ? 0 : $count_arr / 10) + 1; for ($i = 0; $i < $pageCount; $i++ ) { $temp = $i+1; $tmp = ""; if($page == $temp){ $tmp = "active"; } echo "<li class='page-item $tmp'>"; echo "<a class='page-link' href='".$_SERVER['REDIRECT_URL']. '?page='. $temp ." &tableName=".$tableName ."' >". $temp ."</a>"; echo "</li>"; } echo $bottom; } // end getListPage } // end class