本文整理汇总了PHP中delete_event函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_event函数的具体用法?PHP delete_event怎么用?PHP delete_event使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delete_event函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _wwassignment_delete_events
/**
* @desc Deletes all events relating to the wwassignment passed in.
* @param $wwassignmentid integer The wwassignment ID.
* @return integer 0 on success
*/
function _wwassignment_delete_events($wwassignment)
{
$wwassignmentid = $wwassignment->id;
if ($events = get_records_select('event', "modulename = 'wwassignment' and instance = '{$wwassignmentid}'")) {
foreach ($events as $event) {
// error_log("deleting event ".$event->id);
delete_event($event->id);
}
}
return 0;
}
示例2: certificate_delete_instance
function certificate_delete_instance($id)
{
if (!($certificate = get_record('certificate', 'id', $id))) {
return false;
}
$result = true;
delete_records('certificate_issues', 'certificateid', $certificate->id);
if (!delete_records('certificate', 'id', $certificate->id)) {
$result = false;
}
if ($events = get_records_select('event', "modulename = 'certificate' and instance = '{$certificate->id}'")) {
foreach ($events as $event) {
delete_event($event->id);
}
}
return $result;
}
示例3: session_start
session_start();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<?php
include 'header.php';
if (isset($_POST['addBook'])) {
add_book();
} elseif (isset($_POST['deleteBook'])) {
delete_book();
} elseif (isset($_POST['addEvent'])) {
add_event();
} elseif (isset($_POST['deleteEvent'])) {
delete_event();
} elseif (isset($_POST['uploadNewsletter'])) {
upload_newsletter();
} elseif (isset($_POST['deleteNewsletter'])) {
delete_newsletter();
} elseif (isset($_POST['uploadReport'])) {
upload_report();
} elseif (isset($_POST['deleteReport'])) {
delete_report();
} else {
echo "Error: Please submit changes to the site first.";
}
// TODO: If logged_user is the admin user, then this page will be available as a link
// TODO: Add following forms:
// ADD/DELETE Books/Events Form
// Upload Newsletter form
示例4: delete_course_module
function delete_course_module($id)
{
global $CFG;
require_once $CFG->libdir . '/gradelib.php';
if (!($cm = get_record('course_modules', 'id', $id))) {
return true;
}
$modulename = get_field('modules', 'name', 'id', $cm->module);
//delete events from calendar
if ($events = get_records_select('event', "instance = '{$cm->instance}' AND modulename = '{$modulename}'")) {
foreach ($events as $event) {
delete_event($event->id);
}
}
//delete grade items, outcome items and grades attached to modules
if ($grade_items = grade_item::fetch_all(array('itemtype' => 'mod', 'itemmodule' => $modulename, 'iteminstance' => $cm->instance, 'courseid' => $cm->course))) {
foreach ($grade_items as $grade_item) {
$grade_item->delete('moddelete');
}
}
delete_context(CONTEXT_MODULE, $cm->id);
return delete_records('course_modules', 'id', $cm->id);
}
示例5: delete_recursive_event
public static function delete_recursive_event($eventid, $eventtype)
{
global $langNotValidInput;
$rec_eventid = Database::get()->query('SELECT source_event_id FROM personal_calendar WHERE id=?d', $eventid);
if ($rec_eventid) {
return delete_event($rec_eventid, $eventtype, true);
} else {
return array('success' => false, 'message' => $langNotValidInput);
}
}
示例6:
$event['description'] = $_POST['desc'];
$event['subject'] = $_POST['subject'];
$_REQUEST['action'] = 'modify';
}
}
} else {
if ($_REQUEST['action'] == 'submit_delete') {
if (delete_event_slot($_SESSION['valid_user'], $event['event_id'], $_REQUEST['date_time'])) {
$page_info_message = "Time slot deleted successfully!";
} else {
$page_error_message = "Event time slot could not be deleted. Please try again.";
}
$_REQUEST['action'] = 'delete';
} else {
if ($_REQUEST['action'] == 'delete_event') {
if (delete_event($_SESSION['valid_user'], $event['event_id'])) {
$page_info_message = "Event deleted successfully!";
$page_error_message = "No event to display.";
} else {
$page_error_message = "Event time slot could not be deleted. Please try again.";
$_REQUEST['action'] = 'delete';
}
}
}
}
}
// end of if event_id
if (!empty($_REQUEST['page_info_message'])) {
$page_info_message = $_REQUEST['page_info_message'];
}
$page_title = 'Booking Calendar - Event Details';
示例7: delete_event
/**
* Delete event
*
* Delete event for this model, assumes we have a serial_number
*
**/
public function delete_event()
{
delete_event($this->serial_number, $this->tablename);
}
示例8: delete_course_module
/**
* Delete a course module and any associated data at the course level (events)
* Until 1.5 this function simply marked a deleted flag ... now it
* deletes it completely.
*
*/
function delete_course_module($id)
{
global $CFG, $DB;
require_once $CFG->libdir . '/gradelib.php';
require_once $CFG->dirroot . '/blog/lib.php';
if (!($cm = $DB->get_record('course_modules', array('id' => $id)))) {
return true;
}
$modulename = $DB->get_field('modules', 'name', array('id' => $cm->module));
//delete events from calendar
if ($events = $DB->get_records('event', array('instance' => $cm->instance, 'modulename' => $modulename))) {
foreach ($events as $event) {
delete_event($event->id);
}
}
//delete grade items, outcome items and grades attached to modules
if ($grade_items = grade_item::fetch_all(array('itemtype' => 'mod', 'itemmodule' => $modulename, 'iteminstance' => $cm->instance, 'courseid' => $cm->course))) {
foreach ($grade_items as $grade_item) {
$grade_item->delete('moddelete');
}
}
// Delete completion and availability data; it is better to do this even if the
// features are not turned on, in case they were turned on previously (these will be
// very quick on an empty table)
$DB->delete_records('course_modules_completion', array('coursemoduleid' => $cm->id));
$DB->delete_records('course_modules_availability', array('coursemoduleid' => $cm->id));
$DB->delete_records('course_completion_criteria', array('moduleinstance' => $cm->id, 'criteriatype' => COMPLETION_CRITERIA_TYPE_ACTIVITY));
delete_context(CONTEXT_MODULE, $cm->id);
return $DB->delete_records('course_modules', array('id' => $cm->id));
}
示例9: course_delete_module
/**
* This function will handles the whole deletion process of a module. This includes calling
* the modules delete_instance function, deleting files, events, grades, conditional data,
* the data in the course_module and course_sections table and adding a module deletion
* event to the DB.
*
* @param int $cmid the course module id
* @since 2.5
*/
function course_delete_module($cmid)
{
global $CFG, $DB, $USER;
require_once $CFG->libdir . '/gradelib.php';
require_once $CFG->dirroot . '/blog/lib.php';
// Get the course module.
if (!($cm = $DB->get_record('course_modules', array('id' => $cmid)))) {
return true;
}
// Get the module context.
$modcontext = context_module::instance($cm->id);
// Get the course module name.
$modulename = $DB->get_field('modules', 'name', array('id' => $cm->module), MUST_EXIST);
// Get the file location of the delete_instance function for this module.
$modlib = "{$CFG->dirroot}/mod/{$modulename}/lib.php";
// Include the file required to call the delete_instance function for this module.
if (file_exists($modlib)) {
require_once $modlib;
} else {
throw new moodle_exception('cannotdeletemodulemissinglib', '', '', null, "Cannot delete this module as the file mod/{$modulename}/lib.php is missing.");
}
$deleteinstancefunction = $modulename . '_delete_instance';
// Ensure the delete_instance function exists for this module.
if (!function_exists($deleteinstancefunction)) {
throw new moodle_exception('cannotdeletemodulemissingfunc', '', '', null, "Cannot delete this module as the function {$modulename}_delete_instance is missing in mod/{$modulename}/lib.php.");
}
// Call the delete_instance function, if it returns false throw an exception.
if (!$deleteinstancefunction($cm->instance)) {
throw new moodle_exception('cannotdeletemoduleinstance', '', '', null, "Cannot delete the module {$modulename} (instance).");
}
// Remove all module files in case modules forget to do that.
$fs = get_file_storage();
$fs->delete_area_files($modcontext->id);
// Delete events from calendar.
if ($events = $DB->get_records('event', array('instance' => $cm->instance, 'modulename' => $modulename))) {
foreach ($events as $event) {
delete_event($event->id);
}
}
// Delete grade items, outcome items and grades attached to modules.
if ($grade_items = grade_item::fetch_all(array('itemtype' => 'mod', 'itemmodule' => $modulename, 'iteminstance' => $cm->instance, 'courseid' => $cm->course))) {
foreach ($grade_items as $grade_item) {
$grade_item->delete('moddelete');
}
}
// Delete completion and availability data; it is better to do this even if the
// features are not turned on, in case they were turned on previously (these will be
// very quick on an empty table).
$DB->delete_records('course_modules_completion', array('coursemoduleid' => $cm->id));
$DB->delete_records('course_modules_availability', array('coursemoduleid' => $cm->id));
$DB->delete_records('course_modules_avail_fields', array('coursemoduleid' => $cm->id));
$DB->delete_records('course_completion_criteria', array('moduleinstance' => $cm->id, 'criteriatype' => COMPLETION_CRITERIA_TYPE_ACTIVITY));
// Delete the context.
delete_context(CONTEXT_MODULE, $cm->id);
// Delete the module from the course_modules table.
$DB->delete_records('course_modules', array('id' => $cm->id));
// Delete module from that section.
if (!delete_mod_from_section($cm->id, $cm->section)) {
throw new moodle_exception('cannotdeletemodulefromsection', '', '', null, "Cannot delete the module {$modulename} (instance) from section.");
}
// Trigger a mod_deleted event with information about this module.
$eventdata = new stdClass();
$eventdata->modulename = $modulename;
$eventdata->cmid = $cm->id;
$eventdata->courseid = $cm->course;
$eventdata->userid = $USER->id;
events_trigger('mod_deleted', $eventdata);
add_to_log($cm->course, 'course', "delete mod", "view.php?id={$cm->course}", "{$modulename} {$cm->instance}", $cm->id);
rebuild_course_cache($cm->course, true);
}
示例10: delete_user
function delete_user($userID)
{
//make sure we have a user id to prevent deleting other peoples events!
if ($userID == '' || $userID == '%') {
return false;
}
//convert the userid into a username
$userDetails = get_user($userID);
$username = $userDetails['username'];
//remove a user and all related events
$result = wrap_db_query("SELECT event_id FROM " . BOOKING_EVENT_TABLE . " WHERE user_id = '" . $userID . "'");
if (!$result) {
return false;
}
//delete all the events and associated links from the booking schedule
while ($fields = wrap_db_fetch_array($result)) {
delete_event($username, $fields['event_id'], false);
}
// delete any saved options set for this user
$query = 'DELETE FROM ' . BOOKING_USER_OPTIONS_TABLE . ' WHERE user_id="' . $userID . '"';
wrap_db_query($query);
//attempt to delete any options found. No point failing if they can't be removed though.
// delete any pending buddies for this user and any entrances where this user is the pending buddy
$query = 'DELETE FROM ' . BOOKING_BUDDIES_PENDING . ' WHERE user_id="' . $userID . '" OR buddy_id="' . $userID . '"';
wrap_db_query($query);
//attempt to delete any pending buddies found. No point failing if they can't be removed though.
// delete any buddies for this user and any entrances where this user is the buddy
$query = 'DELETE FROM ' . BOOKING_BUDDIES . ' WHERE user_id="' . $userID . '" OR buddy_id="' . $userID . '"';
wrap_db_query($query);
//attempt to delete any buddies found. No point failing if they can't be removed though.
//finally, delete the actual user
$result = wrap_db_query("DELETE FROM " . BOOKING_USER_TABLE . " WHERE user_id = '" . $userID . "' LIMIT 1");
if (!$result) {
return false;
}
//if you get here then everything went smoothly
return true;
}
示例11: url_action_calendar
function url_action_calendar($tools, $get, $post)
{
require_once $tools->include_path . 'cal_include.php';
if (!$tools->logged_in()) {
$tools->page_not_found();
}
/* get the current mailbox if any */
$mailbox = $tools->get_mailbox();
/* set the current mailbox */
if ($mailbox) {
$tools->set_mailbox($mailbox);
}
/* default values */
$page_data = array();
$week = false;
$month = false;
$today = date('m-d-Y');
$year = false;
$title = '';
$detail = '';
$repeat = 0;
$duration = 0;
$event_time = 0;
$month_label = false;
$day = false;
$last_day = false;
$events = array();
$duration = '';
$duration2 = '';
$event_time = '';
$event_time2 = '';
$first_week_day = false;
$all_events = array();
$edit_id = 0;
$dsp_page = 'calendar_month';
$final_week = false;
if (isset($post['calendar_add'])) {
$req_flds = array('title', 'year', 'month', 'day');
$opt_flds = array('repeat', 'detail', 'event_time', 'event_time2', 'duration', 'duration2');
$cal_atts = normalize_input($req_flds, $opt_flds, $post);
$cnt = count($req_flds) + count($opt_flds);
if (count($cal_atts) == $cnt) {
$edit_id = add_cal_event($cal_atts, $tools);
if ($edit_id) {
$tools->send_notice('Event Added');
$dsp_page = 'edit';
} else {
$tools->send_notice('An error occured adding this event');
$dsp_page = 'add';
}
} else {
$dsp_page = 'add';
foreach ($req_flds as $v) {
if (isset($cal_atts[$v])) {
${$v} = $cal_atts[$v];
}
}
foreach ($opt_flds as $v) {
if (isset($cal_atts[$v])) {
${$v} = $cal_atts[$v];
}
}
}
} elseif (isset($post['calendar_update'])) {
if (isset($post['event_id']) && ($event_id = $post['event_id'])) {
$edit_id = $post['event_id'];
$dsp_page = 'edit';
$req_flds = array('title', 'year', 'month', 'day', 'event_id');
$opt_flds = array('repeat', 'detail', 'event_time', 'event_time2', 'duration', 'duration2');
$cal_atts = normalize_input($req_flds, $opt_flds, $post);
$cnt = count($req_flds) + count($opt_flds);
if (count($cal_atts) == $cnt) {
$res = update_event($tools, $cal_atts);
if ($res) {
$tools->send_notice('Event Updated');
}
}
}
} elseif (isset($post['calendar_delete'])) {
if (isset($post['event_id']) && ($del_id = intval($post['event_id']))) {
if (delete_event($tools, $del_id)) {
calendar_init($tools);
$tools->send_notice('Event Deleted');
$dsp_page = 'calendar_month';
$month = date('m');
$year = date('Y');
$month_label = strtolower(date('F'));
$last_day = date('d', mktime(0, 0, 0, $month + 1, 0, $year));
$first_week_day = date('w', mktime(0, 0, 0, $month, 1, $year));
if ($first_week_day + $last_day > 36) {
$final_week = 6;
} elseif ($first_week_day == 0 && $last_day == 28) {
$final_week = 4;
} else {
$final_week = 5;
}
} else {
$edit_id = $del_id;
send_notice('Could not delete event');
}
//.........这里部分代码省略.........
示例12: save_event
save_event($values);
$app->redirect('/backoffice/eventos');
});
$app->get('/evento/editar/:id', $authenticate($app), function ($id) use($app) {
$event = get_events_id($id);
$app->render('evento_editar.php', array('event' => $event, 'pageTitle' => _('Editar') . ' ' . get_setting('evento_singular')));
});
// Guardar Evento Editar
$app->post('/evento/editar', $authenticate($app), function () use($app) {
$event = $app->request()->post('event');
update_event($event);
$app->redirect('/backoffice/eventos');
});
//Deletes a event
$app->get('/evento/apagar/:id', $authenticate($app), function ($id) use($app) {
delete_event($id);
$app->redirect('/backoffice/eventos');
});
// Get the user page settings
$app->get('/defenicoes', $authenticate($app), function () use($app) {
$app->render('defenicoes.php', array('pageTitle' => _('Definições')));
});
// Save defenicoes no website
$app->post('/defenicoes', $authenticate($app), function () use($app, $db) {
$settings = $app->request()->post('settings');
echo var_dump($settings);
// Guarda o nome do titulo
if (isset($settings['nome'])) {
$value = "'" . $settings['nome'] . "'";
save_setting('nome', $value);
}
示例13: setevent
function setevent($itemid, $add)
{
global $DB;
$item = $this->items[$itemid];
$update = false;
if (!$add || $item->duetime == 0) {
// Remove the event (if any)
if (!$item->eventid) {
return;
// No event to remove
}
delete_event($item->eventid);
$this->items[$itemid]->eventid = 0;
$update = true;
} else {
// Add/update event
$event = new stdClass();
$event->name = $item->displaytext;
$event->description = get_string('calendardescription', 'checklist', $this->checklist->name);
$event->courseid = $this->course->id;
$event->modulename = 'checklist';
$event->instance = $this->checklist->id;
$event->eventtype = 'due';
$event->timestart = $item->duetime;
if ($item->eventid) {
$event->id = $item->eventid;
update_event($event);
} else {
$this->items[$itemid]->eventid = add_event($event);
$update = true;
}
}
if ($update) {
// Event added or removed
$upditem = new stdClass();
$upditem->id = $itemid;
$upditem->eventid = $this->items[$itemid]->eventid;
$DB->update_record('checklist_item', $upditem);
}
}
示例14: adobeconnect_delete_instance
/**
* Given an ID of an instance of this module,
* this function will permanently delete the instance
* and any data that depends on it.
*
* @param int $id Id of the module instance
* @return boolean Success/Failure
*/
function adobeconnect_delete_instance($id)
{
if (!($adobeconnect = get_record('adobeconnect', 'id', $id))) {
return false;
}
$result = true;
// Remove meeting from Adobe connect server
$adbmeetings = get_records('adobeconnect_meeting_groups', 'instanceid', $adobeconnect->id);
if (!empty($adbmeetings)) {
$aconnect = aconnect_login();
foreach ($adbmeetings as $meeting) {
// Update calendar event
$eventid = get_field('event', 'id', 'courseid', $adobeconnect->course, 'instance', $adobeconnect->id, 'groupid', $meeting->groupid);
if (!empty($eventid)) {
delete_event($eventid);
}
aconnect_remove_meeting($aconnect, $meeting->meetingscoid);
}
aconnect_logout($aconnect);
}
$result &= delete_records('adobeconnect', 'id', $adobeconnect->id);
$result &= delete_records('adobeconnect_meeting_groups', 'instanceid', $adobeconnect->id);
return $result;
}
示例15: html_tag
echo html_tag('table', html_tag('tr', html_tag('th', _("Do you really want to delete this event?") . '<br />', '', $color[4], 'colspan="2"')) . html_tag('tr', html_tag('td', _("Date:"), 'right', $color[4]) . html_tag('td', date_intl(_("m/d/Y"), mktime(0, 0, 0, $dmonth, $dday, $dyear)), 'left', $color[4])) . html_tag('tr', html_tag('td', _("Time:"), 'right', $color[4]) . html_tag('td', date_intl(_("H:i"), mktime($dhour, $dminute, 0, $dmonth, $dday, $dyear)), 'left', $color[4])) . html_tag('tr', html_tag('td', _("Title:"), 'right', $color[4]) . html_tag('td', htmlspecialchars($tmparray['title']), 'left', $color[4])) . html_tag('tr', html_tag('td', _("Message:"), 'right', $color[4]) . html_tag('td', nl2br(htmlspecialchars($tmparray['message'])), 'left', $color[4])) . html_tag('tr', html_tag('td', " <form name=\"delevent\" method=\"post\" action=\"{$calself}\">\n" . " <input type=\"hidden\" name=\"dyear\" value=\"{$dyear}\" />\n" . " <input type=\"hidden\" name=\"dmonth\" value=\"{$dmonth}\" />\n" . " <input type=\"hidden\" name=\"dday\" value=\"{$dday}\" />\n" . " <input type=\"hidden\" name=\"year\" value=\"{$year}\" />\n" . " <input type=\"hidden\" name=\"month\" value=\"{$month}\" />\n" . " <input type=\"hidden\" name=\"day\" value=\"{$day}\" />\n" . " <input type=\"hidden\" name=\"dhour\" value=\"{$dhour}\" />\n" . " <input type=\"hidden\" name=\"dminute\" value=\"{$dminute}\" />\n" . " <input type=\"hidden\" name=\"confirmed\" value=\"yes\" />\n" . ' <input type="submit" value="' . _("Yes") . "\" />\n" . " </form>\n", 'right', $color[4]) . html_tag('td', " <form name=\"nodelevent\" method=\"post\" action=\"day.php\">\n" . " <input type=\"hidden\" name=\"year\" value=\"{$year}\" />\n" . " <input type=\"hidden\" name=\"month\" value=\"{$month}\" />\n" . " <input type=\"hidden\" name=\"day\" value=\"{$day}\" />\n" . ' <input type="submit" value="' . _("No") . "\" />\n" . " </form>\n", 'left', $color[4])), '', $color[0], 'border="0" cellpadding="2" cellspacing="1"');
}
if ($month <= 0) {
$month = date('m');
}
if ($year <= 0) {
$year = date('Y');
}
if ($day <= 0) {
$day = date('d');
}
$calself = basename($PHP_SELF);
displayPageHeader($color, 'None');
//load calendar menu
calendar_header();
echo html_tag('tr', '', '', $color[0]) . html_tag('td') . html_tag('table', '', '', $color[0], 'width="100%" border="0" cellpadding="2" cellspacing="1"') . html_tag('tr') . html_tag('td', '', 'left') . date_intl(_("l, F j Y"), mktime(0, 0, 0, $month, $day, $year));
if (isset($dyear) && isset($dmonth) && isset($dday) && isset($dhour) && isset($dminute)) {
if (isset($confirmed)) {
delete_event("{$dmonth}{$dday}{$dyear}", "{$dhour}{$dminute}");
echo '<br /><br />' . _("Event deleted!") . "<br />\n";
echo "<a href=\"day.php?year={$year}&month={$month}&day={$day}\">" . _("Day View") . "</a>\n";
} else {
readcalendardata();
confirm_deletion();
}
} else {
echo '<br />' . _("Nothing to delete!");
}
?>
</table></td></tr></table>
</body></html>