summaryrefslogtreecommitdiff
path: root/process.php
blob: 7e00d6b4de418778b23132bcb008be1e31427caa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php

use Bitweaver\KernelTools;
/**
 * $Header: $
 *
 * Copyright (c) 2006 bitweaver.org
 * All Rights Reserved. See below for details and a complete list of authors.
 * Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details
 *
 * @package contact
 * @subpackage functions
 */

/**
 * required setup
 */
require_once '../kernel/includes/setup_inc.php';

$gBitSystem->verifyPackage( 'contact' );
$gBitSystem->verifyPackage( 'form' );
// $gBitSystem->verifyPermission( 'p_contact_view' );

include_once CONTACT_PKG_INCLUDE_PATH . 'lookup_contact_inc.php';
use Bitweaver\Form\Form;

global $gBitSystem, $gBitSmarty;

$gForm = new Form( 1, NULL );
$gForm->getFieldList( $_REQUEST );
$gBitSmarty->assign( '$gContent->mInfo', $_REQUEST );
//$gTemplate->getTemplateList();

$gBitSmarty->assign( 'formInfo', $gForm->mForm );

// Process return
if (isset($_REQUEST["fCancel"])) {
	if( !empty( $gContent->mContentId ) ) {
		KernelTools::bit_redirect( $gContent->getDisplayUrl() );
	} else {
		KernelTools::bit_redirect( CONTACT_PKG_URL );
	}
} elseif (isset($_REQUEST["form"])) {
	if( $gForm->storeForm( $_REQUEST, $gContent ) ) {
		KernelTools::bit_redirect( $gContent->getDisplayUrl() );
	} else {
		$formInfo = $_REQUEST;
		$formInfo['data'] = &$_REQUEST['edit'];
	}
}

// formInfo might be set due to a error on submit
if( empty( $formInfo ) ) {
//	$formInfo = &$gContent->mInfo;
}

$gBitSystem->display( 'bitpackage:contact/employment.tpl', 'Edit: ' , [ 'display_mode' => 'edit' ]);