/application/modules/home/controllers/test.php

https://bitbucket.org/matyhaty/senses-designertravelv3 · PHP · 154 lines · 108 code · 39 blank · 7 comment · 1 complexity · 02e744f1e43a60ff36974062497caf06 MD5 · raw file

  1. <?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  2. class Test extends Base_Controller {
  3. function __construct()
  4. {
  5. parent::__construct();
  6. }
  7. public function cacheTest()
  8. {
  9. $this->maintaincache->setCache('tester/test.txt', 'Hello Cache World');
  10. }
  11. public function ftpTest($depotCode)
  12. {
  13. error_reporting(E_ALL);
  14. ini_set('display_errors', '1');
  15. $CI = &get_instance();
  16. $CI -> load -> library('ftp');
  17. //$fileList = $this -> teamleaf -> ftp_newTask('CONNECTIONTEST', 'DUD', 1);
  18. echo 'This is the FTP test.';
  19. echo '<hr>Config found for depot code: '.$depotCode.': <br/>';
  20. $c = $this -> teamleaf -> ftp_getconfig($depotCode);
  21. print_r($this -> teamleaf -> ftp_getconfig($depotCode));
  22. echo '<br/><br/>';
  23. echo 'The remote path is: <br/>';
  24. echo $this -> teamleaf -> ftp_remotePath($depotCode);
  25. echo '<h2>Trying to connect</h2>';
  26. echo $CI -> ftp -> connect($c);
  27. }
  28. public function ftpTestWrite($depotCode)
  29. {
  30. $fileList = $this -> teamleaf -> ftp_newTask('140', 'DUD', 1);
  31. }
  32. function related()
  33. {
  34. $task = new Task(1194);
  35. $ta = new Taskassign(1460);
  36. echo $task->is_related_to($ta);
  37. }
  38. function hotelupdate()
  39. {
  40. $ho = new Hotel();
  41. $ho->get();
  42. foreach($ho as $h)
  43. {
  44. $h->slugify = $this->teamleaf->slugify($h->title);
  45. $h->save();
  46. }
  47. }
  48. function destinationupdate()
  49. {
  50. $ho = new Destination();
  51. $ho->get();
  52. foreach($ho as $h)
  53. {
  54. $h->slugify = $this->teamleaf->slugify($h->title);
  55. $h->save();
  56. }
  57. }
  58. public function tester()
  59. {
  60. echo '<hr>Departments Checker<br/>';
  61. $dd = new Department();
  62. $dd->where('id', 1);
  63. $dd->or_where('id', 2);
  64. $dd->get();
  65. foreach($dd as $r)
  66. {
  67. echo $r->id .' - '.$r->title .'<br/>';
  68. // DEpartments
  69. $ddc = new Department();
  70. $ddc->where('id', $r->id);
  71. $ddc->get();
  72. $ddc->task->get();
  73. echo '<i>Which has related Task:</i>';
  74. echo '<ul>';
  75. foreach($ddc->task as $task)
  76. {
  77. echo '<li>'.$task->id.' </li>';
  78. }
  79. echo '</ul>';
  80. }
  81. //--------------------------------------------------------------------------------
  82. echo '<hr>Depot Checker<br/>';
  83. $dp = new Depot();
  84. $dp->where('id', 104);
  85. $dp->get();
  86. foreach($dp as $r)
  87. {
  88. echo $r->id .' - '.$r->title .'<br/>';
  89. // DEpots
  90. $ddp = new Depot();
  91. $ddp->where('id', $r->id);
  92. $ddp->get();
  93. $ddp->task->get();
  94. echo '<i>Which has related Task:</i>';
  95. echo '<ul>';
  96. foreach($ddp->task as $task)
  97. {
  98. echo '<li>'.$task->id.' </li>';
  99. }
  100. echo '</ul>';
  101. }
  102. //----------------------------------------------------------------------------------
  103. echo '<hr> Tasks which are related to any of the departmentments and depots:<br/>';
  104. $tt = new Task();
  105. $tt->where_in_related($dd, 'state', 'Active');
  106. $tt->where_in_related($dp, 'state', 'Active');
  107. $tt->get();
  108. foreach($tt as $r)
  109. {
  110. echo $r->id .' - '.$r->title .'<br/>';
  111. }
  112. }
  113. }
  114. /* End of file welcome.php */
  115. /* Location: ./application/controllers/welcome.php */