本文整理汇总了PHP中Event::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Event::delete方法的具体用法?PHP Event::delete怎么用?PHP Event::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Event
的用法示例。
在下文中一共展示了Event::delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run($eventId)
{
if (isset(Yii::app()->session["userId"])) {
Event::delete($eventId, Yii::app()->session["userId"]);
}
Rest::json(array('result' => true, "msg" => Yii::t("event", "Event removed")));
}
示例2: _ops_delete
function _ops_delete($OID = 0, $CID = 0)
{
$OID = max(0, intval($OID));
$CID = max(0, intval($CID));
$msg = '';
loginRequireMgmt();
if (!loginCheckPermission(USER::TEST_EVENT)) {
redirect("errors/401");
}
$itemName = "Event";
$urlPrefix = "test_event";
$object = new Event($OID, $CID);
if (!$object->exists()) {
$msg = "{$itemName} not found!";
} else {
transactionBegin();
if ($object->delete()) {
transactionCommit();
$msg = "{$itemName} deleted!";
} else {
TransactionRollback();
$msg = "{$itemName} delete failed!";
}
}
redirect("{$urlPrefix}/manage", $msg);
}
示例3: eventmanager_action
function eventmanager_action()
{
global $_, $conf, $myUser;
switch ($_['action']) {
case 'eventmanager_save_event':
if ($myUser->can('event', 'c') || $myUser->can('event', 'u')) {
$event = new Event();
$event = $_['eventId'] != '' ? $event->getById($_['eventId']) : $event;
$event->setName($_['eventName']);
$event->setYear($_['eventYear']);
$event->setMonth($_['eventMonth']);
$event->setDay($_['eventDay']);
$event->setHour($_['eventHour']);
$event->setMinut($_['eventMinut']);
$event->setRepeat('0');
$content = array();
//Todo, prendre en compte le multi action ([1],[2]...)
$event->setRecipients(array());
$event->addRecipient($_['eventTarget']);
$content[0]['type'] = $_['eventType'];
$event->setState($_['eventState']);
switch ($content[0]['type']) {
case 'talk':
$content[0]['sentence'] = $_['eventContent'];
break;
case 'sound':
$content[0]['file'] = $_['eventContent'];
break;
case 'command':
$content[0]['program'] = $_['eventContent'];
break;
case 'gpio':
$content[0]['gpios'] = $_['eventContent'];
break;
}
$event->setContent($content[0]);
//$event->setRecipients('all'); //@TODO
$event->save();
header('location:index.php?module=eventmanager');
} else {
header('location:index.php?module=eventmanager&error=Vous n\'avez pas le droit de faire ça!');
}
break;
case 'eventmanager_delete_event':
if ($myUser->can('event', 'd')) {
$event = new Event();
$event->delete(array('id' => $_['id']));
header('location:index.php?module=eventmanager');
} else {
header('location:index.php?module=eventmanager&error=Vous n\'avez pas le droit de faire ça!');
}
break;
}
}
示例4: delete
function delete()
{
//check permissions
if (!isset($_POST["e_eid"])) {
Notification::add("Could not delete the event.");
Page::redirect("/events");
}
$event = new Event($_POST);
if ($event->delete()) {
Notification::add("Event was deleted.");
Page::redirect("/events");
}
Notification::add("Error deleting.");
Page::redirect("/events");
}
示例5: delete
function delete($id = FALSE)
{
$e = new Event($id);
$e->delete();
$this->session->set_flashdata('msg', '<div class="alert alert-success"><a class="close" data-dismiss="alert">×</a>THe event was succesfully deleted.</div>');
redirect($this->agent->referrer());
}
示例6: delete_by_id
public static function delete_by_id($event_id)
{
$e = new Event();
$e->event_id = $event_id;
$e->delete();
}
示例7: testDeleteForceCascadeManyToMany
public function testDeleteForceCascadeManyToMany()
{
$event = new Event();
$event->setTitle('Delete Restrict Event');
$event->setStartDate(new fDate());
$event->associateArtists(array(1));
$event->store();
$event->delete(TRUE);
$this->assertEquals(FALSE, $event->exists());
}
示例8: Delete
/**
* delete
*/
public function Delete($param)
{
try {
if (isset($param['key'])) {
$key = $param['key'];
TTransaction::open('samples');
$object = new Event($key);
$object->delete();
TTransaction::close();
$posAction = new TAction(array('AgendaView', 'reload'));
// shows the success message
new TMessage('info', 'Record deleted', $posAction);
}
} catch (Exception $e) {
new TMessage('error', '<b>Error</b> ' . $e->getMessage());
TTransaction::rollback();
}
}
示例9: testDeleteLocBlock
/**
* deleteLocBlock() method
* delete the location block
* created with various elements.
*
*/
function testDeleteLocBlock()
{
//create test event record.
$eventId = Event::create();
$params['location'][1] = array('location_type_id' => 1, 'is_primary' => 1, 'address' => array('street_address' => 'Saint Helier St', 'supplemental_address_1' => 'Hallmark Ct', 'supplemental_address_2' => 'Jersey Village', 'city' => 'Newark', 'postal_code' => '01903', 'country_id' => 1228, 'state_province_id' => 1029, 'geo_code_1' => '18.219023', 'geo_code_2' => '-105.00973'), 'email' => array('1' => array('email' => 'john.smith@example.org')), 'phone' => array('1' => array('phone_type_id' => 1, 'phone' => '303443689'), '2' => array('phone_type_id' => 2, 'phone' => '9833910234')), 'im' => array('1' => array('name' => 'jane.doe', 'provider_id' => 1)));
$params['entity_id'] = $eventId;
$params['entity_table'] = 'civicrm_event';
//create location block.
//with various elements
//like address, phone, email, im.
require_once 'CRM/Core/BAO/Location.php';
$location = CRM_Core_BAO_Location::create($params, null, true);
$locBlockId = CRM_Utils_Array::value('id', $location);
//update event record with location block id
require_once 'CRM/Event/BAO/Event.php';
$eventParams = array('id' => $eventId, 'loc_block_id' => $locBlockId);
CRM_Event_BAO_Event::add($eventParams);
//delete the location block
CRM_Core_BAO_Location::deleteLocBlock($locBlockId);
//Now check DB for location elements.
//Now check DB for Address
$this->assertDBNull('CRM_Core_DAO_Address', 'Saint Helier St', 'id', 'street_address', 'Database check, Address deleted successfully.');
//Now check DB for Email
$this->assertDBNull('CRM_Core_DAO_Email', 'john.smith@example.org', 'id', 'email', 'Database check, Email deleted successfully.');
//Now check DB for Phone
$this->assertDBNull('CRM_Core_DAO_Phone', '303443689', 'id', 'phone', 'Database check, Phone deleted successfully.');
//Now check DB for Mobile
$this->assertDBNull('CRM_Core_DAO_Phone', '9833910234', 'id', 'phone', 'Database check, Mobile deleted successfully.');
//Now check DB for IM
$this->assertDBNull('CRM_Core_DAO_IM', 'jane.doe', 'id', 'name', 'Database check, IM deleted successfully.');
//cleanup DB by deleting the record.
Event::delete($eventId);
//Now check DB for Event
$this->assertDBNull('CRM_Event_DAO_Event', $eventId, 'id', 'id', 'Database check, Event deleted successfully.');
}
示例10: Event
if ($action == 'enableEvent') {
$event = new Event();
$event->storeFormValues($_GET);
$event->updateStatus();
}
// disable the event
if ($action == 'disableEvent') {
$event = new Event();
$event->storeFormValues($_GET);
$event->updateStatus();
}
// delete the event
if ($action == 'deleteEvent') {
$event = new Event();
$event->storeFormValues($_GET);
$event->delete();
}
// if $_POST is detected
if (isset($_POST['events'])) {
$_SESSION['postevents'] = $_POST['events'] != '' ? $_POST['events'] : 0;
}
if (isset($_GET['newGroup']) && $_GET['newGroup'] != '') {
// Update the events access level for new groups
$update = "UPDATE " . DB_PREFIX . "groups SET events = :events WHERE id = :id";
$st = $conn->prepare($update);
$st->bindValue(":events", $_SESSION['postevents'], PDO::PARAM_INT);
$st->bindValue(":id", $_GET['newGroup'], PDO::PARAM_INT);
$st->execute();
} else {
if (isset($_POST['events']) && !isset($_GET['newGroup'])) {
// Update the events access level for existing groups
示例11: verify_oauth_session_exists
<?php
require_once './global.inc.php';
verify_oauth_session_exists();
if (HttpSession::currentUser()->getOrganization()->access_level < 4) {
echo "Access denied";
die;
}
require_once './global.inc.php';
$event_id = $_POST["event_id"];
$result = Event::delete($event_id);
echo json_encode($result);
示例12: eventManipultion
function eventManipultion()
{
global $session;
global $db;
if ($session->haveAccess(1, 0, 0, 0)) {
if (!isset($_GET['eventcode']) && !isset($_GET['eventop'])) {
$out['status'] = 'fail';
$out['error'] = '<!---- Gold Fish ---->';
} else {
$eventcode = $_GET['eventcode'];
$eventop = $_GET['eventop'];
if ($eventop == 'validate') {
Event::updateColumn($db, $eventcode, Event::EVENT_VALIDATE, 1);
$out['data'] = "validate";
} else {
if ($eventop == "invalidate") {
Event::updateColumn($db, $eventcode, Event::EVENT_VALIDATE, 0);
$out['data'] = "invalidate";
} else {
if ($eventop == "delete") {
Event::delete($db, $eventcode);
$out['data'] = "delete";
} else {
$out['data'] = "invalid operation!!";
}
}
}
$out['status'] = 'success';
}
} else {
$out['status'] = 'fail';
$out['error'] = 'no access';
}
return $out;
}
示例13: checkItemValues
/**
* checks db values for financial item
*/
public function checkItemValues($contribution)
{
$relationTypeId = key(CRM_Core_PseudoConstant::accountOptionValues('account_relationship', NULL, " AND v.name LIKE 'Accounts Receivable Account is' "));
$toFinancialAccount = CRM_Contribute_PseudoConstant::financialAccountType(4, $relationTypeId);
$query = "SELECT eft1.entity_id, ft.total_amount, eft1.amount FROM civicrm_financial_trxn ft INNER JOIN civicrm_entity_financial_trxn eft ON (eft.financial_trxn_id = ft.id AND eft.entity_table = 'civicrm_contribution') \nINNER JOIN civicrm_entity_financial_trxn eft1 ON (eft1.financial_trxn_id = eft.financial_trxn_id AND eft1.entity_table = 'civicrm_financial_item')\nWHERE eft.entity_id = %1 AND ft.to_financial_account_id <> %2";
$queryParams[1] = array($contribution->id, 'Integer');
$queryParams[2] = array($toFinancialAccount, 'Integer');
$dao = CRM_Core_DAO::executeQuery($query, $queryParams);
$amounts = array(100.0, 50.0);
while ($dao->fetch()) {
$this->assertEquals(150.0, $dao->total_amount, 'Mismatch of total amount paid.');
$this->assertEquals($dao->amount, array_pop($amounts), 'Mismatch of amount proportionally assigned to financial item');
}
Contact::delete($this->_contactId);
Event::delete($this->_eventId);
}
示例14: delete
public static function delete(Section $section)
{
/*
TODO:
Upon deletion it should update all data-sources/events attached to it.
Either by deleting them, or making section $unknown.
I think deletion is best because if the section is renamed, the rename()
function will take care of moving the dependancies, so there should be
no data-sources/events to delete anyway.
However, if you delete page accidentally (hm, even though you clicked
confirm), do you really want your data-sources/events to just be deleted?
Verdict?
*/
// Remove fields:
foreach ($section->fields as $field) {
$field->remove();
}
// Remove sync data:
Symphony::Database()->delete('tbl_sections_sync', array($section->guid), '`section` = "%s"');
// Remove entry metadata
Symphony::Database()->delete('tbl_entries', array($section->handle), '`section` = "%s"');
if (General::deleteFile(SECTIONS . '/' . $section->handle . '.xml')) {
// Cleanup Datasources
foreach (new DataSourceIterator() as $datasource) {
$ds = DataSource::load($datasource);
if ($ds->parameters()->section == $section->handle) {
DataSource::delete($ds);
}
}
// Cleanup Events
foreach (new EventIterator() as $event) {
$ev = Event::load($event);
if ($ev->parameters()->source == $section->handle) {
Event::delete($ev);
}
}
}
}
示例15: Member
*
* Author: Bluethrust Web Development
* E-mail: support@bluethrust.com
* Website: http://www.bluethrust.com
*
* License: http://www.bluethrust.com/license.php
*
*/
include "../../../_setup.php";
include_once "../../../classes/member.php";
include_once "../../../classes/rank.php";
include_once "../../../classes/consoleoption.php";
include_once "../../../classes/event.php";
$member = new Member($mysqli);
$member->select($_SESSION['btUsername']);
$objMember = new Member($mysqli);
$eventObj = new Event($mysqli);
$consoleObj = new ConsoleOption($mysqli);
$cID = $consoleObj->findConsoleIDByName("Manage My Events");
$consoleObj->select($cID);
if ($member->authorizeLogin($_SESSION['btPassword']) && $eventObj->select($_POST['eID'])) {
$memberInfo = $member->get_info();
$eventInfo = $eventObj->get_info_filtered();
if ($eventInfo['member_id'] == $memberInfo['member_id']) {
if ($_POST['confirmDelete'] == 1) {
$eventObj->delete();
} else {
echo "\n\t\t\t\n\t\t\t\t<div id='confirmDeleteMessage' style='display: none'>\n\t\t\t\t\n\t\t\t\t\t<p class='main' align='center'>Are you sure you want to delete the event, <b>" . $eventInfo['title'] . "</b>?</p>\n\t\t\t\t\n\t\t\t\t</div>\t\t\t\n\t\t\t\n\t\t\t\t<script type='text/javascript'>\n\t\t\t\t\n\t\t\t\t\t\$(document).ready(function() {\n\t\t\t\t\t\n\t\t\t\t\t\t\$('#confirmDeleteMessage').dialog({\n\t\t\t\t\t\t\n\t\t\t\t\t\t\ttitle: 'Delete Event',\n\t\t\t\t\t\t\tmodal: true,\n\t\t\t\t\t\t\tzIndex: 99999,\n\t\t\t\t\t\t\tshow: 'scale',\n\t\t\t\t\t\t\twidth: 400,\n\t\t\t\t\t\t\tresizable: false,\n\t\t\t\t\t\t\tbuttons: {\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t'Yes': function() {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\$.post('" . $MAIN_ROOT . "members/events/include/deleteevent.php', { confirmDelete: 1, eID: '" . $eventInfo['event_id'] . "' }, function(data) {\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\twindow.location = '" . $MAIN_ROOT . "members/console.php?cID=" . $cID . "'\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t'Cancel': function() {\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\$(this).dialog('close');\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t});\n\t\t\t\t\t\n\t\t\t\t\t});\n\t\t\t\t\n\t\t\t\t</script>\n\t\t\t\t\n\t\t\t\t\n\t\t\t";
}
}
}