summaryrefslogtreecommitdiff
path: root/list1.php
blob: 77d167813da0ecf241f44e00521fb7d6e3b71fce (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
<?php
/**
 * @version $Header: /cvsroot/bitweaver/_bit_contact/list.php,v 1.5 2010/02/08 21:27:22 wjames5 Exp $
 *
 * 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';

use Bitweaver\Contact\Contact;
use Bitweaver\KernelTools;

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

$gContent = new Contact( );
$gContent->invokeServices( 'content_list_function', $_REQUEST );

// Handle the request hash storing into the session.
$gContent->mTypes->processRequestHash($_REQUEST, $_SESSION['contact']);

$listHash = $_REQUEST;
/*
 * Setup which contact types we want to view.
$contactTypes = $gContent->getContactTypes();
if( $gBitUser->hasPermission("p_contact_view_changes") && $_SESSION['contact']['contact_type_guid'] ) {
	$listHash['contact_type_guid'] = $_SESSION['contact']['contact_type_guid'];
} else {
	foreach ($contactTypes as $key => $val) {
		if ($gBitSystem->isFeatureActive('contact_default_'.$key)) {
			$listHash['contact_type_guid'][] = $key;
		}
	}
} */
// Get a list of matching contact entries
$listcontacts = $gContent->getList( $listHash );

if ( $listHash['listInfo']['count'] == 1 ){
	KernelTools::bit_redirect( CONTACT_PKG_URL."display_contact.php?content_id=".$listcontacts[0]['content_id'] );
}

$gBitSmarty->assign( 'listcontacts', $listcontacts );
$gBitSmarty->assign( 'listInfo', $listHash['listInfo'] );

$gBitSystem->setBrowserTitle("View Contacts List");
// Display the template
$gBitSystem->display( 'bitpackage:contact/list1.tpl', NULL, [ 'display_mode' => 'list' ]);