Projekt

Obecné

Profil

<?php defined('SYSPATH') or die('No direct script access.');
/*
* This file is part of open source system FreeNetIS
* and it is released under GPLv3 licence.
*
* More info about licence can be found:
* http://www.gnu.org/licenses/gpl-3.0.html
*
* More info about project can be found:
* http://www.freenetis.org/
*
*/

/**
* Abstract class for SMS
*
* @author Roman Sevcik
*/
abstract class Sms
{

private $driver;
protected $user;
protected $password;
protected $text;
protected $error;
protected $status;
protected $sender;
protected $recipient;
public static $INACTIVE = 1;
public static $SOUNDWINV100 = 2;
public static $KLIKNIAVOLEJ = 3;
public static $NEJLEVNEJSISMS = 4;
public static $DRIVER_INACTIVE = 1;
public static $DRIVER_ACTIVE = 2;
private static $drivers = array
(
2 => 'Soundwin V100',
3 => 'Klikniavolej.cz',
4 => 'NejlevnějšíSMS.cz',
);

public function __construct()
{
$this->driver = self::$INACTIVE;
}

public function user($user)
{
$this->user = $user;
}

public function password($password)
{
$this->password = $password;
}

public function text($text)
{
$this->text = $text;
}

public function sender($sender)
{
$this->sender = $sender;
}

public function recipient($recipient)
{
$this->recipient = $recipient;
}

public function get_error()
{
return $this->error;
}

public function get_status()
{
return $this->status;
}

abstract public function test_conn();

abstract public function send();

abstract public function receive();
public static function get_driver_name($driver)
{
switch ($driver)
{
case self::$KLIKNIAVOLEJ:
return 'SMS ' . __('Gateway') . ' ' . self::$drivers[self::$KLIKNIAVOLEJ];
case self::$NEJLEVNEJSISMS:
return 'SMS ' . __('Gateway') . ' ' . self::$drivers[self::$NEJLEVNEJSISMS];
case self::$SOUNDWINV100:
return 'GSM ' . __('Gateway') . ' ' . self::$drivers[self::$SOUNDWINV100];
case self::$INACTIVE:
default:
return __('Inactive');
}
}
public static function get_drivers()
{
return self::$drivers;
}

}
(17-17/23)