if (class_exists('module_group', false)) { module_group::enable_pagination_hook(array('fields' => array('owner_id' => 'user_id', 'owner_table' => 'user', 'name' => 'name', 'email' => 'email'))); } // hack to add a "export" option to the pagination results. if (class_exists('module_import_export', false) && module_user::can_i('view', 'Export ' . $contact_type_permission . ' Contacts')) { if (isset($_REQUEST['import_export_go'])) { $users = query_to_array($users); foreach ($users as $user_id => $user) { $users[$user_id]['is_primary'] = $user['is_primary'] == $user['user_id'] ? _l('Yes') : _l('No'); } } module_import_export::enable_pagination_hook(array('name' => $contact_type_permission . ' Contact Export', 'fields' => array($contact_type_permission . ' Contact ID' => 'user_id', 'First Name' => 'name', 'Last Name' => 'last_name', $contact_type_permission . ' ID' => $contact_module_name . '_id', $contact_type_permission . ' Name' => $contact_module_name . '_name', 'Primary Contact' => 'is_primary', 'Phone' => 'phone', 'Email' => 'email', 'Fax' => 'fax', 'Mobile' => 'mobile'), 'extra' => array('owner_table' => 'user', 'owner_id' => 'user_id'), 'group' => array(array('title' => 'Contact Group', 'owner_table' => 'user', 'owner_id' => 'user_id')))); } $heading = array('main' => true, 'type' => 'h2', 'title' => _l(($show_customer_details ? 'All ' : '') . $contact_type_permission . ' Contacts'), 'button' => array()); if (isset($search[$use_master_key]) && $search[$use_master_key] && module_user::can_i('create', 'Contacts', $contact_type_permission)) { $heading['button'][] = array('title' => 'Add New Contact', 'url' => module_user::link_generate('new', array('type' => 'contact', $use_master_key => isset($search[$use_master_key]) ? $search[$use_master_key] : false)), 'type' => 'add'); } print_heading($heading); ?> <form action="" method="<?php echo _DEFAULT_FORM_METHOD; ?> "> <?php if ($use_master_key && isset($search[$use_master_key])) { ?> <input type="hidden" name="<?php
//throw new Exception('Please create a user correctly'); } else { $show_customer_details = false; } $users = module_user::get_contacts($search, true); ?> <h2> <?php if (isset($search[$use_master_key]) && $search[$use_master_key] && module_user::can_i('create', 'Contacts', 'Customer')) { ?> <span class="button"> <?php echo create_link("Add New Contact", "add", module_user::link_generate('new', array('type' => 'contact'))); ?> </span> <?php } ?> <?php echo _l(($show_customer_details ? 'All ' : '') . 'Customer Contacts'); ?> </h2> <form action="" method="<?php echo _DEFAULT_FORM_METHOD;