本文整理汇总了PHP中Vtiger_Response::setResult方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Response::setResult方法的具体用法?PHP Vtiger_Response::setResult怎么用?PHP Vtiger_Response::setResult使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Response
的用法示例。
在下文中一共展示了Vtiger_Response::setResult方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
/**
* Function that saves SMS records
* @param Vtiger_Request $request
*/
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$currentUserModel = Users_Record_Model::getCurrentUserModel();
$recordIds = $this->getRecordsListFromRequest($request);
$phoneFieldList = $request->get('fields');
$message = $request->get('message');
foreach ($recordIds as $recordId) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId);
$numberSelected = false;
foreach ($phoneFieldList as $fieldname) {
$fieldValue = $recordModel->get($fieldname);
if (!empty($fieldValue)) {
$toNumbers[] = $fieldValue;
$numberSelected = true;
}
}
if ($numberSelected) {
$recordIds[] = $recordId;
}
}
$response = new Vtiger_Response();
if (!empty($toNumbers)) {
SMSNotifier_Record_Model::SendSMS($message, $toNumbers, $currentUserModel->getId(), $recordIds, $moduleName);
$response->setResult(true);
} else {
$response->setResult(false);
}
return $response;
}
示例2: process
/**
* Process the request for displaying UI
* @global String $moduleName
* @param Vtiger_Request $request
* @return MailManager_Response
*/
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$response = new Vtiger_Response();
$viewer = $this->getViewer($request);
if ($this->getOperationArg($request) == "_quicklinks") {
$content = $viewer->view('MainuiQuickLinks.tpl', $moduleName, true);
$response->setResult(array('ui' => $content));
return $response;
} else {
if ($this->hasMailboxModel()) {
$connector = $this->getConnector();
if ($connector->hasError()) {
$viewer->assign('ERROR', $connector->lastError());
} else {
$folders = $connector->folders();
$connector->updateFolders();
$viewer->assign('FOLDERS', $folders);
}
$this->closeConnector();
}
$viewer->assign('MODULE', $moduleName);
$content = $viewer->view('Mainui.tpl', $moduleName, true);
$response->setResult(array('mailbox' => $this->hasMailboxModel(), 'ui' => $content));
return $response;
}
}
示例3: save
/**
* Save date
* @param <Object> $request
* @return true if saved, false otherwise
*/
public function save(Vtiger_Request $request)
{
$response = new Vtiger_Response();
$moduleName = 'Settings:' . $request->getModule();
try {
$id = $request->get('holidayId');
$date = DateTimeField::convertToDBFormat($request->get('holidayDate'));
$name = $request->get('holidayName');
$type = $request->get('holidayType');
if (empty($name) || empty($date)) {
$response->setResult(array('success' => false, 'message' => vtranslate('LBL_FILL_FORM_ERROR', $moduleName)));
} else {
if (!empty($id)) {
if (Settings_PublicHoliday_Module_Model::edit($id, $date, $name, $type)) {
$response->setResult(array('success' => true, 'message' => vtranslate('LBL_EDIT_DATE_OK', $moduleName)));
} else {
$response->setResult(array('success' => false, 'message' => vtranslate('LBL_EDIT_DATE_ERROR', $moduleName)));
}
} else {
if (Settings_PublicHoliday_Module_Model::save($date, $name, $type)) {
$response->setResult(array('success' => true, 'message' => vtranslate('LBL_NEW_DATE_OK', $moduleName)));
} else {
$response->setResult(array('success' => false, 'message' => vtranslate('LBL_NEW_DATE_ERROR', $moduleName)));
}
}
}
} catch (Exception $e) {
$response->setError($e->getCode(), $e->getMessage());
}
$response->emit();
}
示例4: process
/**
* Process the request for Folder opertions
* @global <type> $list_max_entries_per_page
* @param MailManager_Request $request
* @return MailManager_Response
*/
function process(MailManager_Request $request)
{
global $list_max_entries_per_page, $current_user;
$response = new Vtiger_Response();
if ('open' == $request->getOperationArg()) {
$q = $request->get('q');
$foldername = $request->get('_folder');
$type = $request->get('type');
$connector = $this->getConnector($foldername);
$folder = $connector->folderInstance($foldername);
if (empty($q)) {
$connector->folderMails($folder, intval($request->get('_page', 0)), $list_max_entries_per_page);
} else {
if (empty($type)) {
$type = 'ALL';
}
if ($type == 'ON') {
$dateFormat = $current_user->date_format;
if ($dateFormat == 'mm-dd-yyyy') {
$dateArray = explode('-', $q);
$temp = $dateArray[0];
$dateArray[0] = $dateArray[1];
$dateArray[1] = $temp;
$q = implode('-', $dateArray);
}
$query = date('d M Y', strtotime($q));
$q = '' . $type . ' "' . vtlib_purify($query) . '"';
} else {
$q = '' . $type . ' "' . vtlib_purify($q) . '"';
}
$connector->searchMails($q, $folder, intval($request->get('_page', 0)), $list_max_entries_per_page);
}
$folderList = $connector->getFolderList();
$viewer = $this->getViewer();
$viewer->assign('TYPE', $type);
$viewer->assign('QUERY', $request->get('q'));
$viewer->assign('FOLDER', $folder);
$viewer->assign('FOLDERLIST', $folderList);
$viewer->assign('SEARCHOPTIONS', self::getSearchOptions());
$viewer->assign("JS_DATEFORMAT", parse_calendardate(getTranslatedString('NTC_DATE_FORMAT')));
$response->setResult($viewer->fetch($this->getModuleTpl('FolderOpen.tpl')));
} elseif ('drafts' == $request->getOperationArg()) {
$q = $request->get('q');
$type = $request->get('type');
$page = intval($request->get('_page', 0));
$connector = $this->getConnector('__vt_drafts');
$folder = $connector->folderInstance();
if (empty($q)) {
$draftMails = $connector->getDrafts($page, $list_max_entries_per_page, $folder);
} else {
$draftMails = $connector->searchDraftMails($q, $type, $page, $list_max_entries_per_page, $folder);
}
$viewer = $this->getViewer();
$viewer->assign('MAILS', $draftMails);
$viewer->assign('FOLDER', $folder);
$viewer->assign('SEARCHOPTIONS', MailManager_DraftController::getSearchOptions());
$response->setResult($viewer->fetch($this->getModuleTpl('FolderDrafts.tpl')));
}
return $response;
}
示例5: process
function process(Vtiger_Request $request)
{
$db = PearDatabase::getInstance();
$response = new Vtiger_Response();
$result = $db->pquery('SELECT 1 FROM vtiger_smsnotifier_servers WHERE isactive = 1', array());
if ($db->num_rows($result)) {
$response->setResult(true);
} else {
$response->setResult(false);
}
return $response;
}
示例6: process
function process(Vtiger_Request $request)
{
$db = PearDatabase::getInstance();
$response = new Vtiger_Response();
$result = $db->pquery('SELECT 1 FROM vtiger_systems WHERE server_type = ?', array('email'));
if ($db->num_rows($result)) {
$response->setResult(true);
} else {
$response->setResult(false);
}
return $response;
}
示例7: process
public function process(Vtiger_Request $request)
{
$recordId = $request->get('record');
$response = new Vtiger_Response();
$recordModel = Vtiger_PDF_Model::getInstanceById($recordId);
if (Settings_PDF_Record_Model::delete($recordModel)) {
$response->setResult(array('success' => 'true'));
} else {
$response->setResult(array('success' => 'false'));
}
$response->emit();
}
示例8: process
public function process(Vtiger_Request $request)
{
$recordId = $request->get('record');
$response = new Vtiger_Response();
$moduleInstance = Settings_MappedFields_Module_Model::getInstanceById($recordId);
if ($moduleInstance->delete()) {
$response->setResult(array('success' => 'true'));
} else {
$response->setResult(array('success' => 'false'));
}
$response->emit();
}
示例9: checkDuplicate
public function checkDuplicate(Vtiger_Request $request)
{
$profileName = $request->get('profilename');
$recordId = $request->get('record');
$recordModel = Settings_Profiles_Record_Model::getInstanceByName($profileName, false, array($recordId));
$response = new Vtiger_Response();
if (!empty($recordModel)) {
$response->setResult(array('success' => true, 'message' => vtranslate('LBL_DUPLICATES_EXIST', $request->getModule(false))));
} else {
$response->setResult(array('success' => false));
}
$response->emit();
}
示例10: changeActiveStatus
public function changeActiveStatus(Vtiger_Request $request)
{
$id = $request->get('id');
$status = $request->get('status');
$moduleModel = new Settings_ModTracker_Module_Model();
$moduleModel->changeActiveStatus($id, $status == 'true' ? 1 : 0);
$response = new Vtiger_Response();
if ($status == 'true') {
$response->setResult(array('success' => true, 'message' => vtranslate('LBL_TRACK_CHANGES_ENABLED', $request->getModule(false))));
} else {
$response->setResult(array('success' => true, 'message' => vtranslate('LBL_TRACK_CHANGES_DISABLE', $request->getModule(false))));
}
$response->emit();
}
示例11: process
public function process(Vtiger_Request $request)
{
$record = $request->get('record');
$sourceModule = $request->get('source_module');
$response = new Vtiger_Response();
$permitted = Users_Privileges_Model::isPermitted($sourceModule, 'DetailView', $record);
if ($permitted) {
$recordModel = Vtiger_Record_Model::getInstanceById($record, $sourceModule);
$data = $recordModel->getData();
$response->setResult(array('success' => true, 'data' => array_map('decode_html', $data)));
} else {
$response->setResult(array('success' => false, 'message' => vtranslate('LBL_PERMISSION_DENIED')));
}
$response->emit();
}
示例12: getSecretKey
public function getSecretKey(Vtiger_Request $request)
{
$serverModel = PBXManager_Server_Model::getInstance();
$response = new Vtiger_Response();
$vtigersecretkey = $serverModel->get('vtigersecretkey');
if ($vtigersecretkey) {
$connector = $serverModel->getConnector();
$vtigersecretkey = $connector->getVtigerSecretKey();
$response->setResult($vtigersecretkey);
} else {
$vtigersecretkey = PBXManager_Server_Model::generateVtigerSecretKey();
$response->setResult($vtigersecretkey);
}
$response->emit();
}
示例13: process
public function process(Vtiger_Request $request)
{
$mode = $request->get('mode');
$name = 'Settings_CurrencyUpdate_models_' . $request->get('name') . '_BankModel';
$moduleModel = Settings_CurrencyUpdate_Module_Model::getCleanInstance();
$response = new Vtiger_Response();
if ($mode == 'supported') {
$supported = $moduleModel->getSupportedCurrencies($name);
$response->setResult($supported);
} else {
$unsupported = $moduleModel->getUnSupportedCurrencies($name);
$response->setResult($unsupported);
}
$response->emit();
}
示例14: process
public function process(Vtiger_Request $request)
{
$response = new Vtiger_Response();
$moduleName = $request->getModule();
$url = $request->get('feedurl');
$recordModel = Rss_Record_Model::getCleanInstance($moduleName);
$result = $recordModel->validateRssUrl($url);
if ($result) {
$recordModel->save($url);
$response->setResult(array('success' => true, 'message' => vtranslate('JS_RSS_SUCCESSFULLY_SAVED', $moduleName), 'id' => $recordModel->getId()));
} else {
$response->setResult(array('success' => false, 'message' => vtranslate('JS_INVALID_RSS_URL', $moduleName)));
}
$response->emit();
}
示例15: process
function process(Vtiger_Request $request)
{
$recordId = $request->get('record');
$idList = $request->get('idlist');
$currencyId = $request->get('currency_id');
$currencies = Inventory_Module_Model::getAllCurrencies();
$conversionRate = 1;
$response = new Vtiger_Response();
if (empty($idList)) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId);
$taxes = $recordModel->getTaxes();
$listPriceValues = $recordModel->getListPriceValues($recordModel->getId());
$priceDetails = $recordModel->getPriceDetails();
foreach ($priceDetails as $currencyDetails) {
if ($currencyId == $currencyDetails['curid']) {
$conversionRate = $currencyDetails['conversionrate'];
}
}
$listPrice = (double) $recordModel->get('unit_price') * (double) $conversionRate;
if ($recordModel->has('usageunit')) {
$usageUnit = vtranslate($recordModel->get('usageunit'), 'Products');
} else {
$usageUnit = vtranslate($recordModel->get('service_usageunit'), 'Services');
}
$response->setResult(array($recordId => array('id' => $recordId, 'name' => decode_html($recordModel->getName()), 'taxes' => $taxes, 'listprice' => $listPrice, 'listpricevalues' => $listPriceValues, 'description' => decode_html($recordModel->get('description')), 'quantityInStock' => $recordModel->get('qtyinstock'), 'usageunit' => $usageUnit)));
} else {
foreach ($idList as $id) {
$recordModel = Vtiger_Record_Model::getInstanceById($id);
$taxes = $recordModel->getTaxes();
$listPriceValues = $recordModel->getListPriceValues($recordModel->getId());
$priceDetails = $recordModel->getPriceDetails();
foreach ($priceDetails as $currencyDetails) {
if ($currencyId == $currencyDetails['curid']) {
$conversionRate = $currencyDetails['conversionrate'];
}
}
$listPrice = (double) $recordModel->get('unit_price') * (double) $conversionRate;
if ($recordModel->has('usageunit')) {
$usageUnit = vtranslate($recordModel->get('usageunit'), 'Products');
} else {
$usageUnit = vtranslate($recordModel->get('service_usageunit'), 'Services');
}
$info[] = array($id => array('id' => $id, 'name' => decode_html($recordModel->getName()), 'taxes' => $taxes, 'listprice' => $listPrice, 'listpricevalues' => $listPriceValues, 'description' => decode_html($recordModel->get('description')), 'quantityInStock' => $recordModel->get('qtyinstock'), 'usageunit' => $usageUnit));
}
$response->setResult($info);
}
$response->emit();
}