/** * show assigned aapointments * * @access protected * @return */ protected function showAssignedAppointments() { include_once './Services/Calendar/classes/class.ilCalendarCategoryTableGUI.php'; include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php'; include_once './Services/Calendar/classes/class.ilCalendarAppointmentsTableGUI.php'; $table_gui = new ilCalendarAppointmentsTableGUI($this, 'details', (int) $_GET['category_id']); $table_gui->setTitle($this->lng->txt('cal_assigned_appointments')); $table_gui->setAppointments(ilCalendarCategoryAssignments::_getAssignedAppointments(ilCalendarCategories::_getInstance()->getSubitemCategories((int) $_GET['category_id']))); return $table_gui->getHTML(); }
protected function addCategories() { foreach ($this->calendars as $category_id) { foreach (ilCalendarCategoryAssignments::_getAssignedAppointments(array($category_id)) as $app_id) { $this->addAppointment($app_id); } } }
/** * Import ical in calendar * @param ilCalendarCategory $cat */ protected function importIcal(ilCalendarCategory $cat) { // Delete old appointments include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php'; foreach (ilCalendarCategoryAssignments::_getAssignedAppointments(array($cat->getCategoryID())) as $app_id) { include_once './Services/Calendar/classes/class.ilCalendarEntry.php'; ilCalendarEntry::_delete($app_id); } ilCalendarCategoryAssignments::_deleteByCategoryId($cat->getCategoryID()); // Import new appointments include_once './Services/Calendar/classes/iCal/class.ilICalParser.php'; $parser = new ilICalParser($this->ical, ilICalParser::INPUT_STRING); $parser->setCategoryId($cat->getCategoryID()); $parser->parse(); }
/** * parse calendar data * * @access public * @param * @return */ public function parse() { global $ilUser; $counter = 0; $calendars = array(); $status = new ilCalendarSharedStatus($ilUser->getId()); foreach ($this->cal_data as $data) { if ($status->isDeclined($data['cal_id']) || $status->isAccepted($data['cal_id'])) { continue; } $tmp_calendar = new ilCalendarCategory($data['cal_id']); $calendars[$counter]['cal_id'] = $data['cal_id']; $calendars[$counter]['create_date'] = $data['create_date']; $calendars[$counter]['obj_type'] = $data['obj_type']; $calendars[$counter]['name'] = $tmp_calendar->getTitle(); $calendars[$counter]['owner'] = $tmp_calendar->getObjId(); $calendars[$counter]['apps'] = count(ilCalendarCategoryAssignments::_getAssignedAppointments(array($data['cal_id']))); $calendars[$counter]['accepted'] = $status->isAccepted($data['cal_id']); $calendars[$counter]['declined'] = $status->isDeclined($data['cal_id']); $counter++; } $this->setData($calendars ? $calendars : array()); return count($calendars) ? true : false; }
/** * delete * * @access public * @return */ public function delete() { global $ilDB; $query = "DELETE FROM cal_categories " . "WHERE cat_id = " . $this->db->quote($this->cat_id, 'integer') . " "; $res = $ilDB->manipulate($query); include_once './Services/Calendar/classes/class.ilCalendarHidden.php'; ilCalendarHidden::_deleteCategories($this->cat_id); include_once './Services/Calendar/classes/class.ilCalendarCategoryAssignments.php'; foreach (ilCalendarCategoryAssignments::_getAssignedAppointments(array($this->cat_id)) as $app_id) { include_once './Services/Calendar/classes/class.ilCalendarEntry.php'; ilCalendarEntry::_delete($app_id); } ilCalendarCategoryAssignments::_deleteByCategoryId($this->cat_id); }
/** * Determine the dependent sets of data */ protected function getDependencies($a_entity, $a_version, $a_rec, $a_ids) { switch ($a_entity) { case "calendar": include_once "./Services/Calendar/classes/class.ilCalendarCategoryAssignments.php"; $assignmnts = ilCalendarCategoryAssignments::_getAssignedAppointments(array($a_rec["CatId"])); $entries = array(); foreach ($assignmnts as $cal_id) { $entries[$cal_id] = $cal_id; } return array("cal_entry" => array("ids" => $entries), "cal_assignment" => array("ids" => $a_rec["CatId"])); case "cal_entry": return array("recurrence_rule" => array("ids" => $a_rec["Id"])); } return false; }