// import_dir default value prepended by cache_dir = import/ $upload_dir = $cache_dir . 'upload/'; // upload_dir default value prepended by cache_dir = upload/ $WERPASCOPEVAL = array(); $WERPASCOPEVAL['SCOPE'] = $WERPAACCOUNT; $WERPASCOPEVAL['SCOPEDIR'] = $WERPASCOPEDIR; require_once 'modules/Settings/SysVars/SysVars.php'; /////////////////////////////////////////////////////////////////// // НАСТРОЙКИ АККАУНТА $pagetext_vars = SysVars::getVarsSimple('pagetext'); foreach ($pagetext_vars as $key => $value) { $WERPASCOPEVAL[$key] = $value; } //trigger_error(var_dump($WERPASCOPEVAL), E_USER_ERROR); /////////////////////////////////////////////////////////////////// // ОСНОВНАЯ КОНФИГУРАЦИЯ $config_vars = SysVars::getVarsSimple('variables'); // переменные которые можно определять напрямую $allowedconfigvars = array('default_timezone', 'PORTAL_URL', 'site_ALT_URL'); foreach ($config_vars as $key => $value) { if (in_array($key, $allowedconfigvars)) { ${$key} = $value; } } /////////////////////////////////////////////////////////////////// // переменные HELPDESK_SUPPORT_ $config_vars = SysVars::getVarsSimple('helpdesk'); foreach ($config_vars as $key => $value) { $varname = 'HELPDESK_SUPPORT_' . $key; ${$varname} = $value; }
<?php // НАСТРОЙКИ СИСТЕМНОГО МЕНЮ $sysmenu_vars = SysVars::getVars('sysmenu'); //////////////////////////////////////////////////////////////// // sysmenu_toch $sysmenu_toch = array( 'linktype' => 'HEADERLINK', 'linklabel' => $userModel->get('filial'), 'linkicon' => $userModel->get('filial') . '.png', 'childlinks' => array( array ( 'linktype' => 'HEADERLINK', 'linklabel' => 'LBL_CREATE_POTENTIAL', 'linkurl' => '/z/index.php?module=Potentials&view=Edit', 'linkicon' => '' ) ) ); array_push($headerLinks, $sysmenu_toch); ////////////////////////////////////////////////////////////////
/** * Function to get the list of Header Links * @return <Array> - List of Vtiger_Link_Model instances */ function getHeaderLinks() { $appUniqueKey = vglobal('application_unique_key'); $vtigerCurrentVersion = vglobal('vtiger_current_version'); $site_URL = vglobal('site_URL'); $userModel = Users_Record_Model::getCurrentUserModel(); $userEmail = $userModel->get('email1'); $headerLinks = array(); ////////////////////////////////////////////////////////////////////////////// // sysmenu по умолчанию $defHeaderLinks = array(); // sysmenu_admin if($userModel->isAdminUser()) { $defHeaderLinks['admin'] = array( 'linklabel' => 'LBL_CRM_SETTINGS', 'linkicon' => 'setting.png', 'childlinks' => array() ); $pinnedSettingsShortcuts = Settings_Vtiger_MenuItem_Model::getPinnedItems(); // Загружаем Pinned элементы foreach ($pinnedSettingsShortcuts as $pinnedItem) { $mitem = Array( 'linklabel' => vtranslate($pinnedItem->get('name'), $pinnedItem->getModuleNameFromUrl($pinnedItem->get('linkto'))), 'linkurl' => $pinnedItem->getUrl(), 'linkicon' => '' ); array_push($defHeaderLinks['admin']['childlinks'], $mitem); } $defHeaderLinks['admin']['childlinks'][] = array(); $defHeaderLinks['admin']['childlinks'][] = array ( 'linklabel' => 'LBL_CRM_SETTINGS', 'linkurl' => 'index.php?module=Vtiger&parent=Settings&view=Index' ); } // sysmenu_user $defHeaderLinks['user'] = array( 'linklabel' => $userModel->getDisplayName(), 'linkurl' => '', 'linkicon' => '', 'childlinks' => array( array ( 'linklabel' => 'LBL_MY_PREFERENCES', 'linkurl' => $userModel->getPreferenceDetailViewUrl(), 'linkicon' => '', ), array(), // separator array ( 'linklabel' => 'LBL_SIGN_OUT', 'linkurl' => '?module=Users&parent=Settings&action=Logout', 'linkicon' => '', ) ) ); // sysmenu_toch global $adb; $stresult = $adb->query("SELECT store_id FROM vtiger_users WHERE id = " . $userModel->getId()); $curentUserStoreId = $adb->query_result($stresult, 0, 'store_id'); if($curentUserStoreId > 0) { $curentUserStore = CRMEntity::getInstance('Store'); $curentUserStore->retrieve_entity_info($curentUserStoreId, 'Store'); $defHeaderLinks['toch'] = array( 'linklabel' => $curentUserStore->column_fields['name'], 'linkurl' => 'index.php?module=Store&view=Detail&record='.$curentUserStoreId, 'childlinks' => array() ); } // sysmenu_info $defHeaderLinks['info'] = array( 'linklabel' => 'LBL_HELP', 'linkicon' => 'info.png', 'childlinks' => array( array ( 'linktype' => 'HEADERLINK', 'linklabel' => 'LBL_DOCUMENTATION', 'linkurl' => 'http://salesplatform.ru/wiki/index.php/SalesPlatform_vtiger_crm_630', 'target' => '_blank' ), array () ) ); ////////////////////////////////////////////////////////////////////////////// // sysmenu из sysmenu.inc.php $incHeaderLinks = array(); global $WERPASCOPEDIR; include($WERPASCOPEDIR . '/sysmenu.inc.php'); ////////////////////////////////////////////////////////////////////////////// // sysmenu из SysVars $sysmenu_vars = SysVars::getVars('sysmenu'); // переносим список сортировки if (array_key_exists('sort', $sysmenu_vars)) { $headerSortList = Zend_Json::decode(decode_html($sysmenu_vars['sort'])); } else if (isset($incHeaderSortList)) { $headerSortList = $incHeaderSortList; } else { $headerSortList = Array("toch", "info", "admin", "user"); } // Сформируем меню из трех массивов foreach($headerSortList as $key) { if($key == 'admin' && !$userModel->isAdminUser()) continue; if ($defHeaderLinks[$key]) $headerLinks[$key] = $defHeaderLinks[$key]; if ($incHeaderLinks[$key]) { $tempChildlinks = $headerLinks[$key]['childlinks']; $newHeaderLinks = $incHeaderLinks[$key]; $headerLinks[$key] = ($headerLinks[$key]) ? array_replace($headerLinks[$key], $newHeaderLinks) : $newHeaderLinks; if($newHeaderLinks['childupdate'] && $newHeaderLinks['childlinks'] && $tempChildlinks) { // если надо дописать подпункты, а не заменить switch($newHeaderLinks['childupdate']) { case 'top': $headerLinks[$key]['childlinks'] = array_merge($newHeaderLinks['childlinks'], $tempChildlinks); break; case 'bottom': $headerLinks[$key]['childlinks'] = array_merge($tempChildlinks, $newHeaderLinks['childlinks']); break; } unset($headerLinks[$key]['childupdate']); } } if ($sysmenu_vars[$key]) { $tempChildlinks = $headerLinks[$key]['childlinks']; $newHeaderLinks = Zend_Json::decode(decode_html($sysmenu_vars[$key])); $headerLinks[$key] = ($headerLinks[$key]) ? array_replace($headerLinks[$key], $newHeaderLinks) : $newHeaderLinks; if($newHeaderLinks['childupdate'] && $newHeaderLinks['childlinks'] && $tempChildlinks) { // если надо дописать подпункты, а не заменить switch($newHeaderLinks['childupdate']) { case 'top': $headerLinks[$key]['childlinks'] = array_merge($newHeaderLinks['childlinks'], $tempChildlinks); break; case 'bottom': $headerLinks[$key]['childlinks'] = array_merge($tempChildlinks, $newHeaderLinks['childlinks']); break; } unset($headerLinks[$key]['childupdate']); } } $headerLinks[$key]['linktype'] = 'HEADERLINK'; if (array_key_exists('childlinks', $headerLinks[$key])) { foreach($headerLinks[$key]['childlinks'] as $childKey => $childLink) { $headerLinks[$key]['childlinks'][$childKey]['linktype'] = 'HEADERLINK'; } } } // Конвертировать headerLinks в ссылки $headerLinkInstances = array(); $index = 0; foreach($headerLinks as $headerLink) { $headerLinkInstance = Vtiger_Link_Model::getInstanceFromValues($headerLink); foreach($headerLink['childlinks'] as $childLink) { $headerLinkInstance->addChildLink(Vtiger_Link_Model::getInstanceFromValues($childLink)); } $headerLinkInstances[$index++] = $headerLinkInstance; } $headerLinks = Vtiger_Link_Model::getAllByType(Vtiger_Link::IGNORE_MODULE, array('HEADERLINK')); foreach($headerLinks as $headerType => $headerLinks) { foreach($headerLinks as $headerLink) { $headerLinkInstances[$index++] = Vtiger_Link_Model::getInstanceFromLinkObject($headerLink); } } return $headerLinkInstances; }