• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP ExternalAPIFactory类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: getEAPM

 /**
  * gets twitter EAPM
  * @return array|bool|ExternalAPIBase
  */
 public function getEAPM()
 {
     // ignore auth and load to just check if connector configured
     $twitterEAPM = ExternalAPIFactory::loadAPI('Twitter', true);
     if (!$twitterEAPM) {
         $source = SourceFactory::getSource('ext_rest_twitter');
         if ($source && $source->hasTestingEnabled()) {
             try {
                 if (!$source->test()) {
                     return array('error' => 'ERROR_NEED_OAUTH');
                 }
             } catch (Exception $e) {
                 return array('error' => 'ERROR_NEED_OAUTH');
             }
         }
         return array('error' => 'ERROR_NEED_OAUTH');
     }
     $twitterEAPM->getConnector();
     $eapmBean = EAPM::getLoginInfo('Twitter');
     if (empty($eapmBean->id)) {
         return array('error' => 'ERROR_NEED_AUTHORIZE');
     }
     //return a fully authed EAPM
     $twitterEAPM = ExternalAPIFactory::loadAPI('Twitter');
     return $twitterEAPM;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:30,代码来源:TwitterApi.php


示例2: getEAPM

 /**
  * gets dnb EAPM
  * @return array|bool|ExternalAPIBase
  */
 public function getEAPM()
 {
     $dnbEAPM = ExternalAPIFactory::loadAPI('Dnb', true);
     $dnbEAPM->getConnector();
     if (!$dnbEAPM->getConnectorParam('dnb_username') || !$dnbEAPM->getConnectorParam('dnb_password') || !$dnbEAPM->getConnectorParam('dnb_env')) {
         return array('error' => 'ERROR_DNB_CONFIG');
     }
     return $dnbEAPM;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:13,代码来源:DnbApi.php


示例3: getDocumentsExternalApiDropDown

function getDocumentsExternalApiDropDown($focus = null, $name = null, $value = null, $view = null)
{
    require_once 'include/externalAPI/ExternalAPIFactory.php';
    $apiList = ExternalAPIFactory::getModuleDropDown('Documents');
    $apiList = array_merge(array('Sugar' => $GLOBALS['app_list_strings']['eapm_list']['Sugar']), $apiList);
    if (!empty($value) && empty($apiList[$value])) {
        $apiList[$value] = $value;
    }
    return $apiList;
}
开发者ID:NALSS,项目名称:SuiteCRM,代码行数:10,代码来源:DocumentExternalApiDropDown.php


示例4: loadDataSet

 /**
  * Return a feed of google contacts using the EAPM and Connectors farmework.
  *
  * @throws Exception
  * @param  $maxResults
  * @return array
  */
 public function loadDataSet($maxResults = 0)
 {
     if (!($eapmBean = EAPM::getLoginInfo($this->_eapmName, true))) {
         throw new Exception('Authentication error with Google Contacts EAPM.');
     }
     $api = ExternalAPIFactory::loadAPI($this->_eapmName);
     $api->loadEAPM($eapmBean);
     $conn = $api->getConnector();
     $feed = $conn->getList(array('maxResults' => $maxResults, 'startIndex' => $this->_offset));
     if ($feed !== FALSE) {
         $this->_totalRecordCount = $feed['totalResults'];
         $this->_recordSet = $feed['records'];
     } else {
         throw new Exception("Unable to retrieve {$this->_eapmName} feed.");
     }
 }
开发者ID:razorinc,项目名称:sugarcrm-example,代码行数:23,代码来源:ExternalSourceEAPMAdapter.php


示例5: listViewProcess

 function listViewProcess()
 {
     if (!($eapmBean = EAPM::getLoginInfo('LotusLive', true))) {
         $smarty = new Sugar_Smarty();
         echo $smarty->fetch('include/externalAPI/LotusLive/LotusLiveSignup.' . $GLOBALS['current_language'] . '.tpl');
         return;
     }
     $apiName = 'LotusLive';
     $api = ExternalAPIFactory::loadAPI($apiName, true);
     $api->loadEAPM($eapmBean);
     $quickCheck = $api->quickCheckLogin();
     if (!$quickCheck['success']) {
         $errorMessage = string_format(translate('LBL_ERR_FAILED_QUICKCHECK', 'EAPM'), array('LotusLive'));
         $errorMessage .= '<form method="POST" target="_EAPM_CHECK" action="index.php">';
         $errorMessage .= '<input type="hidden" name="module" value="EAPM">';
         $errorMessage .= '<input type="hidden" name="action" value="Save">';
         $errorMessage .= '<input type="hidden" name="record" value="' . $eapmBean->id . '">';
         $errorMessage .= '<input type="hidden" name="active" value="1">';
         $errorMessage .= '<input type="hidden" name="closeWhenDone" value="1">';
         $errorMessage .= '<input type="hidden" name="refreshParentWindow" value="1">';
         $errorMessage .= '<br><input type="submit" value="' . $GLOBALS['app_strings']['LBL_EMAIL_OK'] . '">&nbsp;';
         $errorMessage .= '<input type="button" onclick="lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" value="' . $GLOBALS['app_strings']['LBL_CANCEL_BUTTON_LABEL'] . '">';
         $errorMessage .= '</form>';
         echo $errorMessage;
         return;
     }
     $this->processSearchForm();
     $this->params['orderBy'] = 'meetings.date_start';
     $this->params['overrideOrder'] = true;
     $this->lv->searchColumns = $this->searchForm->searchColumns;
     $this->lv->show_action_dropdown = false;
     $this->lv->multiSelect = false;
     unset($this->searchForm->searchdefs['layout']['advanced_search']);
     if (!$this->headers) {
         return;
     }
     if (empty($_REQUEST['search_form_only']) || $_REQUEST['search_form_only'] == false) {
         $this->lv->ss->assign("SEARCH", false);
         if (!isset($_REQUEST['name_basic'])) {
             $_REQUEST['name_basic'] = '';
         }
         $this->lv->ss->assign('DCSEARCH', $_REQUEST['name_basic']);
         $this->lv->setup($this->seed, 'include/ListView/ListViewDCMenu.tpl', $this->where, $this->params);
         $savedSearchName = empty($_REQUEST['saved_search_select_name']) ? '' : ' - ' . $_REQUEST['saved_search_select_name'];
         echo $this->lv->display();
     }
 }
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:47,代码来源:view.listbytype.php


示例6: test

 /**
  * test
  * This method is called from the administration interface to run a test of the service
  * It is up to subclasses to implement a test and set _has_testing_enabled to true so that
  * a test button is rendered in the administration interface
  *
  * @return result boolean result of the test function
  */
 public function test()
 {
     require_once 'vendor/Zend/Oauth/Consumer.php';
     $api = ExternalAPIFactory::loadAPI('Twitter', true);
     if ($api) {
         $properties = $this->getProperties();
         $config = array('callbackUrl' => 'http://www.sugarcrm.com', 'siteUrl' => $api->getOauthRequestURL(), 'consumerKey' => $properties['oauth_consumer_key'], 'consumerSecret' => $properties['oauth_consumer_secret']);
         try {
             $consumer = new Zend_Oauth_Consumer($config);
             $consumer->getRequestToken();
             return true;
         } catch (Exception $e) {
             $GLOBALS['log']->error("Error getting request token for twitter:" . $e->getMessage());
             return false;
         }
     }
     return false;
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:26,代码来源:twitter.php


示例7: display

 public function display()
 {
     global $mod_strings;
     if (isset($_REQUEST['name_basic'])) {
         $file_search = trim($_REQUEST['name_basic']);
     } else {
         $file_search = '';
     }
     if (!isset($_REQUEST['apiName'])) {
         $apiName = 'IBMSmartCloud';
     } else {
         $tmpApi = ExternalAPIFactory::loadAPI($_REQUEST['apiName'], true);
         if ($tmpApi === false) {
             Log::error(string_format($mod_strings['ERR_INVALID_EXTERNAL_API_ACCESS'], [$_REQUEST['apiName']]));
             return;
         }
         $apiName = $_REQUEST['apiName'];
     }
     // See if we are running as a popup window
     if (isset($_REQUEST['isPopup']) && $_REQUEST['isPopup'] == 1 && !empty($_REQUEST['elemBaseName'])) {
         $isPopup = true;
     } else {
         $isPopup = false;
     }
     // bug50952 - must actually make sure we can log in, not just that we've got a EAPM record
     // getLoginInfo only checks to see if user has logged in correctly ONCE to ExternalAPI
     // Need to manually attempt to fetch the EAPM record, we don't want to give them the signup screen when they just have a deactivated account.
     $eapmBean = EAPM::getLoginInfo($apiName, true);
     $api = ExternalAPIFactory::loadAPI($apiName, true);
     $validSession = true;
     if (!empty($eapmBean)) {
         try {
             $api->loadEAPM($eapmBean);
             // $api->checkLogin() does the same thing as quickCheckLogin plus actually makes sure the user CAN log in to the API currently
             $loginCheck = $api->checkLogin($eapmBean);
             if (isset($loginCheck['success']) && !$loginCheck['success']) {
                 $validSession = false;
             }
         } catch (Exception $ex) {
             $validSession = false;
             Log::error(string_format($mod_strings['ERR_INVALID_EXTERNAL_API_LOGIN'], [$apiName]));
         }
     }
     if (!$validSession || empty($eapmBean)) {
         // Bug #49987 : Documents view.extdoc.php doesn't allow custom override
         $tpl_file = get_custom_file_if_exists('include/externalAPI/' . $apiName . '/' . $apiName . 'Signup.' . $GLOBALS['current_language'] . '.tpl');
         if (file_exists($tpl_file)) {
             $smarty = new Sugar_Smarty();
             echo $smarty->fetch($tpl_file);
         } else {
             $output = string_format(translate('LBL_ERR_FAILED_QUICKCHECK', 'EAPM'), [$apiName]);
             $output .= '<form method="POST" target="_EAPM_CHECK" action="index.php">';
             $output .= '<input type="hidden" name="module" value="EAPM">';
             $output .= '<input type="hidden" name="action" value="Save">';
             $output .= '<input type="hidden" name="record" value="' . $eapmBean->id . '">';
             $output .= '<input type="hidden" name="active" value="1">';
             $output .= '<input type="hidden" name="closeWhenDone" value="1">';
             $output .= '<input type="hidden" name="refreshParentWindow" value="1">';
             $output .= '<br><input type="submit" value="' . $GLOBALS['app_strings']['LBL_EMAIL_OK'] . '">&nbsp;';
             $output .= '<input type="button" onclick="lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" value="' . $GLOBALS['app_strings']['LBL_CANCEL_BUTTON_LABEL'] . '">';
             $output .= '</form>';
             echo $output;
         }
         return;
     }
     $searchDataLower = $api->searchDoc($file_search, true);
     // In order to emulate the list views for the SugarFields, I need to uppercase all of the key names.
     $searchData = [];
     if (is_array($searchDataLower)) {
         foreach ($searchDataLower as $row) {
             $newRow = [];
             foreach ($row as $key => $value) {
                 $newRow[strtoupper($key)] = $value;
             }
             if ($isPopup) {
                 // We are running as a popup window, we need to replace the direct url with some javascript
                 $newRow['DOC_URL'] = "javascript:window.opener.SUGAR.field.file.populateFromPopup('" . addslashes($_REQUEST['elemBaseName']) . "','" . addslashes($newRow['ID']) . "','" . addslashes($newRow['NAME']) . "','" . addslashes($newRow['URL']) . "','" . addslashes($newRow['URL']) . "'); window.close();";
             } else {
                 $newRow['DOC_URL'] = $newRow['URL'];
             }
             $searchData[] = $newRow;
         }
     }
     $displayColumns = ['NAME' => ['label' => 'LBL_LIST_EXT_DOCUMENT_NAME', 'type' => 'varchar', 'link' => true], 'DATE_MODIFIED' => ['label' => 'LBL_DATE', 'type' => 'date']];
     $ss = new Sugar_Smarty();
     $ss->assign('searchFieldLabel', translate('LBL_SEARCH_EXTERNAL_DOCUMENT', 'Documents'));
     $ss->assign('displayedNote', translate('LBL_EXTERNAL_DOCUMENT_NOTE', 'Documents'));
     $ss->assign('APP', $GLOBALS['app_strings']);
     $ss->assign('MOD', $GLOBALS['mod_strings']);
     $ss->assign('data', $searchData);
     $ss->assign('displayColumns', $displayColumns);
     $ss->assign('imgPath', SugarThemeRegistry::current()->getImageURL($apiName . '_image_inline.png'));
     if ($isPopup) {
         $ss->assign('linkTarget', '');
         $ss->assign('isPopup', 1);
         $ss->assign('elemBaseName', $_REQUEST['elemBaseName']);
     } else {
         $ss->assign('linkTarget', '_new');
         $ss->assign('isPopup', 0);
         $ss->assign('elemBaseName', '');
//.........这里部分代码省略.........
开发者ID:butschster,项目名称:sugarcrm_dev,代码行数:101,代码来源:view.extdoc.php


示例8: getAuthenticatedImportableExternalEAPMs

 private function getAuthenticatedImportableExternalEAPMs()
 {
     return ExternalAPIFactory::getModuleDropDown('Import', FALSE, FALSE);
 }
开发者ID:isrealconsulting,项目名称:ic-suite,代码行数:4,代码来源:view.step1.php


示例9: array

require_once 'include/externalAPI/ExternalAPIFactory.php';
global $app_strings;
$checkList = ExternalAPIFactory::listAPI('', true);
if (!empty($_REQUEST['api'])) {
    // Check just one login type
    $newCheckList = array();
    if (isset($checkList[$_REQUEST['api']])) {
        $newCheckList[$_REQUEST['api']] = $checkList[$_REQUEST['api']];
    }
    $checkList = $newCheckList;
}
$failList = array();
if (is_array($checkList)) {
    foreach ($checkList as $apiName => $apiOpts) {
        if ($apiOpts['authMethod'] == 'oauth') {
            $api = ExternalAPIFactory::loadAPI($apiName);
            if (is_object($api)) {
                $loginCheck = $api->quickCheckLogin();
            } else {
                $loginCheck['success'] = false;
            }
            if (!$loginCheck['success']) {
                $thisFail = array();
                $thisFail['checkURL'] = 'index.php?module=EAPM&closeWhenDone=1&action=QuickSave&application=' . $apiName;
                $translateKey = 'LBL_EXTAPI_' . strtoupper($apiName);
                if (!empty($app_strings[$translateKey])) {
                    $apiLabel = $app_strings[$translateKey];
                } else {
                    $apiLabel = $apiName;
                }
                $thisFail['label'] = str_replace('{0}', $apiLabel, translate('LBL_ERR_FAILED_QUICKCHECK', 'EAPM'));
开发者ID:sysraj86,项目名称:carnivalcrm,代码行数:31,代码来源:CheckLogins.php


示例10: save

 function save($check_notify = FALSE)
 {
     global $timedate;
     global $current_user;
     global $disable_date_format;
     if (isset($this->date_start) && isset($this->duration_hours) && isset($this->duration_minutes)) {
         if (isset($this->date_start) && isset($this->duration_hours) && isset($this->duration_minutes)) {
             $td = $timedate->fromDb($this->date_start);
             if (!$td) {
                 $this->date_start = $timedate->to_db($this->date_start);
                 $td = $timedate->fromDb($this->date_start);
             }
             if ($td) {
                 $this->date_end = $td->modify("+{$this->duration_hours} hours {$this->duration_minutes} mins")->asDb();
             }
         }
     }
     $check_notify = !empty($_REQUEST['send_invites']) && $_REQUEST['send_invites'] == '1' ? true : false;
     if (empty($_REQUEST['send_invites'])) {
         if (!empty($this->id)) {
             $old_record = new Meeting();
             $old_record->retrieve($this->id);
             $old_assigned_user_id = $old_record->assigned_user_id;
         }
         if (empty($this->id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $GLOBALS['current_user']->id != $_REQUEST['assigned_user_id'] || isset($old_assigned_user_id) && !empty($old_assigned_user_id) && isset($_REQUEST['assigned_user_id']) && !empty($_REQUEST['assigned_user_id']) && $old_assigned_user_id != $_REQUEST['assigned_user_id']) {
             $this->special_notification = true;
             $check_notify = true;
             if (isset($_REQUEST['assigned_user_name'])) {
                 $this->new_assigned_user_name = $_REQUEST['assigned_user_name'];
             }
         }
     }
     /*nsingh 7/3/08  commenting out as bug #20814 is invalid
     		if($current_user->getPreference('reminder_time')!= -1 &&  isset($_POST['reminder_checked']) && isset($_POST['reminder_time']) && $_POST['reminder_checked']==0  && $_POST['reminder_time']==-1){
     			$this->reminder_checked = '1';
     			$this->reminder_time = $current_user->getPreference('reminder_time');
     		}*/
     // prevent a mass mailing for recurring meetings created in Calendar module
     if (empty($this->id) && !empty($_REQUEST['module']) && $_REQUEST['module'] == "Calendar" && !empty($_REQUEST['repeat_type']) && !empty($this->repeat_parent_id)) {
         $check_notify = false;
     }
     if (empty($this->status)) {
         $this->status = $this->getDefaultStatus();
     }
     // Do any external API saving
     // Clear out the old external API stuff if we have changed types
     if (isset($this->fetched_row) && $this->fetched_row['type'] != $this->type) {
         $this->join_url = '';
         $this->host_url = '';
         $this->external_id = '';
         $this->creator = '';
     }
     if (!empty($this->type) && $this->type != 'Sugar') {
         require_once 'include/externalAPI/ExternalAPIFactory.php';
         $api = ExternalAPIFactory::loadAPI($this->type);
     }
     if (empty($this->type)) {
         $this->type = 'Sugar';
     }
     if (isset($api) && is_a($api, 'WebMeeting') && empty($this->in_relationship_update)) {
         // Make sure the API initialized and it supports Web Meetings
         // Also make suer we have an ID, the external site needs something to reference
         if (!isset($this->id) || empty($this->id)) {
             $this->id = create_guid();
             $this->new_with_id = true;
         }
         $response = $api->scheduleMeeting($this);
         if ($response['success'] == TRUE) {
             // Need to send out notifications
             if ($api->canInvite) {
                 $notifyList = $this->get_notification_recipients();
                 foreach ($notifyList as $person) {
                     $api->inviteAttendee($this, $person, $check_notify);
                 }
             }
         } else {
             SugarApplication::appendErrorMessage($GLOBALS['app_strings']['ERR_EXTERNAL_API_SAVE_FAIL']);
             return $this->id;
         }
         $api->logoff();
     }
     $return_id = parent::save($check_notify);
     if ($this->update_vcal) {
         vCal::cache_sugar_vcal($current_user);
     }
     return $return_id;
 }
开发者ID:jgera,项目名称:sugarcrm_dev,代码行数:87,代码来源:Meeting.php


示例11: upload_doc

 /**
  * Upload document to external service
  * @param SugarBean $bean Related bean
  * @param string $bean_id
  * @param string $doc_type
  * @param string $file_name
  * @param string $mime_type
  */
 function upload_doc($bean, $bean_id, $doc_type, $file_name, $mime_type)
 {
     if (!empty($doc_type) && $doc_type != 'Sugar') {
         global $sugar_config;
         $destination = $this->get_upload_path($bean_id);
         sugar_rename($destination, str_replace($bean_id, $bean_id . '_' . $file_name, $destination));
         $new_destination = $this->get_upload_path($bean_id . '_' . $file_name);
         try {
             $this->api = ExternalAPIFactory::loadAPI($doc_type);
             if (isset($this->api) && $this->api !== false) {
                 $result = $this->api->uploadDoc($bean, $new_destination, $file_name, $mime_type);
             } else {
                 $result['success'] = FALSE;
                 // FIXME: Translate
                 $GLOBALS['log']->error("Could not load the requested API (" . $doc_type . ")");
                 $result['errorMessage'] = 'Could not find a proper API';
             }
         } catch (Exception $e) {
             $result['success'] = FALSE;
             $result['errorMessage'] = $e->getMessage();
             $GLOBALS['log']->error("Caught exception: (" . $e->getMessage() . ") ");
         }
         if (!$result['success']) {
             sugar_rename($new_destination, str_replace($bean_id . '_' . $file_name, $bean_id, $new_destination));
             $bean->doc_type = 'Sugar';
             // FIXME: Translate
             if (!is_array($_SESSION['user_error_message'])) {
                 $_SESSION['user_error_message'] = array();
             }
             $error_message = isset($result['errorMessage']) ? $result['errorMessage'] : $GLOBALS['app_strings']['ERR_EXTERNAL_API_SAVE_FAIL'];
             $_SESSION['user_error_message'][] = $error_message;
         } else {
             unlink($new_destination);
         }
     }
 }
开发者ID:sunmo,项目名称:snowlotus,代码行数:44,代码来源:upload_file.php


示例12: externalApi

 function externalApi($data)
 {
     require_once 'include/externalAPI/ExternalAPIFactory.php';
     $api = ExternalAPIFactory::loadAPI($data['api']);
     $json = getJSONobj();
     $listArray['fields'] = $api->searchDoc($_REQUEST['query']);
     $listArray['totalCount'] = count($listArray['fields']);
     $listJson = $json->encodeReal($listArray);
     return $listJson;
 }
开发者ID:netconstructor,项目名称:sugarcrm_dev,代码行数:10,代码来源:quicksearchQuery.php


示例13: test

 public function test()
 {
     $api = ExternalAPIFactory::loadAPI('Plivo', true);
     return $api->getAccountDetails();
 }
开发者ID:hectorrios,项目名称:sugarcrm-plivo,代码行数:5,代码来源:plivo.php


示例14: clearExternalAPICache

 public function clearExternalAPICache()
 {
     global $mod_strings, $sugar_config;
     if ($this->show_output) {
         echo "<h3>{$mod_strings['LBL_QR_CLEAR_EXT_API']}</h3>";
     }
     require_once 'include/externalAPI/ExternalAPIFactory.php';
     ExternalAPIFactory::clearCache();
 }
开发者ID:thsonvt,项目名称:sugarcrm_dev,代码行数:9,代码来源:QuickRepairAndRebuild.php


示例15: externalApi

 /**
  * Returns search results from external API
  *
  * @param array $args
  * @return array
  */
 public function externalApi($args)
 {
     require_once 'include/externalAPI/ExternalAPIFactory.php';
     $data = array();
     try {
         $api = ExternalAPIFactory::loadAPI($args['api']);
         $data['fields'] = $api->searchDoc($_REQUEST['query']);
         $data['totalCount'] = count($data['fields']);
     } catch (Exception $ex) {
         $GLOBALS['log']->error($ex->getMessage());
     }
     return $this->getJsonEncodedData($data);
 }
开发者ID:delkyd,项目名称:sugarcrm_dev,代码行数:19,代码来源:QuickSearch.php


示例16: display

 public function display()
 {
     if (isset($_REQUEST['name_basic'])) {
         $file_search = trim($_REQUEST['name_basic']);
     } else {
         $file_search = '';
     }
     if (!isset($_REQUEST['apiName'])) {
         $apiName = 'LotusLive';
     } else {
         $tmpApi = ExternalAPIFactory::loadAPI($_REQUEST['apiName'], true);
         if ($tmpApi === false) {
             $GLOBALS['log']->error('The user attempted to access an invalid external API (' . $_REQUEST['apiName'] . ')');
             return;
         }
         $apiName = $_REQUEST['apiName'];
     }
     // See if we are running as a popup window
     if (isset($_REQUEST['isPopup']) && $_REQUEST['isPopup'] == 1 && !empty($_REQUEST['elemBaseName'])) {
         $isPopup = true;
     } else {
         $isPopup = false;
     }
     // Need to manually attempt to fetch the EAPM record, we don't want to give them the signup screen when they just have a deactivated account.
     if (!($eapmBean = EAPM::getLoginInfo($apiName, true))) {
         $smarty = new Sugar_Smarty();
         echo $smarty->fetch('include/externalAPI/' . $apiName . '/' . $apiName . 'Signup.' . $GLOBALS['current_language'] . '.tpl');
         return;
     }
     $api = ExternalAPIFactory::loadAPI($apiName, true);
     $api->loadEAPM($eapmBean);
     $quickCheck = $api->quickCheckLogin();
     if (!$quickCheck['success']) {
         $errorMessage = string_format(translate('LBL_ERR_FAILED_QUICKCHECK', 'EAPM'), array($apiName));
         $errorMessage .= '<form method="POST" target="_EAPM_CHECK" action="index.php">';
         $errorMessage .= '<input type="hidden" name="module" value="EAPM">';
         $errorMessage .= '<input type="hidden" name="action" value="Save">';
         $errorMessage .= '<input type="hidden" name="record" value="' . $eapmBean->id . '">';
         $errorMessage .= '<input type="hidden" name="active" value="1">';
         $errorMessage .= '<input type="hidden" name="closeWhenDone" value="1">';
         $errorMessage .= '<input type="hidden" name="refreshParentWindow" value="1">';
         $errorMessage .= '<br><input type="submit" value="' . $GLOBALS['app_strings']['LBL_EMAIL_OK'] . '">&nbsp;';
         $errorMessage .= '<input type="button" onclick="lastLoadedMenu=undefined;DCMenu.closeOverlay();return false;" value="' . $GLOBALS['app_strings']['LBL_CANCEL_BUTTON_LABEL'] . '">';
         $errorMessage .= '</form>';
         echo $errorMessage;
         return;
     }
     $searchDataLower = $api->searchDoc($file_search, true);
     // In order to emulate the list views for the SugarFields, I need to uppercase all of the key names.
     $searchData = array();
     if (is_array($searchDataLower)) {
         foreach ($searchDataLower as $row) {
             $newRow = array();
             foreach ($row as $key => $value) {
                 $newRow[strtoupper($key)] = $value;
             }
             if ($isPopup) {
                 // We are running as a popup window, we need to replace the direct url with some javascript
                 $newRow['DOC_URL'] = "javascript:window.opener.SUGAR.field.file.populateFromPopup('" . addslashes($_REQUEST['elemBaseName']) . "','" . addslashes($newRow['ID']) . "','" . addslashes($newRow['NAME']) . "','" . addslashes($newRow['URL']) . "','" . addslashes($newRow['URL']) . "'); window.close();";
             } else {
                 $newRow['DOC_URL'] = $newRow['URL'];
             }
             $searchData[] = $newRow;
         }
     }
     $displayColumns = array('NAME' => array('label' => 'LBL_LIST_EXT_DOCUMENT_NAME', 'type' => 'varchar', 'link' => true), 'DATE_MODIFIED' => array('label' => 'LBL_DATE', 'type' => 'date'));
     $ss = new Sugar_Smarty();
     $ss->assign('searchFieldLabel', translate('LBL_SEARCH_EXTERNAL_DOCUMENT', 'Documents'));
     $ss->assign('displayedNote', translate('LBL_EXTERNAL_DOCUMENT_NOTE', 'Documents'));
     $ss->assign('APP', $GLOBALS['app_strings']);
     $ss->assign('MOD', $GLOBALS['mod_strings']);
     $ss->assign('data', $searchData);
     $ss->assign('displayColumns', $displayColumns);
     $ss->assign('imgPath', SugarThemeRegistry::current()->getImageURL($apiName . '_image_inline.png'));
     if ($isPopup) {
         $ss->assign('linkTarget', '');
         $ss->assign('isPopup', 1);
         $ss->assign('elemBaseName', $_REQUEST['elemBaseName']);
     } else {
         $ss->assign('linkTarget', '_new');
         $ss->assign('isPopup', 0);
         $ss->assign('elemBaseName', '');
     }
     $ss->assign('apiName', $apiName);
     $ss->assign('DCSEARCH', $file_search);
     if ($isPopup) {
         // Need the popup header... I feel so dirty.
         ob_start();
         echo '<div class="dccontent">';
         insert_popup_header($GLOBALS['theme']);
         $output_html = ob_get_contents();
         ob_end_clean();
         $output_html .= get_form_header(translate('LBL_SEARCH_FORM_TITLE', 'Documents'), '', false);
         echo $output_html;
     }
     $ss->display('modules/Documents/tpls/view.extdoc.tpl');
     if ($isPopup) {
         // Close the dccontent div
         echo '</div>';
     }
//.........这里部分代码省略.........
开发者ID:rgauss,项目名称:sugarcrm_dev,代码行数:101,代码来源:view.extdoc.php


示例17: action_FlushFileCache

 protected function action_FlushFileCache()
 {
     $api = ExternalAPIFactory::loadAPI($_REQUEST['api']);
     if ($api == false) {
         echo 'FAILED';
         return;
     }
     if (method_exists($api, 'loadDocCache')) {
         $api->loadDocCache(true);
     }
     echo 'SUCCESS';
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:12,代码来源:controller.php


示例18: test

 public function test()
 {
     $api = ExternalAPIFactory::loadAPI('Dnb', true);
     return $api->checkTokenValidity(false);
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:5,代码来源:dnb.php


示例19: getImportableExternalEAPMs

 private function getImportableExternalEAPMs()
 {
     require_once 'include/externalAPI/ExternalAPIFactory.php';
     return ExternalAPIFactory::getModuleDropDown('Import', FALSE, FALSE, 'eapm_import_list');
 }
开发者ID:jglaine,项目名称:sugar761-ent,代码行数:5,代码来源:view.extstep1.php


示例20: fillInName

 protected function fillInName()
 {
     if (!empty($this->application)) {
         $apiList = ExternalAPIFactory::loadFullAPIList(false, true);
     }
     if (!empty($apiList) && isset($apiList[$this->application]) && $apiList[$this->application]['authMethod'] == "oauth") {
         $this->name = sprintf(translate('LBL_OAUTH_NAME', $this->module_dir), $this->application);
     }
 }
开发者ID:BMLP,项目名称:memoryhole-ansible,代码行数:9,代码来源:EAPM.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP ExtraField类代码示例发布时间:2022-05-23
下一篇:
PHP ExtensionRegistry类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap