Google Shared Contacts Manager  1.0
Semestral project for BI-ZNF
ContactPresenter Class Reference

Presenter that handles all operations with Contacts. More...

Inheritance diagram for ContactPresenter:
SecuredPresenter

Public Member Functions

 __construct (OAuthService $os)
 ContactPresenter constructor. More...
 
 injectDependencies (APIService $apis, ContactService $cs, ContactFormFactory $cff, EmailFormFactory $eff, PhoneFormFactory $pff, CustomAttributeFromFactory $caff, Session $session)
 Inject required dependencies. More...
 
 actionDefault ()
 URL = /contact/ Receive all contacts. More...
 
 actionDelete ($id)
 URL = /contact/delete/$id Delete contact specified by the ID in URL. More...
 
 actionEdit ($id)
 URL = /contact/edit/$id Prepare data for Contact Edit form. More...
 
 renderEdit ()
 URL = /contact/edit/$id Clear repeating-value forms session and fill it with the attributes. More...
 
 renderCreate ()
 URL = /contact/create Assign autofill data to the template. More...
 
 createContactForm (Contact $c=null)
 Create form to create / edit Contact. More...
 
 createComponentEditContactForm ()
 Create form to edit contact. More...
 
 createComponentCreateContactForm ()
 Create form to create contact. More...
 
 createComponentAddEmailForm ()
 Create form for repeating email values. More...
 
 createComponentAddPhoneForm ()
 Create form for repeating phone number values. More...
 
 createComponentAddCustomAttributeForm ()
 Create form for repeating custom attributes. More...
 
 handleRemoveEmail ($index)
 Handle signal to remove Email from session storage. More...
 
 handleRemovePhone ($index)
 Handle signal to remove Phone number from session storage. More...
 
 handleRemoveCustomAttribute ($index)
 Handle signal to remove ¨Custom Attribute from session storage. More...
 
 createComponentPictureEditor ()
 Create PictureEditor component. More...
 
 solveConnectionException (ConnectionException $ex)
 Handle any connection exception that might occur during data retrieving. More...
 
 createComponentDatagrid ()
 Create my customized datagrid for the list of Contacts. More...
 
 prepareData ($filters, $order)
 Method suplies data for the Datagrid. More...
 
- Public Member Functions inherited from SecuredPresenter
 __construct (OAuthService $os)
 
 startup ()
 Require logged in user. More...
 

Data Fields

const CREATED_CONTACT_ATTRIBUTE = "created_id"
 
const UPDATED_CONTACT_ATTRIBUTE = "updated_id"
 

Private Member Functions

 prepareAutofill ()
 Collect all autofill data. More...
 
 addIfNotNull (&$array, $value)
 Append the value to the array if the value is not null. More...
 
 prepareAutofillAddress (Contact &$c, &$array)
 Collect address data for Autofill feature. More...
 
 prepareAutofillOrganization (Contact &$c, &$array)
 Collect organization data for Autofill feature. More...
 
 prepareAutofillCustoms (Contact &$c, &$array)
 Collect custom attributes keys for Autofill feature. More...
 

Private Attributes

 $apis
 
 $cs
 
 $contactFormFactory
 
 $emailFormFactory
 
 $phoneFormFactory
 
 $customAttributeFormFactory
 
 $session
 
 $contact
 

Additional Inherited Members

- Protected Attributes inherited from SecuredPresenter
 $oauthService
 

Detailed Description

Presenter that handles all operations with Contacts.

Constructor & Destructor Documentation

◆ __construct()

__construct ( OAuthService  $os)

ContactPresenter constructor.

Parameters
OAuthService$os

Member Function Documentation

◆ actionDefault()

actionDefault ( )

URL = /contact/ Receive all contacts.

Clear cache if URL purge attribute is set.

◆ actionDelete()

actionDelete (   $id)

URL = /contact/delete/$id Delete contact specified by the ID in URL.

Parameters
string$idID of contact to be deleted

◆ actionEdit()

actionEdit (   $id)

URL = /contact/edit/$id Prepare data for Contact Edit form.

Parameters
string$idID of contact to be deleted

◆ addIfNotNull()

addIfNotNull ( $array,
  $value 
)
private

Append the value to the array if the value is not null.

Parameters
array$array
mixed$value

◆ createComponentAddCustomAttributeForm()

createComponentAddCustomAttributeForm ( )

Create form for repeating custom attributes.

Returns
Form

◆ createComponentAddEmailForm()

createComponentAddEmailForm ( )

Create form for repeating email values.

Returns
Form

◆ createComponentAddPhoneForm()

createComponentAddPhoneForm ( )

Create form for repeating phone number values.

Returns
Form

◆ createComponentCreateContactForm()

createComponentCreateContactForm ( )

Create form to create contact.

Returns
Form

◆ createComponentDatagrid()

createComponentDatagrid ( )

Create my customized datagrid for the list of Contacts.

Returns
MyDatagrid

◆ createComponentEditContactForm()

createComponentEditContactForm ( )

Create form to edit contact.

Returns
Form

◆ createComponentPictureEditor()

createComponentPictureEditor ( )

Create PictureEditor component.

Returns
PictureEditor

◆ createContactForm()

createContactForm ( Contact  $c = null)

Create form to create / edit Contact.

Parameters
Contact | null$c
Returns
Form

◆ handleRemoveCustomAttribute()

handleRemoveCustomAttribute (   $index)

Handle signal to remove ¨Custom Attribute from session storage.

Parameters
$index

◆ handleRemoveEmail()

handleRemoveEmail (   $index)

Handle signal to remove Email from session storage.

Parameters
$index

◆ handleRemovePhone()

handleRemovePhone (   $index)

Handle signal to remove Phone number from session storage.

Parameters
$index

◆ injectDependencies()

injectDependencies ( APIService  $apis,
ContactService  $cs,
ContactFormFactory  $cff,
EmailFormFactory  $eff,
PhoneFormFactory  $pff,
CustomAttributeFromFactory  $caff,
Session  $session 
)

Inject required dependencies.

Parameters
APIService$apis
ContactService$cs
ContactFormFactory$cff
EmailFormFactory$eff
PhoneFormFactory$pff
CustomAttributeFromFactory$caff
Session$session

◆ prepareAutofill()

prepareAutofill ( )
private

Collect all autofill data.

Returns
array

◆ prepareAutofillAddress()

prepareAutofillAddress ( Contact $c,
$array 
)
private

Collect address data for Autofill feature.

Parameters
Contact$c
array$array

◆ prepareAutofillCustoms()

prepareAutofillCustoms ( Contact $c,
$array 
)
private

Collect custom attributes keys for Autofill feature.

Parameters
Contact$c
$array

◆ prepareAutofillOrganization()

prepareAutofillOrganization ( Contact $c,
$array 
)
private

Collect organization data for Autofill feature.

Parameters
Contact$c
array$array

◆ prepareData()

prepareData (   $filters,
  $order 
)

Method suplies data for the Datagrid.

Parameters
array$filtersFilter rules specified by user
array$orderOrder rule specified by user
Returns
Contact[]|null

◆ renderCreate()

renderCreate ( )

URL = /contact/create Assign autofill data to the template.

◆ renderEdit()

renderEdit ( )

URL = /contact/edit/$id Clear repeating-value forms session and fill it with the attributes.

◆ solveConnectionException()

solveConnectionException ( ConnectionException  $ex)

Handle any connection exception that might occur during data retrieving.

If the access token had expired, reauthenticate, otherwise display error.

Parameters
ConnectionException$ex

Field Documentation

◆ $apis

$apis
private

◆ $contact

$contact
private

◆ $contactFormFactory

$contactFormFactory
private

◆ $cs

$cs
private

◆ $customAttributeFormFactory

$customAttributeFormFactory
private

◆ $emailFormFactory

$emailFormFactory
private

◆ $phoneFormFactory

$phoneFormFactory
private

◆ $session

$session
private

◆ CREATED_CONTACT_ATTRIBUTE

const CREATED_CONTACT_ATTRIBUTE = "created_id"

◆ UPDATED_CONTACT_ATTRIBUTE

const UPDATED_CONTACT_ATTRIBUTE = "updated_id"

The documentation for this class was generated from the following file: