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


PHP Vtiger_Response::isJSON方法代码示例

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


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

示例1: process

 /**
  * Process the request for Settings Operations
  * @param Vtiger_Request $request
  * @return MailManager_Response
  */
 function process(Vtiger_Request $request)
 {
     $response = new Vtiger_Response();
     $module = $request->getModule();
     if ('edit' == $this->getOperationArg($request)) {
         $model = $this->getMailBoxModel();
         $serverName = $model->serverName();
         $viewer = $this->getViewer($request);
         $viewer->assign('MODULE', $module);
         $viewer->assign('MAILBOX', $model);
         $viewer->assign('SERVERNAME', $serverName);
         $response->setResult($viewer->view('Settings.tpl', $module, true));
     } else {
         if ('save' == $this->getOperationArg($request)) {
             $model = $this->getMailBoxModel();
             $model->setServer($request->get('_mbox_server'));
             $model->setUsername($request->get('_mbox_user'));
             $model->setPassword($request->get('_mbox_pwd'));
             $model->setProtocol($request->get('_mbox_protocol', 'IMAP4'));
             $model->setSSLType($request->get('_mbox_ssltype', 'ssl'));
             $model->setCertValidate($request->get('_mbox_certvalidate', 'novalidate-cert'));
             $model->setRefreshTimeOut($request->get('_mbox_refresh_timeout'));
             $connector = $this->getConnector();
             if ($connector->isConnected()) {
                 $model->save();
                 $request->set('_operation', 'mainui');
                 return parent::process($request);
             } else {
                 if ($connector->hasError()) {
                     $response->isJSON(true);
                     $response->setError(101, $connector->lastError());
                 }
             }
         } else {
             if ('remove' == $this->getOperationArg($request)) {
                 $model = $this->getMailBoxModel();
                 $model->delete();
                 $response->isJSON(true);
                 $response->setResult(array('status' => true));
             }
         }
     }
     return $response;
 }
开发者ID:nouphet,项目名称:vtigercrm-6.0.0-ja,代码行数:49,代码来源:Settings.php

示例2: process

 /**
  * Process the request for Settings Operations
  * @param Vtiger_Request $request
  * @return MailManager_Response
  */
 public function process(Vtiger_Request $request)
 {
     $response = new Vtiger_Response();
     $module = $request->getModule();
     if ('edit' == $this->getOperationArg($request)) {
         $model = $this->getMailBoxModel();
         $connector = $this->getConnector();
         $serverName = $model->serverName();
         if ($connector->isConnected()) {
             $folders = $connector->folders();
         }
         $viewer = $this->getViewer($request);
         $viewer->assign('MODULE', $module);
         $viewer->assign('MAILBOX', $model);
         $viewer->assign('SERVERNAME', $serverName);
         $viewer->assign('FOLDERS', $folders);
         $response->setResult($viewer->view('SettingsEdit.tpl', $module, true));
     } else {
         if ('save' == $this->getOperationArg($request)) {
             $model = $this->getMailBoxModel();
             $model->setServer($request->get('_mbox_server'));
             $model->setUsername($request->get('_mbox_user'));
             $model->setPassword($request->getRaw('_mbox_pwd'));
             $model->setProtocol($request->get('_mbox_protocol', 'IMAP4'));
             $model->setSSLType($request->get('_mbox_ssltype', 'ssl'));
             $model->setCertValidate($request->get('_mbox_certvalidate', 'novalidate-cert'));
             $model->setRefreshTimeOut($request->get('_mbox_refresh_timeout'));
             $connector = $this->getConnector();
             $sentFolder = $request->get('_mbox_sent_folder');
             if ($connector->isConnected() && empty($sentFolder)) {
                 $folderInstaces = $connector->folders();
                 foreach ($folderInstaces as $folder) {
                     if (strpos(strtolower($folder->name()), 'sent') !== false) {
                         $sentFolder = $folder->name();
                     }
                 }
             }
             $model->setFolder($sentFolder);
             if ($connector->isConnected()) {
                 $model->save();
                 $request->set('_operation', 'mainui');
                 return parent::process($request);
             } else {
                 if ($connector->hasError()) {
                     $error = $connector->lastError();
                     $response->isJSON(true);
                     $response->setError(101, $error);
                 }
             }
         } else {
             if ('remove' == $this->getOperationArg($request)) {
                 $model = $this->getMailBoxModel();
                 $model->delete();
                 $response->isJSON(true);
                 $response->setResult(array('status' => true));
             } else {
                 if ('detail' == $this->getOperationArg($request)) {
                     $model = $this->getMailBoxModel();
                     $serverName = $model->serverName();
                     $viewer = $this->getViewer($request);
                     $viewer->assign('MODULE', $module);
                     $viewer->assign('MAILBOX', $model);
                     $viewer->assign('SERVERNAME', $serverName);
                     $response->setResult($viewer->view('SettingsDetail.tpl', $module, true));
                 }
             }
         }
     }
     return $response;
 }
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:75,代码来源:Settings.php


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