本文整理汇总了PHP中VTEventsManager::setHandlerActive方法的典型用法代码示例。如果您正苦于以下问题:PHP VTEventsManager::setHandlerActive方法的具体用法?PHP VTEventsManager::setHandlerActive怎么用?PHP VTEventsManager::setHandlerActive使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VTEventsManager
的用法示例。
在下文中一共展示了VTEventsManager::setHandlerActive方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSettingsBlockId
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type
*/
function vtlib_handler($moduleName, $eventType)
{
require_once 'include/utils/utils.php';
global $adb;
if ($eventType == 'module.postinstall') {
$fieldid = $adb->getUniqueID('vtiger_settings_field');
$blockid = getSettingsBlockId('LBL_MODULE_MANAGER');
$seq_res = $adb->query("SELECT max(sequence) AS max_seq FROM vtiger_settings_field");
$seq = 1;
if ($adb->num_rows($seq_res) > 0) {
$cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
if ($cur_seq != null) {
$seq = $cur_seq + 1;
}
}
$adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence)
VALUES (?,?,?,?,?,?,?)', array($fieldid, $blockid, 'LBL_FIELDFORMULAS', 'modules/FieldFormulas/resources/FieldFormulas.png', 'LBL_FIELDFORMULAS_DESCRIPTION', 'index.php?module=FieldFormulas&action=index&parenttab=Settings', $seq));
$tabid = getTabid('FieldFormulas');
if (isset($tabid) && $tabid != '') {
$adb->pquery('DELETE FROM vtiger_profile2tab WHERE tabid = ?', array($tabid));
}
// Mark the module as Standard module
$adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($moduleName));
} else {
if ($eventType == 'module.disabled') {
$em = new VTEventsManager($adb);
$em->setHandlerInActive('VTFieldFormulasEventHandler');
} else {
if ($eventType == 'module.enabled') {
$em = new VTEventsManager($adb);
$em->setHandlerActive('VTFieldFormulasEventHandler');
} else {
if ($eventType == 'module.preuninstall') {
// TODO Handle actions when this module is about to be deleted.
} else {
if ($eventType == 'module.preupdate') {
// TODO Handle actions before this module is updated.
} else {
if ($eventType == 'module.postupdate') {
// TODO Handle actions after this module is updated.
}
}
}
}
}
}
}
示例2: array
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type
*/
function vtlib_handler($moduleName, $eventType)
{
global $adb, $currentModule;
$modtrackerModule = Vtiger_Module::getInstance($currentModule);
$otherModuleNames = $this->getModTrackerEnabledModules();
if ($eventType == 'module.postinstall') {
$adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($moduleName));
$fieldid = $adb->getUniqueID('vtiger_settings_field');
$blockid = getSettingsBlockId('LBL_OTHER_SETTINGS');
$seq_res = $adb->pquery("SELECT max(sequence) AS max_seq FROM vtiger_settings_field WHERE blockid = ?", array($blockid));
if ($adb->num_rows($seq_res) > 0) {
$cur_seq = $adb->query_result($seq_res, 0, 'max_seq');
if ($cur_seq != null) {
$seq = $cur_seq + 1;
}
}
$adb->pquery('INSERT INTO vtiger_settings_field(fieldid, blockid, name, iconpath, description, linkto, sequence)
VALUES (?,?,?,?,?,?,?)', array($fieldid, $blockid, 'ModTracker', 'set-IcoLoginHistory.gif', 'LBL_MODTRACKER_DESCRIPTION', 'index.php?module=ModTracker&action=BasicSettings&parenttab=Settings&formodule=ModTracker', $seq));
} else {
if ($eventType == 'module.disabled') {
$em = new VTEventsManager($adb);
$em->setHandlerInActive('ModTrackerHandler');
// De-register Common Javascript
$modtrackerModule->deleteLink('HEADERSCRIPT', 'ModTrackerCommon_JS');
} else {
if ($eventType == 'module.enabled') {
$em = new VTEventsManager($adb);
$em->setHandlerActive('ModTrackerHandler');
// Register Common Javascript
$modtrackerModule->addLink('HEADERSCRIPT', 'ModTrackerCommon_JS', 'modules/ModTracker/ModTrackerCommon.js');
} else {
if ($eventType == 'module.preuninstall') {
// TODO Handle actions when this module is about to be deleted.
} else {
if ($eventType == 'module.preupdate') {
// TODO Handle actions before this module is updated.
} else {
if ($eventType == 'module.postupdate') {
// TODO Handle actions after this module is updated.
}
}
}
}
}
}
}
示例3: array
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type (module.postinstall, module.disabled, module.enabled, module.preuninstall)
*/
function vtlib_handler($moduleName, $eventType)
{
require_once 'include/utils/utils.php';
global $adb;
if ($eventType == 'module.postinstall') {
require_once 'vtlib/Vtiger/Module.php';
$this->setModuleSeqNumber('configure', $modulename, 'srvcto-', '0000001');
$moduleInstance = Vtiger_Module::getInstance($moduleName);
$accModuleInstance = Vtiger_Module::getInstance('Accounts');
$accModuleInstance->setRelatedList($moduleInstance, 'Service Contracts', array('add'), 'get_dependents_list');
$conModuleInstance = Vtiger_Module::getInstance('Contacts');
$conModuleInstance->setRelatedList($moduleInstance, 'Service Contracts', array('add'), 'get_dependents_list');
$helpDeskInstance = Vtiger_Module::getInstance("HelpDesk");
$helpDeskInstance->setRelatedList($moduleInstance, "Service Contracts", array('ADD', 'SELECT'));
// Initialize module sequence for the module
$adb->pquery("INSERT into vtiger_modentity_num values(?,?,?,?,?,?)", array($adb->getUniqueId("vtiger_modentity_num"), $moduleName, 'SERCON', 1, 1, 1));
// Make the picklist value 'Complete' for status as non-editable
$adb->query("UPDATE vtiger_contract_status SET presence=0 WHERE contract_status='Complete'");
// Mark the module as Standard module
$adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($moduleName));
} else {
if ($eventType == 'module.disabled') {
$em = new VTEventsManager($adb);
$em->setHandlerInActive('ServiceContractsHandler');
} else {
if ($eventType == 'module.enabled') {
$em = new VTEventsManager($adb);
$em->setHandlerActive('ServiceContractsHandler');
} else {
if ($eventType == 'module.preuninstall') {
// TODO Handle actions when this module is about to be deleted.
} else {
if ($eventType == 'module.preupdate') {
// TODO Handle actions before this module is updated.
} else {
if ($eventType == 'module.postupdate') {
// TODO Handle actions after this module is updated.
}
}
}
}
}
}
}
示例4: VTEventsManager
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type
*/
function vtlib_handler($moduleName, $eventType)
{
require_once 'include/utils/utils.php';
require_once 'include/events/include.inc';
$adb = PearDatabase::getInstance();
$registerLink = false;
$addModTracker = false;
$handlerClass = 'SECURE';
if ($eventType == 'module.postinstall') {
} else {
if ($eventType == 'module.disabled') {
// TODO Handle actions when this module is disabled.
$registerLink = false;
$em = new VTEventsManager($adb);
$em->setHandlerInActive($handlerClass);
} else {
if ($eventType == 'module.enabled') {
// TODO Handle actions when this module is enabled.
$registerLink = true;
$em = new VTEventsManager($adb);
$em->setHandlerActive($handlerClass);
} else {
if ($eventType == 'module.preuninstall') {
// TODO Handle actions when this module is about to be deleted.
$this->log->debug('Before starting uninstall script...');
require_once 'modules/Settings/' . $moduleName . '/views/uninstall.php';
$this->log->debug('After uninstall script.');
header('Location: index.php?module=Vtiger&parent=Settings&view=Index');
} else {
if ($eventType == 'module.preupdate') {
// TODO Handle actions before this module is updated.
} else {
if ($eventType == 'module.postupdate') {
}
}
}
}
}
}
$displayLabel = 'OSSPassword Configuration';
if ($registerLink) {
$blockid = $adb->query_result($adb->pquery("SELECT blockid FROM vtiger_settings_blocks WHERE label='LBL_OTHER_SETTINGS'", array()), 0, 'blockid');
$sequence = (int) $adb->query_result($adb->pquery("SELECT max(sequence) as sequence FROM vtiger_settings_field WHERE blockid=?", array($blockid)), 0, 'sequence') + 1;
$fieldid = $adb->getUniqueId('vtiger_settings_field');
$adb->pquery("INSERT INTO vtiger_settings_field (fieldid,blockid,sequence,name,iconpath,description,linkto)\n\t\t\t\tVALUES (?,?,?,?,?,?,?)", array($fieldid, $blockid, $sequence, $displayLabel, 'migrate.gif', 'LBL_OSSPASSWORD_CONFIGURATION_DESCRIPTION', 'index.php?module=OSSPasswords&view=ConfigurePass&parent=Settings'));
} else {
$adb->pquery("DELETE FROM vtiger_settings_field WHERE name=?", array($displayLabel));
}
// register modtracker history updates
if ($addModTracker) {
$tabId = getTabid($moduleName);
include_once 'modules/ModTracker/ModTracker.php';
$moduleModTrackerInstance = new ModTracker();
if (!$moduleModTrackerInstance->isModulePresent($tabId)) {
$res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabId, 1));
$moduleModTrackerInstance->updateCache($tabId, 1);
} else {
$updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabId));
$moduleModTrackerInstance->updateCache($tabId, 1);
}
if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabId)) {
$moduleInstance = Vtiger_Module::getInstance($tabId);
$moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted'));
}
}
}
示例5: values
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type
*/
function vtlib_handler($moduleName, $eventType)
{
require_once 'include/utils/utils.php';
require_once 'include/events/include.inc';
$adb = PearDatabase::getInstance();
$registerLink = false;
$addModTracker = false;
$handlerClass = 'SECURE';
if ($eventType == 'module.postinstall') {
//Add OSSPasswords Module to Customer Portal
require_once 'vtlib/Vtiger/Module.php';
// add default oss_passwords configuration
$adb->pquery("INSERT INTO vtiger_passwords_config values(?,?,?,?)", array('10', '15', 'a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,W,X,Y,Z,0,1,2,3,4,5,6,7,8,9', '0'));
// adds record prefix
$myCustomEntity = new CRMEntity();
$myCustomPrefix = "PASS";
// Your custom prefix string for the custom module
$sequenceStart = 1;
// The starting sequence number
$myCustomEntity->setModuleSeqNumber("configure", $moduleName, $myCustomPrefix, $sequenceStart);
$registerLink = true;
$addModTracker = true;
// handler for obscuring password data in "update history"
$em = new VTEventsManager($adb);
$em->registerHandler('vtiger.entity.aftersave.final', 'modules/OSSPasswords/handlers/secure.php', $handlerClass);
// Module icon
copy('modules/OSSPasswords/OSSPasswords.png', 'layouts/vlayout/skins/images/OSSPasswords.png');
// block export of module
$sql = "UPDATE vtiger_tab SET customized=0 WHERE name='{$moduleName}' LIMIT 1;";
$adb->query($sql, true);
} else {
if ($eventType == 'module.disabled') {
// TODO Handle actions when this module is disabled.
$registerLink = false;
$em = new VTEventsManager($adb);
$em->setHandlerInActive($handlerClass);
} else {
if ($eventType == 'module.enabled') {
// TODO Handle actions when this module is enabled.
$registerLink = true;
$em = new VTEventsManager($adb);
$em->setHandlerActive($handlerClass);
} else {
if ($eventType == 'module.preuninstall') {
// TODO Handle actions when this module is about to be deleted.
$this->log->debug('Before starting uninstall script...');
require_once 'modules/Settings/' . $moduleName . '/views/uninstall.php';
$this->log->debug('After uninstall script.');
header('Location: index.php?module=Vtiger&parent=Settings&view=Index');
} else {
if ($eventType == 'module.preupdate') {
// TODO Handle actions before this module is updated.
} else {
if ($eventType == 'module.postupdate') {
}
}
}
}
}
}
$displayLabel = 'OSSPassword Configuration';
if ($registerLink) {
$blockid = $adb->query_result($adb->pquery("SELECT blockid FROM vtiger_settings_blocks WHERE label='LBL_OTHER_SETTINGS'", array()), 0, 'blockid');
$sequence = (int) $adb->query_result($adb->pquery("SELECT max(sequence) as sequence FROM vtiger_settings_field WHERE blockid=?", array($blockid)), 0, 'sequence') + 1;
$fieldid = $adb->getUniqueId('vtiger_settings_field');
$adb->pquery("INSERT INTO vtiger_settings_field (fieldid,blockid,sequence,name,iconpath,description,linkto)\n\t\t\t\tVALUES (?,?,?,?,?,?,?)", array($fieldid, $blockid, $sequence, $displayLabel, 'migrate.gif', 'LBL_OSSPASSWORD_CONFIGURATION_DESCRIPTION', 'index.php?module=OSSPasswords&view=ConfigurePass&parent=Settings'));
} else {
$adb->pquery("DELETE FROM vtiger_settings_field WHERE name=?", array($displayLabel));
}
// register modtracker history updates
if ($addModTracker) {
$tabId = getTabid($moduleName);
include_once 'modules/ModTracker/ModTracker.php';
$moduleModTrackerInstance = new ModTracker();
if (!$moduleModTrackerInstance->isModulePresent($tabId)) {
$res = $adb->pquery("INSERT INTO vtiger_modtracker_tabs VALUES(?,?)", array($tabId, 1));
$moduleModTrackerInstance->updateCache($tabId, 1);
} else {
$updatevisibility = $adb->pquery("UPDATE vtiger_modtracker_tabs SET visible = 1 WHERE tabid = ?", array($tabId));
$moduleModTrackerInstance->updateCache($tabId, 1);
}
if (!$moduleModTrackerInstance->isModTrackerLinkPresent($tabId)) {
$moduleInstance = Vtiger_Module::getInstance($tabId);
$moduleInstance->addLink('DETAILVIEWBASIC', 'View History', "javascript:ModTrackerCommon.showhistory('\$RECORD\$')", '', '', array('path' => 'modules/ModTracker/ModTracker.php', 'class' => 'ModTracker', 'method' => 'isViewPermitted'));
}
}
}
示例6: getTabid
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type
*/
function vtlib_handler($moduleName, $eventType)
{
require_once 'include/utils/utils.php';
global $adb;
$tabid = getTabid("Users");
if ($eventType == 'module.postinstall') {
// Add a block and 2 fields for Users module
$blockid = $adb->getUniqueID('vtiger_blocks');
$adb->query("insert into vtiger_blocks(blockid,tabid,blocklabel,sequence,show_title,visible,create_view,edit_view,detail_view,display_status)" . " values ({$blockid},{$tabid},'Asterisk Configuration',6,0,0,0,0,0,1)");
$adb->query("insert into vtiger_field(tabid,fieldid,columnname,tablename,generatedtype,uitype,fieldname,fieldlabel,readonly," . " presence,defaultvalue,maximumlength,sequence,block,displaytype,typeofdata,quickcreate,quickcreatesequence,info_type) " . " values ({$tabid}," . $adb->getUniqueID('vtiger_field') . ",'asterisk_extension','vtiger_asteriskextensions',1,1,'asterisk_extension'," . " 'Asterisk Extension',1,0,0,30,1,{$blockid},1,'V~O',1,NULL,'BAS')");
$adb->query("insert into vtiger_field(tabid,fieldid,columnname,tablename,generatedtype,uitype,fieldname,fieldlabel,readonly," . " presence,defaultvalue,maximumlength,sequence,block,displaytype,typeofdata,quickcreate,quickcreatesequence,info_type) " . " values ({$tabid}," . $adb->getUniqueID('vtiger_field') . ",'use_asterisk','vtiger_asteriskextensions',1,56,'use_asterisk'," . "' Receive Incoming Calls',1,0,0,30,2,{$blockid},1,'C~O',1,NULL,'BAS')");
// Mark the module as Standard module
$adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($moduleName));
} else {
if ($eventType == 'module.disabled') {
// TODO Handle actions when this module is disabled.
$em = new VTEventsManager($adb);
$em->setHandlerInActive('PBXManagerAfterSaveCreateActivity');
} else {
if ($eventType == 'module.enabled') {
// TODO Handle actions when this module is enabled.
$em = new VTEventsManager($adb);
$em->setHandlerActive('PBXManagerAfterSaveCreateActivity');
} else {
if ($eventType == 'module.preuninstall') {
// TODO Handle actions when this module is about to be deleted.
} else {
if ($eventType == 'module.preupdate') {
// TODO Handle actions before this module is updated.
} else {
if ($eventType == 'module.postupdate') {
// TODO Handle actions after this module is updated.
}
}
}
}
}
}
}