/** * Filter to display the modify-buttons * * @param - int $id The item-id */ function modify_filter($id) { $str = ''; $outtt = false; if (Rsys::item_allow($id, 'edit')) { $str .= '<a href="m_item.php?action=edit&id=' . $id . '" title="' . get_lang("EditItem2") . '"><img alt="" src="../img/edit.gif" /></a>'; } if (Rsys::item_allow($id, 'm_rights')) { $str .= ' <a href="m_item.php?action=m_rights&item_id=' . $id . '" title="' . get_lang("MRights") . '"><img alt="" src="../img/info_small.gif" /></a>'; } if (Rsys::item_allow($id, 'delete')) { $str .= ' <a href="m_item.php?action=delete&id=' . $id . '" title="' . get_lang("DeleteItem") . '" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang("ConfirmDeleteItem"))) . "'" . ')) return false;"><img alt="" src="../img/delete.gif" /></a>'; } if (Rsys::item_allow($id, 'edit')) { $number = Rsys::get_item($id); $str .= ' <a href="m_item.php?action=blackout&id=' . $id . '" title="' . get_lang("Blackout") . '"><img alt="" src="../img/blackout' . $number[5] . '.gif" /></a>'; } return $str; }
/** * Filter to display the modify-buttons * * @param - int $id The item-id */ function modify_filter($id) { $str = ''; $outtt = false; if (Rsys::item_allow($id, 'edit')) { $number = Rsys::get_item($id); //checking the status if ($number[5] == 1) { $str .= ' <a href="m_item.php?action=blackout&id=' . $id . '" title="' . get_lang('Inactive') . '"><img alt="" src="../img/wrong.gif" /></a>'; } else { $str .= ' <a href="m_item.php?action=blackout&id=' . $id . '" title="' . get_lang('Active') . '"><img alt="" src="../img/right.gif" /></a>'; } } if (Rsys::item_allow($id, 'edit')) { $str .= '<a href="m_item.php?action=edit&id=' . $id . '" title="' . get_lang("EditItem2") . '"><img alt="" src="../img/edit.gif" /></a>'; } //if(Rsys::item_allow($id,'m_rights')) $str.=' <a href="m_item.php?action=m_rights&item_id='.$id.'" title="'.get_lang("MRights").'"><img alt="" src="../img/info_small.gif" /></a>'; if (Rsys::item_allow($id, 'delete')) { $str .= ' <a href="m_item.php?action=delete&id=' . $id . '" title="' . get_lang('DeleteResource') . '" onclick="javascript:if(!confirm(' . "'" . addslashes(api_htmlentities(get_lang("ConfirmDeleteResource"))) . "'" . ')) return false;"><img alt="" src="../img/delete.gif" /></a>'; } return $str; }
/** * Edits a reservation * * @param - int $id The reservation-ID * @param - $item_id,$auto_accept,$max_users,$start_at,$end_at,$subscribe_until,$notes * @return - FALSE if there is something wrong with the dates, TRUE if everything went perfectly * */ function edit_reservation($id, $item_id, $auto_accept, $max_users, $start_at, $end_at, $subscribe_from, $subscribe_until, $notes, $timepicker) { $id = Database::escape_string($id); if (!Rsys::item_allow($item_id, 'm_reservation')) { return false; } $stamp_start = Rsys::mysql_datetime_to_timestamp($start_at); $stamp_end = Rsys::mysql_datetime_to_timestamp($end_at); $stamp_start_date = date('Y-m-d', $stamp_start); $stamp_end_date = date('Y-m-d', $stamp_end); if (Rsys::check_date_edit($item_id, $stamp_start, $stamp_end, $start_at, $end_at, $id) != 0) { return 1; } if ($subscribe_until != 0) { $stamp_until = Rsys::mysql_datetime_to_timestamp($subscribe_until); if ($stamp_until > $stamp_start) { return 2; } } $sql = "SELECT timepicker, subscribers FROM " . Rsys::getTable("reservation") . " WHERE id='" . $id . "'"; $result = Database::fetch_array(Database::query($sql)); if ($result[0] == 0 && $result[1] > $max_users) { return 3; } if ($stamp_start_date != $stamp_end_date && $timepicker == '1') { return 4; } if ($auto_accept == 1) { $sql = "SELECT dummy FROM " . Rsys::getTable("subscription") . " WHERE reservation_id='" . $id . "'"; $result = Database::query($sql); while ($array = Database::fetch_array($result, 'NUM')) { Rsys::set_accepted($array[0], 1); } } else { $auto_accept = 0; } $sql = "UPDATE " . Rsys::getTable("reservation") . " SET item_id='" . Database::escape_string($item_id) . "',auto_accept='" . Database::escape_string($auto_accept) . "',max_users='" . ($max_users > 1 ? $max_users : 1) . "',start_at='" . Database::escape_string($start_at) . "',end_at='" . Database::escape_string($end_at) . "',subscribe_from='" . Database::escape_string($subscribe_from) . "',subscribe_until='" . Database::escape_string($subscribe_until) . "',notes='" . Database::escape_string($notes) . "' WHERE id='" . $id . "'"; Database::query($sql); return 0; }