本文整理汇总了PHP中Vtiger_Field_Model::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Field_Model::set方法的具体用法?PHP Vtiger_Field_Model::set怎么用?PHP Vtiger_Field_Model::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Field_Model
的用法示例。
在下文中一共展示了Vtiger_Field_Model::set方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getHeaders
public function getHeaders()
{
$headerFields = parent::getHeaders();
//Added to support List Price
$field = new Vtiger_Field_Model();
$field->set('name', 'listprice');
$field->set('column', 'listprice');
$field->set('label', 'List Price');
$headerFields['listprice'] = $field;
return $headerFields;
}
示例2: getCommentFieldsListForTasks
/**
* Function to get comment fields list which are useful in tasks
* @param <Vtiger_Module_Model> $moduleModel
* @return <Array> list of Field models <Vtiger_Field_Model>
*/
public static function getCommentFieldsListForTasks($moduleModel)
{
$commentsFieldsInfo = array('lastComment' => 'Last Comment', 'last5Comments' => 'Last 5 Comments', 'allComments' => 'All Comments');
$commentFieldModelsList = array();
foreach ($commentsFieldsInfo as $fieldName => $fieldLabel) {
$commentField = new Vtiger_Field_Model();
$commentField->setModule($moduleModel);
$commentField->set('name', $fieldName);
$commentField->set('label', $fieldLabel);
$commentFieldModelsList[$fieldName] = $commentField;
}
return $commentFieldModelsList;
}
示例3: getHeaders
public function getHeaders()
{
$relationModel = $this->getRelationModel();
$relatedModuleModel = $relationModel->getRelationModuleModel();
$headerFieldNames = $relatedModuleModel->getRelatedListFields();
$headerFields = array();
foreach ($headerFieldNames as $fieldName) {
$headerFields[$fieldName] = $relatedModuleModel->getField($fieldName);
}
//Added to support List Price
$field = new Vtiger_Field_Model();
$field->set('name', 'listprice');
$field->set('column', 'listprice');
$field->set('label', 'List Price');
array_push($headerFields, $field);
return $headerFields;
}
示例4: getHeaders
public function getHeaders()
{
$headerFields = parent::getHeaders();
if ($this->getRelationModel()->getRelationModuleModel()->getName() == 'PriceBooks') {
//Added to support Unit Price
$unitPriceField = new Vtiger_Field_Model();
$unitPriceField->set('name', 'unit_price');
$unitPriceField->set('column', 'unit_price');
$unitPriceField->set('label', 'Unit Price');
$headerFields['unit_price'] = $unitPriceField;
//Added to support List Price
$field = new Vtiger_Field_Model();
$field->set('name', 'listprice');
$field->set('column', 'listprice');
$field->set('label', 'List Price');
$headerFields['listprice'] = $field;
}
return $headerFields;
}
示例5: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer) {
$moduleName = $this->getModule($request);
$cvId = $request->get('cvid');
$pageNumber = $request->get('page');
$orderBy = $request->get('orderby');
$sortOrder = $request->get('sortorder');
$sourceModule = $request->get('src_module');
$sourceField = $request->get('src_field');
$sourceRecord = $request->get('src_record');
$searchKey = $request->get('search_key');
$searchValue = $request->get('search_value');
$currencyId = $request->get('currency_id');
//To handle special operation when selecting record from Popup
$getUrl = $request->get('get_url');
//Check whether the request is in multi select mode
$multiSelectMode = $request->get('multi_select');
if(empty($multiSelectMode)) {
$multiSelectMode = false;
}
if(empty($cvId)) {
$cvId = '0';
}
if(empty ($pageNumber)) {
$pageNumber = '1';
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
$listViewModel = Vtiger_ListView_Model::getInstanceForPopup($moduleName);
$recordStructureInstance = Vtiger_RecordStructure_Model::getInstanceForModule($moduleModel);
if(!empty($orderBy)) {
$listViewModel->set('orderby', $orderBy);
$listViewModel->set('sortorder', $sortOrder);
}
if(!empty($sourceModule)) {
$listViewModel->set('src_module', $sourceModule);
$listViewModel->set('src_field', $sourceField);
$listViewModel->set('src_record', $sourceRecord);
}
if((!empty($searchKey)) && (!empty($searchValue))) {
$listViewModel->set('search_key', $searchKey);
$listViewModel->set('search_value', $searchValue);
}
if(!empty($currencyId)) {
$listViewModel->set('currency_id', $currencyId);
}
if(!$this->listViewHeaders){
$this->listViewHeaders = $listViewModel->getListViewHeaders();
}
//Added to support List Price
$field = new Vtiger_Field_Model();
$field->set('name', 'listprice');
$field->set('column', 'listprice');
$field->set('label', 'List Price');
$this->listViewHeaders['listprice'] = $field;
if(!$this->listViewEntries){
$this->listViewEntries = $listViewModel->getListViewEntries($pagingModel);
}
foreach ($this->listViewEntries as $recordId => $recordModel) {
$recordModel->set('listprice', $recordModel->getProductsListPrice($sourceRecord));
}
$noOfEntries = count($this->listViewEntries);
if(empty($sortOrder)) {
$sortOrder = "ASC";
}
if($sortOrder == "ASC") {
$nextSortOrder = "DESC";
$sortImage = "downArrowSmall.png";
}else {
$nextSortOrder = "ASC";
$sortImage = "upArrowSmall.png";
}
$viewer->assign('MODULE', $moduleName);
$viewer->assign('SOURCE_MODULE', $sourceModule);
$viewer->assign('SOURCE_FIELD', $sourceField);
$viewer->assign('SOURCE_RECORD', $sourceRecord);
$viewer->assign('SEARCH_KEY', $searchKey);
$viewer->assign('SEARCH_VALUE', $searchValue);
$viewer->assign('ORDER_BY',$orderBy);
$viewer->assign('SORT_ORDER',$sortOrder);
$viewer->assign('NEXT_SORT_ORDER',$nextSortOrder);
$viewer->assign('SORT_IMAGE',$sortImage);
$viewer->assign('GETURL', $getUrl);
$viewer->assign('CURRENCY_ID', $currencyId);
//.........这里部分代码省略.........
示例6: getStructure
/**
* Function to get the values in stuctured format
* @return <array> - values in structure array('block'=>array(fieldinfo));
*/
public function getStructure()
{
if (!empty($this->structuredValues)) {
return $this->structuredValues;
}
$recordModel = $this->getWorkFlowModel();
$recordId = $recordModel->getId();
$values = array();
$baseModuleModel = $moduleModel = $this->getModule();
$blockModelList = $moduleModel->getBlocks();
//SalesPlatform.ru add Direct link field to Detail view of entity
$additionalFieldModel = new Vtiger_Field_Model();
$additionalFieldModel->set('workflow_columnname', 'spDetailViewLink')->set('workflow_columnlabel', vtranslate('LBL_DETAIL_VIEW_LINK', $moduleModel->getName()));
$values['SP_LINKS_BLOCK'] = array();
$values['SP_LINKS_BLOCK'][] = $additionalFieldModel;
//SalesPlatform.ru end
foreach ($blockModelList as $blockLabel => $blockModel) {
$fieldModelList = $blockModel->getFields();
if (!empty($fieldModelList)) {
$values[$blockLabel] = array();
foreach ($fieldModelList as $fieldName => $fieldModel) {
if ($fieldModel->isViewable()) {
if ($moduleModel->getName() == "Documents" && $fieldName == "filename") {
continue;
}
if (in_array($moduleModel->getName(), array('Calendar', 'Events')) && $fieldModel->getDisplayType() == 3) {
/* Restricting the following fields(Event module fields) for "Calendar" module
* time_start, time_end, eventstatus, activitytype, visibility, duration_hours,
* duration_minutes, reminder_time, recurringtype, notime
*/
continue;
}
if (!empty($recordId)) {
//Set the fieldModel with the valuetype for the client side.
$fieldValueType = $recordModel->getFieldFilterValueType($fieldName);
$fieldInfo = $fieldModel->getFieldInfo();
$fieldInfo['workflow_valuetype'] = $fieldValueType;
$fieldModel->setFieldInfo($fieldInfo);
}
switch ($fieldModel->getFieldDataType()) {
case 'date':
if ($moduleName === 'Events' && in_array($fieldName, array('date_start', 'due_date')) || $moduleName === 'Calendar' && $fieldName === 'date_start') {
$fieldName = $fieldName . ' ($(general : (__VtigerMeta__) usertimezone))';
} else {
$fieldName = $fieldName . ' ($_DATE_FORMAT_)';
}
break;
case 'datetime':
$fieldName = $fieldName . ' ($(general : (__VtigerMeta__) usertimezone))';
break;
default:
$fieldName;
}
// This will be used during editing task like email, sms etc
$fieldModel->set('workflow_columnname', $fieldName)->set('workflow_columnlabel', vtranslate($fieldModel->get('label'), $moduleModel->getName()));
// This is used to identify the field belongs to source module of workflow
$fieldModel->set('workflow_sourcemodule_field', true);
$values[$blockLabel][$fieldName] = clone $fieldModel;
}
}
}
}
if ($moduleModel->isCommentEnabled()) {
$commentFieldModelsList = Settings_Workflows_Field_Model::getCommentFieldsListForTasks($moduleModel);
$labelName = vtranslate($moduleModel->getSingularLabelKey(), $moduleModel->getName()) . ' ' . vtranslate('LBL_COMMENTS', $moduleModel->getName());
foreach ($commentFieldModelsList as $commentFieldName => $commentFieldModel) {
switch ($commentFieldModel->getFieldDataType()) {
case 'date':
$commentFieldName = $commentFieldName . ' ($_DATE_FORMAT_)';
break;
case 'datetime':
$commentFieldName = $commentFieldName . ' ($(general : (__VtigerMeta__) usertimezone)_)';
break;
default:
$commentFieldName;
}
$commentFieldModel->set('workflow_columnname', $commentFieldName)->set('workflow_columnlabel', vtranslate($commentFieldModel->get('label'), $moduleModel->getName()))->set('workflow_sourcemodule_field', true);
$values[$labelName][$commentFieldName] = $commentFieldModel;
}
}
//All the reference fields should also be sent
$fields = $moduleModel->getFieldsByType(array('reference', 'owner', 'multireference'));
foreach ($fields as $parentFieldName => $field) {
$type = $field->getFieldDataType();
$referenceModules = $field->getReferenceList();
if ($type == 'owner') {
$referenceModules = array('Users');
}
foreach ($referenceModules as $refModule) {
$moduleModel = Vtiger_Module_Model::getInstance($refModule);
$blockModelList = $moduleModel->getBlocks();
foreach ($blockModelList as $blockLabel => $blockModel) {
$fieldModelList = $blockModel->getFields();
if (!empty($fieldModelList)) {
foreach ($fieldModelList as $fieldName => $fieldModel) {
if ($fieldModel->isViewable()) {
//.........这里部分代码省略.........