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