本文整理汇总了PHP中Vtiger_Request::setGlobal方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Request::setGlobal方法的具体用法?PHP Vtiger_Request::setGlobal怎么用?PHP Vtiger_Request::setGlobal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Request
的用法示例。
在下文中一共展示了Vtiger_Request::setGlobal方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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
*/
protected function getRecordModelFromRequest(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$recordId = $request->get('record');
if (!empty($recordId)) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleName);
$modelData = $recordModel->getData();
$recordModel->set('id', $recordId);
$sharedType = $request->get('sharedtype');
if (!empty($sharedType)) {
$recordModel->set('calendarsharedtype', $request->get('sharedtype'));
}
$recordModel->set('mode', 'edit');
} else {
$recordModel = Vtiger_Record_Model::getCleanInstance($moduleName);
$modelData = $recordModel->getData();
$recordModel->set('mode', '');
}
foreach ($modelData as $fieldName => $value) {
$requestFieldExists = $request->has($fieldName);
if (!$requestFieldExists) {
continue;
}
$fieldValue = $request->get($fieldName, null);
if ($fieldName === 'is_admin' && !$fieldValue) {
$fieldValue = 'off';
}
if ($fieldValue !== null) {
if (!is_array($fieldValue)) {
$fieldValue = trim($fieldValue);
}
$recordModel->set($fieldName, $fieldValue);
}
}
$homePageComponents = $recordModel->getHomePageComponents();
$selectedHomePageComponents = $request->get('homepage_components', array());
foreach ($homePageComponents as $key => $value) {
if (in_array($key, $selectedHomePageComponents)) {
$request->setGlobal($key, $key);
} else {
$request->setGlobal($key, '');
}
}
// Tag cloud save
$tagCloud = $request->get('tagcloudview');
if ($tagCloud == "on") {
$recordModel->set('tagcloud', 0);
} else {
$recordModel->set('tagcloud', 1);
}
return $recordModel;
}