[ 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 class Accounts_DetailView_Model extends Vtiger_DetailView_Model { 12 13 /** 14 * Function to get the detail view links (links and widgets) 15 * @param <array> $linkParams - parameters which will be used to calicaulate the params 16 * @return <array> - array of link models in the format as below 17 * array('linktype'=>list of link models); 18 */ 19 public function getDetailViewLinks($linkParams) { 20 $currentUserModel = Users_Privileges_Model::getCurrentUserPrivilegesModel(); 21 $emailModuleModel = Vtiger_Module_Model::getInstance('Emails'); 22 $recordModel = $this->getRecord(); 23 24 $linkModelList = parent::getDetailViewLinks($linkParams); 25 26 if($currentUserModel->hasModulePermission($emailModuleModel->getId())) { 27 $basicActionLink = array( 28 'linktype' => 'DETAILVIEWBASIC', 29 'linklabel' => 'LBL_SEND_EMAIL', 30 'linkurl' => 'javascript:Vtiger_Detail_Js.triggerSendEmail("index.php?module='.$this->getModule()->getName(). 31 '&view=MassActionAjax&mode=showComposeEmailForm&step=step1","Emails");', 32 'linkicon' => '' 33 ); 34 $linkModelList['DETAILVIEWBASIC'][] = Vtiger_Link_Model::getInstanceFromValues($basicActionLink); 35 } 36 37 //TODO: update the database so that these separate handlings are not required 38 $index=0; 39 foreach($linkModelList['DETAILVIEW'] as $link) { 40 if($link->linklabel == 'View History' || $link->linklabel == 'Send SMS') { 41 unset($linkModelList['DETAILVIEW'][$index]); 42 } else if($link->linklabel == 'LBL_SHOW_ACCOUNT_HIERARCHY') { 43 $linkURL = 'index.php?module=Accounts&view=AccountHierarchy&record='.$recordModel->getId(); 44 $link->linkurl = 'javascript:Accounts_Detail_Js.triggerAccountHierarchy("'.$linkURL.'");'; 45 unset($linkModelList['DETAILVIEW'][$index]); 46 $linkModelList['DETAILVIEW'][$index] = $link; 47 } 48 $index++; 49 } 50 51 $CalendarActionLinks = array(); 52 $CalendarModuleModel = Vtiger_Module_Model::getInstance('Calendar'); 53 if($currentUserModel->hasModuleActionPermission($CalendarModuleModel->getId(), 'EditView')) { 54 $CalendarActionLinks[] = array( 55 'linktype' => 'DETAILVIEW', 56 'linklabel' => 'LBL_ADD_EVENT', 57 'linkurl' => $recordModel->getCreateEventUrl(), 58 'linkicon' => '' 59 ); 60 61 $CalendarActionLinks[] = array( 62 'linktype' => 'DETAILVIEW', 63 'linklabel' => 'LBL_ADD_TASK', 64 'linkurl' => $recordModel->getCreateTaskUrl(), 65 'linkicon' => '' 66 ); 67 } 68 69 $SMSNotifierModuleModel = Vtiger_Module_Model::getInstance('SMSNotifier'); 70 if(!empty($SMSNotifierModuleModel) && $currentUserModel->hasModulePermission($SMSNotifierModuleModel->getId())) { 71 $basicActionLink = array( 72 'linktype' => 'DETAILVIEWBASIC', 73 'linklabel' => 'LBL_SEND_SMS', 74 'linkurl' => 'javascript:Vtiger_Detail_Js.triggerSendSms("index.php?module='.$this->getModule()->getName(). 75 '&view=MassActionAjax&mode=showSendSMSForm","SMSNotifier");', 76 'linkicon' => '' 77 ); 78 $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($basicActionLink); 79 } 80 81 $moduleModel = $this->getModule(); 82 if($currentUserModel->hasModuleActionPermission($moduleModel->getId(), 'EditView')) { 83 $massActionLink = array( 84 'linktype' => 'LISTVIEWMASSACTION', 85 'linklabel' => 'LBL_TRANSFER_OWNERSHIP', 86 'linkurl' => 'javascript:Vtiger_Detail_Js.triggerTransferOwnership("index.php?module='.$moduleModel->getName().'&view=MassActionAjax&mode=transferOwnership")', 87 'linkicon' => '' 88 ); 89 $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($massActionLink); 90 } 91 92 foreach($CalendarActionLinks as $basicLink) { 93 $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($basicLink); 94 } 95 96 return $linkModelList; 97 } 98 }
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 |