예제 #1
0
 /**
  * Adds an item
  * 
  * @param double $value
  * @param string $label
  * 
  * @throws \Exception if $value doesn't validate
  * @throws \Exception if $label doesn't validate
  * 
  * @return \sfAltumoPlugin\Geckoboard\Widget\FunnelWidget 
  */
 public function addItem($value, $label)
 {
     $value = \Altumo\Validation\Numerics::assertDouble($value);
     $label = \Altumo\Validation\Strings::assertString($label);
     $item = new \stdClass();
     $item->value = $value;
     $item->label = $label;
     $this->items[] = $item;
     return $this;
 }
 /**
  * (non-PHPdoc)
  * @see Geckoboard\Widget.AbstractWidget::getContent()
  */
 public function getContent()
 {
     // make sure we have a primary value
     \Altumo\Validation\Numerics::assertDouble($this->getPrimaryValue());
     $wrapper = new \stdClass();
     $wrapper->item = array();
     $item = new \stdClass();
     $item->value = $this->getPrimaryValue();
     $item->text = $this->getPrimaryText();
     $wrapper->item[] = $item;
     if ($this->getSecondaryValue()) {
         $item = new \stdClass();
         $item->value = $this->getSecondaryValue();
         $item->text = $this->getSecondaryText();
         $wrapper->item[] = $item;
     }
     return $wrapper;
 }
예제 #3
0
 /**
  * Sets the amber value
  *
  * @param double $value
  *
  * @return \sfAltumoPlugin\Geckoboard\Widget\RAGNumbersWidget
  */
 public function setAmberValue($value)
 {
     $this->amber_value = \Altumo\Validation\Numerics::assertDouble($value);
     return $this;
 }
예제 #4
0
 /**
  * (non-PHPdoc)
  * @see Geckoboard\Widget.AbstractWidget::getContent()
  */
 public function getContent()
 {
     // make sure we have a primary value
     \Altumo\Validation\Numerics::assertDouble($this->getItem(), 'An item is required');
     $wrapper = new \stdClass();
     $wrapper->item = $this->getItem();
     $min = new \stdClass();
     $min->value = $this->getMinValue();
     $min->text = $this->getMinText();
     $wrapper->min = $min;
     $max = new \stdClass();
     $max->value = $this->getMaxValue();
     $max->text = $this->getMaxText();
     $wrapper->max = $max;
     return $wrapper;
 }
예제 #5
0
 /**
  * @param double $value
  * 
  * @return \sfAltumoPlugin\Geckoboard\Widget\LineChartWidget
  * 
  * @throws \Exception if item fails to validate
  */
 public function addItem($value)
 {
     $this->items[] = \Altumo\Validation\Numerics::assertDouble($value);
     return $this;
 }