%PDF- <> %âãÏÓ endobj 2 0 obj <> endobj 3 0 obj <>/ExtGState<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI] >>/Annots[ 28 0 R 29 0 R] /MediaBox[ 0 0 595.5 842.25] /Contents 4 0 R/Group<>/Tabs/S>> endobj ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<>endobj 2 0 obj<> endobj 2 0 obj<>endobj 2 0 obj<>es 3 0 R>> endobj 2 0 obj<> ox[ 0.000000 0.000000 609.600000 935.600000]/Fi endobj 3 0 obj<> endobj 7 1 obj<>/ProcSet[/PDF/Text/ImageB/ImageC/ImageI]>>/Subtype/Form>> stream
<?php
class Shardastory_model extends CI_Model
{
public function __construct()
{
parent::__construct();
}
/*
* Function : deleteRecords
* Description : Delete Record
*/
public function deleteRecords($id, $field_name= 'id', $tbl_name='tbl_shardastory')
{
$this->db->where($field_name, $id);
$data = array();
$data = array('is_deleted'=> '1','status'=>'0', 'modifiedon'=>date('Y-m-d h:i:s'));
if (!$this->db->update($tbl_name, $data)) {
log_message('error', print_r($this->db->error(), true));
show_error(lang('database_error'));
}
}
/*
* Function : setRecords
* Description : Insert/Update the records based on id
*/
function setRecords($post, $tbl_name = 'tbl_shardastory')
{
$post['story_url'] = str_replace(" ","-",strtolower(trim($post['story_url'])));
unset($post['submit']);
if($post['story_image']=='') { $post['story_image'] = $post['old_image']; }
if ($post['edit'] > 0) {
$this->db->where('id', $post['edit']);
unset($post['edit']);
unset($post['id']);
unset($post['old_image']);
if (!$this->db->update($tbl_name, $post)) {
print_r($this->db->error());
log_message('error', print_r($this->db->error(), true));
show_error(lang('database_error'));
}
} else {
unset($post['edit']);
unset($post['id']);
$post['createdon'] = date('Y-m-d h:i:s');
if (!$this->db->insert($tbl_name, $post)) {
print_r($this->db->error());
log_message('error', print_r($this->db->error(), true));
show_error(lang('database_error'));
}
}
}
/*
* Function : getRecords
* Description : Get all table records
*/
function getRecords( $id = NULL, $tbl_name='tbl_shardastory', $limit=0)
{
$this->db->select('*');
$this->db->order_by('id', 'desc');
$this->db->order_by('display_order', 'asc');
$this->db->where('is_deleted', '0');
if($id>0){
$this->db->where('id', $id);
}
if($limit>0){
$this->db->limit($limit);
}
$queryResult = $this->db->get($tbl_name);
if ($id >0) {
return $queryResult->row_array();
} else {
return $queryResult->result_array();
}
}
}