pquery('UPDATE vtiger_tab SET customized=0 WHERE name=?', array($modulename)); } } /** * Get widget instance by name */ static function getWidget($name) { if ($name == 'DetailViewBlockCommentWidget' && isPermitted('ModComments', 'DetailView') == 'yes') { require_once dirname(__FILE__) . '/widgets/DetailViewBlockComment.php'; return (new ModComments_DetailViewBlockCommentWidget()); } return false; } /** * Add widget to other module. * @param unknown_type $moduleNames * @return unknown_type */ static function addWidgetTo($moduleNames, $widgetType='DETAILVIEWWIDGET', $widgetName='DetailViewBlockCommentWidget') { if (empty($moduleNames)) return; include_once 'vtlib/Vtiger/Module.php'; if (is_string($moduleNames)) $moduleNames = array($moduleNames); $commentWidgetCount = 0; foreach($moduleNames as $moduleName) { $module = Vtiger_Module::getInstance($moduleName); if($module) { $module->addLink($widgetType, $widgetName, "block://ModComments:modules/ModComments/ModComments.php"); ++$commentWidgetCount; } } if ($commentWidgetCount) { $modCommentsModule = Vtiger_Module::getInstance('ModComments'); $modCommentsModule->addLink('HEADERSCRIPT', 'ModCommentsCommonHeaderScript', 'modules/ModComments/ModCommentsCommon.js'); $modCommentsRelatedToField = Vtiger_Field::getInstance('related_to', $modCommentsModule); $modCommentsRelatedToField->setRelatedModules($moduleNames); } } /** * Remove widget from other modules. * @param unknown_type $moduleNames * @param unknown_type $widgetType * @param unknown_type $widgetName * @return unknown_type */ static function removeWidgetFrom($moduleNames, $widgetType='DETAILVIEWWIDGET', $widgetName='DetailViewBlockCommentWidget') { if (empty($moduleNames)) return; include_once 'vtlib/Vtiger/Module.php'; if (is_string($moduleNames)) $moduleNames = array($moduleNames); $commentWidgetCount = 0; foreach($moduleNames as $moduleName) { $module = Vtiger_Module::getInstance($moduleName); if($module) { $module->deleteLink($widgetType, $widgetName, "block://ModComments:modules/ModComments/ModComments.php"); ++$commentWidgetCount; } } if ($commentWidgetCount) { $modCommentsModule = Vtiger_Module::getInstance('ModComments'); $modCommentsRelatedToField = Vtiger_Field::getInstance('related_to', $modCommentsModule); $modCommentsRelatedToField->unsetRelatedModules($moduleNames); } } /** * Wrap this instance as a model */ function getAsCommentModel() { return new ModComments_CommentsModel($this->column_fields); } } ?>