<?php /** * Tokens_model.php class file * * @package AIR\Models * @version V2.7.0 * @copyright 2015, BizyCorp Internal Systems Development * @license private, All rights reserved * @author MRM Roshan <roshan@ekwa.com> * */ if ( ! defined('BASEPATH')) exit('No direct script access allowed'); /** * This model file maintains tables of application informations * * Functions available :- * function __construct() - class constructor * function exists() - checks for existing primary key * function save_token_data() - saves generated token data * function get_uaacs_data() - gets app uaacs data for a given token * Creation date :- Jun 5, 2014 * Last Modified on :- * Last Modification :- * * @package AIR\Models * @author Mohamed Ruzaik Mohamed Roshan <roshan@ekwa.com> * @version V2.7.0 * @created Jun 5, 2014 */ class Tokens_model extends CI_Model{ /** * Abstract __construct function * * Class constructor */ function __construct(){ parent::__construct(); }//end of function /** * save_token_data($data) * * This function saves given data array in ar_tokens table * * @param array $data * @return int affected rows */ public function save_token_data($data){ $this->db->insert('ar_tokens',$data); $num_inserts = $this->db->affected_rows(); return $num_inserts; }//end of function /** * exists($primekey) * * This function checks for duplicate records with given data * * @param arrau $primekey * @return boolean */ function exists($primekey) { $this->db->from('ar_tokens'); foreach ($primekey as $k=>$v){ $this->db->where($k,$v); } $query = $this->db->get(); $num_rows = $query->num_rows(); $exist = ($num_rows > 0 )? true : false; return $exist; }//end of function /** * get_uaacs_data($token) * * This function gets token related info data from table for given token * * @param string $token */ function get_uaacs_data($token) { $this->db->select('*'); $this->db->from('ar_tokens'); $this->db->where('token',$token); $query = $this->db->get(); if($this->debug) log_message('info',"<b>tokens_model/get_uaacs_data();query:".print_r($query,true)."</b>"); return $query->result_array(); }//end of function }//end of class ?>