public function getModalScripts(Vtiger_Request $request) { $parentScriptInstances = parent::getModalScripts($request); $scripts = ['~libraries/jquery/jstree/jstree.js']; if (AppConfig::relation('SELECTABLE_CATEGORY')) { $scripts[] = '~libraries/jquery/jstree/jstree.category.js'; } if ($this->relationType == 1) { $scripts[] = '~libraries/jquery/jstree/jstree.edit.js'; } $scripts[] = 'modules.Vtiger.resources.TreeCategoryModal'; $modalInstances = $this->checkAndConvertJsScripts($scripts); $scriptInstances = array_merge($modalInstances, $parentScriptInstances); return $scriptInstances; }
public static function load($key, $config) { switch ($key) { case 'debug': self::$debug = $config; break; case 'developer': self::$developer = $config; break; case 'security': self::$security = $config; break; case 'securityKeys': self::$securityKeys = $config; break; case 'performance': self::$performance = $config; break; case 'relation': self::$relation = $config; break; } }
public function preProcess(Vtiger_Request $request, $display = true) { parent::preProcess($request); $viewer = $this->getViewer($request); $viewer->assign('SELECTABLE_CATEGORY', AppConfig::relation('SELECTABLE_CATEGORY') ? 1 : 0); }
public function getTreeEntries() { $db = PearDatabase::getInstance(); $recordId = $this->getParentRecordModel()->getId(); $relModuleId = $this->getRelatedModuleModel()->getId(); $relModuleName = $this->getRelatedModuleModel()->getName(); $treeViewModel = $this->getTreeViewModel(); $relationModel = $this->getRelationModel(); $fields = $treeViewModel->getTreeField(); $template = $treeViewModel->getTemplate(); $result = $db->pquery('SELECT tr.*,rel.crmid,rel.rel_created_time,rel.rel_created_user,rel.rel_comment FROM vtiger_trees_templates_data tr ' . 'INNER JOIN u_yf_crmentity_rel_tree rel ON rel.tree = tr.tree ' . 'WHERE tr.templateid = ? AND rel.crmid = ? AND rel.relmodule = ?', [$template, $recordId, $relModuleId]); $trees = []; while ($row = $db->getRow($result)) { $treeID = $row['tree']; $pieces = explode('::', $row['parenttrre']); end($pieces); $parent = prev($pieces); $parentName = ''; if ($row['depth'] > 0) { $result2 = $db->pquery('SELECT name FROM vtiger_trees_templates_data WHERE templateid = ? AND tree = ?', [$template, $parent]); $parentName = $db->getSingleValue($result2); $parentName = '(' . vtranslate($parentName, $relModuleName) . ') '; } $tree = ['id' => $treeID, 'name' => $parentName . vtranslate($row['name'], $relModuleName), 'parent' => $parent == 0 ? '#' : $parent]; if ($relationModel->showCreatorDetail()) { $tree['relCreatedUser'] = getOwnerName($row['rel_created_user']); $tree['relCreatedTime'] = Vtiger_Datetime_UIType::getDisplayDateTimeValue($row['rel_created_time']); } if ($relationModel->showComment()) { if (strlen($row['rel_comment']) > AppConfig::relation('COMMENT_MAX_LENGTH')) { $tree['relCommentFull'] = $row['rel_comment']; } $tree['relComment'] = Vtiger_Functions::textLength($row['rel_comment'], AppConfig::relation('COMMENT_MAX_LENGTH')); } if (!empty($row['icon'])) { $tree['icon'] = $row['icon']; } $trees[] = $tree; } return $trees; }