function testEditCalendarEventType() { // Test the forum edits edit_event_type($this->eventtype_id, "test_event_type1", 'calendar/testtype1', ''); // Test the forum was actually created $this->assertTrue('test_event_type1' == get_translated_text($GLOBALS['SITE_DB']->query_value('calendar_types', 't_title ', array('id' => $this->eventtype_id)))); }
/** * Standard aed_module edit actualiser. * * @param ID_TEXT The entry being edited */ function edit_actualisation($id) { require_code('themes2'); edit_event_type(intval($id), post_param('title'), get_theme_img_code('calendar'), post_param('external_feed')); if (!fractional_edit()) { $this->set_permissions($id); } }
/** * Edit a bookable. * * @param AUTO_LINK Bookable ID. * @param array Bookable details. * @param array List of codes. * @param ?array List of black-outs (NULL: no change). * @param ?array List of supplements (NULL: no change). */ function edit_bookable($bookable_id, $bookable_details, $codes, $blacked = NULL, $supplements = NULL) { $_old_bookable = $GLOBALS['SITE_DB']->query_select('bookable', array('*'), array('id' => $bookable_id), '', 1); if (!array_key_exists(0, $_old_bookable)) { warn_exit(do_lang_tempcode('MISSING_RESOURCE')); } $title = $bookable_details['title']; $bookable_details['title'] = lang_remap($_old_bookable[0]['title'], $bookable_details['title']); $bookable_details['description'] = lang_remap($_old_bookable[0]['description'], $bookable_details['description']); $bookable_details['categorisation'] = lang_remap($_old_bookable[0]['categorisation'], $bookable_details['categorisation']); $bookable_details['edit_date'] = time(); $bookable_details['calendar_type'] = $_old_bookable[0]['calendar_type']; require_code('calendar2'); $external_feed = find_script('bookings_ical') . '?id=' . strval($bookable_id) . '&pass='******'booking_salt_' . $GLOBALS['SITE_INFO']['admin_password']); if (is_null($bookable_details['calendar_type']) && is_null($GLOBALS['SITE_DB']->query_value_null_ok('calendar_types', 'id', array('id' => $bookable_details['calendar_type'])))) { $bookable_details['calendar_type'] = add_event_type($title, 'calendar/booking', $external_feed); } else { edit_event_type($bookable_details['calendar_type'], $title, 'calendar/booking', $external_feed); } $GLOBALS['SITE_DB']->query_update('bookable', $bookable_details, array('id' => $bookable_id), '', 1); $GLOBALS['SITE_DB']->query_delete('bookable_codes', array('bookable_id' => $bookable_id)); foreach ($codes as $code) { $GLOBALS['SITE_DB']->query_insert('bookable_codes', array('bookable_id' => $bookable_id, 'code' => $code)); } if (!is_null($blacked)) { $GLOBALS['SITE_DB']->query_delete('bookable_blacked_for', array('bookable_id' => $bookable_id)); foreach ($blacked as $blacked_id) { $GLOBALS['SITE_DB']->query_insert('bookable_blacked_for', array('blacked_id' => $blacked_id, 'bookable_id' => $bookable_id)); } } if (!is_null($supplements)) { $GLOBALS['SITE_DB']->query_delete('bookable_supplement_for', array('bookable_id' => $bookable_id)); foreach ($supplements as $supplement_id) { $GLOBALS['SITE_DB']->query_insert('bookable_supplement_for', array('supplement_id' => $supplement_id, 'bookable_id' => $bookable_id)); } } log_it('EDIT_BOOKABLE', strval($bookable_id), $title); }