24 include_once(
'./Services/Calendar/classes/class.ilCalendarCategories.php');
45 public function __construct($a_parent_obj,$a_parent_cmd,$a_category_id)
51 $this->cat_id = $a_category_id;
52 $this->is_editable = $this->categories->isEditable($this->cat_id);
55 $this->lng->loadLanguageModule(
'dateplaner');
58 $this->
setId(
'calcalapps');
63 $this->
addColumn($this->lng->txt(
'cal_start'),
'dt_sort',
"30%");
64 $this->
addColumn($this->lng->txt(
'title'),
'title',
"60%");
65 $this->
addColumn($this->lng->txt(
'cal_duration'),
'duration',
"20%");
66 $this->
addColumn($this->lng->txt(
'cal_recurrences'),
'frequence',
"10%");
68 if($this->is_editable)
70 $this->
addMultiCommand(
'askDeleteAppointments',$this->lng->txt(
'delete'));
71 $this->
enable(
'select_all');
78 $this->
setFormAction($this->ctrl->getFormAction($a_parent_obj));
79 $this->
setRowTemplate(
"tpl.show_appointment_row.html",
"Services/Calendar");
100 if($a_set[
'deletable'])
102 $this->tpl->setVariable(
'VAL_ID',$a_set[
'id']);
105 $this->tpl->setVariable(
'VAL_DESCRIPTION',$a_set[
'description']);
107 $this->tpl->setVariable(
'VAL_TITLE_LINK',$a_set[
'title']);
108 $this->ctrl->setParameterByClass(
'ilcalendarappointmentgui',
'app_id',$a_set[
'id']);
109 $this->tpl->setVariable(
'VAL_LINK',$this->ctrl->getLinkTargetByClass(
'ilcalendarappointmentgui',
'edit'));
111 switch($a_set[
'frequence'])
114 $this->tpl->setVariable(
'VAL_FREQUENCE',$this->lng->txt(
'cal_daily'));
118 $this->tpl->setVariable(
'VAL_FREQUENCE',$this->lng->txt(
'cal_weekly'));
122 $this->tpl->setVariable(
'VAL_FREQUENCE',$this->lng->txt(
'cal_monthly'));
126 $this->tpl->setVariable(
'VAL_FREQUENCE',$this->lng->txt(
'cal_yearly'));
131 $this->tpl->setVariable(
'VAL_FREQUENCE',
'');
134 $this->tpl->setVariable(
'VAL_BEGIN',$a_set[
'dt']);
135 if($a_set[
'duration'])
141 $this->tpl->setVariable(
'VAL_DURATION',
'');
155 include_once(
'./Services/Calendar/classes/class.ilCalendarEntry.php');
156 include_once(
'./Services/Calendar/classes/class.ilCalendarRecurrences.php');
157 include_once(
'./Services/Calendar/classes/class.ilCalendarCategory.php');
161 foreach($a_apps as $cal_entry_id)
169 include_once
'Services/Booking/classes/class.ilBookingEntry.php';
173 $title = $entry->getTitle();
176 $max = (int)$book->getNumberOfBookings();
177 $current = (int)$book->getCurrentNumberOfBookings($entry->getEntryId());
180 $title .=
' ('.$current.
'/'.$max.
')';
182 else if($current == $max)
184 $title .=
' ('.$this->lng->txt(
'cal_booked_out').
')';
188 $title .=
' ('.$this->lng->txt(
'cal_book_free').
')';
191 else if($book->hasBooked($entry->getEntryId()))
193 $title .=
' ('.$this->lng->txt(
'cal_date_booked').
')';
199 $title = $entry->getPresentationTitle();
202 $tmp_arr[
'id'] = $entry->getEntryId();
203 $tmp_arr[
'title'] =
$title;
204 $tmp_arr[
'description'] = $entry->getDescription();
205 $tmp_arr[
'fullday'] = $entry->isFullday();
206 $tmp_arr[
'begin'] = $entry->getStart()->get(
IL_CAL_UNIX);
207 $tmp_arr[
'end'] = $entry->getEnd()->get(
IL_CAL_UNIX);
209 $tmp_arr[
'dt_sort'] = $entry->getStart()->get(
IL_CAL_UNIX);
215 #$tmp_arr['duration'] = ($dur = $tmp_arr['end'] - $tmp_arr['begin']) ? $dur : 60 * 60 * 24;
216 $tmp_arr[
'duration'] = $tmp_arr[
'end'] - $tmp_arr[
'begin'];
217 if($tmp_arr[
'fullday'])
219 $tmp_arr[
'duration'] += (60 * 60 * 24);
222 if(!$tmp_arr[
'fullday'] and $tmp_arr[
'end'] == $tmp_arr[
'begin'])
224 $tmp_arr[
'duration'] =
'';
226 $tmp_arr[
'frequence'] = $rec->getFrequenceType();
229 $appointments[] = $tmp_arr;
231 $this->
setData($appointments ? $appointments : array());