Guest User

Untitled

a guest
Jul 21st, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.57 KB | None | 0 0
  1. <?php defined('SYSPATH') OR die('No direct access allowed.');
  2.  
  3. /**
  4. * Model_Oferta
  5. *
  6. * @uses ORM
  7. * @package
  8. * @version $id$
  9. * @copyright 1997-2010 The SPACEONLINE GROUP
  10. * @author Márcio Dias <suporte@spaceonline.com.br>
  11. * @license PHP Version 5.3
  12. */
  13. class Model_Oferta extends ORM {
  14.  
  15. /**
  16. * _db
  17. *
  18. * @var string
  19. * @access protected
  20. */
  21. protected $_db = 'default'; // or any db group defined in database configuration
  22.  
  23. /**
  24. * _table_name
  25. *
  26. * @var string
  27. * @access protected
  28. */
  29. protected $_table_name = 'ofertas';
  30.  
  31. /**
  32. * _has_many
  33. *
  34. * @var string
  35. * @access protected
  36. */
  37. protected $_has_many = array(
  38. 'comments' => array('model' => 'comment', 'foreign_key' => 'oferta_id'),
  39. 'enderecos' => array('model' => 'ofertaendereco', 'foreign_key' => 'oferta_id'),
  40. 'telefones' => array('model' => 'ofertatelefone', 'foreign_key' => 'oferta_id'),
  41. 'images' => array('model' => 'ofertaimage', 'foreign_key' => 'oferta_id'),
  42. );
  43.  
  44.  
  45.  
  46. /**
  47. * validate_create
  48. *
  49. * @param & $&array
  50. * @access public
  51. * @return void
  52. */
  53. public function validate_create(& $array)
  54. {
  55. $array = Validate::factory($array)
  56. ->rule('cidade', 'not_empty')
  57. ->rule('titulo', 'not_empty')
  58. ->rule('editor1', 'not_empty')
  59. ->rule('editor2', 'not_empty')
  60. ->rule('empresa', 'not_empty')
  61. ->rule('rua', 'not_empty')
  62. ->rule('numero', 'not_empty')
  63. ->rule('cep', 'not_empty')
  64. ->rule('bairro', 'not_empty')
  65. ->rule('imagem1', 'Upload::valid')
  66. ->rule('numero_minimo', 'not_empty')
  67. ->rule('numero_maximo', 'not_empty')
  68. ->rule('valor_produto', 'not_empty')
  69. ->rule('valor_promocao', 'not_empty')
  70. ->rule('valor_comissao', 'not_empty')
  71. ->rule('date_start', 'not_empty')
  72. ->rule('date_close', 'not_empty')
  73. ->rule('telefone', 'not_empty')
  74. ->filter('imagem1', 'trim')
  75. ->filter('logomarca', 'trim')
  76. ->filter('cidade', 'trim')
  77. ->filter('titulo', 'trim')
  78. ->filter('telefone', 'trim')
  79. ->filter('date_start', 'trim')
  80. ->filter('date_close', 'trim')
  81. ->filter('numero_minimo', 'trim')
  82. ->filter('numero_maximo', 'trim')
  83. ->filter('valor_promocao', 'trim')
  84. ->filter('valor_produto', 'trim')
  85. ->filter('valor_comissao', 'trim')
  86. ->filter('editor2', 'trim')
  87. ->filter('editor1', 'trim')
  88. ->filter('empresa', 'trim')
  89. ->filter('rua', 'trim')
  90. ->filter('numero', 'trim')
  91. ->filter('complemento', 'trim')
  92. ->filter('cep', 'trim')
  93. ->filter('bairro', 'trim');
  94.  
  95. return $array;
  96. }
  97.  
  98. }
Add Comment
Please, Sign In to add comment