當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Contacts::getAll方法代碼示例

本文整理匯總了PHP中Contacts::getAll方法的典型用法代碼示例。如果您正苦於以下問題:PHP Contacts::getAll方法的具體用法?PHP Contacts::getAll怎麽用?PHP Contacts::getAll使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Contacts的用法示例。


在下文中一共展示了Contacts::getAll方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: show

 private function show()
 {
     /* Bail out if we don't have a valid company ID. */
     if (!$this->isRequiredIDValid('companyID', $_GET)) {
         $this->listByView('Invalid company ID.');
         return;
     }
     $companyID = $_GET['companyID'];
     $companies = new Companies($this->_siteID);
     $data = $companies->get($companyID);
     /* Bail out if we got an empty result set. */
     if (empty($data)) {
         $this->listByView('The specified company ID could not be found.');
         return;
     }
     /* We want to handle formatting the city and state here instead
      * of in the template.
      */
     $data['cityAndState'] = StringUtility::makeCityStateString($data['city'], $data['state']);
     /*
      * Replace newlines with <br />, fix HTML "special" characters, and
      * strip leading empty lines and spaces.
      */
     $data['notes'] = trim(nl2br(htmlspecialchars($data['notes'], ENT_QUOTES)));
     /* Chop $data['notes'] to make $data['shortNotes']. */
     if (strlen($data['notes']) > self::NOTES_MAXLEN) {
         $data['shortNotes'] = substr($data['notes'], 0, self::NOTES_MAXLEN);
         $isShortNotes = true;
     } else {
         $data['shortNotes'] = $data['notes'];
         $isShortNotes = false;
     }
     /* Hot companies [can] have different title styles than normal companies. */
     if ($data['isHot'] == 1) {
         $data['titleClass'] = 'jobTitleHot';
     } else {
         $data['titleClass'] = 'jobTitleCold';
     }
     /* Link to Google Maps for this address */
     if (!empty($data['address']) && !empty($data['city']) && !empty($data['state'])) {
         $data['googleMaps'] = '<a href="http://maps.google.com/maps?q=' . urlencode($data['address']) . '+' . urlencode($data['city']) . '+' . urlencode($data['state']);
         /* Google Maps will find an address without Zip. */
         if (!empty($data['zip'])) {
             $data['googleMaps'] .= '+' . $data['zip'];
         }
         $data['googleMaps'] .= '" target=_blank><img src="images/google_maps.gif" style="border: none;" class="absmiddle" /></a>';
     } else {
         $data['googleMaps'] = '';
     }
     /* Attachments */
     $attachments = new Attachments($this->_siteID);
     $attachmentsRS = $attachments->getAll(DATA_ITEM_COMPANY, $companyID);
     foreach ($attachmentsRS as $rowNumber => $attachmentsData) {
         /* Show an attachment icon based on the document's file type. */
         $attachmentIcon = strtolower(FileUtility::getAttachmentIcon($attachmentsRS[$rowNumber]['originalFilename']));
         $attachmentsRS[$rowNumber]['attachmentIcon'] = $attachmentIcon;
     }
     /* Job Orders for this company */
     $jobOrders = new JobOrders($this->_siteID);
     $jobOrdersRS = $jobOrders->getAll(JOBORDERS_STATUS_ALL, -1, $companyID, -1);
     if (!empty($jobOrdersRS)) {
         foreach ($jobOrdersRS as $rowIndex => $row) {
             /* Convert '00-00-00' dates to empty strings. */
             $jobOrdersRS[$rowIndex]['startDate'] = DateUtility::fixZeroDate($jobOrdersRS[$rowIndex]['startDate']);
             /* Hot jobs [can] have different title styles than normal
              * jobs.
              */
             if ($jobOrdersRS[$rowIndex]['isHot'] == 1) {
                 $jobOrdersRS[$rowIndex]['linkClass'] = 'jobLinkHot';
             } else {
                 $jobOrdersRS[$rowIndex]['linkClass'] = 'jobLinkCold';
             }
             $jobOrdersRS[$rowIndex]['recruiterAbbrName'] = StringUtility::makeInitialName($jobOrdersRS[$rowIndex]['recruiterFirstName'], $jobOrdersRS[$rowIndex]['recruiterLastName'], false, LAST_NAME_MAXLEN);
             $jobOrdersRS[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName($jobOrdersRS[$rowIndex]['ownerFirstName'], $jobOrdersRS[$rowIndex]['ownerLastName'], false, LAST_NAME_MAXLEN);
         }
     }
     /* Contacts for this company */
     $contacts = new Contacts($this->_siteID);
     $contactsRS = $contacts->getAll(-1, $companyID);
     $contactsRSWC = null;
     if (!empty($contactsRS)) {
         foreach ($contactsRS as $rowIndex => $row) {
             /* Hot contacts [can] have different title styles than normal contacts. */
             if ($contactsRS[$rowIndex]['isHot'] == 1) {
                 $contactsRS[$rowIndex]['linkClass'] = 'jobLinkHot';
             } else {
                 $contactsRS[$rowIndex]['linkClass'] = 'jobLinkCold';
             }
             if (!empty($contactsRS[$rowIndex]['ownerFirstName'])) {
                 $contactsRS[$rowIndex]['ownerAbbrName'] = StringUtility::makeInitialName($contactsRS[$rowIndex]['ownerFirstName'], $contactsRS[$rowIndex]['ownerLastName'], false, LAST_NAME_MAXLEN);
             } else {
                 $contactsRS[$rowIndex]['ownerAbbrName'] = 'None';
             }
             if ($contactsRS[$rowIndex]['leftCompany'] == 0) {
                 $contactsRSWC[] = $contactsRS[$rowIndex];
             } else {
                 $contactsRS[$rowIndex]['linkClass'] = 'jobLinkDead';
             }
         }
     }
//.........這裏部分代碼省略.........
開發者ID:rankinp,項目名稱:OpenCATS,代碼行數:101,代碼來源:CompaniesUI.php

示例2: edit

 private function edit()
 {
     /* Bail out if we don't have a valid contact ID. */
     if (!$this->isRequiredIDValid('contactID', $_GET)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'Invalid contact ID.');
     }
     $contactID = $_GET['contactID'];
     $contacts = new Contacts($this->_siteID);
     $data = $contacts->getForEditing($contactID);
     /* Bail out if we got an empty result set. */
     if (empty($data)) {
         CommonErrors::fatal(COMMONERROR_BADINDEX, $this, 'The specified contact ID could not be found.');
     }
     $companies = new Companies($this->_siteID);
     $companiesRS = $companies->getSelectList();
     $users = new Users($this->_siteID);
     $usersRS = $users->getSelectList();
     /* Add an MRU entry. */
     $_SESSION['CATS']->getMRU()->addEntry(DATA_ITEM_CONTACT, $contactID, $data['firstName'] . ' ' . $data['lastName']);
     /* Get extra fields. */
     $extraFieldRS = $contacts->extraFields->getValuesForEdit($contactID);
     /* Get departments. */
     $departmentsRS = $companies->getDepartments($data['companyID']);
     $departmentsString = ListEditor::getStringFromList($departmentsRS, 'name');
     $emailTemplates = new EmailTemplates($this->_siteID);
     $statusChangeTemplateRS = $emailTemplates->getByTag('EMAIL_TEMPLATE_OWNERSHIPASSIGNCONTACT');
     if (!isset($statusChangeTemplateRS['disabled']) || $statusChangeTemplateRS['disabled'] == 1) {
         $emailTemplateDisabled = true;
     } else {
         $emailTemplateDisabled = false;
     }
     $reportsToRS = $contacts->getAll(-1, $data['companyID']);
     if ($this->_accessLevel == ACCESS_LEVEL_DEMO) {
         $canEmail = false;
     } else {
         $canEmail = true;
     }
     $companies = new Companies($this->_siteID);
     $defaultCompanyID = $companies->getDefaultCompany();
     if ($defaultCompanyID !== false) {
         $defaultCompanyRS = $companies->get($defaultCompanyID);
     } else {
         $defaultCompanyRS = array();
     }
     if (!eval(Hooks::get('CONTACTS_EDIT'))) {
         return;
     }
     $this->_template->assign('defaultCompanyID', $defaultCompanyID);
     $this->_template->assign('defaultCompanyRS', $defaultCompanyRS);
     $this->_template->assign('canEmail', $canEmail);
     $this->_template->assign('emailTemplateDisabled', $emailTemplateDisabled);
     $this->_template->assign('active', $this);
     $this->_template->assign('data', $data);
     $this->_template->assign('companiesRS', $companiesRS);
     $this->_template->assign('extraFieldRS', $extraFieldRS);
     $this->_template->assign('departmentsRS', $departmentsRS);
     $this->_template->assign('departmentsString', $departmentsString);
     $this->_template->assign('usersRS', $usersRS);
     $this->_template->assign('reportsToRS', $reportsToRS);
     $this->_template->assign('contactID', $contactID);
     $this->_template->assign('sessionCookie', $_SESSION['CATS']->getCookie());
     $this->_template->display('./modules/contacts/Edit.tpl');
 }
開發者ID:rankinp,項目名稱:OpenCATS,代碼行數:63,代碼來源:ContactsUI.php

示例3: share

 function share()
 {
     $id = array_var($_GET, 'object_id');
     $manager = array_var($_GET, 'manager');
     $obj = get_object_by_manager_and_id($id, $manager);
     if (!$obj instanceof DataObject) {
         flash_error(lang('object dnx'));
         ajx_current("empty");
         return;
     }
     // if
     $contacts = Contacts::getAll();
     $allEmails = array();
     $emailAndComp = array();
     foreach ($contacts as $contact) {
         if (trim($contact->getEmail()) != "") {
             $emailStr = str_replace(",", " ", $contact->getFirstname() . ' ' . $contact->getLastname() . ' <' . $contact->getEmail() . '>');
             $allEmails[] = $emailStr;
             if ($contact->getCompany()) {
                 $emailAndComp[$emailStr] = $contact->getCompany()->getId();
             }
         }
     }
     $companies = Companies::getAll();
     $allCompanies = array();
     foreach ($companies as $comp) {
         $allCompanies[$comp->getId()] = $comp->getName();
     }
     $actuallySharing = array();
     $users = SharedObjects::getUsersSharing($id, $manager);
     foreach ($users as $u) {
         $user = Users::findById($u->getUserId());
         if ($user) {
             $actuallySharing[] = array('name' => $user->getDisplayName(), 'email' => $user->getEmail(), 'company' => $user->getCompany()->getName());
         }
     }
     tpl_assign('allEmails', $allEmails);
     tpl_assign('allCompanies', $allCompanies);
     tpl_assign('emailAndComp', $emailAndComp);
     tpl_assign('actuallySharing', $actuallySharing);
     tpl_assign('object', $obj);
 }
開發者ID:pnagaraju25,項目名稱:fengoffice,代碼行數:42,代碼來源:ObjectController.class.php

示例4: header

    header("Location: /staff/?id=notFound");
    exit;
}
if (isset($_GET['go']) && $_GET['go'] == "y") {
    $contactsDelete = new Contacts();
    $contactsDelete->setContactsid($_GET['id']);
    $contactsDelete->deleteFromDB();
    header("Location: /contacts/?ItemDeleted=y");
    exit;
}
include "../tmpl/header.php";
$contacts = new Contacts();
// Load DB data into object
$contacts->setContactsid($_GET['id']);
$contacts->loadContacts();
$all = $contacts->getAll();
if (isset($all)) {
    ?>
		   
<div class="panel panel-info">
	<div class="panel-heading">
		<strong>Viewing <?php 
    echo $contacts->getContactsid();
    ?>
</strong>
	</div>
	<div class="panel-body">
		<?php 
    foreach ($all as $key => $value) {
        if (isset($value) && $value != '') {
            ?>
開發者ID:athenasystems,項目名稱:athena,代碼行數:31,代碼來源:delete.php

示例5: session_start

<?php

require_once __DIR__ . "/../vendor/autoload.php";
require_once __DIR__ . "/../src/contacts.php";
session_start();
if (empty($_SESSION['list_of_contacts'])) {
    $_SESSION['list_of_contacts'] = array();
}
$app = new Silex\Application();
$app->register(new Silex\Provider\TwigServiceProvider(), array('twig.path' => __DIR__ . '/../views'));
$app->get("/", function () use($app) {
    return $app['twig']->render('home.html.twig', array('contact' => Contacts::getAll()));
});
$app->post("/create_contact", function () use($app) {
    $contact = new Contacts($_POST['list_of_contacts']);
    $contact->save();
    return $app['twig']->render('create_contact.html.twig', array('newcontact' => $contact));
});
$app->post("/delete_contacts", function () use($app) {
    Task::deleteAll();
    return $app['twig']->render('delete_contacts.html.twig');
});
return $app;
開發者ID:jeff1236,項目名稱:codeReviewOne,代碼行數:23,代碼來源:app.php


注:本文中的Contacts::getAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。