Guest User

Untitled

a guest
Jun 21st, 2018
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. <?php
  2. /**
  3. * Aluno_info_Controller
  4. *
  5. * @uses Template
  6. * @uses _Controller
  7. * @package
  8. * @version $id$
  9. * @copyright 1997-2005 The SPACEONLINE GROUP
  10. * @author Márcio Dias <suporte@spaceonline.com.br>
  11. * @license PHP Version 5.3
  12. */
  13.  
  14. class Teste_Controller extends Template_Controller {
  15.  
  16. // Do not allow to run in production
  17. const ALLOW_PRODUCTION = FALSE;
  18.  
  19. // Use the default Kohana template
  20. public $template = 'themes/base_page';
  21.  
  22. // Currently logged in user
  23. protected $user;
  24.  
  25. /**
  26. * __construct
  27. *
  28. * @access public
  29. * @return void
  30. */
  31. public function __construct()
  32. {
  33. parent::__construct();
  34.  
  35. // Load sessions, to support logins
  36. $this->session = Session::instance();
  37.  
  38. if (Auth::instance()->logged_in())
  39. {
  40. // Set the current user
  41. $this->user = $_SESSION['auth_user'];
  42. }
  43. }
  44.  
  45. /**
  46. * index
  47. *
  48. * @access public
  49. * @return void
  50. */
  51. public function index()
  52. {
  53. if ($_POST) {
  54.  
  55. $post = $_POST;
  56.  
  57. $where_mes = "";
  58.  
  59. foreach($post['mes'] as $mes) {
  60. $where_mes .= '->where("mes_ref", '."$mes".')';
  61. }
  62.  
  63. $where_ano = "";
  64.  
  65. foreach($post['ano'] as $ano) {
  66. $where_ano .= '->where("ano_ref", '."$ano".')';
  67. }
  68.  
  69. $where_curso = "";
  70.  
  71. foreach($post['curso'] as $curso) {
  72. $where_curso .= '->where("nome_curso", '."$curso".')';
  73. }
  74.  
  75. $query_orm = "$where_mes"."$where_ano"."$where_curso";
  76.  
  77. $this->template->alunos = ORM::factory('cliente').$query_orm.->find_all();
  78.  
  79. $this->template->content = "$where_mes"."$where_ano"."$where_curso";
  80.  
  81. }
  82. }
  83.  
  84. }
  85.  
  86.  
  87. ?>
Add Comment
Please, Sign In to add comment