This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| date("d/m/Y", mktime(0, 0, 0, date("m"), date("d")+5, date("Y"))); // formato DD/MM/AAAA - data atual + 5 dias |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // symfony 1.2 | |
| public function setup(){ | |
| sfValidatorBase::setRequiredMessage('O campo é obrigatório'); | |
| sfValidatorBase::setInvalidMessage('O campo é inválido'); | |
| parent::setup(); | |
| } | |
| // symfony 1.4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $(function(){ | |
| $("#frmCadastro").relatedSelects({ | |
| onChangeLoad: 'retornaDados.php', | |
| loadingMessage: 'Carregando, por favor aguarde...', | |
| selects: ['cenId', 'curId', 'disId'], | |
| disableIfEmpty: true, | |
| onEmptyResult: function(){ | |
| alert('Não existem opções disponíveis para ' + $(this).find('option:selected').text() + '!'); | |
| } | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class MyFormFilter extends BaseMyFormFilter{ | |
| public function configure(){ | |
| $this->widgetSchema['areas_conhecimento'] = | |
| new sfWidgetFormChoice(array( | |
| 'expanded' => true, | |
| 'choices' => Doctrine_Core::getTable('MyTable')->getAreasConhecimento(), | |
| )); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| class MyFormFilter extends BaseMyFormFilter{ | |
| public function doBuildQuery(array $values){ | |
| $query = parent::doBuildQuery($values); | |
| $query->leftJoin($query->getRootAlias().".Translation t"); | |
| return $query; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $years = range(2000, date("Y")); | |
| $this->widgetSchema['start_date'] = new sfWidgetFormFilterDate(array( | |
| 'from_date' => new sfWidgetFormDate(array('years' => array_combine($years, $years))), | |
| 'to_date' => new sfWidgetFormDate(array('years' => array_combine($years, $years))), | |
| 'with_empty' => false, | |
| 'template' => 'from %from_date% to %to_date%', | |
| )); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ symfony plugin:install -r 0.9.3 sfFormI18nNumberPlugin |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // http://uk.php.net/manual/en/filter.filters.php | |
| // validate | |
| // http://uk.php.net/manual/en/filter.filters.validate.php | |
| $var = filter_var($email, FILTER_VALIDATE_EMAIL); | |
| $var = filter_var($code, FILTER_VALIDATE_INT); | |
| // sanitize | |
| // http://uk.php.net/manual/en/filter.filters.sanitize.php |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ echo cmd | at 5am next year |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ curl -u user:pass -d status='Hello from shell' http://twitter.com/statuses/update.xml |