Example #1
0
 public function configure()
 {
     unset($this['created_at'], $this['updated_at']);
     $this->widgetSchema['iteration_id'] = new sfWidgetFormDoctrineChoice(array('model' => 'Iteration', 'query' => Doctrine::getTable('Iteration')->findByProjectQuery($this->getObject()->getProject()), 'add_empty' => false));
     $this->widgetSchema['priority'] = new sfWidgetFormChoice(array('choices' => NB::getPriorities()));
     $this->validatorSchema['iteration_id'] = new sfValidatorDoctrineChoice(array('model' => 'Iteration', 'query' => Doctrine::getTable('Iteration')->findByProjectQuery($this->getObject()->getProject())));
     $this->validatorSchema['priority'] = new sfValidatorChoice(array('choices' => array_keys(NB::getPriorities())));
     $this->widgetSchema->setLabels(array('iteration_id' => 'Iteration'));
 }
Example #2
0
 public function configure()
 {
     unset($this['created_at'], $this['updated_at'], $this['effort_left'], $this['effort_spent'], $this['status']);
     $query = Doctrine::getTable('Story')->findByIterationQuery($this->getObject()->getIteration());
     $this->widgetSchema['story_id'] = new sfWidgetFormDoctrineChoice(array('model' => 'Story', 'query' => $query, 'add_empty' => false));
     $this->widgetSchema['priority'] = new sfWidgetFormChoice(array('choices' => NB::getPriorities()));
     $this->setDefault('priority', 'p4');
     $this->validatorSchema['story_id'] = new sfValidatorDoctrineChoice(array('model' => 'Story', 'query' => $query));
     if ($this->isNew()) {
         unset($this['current_estimate']);
         $this->widgetSchema['original_estimate'] = new nbWidgetFormEstimate();
         $this->validatorSchema['original_estimate'] = new nbEstimateValidator();
         $this->widgetSchema->setHelp('original_estimate', $this->formatEstimateHelp());
         $this->setDefault('original_estimate', 30);
     } else {
         unset($this['original_estimate']);
         $this->widgetSchema['current_estimate'] = new nbWidgetFormEstimate();
         $this->validatorSchema['current_estimate'] = new nbEstimateValidator();
         $this->widgetSchema->setHelp('current_estimate', $this->formatEstimateHelp());
     }
     $this->widgetSchema['name']->setAttribute('class', 'width90');
     $this->validatorSchema['priority'] = new sfValidatorChoice(array('choices' => array_keys(NB::getPriorities())));
 }
Example #3
0
<?php

require_once dirname(__FILE__) . '/../bootstrap/unit.php';
$t = new lime_test(6, new lime_output_color());
$t->comment('::clean()');
$validator = new mdEstimateValidator();
$t->is($validator->clean('36:00'), 2160, '::clean(\'36:00\') returns 2160 minutes');
$t->is($validator->clean('2160'), 2160, '::clean(\'2160\') returns 2160 minutes');
$t->is($validator->clean('12:34:56'), 754, '::clean(\'12:34:56\') returns 754 minutes');
$t->comment('NB::formatEstimate()');
$t->is(NB::formatEstimate(12), '00:12', '::toDate(12) returns 12 minutes');
$t->is(NB::formatEstimate(754), '12:34', '::toDate(754) returns 12 hours and 34 minutes');
$t->is(NB::formatEstimate(2160), '36:00', '::toDate(2160) returns 36 hours');
 public function render($name, $value = null, $attributes = array(), $errors = array())
 {
     $value = NB::formatEstimate($value);
     return $this->renderTag('input', array_merge(array('type' => 'input', 'name' => $name, 'value' => $value), $attributes));
 }