本文整理匯總了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;
}