Ejemplo n.º 1
0
 /**
  * Method to get the field input markup for check boxes.
  *
  * @return  string  The field input markup.
  *
  * @since   11.1
  */
 protected function getInput()
 {
     $html = array();
     // Get default id
     $this->defaults_id = $this->form->getValue('defaults_id') ? $this->form->getValue('defaults_id') : 0;
     // Set days
     $days = $this->element['days'] ? $this->element['days'] : '1-2-3-4-5-6-7';
     $days = $this->form->getValue('days') ? $this->form->getValue('days') : $days;
     $days = explode('-', $days);
     // Set meals
     $meals = $this->element['meals'] ? $this->element['meals'] : '1,2,3';
     $meals = $this->form->getValue('meal') ? $this->form->getValue('meal') : $meals;
     $meals = explode(',', $meals);
     // Temp value
     $value_array = $this->value;
     foreach ($meals as $meal) {
         $this->meal = $meal;
         $options = (array) $this->getOptions();
         $html[] = '<div class="span4">';
         $html[] = '<div class="control-group center">' . SibdietHelper::convertMeals($meal) . '</div>';
         foreach ($days as $day) {
             $this->value = isset($value_array[$meal][$day]) ? $value_array[$meal][$day] : '';
             $this->name = 'jform[' . $this->fieldname . '][' . $meal . '][' . $day . ']';
             $this->id = $this->id . 'meal' . $meal . 'day' . $day;
             $this->hint = SibdietHelper::dayToString($day);
             $html[] = '<div class="control-group center">';
             $html[] = parent::getInput();
             $html[] = '</div>';
         }
         $html[] = '</div>';
     }
     return implode($html);
 }