本文整理汇总了PHP中CEvent::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP CEvent::delete方法的具体用法?PHP CEvent::delete怎么用?PHP CEvent::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CEvent
的用法示例。
在下文中一共展示了CEvent::delete方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1:
if (!$obj->bind($_POST)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
if ($obj->event_start_date) {
$start_date = new w2p_Utilities_Date($obj->event_start_date . $_POST['start_time']);
$obj->event_start_date = $start_date->format(FMT_DATETIME_MYSQL);
}
if ($obj->event_end_date) {
$end_date = new w2p_Utilities_Date($obj->event_end_date . $_POST['end_time']);
$obj->event_end_date = $end_date->format(FMT_DATETIME_MYSQL);
}
$action = $del ? 'deleted' : 'stored';
$clashRedirect = false;
if ($del) {
$result = $obj->delete();
} else {
if ($_POST['event_assigned'] > '' && ($clash = $obj->checkClash($_POST['event_assigned']))) {
$last_a = $a;
$GLOBALS['a'] = "clash";
$clashRedirect = true;
} else {
$result = $obj->store();
if (isset($_POST['event_assigned'])) {
$obj->updateAssigned(explode(',', $_POST['event_assigned']));
}
if (isset($_POST['mail_invited'])) {
$obj->notify($_POST['event_assigned'], false);
}
}
}
示例2:
}
if (!$del && $start_date->compare($start_date, $end_date) >= 0) {
$AppUI->setMsg("Start-Date >= End-Date, please correct", UI_MSG_ERROR);
$AppUI->redirect();
exit;
}
// prepare (and translate) the module name ready for the suffix
$AppUI->setMsg('Event');
$do_redirect = true;
require_once $AppUI->getSystemClass("CustomFields");
if ($del) {
if (!$obj->canDelete($msg)) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
$AppUI->redirect();
}
if ($msg = $obj->delete()) {
$AppUI->setMsg($msg, UI_MSG_ERROR);
} else {
$AppUI->setMsg("deleted", UI_MSG_OK, true);
}
$AppUI->redirect('m=calendar');
} else {
$isNotNew = @$_POST['event_id'];
if (!$isNotNew) {
$obj->event_owner = $AppUI->user_id;
}
// Check for existence of clashes.
if ($_POST['event_assigned'] > '' && ($clash = $obj->checkClash($_POST['event_assigned']))) {
$last_a = $a;
$GLOBALS['a'] = "clash";
$do_redirect = false;
示例3:
if (!$obj->bind($_POST)) {
$AppUI->setMsg($obj->getError(), UI_MSG_ERROR);
$AppUI->redirect();
}
if ($obj->event_start_date) {
$start_date = new w2p_Utilities_Date($obj->event_start_date . $_POST['start_time']);
$obj->event_start_date = $start_date->format(FMT_DATETIME_MYSQL);
}
if ($obj->event_end_date) {
$end_date = new w2p_Utilities_Date($obj->event_end_date . $_POST['end_time']);
$obj->event_end_date = $end_date->format(FMT_DATETIME_MYSQL);
}
$action = $del ? 'deleted' : 'stored';
$clashRedirect = false;
if ($del) {
$result = $obj->delete($AppUI);
} else {
if ($_POST['event_assigned'] > '' && ($clash = $obj->checkClash($_POST['event_assigned']))) {
$last_a = $a;
$GLOBALS['a'] = "clash";
$clashRedirect = true;
} else {
$result = $obj->store($AppUI);
if (isset($_POST['event_assigned'])) {
$obj->updateAssigned(explode(',', $_POST['event_assigned']));
}
if (isset($_POST['mail_invited'])) {
$obj->notify($_POST['event_assigned'], false);
}
}
}
示例4: hook_postDelete
protected function hook_postDelete()
{
$q = $this->_getQuery();
$q->addTable('tasks');
$q->addQuery('task_id');
$q->addWhere('task_project = ' . $this->_old_key);
$tasks_to_delete = $q->loadColumn();
$q->clear();
$task = new w2p_Actions_BulkTasks();
$task->overrideDatabase($this->_query);
foreach ($tasks_to_delete as $task_id) {
$task->task_id = $task_id;
$task->delete();
}
$q->clear();
$q->addTable('files');
$q->addQuery('file_id');
$q->addWhere('file_project = ' . $this->_old_key);
$files_to_delete = $q->loadColumn();
$q->clear();
$file = new CFile();
$file->overrideDatabase($this->_query);
foreach ($files_to_delete as $file_id) {
$file->file_id = $file_id;
$file->delete();
}
$q->clear();
$q->addTable('events');
$q->addQuery('event_id');
$q->addWhere('event_project = ' . $this->_old_key);
$events_to_delete = $q->loadColumn();
$q->clear();
$event = new CEvent();
$event->overrideDatabase($this->_query);
foreach ($events_to_delete as $event_id) {
$event->event_id = $event_id;
$event->delete();
}
$q->clear();
// remove the project-contacts and project-departments map
$q->setDelete('project_contacts');
$q->addWhere('project_id =' . $this->_old_key);
$q->exec();
$q->clear();
$q->setDelete('project_departments');
$q->addWhere('project_id =' . $this->_old_key);
$q->exec();
$q->clear();
$q->setDelete('tasks');
$q->addWhere('task_represents_project =' . $this->_old_key);
parent::hook_preDelete();
}
示例5: delete
public function delete()
{
$result = false;
if ($this->_perms->checkModuleItem($this->_tbl_module, 'delete', $this->{$this->_tbl_key})) {
$q = $this->_getQuery();
$q->addTable('tasks');
$q->addQuery('task_id');
$q->addWhere('task_project = ' . (int) $this->project_id);
$tasks_to_delete = $q->loadColumn();
$q->clear();
$task = new CTask();
$task->overrideDatabase($this->_query);
foreach ($tasks_to_delete as $task_id) {
$task->task_id = $task_id;
$task->delete();
}
$q->clear();
$q->addTable('files');
$q->addQuery('file_id');
$q->addWhere('file_project = ' . (int) $this->project_id);
$files_to_delete = $q->loadColumn();
$q->clear();
$file = new CFile();
$file->overrideDatabase($this->_query);
foreach ($files_to_delete as $file_id) {
$file->file_id = $file_id;
$file->delete();
}
$q->clear();
$q->addTable('events');
$q->addQuery('event_id');
$q->addWhere('event_project = ' . (int) $this->project_id);
$events_to_delete = $q->loadColumn();
$q->clear();
$event = new CEvent();
$event->overrideDatabase($this->_query);
foreach ($events_to_delete as $event_id) {
$event->event_id = $event_id;
$event->delete();
}
$q->clear();
// remove the project-contacts and project-departments map
$q->setDelete('project_contacts');
$q->addWhere('project_id =' . (int) $this->project_id);
$q->exec();
$q->clear();
$q->setDelete('project_departments');
$q->addWhere('project_id =' . (int) $this->project_id);
$q->exec();
$q->clear();
$q->setDelete('tasks');
$q->addWhere('task_represents_project =' . (int) $this->project_id);
$q->clear();
if ($msg = parent::delete()) {
return $msg;
}
return true;
}
return $result;
}