本文整理汇总了PHP中ModTracker::unLinkRelation方法的典型用法代码示例。如果您正苦于以下问题:PHP ModTracker::unLinkRelation方法的具体用法?PHP ModTracker::unLinkRelation怎么用?PHP ModTracker::unLinkRelation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModTracker
的用法示例。
在下文中一共展示了ModTracker::unLinkRelation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: trackUnLinkedInfo
/**
* Function to track when a record is unlinked to a given record
*/
function trackUnLinkedInfo($module, $crmid, $with_module, $with_crmid)
{
global $current_user;
$adb = PearDatabase::getInstance();
$currentTime = date('Y-m-d H:i:s');
$adb->pquery('UPDATE vtiger_crmentity SET modifiedtime = ?, modifiedby = ? WHERE crmid = ?', array($currentTime, $current_user->id, $crmid));
// @Note: We should extend this to event handlers
if (vtlib_isModuleActive('ModTracker')) {
//Track the time the relation was deleted
require_once 'modules/ModTracker/ModTracker.php';
ModTracker::unLinkRelation($module, $crmid, $with_module, $with_crmid);
}
}
示例2: handleEvent
function handleEvent($eventName, $data)
{
$adb = PearDatabase::getInstance();
$current_user = vglobal('current_user');
$log = vglobal('log');
$current_module = vglobal('current_module');
if (!is_object($data)) {
$extendedData = $data;
$data = $extendedData['entityData'];
}
$moduleName = $data->getModuleName();
$flag = ModTracker::isTrackingEnabledForModule($moduleName);
if ($flag) {
if ($eventName == 'vtiger.entity.aftersave.final') {
$recordId = $data->getId();
$columnFields = $data->getData();
$vtEntityDelta = new VTEntityDelta();
$delta = $vtEntityDelta->getEntityDelta($moduleName, $recordId, true);
$newerEntity = $vtEntityDelta->getNewEntity($moduleName, $recordId);
$newerColumnFields = $newerEntity->getData();
$newerColumnFields = array_change_key_case($newerColumnFields, CASE_LOWER);
$delta = array_change_key_case($delta, CASE_LOWER);
if (is_array($delta)) {
$inserted = false;
foreach ($delta as $fieldName => $values) {
if ($fieldName != 'modifiedtime') {
if (!$inserted) {
$checkRecordPresentResult = $adb->pquery('SELECT * FROM vtiger_modtracker_basic WHERE crmid = ?', array($recordId));
if (!$adb->num_rows($checkRecordPresentResult) && $data->isNew()) {
$status = ModTracker::$CREATED;
} else {
$status = ModTracker::$UPDATED;
}
$this->id = $adb->getUniqueId('vtiger_modtracker_basic');
$adb->insert('vtiger_modtracker_basic', ['id' => $this->id, 'crmid' => $recordId, 'module' => $moduleName, 'whodid' => $current_user->id, 'changedon' => $newerColumnFields['modifiedtime'], 'status' => $status, 'whodidsu' => Vtiger_Session::get('baseUserId')]);
$inserted = true;
}
$adb->pquery('INSERT INTO vtiger_modtracker_detail(id,fieldname,prevalue,postvalue) VALUES(?,?,?,?)', array($this->id, $fieldName, $values['oldValue'], $values['currentValue']));
}
}
}
$isMyRecord = $adb->pquery('SELECT crmid FROM vtiger_crmentity WHERE smownerid <> ? AND crmid = ?', array($current_user->id, $recordId));
if ($adb->num_rows($isMyRecord) > 0) {
$adb->pquery("UPDATE vtiger_crmentity SET was_read = 0 WHERE crmid = ?;", array($recordId));
}
}
if ($eventName == 'vtiger.entity.beforedelete') {
$recordId = $data->getId();
$columnFields = $data->getData();
$id = $adb->getUniqueId('vtiger_modtracker_basic');
$adb->insert('vtiger_modtracker_basic', ['id' => $id, 'crmid' => $recordId, 'module' => $moduleName, 'whodid' => $current_user->id, 'changedon' => date('Y-m-d H:i:s', time()), 'status' => ModTracker::$DELETED, 'whodidsu' => Vtiger_Session::get('baseUserId')]);
$isMyRecord = $adb->pquery('SELECT crmid FROM vtiger_crmentity WHERE smownerid <> ? AND crmid = ?', array($current_user->id, $recordId));
if ($adb->num_rows($isMyRecord) > 0) {
$adb->pquery("UPDATE vtiger_crmentity SET was_read = 0 WHERE crmid = ?;", array($recordId));
}
}
if ($eventName == 'vtiger.entity.afterrestore') {
$recordId = $data->getId();
$columnFields = $data->getData();
$id = $adb->getUniqueId('vtiger_modtracker_basic');
$adb->insert('vtiger_modtracker_basic', ['id' => $id, 'crmid' => $recordId, 'module' => $moduleName, 'whodid' => $current_user->id, 'changedon' => date('Y-m-d H:i:s', time()), 'status' => ModTracker::$RESTORED, 'whodidsu' => Vtiger_Session::get('baseUserId')]);
$isMyRecord = $adb->pquery('SELECT crmid FROM vtiger_crmentity WHERE smownerid <> ? AND crmid = ?', array($current_user->id, $recordId));
if ($adb->num_rows($isMyRecord) > 0) {
$adb->pquery("UPDATE vtiger_crmentity SET was_read = 0 WHERE crmid = ?;", array($recordId));
}
}
if ($eventName == 'vtiger.entity.link.after') {
ModTracker::linkRelation($extendedData['sourceModule'], $extendedData['sourceRecordId'], $extendedData['destinationModule'], $extendedData['destinationRecordId']);
}
if ($eventName == 'vtiger.entity.unlink.after') {
ModTracker::unLinkRelation($extendedData['sourceModule'], $extendedData['sourceRecordId'], $extendedData['destinationModule'], $extendedData['destinationRecordId']);
}
}
}