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


PHP Companies::getAll方法代碼示例

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


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

示例1: select_company

/**
 * Render select company box
 *
 * @param integer $selected ID of selected company
 * @param array $attributes Additional attributes
 * @return string
 */
function select_company($name, $selected = null, $attributes = null)
{
    $companies = Companies::getAll();
    $options = array(option_tag(lang('none'), 0));
    if (is_array($companies)) {
        foreach ($companies as $company) {
            $option_attributes = $company->getId() == $selected ? array('selected' => 'selected') : null;
            $company_name = $company->getName();
            if ($company->isOwner()) {
                $company_name .= ' (' . lang('owner company') . ')';
            }
            $options[] = option_tag($company_name, $company->getId(), $option_attributes);
        }
        // foreach
    }
    // if
    return select_box($name, $options, $attributes);
}
開發者ID:bahmany,項目名稱:PythonPurePaperless,代碼行數:25,代碼來源:application.php

示例2: getGroupedByCompany

 /**
  * Return contacts grouped by company
  *
  * @param void
  * @return array
  */
 static function getGroupedByCompany()
 {
     $companies = Companies::getAll();
     if (!is_array($companies) || !count($companies)) {
         return null;
     }
     // if
     $result = array();
     foreach ($companies as $company) {
         $contacts = $company->getContacts();
         if (is_array($contacts) && count($contacts)) {
             $result[$company->getName()] = array('details' => $company, 'contacts' => $contacts);
             // array
         }
         // if
     }
     // foreach
     return count($result) ? $result : null;
 }
開發者ID:bklein01,項目名稱:Project-Pier,代碼行數:25,代碼來源:Contacts.class.php

示例3:

?>
<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <title>Edit Descriptions</title>
</head>
<body>

<form name="updateDescriptionForm" id="updateDescriptionForm">
  <center>
  Edit company: 
  <select id="company">
    <option value="">Select a company to edit</option>
  <?php 
$companies = Companies::getAll();
foreach ($companies as $company) {
    print "<option value=" . $company['id'] . ">";
    print $company['name'];
    print "</option>";
}
?>
  </select>
  <br><br>
  <table border="1">
    <tr>
      <td valign="top">
        <label for="description" id="descriptionLabel">
          test1
        </label>
      </td>
開發者ID:wesgk,項目名稱:TextareaEdit,代碼行數:31,代碼來源:form.php

示例4: 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


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