本文整理汇总了PHP中Vtiger_Response类的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Response类的具体用法?PHP Vtiger_Response怎么用?PHP Vtiger_Response使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vtiger_Response类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validateRecords
function validateRecords(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$records = $request->get('records');
$templates = $request->get('templates');
$allRecords = count($records);
$output = ['valid_records' => [], 'message' => vtranslate('LBL_VALID_RECORDS', $moduleName, 0, $allRecords)];
if (!empty($templates) && count($templates) > 0) {
foreach ($templates as $templateId) {
$templateRecord = Vtiger_PDF_Model::getInstanceById($templateId);
foreach ($records as $recordId) {
if (!$templateRecord->checkFiltersForRecord(intval($recordId))) {
if (($key = array_search($recordId, $records)) !== false) {
unset($records[$key]);
}
}
}
}
$selectedRecords = count($records);
$output = ['valid_records' => $records, 'message' => vtranslate('LBL_VALID_RECORDS', $moduleName, $selectedRecords, $allRecords)];
}
$response = new Vtiger_Response();
$response->setResult($output);
$response->emit();
}
示例2: process
public function process(Vtiger_Request $request)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$qualifiedModuleName = $request->getModule(false);
if (!$request->get("label") && !$request->get("block") || !$request->get("languages")) {
//Make JSON response
$response = new Vtiger_Response();
$response->setError('error-param', getTranslatedString("LBL_ERROR_PARAM", $moduleName));
$response->emit();
exit;
}
$languages = trim($request->get("languages"));
$a_languages = explode(",", $languages);
$a_block = $request->get("block");
//Repair bug with utf8 characters
if (!is_array($a_block)) {
$oldValue = Zend_Json::$useBuiltinEncoderDecoder;
Zend_Json::$useBuiltinEncoderDecoder = true;
$a_block = Zend_Json::decode($a_block);
Zend_Json::$useBuiltinEncoderDecoder = $oldValue;
foreach ($a_block as &$val) {
$val = utf8_encode($val);
}
}
$viewer->assign('MODULE', $moduleName);
$viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
$viewer->assign('LIST_PARENT_TABS', $a_parent_tabs);
$viewer->assign('LIST_MODULES', $a_modules);
$viewer->assign('LIST_MANIFEST_TEMPLATES', $a_manifest_templates);
$viewer->assign('LIST_DIR_TEMPLATES', $a_dir_templates);
$viewer->assign('a_block', $a_block);
$viewer->assign('a_languages', $a_languages);
echo $viewer->view('EditBlockPopup.tpl', $qualifiedModuleName, true);
}
示例3: process
public function process(Vtiger_Request $request)
{
$recordId = $request->get('record');
$qualifiedModuleName = $request->getModule(false);
if ($recordId) {
$recordModel = Settings_MailConverter_Record_Model::getInstanceById($recordId);
} else {
$recordModel = Settings_MailConverter_Record_Model::getCleanInstance();
}
$recordModel->set('scannerOldName', $request->get('scannerOldName'));
$fieldsList = $recordModel->getModule()->getFields();
foreach ($fieldsList as $fieldName => $fieldModel) {
$recordModel->set($fieldName, $request->get($fieldName));
}
$status = $recordModel->save();
$response = new Vtiger_Response();
if ($status) {
$result = array('message' => vtranslate('LBL_SAVED_SUCCESSFULLY', $qualifiedModuleName));
$result['id'] = $recordModel->getId();
$response->setResult($result);
} else {
$response->setError(vtranslate('LBL_CONNECTION_TO_MAILBOX_FAILED', $qualifiedModuleName));
}
$response->emit();
}
示例4: process
public function process(Vtiger_Request $request)
{
$recordId = $request->get('record');
$scannerId = $request->get('scannerId');
$action = $request->get('action1');
$request->set('action', $action);
$qualifiedModuleName = $request->getModule(false);
if ($recordId) {
$recordModel = Settings_MailConverter_RuleRecord_Model::getInstanceById($recordId);
} else {
$recordModel = Settings_MailConverter_RuleRecord_Model::getCleanInstance($scannerId);
}
$recordModel->assignedTo = $request->get('assignedTo');
$recordModel->cc = $request->get('cc');
$recordModel->bcc = $request->get('bcc');
$fieldsList = $recordModel->getFields();
foreach ($fieldsList as $fieldName) {
$recordModel->set($fieldName, $request->get($fieldName));
}
$recordModel->set('newAction', $request->get('action'));
$ruleId = $recordModel->save();
$response = new Vtiger_Response();
$response->setResult(array('message' => vtranslate('LBL_SAVED_SUCCESSFULLY', $qualifiedModuleName), 'id' => $ruleId, 'scannerId' => $scannerId));
$response->emit();
}
示例5: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
vimport('~~modules/' . $moduleName . '/' . $moduleName . '.php');
$bag = false;
$paymentsIn = $request->get('paymentsIn');
foreach ($paymentsIn as $fields) {
$ossPaymentsIn = new $moduleName();
$ossPaymentsIn->column_fields['paymentsname'] = 'Name';
$ossPaymentsIn->column_fields['paymentsvalue'] = $fields['amount'];
$ossPaymentsIn->column_fields['paymentscurrency'] = $fields['third_letter_currency_code'];
$ossPaymentsIn->column_fields['paymentstitle'] = $fields['details']['title'];
$ossPaymentsIn->column_fields['bank_account'] = $fields['details']['contAccount'];
$saved = $ossPaymentsIn->save('PaymentsIn');
if ($saved == false) {
$bag = true;
}
}
if ($bag) {
$result = array('success' => true, 'return' => vtranslate('MSG_SAVE_OK', $moduleName));
} else {
$result = array('success' => false, 'return' => vtranslate('MSG_SAVE_ERROR', $moduleName));
}
$response = new Vtiger_Response();
$response->setResult($result);
$response->emit();
}
示例6: process
function process(Vtiger_Request $request)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$moduleName = $request->getModule();
$componentName = $request->get('name');
$linkId = $request->get('linkid');
if (!empty($componentName)) {
$className = Vtiger_Loader::getComponentClassName('Dashboard', $componentName, $moduleName);
if (!empty($className)) {
$widget = NULL;
if (!empty($linkId)) {
$widget = new Vtiger_Widget_Model();
$widget->set('linkid', $linkId);
$widget->set('userid', $currentUser->getId());
$widget->set('filterid', $request->get('filterid', NULL));
if ($request->has('data')) {
$widget->set('data', $request->get('data'));
}
$widget->add();
}
$classInstance = new $className();
$classInstance->process($request, $widget);
return;
}
}
$response = new Vtiger_Response();
$response->setResult(array('success' => false, 'message' => vtranslate('NO_DATA')));
$response->emit();
}
示例7: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
if ($request->get('selected_ids') == 'all' && $request->get('mode') == 'FindDuplicates') {
$recordIds = Vtiger_FindDuplicate_Model::getMassDeleteRecords($request);
} else {
$recordIds = $this->getRecordsListFromRequest($request);
}
foreach ($recordIds as $recordId) {
if (Users_Privileges_Model::isPermitted($moduleName, 'Delete', $recordId)) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleModel);
$recordModel->delete();
} else {
$permission = 'No';
}
}
if ($permission === 'No') {
throw new AppException(vtranslate('LBL_PERMISSION_DENIED'));
}
$cvId = $request->get('viewname');
$response = new Vtiger_Response();
$response->setResult(array('viewname' => $cvId, 'module' => $moduleName));
$response->emit();
}
示例8: checkEnable
public function checkEnable(\Vtiger_Request $request)
{
$moduleModel = Vtiger_Module_Model::getCleanInstance($request->getModule());
$response = new Vtiger_Response();
$response->setResult($moduleModel->isActive());
$response->emit();
}
示例9: process
public function process(Vtiger_Request $request)
{
$db = PearDatabase::getInstance();
if ($request->get('file') == 'ShowModuleIdField') {
$html = ShowModuleIdField($request->get('selected_module'));
$response = new Vtiger_Response();
$response->setResult($html);
$response->emit();
} elseif ($request->get('file') == 'CheckForTemplates') {
include "modules/OSSPdf/CheckForTemplates_function.php";
$value = check();
$response = new Vtiger_Response();
$response->setResult($value);
$response->emit();
} elseif ($request->get('file') == 'PDFExport') {
include "modules/OSSPdf/PDFExport.php";
} else {
if ($request->get('mode') == 'Popup') {
$html = Popup($request);
$response = new Vtiger_Response();
$response->setResult($html);
$response->emit();
}
}
}
示例10: updateEvent
public function updateEvent(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$recordId = $request->get('id');
$date_start = date('Y-m-d', strtotime($request->get('start')));
$time_start = date('H:i:s', strtotime($request->get('start')));
$succes = false;
if (isPermitted($moduleName, 'EditView', $recordId) === 'no') {
$succes = false;
} else {
if (!empty($recordId)) {
try {
$delta = $request->get('delta');
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
$recordData = $recordModel->entity->column_fields;
$end = self::changeDateTime($recordData['due_date'] . ' ' . $recordData['time_end'], $delta);
$due_date = $end['date'];
$time_end = $end['time'];
$recordModel->set('id', $recordId);
$recordModel->set('mode', 'edit');
$recordModel->set('date_start', $date_start);
$recordModel->set('time_start', $time_start);
$recordModel->set('due_date', $due_date);
$recordModel->set('time_end', $time_end);
$recordModel->save();
$succes = true;
} catch (Exception $e) {
$succes = false;
}
}
}
$response = new Vtiger_Response();
$response->setResult($succes);
$response->emit();
}
示例11: process
public function process(Vtiger_Request $request)
{
$current_user = Users_Record_Model::getCurrentUserModel();
$RelatedBlock = new PDFMaker_RelatedBlock_Model();
$sec_module = $request->get('secmodule');
$pri_module = $request->get('primodule');
$mode = $request->get('mode');
$module_list = $RelatedBlock->getModuleList($sec_module);
$content = "";
if ($mode == "stdcriteria") {
$options = $RelatedBlock->getStdCriteriaByModule($sec_module, $module_list, $current_user);
if (count($options) > 0) {
foreach ($options as $value => $label) {
$content .= "<option value='" . $value . "'>" . $label . "</option>";
}
}
} else {
foreach ($module_list as $blockid => $optgroup) {
$options = $RelatedBlock->getColumnsListbyBlock($sec_module, $blockid, $pri_module, $current_user);
if (count($options) > 0) {
$content .= "<optgroup label='" . $optgroup . "'>";
foreach ($options as $value => $label) {
$content .= "<option value='" . $value . "'>" . $label . "</option>";
}
$content .= "</optgroup>";
}
}
}
$response = new Vtiger_Response();
$response->setResult($content);
$response->emit();
}
示例12: process
public function process(Vtiger_Request $request)
{
$recordId = $request->get('record');
$step = $request->get('step');
$moduleName = $request->get('module_name');
if ($recordId) {
$pdfModel = Vtiger_PDF_Model::getInstanceById($recordId, $moduleName);
} else {
$pdfModel = Settings_PDF_Record_Model::getCleanInstance($moduleName);
}
$stepFields = Settings_PDF_Module_Model::getFieldsByStep($step);
foreach ($stepFields as $field) {
$value = $request->get($field);
if (is_array($value)) {
$value = implode(',', $value);
}
if ($field === 'module_name' && $pdfModel->get('module_name') != $value) {
// change of main module, overwrite existing conditions
$pdfModel->deleteConditions();
}
$pdfModel->set($field, $value);
}
$pdfModel->set('conditions', $request->get('conditions'));
Settings_PDF_Record_Model::transformAdvanceFilterToWorkFlowFilter($pdfModel);
Settings_PDF_Record_Model::save($pdfModel, $step);
$response = new Vtiger_Response();
$response->setResult(['id' => $pdfModel->get('pdfid')]);
$response->emit();
}
示例13: updateUserModuleStep3
public function updateUserModuleStep3(Vtiger_Request $request)
{
$importModuleName = $request->get('module_import_name');
$uploadFile = $request->get('module_import_file');
$uploadDir = Settings_ModuleManager_Extension_Model::getUploadDirectory();
$uploadFileName = "{$uploadDir}/{$uploadFile}";
checkFileAccess($uploadFileName);
$importType = $request->get('module_import_type');
if (strtolower($importType) == 'language') {
$package = new Vtiger_Language();
} else {
$package = new Vtiger_Package();
}
if (strtolower($importType) == 'language') {
$package->import($uploadFileName);
} else {
$package->update(Vtiger_Module::getInstance($importModuleName), $uploadFileName);
}
checkFileAccessForDeletion($uploadFileName);
unlink($uploadFileName);
$result = array('success' => true, 'importModuleName' => $importModuleName);
$response = new Vtiger_Response();
$response->setResult($result);
$response->emit();
}
示例14: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$relatedLoad = $request->get('relatedLoad');
$data = '';
if ($relatedLoad) {
$postData = $request->get('postData');
$relatedModuleName = $request->get('relatedModuleName');
$selected_ids = json_decode($postData['selected_ids'], true);
$OSSMailModel = Vtiger_Record_Model::getCleanInstance('OSSMail');
$data = $OSSMailModel->getEmailsFromModule($selected_ids, $relatedModuleName);
} else {
$selectedFields = $request->get('selectedFields');
$selected_ids = $request->get('selected_ids');
foreach ($selected_ids as $key => $value) {
$recordModel = Vtiger_Record_Model::getInstanceById($value);
if ($data == '') {
$data = $recordModel->get($selectedFields[$key]);
} else {
$data .= ',' . $recordModel->get($selectedFields[$key]);
}
}
}
$result = array('success' => true, 'data' => $data);
$response = new Vtiger_Response();
$response->setResult($result);
$response->emit();
}
示例15: process
public function process(Vtiger_Request $request)
{
$recordModel = $this->saveRecord($request);
$fieldModelList = $recordModel->getModule()->getFields();
$result = array();
foreach ($fieldModelList as $fieldName => $fieldModel) {
$recordFieldValue = $recordModel->get($fieldName);
if (is_array($recordFieldValue) && $fieldModel->getFieldDataType() == 'multipicklist') {
$recordFieldValue = implode(' |##| ', $recordFieldValue);
}
if (is_array($recordFieldValue) && $fieldModel->getFieldDataType() == 'sharedOwner') {
$recordFieldValue = implode(',', $recordFieldValue);
}
$fieldValue = $displayValue = Vtiger_Util_Helper::toSafeHTML($recordFieldValue);
if ($fieldModel->getFieldDataType() !== 'currency' && $fieldModel->getFieldDataType() !== 'datetime' && $fieldModel->getFieldDataType() !== 'date') {
$displayValue = $fieldModel->getDisplayValue($fieldValue, $recordModel->getId());
}
$result[$fieldName] = array('value' => $fieldValue, 'display_value' => $displayValue);
}
//Handling salutation type
if ($request->get('field') === 'firstname' && in_array($request->getModule(), array('Contacts'))) {
$salutationType = $recordModel->getDisplayValue('salutationtype');
$firstNameDetails = $result['firstname'];
$firstNameDetails['display_value'] = $salutationType . " " . $firstNameDetails['display_value'];
if ($salutationType != '--None--') {
$result['firstname'] = $firstNameDetails;
}
}
$result['_recordLabel'] = $recordModel->getName();
$result['_recordId'] = $recordModel->getId();
$response = new Vtiger_Response();
$response->setEmitType(Vtiger_Response::$EMIT_JSON);
$response->setResult($result);
$response->emit();
}