-
Notifications
You must be signed in to change notification settings - Fork 1
Simple Contact List
kfContact comes with a contact list which can show you all contacts with selected fields, sorted and split in pages.
<YOUR_BASE_URL>/kit2/admin/contact/simple/contact/list
will show you the contact list:
The following steps will explain you, how to place this contact list within your own application. kfEvent is also using kfContact and so this Wiki is using kfEvent as practical sample.
This control is a simple class which is accessing the kfContact Control ContactList and define some parameters for the usage. Define your namespace:
namespace phpManufaktur\Event\Control\Backend;
and use the kfContact Control for the ContactList:
use phpManufaktur\Contact\Control\Dialog\Simple\ContactList as SimpleContactList;
Before you call the constructor of the SimpleContactList
you have to define the template and routing parameters within an options array:
$options = array(
'template' => array(
'namespace' => '@phpManufaktur/Event/Template',
'settings' => 'backend/contact.list.json',
'message' => 'backend/message.twig',
'list' => 'backend/contact.list.twig'
),
'route' => array(
'pagination' => '/admin/event/contact/list/page/{page}?order={order}&direction={direction}&usage='.self::$usage,
'contact' => array(
'person' => '/admin/event/contact/person/edit/id/{contact_id}?usage='.self::$usage,
'company' => '/admin/event/contact/company/edit/id/{contact_id}?usage='.self::$usage
)
)
);
$options['template']['namespace']
define the namespace which will be used by the template of your application, so this should be something like
@thirdParty/YourApplication/Template_Directory
.
$options['template']['settings']
is a JSON settings file for the contact list, just copy the file contact.list.json
from
\extension\phpmanufaktur\phpManufaktur\Contact\Template\default\backend\simple
into your own template directory.
{
"columns":[
"contact_id",
"contact_type",
"communication_email",
"company_name",
"person_first_name",
"person_last_name",
"address_city",
"address_country_code"
],
"list":{
"rows_per_page":100,
"select_status":[
"ACTIVE",
"LOCKED"
],
"select_type":[
"PERSON",
"COMPANY"
],
"order":{
"by":[
"person_last_name",
"person_first_name"
],
"direction":"ASC"
}
}
}
With columns
you define the columns, which will be shown within the contact list in the given sequence. You can use all field identifiers from the contact_overview
table - see the datamodel for more information.
In list
you can define the rows_per_page
which will be shown before the contact list is split into an paging (will be displayed at the top right and at the bottom of the list).
With select_status
you determine which records will be shown: with ACTIVE
status, with LOCKED
or with DELETED
status.
select_type
specify PERSON
and/or COMPANY
contact records.
order
with by
and direction
specify the default ordering of the contact list at startup. Clicking to the column heads will change the order.
- If you spot a typo or want to contribute an article, a how-to or a tip, feel free to edit the Wiki directly
- If you you have any questions, please visit the phpManufaktur Support Forum
This Documentation is part of the kitFramework Project
© 2010, 2014 by phpManufaktur, kitFramework and Contact are published under MIT license.