本文整理汇总了PHP中Vtiger_Relation_Model::getReferenceTableInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Relation_Model::getReferenceTableInfo方法的具体用法?PHP Vtiger_Relation_Model::getReferenceTableInfo怎么用?PHP Vtiger_Relation_Model::getReferenceTableInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Relation_Model
的用法示例。
在下文中一共展示了Vtiger_Relation_Model::getReferenceTableInfo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setRelatedList
/**
* Set related list information between other module
* @param Vtiger_Module Instance of target module with which relation should be setup
* @param String Label to display in related list (default is target module name)
* @param Array List of action button to show ('ADD', 'SELECT')
* @param String Callback function name of this module to use as handler
*
* @internal Creates table vtiger_crmentityrel if it does not exists
*/
function setRelatedList($moduleInstance, $label = '', $actions = false, $functionName = 'get_related_list')
{
$adb = PearDatabase::getInstance();
if (empty($moduleInstance)) {
return;
}
if (empty($label)) {
$label = $moduleInstance->name;
}
$result = $adb->pquery('SELECT relation_id FROM vtiger_relatedlists WHERE tabid=? AND related_tabid = ? AND name = ? AND label = ?;', [$this->id, $moduleInstance->id, $functionName, $label]);
if ($result->rowCount() > 0) {
self::log("Setting relation with {$moduleInstance->name} [{$useactions_text}] ... Error, the related module already exists");
return;
}
$sequence = $this->__getNextRelatedListSequence();
$presence = 0;
// 0 - Enabled, 1 - Disabled
// Allow ADD action of other module records (default)
if ($actions === false) {
$actions = ['ADD'];
}
$useactionsText = $actions;
if (is_array($actions)) {
$useactionsText = implode(',', $actions);
}
$useactionsText = strtoupper($useactionsText);
$adb->insert('vtiger_relatedlists', ['relation_id' => $adb->getUniqueID('vtiger_relatedlists'), 'tabid' => $this->id, 'related_tabid' => $moduleInstance->id, 'name' => $functionName, 'sequence' => $sequence, 'label' => $label, 'presence' => $presence, 'actions' => $useactionsText]);
if ($functionName == 'get_many_to_many') {
$refTableName = Vtiger_Relation_Model::getReferenceTableInfo($moduleInstance->name, $this->name);
if (!Vtiger_Utils::CheckTable($refTableName['table'])) {
Vtiger_Utils::CreateTable($refTableName['table'], '(crmid INT(19) ,relcrmid INT(19),KEY crmid (crmid),KEY relcrmid (relcrmid))', true);
}
}
self::log("Setting relation with {$moduleInstance->name} [{$useactions_text}] ... DONE");
}
示例2: getRelationQueryM2M
public function getRelationQueryM2M($recordId, $relatedModule, $relationModel)
{
$referenceInfo = Vtiger_Relation_Model::getReferenceTableInfo($this->getName(), $relatedModule->getName());
$basetable = $relatedModule->get('basetable');
$query = 'SELECT vtiger_crmentity.*, ' . $basetable . '.*' . ' FROM ' . $basetable;
$query .= ' INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = ' . $basetable . '.' . $relatedModule->get('basetableid');
$query .= ' INNER JOIN ' . $referenceInfo['table'] . ' ON ' . $referenceInfo['table'] . '.' . $referenceInfo['base'] . ' = vtiger_crmentity.crmid';
$query .= ' LEFT JOIN vtiger_users ON vtiger_users.id = vtiger_crmentity.smownerid';
$query .= ' LEFT JOIN vtiger_groups ON vtiger_groups.groupid = vtiger_crmentity.smownerid';
$query .= ' WHERE vtiger_crmentity.deleted = 0 AND ' . $referenceInfo['table'] . '.' . $referenceInfo['rel'] . ' = ' . $recordId;
return $query;
}