本文整理汇总了PHP中Vtiger_Response::emit方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Response::emit方法的具体用法?PHP Vtiger_Response::emit怎么用?PHP Vtiger_Response::emit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Response
的用法示例。
在下文中一共展示了Vtiger_Response::emit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$buttonsReturn = false;
$mode = $request->get('mode');
$formodule = $request->get('formodule');
$recordModel = Vtiger_Module_Model::getCleanInstance('OSSPdf');
if ($mode == 'create_buttons') {
$recordModel->add_links($formodule);
$buttonsReturn = true;
}
if ($mode == 'delete_buttons') {
$modCommentsModule = Vtiger_Module::getInstance($formodule);
$modCommentsModule->deleteLink('LISTVIEWSIDEBARWIDGET', 'Pdf');
$modCommentsModule->deleteLink('DETAILVIEWSIDEBARWIDGET', 'Pdf');
$modCommentsModule->deleteLink('DETAILVIEWBASIC', 'LBL_QUICK_GENERATE_MAIL');
// do ewentualnej poprawy
$modCommentsModule->deleteLink('DETAILVIEWBASIC', 'Generate default PDF');
$buttonsReturn = true;
}
if ($buttonsReturn === false) {
$result = array('success' => false, 'message' => vtranslate('Error', $moduleName));
} else {
$result = array('success' => true, 'message' => 'Ok');
}
$response = new Vtiger_Response();
$response->setResult($result);
$response->emit();
}
示例2: 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();
}
示例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: 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();
}
示例9: checkEnable
public function checkEnable(\Vtiger_Request $request)
{
$moduleModel = Vtiger_Module_Model::getCleanInstance($request->getModule());
$response = new Vtiger_Response();
$response->setResult($moduleModel->isActive());
$response->emit();
}
示例10: 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();
}
示例11: 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();
}
示例12: 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();
}
示例13: 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();
}
示例14: 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();
}
示例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();
}