Example #1
0
 /**
  * Generate explanations for specified schedule parameters
  *
  * TODO: utilize \Zend_Translate_Plural or similar stuff to render proper declensions with numerals.
  *
  * @param string $periodKey
  * @param string $frequencyKey
  * @param string $cyclesKey
  * @return array
  */
 protected function _renderSchedule($periodKey, $frequencyKey, $cyclesKey)
 {
     $result = array();
     $period = $this->_getData($periodKey);
     $frequency = (int) $this->_getData($frequencyKey);
     if (!$period || !$frequency) {
         return $result;
     }
     if (PeriodUnits::SEMI_MONTH == $period) {
         $frequency = '';
     }
     $result[] = __('%1 %2 cycle.', $frequency, $this->_periodUnits->toOptionArray()[$period]);
     $cycles = (int) $this->_getData($cyclesKey);
     if ($cycles) {
         $result[] = __('Repeats %1 time(s)', $cycles);
     } else {
         $result[] = __('Repeats until suspended or canceled.');
     }
     return $result;
 }
Example #2
0
 /**
  * Getter for period unit options with "Please Select" label
  *
  * @param string $emptyLabel
  * @return array
  */
 protected function _getPeriodUnitOptions($emptyLabel)
 {
     return array_merge(array('' => $emptyLabel), $this->_periodUnits->toOptionArray());
 }
Example #3
0
 public function testToOptionArray()
 {
     $this->assertEquals(array('day' => 'Day', 'week' => 'Week', 'semi_month' => 'Two Weeks', 'month' => 'Month', 'year' => 'Year'), $this->object->toOptionArray());
 }