Overview

Namespaces

  • None
  • PHP
  • tschiemer
    • Aspsms
      • Http
      • Soap
      • Xml

Classes

  • Aspsms
  • Aspsms_demo
  • Overview
  • Namespace
  • Class
  • Tree
 1: <?php
 2: 
 3: require_once APPPATH . 'third_party/tschiemer/autoload.php';
 4: 
 5: /**
 6:  * Adapter interface of aspsms-php for CodeIgniter
 7:  * 
 8:  * @version 1.1.0
 9:  * @package aspsms.adapter.codeigniter
10:  * @license LGPL v3 http://www.gnu.org/licenses/lgpl-3.0.txt 
11:  * @copyright 2013 Philip Tschiemer, <tschiemer@filou.se>
12:  * @link https://github.com/tschiemer/aspsms-php
13:  */
14: class Aspsms extends tschiemer\Aspsms\SimpleClient
15: {
16:     /**
17:      * @var CI_Controller
18:      */
19:     var $CI;
20:     
21:     public function __construct($config = array())
22:     {
23:         $this->CI = get_instance();
24:         
25:         $config_base = $this->CI->load->config('aspsms',TRUE);
26:         
27:         // overwrite base configuration with any config values passed
28:         foreach($config as $k => $v)
29:         {
30:             $config_base[$k] = $v;
31:         }
32:         
33:         // initialize as usual
34:         parent::__construct($config_base);
35:     }
36:     
37:     
38:     /**
39:      * Request: Get description to given status code.
40:      * 
41:      * @param string|int $statusCode
42:      * @param boolean $force_query Do not rely on database of known status codes, force query.
43:      * @return string
44:      */
45:     public function getStatusDescription($statusCode, $force_query = FALSE)
46:     {   
47:         $param = array(
48:             'RequestName' => 'getStatusCodeDescription',
49:             'StatusCode'  => $statusCode,
50:             'Userkey'     => $this->userkey,
51:             'Password'    => $this->password
52:         );
53:         
54:         if ( ! $force_query)
55:         {
56:             $this->CI->lang->load('aspsms','english');
57:             $status = $this->CI->lang->line('status_'.intval($statusCode));
58:             if ($status !== NULL)
59:             {
60:                 // Simulate actual request in case any other request/response
61:                 // processing would take place.
62:                 $this->lastRequest = new Aspsms\Request($param);
63:                 
64:                 $this->lastResponse = new \Aspsms\Response($this->lastRequest);
65:                 $this->lastResponse->statusCode(\Aspsms\Response::STAT_OK);
66:                 $this->lastResponse->result = $status;
67:                 
68:                 return $this->lastResponse->result();
69:             }
70:         }
71:         
72:         
73:         return $this->send($param);
74:     }
75: }
76: 
aspsms-php API documentation generated by ApiGen 2.8.0