Overview

Namespaces

  • Ctct
    • Auth
    • Components
      • Account
      • Activities
      • Contacts
      • EmailMarketing
      • Library
      • Tracking
    • Exceptions
    • Services
    • Util
    • WebHooks

Classes

  • Ctct\Auth\CtctOAuth2
  • Ctct\Auth\SessionDataStore
  • Ctct\Components\Account\AccountInfo
  • Ctct\Components\Account\VerifiedEmailAddress
  • Ctct\Components\Activities\Activity
  • Ctct\Components\Activities\ActivityError
  • Ctct\Components\Activities\AddContacts
  • Ctct\Components\Activities\AddContactsImportData
  • Ctct\Components\Activities\ExportContacts
  • Ctct\Components\Component
  • Ctct\Components\Contacts\Address
  • Ctct\Components\Contacts\Contact
  • Ctct\Components\Contacts\ContactList
  • Ctct\Components\Contacts\CustomField
  • Ctct\Components\Contacts\EmailAddress
  • Ctct\Components\Contacts\Note
  • Ctct\Components\EmailMarketing\Campaign
  • Ctct\Components\EmailMarketing\ClickThroughDetails
  • Ctct\Components\EmailMarketing\MessageFooter
  • Ctct\Components\EmailMarketing\Schedule
  • Ctct\Components\EmailMarketing\TestSend
  • Ctct\Components\Library\File
  • Ctct\Components\Library\FileUploadStatus
  • Ctct\Components\Library\Folder
  • Ctct\Components\Library\Thumbnail
  • Ctct\Components\ResultSet
  • Ctct\Components\Tracking\BounceActivity
  • Ctct\Components\Tracking\ClickActivity
  • Ctct\Components\Tracking\ForwardActivity
  • Ctct\Components\Tracking\OpenActivity
  • Ctct\Components\Tracking\SendActivity
  • Ctct\Components\Tracking\TrackingActivity
  • Ctct\Components\Tracking\TrackingSummary
  • Ctct\Components\Tracking\UnsubscribeActivity
  • Ctct\ConstantContact
  • Ctct\Services\AccountService
  • Ctct\Services\ActivityService
  • Ctct\Services\BaseService
  • Ctct\Services\CampaignScheduleService
  • Ctct\Services\CampaignTrackingService
  • Ctct\Services\ContactService
  • Ctct\Services\ContactTrackingService
  • Ctct\Services\EmailMarketingService
  • Ctct\Services\LibraryService
  • Ctct\Services\ListService
  • Ctct\SplClassLoader
  • Ctct\Util\Config
  • Ctct\WebHooks\CTCTWebhookUtil

Interfaces

  • Ctct\Auth\CtctDataStore

Exceptions

  • Ctct\Exceptions\CtctException
  • Ctct\Exceptions\IllegalArgumentException
  • Ctct\Exceptions\OAuth2Exception
  • Overview
  • Namespace
  • Class
 1: <?php
 2: namespace Ctct\Components\Activities;
 3: 
 4: use Ctct\Components\Component;
 5: 
 6: /**
 7:  * Represents a single Activity in Constant Contact
 8:  *
 9:  * @package        Components
10:  * @subpackage     Activities
11:  * @author         Constant Contact
12:  */
13: class Activity extends Component
14: {
15:     public $id;
16:     public $type;
17:     public $status;
18:     public $start_date;
19:     public $finish_date;
20:     public $file_name;
21:     public $created_date;
22:     public $error_count;
23:     public $errors = array();
24:     public $warnings = array();
25:     public $contact_count;
26: 
27:     /**
28:      * Factory method to create an Activity object from an array
29:      * @param array $props - associative array of initial properties to set
30:      * @return Activity
31:      */
32:     public static function create(array $props)
33:     {
34:         $activity = new Activity();
35:         $activity->id = parent::getValue($props, "id");
36:         $activity->type = parent::getValue($props, "type");
37:         $activity->status = parent::getValue($props, "status");
38:         $activity->start_date = parent::getValue($props, "start_date");
39:         $activity->finish_date = parent::getValue($props, "finish_date");
40:         $activity->created_date = parent::getValue($props, "created_date");
41:         $activity->error_count = parent::getValue($props, "error_count");
42:         $activity->contact_count = parent::getValue($props, "contact_count");
43: 
44:         // set any errors that exist, otherwise destroy the property
45:         if (array_key_exists('errors', $props)) {
46:             foreach ($props['errors'] as $error) {
47:                 $activity->errors[] = ActivityError::create($error);
48:             }
49:         } else {
50:             unset($activity->errors);
51:         }
52: 
53:         // set any warnings that exist, otherwise destroy the property
54:         if (array_key_exists('warnings', $props)) {
55:             foreach ($props['warnings'] as $error) {
56:                 $activity->warnings[] = ActivityError::create($error);
57:             }
58:         } else {
59:             unset($activity->warnings);
60:         }
61: 
62:         // set the file name if exists
63:         if (array_key_exists('file_name', $props)) {
64:             $activity->file_name = $props['file_name'];
65:         } else {
66:             unset($activity->file_name);
67:         }
68: 
69:         return $activity;
70:     }
71: 
72:     /**
73:      * Create json used for a POST/PUT request, also handles removing attributes that will cause errors if sent
74:      * @return string
75:      */
76:     public function toJson()
77:     {
78:         return json_encode($this);
79:     }
80: }
81: 
API documentation generated by ApiGen