Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php defined('SYSPATH') OR die('No direct access allowed.');
- /**
- * Model_Oferta
- *
- * @uses ORM
- * @package
- * @version $id$
- * @copyright 1997-2010 The SPACEONLINE GROUP
- * @author Márcio Dias <suporte@spaceonline.com.br>
- * @license PHP Version 5.3
- */
- class Model_Oferta extends ORM {
- /**
- * _db
- *
- * @var string
- * @access protected
- */
- protected $_db = 'default'; // or any db group defined in database configuration
- /**
- * _table_name
- *
- * @var string
- * @access protected
- */
- protected $_table_name = 'ofertas';
- /**
- * _has_many
- *
- * @var string
- * @access protected
- */
- protected $_has_many = array(
- 'comments' => array('model' => 'comment', 'foreign_key' => 'oferta_id'),
- 'enderecos' => array('model' => 'ofertaendereco', 'foreign_key' => 'oferta_id'),
- 'telefones' => array('model' => 'ofertatelefone', 'foreign_key' => 'oferta_id'),
- 'images' => array('model' => 'ofertaimage', 'foreign_key' => 'oferta_id'),
- );
- /**
- * validate_create
- *
- * @param & $&array
- * @access public
- * @return void
- */
- public function validate_create(& $array)
- {
- $array = Validate::factory($array)
- ->rule('cidade', 'not_empty')
- ->rule('titulo', 'not_empty')
- ->rule('editor1', 'not_empty')
- ->rule('editor2', 'not_empty')
- ->rule('empresa', 'not_empty')
- ->rule('rua', 'not_empty')
- ->rule('numero', 'not_empty')
- ->rule('cep', 'not_empty')
- ->rule('bairro', 'not_empty')
- ->rule('imagem1', 'Upload::valid')
- ->rule('numero_minimo', 'not_empty')
- ->rule('numero_maximo', 'not_empty')
- ->rule('valor_produto', 'not_empty')
- ->rule('valor_promocao', 'not_empty')
- ->rule('valor_comissao', 'not_empty')
- ->rule('date_start', 'not_empty')
- ->rule('date_close', 'not_empty')
- ->rule('telefone', 'not_empty')
- ->filter('imagem1', 'trim')
- ->filter('logomarca', 'trim')
- ->filter('cidade', 'trim')
- ->filter('titulo', 'trim')
- ->filter('telefone', 'trim')
- ->filter('date_start', 'trim')
- ->filter('date_close', 'trim')
- ->filter('numero_minimo', 'trim')
- ->filter('numero_maximo', 'trim')
- ->filter('valor_promocao', 'trim')
- ->filter('valor_produto', 'trim')
- ->filter('valor_comissao', 'trim')
- ->filter('editor2', 'trim')
- ->filter('editor1', 'trim')
- ->filter('empresa', 'trim')
- ->filter('rua', 'trim')
- ->filter('numero', 'trim')
- ->filter('complemento', 'trim')
- ->filter('cep', 'trim')
- ->filter('bairro', 'trim');
- return $array;
- }
- }
Add Comment
Please, Sign In to add comment