home *** CD-ROM | disk | FTP | other *** search
- <?php /* PROJECTS $Id: do_project_aed.php,v 1.8 2004/01/15 04:34:51 ajdonnison Exp $ */
- $obj = new CProject();
- $msg = '';
-
- if (!$obj->bind( $_POST )) {
- $AppUI->setMsg( $obj->getError(), UI_MSG_ERROR );
- $AppUI->redirect();
- }
- // convert dates to SQL format first
- $date = new CDate( $obj->project_start_date );
- $obj->project_start_date = $date->format( FMT_DATETIME_MYSQL );
-
- if ($obj->project_end_date) {
- $date = new CDate( $obj->project_end_date );
- $obj->project_end_date = $date->format( FMT_DATETIME_MYSQL );
- }
- if ($obj->project_actual_end_date) {
- $date = new CDate( $obj->project_actual_end_date );
- $obj->project_actual_end_date = $date->format( FMT_DATETIME_MYSQL );
- }
-
- $del = dPgetParam( $_POST, 'del', 0 );
-
- // prepare (and translate) the module name ready for the suffix
- if ($del) {
- if (!$obj->canDelete( $msg )) {
- $AppUI->setMsg( $msg, UI_MSG_ERROR );
- $AppUI->redirect();
- }
- if (($msg = $obj->delete())) {
- $AppUI->setMsg( $msg, UI_MSG_ERROR );
- $AppUI->redirect();
- } else {
- $AppUI->setMsg( "Project deleted", UI_MSG_ALERT);
- $AppUI->redirect( "m=projects" );
- }
- } else {
- if (($msg = $obj->store())) {
- $AppUI->setMsg( $msg, UI_MSG_ERROR );
- } else {
- $isNotNew = @$_POST['project_id'];
- $AppUI->setMsg( $isNotNew ? 'Project updated' : 'Project inserted', UI_MSG_OK);
- }
- $AppUI->redirect();
- }
- ?>
-