本文整理汇总了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;
}
示例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;
}