events
[ class tree: events ] [ index: events ] [ all elements ]

Source for file edit.php

Documentation is available at edit.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  *  Copyright (c) 2004 bitweaver Events
  5.  * @package events
  6.  * @subpackage functions
  7.  */
  8.  
  9. /**
  10.  * required setup
  11.  */
  12. require_once('../kernel/setup_inc.php' );
  13.  
  14. // Is package installed and enabled
  15. $gBitSystem->verifyPackage('events' );
  16.  
  17. require_once(EVENTS_PKG_PATH.'lookup_events_inc.php' );
  18.  
  19. // Now check permissions to access this page
  20. if ($gContent->isValid()) {
  21.     $gContent->verifyUpdatePermission();
  22. }
  23. else {
  24.     $gContent->verifyCreatePermission();
  25. }
  26.  
  27. if (isset($_REQUEST["title"])) {
  28.     $gContent->mInfo["title"$_REQUEST["title"];
  29. }
  30.  
  31. if (isset($_REQUEST["description"])) {
  32.     $gContent->mInfo["description"$_REQUEST["description"];
  33. }
  34.  
  35. if (isset($_REQUEST["event_time"])) {
  36.     $gContent->mInfo["event_time"$_REQUEST["event_time"];
  37. }
  38.  
  39. if (isset($_REQUEST["data"])) {
  40.     $gContent->mInfo["data"$_REQUEST["data"];
  41. }
  42.  
  43. // If we are in preview mode then preview it!
  44. if (isset($_REQUEST["preview"])) {
  45.     $gBitSmarty->assign('preview''y');
  46.     $gContent->preview($_REQUEST);
  47. else {
  48.     $gContent->invokeServices'content_edit_function' );
  49. }
  50.  
  51. // Pro
  52. // Check if the page has changed
  53. if (!empty($_REQUEST["save_events"])) {
  54.  
  55.     // Check if all Request values are delivered, and if not, set them
  56.     // to avoid error messages. This can happen if some features are
  57.     // disabled
  58.     if ($gContent->store$_REQUEST ) ) {
  59.         bit_redirect($gContent->getDisplayUrl() );
  60.         die;
  61.     else {
  62.         $gBitSmarty->assign_by_ref('errors'$gContent->mErrors );
  63.     }
  64. }
  65.  
  66. // Remove events
  67. if !empty$_REQUEST['remove') ) {
  68.     if $gContent->isValid(&& !empty$gContent->mInfo ) ) {
  69.         ifempty$_REQUEST['confirm') ) {
  70.             $formHash['remove'TRUE;
  71.             $formHash['input']['<input type="hidden" name="events_id" value="'.$_REQUEST['events_id'].'"/>';
  72.             $gBitSystem->confirmDialog$formHasharray'warning' => tra('Are you sure you want to delete the "').htmlentities($gContent->mInfo['title']).tra('" event?')'error' => tra('This cannot be undone!') ) );
  73.         else if $_REQUEST['confirm'{
  74.             if $gContent->expunge() ) {
  75.                 bit_redirectEVENTS_PKG_URL );
  76.                 die;
  77.             else {
  78.                 $gBitSmarty->assign_by_ref('errors'$gContent->mErrors );
  79.             }
  80.         }
  81.     }
  82.     else {
  83.         $gBitSystem->setHttpStatus(404);
  84.         $gBitSystem->fatalErrortra("No such event could be found to be removed.") );
  85.     }
  86. }
  87.  
  88. if$gBitSystem->isFeatureActive('events_use_types') ) {
  89.     $eventTypes $gContent->loadEventTypes(FALSE);
  90.     if$gBitSystem->isFeatureActive('events_allow_no_type') ) {
  91.         $eventTypes[-1'';
  92.         asort($eventTypes);
  93.     }
  94.     $gBitSmarty->assign('eventTypes'$eventTypes);
  95. }
  96.  
  97. // Display the template
  98. $gBitSystem->display('bitpackage:events/edit_events.tpl'tra('Events'array'display_mode' => 'edit' ));
  99. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:24 +0000 by phpDocumentor 1.5.0-lsces