本文整理汇总了PHP中Vtiger_Request类的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Request类的具体用法?PHP Vtiger_Request怎么用?PHP Vtiger_Request使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vtiger_Request类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: showLineItemDetails
/**
* Function returns Inventory Line Items
* @param Vtiger_Request $request
*/
function showLineItemDetails(Vtiger_Request $request)
{
$record = $request->get('record');
$moduleName = $request->getModule();
$recordModel = Inventory_Record_Model::getInstanceById($record);
$relatedProducts = $recordModel->getProducts();
//##Final details convertion started
$finalDetails = $relatedProducts[1]['final_details'];
//Final shipping tax details convertion ended
$currencyFieldsList = array('grandTotal');
foreach ($currencyFieldsList as $fieldName) {
$finalDetails[$fieldName] = Vtiger_Currency_UIType::transformDisplayValue($finalDetails[$fieldName], null, true);
}
$relatedProducts[1]['final_details'] = $finalDetails;
//##Final details convertion ended
//##Product details convertion started
$productsCount = count($relatedProducts);
for ($i = 1; $i <= $productsCount; $i++) {
$product = $relatedProducts[$i];
$currencyFieldsList = array('listPrice', 'unitPrice', 'productTotal');
foreach ($currencyFieldsList as $fieldName) {
$product[$fieldName . $i] = Vtiger_Currency_UIType::transformDisplayValue($product[$fieldName . $i], null, true);
}
$relatedProducts[$i] = $product;
}
//##Product details convertion ended
$viewer = $this->getViewer($request);
$viewer->assign('RELATED_PRODUCTS', $relatedProducts);
$viewer->assign('RECORD', $recordModel);
$viewer->assign('MODULE_NAME', $moduleName);
$viewer->view('LineItemsDetail.tpl', $moduleName);
}
示例2: requestForgotPassword
public function requestForgotPassword($request)
{
$request = new Vtiger_Request($request);
$adb = PearDatabase::getInstance();
$username = vtlib_purify($request->get('user_name'));
$result = $adb->pquery('select id,email1 from vtiger_users where user_name = ? ', array($username));
if ($adb->num_rows($result) > 0) {
$email = $adb->query_result($result, 0, 'email1');
}
if (strcasecmp($request->get('emailId'), $email) === 0) {
$userId = $adb->query_result($result, 0, 'id');
$time = time();
$options = array('handler_path' => 'modules/Users/handlers/ForgotPassword.php', 'handler_class' => 'Users_ForgotPassword_Handler', 'handler_function' => 'changePassword', 'handler_data' => array('username' => $username, 'email' => $email, 'time' => $time, 'hash' => md5($username . $time)));
$trackURL = Vtiger_ShortURL_Helper::generateURL($options);
$data = ['sysname' => 'UsersForgotPassword', 'to_email' => $email, 'module' => 'Users', 'record' => $userId, 'trackURL' => $trackURL];
$recordModel = Vtiger_Record_Model::getCleanInstance('OSSMailTemplates');
$status = $recordModel->sendMailFromTemplate($data);
$site_URL = vglobal('site_URL') . 'index.php?modules=Users&view=Login';
if ($status === 1) {
header('Location: ' . $site_URL . '&status=1');
} else {
header('Location: ' . $site_URL . '&statusError=1');
}
} else {
$site_URL = vglobal('site_URL') . 'index.php?modules=Users&view=Login';
header('Location: ' . $site_URL . '&fpError=1');
}
}
示例3: process
public function process(Vtiger_Request $request)
{
$recordId = $request->get('record');
$qualifiedModuleName = $request->getModule(false);
$mode = '';
$selectedFieldsList = $allFieldsList = array();
if ($recordId) {
$recordModel = Settings_Webforms_Record_Model::getInstanceById($recordId, $qualifiedModuleName);
$selectedFieldsList = $recordModel->getSelectedFieldsList();
$allFieldsList = $recordModel->getAllFieldsList();
$sourceModule = $recordModel->get('targetmodule');
$mode = 'edit';
} else {
$recordModel = Settings_Webforms_Record_Model::getCleanInstance($qualifiedModuleName);
$sourceModule = $request->get('sourceModule');
if (!$sourceModule) {
$sourceModule = reset(array_keys(Settings_Webforms_Module_Model::getSupportedModulesList()));
}
$allFieldsList = $recordModel->getAllFieldsList($sourceModule);
}
$recordStructure = Vtiger_RecordStructure_Model::getInstanceFromRecordModel($recordModel, Vtiger_RecordStructure_Model::RECORD_STRUCTURE_MODE_EDIT);
$viewer = $this->getViewer($request);
$viewer->assign('MODE', $mode);
$viewer->assign('RECORD_ID', $recordId);
$viewer->assign('RECORD_MODEL', $recordModel);
$viewer->assign('MODULE', $qualifiedModuleName);
$viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
$viewer->assign('SOURCE_MODULE', $sourceModule);
$viewer->assign('ALL_FIELD_MODELS_LIST', $allFieldsList);
$viewer->assign('SELECTED_FIELD_MODELS_LIST', $selectedFieldsList);
$viewer->assign('RECORD_STRUCTURE_MODEL', $recordStructure);
$viewer->assign('RECORD_STRUCTURE', $recordStructure->getStructure());
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->view('EditView.tpl', $qualifiedModuleName);
}
示例4: 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();
}
示例5: process
function process(Vtiger_Request $request)
{
$mode = $request->getMode();
if (!empty($mode) && method_exists($this, $mode)) {
$this->{$mode}($request);
}
}
示例6: GetCSV
/**
* Function exports report in a CSV file
* @param Vtiger_Request $request
*/
function GetCSV(Vtiger_Request $request)
{
$recordId = $request->get('record');
$reportModel = Reports_Record_Model::getInstanceById($recordId);
$reportModel->set('advancedFilter', $request->get('advanced_filter'));
$reportModel->getReportCSV();
}
示例7: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$recordId = $request->get('record');
$currencyName = $request->get('currency');
if (!empty($recordId)) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
$priceDetails = $recordModel->getPriceDetails();
} else {
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$priceDetails = $recordModel->getPriceDetails();
foreach ($priceDetails as $key => $currencyDetails) {
if ($currencyDetails['curname'] === $currencyName) {
$baseCurrencyConversionRate = $currencyDetails['conversionrate'];
break;
}
}
foreach ($priceDetails as $key => $currencyDetails) {
if ($currencyDetails['curname'] === $currencyName) {
$currencyDetails['conversionrate'] = 1;
$currencyDetails['is_basecurrency'] = 1;
} else {
$currencyDetails['conversionrate'] = $currencyDetails['conversionrate'] / $baseCurrencyConversionRate;
$currencyDetails['is_basecurrency'] = 0;
}
$priceDetails[$key] = $currencyDetails;
}
}
$viewer = $this->getViewer($request);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('PRICE_DETAILS', $priceDetails);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->view('MoreCurrenciesList.tpl', 'Products');
}
示例8: 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();
}
示例9: process
function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$records = $request->get('records');
$primaryRecord = $request->get('primaryRecord');
$primaryRecordModel = Vtiger_Record_Model::getInstanceById($primaryRecord, $moduleName);
$fields = $moduleModel->getFields();
foreach ($fields as $field) {
$fieldValue = $request->get($field->getName());
if ($field->isEditable()) {
$primaryRecordModel->set($field->getName(), $fieldValue);
}
}
$primaryRecordModel->set('mode', 'edit');
$primaryRecordModel->save();
$deleteRecords = array_diff($records, array($primaryRecord));
foreach ($deleteRecords as $deleteRecord) {
$recordPermission = Users_Privileges_Model::isPermitted($moduleName, 'Delete', $deleteRecord);
if ($recordPermission) {
$primaryRecordModel->transferRelationInfoOfRecords(array($deleteRecord));
$record = Vtiger_Record_Model::getInstanceById($deleteRecord);
$record->delete();
}
}
$response = new Vtiger_Response();
$response->setResult(true);
$response->emit();
}
示例10: showAccountsList
public function showAccountsList(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$selected = $request->get('selected');
$sourceModule = $request->get('selectedModule');
$filter = $request->get('selectedFilter');
$records = [];
if (empty($selected)) {
return;
}
$multiReferenceFirld = Vtiger_MultiReferenceValue_UIType::getFieldsByModules($moduleName, $sourceModule);
if (count($multiReferenceFirld) === 0) {
return;
}
$multiReferenceFirld = reset($multiReferenceFirld);
//var_dump($multiReferenceFirld);
$searchParams = [['columns' => [['columnname' => $multiReferenceFirld['tablename'] . ':' . $multiReferenceFirld['columnname'] . ':' . $multiReferenceFirld['fieldname'], 'value' => implode(',', $selected), 'column_condition' => '', 'comparator' => 'c']]]];
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('limit', 'no_limit');
$listViewModel = Vtiger_ListView_Model::getInstance('Accounts', $filter);
$listViewModel->set('search_key', $multiReferenceFirld['fieldname']);
$listViewModel->set('search_params', $searchParams);
$listEntries = $listViewModel->getListViewEntries($pagingModel, true);
if (count($listEntries) === 0) {
return;
}
$listHeaders = $listViewModel->getListViewHeaders();
$viewer = $this->getViewer($request);
$viewer->assign('ENTRIES', $listEntries);
$viewer->assign('HEADERS', $listHeaders);
$viewer->assign('MODULE', $moduleName);
$viewer->view('AccountsList.tpl', $moduleName);
}
示例11: process
public function process(Vtiger_Request $request)
{
${"GLOBALS"}["zuvbgco"] = "url";
${${"GLOBALS"}["nvqrslc"]} = PearDatabase::getInstance();
${${"GLOBALS"}["ivimgqkchpe"]} = new Vtiger_Response();
${${"GLOBALS"}["zuvbgco"]} = $request->get("url");
try {
if (!filter_var(${${"GLOBALS"}["vwlgxcvjvn"]}, FILTER_VALIDATE_URL)) {
throw new Exception("URL is not valid");
}
${"GLOBALS"}["rwirxck"] = "needLicense";
$eneasgio = "content";
${$eneasgio} = VtUtils::getContentFromUrl(${${"GLOBALS"}["vwlgxcvjvn"]});
try {
${"GLOBALS"}["bykxupaxtecx"] = "root";
${${"GLOBALS"}["bykxupaxtecx"]} = new SimpleXMLElement(${${"GLOBALS"}["jpkdykvrxcnm"]});
} catch (Exception $exp) {
throw new Exception("no task repository");
}
if (empty($root->title)) {
throw new Exception("no task repository (title missing)");
}
${${"GLOBALS"}["jjgsblrkloz"]} = (string) $root->needLicense == "1";
$response->setResult(array("success" => true, "title" => (string) $root->title, "license" => ${${"GLOBALS"}["rwirxck"]}));
} catch (Exception $exp) {
$response->setResult(array("success" => false, "error" => $exp->getMessage()));
}
$response->emit();
}
示例12: getScripts
/**
* Function to get the list of Script models to be included
* @param Vtiger_Request $request
* @return <Array> - List of Vtiger_JsScript_Model instances
*/
function getScripts(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$jsFileNames = array("modules.{$moduleName}.resources.ActivityStateModal");
$jsScriptInstances = $this->checkAndConvertJsScripts($jsFileNames);
return $jsScriptInstances;
}
示例13: process
public function process(Vtiger_Request $request)
{
$recordId = $request->get('record');
$qualifiedModuleName = $request->getModule(false);
$mode = '';
$enabled = 0;
$views = array();
$viewer = $this->getViewer($request);
$moduleModel = Settings_Vtiger_Module_Model::getInstance($qualifiedModuleName);
if ($recordId) {
$mode = 'edit';
$recordModel = Settings_HideBlocks_Record_Model::getInstanceById($recordId, $qualifiedModuleName);
$enabled = $recordModel->get('enabled');
if ($recordModel->get('view') != '') {
$views = explode(',', $recordModel->get('view'));
}
$viewer->assign('BLOCK_ID', $recordModel->get('blockid'));
}
$viewer->assign('MODE', $mode);
$viewer->assign('RECORD_ID', $recordId);
$viewer->assign('ENABLED', $enabled);
$viewer->assign('SELECTED_VIEWS', $views);
$viewer->assign('MODULE', 'HideBlocks');
$viewer->assign('QUALIFIED_MODULE', $qualifiedModuleName);
$viewer->assign('BLOCKS', $moduleModel->getAllBlock());
$viewer->assign('VIEWS', $moduleModel->getViews());
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->view('EditView.tpl', $qualifiedModuleName);
}
示例14: getRecordModelFromRequest
/**
* Function to get the record model based on the request parameters
* @param Vtiger_Request $request
* @return Vtiger_Record_Model or Module specific Record Model instance
*/
public function getRecordModelFromRequest(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$recordId = $request->get('record');
if (!empty($recordId)) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
$recordModel->set('id', $recordId);
$recordModel->set('mode', 'edit');
$fieldModelList = $recordModel->getModule()->getFields();
foreach ($fieldModelList as $fieldName => $fieldModel) {
//For not converting craetedtime and modified time to user format
$uiType = $fieldModel->get('uitype');
if ($uiType == 70) {
$fieldValue = $recordModel->get($fieldName);
} elseif (in_array($uiType, [71, 72])) {
// currency ui types
$fieldValue = $recordModel->get($fieldName);
} else {
$fieldValue = $fieldModel->getUITypeModel()->getUserRequestValue($recordModel->get($fieldName), $recordId);
}
if ($fieldName === $request->get('field')) {
$fieldValue = $request->get('value');
}
$fieldDataType = $fieldModel->getFieldDataType();
if ($fieldDataType == 'time') {
$fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
}
if ($fieldValue !== null) {
if (!is_array($fieldValue)) {
$fieldValue = trim($fieldValue);
}
$recordModel->set($fieldName, $fieldValue);
}
$recordModel->set($fieldName, $fieldValue);
}
} else {
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$recordModel->set('mode', '');
$fieldModelList = $moduleModel->getFields();
foreach ($fieldModelList as $fieldName => $fieldModel) {
if ($request->has($fieldName)) {
$fieldValue = $request->get($fieldName, null);
} else {
$fieldValue = $fieldModel->getDefaultFieldValue();
}
$fieldDataType = $fieldModel->getFieldDataType();
if ($fieldDataType == 'time') {
$fieldValue = Vtiger_Time_UIType::getTimeValueWithSeconds($fieldValue);
}
if ($fieldValue !== null) {
if (!is_array($fieldValue)) {
$fieldValue = trim($fieldValue);
}
$recordModel->set($fieldName, $fieldValue);
}
}
}
return $recordModel;
}
示例15: checkPermission
function checkPermission(Vtiger_Request $request)
{
$moduleName = $request->getModule();
if (!Users_Privileges_Model::isPermitted($moduleName, $actionName)) {
throw new AppException(vtranslate('LBL_PERMISSION_DENIED'));
}
}