本文整理汇总了PHP中QueryGenerator::getModule方法的典型用法代码示例。如果您正苦于以下问题:PHP QueryGenerator::getModule方法的具体用法?PHP QueryGenerator::getModule怎么用?PHP QueryGenerator::getModule使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QueryGenerator
的用法示例。
在下文中一共展示了QueryGenerator::getModule方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAdvancedSearchOptionString
public function getAdvancedSearchOptionString()
{
$module = $this->queryGenerator->getModule();
$meta = $this->queryGenerator->getMeta($module);
$moduleFields = $meta->getModuleFields();
$i = 0;
foreach ($moduleFields as $fieldName => $field) {
if ($field->getFieldDataType() == 'reference') {
$typeOfData = 'V';
} else {
if ($field->getFieldDataType() == 'boolean') {
$typeOfData = 'C';
} else {
$typeOfData = $field->getTypeOfData();
$typeOfData = explode("~", $typeOfData);
$typeOfData = $typeOfData[0];
}
}
$label = getTranslatedString($field->getFieldLabelKey(), $module);
if (empty($label)) {
$label = $field->getFieldLabelKey();
}
if ($label == "Start Date & Time") {
$fieldlabel = "Start Date";
}
$selected = '';
if ($i++ == 0) {
$selected = "selected";
}
$OPTION_SET .= "<option value=\\'{$fieldName}::::{$typeOfData}\\' {$selected}>{$label}</option>";
}
return $OPTION_SET;
}
示例2: getAdvancedSearchOptionString
public function getAdvancedSearchOptionString()
{
$module = $this->queryGenerator->getModule();
$meta = $this->queryGenerator->getMeta($module);
$moduleFields = $meta->getModuleFields();
$i = 0;
foreach ($moduleFields as $fieldName => $field) {
if ($field->getFieldDataType() == 'reference') {
$typeOfData = 'V';
} else {
if ($field->getFieldDataType() == 'boolean') {
$typeOfData = 'C';
} else {
$typeOfData = $field->getTypeOfData();
$typeOfData = explode("~", $typeOfData);
$typeOfData = $typeOfData[0];
}
}
$label = getTranslatedString($field->getFieldLabelKey(), $module);
$label = str_replace(array("\n", "\r"), '', $label);
if (empty($label)) {
$label = $field->getFieldLabelKey();
}
if ($label == "Start Date & Time") {
$fieldlabel = "Start Date";
}
$selected = '';
if ($i++ == 0) {
$selected = "selected";
}
// place option in array for sorting later
//$blockName = getTranslatedString(getBlockName($field->getBlockId()), $module);
$blockName = getTranslatedString($field->getBlockName(), $module);
$fieldLabelEscaped = str_replace(" ", "_", $field->getFieldLabelKey());
$optionvalue = $field->getTableName() . ":" . $field->getColumnName() . ":" . $fieldName . ":" . $module . "_" . $fieldLabelEscaped . ":" . $typeOfData;
$OPTION_SET[$blockName][$label] = "<option value=\\'{$optionvalue}\\' {$selected}>{$label}</option>";
}
// sort array on block label
ksort($OPTION_SET, SORT_STRING);
$shtml = '';
foreach ($OPTION_SET as $key => $value) {
$shtml .= "<optgroup label='{$key}' class='select' style='border:none'>";
// sort array on field labels
ksort($value, SORT_STRING);
$shtml .= implode('', $value);
}
return $shtml;
}
示例3: getListViewRecords
function getListViewRecords($focus, $module, $result)
{
global $listview_max_textlength, $theme, $default_charset;
require 'user_privileges/user_privileges_' . $this->user->id . '.php';
$fields = $this->queryGenerator->getFields();
$meta = $this->queryGenerator->getMeta($this->queryGenerator->getModule());
$moduleFields = $this->queryGenerator->getModuleFields();
$accessibleFieldList = array_keys($moduleFields);
$listViewFields = array_intersect($fields, $accessibleFieldList);
$referenceFieldList = $this->queryGenerator->getReferenceFieldList();
foreach ($referenceFieldList as $fieldName) {
if (in_array($fieldName, $listViewFields)) {
$field = $moduleFields[$fieldName];
$this->fetchNameList($field, $result);
}
}
$db = PearDatabase::getInstance();
$rowCount = $db->num_rows($result);
$ownerFieldList = $this->queryGenerator->getOwnerFieldList();
foreach ($ownerFieldList as $fieldName) {
if (in_array($fieldName, $listViewFields)) {
$field = $moduleFields[$fieldName];
$idList = array();
for ($i = 0; $i < $rowCount; $i++) {
$id = $this->db->query_result($result, $i, $field->getColumnName());
if (!isset($this->ownerNameList[$fieldName][$id])) {
$idList[] = $id;
}
}
if (count($idList) > 0) {
if (!is_array($this->ownerNameList[$fieldName])) {
$this->ownerNameList[$fieldName] = getOwnerNameList($idList);
} else {
//array_merge API loses key information so need to merge the arrays
// manually.
$newOwnerList = getOwnerNameList($idList);
foreach ($newOwnerList as $id => $name) {
$this->ownerNameList[$fieldName][$id] = $name;
}
}
}
}
}
foreach ($listViewFields as $fieldName) {
$field = $moduleFields[$fieldName];
if (!$is_admin && ($field->getFieldDataType() == 'picklist' || $field->getFieldDataType() == 'multipicklist')) {
$this->setupAccessiblePicklistValueList($fieldName);
}
}
$useAsterisk = get_use_asterisk($this->user->id);
$data = array();
for ($i = 0; $i < $rowCount; ++$i) {
//Getting the recordId
if ($module != 'Users') {
$baseTable = $meta->getEntityBaseTable();
$moduleTableIndexList = $meta->getEntityTableIndexList();
$baseTableIndex = $moduleTableIndexList[$baseTable];
$recordId = $db->query_result($result, $i, $baseTableIndex);
} else {
$recordId = $db->query_result($result, $i, "id");
}
$row = array();
foreach ($listViewFields as $fieldName) {
$field = $moduleFields[$fieldName];
$uitype = $field->getUIType();
$rawValue = $this->db->query_result($result, $i, $field->getColumnName());
if (in_array($uitype, array(15, 33, 16))) {
$value = html_entity_decode($rawValue, ENT_QUOTES, $default_charset);
} else {
$value = $rawValue;
}
if ($module == 'Documents' && $fieldName == 'filename') {
$downloadtype = $db->query_result($result, $i, 'filelocationtype');
$fileName = $db->query_result($result, $i, 'filename');
$downloadType = $db->query_result($result, $i, 'filelocationtype');
$status = $db->query_result($result, $i, 'filestatus');
$fileIdQuery = "select attachmentsid from vtiger_seattachmentsrel where crmid=?";
$fileIdRes = $db->pquery($fileIdQuery, array($recordId));
$fileId = $db->query_result($fileIdRes, 0, 'attachmentsid');
if ($fileName != '' && $status == 1) {
if ($downloadType == 'I') {
$value = '<a onclick="Javascript:Documents_Index_Js.updateDownloadCount(\'index.php?module=Documents&action=UpdateDownloadCount&record=' . $recordId . '\');"' . ' href="index.php?module=Documents&action=DownloadFile&record=' . $recordId . '&fileid=' . $fileId . '"' . ' title="' . getTranslatedString('LBL_DOWNLOAD_FILE', $module) . '" >' . textlength_check($value) . '</a>';
} elseif ($downloadType == 'E') {
$value = '<a onclick="Javascript:Documents_Index_Js.updateDownloadCount(\'index.php?module=Documents&action=UpdateDownloadCount&record=' . $recordId . '\');"' . ' href="' . $fileName . '" target="_blank"' . ' title="' . getTranslatedString('LBL_DOWNLOAD_FILE', $module) . '" >' . textlength_check($value) . '</a>';
} else {
$value = ' --';
}
}
$value = $fileicon . $value;
} elseif ($module == 'Documents' && $fieldName == 'filesize') {
$downloadType = $db->query_result($result, $i, 'filelocationtype');
if ($downloadType == 'I') {
$filesize = $value;
if ($filesize < 1024) {
$value = $filesize . ' B';
} elseif ($filesize > 1024 && $filesize < 1048576) {
$value = round($filesize / 1024, 2) . ' KB';
} else {
if ($filesize > 1048576) {
$value = round($filesize / (1024 * 1024), 2) . ' MB';
//.........这里部分代码省略.........
示例4: getListViewRecords
function getListViewRecords($focus, $module, $result)
{
global $listview_max_textlength, $theme, $default_charset;
require 'user_privileges/user_privileges_' . $this->user->id . '.php';
$fields = $this->queryGenerator->getFields();
$meta = $this->queryGenerator->getMeta($this->queryGenerator->getModule());
$moduleFields = $meta->getModuleFields();
$accessibleFieldList = array_keys($moduleFields);
$listViewFields = array_intersect($fields, $accessibleFieldList);
$referenceFieldList = $this->queryGenerator->getReferenceFieldList();
foreach ($referenceFieldList as $fieldName) {
if (in_array($fieldName, $listViewFields)) {
$field = $moduleFields[$fieldName];
$this->fetchNameList($field, $result);
}
}
$db = PearDatabase::getInstance();
$rowCount = $db->num_rows($result);
$ownerFieldList = $this->queryGenerator->getOwnerFieldList();
foreach ($ownerFieldList as $fieldName) {
if (in_array($fieldName, $listViewFields)) {
$field = $moduleFields[$fieldName];
$idList = array();
for ($i = 0; $i < $rowCount; $i++) {
$id = $this->db->query_result($result, $i, $field->getColumnName());
if (!isset($this->ownerNameList[$fieldName][$id])) {
$idList[] = $id;
}
}
if (count($idList) > 0) {
if (!is_array($this->ownerNameList[$fieldName])) {
$this->ownerNameList[$fieldName] = getOwnerNameList($idList);
} else {
//array_merge API loses key information so need to merge the arrays
// manually.
$newOwnerList = getOwnerNameList($idList);
foreach ($newOwnerList as $id => $name) {
$this->ownerNameList[$fieldName][$id] = $name;
}
}
}
}
}
foreach ($listViewFields as $fieldName) {
$field = $moduleFields[$fieldName];
if (!$is_admin && ($field->getFieldDataType() == 'picklist' || $field->getFieldDataType() == 'multipicklist')) {
$this->setupAccessiblePicklistValueList($fieldName);
}
}
$useAsterisk = get_use_asterisk($this->user->id);
$data = array();
for ($i = 0; $i < $rowCount; ++$i) {
//Getting the recordId
if ($module != 'Users') {
$baseTable = $meta->getEntityBaseTable();
$moduleTableIndexList = $meta->getEntityTableIndexList();
$baseTableIndex = $moduleTableIndexList[$baseTable];
$recordId = $db->query_result($result, $i, $baseTableIndex);
} else {
$recordId = $db->query_result($result, $i, "id");
}
$row = array();
foreach ($listViewFields as $fieldName) {
$field = $moduleFields[$fieldName];
$uitype = $field->getUIType();
$rawValue = $this->db->query_result($result, $i, $field->getColumnName());
if ($uitype != 8) {
$value = html_entity_decode($rawValue, ENT_QUOTES, $default_charset);
} else {
$value = $rawValue;
}
if ($module == 'Documents' && $fieldName == 'filename') {
$downloadtype = $db->query_result($result, $i, 'filelocationtype');
$fileName = $db->query_result($result, $i, 'filename');
$downloadType = $db->query_result($result, $i, 'filelocationtype');
$status = $db->query_result($result, $i, 'filestatus');
$fileIdQuery = "select attachmentsid from vtiger_seattachmentsrel where crmid=?";
$fileIdRes = $db->pquery($fileIdQuery, array($recordId));
$fileId = $db->query_result($fileIdRes, 0, 'attachmentsid');
if ($fileName != '' && $status == 1) {
if ($downloadType == 'I') {
$value = '<a onclick="Javascript:Documents_Index_Js.updateDownloadCount(\'index.php?module=Documents&action=UpdateDownloadCount&record=' . $recordId . '\');"' . ' href="index.php?module=Documents&action=DownloadFile&record=' . $recordId . '&fileid=' . $fileId . '"' . ' title="' . getTranslatedString('LBL_DOWNLOAD_FILE', $module) . '" >' . textlength_check($value) . '</a>';
} elseif ($downloadType == 'E') {
$value = '<a onclick="Javascript:Documents_Index_Js.updateDownloadCount(\'index.php?module=Documents&action=UpdateDownloadCount&record=' . $recordId . '\');"' . ' href="' . $fileName . '" target="_blank"' . ' title="' . getTranslatedString('LBL_DOWNLOAD_FILE', $module) . '" >' . textlength_check($value) . '</a>';
} else {
$value = ' --';
}
}
$value = $fileicon . $value;
} elseif ($module == 'Documents' && $fieldName == 'filesize') {
$downloadType = $db->query_result($result, $i, 'filelocationtype');
if ($downloadType == 'I') {
$filesize = $value;
if ($filesize < 1024) {
$value = $filesize . ' B';
} elseif ($filesize > 1024 && $filesize < 1048576) {
$value = round($filesize / 1024, 2) . ' KB';
} else {
if ($filesize > 1048576) {
$value = round($filesize / (1024 * 1024), 2) . ' MB';
//.........这里部分代码省略.........