本文整理汇总了PHP中Vtiger_Functions::textLength方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Functions::textLength方法的具体用法?PHP Vtiger_Functions::textLength怎么用?PHP Vtiger_Functions::textLength使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Functions
的用法示例。
在下文中一共展示了Vtiger_Functions::textLength方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDisplayValue
/**
* Function to get the display value in detail view
* @param <Integer> crmid of record
* @return <String>
*/
public function getDisplayValue($value, $record = false, $recordInstance = false, $rawText = false)
{
$referenceModule = $this->getReferenceModule($value);
if ($referenceModule && !empty($value)) {
$referenceModuleName = $referenceModule->get('name');
$entityNames = getEntityName($referenceModuleName, [$value]);
$name = Vtiger_Functions::textLength($entityNames[$value], vglobal('href_max_length'));
if ($rawText || $referenceModuleName == 'Users') {
return $name;
}
$linkValue = "<a class='moduleColor_{$referenceModuleName}' href='index.php?module={$referenceModuleName}&view=" . $referenceModule->getDetailViewName() . "&record={$value}' title='" . vtranslate($referenceModuleName, $referenceModuleName) . "'>{$name}</a>";
return $linkValue;
}
return '';
}
示例2: getListViewRecords
//.........这里部分代码省略.........
$value = round($filesize / 1024, 2) . ' KB';
} else {
if ($filesize > 1048576) {
$value = round($filesize / (1024 * 1024), 2) . ' MB';
}
}
} else {
$value = ' --';
}
} elseif ($module == 'Documents' && $fieldName == 'filestatus') {
if ($value == 1) {
$value = getTranslatedString('yes', $module);
} elseif ($value == 0) {
$value = getTranslatedString('no', $module);
} else {
$value = '--';
}
} elseif ($module == 'Documents' && $fieldName == 'filetype') {
$downloadType = $db->query_result($result, $i, 'filelocationtype');
if ($downloadType == 'E' || $downloadType != 'I') {
$value = '--';
}
} elseif ($module == 'OSSTimeControl' && $fieldName == 'sum_time') {
$value = Vtiger_Functions::decimalTimeFormat($value);
$value = $value['short'];
} elseif ($field->getUIType() == '27') {
if ($value == 'I') {
$value = getTranslatedString('LBL_INTERNAL', $module);
} elseif ($value == 'E') {
$value = getTranslatedString('LBL_EXTERNAL', $module);
} else {
$value = ' --';
}
$value = Vtiger_Functions::textLength($value);
} elseif ($field->getFieldDataType() == 'picklist') {
$value = Vtiger_Language_Handler::getTranslatedString($value, $module);
$value = textlength_check($value);
} elseif ($field->getFieldDataType() == 'date' || $field->getFieldDataType() == 'datetime') {
if ($value != '' && $value != '0000-00-00') {
$fieldDataType = $field->getFieldDataType();
if ($module == 'Calendar' && ($fieldName == 'date_start' || $fieldName == 'due_date')) {
if ($fieldName == 'date_start') {
$timeField = 'time_start';
} else {
if ($fieldName == 'due_date') {
$timeField = 'time_end';
}
}
$timeFieldValue = $this->db->query_result($result, $i, $timeField);
if (!empty($timeFieldValue)) {
$value .= ' ' . $timeFieldValue;
//TO make sure it takes time value as well
$fieldDataType = 'datetime';
}
}
if ($fieldDataType == 'datetime') {
$value = Vtiger_Datetime_UIType::getDateTimeValue($value);
} else {
if ($fieldDataType == 'date') {
$date = new DateTimeField($value);
$value = $date->getDisplayDate();
}
}
} elseif ($value == '0000-00-00') {
$value = '';
}
示例3: showEmailsList
public function showEmailsList($srecord, $smodule, $config, $type, $filter = 'All')
{
$return = [];
$adb = PearDatabase::getInstance();
$widgets = $this->modules_email_actions_widgets;
$queryParams = [];
if ($widgets[$smodule]) {
$ids = [];
$relatedID = [];
if ($filter == 'All' || $filter == 'Contacts') {
$result = $adb->pquery('SELECT vtiger_contactdetails.contactid FROM vtiger_contactdetails ' . 'INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_contactdetails.contactid ' . 'WHERE vtiger_contactdetails.parentid = ? AND vtiger_crmentity.deleted = ?', [$srecord, 0]);
while ($row = $adb->fetch_array($result)) {
$relatedID[] = $row['contactid'];
}
}
if ($filter != 'Contacts') {
$relatedID[] = $srecord;
}
$query = 'SELECT ossmailviewid FROM vtiger_ossmailview_relation WHERE crmid IN(' . implode(',', $relatedID) . ') AND `deleted` = ? ORDER BY `date` DESC';
if ($config['widget_limit'] != '') {
$query .= ' LIMIT ' . $config['widget_limit'];
}
$result = $adb->pquery($query, [0]);
while ($row = $adb->fetch_array($result)) {
$ids[] = $row['ossmailviewid'];
}
if (count($ids) == 0) {
return [];
}
$queryParams[] = $ids;
if ($type != 'All') {
$ifwhere = ' AND type = ?';
$queryParams[] = $type;
}
$query = 'SELECT vtiger_ossmailview.* FROM vtiger_ossmailview INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_ossmailview.ossmailviewid';
$query .= ' WHERE ossmailviewid IN (' . generateQuestionMarks($ids) . ')' . $ifwhere;
$currentUser = Users_Record_Model::getCurrentUserModel();
$moduleName = 'OSSMailView';
$instance = CRMEntity::getInstance($moduleName);
$securityParameter = $instance->getUserAccessConditionsQuerySR($moduleName, $currentUser);
if ($securityParameter != '') {
$query .= $securityParameter;
}
$query .= ' ORDER BY ossmailviewid DESC';
if ($config['widget_limit'] != '') {
$query .= ' LIMIT ' . $config['widget_limit'];
}
$result = $adb->pquery($query, $queryParams, true);
while ($row = $adb->fetch_array($result)) {
$from = $this->findRecordsById($row['from_id']);
$from = $from && $from != '' ? $from : $row['from_email'];
$to = $this->findRecordsById($row['to_id']);
$to = $to && $to != '' ? $to : $row['to_email'];
$content = Vtiger_Functions::removeHtmlTags(['link', 'style', 'a', 'img', 'script', 'base'], decode_html($row['content']));
$return[] = ['id' => $row['ossmailviewid'], 'date' => $row['date'], 'firstLetter' => strtoupper(Vtiger_Functions::textLength(trim(strip_tags($from)), 1, false)), 'subject' => '<a href="index.php?module=OSSMailView&view=preview&record=' . $row['ossmailviewid'] . '" target="' . $config['target'] . '"> ' . $row['subject'] . '</a>', 'attachments' => $row['attachments_exist'], 'from' => $from, 'to' => $to, 'url' => 'index.php?module=OSSMailView&view=preview&record=' . $row['ossmailviewid'], 'type' => $row['type'], 'teaser' => Vtiger_Functions::textLength(trim(preg_replace('/[ \\t]+/', ' ', strip_tags($content))), 100), 'body' => $content];
}
}
return $return;
}
示例4: getTreeEntries
public function getTreeEntries()
{
$db = PearDatabase::getInstance();
$recordId = $this->getParentRecordModel()->getId();
$relModuleId = $this->getRelatedModuleModel()->getId();
$relModuleName = $this->getRelatedModuleModel()->getName();
$treeViewModel = $this->getTreeViewModel();
$relationModel = $this->getRelationModel();
$fields = $treeViewModel->getTreeField();
$template = $treeViewModel->getTemplate();
$result = $db->pquery('SELECT tr.*,rel.crmid,rel.rel_created_time,rel.rel_created_user,rel.rel_comment FROM vtiger_trees_templates_data tr ' . 'INNER JOIN u_yf_crmentity_rel_tree rel ON rel.tree = tr.tree ' . 'WHERE tr.templateid = ? AND rel.crmid = ? AND rel.relmodule = ?', [$template, $recordId, $relModuleId]);
$trees = [];
while ($row = $db->getRow($result)) {
$treeID = $row['tree'];
$pieces = explode('::', $row['parenttrre']);
end($pieces);
$parent = prev($pieces);
$parentName = '';
if ($row['depth'] > 0) {
$result2 = $db->pquery('SELECT name FROM vtiger_trees_templates_data WHERE templateid = ? AND tree = ?', [$template, $parent]);
$parentName = $db->getSingleValue($result2);
$parentName = '(' . vtranslate($parentName, $relModuleName) . ') ';
}
$tree = ['id' => $treeID, 'name' => $parentName . vtranslate($row['name'], $relModuleName), 'parent' => $parent == 0 ? '#' : $parent];
if ($relationModel->showCreatorDetail()) {
$tree['relCreatedUser'] = getOwnerName($row['rel_created_user']);
$tree['relCreatedTime'] = Vtiger_Datetime_UIType::getDisplayDateTimeValue($row['rel_created_time']);
}
if ($relationModel->showComment()) {
if (strlen($row['rel_comment']) > AppConfig::relation('COMMENT_MAX_LENGTH')) {
$tree['relCommentFull'] = $row['rel_comment'];
}
$tree['relComment'] = Vtiger_Functions::textLength($row['rel_comment'], AppConfig::relation('COMMENT_MAX_LENGTH'));
}
if (!empty($row['icon'])) {
$tree['icon'] = $row['icon'];
}
$trees[] = $tree;
}
return $trees;
}