[ Index ] |
PHP Cross Reference of vtigercrm-6.1.0 |
[Summary view] [Print] [Text view]
1 <?php 2 /*+*********************************************************************************** 3 * The contents of this file are subject to the vtiger CRM Public License Version 1.0 4 * ("License"); You may not use this file except in compliance with the License 5 * The Original Code is: vtiger CRM Open Source 6 * The Initial Developer of the Original Code is vtiger. 7 * Portions created by vtiger are Copyright (C) vtiger. 8 * All Rights Reserved. 9 * ************************************************************************************/ 10 11 abstract class Vtiger_Header_View extends Vtiger_View_Controller { 12 13 function __construct() { 14 parent::__construct(); 15 } 16 17 //Note : To get the right hook for immediate parent in PHP, 18 // specially in case of deep hierarchy 19 /*function preProcessParentTplName(Vtiger_Request $request) { 20 return parent::preProcessTplName($request); 21 }*/ 22 23 /** 24 * Function to determine file existence in relocated module folder (under vtiger6) 25 * @param String $fileuri 26 * @return Boolean 27 * 28 * Utility function to manage the backward compatible file load 29 * which are registered for 5.x modules (and now provided for 6.x as well). 30 */ 31 protected function checkFileUriInRelocatedMouldesFolder($fileuri) { 32 list ($filename, $query) = explode('?', $fileuri); 33 34 // prefix the base lookup folder (relocated file). 35 if (strpos($filename, 'modules') === 0) { 36 $filename = $filename; 37 } 38 39 return file_exists($filename); 40 } 41 42 /** 43 * Function to get the list of Header Links 44 * @return <Array> - List of Vtiger_Link_Model instances 45 */ 46 function getHeaderLinks() { 47 $appUniqueKey = vglobal('application_unique_key'); 48 $vtigerCurrentVersion = vglobal('vtiger_current_version'); 49 $site_URL = vglobal('site_URL'); 50 51 $userModel = Users_Record_Model::getCurrentUserModel(); 52 $userEmail = $userModel->get('email1'); 53 54 $headerLinks = array( 55 // Note: This structure is expected to generate side-bar feedback button. 56 array ( 57 'linktype' => 'HEADERLINK', 58 'linklabel' => 'LBL_FEEDBACK', 59 'linkurl' => "javascript:window.open('http://vtiger.com/products/crm/od-feedback/index.php?version=".$vtigerCurrentVersion. 60 "&email=".$userEmail."&uid=".$appUniqueKey. 61 "&ui=6','feedbackwin','height=400,width=550,top=200,left=300')", 62 'linkicon' => 'info.png', 63 'childlinks' => array( 64 array ( 65 'linktype' => 'HEADERLINK', 66 'linklabel' => 'LBL_DOCUMENTATION', 67 'linkurl' => 'https://wiki.vtiger.com/vtiger6/index.php/Main_Page', 68 'linkicon' => '', 69 'target' => '_blank' 70 ), 71 array ( 72 'linktype' => 'HEADERLINK', 73 'linklabel' => 'LBL_VIDEO_TUTORIAL', 74 'linkurl' => 'https://www.vtiger.com/crm/videos', 75 'linkicon' => '', 76 'target' => '_blank' 77 ), 78 // Note: This structure is expected to generate side-bar feedback button. 79 array ( 80 'linktype' => 'HEADERLINK', 81 'linklabel' => 'LBL_FEEDBACK', 82 'linkurl' => "javascript:window.open('http://vtiger.com/products/crm/od-feedback/index.php?version=".$vtigerCurrentVersion. 83 "&email=".$userEmail."&uid=".$appUniqueKey. 84 "&ui=6','feedbackwin','height=400,width=550,top=200,left=300')", 85 'linkicon' => '', 86 ) 87 ) 88 ) 89 ); 90 91 if($userModel->isAdminUser()) { 92 $crmSettingsLink = array( 93 'linktype' => 'HEADERLINK', 94 'linklabel' => 'LBL_CRM_SETTINGS', 95 'linkurl' => '', 96 'linkicon' => 'setting.png', 97 'childlinks' => array( 98 array ( 99 'linktype' => 'HEADERLINK', 100 'linklabel' => 'LBL_CRM_SETTINGS', 101 'linkurl' => '?module=Vtiger&parent=Settings&view=Index', 102 'linkicon' => '', 103 ), 104 array(), // separator 105 array ( 106 'linktype' => 'HEADERLINK', 107 'linklabel' => 'LBL_MANAGE_USERS', 108 'linkurl' => '?module=Users&parent=Settings&view=List', 109 'linkicon' => '', 110 ), 111 ) 112 ); 113 array_push($headerLinks, $crmSettingsLink); 114 } 115 $userPersonalSettingsLinks = array( 116 'linktype' => 'HEADERLINK', 117 'linklabel' => $userModel->getDisplayName(), 118 'linkurl' => '', 119 'linkicon' => '', 120 'childlinks' => array( 121 array ( 122 'linktype' => 'HEADERLINK', 123 'linklabel' => 'LBL_MY_PREFERENCES', 124 'linkurl' => $userModel->getPreferenceDetailViewUrl(), 125 'linkicon' => '', 126 ), 127 array(), // separator 128 array ( 129 'linktype' => 'HEADERLINK', 130 'linklabel' => 'LBL_SIGN_OUT', 131 'linkurl' => '?module=Users&parent=Settings&action=Logout', 132 'linkicon' => '', 133 ) 134 ) 135 ); 136 array_push($headerLinks, $userPersonalSettingsLinks); 137 $headerLinkInstances = array(); 138 139 $index = 0; 140 foreach($headerLinks as $headerLink) { 141 $headerLinkInstance = Vtiger_Link_Model::getInstanceFromValues($headerLink); 142 foreach($headerLink['childlinks'] as $childLink) { 143 $headerLinkInstance->addChildLink(Vtiger_Link_Model::getInstanceFromValues($childLink)); 144 } 145 $headerLinkInstances[$index++] = $headerLinkInstance; 146 } 147 $headerLinks = Vtiger_Link_Model::getAllByType(Vtiger_Link::IGNORE_MODULE, array('HEADERLINK')); 148 foreach($headerLinks as $headerType => $headerLinks) { 149 foreach($headerLinks as $headerLink) { 150 $headerLinkInstances[$index++] = Vtiger_Link_Model::getInstanceFromLinkObject($headerLink); 151 } 152 } 153 return $headerLinkInstances; 154 } 155 156 /** 157 * Function to get the list of Script models to be included 158 * @param Vtiger_Request $request 159 * @return <Array> - List of Vtiger_JsScript_Model instances 160 */ 161 function getHeaderScripts(Vtiger_Request $request) { 162 $headerScriptInstances = parent::getHeaderScripts($request); 163 $headerScripts = Vtiger_Link_Model::getAllByType(Vtiger_Link::IGNORE_MODULE, array('HEADERSCRIPT')); 164 foreach($headerScripts as $headerType => $headerScripts) { 165 foreach($headerScripts as $headerScript) { 166 if ($this->checkFileUriInRelocatedMouldesFolder($headerScript->linkurl)) { 167 $headerScriptInstances[] = Vtiger_JsScript_Model::getInstanceFromLinkObject($headerScript); 168 } 169 } 170 } 171 return $headerScriptInstances; 172 } 173 174 /** 175 * Function to get the list of Css models to be included 176 * @param Vtiger_Request $request 177 * @return <Array> - List of Vtiger_CssScript_Model instances 178 */ 179 function getHeaderCss(Vtiger_Request $request) { 180 $headerCssInstances = parent::getHeaderCss($request); 181 $headerCss = Vtiger_Link_Model::getAllByType(Vtiger_Link::IGNORE_MODULE, array('HEADERCSS')); 182 $selectedThemeCssPath = Vtiger_Theme::getStylePath(); 183 //TODO : check the filename whether it is less or css and add relative less 184 $isLessType = (strpos($selectedThemeCssPath, ".less") !== false)? true:false; 185 $cssScriptModel = new Vtiger_CssScript_Model(); 186 $headerCssInstances[] = $cssScriptModel->set('href', $selectedThemeCssPath) 187 ->set('rel', 188 $isLessType? 189 Vtiger_CssScript_Model::LESS_REL : 190 Vtiger_CssScript_Model::DEFAULT_REL); 191 192 foreach($headerCss as $headerType => $cssLinks) { 193 foreach($cssLinks as $cssLink) { 194 if ($this->checkFileUriInRelocatedMouldesFolder($cssLink->linkurl)) { 195 $headerCssInstances[] = Vtiger_CssScript_Model::getInstanceFromLinkObject($cssLink); 196 } 197 } 198 } 199 return $headerCssInstances; 200 } 201 202 /** 203 * Function to get the Announcement 204 * @return Vtiger_Base_Model - Announcement 205 */ 206 function getAnnouncement() { 207 //$announcement = Vtiger_Cache::get('announcement', 'value'); 208 $model = new Vtiger_Base_Model(); 209 //if(!$announcement) { 210 $announcement = get_announcements(); 211 //Vtiger_Cache::set('announcement', 'value', $announcement); 212 //} 213 return $model->set('announcement', $announcement); 214 } 215 216 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:08:37 2014 | Cross-referenced by PHPXref 0.7.1 |