clockworksms_plugin.class.php 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. /* For licensing terms, see /vendor/license.txt */
  3. /**
  4. * Class ClockworksmsPlugin
  5. * This script contains SMS type constants and basic plugin functions
  6. *
  7. * @package chamilo.plugin.clockworksms.lib
  8. * @author Imanol Losada <imanol.losada@beeznest.com>
  9. * @author Julio Montoya - Refactor code
  10. */
  11. class ClockworksmsPlugin extends SmsPlugin
  12. {
  13. /**
  14. * create (a singleton function that ensures ClockworksmsPlugin instance is
  15. * created only once. If it is already created, it returns the instance)
  16. * @return object ClockworksmsPlugin instance
  17. */
  18. public static function create()
  19. {
  20. static $result = null;
  21. return $result ? $result : $result = new self();
  22. }
  23. /**
  24. * Constructor
  25. * @return void
  26. */
  27. public function __construct()
  28. {
  29. $fields = array('tool_enable' => 'boolean', 'api_key' => 'text');
  30. $smsTypeOptions = $this->getSmsTypeOptions();
  31. foreach ($smsTypeOptions as $smsTypeOption) {
  32. $fields[$smsTypeOption] = 'checkbox';
  33. }
  34. parent::__construct('0.1', 'Imanol Losada', $fields);
  35. }
  36. /**
  37. * install (uninstalls the plugin and removes all plugin's tables and/or rows)
  38. * @return void
  39. */
  40. public function uninstall()
  41. {
  42. $tSettings = Database::get_main_table(TABLE_MAIN_SETTINGS_CURRENT);
  43. $sql = "DELETE FROM $tSettings WHERE subkey = 'clockworksms'";
  44. Database::query($sql);
  45. }
  46. }