Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 757
Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 757
Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 758
Deprecated: Array and string offset access syntax with curly braces is deprecated in /var/www/html/ticnews.com.br/web/wp-includes/script-loader.php on line 758
Notice: require(): read of 2634 bytes failed with errno=12 Cannot allocate memory in /var/www/html/ticnews.com.br/web/wp-content/plugins/google-maps-easy/functions.php on line 44
Notice: require(): read of 2634 bytes failed with errno=12 Cannot allocate memory in /var/www/html/ticnews.com.br/web/wp-content/plugins/google-maps-easy/functions.php on line 44
learQuery($params);
return $data;
}
protected function _afterGetFromTbl( $row ) { // You can re-define this method in your own model
return $row;
}
protected function _buildQuery($table = null) {
if(!$table)
$table = frameGmp::_()->getTable( $this->_tbl );
if(!empty($this->_orderBy)) {
$order = $this->_orderBy;
if(!empty($this->_sortOrder))
$order .= ' '. strtoupper($this->_sortOrder);
$table->orderBy( $order );
}
if(!empty($this->_groupBy)) {
$table->groupBy( $this->_groupBy );
}
if(!empty($this->_limit)) {
$table->setLimit( $this->_limit );
}
}
public function removeGroup($ids) {
if(!is_array($ids))
$ids = array($ids);
// Remove all empty values
$ids = array_filter(array_map('intval', $ids));
if(!empty($ids)) {
if(frameGmp::_()->getTable( $this->_tbl )->delete(array('additionalCondition' => 'id IN ('. implode(',', $ids). ')'))) {
return true;
} else
$this->pushError (__('Database error detected', GMP_LANG_CODE));
} else
$this->pushError(__('Invalid ID', GMP_LANG_CODE));
return false;
}
public function clear() {
return $this->delete(); // Just delete all
}
public function delete($params = array()) {
if(frameGmp::_()->getTable( $this->_tbl )->delete( $params )) {
return true;
} else
$this->pushError (__('Database error detected', GMP_LANG_CODE));
return false;
}
public function getById($id) {
$data = $this->setWhere(array($this->_idField => $id))->getFromTbl();
return empty($data) ? false : array_shift($data);
}
public function insert($data) {
$data = $this->_dataSave($data, false);
$id = frameGmp::_()->getTable( $this->_tbl )->insert( $data );
if($id) {
return $id;
}
$this->pushError(frameGmp::_()->getTable( $this->_tbl )->getErrors());
return false;
}
public function updateById($data, $id = 0) {
if(!$id) {
$id = isset($data[ $this->_idField ]) ? (int) $data[ $this->_idField ] : 0;
}
if($id) {
return $this->update($data, array($this->_idField => $id));
} else
$this->pushError(__('Empty or invalid ID', GMP_LANG_CODE));
return false;
}
public function update($data, $where) {
$data = $this->_dataSave($data, true);
if(frameGmp::_()->getTable( $this->_tbl )->update( $data, $where )) {
return true;
}
$this->pushError(frameGmp::_()->getTable( $this->_tbl )->getErrors());
return false;
}
protected function _dataSave($data, $update = false) {
return $data;
}
public function getTbl() {
return $this->_tbl;
}
public function existsId($id) {
}
}