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


PHP CM_Params類代碼示例

本文整理匯總了PHP中CM_Params的典型用法代碼示例。如果您正苦於以下問題:PHP CM_Params類的具體用法?PHP CM_Params怎麽用?PHP CM_Params使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: _execute

 protected function _execute(CM_Params $params)
 {
     $id = $params->getInt('id');
     $values = $params->getArray('values');
     $svm = new CM_SVM_Model($id);
     return $svm->predict($values);
 }
開發者ID:cargomedia,項目名稱:cm,代碼行數:7,代碼來源:PredictJob.php

示例2: _execute

 protected function _execute(CM_Params $params)
 {
     $propertyId = $params->getString('propertyId');
     $parameterList = $params->getArray('parameterList');
     $client = new CMService_GoogleAnalytics_MeasurementProtocol_Client($propertyId);
     $client->_submitHit($parameterList);
 }
開發者ID:cargomedia,項目名稱:cm,代碼行數:7,代碼來源:SendHitJob.php

示例3: _execute

 protected function _execute(CM_Params $params)
 {
     $user = $params->getUser('user');
     if (null === CM_Model_StreamChannel_Message_User::findByUser($user)) {
         $user->setOnline(false);
     }
 }
開發者ID:cargomedia,項目名稱:cm,代碼行數:7,代碼來源:OfflineJob.php

示例4: prepare

 public function prepare(CM_Params $renderParams, CM_Frontend_Environment $environment, CM_Frontend_ViewResponse $viewResponse)
 {
     $text = $this->getParams()->has('text') ? $renderParams->getString('text') : null;
     $skipDropZone = $renderParams->getBoolean('skipDropZone', false);
     $viewResponse->set('text', $text);
     $viewResponse->set('skipDropZone', $skipDropZone);
 }
開發者ID:NicolasSchmutz,項目名稱:cm,代碼行數:7,代碼來源:File.php

示例5: _execute

 protected function _execute(CM_Params $params)
 {
     $id = $params->getInt('id');
     $class = $params->getInt('class');
     $values = $params->getArray('values');
     $svm = new CM_SVM_Model($id);
     $svm->addTraining($class, $values);
 }
開發者ID:cargomedia,項目名稱:cm,代碼行數:8,代碼來源:AddTrainingJob.php

示例6: ajax_loadComponent

 public function ajax_loadComponent(CM_Params $params, CM_Frontend_JavascriptContainer_View $handler, CM_Http_Response_View_Ajax $response)
 {
     $className = $params->getString('className');
     $params->remove('className');
     if (!class_exists($className)) {
         throw new CM_Exception_Invalid('Class not found', CM_Exception::WARN, ['className' => $className]);
     }
     return $response->loadComponent($className, $params);
 }
開發者ID:cargomedia,項目名稱:cm,代碼行數:9,代碼來源:Abstract.php

示例7: _execute

 protected function _execute(CM_Params $params)
 {
     $indexClassName = $params->getString('indexClassName');
     $id = $params->getString('id');
     /** @var CM_Elasticsearch_Type_Abstract $index */
     $index = new $indexClassName();
     $index->update(array($id));
     $index->getIndex()->refresh();
 }
開發者ID:NicolasSchmutz,項目名稱:cm,代碼行數:9,代碼來源:UpdateDocumentJob.php

示例8: ajax_flushLog

 public function ajax_flushLog(CM_Params $params, CM_Frontend_JavascriptContainer $handler, CM_Http_Response_View_Ajax $response)
 {
     if (!$this->_getAllowedFlush($response->getRender()->getEnvironment())) {
         throw new CM_Exception_NotAllowed();
     }
     $type = $params->getInt('type');
     $logList = CM_Paging_Log_Abstract::factory($type);
     $logList->flush();
     $response->reloadComponent();
 }
開發者ID:NicolasSchmutz,項目名稱:cm,代碼行數:10,代碼來源:LogList.php

示例9: _execute

 protected function _execute(CM_Params $params)
 {
     $code = $params->getString('code');
     $identityList = $params->getArray('identityList');
     $eventName = $params->getString('eventName');
     $propertyList = $params->getArray('propertyList');
     $kissMetrics = new CMService_KissMetrics_Client($code);
     $kissMetrics->setIdentityList($identityList);
     $kissMetrics->trackEvent($eventName, $propertyList);
 }
開發者ID:cargomedia,項目名稱:cm,代碼行數:10,代碼來源:TrackEventJob.php

示例10: _execute

 protected function _execute(CM_Params $params)
 {
     $indexClassName = $params->getString('indexClassName');
     $id = $params->getString('id');
     $client = CM_Service_Manager::getInstance()->getElasticsearch()->getClient();
     /** @var CM_Elasticsearch_Type_Abstract $index */
     $index = new $indexClassName($client);
     $index->updateDocuments(array($id));
     $index->refreshIndex();
 }
開發者ID:cargomedia,項目名稱:cm,代碼行數:10,代碼來源:UpdateDocumentJob.php

示例11: ajax_getSuggestionByCoordinates

 public function ajax_getSuggestionByCoordinates(CM_Params $params, CM_Frontend_JavascriptContainer_View $handler, CM_Http_Response_View_Ajax $response)
 {
     $lat = $params->getFloat('lat');
     $lon = $params->getFloat('lon');
     $location = CM_Model_Location::findByCoordinates($lat, $lon);
     $location = $this->_squashLocationInConstraints($location);
     if (!$location) {
         throw new CM_Exception('Cannot find a location by coordinates `' . $lat . '` / `' . $lon . '`.');
     }
     return $this->getSuggestion($location, $response->getRender());
 }
開發者ID:NicolasSchmutz,項目名稱:cm,代碼行數:11,代碼來源:Location.php

示例12: prepare

 public function prepare(CM_Params $renderParams, CM_Frontend_Environment $environment, CM_Frontend_ViewResponse $viewResponse)
 {
     $text = $renderParams->has('text') ? $renderParams->getString('text') : null;
     $buttonTheme = $this->_params->getString('buttonTheme', 'default');
     $skipPreviews = $this->_params->getBoolean('skipPreviews', false);
     $viewResponse->set('text', $text);
     $viewResponse->set('buttonTheme', $buttonTheme);
     if ($skipPreviews) {
         $viewResponse->setDataAttributes(['skip-previews' => '']);
     }
 }
開發者ID:cargomedia,項目名稱:cm,代碼行數:11,代碼來源:File.php

示例13: ajax_flushLog

 public function ajax_flushLog(CM_Params $params, CM_Frontend_JavascriptContainer $handler, CM_Http_Response_View_Ajax $response)
 {
     if (!$this->_getAllowedFlush($response->getRender()->getEnvironment())) {
         throw new CM_Exception_NotAllowed();
     }
     $level = $params->has('level') ? $params->getInt('level') : null;
     $levelList = $level ? [$level] : null;
     $type = $params->has('type') ? $params->getInt('type') : null;
     $logList = new CM_Paging_Log($levelList, $type);
     $logList->flush();
     $response->reloadComponent();
 }
開發者ID:cargomedia,項目名稱:cm,代碼行數:12,代碼來源:LogList.php

示例14: _processView

 protected function _processView(array $output)
 {
     $success = array();
     $form = $this->_getView();
     $className = get_class($form);
     if (!$form instanceof CM_Form_Abstract) {
         throw new CM_Exception_Invalid('`' . $className . '`is not `CM_Form_Abstract` instance');
     }
     $query = $this->_request->getQuery();
     $actionName = (string) $query['actionName'];
     $data = (array) $query['data'];
     $this->_setStringRepresentation($className . '::' . $actionName);
     $success['data'] = CM_Params::encode($form->process($data, $actionName, $this));
     if (!empty($this->errors)) {
         $success['errors'] = $this->errors;
     }
     $jsCode = $this->getRender()->getGlobalResponse()->getJs();
     if (!empty($jsCode)) {
         $success['exec'] = $jsCode;
     }
     if (!empty($this->messages)) {
         $success['messages'] = $this->messages;
     }
     $output['success'] = $success;
     return $output;
 }
開發者ID:NicolasSchmutz,項目名稱:cm,代碼行數:26,代碼來源:Form.php

示例15: testProcessTranslationsEnableKey

 public function testProcessTranslationsEnableKey()
 {
     $language = CMTest_TH::createLanguage('test');
     $languageKey = CM_Model_LanguageKey::create('Hello World');
     $this->assertSame(false, $languageKey->getJavascript());
     $site = CM_Site_Abstract::factory();
     $render = new CM_Frontend_Render(new CM_Frontend_Environment(null, null, $language));
     // Check that key is *not* included in the JS translations list
     $versionJavascript = CM_Model_Language::getVersionJavascript();
     $request = new CM_Http_Request_Get($render->getUrlResource('library-js', "translations/{$versionJavascript}.js"));
     $response = CM_Http_Response_Resource_Javascript_Library::createFromRequest($request, $site, $this->getServiceManager());
     $response->process();
     $this->assertNotContains('Hello World', $response->getContent());
     // Request JS-enabling of language key via RPC call
     $body = CM_Params::jsonEncode(['method' => 'CM_Model_Language.requestTranslationJs', 'params' => ['Hello World']]);
     $request = new CM_Http_Request_Post('/rpc', null, null, $body);
     $response = CM_Http_Response_RPC::createFromRequest($request, $site, $this->getServiceManager());
     $response->process();
     CMTest_TH::reinstantiateModel($languageKey);
     $this->assertSame(true, $languageKey->getJavascript());
     // Check that key *is* included in the JS translations list
     $versionJavascript = CM_Model_Language::getVersionJavascript();
     $request = new CM_Http_Request_Get($render->getUrlResource('library-js', "translations/{$versionJavascript}.js"));
     $response = CM_Http_Response_Resource_Javascript_Library::createFromRequest($request, $site, $this->getServiceManager());
     $response->process();
     $this->assertContains('Hello World', $response->getContent());
 }
開發者ID:cargomedia,項目名稱:cm,代碼行數:27,代碼來源:LibraryTest.php


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