LoginTCC.php 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * Class LoginTCC
  4. */
  5. class LoginTCC extends Plugin
  6. {
  7. public $isCoursePlugin = false;
  8. /**
  9. * Constructor.
  10. */
  11. protected function __construct()
  12. {
  13. parent::__construct(
  14. 'O.1',
  15. 'Julio Montoya',
  16. [
  17. 'tool_enable' => 'boolean',
  18. 'webservice_url' => 'text',
  19. 'sso_url' => 'text',
  20. 'hash' => 'text'
  21. ]
  22. );
  23. }
  24. /**
  25. * @return LoginTCC|null
  26. */
  27. public static function create()
  28. {
  29. static $result = null;
  30. return $result ? $result : $result = new self();
  31. }
  32. /**
  33. * Install
  34. */
  35. public function install()
  36. {
  37. $extraField = new ExtraField('user');
  38. $data = $extraField->get_handler_field_info_by_field_variable('tcc_user_id');
  39. if (empty($data)) {
  40. $params = [
  41. 'field_type' => 1,
  42. 'variable' => 'tcc_user_id',
  43. 'display_text' => 'TCC user id',
  44. 'default_value' => 0,
  45. 'visible' => false,
  46. 'changeable' => true,
  47. 'filter' => false
  48. ];
  49. $extraField->save($params);
  50. }
  51. $data = $extraField->get_handler_field_info_by_field_variable('tcc_hash_key');
  52. if (empty($data)) {
  53. $params = [
  54. 'field_type' => 1,
  55. 'variable' => 'tcc_hash_key',
  56. 'display_text' => 'TCC hash key',
  57. 'default_value' => 0,
  58. 'visible' => false,
  59. 'changeable' => true,
  60. 'filter' => false
  61. ];
  62. $extraField->save($params);
  63. }
  64. }
  65. /**
  66. * Uninstall
  67. */
  68. public function uninstall()
  69. {
  70. }
  71. }