Source for file edit.php
Documentation is available at edit.php
* Copyright (c) 2004 bitweaver Events
require_once('../kernel/setup_inc.php' );
// Is package installed and enabled
$gBitSystem->verifyPackage('events' );
require_once(EVENTS_PKG_PATH. 'lookup_events_inc.php' );
// Now check permissions to access this page
if ($gContent->isValid()) {
$gContent->verifyUpdatePermission();
$gContent->verifyCreatePermission();
if (isset ($_REQUEST["title"])) {
$gContent->mInfo["title"] = $_REQUEST["title"];
if (isset ($_REQUEST["description"])) {
$gContent->mInfo["description"] = $_REQUEST["description"];
if (isset ($_REQUEST["event_time"])) {
$gContent->mInfo["event_time"] = $_REQUEST["event_time"];
if (isset ($_REQUEST["data"])) {
$gContent->mInfo["data"] = $_REQUEST["data"];
// If we are in preview mode then preview it!
if (isset ($_REQUEST["preview"])) {
$gBitSmarty->assign('preview', 'y');
$gContent->preview($_REQUEST);
$gContent->invokeServices( 'content_edit_function' );
// Check if the page has changed
if (!empty($_REQUEST["save_events"])) {
// Check if all Request values are delivered, and if not, set them
// to avoid error messages. This can happen if some features are
if ($gContent->store( $_REQUEST ) ) {
$gBitSmarty->assign_by_ref('errors', $gContent->mErrors );
if ( !empty( $_REQUEST['remove'] ) ) {
if ( $gContent->isValid() && !empty( $gContent->mInfo ) ) {
if( empty( $_REQUEST['confirm'] ) ) {
$formHash['remove'] = TRUE;
$formHash['input'][] = '<input type="hidden" name="events_id" value="'. $_REQUEST['events_id']. '"/>';
$gBitSystem->confirmDialog( $formHash, array( 'warning' => tra('Are you sure you want to delete the "'). htmlentities($gContent->mInfo['title']). tra('" event?'), 'error' => tra('This cannot be undone!') ) );
} else if ( $_REQUEST['confirm'] ) {
$gBitSmarty->assign_by_ref('errors', $gContent->mErrors );
$gBitSystem->setHttpStatus(404);
$gBitSystem->fatalError( tra("No such event could be found to be removed.") );
$eventTypes = $gContent->loadEventTypes(FALSE);
$gBitSmarty->assign('eventTypes', $eventTypes);
$gBitSystem->display('bitpackage:events/edit_events.tpl', tra('Events') , array( 'display_mode' => 'edit' ));
|