home *** CD-ROM | disk | FTP | other *** search
/ Chip 2004 April / CMCD0404.ISO / Software / Freeware / Programare / dotproject / modules / contacts / do_contact_aed.php < prev    next >
Encoding:
PHP Script  |  2003-07-04  |  791 b   |  33 lines

  1. <?php /* CONTACTS $Id: do_contact_aed.php,v 1.4 2003/07/04 03:07:40 eddieajau Exp $ */
  2.  
  3. $obj = new CContact();
  4. $msg = '';
  5.  
  6. if (!$obj->bind( $_POST )) {
  7.     $AppUI->setMsg( $obj->getError(), UI_MSG_ERROR );
  8.     $AppUI->redirect();
  9. }
  10.  
  11. $del = dPgetParam( $_POST, 'del', 0 );
  12.  
  13. // prepare (and translate) the module name ready for the suffix
  14. $AppUI->setMsg( 'Contact' );
  15. if ($del) {
  16.     if (($msg = $obj->delete())) {
  17.         $AppUI->setMsg( $msg, UI_MSG_ERROR );
  18.         $AppUI->redirect();
  19.     } else {
  20.         $AppUI->setMsg( "deleted", UI_MSG_ALERT, true );
  21.         $AppUI->redirect( "m=contacts" );
  22.     }
  23. } else {
  24.     $isNotNew = @$_POST['contact_id'];
  25.  
  26.     if (($msg = $obj->store())) {
  27.         $AppUI->setMsg( $msg, UI_MSG_ERROR );
  28.     } else {
  29.         $AppUI->setMsg( $isNotNew ? 'updated' : 'added', UI_MSG_OK, true );
  30.     }
  31.     $AppUI->redirect();
  32. }
  33. ?>