108 lines
2.6 KiB
PHP
108 lines
2.6 KiB
PHP
<?php
|
|
|
|
namespace BRSystems\Core\Sys\sysApcOverview\inc;
|
|
|
|
use BRSystems\Core\Library\cApc\cApc;
|
|
use BRSystems\Core\Library\cDb\cDb;
|
|
|
|
/**
|
|
* sysApcOverview Module
|
|
*
|
|
* @category sysApcOverview Module
|
|
* @author Mareks Keišs <mareks.keiss@brsystems.lv>
|
|
* @since Version 2.0
|
|
*/
|
|
class sysApcOverviewModule
|
|
{
|
|
public $db;
|
|
private $oApc;
|
|
|
|
/**
|
|
* Class constructor
|
|
*
|
|
* @param object $cApc - apc object
|
|
*/
|
|
public function __construct($cApc) {
|
|
|
|
$this->oApc = $cApc;
|
|
$this->db = cDb::getInstance();
|
|
|
|
}
|
|
|
|
/**
|
|
* Function to get module records
|
|
*
|
|
* @author Mareks Keišs <mareks.keiss@brsystems.lv>
|
|
* @category sysApcOverview Module
|
|
* @param string $where - sql query
|
|
* @param string $sort - sql query
|
|
* @param int $offset - db table offset
|
|
* @param int $limitPerPage - limit per page
|
|
* @return array of data
|
|
* @version 1.1
|
|
*/
|
|
public function getModuleRecords($where, $sort, $offset = 0, $limitPerPage = 20){
|
|
|
|
$sSql = "
|
|
SELECT SQL_CALC_FOUND_ROWS
|
|
*
|
|
FROM
|
|
temp_cache_exp sc
|
|
WHERE
|
|
1 {$where}
|
|
ORDER BY
|
|
{$sort}
|
|
LIMIT
|
|
{$offset}, {$limitPerPage}
|
|
";
|
|
|
|
$this->db->query($sSql);
|
|
return $this->db->getArray();
|
|
}
|
|
|
|
/**
|
|
* Function to delete table records form db
|
|
*
|
|
* @author Mareks Keišs <mareks.keiss@brsystems.lv>
|
|
* @category sysApcOverview Module
|
|
* @param array $ids - record ids to delete
|
|
* @return bool true / false
|
|
* @version 1.1
|
|
*/
|
|
public function deleteRecords($ids){
|
|
|
|
$ids = implode(',', $ids);
|
|
return $this->db->execute("DELETE FROM `temp_cache_exp` WHERE `id` IN ({$ids})");
|
|
|
|
}
|
|
|
|
/**
|
|
* Function to get record data by id
|
|
*
|
|
* @author Mareks Keišs <mareks.keiss@brsystems.lv>
|
|
* @category cmsCatFilters Module
|
|
* @param int $id - record id
|
|
* @return array - record data
|
|
* @version 1.1
|
|
*/
|
|
public function getRecordDataById($id){
|
|
|
|
return $this->db->_querySelectRow('temp_cache_exp', false, array('id' => $id));
|
|
|
|
}
|
|
|
|
/**
|
|
* Function to delete all table records form db
|
|
*
|
|
* @author Mareks Keišs <mareks.keiss@brsystems.lv>
|
|
* @category sysApcOverview Module
|
|
* @return bool true / false
|
|
* @version 1.1
|
|
*/
|
|
public function deleteAllRecords(){
|
|
|
|
return $this->db->execute("DELETE FROM `temp_cache_exp` WHERE `key` <> '" . $this->oApc->prefix . cApc::APC_KEY . "'");
|
|
|
|
}
|
|
}
|