Exemplo n.º 1
0
 /**
  * Make calendar items list.
  * @param array $data
  * @param string $field
  * @param string $itemClass
  * @param string $type
  * @return string
  */
 public static function makeCalendarItemsList($data, $field, $itemClass, $type)
 {
     assert('is_array($data)');
     assert('is_string($field)');
     assert('is_string($itemClass)');
     assert('is_string($type)');
     $itemsContent = null;
     foreach ($data as $calendarArray) {
         $isChecked = false;
         if ($calendarArray[1] === true) {
             $isChecked = true;
         }
         $input = ZurmoHtml::checkBox($field, $isChecked, array('value' => $calendarArray[0]->id, 'class' => $itemClass));
         $color = ZurmoHtml::tag('span', array('class' => 'cal-color', 'style' => 'background:' . $calendarArray[0]->color), '');
         if ($type == 'saved') {
             $label = $calendarArray[0]->name;
             $options = self::getSavedCalendarOptions($calendarArray[0]->id);
             $subscriptionData = null;
         } else {
             $savedCalendar = $calendarArray[0]->savedcalendar;
             $label = $savedCalendar->name;
             $options = self::getSharedCalendarOptions($calendarArray[0]->id);
             $subscriptionData = CalendarUtil::getCalendarSubscriberData($calendarArray[0]->savedcalendar);
         }
         $label = ZurmoHtml::tag('strong', array('class' => 'cal-name'), $label);
         $itemsContent .= ZurmoHtml::tag('li', array(), $input . $color . $label . $subscriptionData . $options);
     }
     return ZurmoHtml::tag('ul', array('class' => 'calendars-list'), $itemsContent);
 }