/** * @param ContactList $contactList * * @return void */ public function add($contactList) { if (!$this->exists(function ($key, ContactList $element) use($contactList) { return $contactList->getId() == $element->getId(); })) { parent::add($contactList); } }
function render($sv) { global $Me; if ($sv->curv("acct_addr")) { $sv->echo_checkbox("acct_addr", "Collect users’ addresses and phone numbers"); } echo "<h3 class=\"settings g\">Program committee & system administrators</h3>"; echo "<p><a href='", hoturl("profile", "u=new&role=pc"), "' class='button'>Create PC account</a> | ", "Select a user’s name to edit a profile.</p>\n"; $pl = new ContactList($Me, false); echo $pl->table_html("pcadminx", hoturl("users", "t=pcadmin")); }
/** * Get an individual contact list * @param $accessToken - Constant Contact OAuth2 access token * @param $list_id - list id * @return ContactList */ public function getList($accessToken, $list_id) { $baseUrl = Configs::get('endpoints.base_url') . sprintf(Configs::get('endpoints.list'), $list_id); $url = $this->buildUrl($baseUrl); $response = parent::getRestClient()->get($url, parent::getHeaders($accessToken)); return ContactList::create(json_decode($response->body, true)); }
public function contacts($parameters = array()) { $url = self::contacts_uri(self::id()); $response = new Response(ContactList::get($url, $parameters)); foreach ($response->items as &$value) { $value = new Contact(new Response($value)); } return $response; }
/** * Saves the changes made in the bulk edit into the dataObject * * @return Redirect */ public function doAddToList($data, $form) { $className = $this->gridField->list->dataClass; $singleton = singleton($className); $return = array(); if (isset($data['RecordIDs'])) { $ids = explode(",", $data['RecordIDs']); } else { $ids = array(); } $list_id = isset($data['ContactListID']) ? $data['ContactListID'] : 0; $list = ContactList::get()->byID($list_id); try { foreach ($ids as $record_id) { if ($list_id) { $record = DataObject::get_by_id($className, $record_id); if ($record->hasMethod("Lists")) { $list->Contacts()->add($record); $list->write(); } $return[] = $record->ID; } } } catch (Exception $e) { $controller = $this->controller; $form->sessionMessage($e->getResult()->message(), 'bad', false); $responseNegotiator = new PjaxResponseNegotiator(array('CurrentForm' => function () use(&$form) { return $form->forTemplate(); }, 'default' => function () use(&$controller) { return $controller->redirectBack(); })); if ($controller->getRequest()->isAjax()) { $controller->getRequest()->addHeader('X-Pjax', 'CurrentForm'); } return $responseNegotiator->respond($controller->getRequest()); } $controller = $this->getToplevelController(); $form = $controller->EditForm(); $message = "Added " . count($return) . " contacts to mailing list '{$list->Title}'"; $form->sessionMessage($message, 'good', false); // Changes to the record properties might've excluded the record from // a filtered list, so return back to the main view if it can't be found $link = $controller->Link(); $controller->getRequest()->addHeader('X-Pjax', 'Content'); return $controller->redirect($link); }
/** * Update a ContactList * @param string $url - address to a list * @return bool - true is successful, else false */ public function updateList(ContactList $List) { $listXml = $List->createXml(); $response = $this->CTCTRequest->makeRequest($this->CTCTRequest->baseUri . $List->link, 'PUT', $listXml); return $response['info']['http_code'] == 204 ? true : false; }
require_once FILE_FUNCTIONS; require_once FILE_CLASS_OPTIONS; require_once FILE_CLASS_CONTACTLIST; require_once FILE_CLASSES; session_start(); $by = $_SESSION['username']; echo "<link rel='stylesheet' href='styles.css' type='text/css'>"; // ** OPEN CONNECTION TO THE DATABASE ** $db_link = openDatabase($db_hostname, $db_username, $db_password, $db_name); // ** CHECK FOR LOGIN ** checkForLogin(); // ** RETRIEVE OPTIONS THAT PERTAIN TO THIS PAGE ** $options = new Options(); // ** END INITIALIZATION ******************************************************* // CREATE THE LIST. $list = new ContactList(); // THIS PAGE TAKES SEVERAL GET VARIABLES // ie. list.php?group_id=6&page=2&letter=c&limit=20 if ($_GET['groupid']) { $list->group_id = $_GET['groupid']; } if ($_GET['page']) { $list->current_page = $_GET['page']; } if (isset($_GET['letter'])) { $list->current_letter = $_GET['letter']; } if (isset($_GET['limit'])) { $list->max_entries = $_GET['limit']; } // Set group name (group_id defaults to 0 if not provided)
public function create_list($parameters) { return ContactList::create($parameters); }
AND properties.value = ' . $db->escape($l) . ' AND ' . VALID_CERT; $db->query($sql); if ($db->rowsAffected() <= 0) { $undone .= $l . ',<br>'; } } if ($undone) { $errorHandler->error('formVal', 'Was not able to update following addresses: ' . $undone); } break; case 'default': default: $modeInfo = "Reissue cerificates that will expire in " . $CONF_CERT_DAYS_TILL_EXPIRE . " days, issue added and revoke deleted records"; $issueContacts = new ContactList('SELECT * FROM ' . TABLE_CONTACT . ' AS contact WHERE ' . NEWCERT_QUERY . ' OR ' . EXPIRED_QUERY); $revokeContacts = new ContactList('SELECT * FROM ' . TABLE_CONTACT . ' AS contact WHERE ' . REVOKE_QUERY); break; } if ($mode == 'exec') { $data = "# {$modeInfo} \n\n"; // issue certificates if ($issueContacts !== null) { foreach ($issueContacts->getContacts() as $c) { $id = $c->contact['id']; $name = escapeshellarg($c->contact['firstname'] . ' ' . $c->contact['lastname']); $ou = $c->contact['organizationalUnit']; if (empty($ou)) { $ou = $CONFIG_CA_OU_CHOICES[0]; } $ou = escapeshellarg($ou); $email = $c->getValueGroup('email');
/** * Factory method to create a Contact object from an array * @param array $props - Associative array of initial properties to set * @return Contact */ public static function create(array $props) { $contact = new Contact(); $contact->id = parent::getValue($props, "id"); $contact->status = parent::getValue($props, "status"); $contact->first_name = parent::getValue($props, "first_name"); $contact->middle_name = parent::getValue($props, "middle_name"); $contact->last_name = parent::getValue($props, "last_name"); $contact->confirmed = parent::getValue($props, "confirmed"); $contact->source = parent::getValue($props, "source"); foreach ($props['email_addresses'] as $email_address) { $contact->email_addresses[] = EmailAddress::create($email_address); } $contact->prefix_name = parent::getValue($props, "prefix_name"); $contact->job_title = parent::getValue($props, "job_title"); foreach ($props['addresses'] as $address) { $contact->addresses[] = Address::create($address); } foreach ($props['notes'] as $note) { $contact->notes[] = Note::create($note); } $contact->company_name = parent::getValue($props, "company_name"); $contact->home_phone = parent::getValue($props, "home_phone"); $contact->work_phone = parent::getValue($props, "work_phone"); $contact->cell_phone = parent::getValue($props, "cell_phone"); $contact->fax = parent::getValue($props, "fax"); foreach ($props['custom_fields'] as $custom_field) { $contact->custom_fields[] = CustomField::create($custom_field); } foreach ($props['lists'] as $contact_list) { $contact->lists[] = ContactList::create($contact_list); } $contact->source_details = parent::getValue($props, "source_details"); return $contact; }
} } if (isset($_REQUEST["scoresort"]) && ($_REQUEST["scoresort"] == "A" || $_REQUEST["scoresort"] == "V" || $_REQUEST["scoresort"] == "D")) { $Conf->save_session("scoresort", $_REQUEST["scoresort"]); } if ($_REQUEST["t"] == "pc") { $title = "Program committee"; } else { if (str_starts_with($_REQUEST["t"], "#")) { $title = "#" . substr($_REQUEST["t"], 1) . " program committee"; } else { $title = "Users"; } } $Conf->header($title, "accounts", actionBar()); $pl = new ContactList($Me, true); $pl_text = $pl->table_html($_REQUEST["t"], hoturl("users", ["t" => $_REQUEST["t"]]), $tOpt[$_REQUEST["t"]], 'uldisplay.$'); // form echo "<div class='g'></div>\n"; if (count($tOpt) > 1) { echo "<table id='contactsform' class='tablinks1'>\n<tr><td><div class='tlx'><div class='tld1'>"; echo Ht::form_div(hoturl("users"), array("method" => "get")); if (isset($_REQUEST["sort"])) { echo Ht::hidden("sort", $_REQUEST["sort"]); } echo Ht::select("t", $tOpt, $_REQUEST["t"], array("id" => "contactsform1_d")), " ", Ht::submit("Go"), "</div></form>"; echo "</div><div class='tld2'>"; // Display options echo Ht::form_div(hoturl("users"), array("method" => "get")); foreach (array("t", "sort") as $x) { if (isset($_REQUEST[$x])) {
/** * Factory method to create a Campaign object from an array * @param array $props - associative array of initial properties to set * @return Campaign */ public static function create(array $props) { $campaign = new Campaign(); $campaign->id = parent::getValue($props, "id"); $campaign->name = parent::getValue($props, "name"); $campaign->subject = parent::getValue($props, "subject"); $campaign->from_name = parent::getValue($props, "from_name"); $campaign->from_email = parent::getValue($props, "from_email"); $campaign->reply_to_email = parent::getValue($props, "reply_to_email"); $campaign->template_type = parent::getValue($props, "template_type"); $campaign->created_date = parent::getValue($props, "created_date"); $campaign->modified_date = parent::getValue($props, "modified_date"); $campaign->last_run_date = parent::getValue($props, "last_run_date"); $campaign->next_run_date = parent::getValue($props, "next_run_date"); $campaign->status = parent::getValue($props, "status"); $campaign->is_permission_reminder_enabled = parent::getValue($props, "is_permission_reminder_enabled"); $campaign->permission_reminder_text = parent::getValue($props, "permission_reminder_text"); $campaign->is_view_as_webpage_enabled = parent::getValue($props, "is_view_as_webpage_enabled"); $campaign->view_as_web_page_text = parent::getValue($props, "view_as_web_page_text"); $campaign->view_as_web_page_link_text = parent::getValue($props, "view_as_web_page_link_text"); $campaign->greeting_salutations = parent::getValue($props, "greeting_salutations"); $campaign->greeting_name = parent::getValue($props, "greeting_name"); $campaign->greeting_string = parent::getValue($props, "greeting_string"); if (array_key_exists("message_footer", $props)) { $campaign->message_footer = MessageFooter::create($props['message_footer']); } if (array_key_exists("tracking_summary", $props)) { $campaign->tracking_summary = TrackingSummary::create($props['tracking_summary']); } $campaign->email_content = parent::getValue($props, "email_content"); $campaign->email_content_format = parent::getValue($props, "email_content_format"); $campaign->style_sheet = parent::getValue($props, "style_sheet"); $campaign->text_content = parent::getValue($props, "text_content"); $campaign->permalink_url = parent::getValue($props, "permalink_url"); if (array_key_exists('sent_to_contact_lists', $props)) { foreach ($props['sent_to_contact_lists'] as $sent_to_contact_list) { $campaign->sent_to_contact_lists[] = ContactList::create($sent_to_contact_list); } } if (array_key_exists('click_through_details', $props)) { foreach ($props['click_through_details'] as $click_through_details) { $campaign->click_through_details[] = ClickThroughDetails::create($click_through_details); } } return $campaign; }
/** * processes each row returned from db * * overrides function from {@link ContactList}; * saves the dates from db to {@link $dates}, then passes * contoll to {@link ContactList::processQueryResults()} */ function processQueryResult($r) { $this->dates[] = array('type' => $r['label'], 'daysAway' => $r['daysAway'], 'repeat' => $r['type'], 'ongoing' => $r['ongoing'], 'day' => $r['day'], 'month' => $r['month'], 'year' => $r['year']); parent::processQueryResult($r); }
$this->name = $name; $this->phone = $phone; } public function id() { return $this->name; } public function get() { return $this->phone; } } class ContactList extends BinaryTree { } $list = new ContactList(); $list->insert(new Contact('Sue', '555-1234')); $list->insert(new Contact('John', '555-5678')); $list->insert(new Contact('Mary', '555-9012')); $list->insert(new Contact('Sally', '555-9876')); $list->insert(new Contact('Mark', '555-3456')); $list->insert(new Contact('Tom', '555-7890')); $list->insert(new Contact('Dick', '555-4567')); $list->insert(new Contact('Sally', '555-7654')); $list->insert(new Contact('Harry', '555-6789')); $list->insert(new Contact('Julie', '555-5432')); $list->insert(new Contact('Paul', '555-3210')); echo $list->locate('John', 'inorder') . "\n"; // 555-5678 echo $list->locate('Tom', 'preorder') . "\n"; // 555-7890
} // Do we have something from the text field?? if (isset($_POST['goTo'])) { if ($_POST['goTo'] == 'whoami' && isset($_SESSION['user']->contact['id'])) { header("Location: " . $CONFIG_TAB_ROOT . 'contact/contact.php?id=' . $_SESSION['user']->contact['id']); exit; } // Remove single quotes which come from $db->escape $goTo = mb_substr($db->escape(StringHelper::cleanGPC($_POST['goTo'])), 1, -1); // Search the database $cList = new ContactList('SELECT * FROM ' . TABLE_CONTACT . ' AS contact WHERE ( CONCAT(firstname,\' \', lastname) LIKE \'%' . $goTo . '%\' OR CONCAT(firstname,\' \', middlename,\' \', lastname) LIKE \'%' . $goTo . '%\' OR nickname LIKE \'%' . $goTo . '%\' OR CONCAT(lastname,\', \',firstname) LIKE \'%' . $goTo . '%\' ) AND (hidden = 0 OR ' . $db->escape($_SESSION['user']->isAtLeast('admin')) . ') ORDER BY lastname ASC, firstname ASC'); // if theres only one contact, show it if (count($cList->getContacts()) == 1) { // redirect to the page to have a valid URL in the window $conts = $cList->getContacts(); header("Location: " . $CONFIG_TAB_ROOT . 'contact/contact.php?id=' . $conts[0]->contact['id']); //$page = Page::newPage('PageContact',$conts[0],isset($_GET['noxslt'])); //echo $page->create(); exit; } // else: show the page with a list of the contacts