本文整理汇总了PHP中Vtiger_Module::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Module::getInstance方法的具体用法?PHP Vtiger_Module::getInstance怎么用?PHP Vtiger_Module::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vtiger_Module
的用法示例。
在下文中一共展示了Vtiger_Module::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
global $adb;
$modname = 'SalesOrder';
$module = Vtiger_Module::getInstance($modname);
$field = Vtiger_Field::getInstance('recurring_frequency', $module);
if ($field) {
$field->setPicklistValues(array('2years', '3years', '4years', '5years'));
$this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=7 WHERE recurring_frequency='2years'");
$this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=8 WHERE recurring_frequency='3years'");
$this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=9 WHERE recurring_frequency='4years'");
$this->ExecuteQuery("UPDATE vtiger_recurring_frequency SET sortorderid=10 WHERE recurring_frequency='5years'");
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例2: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
$moduleInstance = Vtiger_Module::getInstance('Users');
$block = Vtiger_Block::getInstance('LBL_MORE_INFORMATION', $moduleInstance);
$field = Vtiger_Field::getInstance('send_email_to_sender', $moduleInstance);
if ($field) {
$this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
} else {
$user_field = new Vtiger_Field();
$user_field->name = 'send_email_to_sender';
$user_field->label = 'LBL_SEND_EMAIL_TO_SENDER';
$user_field->table = 'vtiger_users';
$user_field->column = 'send_email_to_sender';
$user_field->columntype = 'varchar(3)';
$user_field->typeofdata = 'C~O';
$user_field->uitype = '56';
$user_field->masseditable = '0';
$block->addField($user_field);
$this->ExecuteQuery("update vtiger_users set send_email_to_sender='1'");
RecalculateSharingRules();
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例3: vtlib_handler
/**
* Invoked when special actions are performed on the module.
* @param String Module name
* @param String Event Type
*/
function vtlib_handler($moduleName, $eventType)
{
$adb = PearDatabase::getInstance();
if ($eventType == 'module.postinstall') {
include_once 'vtlib/Vtiger/Module.php';
$moduleInstance = CRMEntity::getInstance('HolidaysEntitlement');
$moduleInstance->setModuleSeqNumber("configure", 'HolidaysEntitlement', 'HE', '1');
$adb->pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array('HolidaysEntitlement'));
$moduleInstance = Vtiger_Module::getInstance('HolidaysEntitlement');
$targetModule = Vtiger_Module::getInstance('OSSEmployees');
$targetModule->setRelatedList($moduleInstance, 'HolidaysEntitlement', array('ADD'), 'get_dependents_list');
} else {
if ($eventType == 'module.disabled') {
// TODO Handle actions before this module is being uninstalled.
} 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: vtlib_handler
function vtlib_handler($modulename, $event_type)
{
if ($event_type == 'module.postinstall') {
} else {
if ($event_type == 'module.disabled') {
$moduleInstance = Vtiger_Module::getInstance($modulename);
$moduleInstance->deleteLink('HEADERSCRIPT', 'Chat', 'layouts/vlayout/modules/AJAXChat/Chat.js');
// TODO Handle actions when this module is disabled.
return;
} else {
if ($event_type == 'module.enabled') {
$moduleInstance = Vtiger_Module::getInstance($modulename);
$moduleInstance->addLink('HEADERSCRIPT', 'Chat', 'layouts/vlayout/modules/AJAXChat/Chat.js');
// TODO Handle actions when this module is enabled.
return;
} else {
if ($event_type == 'module.preuninstall') {
// TODO Handle actions when this module is about to be deleted.
return;
} else {
if ($event_type == 'module.preupdate') {
// TODO Handle actions before this module is updated.
return;
} else {
if ($event_type == 'module.postupdate') {
}
}
}
}
}
}
}
示例5: applyChange
function applyChange()
{
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset assignto_mailscanner already applied!');
} else {
$mod_hd = Vtiger_Module::getInstance('HelpDesk');
$block_hd = Vtiger_Block::getInstance('LBL_TICKET_INFORMATION', $mod_hd);
$field1 = new Vtiger_Field();
$field1->name = 'from_mailscanner';
$field1->label = 'From mailscanner';
$field1->column = 'from_mailscanner';
$field1->columntype = 'VARCHAR(3)';
$field1->sequence = 1;
$field1->uitype = 56;
$field1->typeofdata = 'C~O';
$field1->displaytype = 3;
$field1->presence = 0;
$field1->readonly = 1;
$block_hd->addField($field1);
$this->ExecuteQuery('ALTER TABLE vtiger_mailscanner_rules ADD assign_to INT(11)');
$this->sendMsg('Changeset assignto_mailscanner applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例6: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
$moduleInstance = Vtiger_Module::getInstance('Users');
$block = Vtiger_Block::getInstance('LBL_USER_ADV_OPTIONS', $moduleInstance);
$field = Vtiger_Field::getInstance('failed_login_attempts', $moduleInstance);
if ($field) {
$this->ExecuteQuery('update vtiger_field set presence=2 where fieldid=' . $field->id);
} else {
$user_field = new Vtiger_Field();
$user_field->name = 'failed_login_attempts';
$user_field->label = 'LBL_FAILED_LOGIN_ATTEMPTS';
$user_field->table = 'vtiger_users';
$user_field->column = 'failed_login_attempts';
$user_field->columntype = 'int(11)';
$user_field->typeofdata = 'I~O';
$user_field->uitype = '7';
$user_field->masseditable = '0';
$block->addField($user_field);
$this->ExecuteQuery('update vtiger_users set failed_login_attempts=0');
RecalculateSharingRules();
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例7: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$buttonsReturn = false;
$mode = $request->get('mode');
$formodule = $request->get('formodule');
$recordModel = Vtiger_Module_Model::getCleanInstance('OSSPdf');
if ($mode == 'create_buttons') {
$recordModel->add_links($formodule);
$buttonsReturn = true;
}
if ($mode == 'delete_buttons') {
$modCommentsModule = Vtiger_Module::getInstance($formodule);
$modCommentsModule->deleteLink('LISTVIEWSIDEBARWIDGET', 'Pdf');
$modCommentsModule->deleteLink('DETAILVIEWSIDEBARWIDGET', 'Pdf');
$modCommentsModule->deleteLink('DETAILVIEWBASIC', 'LBL_QUICK_GENERATE_MAIL');
// do ewentualnej poprawy
$modCommentsModule->deleteLink('DETAILVIEWBASIC', 'Generate default PDF');
$buttonsReturn = true;
}
if ($buttonsReturn === false) {
$result = array('success' => false, 'message' => vtranslate('Error', $moduleName));
} else {
$result = array('success' => true, 'message' => 'Ok');
}
$response = new Vtiger_Response();
$response->setResult($result);
$response->emit();
}
示例8: applyChange
function applyChange()
{
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
global $adb;
$moduleInstance = Vtiger_Module::getInstance('GlobalVariable');
// change uitype and label
$field = Vtiger_Field::getInstance('module_list', $moduleInstance);
if ($field) {
$this->ExecuteQuery("update vtiger_field set uitype=3313,fieldlabel='Module List' where fieldid=" . $field->id);
}
// convert all existing records to new format
$gvrs = $adb->pquery('select globalvariableid,module_list from vtiger_globalvariable', array());
$updsql = 'update vtiger_globalvariable set module_list=? where globalvariableid=?';
while ($gv = $adb->fetch_array($gvrs)) {
if (trim($gv['module_list']) != '') {
$ml = array_map('trim', explode(',', $gv['module_list']));
$ml = implode(' |##| ', $ml);
$this->ExecuteQuery($updsql, array($ml, $gv['globalvariableid']));
}
}
// fix incorrect entiyidentifier
$updsql = "UPDATE `vtiger_entityname` SET \n\t\t\t\t`fieldname`='globalno',\n\t\t\t\t`entityidfield`='globalvariableid',\n\t\t\t\t`entityidcolumn`='globalvariableid'\n\t\t\t\tWHERE `modulename`='GlobalVariable' and `tablename`='vtiger_globalvariable'";
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例9: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
global $adb;
$moduleInstance = Vtiger_Module::getInstance('Users');
$block = Vtiger_Block::getInstance('LBL_CALENDAR_SETTINGS', $moduleInstance);
if (!$block) {
$block = new Vtiger_Block();
$block->label = 'LBL_CALENDAR_SETTINGS';
$block->sequence = 2;
$moduleInstance->addBlock($block);
}
$this->ExecuteQuery("delete from vtiger_picklist where name='hour_format'");
$this->ExecuteQuery("delete from vtiger_picklist where name='start_hour'");
$field = Vtiger_Field::getInstance('hour_format', $moduleInstance);
$this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $field->id);
$field->setPicklistValues(array('am/pm', '12', '24'));
$start_hour = Vtiger_Field::getInstance('start_hour', $moduleInstance);
$this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $start_hour->id);
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例10: undoChange
function undoChange()
{
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
// undo your magic here
$moduleInstance = Vtiger_Module::getInstance('Potentials');
$field = Vtiger_Field::getInstance('forecast_amount', $moduleInstance);
if ($field) {
$this->ExecuteQuery('update vtiger_field set presence=1 where fieldid=' . $field->id);
}
global $adb;
$wfrs = $adb->query("SELECT workflow_id FROM com_vtiger_workflows WHERE summary='Calculate or Update forecast amount'");
if ($wfrs and $adb->num_rows($wfrs) == 1) {
$wfid = $adb->query_result($wfrs, 0, 0);
$this->deleteWorkflow($wfid);
$this->sendMsg('Workflow deleted!');
}
$this->sendMsg('Changeset ' . get_class($this) . ' undone!');
$this->markUndone();
} else {
$this->sendMsg('Changeset ' . get_class($this) . ' not applied!');
}
$this->finishExecution();
}
示例11: updateUserModuleStep3
public function updateUserModuleStep3(Vtiger_Request $request)
{
$importModuleName = $request->get('module_import_name');
$uploadFile = $request->get('module_import_file');
$uploadDir = Settings_ModuleManager_Extension_Model::getUploadDirectory();
$uploadFileName = "{$uploadDir}/{$uploadFile}";
checkFileAccess($uploadFileName);
$importType = $request->get('module_import_type');
if (strtolower($importType) == 'language') {
$package = new Vtiger_Language();
} else {
$package = new Vtiger_Package();
}
if (strtolower($importType) == 'language') {
$package->import($uploadFileName);
} else {
$package->update(Vtiger_Module::getInstance($importModuleName), $uploadFileName);
}
checkFileAccessForDeletion($uploadFileName);
unlink($uploadFileName);
$result = array('success' => true, 'importModuleName' => $importModuleName);
$response = new Vtiger_Response();
$response->setResult($result);
$response->emit();
}
示例12: undoChange
function undoChange()
{
if ($this->isBlocked()) {
return true;
}
if ($this->hasError()) {
$this->sendError();
}
if ($this->isSystemUpdate()) {
$this->sendMsg('Changeset ' . get_class($this) . ' is a system update, it cannot be undone!');
} else {
if ($this->isApplied()) {
// undo your magic here
$modname = 'Vendors';
$module = Vtiger_Module::getInstance($modname);
$ctModule = Vtiger_Module::getInstance('Contacts');
$module->unsetRelatedList($ctModule, $modname, 'get_vendors');
$this->sendMsg('Changeset ' . get_class($this) . ' undone!');
$this->markUndone();
} else {
$this->sendMsg('Changeset ' . get_class($this) . ' not applied!');
}
}
$this->finishExecution();
}
示例13: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
$moduleInstance = Vtiger_Module::getInstance('Products');
$field = Vtiger_Field::getInstance('discontinued', $moduleInstance);
if ($field) {
$this->ExecuteQuery("update vtiger_field set defaultvalue='1' where fieldid=" . $field->id);
}
$moduleInstance = Vtiger_Module::getInstance('Services');
$field = Vtiger_Field::getInstance('discontinued', $moduleInstance);
if ($field) {
$this->ExecuteQuery("update vtiger_field set defaultvalue='1' where fieldid=" . $field->id);
}
$moduleInstance = Vtiger_Module::getInstance('PriceBooks');
$field = Vtiger_Field::getInstance('active', $moduleInstance);
if ($field) {
$this->ExecuteQuery("update vtiger_field set defaultvalue='1' where fieldid=" . $field->id);
}
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}
示例14: vtlib_handler
/**
* 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, $event_type)
{
global $adb;
if ($event_type == 'module.postinstall') {
$ModuleInstance = CRMEntity::getInstance($modulename);
$ModuleInstance->setModuleSeqNumber("configure", $modulename, 'UO', '1');
include_once 'vtlib/Vtiger/Module.php';
$moduleInstance = Vtiger_Module::getInstance($modulename);
$docelowy_Module = Vtiger_Module::getInstance('Accounts');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSOutsourcedServices', array('ADD'), 'get_dependents_list');
$docelowy_Module = Vtiger_Module::getInstance('Leads');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSOutsourcedServices', array('ADD'), 'get_dependents_list');
$docelowy_Module = Vtiger_Module::getInstance('Potentials');
$docelowy_Module->setRelatedList($moduleInstance, 'OSSOutsourcedServices', array('ADD'), 'get_dependents_list');
} else {
if ($event_type == 'module.disabled') {
// TODO Handle actions when this module is disabled.
} else {
if ($event_type == 'module.enabled') {
// TODO Handle actions when this module is enabled.
} else {
if ($event_type == 'module.preuninstall') {
// TODO Handle actions when this module is about to be deleted.
} else {
if ($event_type == 'module.preupdate') {
// TODO Handle actions before this module is updated.
} else {
if ($event_type == 'module.postupdate') {
}
}
}
}
}
}
}
示例15: applyChange
function applyChange()
{
global $adb;
if ($this->hasError()) {
$this->sendError();
}
if ($this->isApplied()) {
$this->sendMsg('Changeset ' . get_class($this) . ' already applied!');
} else {
global $adb;
$moduleInstance = Vtiger_Module::getInstance('Users');
$block = Vtiger_Block::getInstance('LBL_CALENDAR_SETTINGS', $moduleInstance);
if (!$block) {
$block = new Vtiger_Block();
$block->label = 'LBL_CALENDAR_SETTINGS';
$block->sequence = 2;
$moduleInstance->addBlock($block);
}
$this->ExecuteQuery('drop table if exists vtiger_hour_format');
$this->ExecuteQuery('drop table if exists vtiger_start_hour');
$field = Vtiger_Field::getInstance('hour_format', $moduleInstance);
if ($field) {
$this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $field->id);
} else {
$field = new Vtiger_Field();
$field->name = 'hour_format';
$field->label = 'Calendar Hour Format';
$field->table = 'vtiger_users';
$field->column = 'hour_format';
$field->columntype = 'varchar(4)';
$field->typeofdata = 'V~O';
$field->uitype = '16';
$field->masseditable = '0';
$block->addField($field);
}
$field->setPicklistValues(array('12', '24'));
$start_hour = Vtiger_Field::getInstance('start_hour', $moduleInstance);
if ($start_hour) {
$this->ExecuteQuery('update vtiger_field set presence=2,uitype=16 where fieldid=' . $start_hour->id);
} else {
$start_hour = new Vtiger_Field();
$start_hour->name = 'start_hour';
$start_hour->label = 'Day starts at';
$start_hour->table = 'vtiger_users';
$start_hour->column = 'start_hour';
$start_hour->columntype = 'varchar(5)';
$start_hour->typeofdata = 'V~O';
$start_hour->uitype = '16';
$start_hour->masseditable = '0';
$block->addField($start_hour);
}
$start_hour->setPicklistValues(array('00:00', '01:00', '02:00', '03:00', '04:00', '05:00', '06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00', '18:00', '19:00', '20:00', '21:00', '22:00', '23:00'));
$this->sendMsg('Changeset ' . get_class($this) . ' applied!');
$this->markApplied();
}
$this->finishExecution();
}