本文整理汇总了PHP中Room::delete方法的典型用法代码示例。如果您正苦于以下问题:PHP Room::delete方法的具体用法?PHP Room::delete怎么用?PHP Room::delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Room
的用法示例。
在下文中一共展示了Room::delete方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doDelete
function doDelete()
{
@($id = $_POST['selector']);
$key = count($id);
//multi delete using checkbox as a selector
for ($i = 0; $i < $key; $i++) {
$room = new Room();
$room->delete($id[$i]);
}
message("Room(s) already Deleted!", "info");
redirect('index.php');
}
示例2: room_action_room
function room_action_room()
{
global $_, $myUser;
//Erreur dans les droits sinon!
$myUser->loadRight();
switch ($_['action']) {
case 'room_add_room':
$right_toverify = isset($_['id']) ? 'u' : 'c';
if ($myUser->can('room', $right_toverify)) {
$room = new Room();
if ($right_toverify == "u") {
$room = $room->load(array("id" => $_['id']));
}
$room->setName($_['nameRoom']);
$room->setDescription($_['descriptionRoom']);
$room->save();
header('location:setting.php?section=room');
} else {
header('location:setting.php?section=room&error=Vous n\'avez pas le droit de faire ça!');
}
break;
case 'room_delete_room':
if ($myUser->can('room', 'd')) {
$roomManager = new Room();
$roomManager->delete(array('id' => $_['id']));
header('location:setting.php?section=room');
} else {
header('location:setting.php?section=room&error=Vous n\'avez pas le droit de faire ça!');
}
break;
}
}
示例3: update
public function update($group_id)
{
$this->load->library('form_validation');
$this->form_validation->set_rules('room[name]', 'lang:admin_rooms_form_field_name', 'required');
$this->form_validation->set_rules('room[time_begin]', 'lang:admin_rooms_form_field_time_begin', 'required|callback__is_time');
$this->form_validation->set_rules('room[time_end]', 'lang:admin_rooms_form_field_time_end', 'required|callback__is_time|callback__is_later_time');
$this->form_validation->set_rules('room[time_day]', 'lang:admin_rooms_form_field_time_day', 'required|callback__is_day');
$this->form_validation->set_rules('room[capacity]', 'lang:admin_rooms_form_field_capacity', 'required|integer|greater_than[0]');
$this->form_validation->set_rules('room_id', 'room_id', 'required');
$this->form_validation->set_message('_is_time', $this->lang->line('admin_rooms_form_error_message_is_time'));
$this->form_validation->set_message('_is_day', $this->lang->line('admin_rooms_form_error_message_is_day'));
$this->form_validation->set_message('_is_later_time', $this->lang->line('admin_rooms_form_error_message_is_later_time'));
if ($this->form_validation->run()) {
$room_id = intval($this->input->post('room_id'));
$room = new Room();
$room->get_by_id($room_id);
if ($room->exists()) {
$room_data = $this->input->post('room');
$room->from_array($room_data, array('name', 'time_day'));
$room->time_begin = $this->time_to_int($room_data['time_begin']);
$room->time_end = $this->time_to_int($room_data['time_end']);
$room->capacity = intval($room_data['capacity']);
$this->_transaction_isolation();
$this->db->trans_begin();
if (trim($room_data['teachers_plain']) != '') {
$room->teachers_plain = trim($room_data['teachers_plain']);
} else {
$room->teachers_plain = NULL;
}
$current_teachers = $room->teacher->get();
$room->delete($current_teachers->all);
$teachers = new Teacher();
if (is_array($room_data['teachers']) && count($room_data['teachers'])) {
foreach ($room_data['teachers'] as $teacher_id) {
$teachers->or_where('id', $teacher_id);
}
$teachers->get();
}
if ($room->save(array($teachers->all)) && $this->db->trans_status()) {
$this->db->trans_commit();
$this->messages->add_message('lang:admin_rooms_flash_message_save_successful', Messages::MESSAGE_TYPE_SUCCESS);
$this->_action_success();
$room->group->get();
$this->output->set_internal_value('course_id', $room->group->course_id);
} else {
$this->db->trans_rollback();
$this->messages->add_message('lang:admin_rooms_flash_message_save_failed', Messages::MESSAGE_TYPE_ERROR);
}
} else {
$this->messages->add_message('lang:admin_rooms_error_room_not_found', Messages::MESSAGE_TYPE_ERROR);
}
redirect(create_internal_url('admin_rooms/index/' . $group_id));
} else {
$this->edit($group_id);
}
}
示例4: KodiCmd
<?php
require_once 'KodiCmd.class.php';
// Suppression de la table du plugin
$table = new KodiCmd();
//$table->drop();
$execQuery = $table->query('DROP TABLE yana_plugin_kodi');
$table_configuration = new configuration();
$table_configuration->getAll();
$table_configuration->remove('plugin_kodiCmd_api_url_kodi');
$table_configuration->remove('plugin_kodiCmd_api_timeout_kodi');
$table_configuration->remove('plugin_kodiCmd_api_recognition_status');
// suppression de la piece KODI
$table_room = new Room();
$table_room->delete(array('name' => 'KODI'));
// Recuperation de l'id et Suppression de la section
$table_section = new Section();
$id_section = $table_section->load(array("label" => "kodi"))->getId();
$table_section->delete(array('label' => 'kodi'));
// suppression des droits correspondant à la section
$table_right = new Right();
$table_right->delete(array('section' => $id_section));
示例5: Room
public static function Room($type, $data)
{
require_once 'room.class.php';
$class = new Room();
$status = false;
$class->setData($data);
switch ($type) {
case 'add':
$status = $class->add();
break;
case 'update':
$status = $class->update();
break;
case 'delete':
$status = $class->delete();
break;
case 'getsingle':
$status = $class->getsingle();
break;
case 'getpage':
$status = $class->getpage();
break;
case 'search':
$status = $class->search();
break;
default:
break;
}
if ($status) {
wp_send_json_success($status);
} else {
wp_send_json_error($class->error);
}
}
示例6: exit_with_status_code
} else {
echo 'Error updating room.';
exit_with_status_code(400);
}
}
case 'GET':
$room = Room::get($room_id);
if ($room) {
echo $room->to_json();
exit_with_status_code(200);
} else {
echo 'Room not found.';
exit_with_status_code(404);
}
case 'DELETE':
$result = Room::delete($room_id);
if ($result) {
echo 'Successfully deleted room';
exit_with_status_code(200);
} else {
echo 'The room you are attempting to delete doesn\'t exist';
exit_with_status_code(404);
}
default:
exit_with_status_code(405);
}
}
} else {
switch ($verb) {
case 'POST':
if (!isset($_REQUEST['name']) || !isset($_REQUEST['admin_id'])) {
示例7: Header
$result = $obj_room->update($user);
if ($result > 0) {
Header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
exit;
} else {
setEventMessage('<div class="error">' . $obj_room->error . '</div>');
$action = 'editroom';
}
} else {
$action = 'editroom';
}
} else {
if ($action == 'confirm_deleteroom' && $confirm == 'yes' && $user->rights->place->write) {
$ret = $obj_room->fetch($roomid);
if ($ret) {
$result = $obj_room->delete($user);
if ($result > 0) {
setEventMessage($langs->trans('RoomDeleted'));
Header("Location: " . $_SERVER['PHP_SELF'] . "?id=" . $id);
exit;
} else {
setEventMessage('<div class="error">' . $obj_room->error . '</div>');
$action = '';
}
} else {
setEventMessage('<div class="error">' . $obj_room->error . '</div>');
$action = '';
}
header('Location: ' . $_SERVER["PHP_SELF"] . '?id=' . $object->id);
exit;
}