* @since Version 2.0 */ class sysActionLogModule { public $db; /** * Class constructor */ public function __construct() { $this->db = cDb::getInstance(); } /** * Function to get module records * * @author Mareks Keišs * @category sysActionLog 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 " . cDbLog::C_BASE_ACTION_TABLE . " ll 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 * @category sysActionLog 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 `" . cDbLog::C_BASE_ACTION_TABLE . "` WHERE `id` IN ({$ids})"); } /** * Function to get record data by id * * @author Mareks Keišs * @category cmsCatFilters Module * @param int $id - record id * @return array - record data * @version 1.1 */ public function getRecordDataById($id){ return $this->db->_querySelectRow(cDbLog::C_BASE_ACTION_TABLE, false, array('id' => $id)); } /** * Function to delete all table records form db * * @author Mareks Keišs * @category sysActionLog Module * @return bool true / false * @version 1.1 */ public function deleteAllRecords(){ return $this->db->execute("DELETE FROM " . cDbLog::C_BASE_ACTION_TABLE); } }