当前位置: 首页>>代码示例>>PHP>>正文


PHP Contacts::getContact方法代码示例

本文整理汇总了PHP中Contacts::getContact方法的典型用法代码示例。如果您正苦于以下问题:PHP Contacts::getContact方法的具体用法?PHP Contacts::getContact怎么用?PHP Contacts::getContact使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Contacts的用法示例。


在下文中一共展示了Contacts::getContact方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getInvestorConversations

 public static function getInvestorConversations($investorID)
 {
     global $db;
     $conversations = $db->select('conversations', '*', ['investor' => $investorID]);
     $toReturn = [];
     foreach ($conversations as $conversation) {
         $contact = Contacts::getContact($conversation['contact']);
         if ($contact['crm'] == 1) {
             array_push($toReturn, $conversation);
         }
     }
     return $conversations;
 }
开发者ID:AnyApp,项目名称:-Commercial-System,代码行数:13,代码来源:conversations.php

示例2: getAssetContacts

 public static function getAssetContacts($assetID)
 {
     global $db;
     $contacts = $db->select('assetContacts', ['[><]contacts' => ["contact" => "id"], '[><]assets' => ["asset" => "id"]], ['contacts.id'], ['assets.id' => $assetID]);
     $toReturn = [];
     foreach ($contacts as $contact) {
         array_push($toReturn, Contacts::getContact($contact['id']));
     }
     // Adding investors contacts
     $assetInvestors = Investors::getAssetInvestors($assetID);
     foreach ($assetInvestors as $investor) {
         $investorContacts = Contacts::getInvestorContacts($investor['id']);
         $toReturn = array_merge($toReturn, $investorContacts);
     }
     return array_unique($toReturn, SORT_REGULAR);
 }
开发者ID:AnyApp,项目名称:-Commercial-System,代码行数:16,代码来源:contacts.php

示例3: create_client

 /**
  * Create a new client
  * 
  * Executes the creation of new client in the IspConfig control panel
  * Note in order to not fail this command, it must meet the following requirements:
  * 
  * - The customer must be registered in the db.
  * - The customer has bought a hosting plan
  * 
  * @param      array      $task     Must be a valid task 
  * @return     integer    RemoteClientId
  * @access     public
  */
 public function create_client(array $task)
 {
     $clientId = "";
     if (empty($task)) {
         throw new Exception('Task empty.', '3000');
     }
     // Execute a custom event
     $this->events()->trigger('panels_create_client_before', __CLASS__, array('task' => $task));
     $server = self::getServer($task['orderitem_id'], 'web');
     // Connection to the SOAP system
     $client = $this->connect($server['server_id']);
     if (!$client) {
         throw new Exception("There is no way to connect the client with the IspConfig Panel.", "3010");
     }
     try {
         // Get all the customer information
         $customer = Customers::getAllInfo($task['customer_id']);
         // Get the client id saved previously in the customer information page
         $customAttribute = CustomAttributes::getAttribute($task['customer_id'], 'client_id');
         // Get the custom ISPConfig attribute set in the customer control panel
         if (is_numeric($customAttribute['value'])) {
             /**
              * Client_id (IspConfig Attribute Set in ShineISP database in the setup of the panel)
              * @see Shineisp_Controller_Plugin_SetupcPanelsModules
              */
             $clientId = $customAttribute['value'];
             $record = $client->client_get($this->getSession(), $clientId);
             if ($record == false) {
                 $clientId = "";
             }
         }
         // Customer Profile
         $record['company_name'] = $customer['company'];
         $record['contact_name'] = $customer['firstname'] . " " . $customer['lastname'];
         $record['customer_no'] = $customer['customer_id'];
         $record['vat_id'] = $customer['vat'];
         $record['email'] = $customer['email'];
         $record['street'] = !empty($customer['Addresses'][0]['address']) ? $customer['Addresses'][0]['address'] : "";
         $record['zip'] = !empty($customer['Addresses'][0]['code']) ? $customer['Addresses'][0]['code'] : "";
         $record['city'] = !empty($customer['Addresses'][0]['city']) ? $customer['Addresses'][0]['city'] : "";
         $record['state'] = !empty($customer['Addresses'][0]['area']) ? $customer['Addresses'][0]['area'] : "";
         $record['country'] = !empty($customer['Addresses'][0]['Countries']['code']) ? $customer['Addresses'][0]['Countries']['code'] : "";
         $record['mobile'] = Contacts::getContact($customer['customer_id'], "Mobile");
         $record['fax'] = Contacts::getContact($customer['customer_id'], "Fax");
         $record['telephone'] = Contacts::getContact($customer['customer_id']);
         // System Configuration
         $languagecode = Languages::get_code($customer['language_id']);
         $record['language'] = $languagecode;
         $record['usertheme'] = "default";
         $record['template_master'] = 0;
         $record['template_additional'] = "";
         $record['created_at'] = date('');
         $record['web_php_options'] = "no,fast-cgi,cgi,mod,suphp,php-fpm";
         $record['ssh_chroot'] = 'jailkit';
         // Get the Json encoded parameters in the task
         $parameters = json_decode($task['parameters'], true);
         // Match all the ShineISP product system attribute and IspConfig attributes (see below about info)
         $retval = self::matchFieldsValues($parameters, $record);
         if (is_array($retval)) {
             $record = array_merge($record, $retval);
         } else {
             Shineisp_Commons_Utilities::logs("No hosting attribute parameters have been set in ShineISP. Check the hosting product attributes section.", "ispconfig.log");
         }
         // Execute the SOAP action
         if (!empty($clientId) && is_numeric($clientId)) {
             $client->client_update($this->getSession(), $clientId, 1, $record);
         } else {
             $arrUsernames = array();
             $arrUsernames = self::generateUsernames($customer);
             // Check if username is available
             foreach ($arrUsernames as $username) {
                 if (!$client->client_get_by_username($this->getSession(), $username)) {
                     break;
                 }
             }
             // Create a random password string
             $password = Shineisp_Commons_Utilities::GenerateRandomString();
             $record['username'] = $username;
             $record['password'] = $password;
             // Save the setup in the service setup field
             OrdersItems::set_setup($task['orderitem_id'], array('url' => 'http://' . $server['ip'] . ':8080', 'username' => $username, 'password' => $password), "webpanel");
             // Adding the client in ISPConfig
             $clientId = $client->client_add($this->getSession(), 0, $record);
             // Update the custom customer attribute client_id
             CustomAttributes::saveElementsValues(array(array('client_id' => $clientId)), $task['customer_id'], "customers");
             // Execute a custom event
             $this->events()->trigger('panels_create_client_after', __CLASS__, array('task' => $task, 'clientid' => $clientId, 'customerdata' => $record));
//.........这里部分代码省略.........
开发者ID:moay,项目名称:shineisp,代码行数:101,代码来源:Main.php

示例4: function

<?php

$this->respond(['GET', 'POST'], '/create', function ($request, $response, $service, $app) {
    $contactData = json_decode($request->body(), true);
    $id = Contacts::createContact($contactData);
    if ($id > 0) {
        $response->json(Result::success('Contact Created.', ['id' => $id]));
    } else {
        $response->json(Result::error('Contact Creation Failed.', ['id' => $id]));
    }
});
$this->respond(['GET', 'POST'], '/get/[i:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $contactData = Contacts::getContact($id);
    $conversations = Conversations::getContactConversations($id);
    $result = array("contactData" => $contactData, "contactConversations" => $conversations);
    if ($contactData) {
        $response->json(Result::success('', $result));
    } else {
        $response->json(Result::error('Contact not found'));
    }
});
$this->respond(['GET', 'POST'], '/edit/[:id]', function ($request, $response, $service, $app) {
    $id = $request->param('id');
    $contactData = json_decode($request->body());
    $result = Contacts::updateContact($id, $contactData);
    if ($result > 0) {
        $response->json(Result::success('Contact Updated.'));
    } elseif ($result === 0) {
        $response->json(Result::success('Contact not Updated.'));
    } else {
开发者ID:AnyApp,项目名称:-Commercial-System,代码行数:31,代码来源:contacts.php


注:本文中的Contacts::getContact方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。