本文整理汇总了PHP中Vtiger_Link_Model类的典型用法代码示例。如果您正苦于以下问题:PHP Vtiger_Link_Model类的具体用法?PHP Vtiger_Link_Model怎么用?PHP Vtiger_Link_Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Vtiger_Link_Model类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getListViewMassActions
/**
* Function to get the list of Mass actions for the module
* @param <Array> $linkParams
* @return <Array> - Associative array of Link type to List of Vtiger_Link_Model instances for Mass Actions
*/
public function getListViewMassActions($linkParams)
{
$currentUserModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$moduleModel = $this->getModule();
$linkTypes = array('LISTVIEWMASSACTION');
$links = Vtiger_Link_Model::getAllByType($moduleModel->getId(), $linkTypes, $linkParams);
//Opensource fix to make documents module mass editable
$massActionLinks = [];
if ($currentUserModel->hasModuleActionPermission($moduleModel->getId(), 'MassEdit')) {
$massActionLinks[] = array('linktype' => 'LISTVIEWMASSACTION', 'linklabel' => 'LBL_EDIT', 'linkurl' => 'javascript:Vtiger_List_Js.triggerMassEdit("index.php?module=' . $moduleModel->get('name') . '&view=MassActionAjax&mode=showMassEditForm");', 'linkicon' => '');
}
if ($currentUserModel->hasModuleActionPermission($moduleModel->getId(), 'MassDelete')) {
$massActionLinks[] = array('linktype' => 'LISTVIEWMASSACTION', 'linklabel' => 'LBL_DELETE', 'linkurl' => 'javascript:Vtiger_List_Js.massDeleteRecords("index.php?module=' . $moduleModel->getName() . '&action=MassDelete");', 'linkicon' => '');
}
if ($currentUserModel->hasModuleActionPermission($moduleModel->getId(), 'MassMoveDocuments')) {
$massActionLinks[] = array('linktype' => 'LISTVIEWMASSACTION', 'linklabel' => 'LBL_MOVE', 'linkurl' => 'javascript:Documents_List_Js.massMove("index.php?module=' . $moduleModel->getName() . '&view=MoveDocuments");', 'linkicon' => '');
}
if ($currentUserModel->hasModuleActionPermission($moduleModel->getId(), 'MassTransferOwnership')) {
$massActionLinks[] = array('linktype' => 'LISTVIEWMASSACTION', 'linklabel' => 'LBL_TRANSFER_OWNERSHIP', 'linkurl' => 'javascript:Vtiger_List_Js.triggerTransferOwnership("index.php?module=' . $moduleModel->getName() . '&view=MassActionAjax&mode=transferOwnership")', 'linkicon' => '');
}
foreach ($massActionLinks as $massActionLink) {
$links['LISTVIEWMASSACTION'][] = Vtiger_Link_Model::getInstanceFromValues($massActionLink);
}
return $links;
}
示例2: getDetailViewLinks
/**
* Function to get the detail view links (links and widgets)
* @param <array> $linkParams - parameters which will be used to calicaulate the params
* @return <array> - array of link models in the format as below
* array('linktype'=>list of link models);
*/
public function getDetailViewLinks($linkParams)
{
$currentUserModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$linkModelList = parent::getDetailViewLinks($linkParams);
$recordModel = $this->getRecord();
$invoiceModuleModel = Vtiger_Module_Model::getInstance('Invoice');
$quoteModuleModel = Vtiger_Module_Model::getInstance('Quotes');
if ($currentUserModel->hasModuleActionPermission($invoiceModuleModel->getId(), 'EditView')) {
$basicActionLink = array('linktype' => 'DETAILVIEW', 'linklabel' => '', 'linkurl' => $recordModel->getCreateInvoiceUrl(), 'linkicon' => 'glyphicon glyphicon-list-alt', 'title' => vtranslate('LBL_CREATE') . ' ' . vtranslate($invoiceModuleModel->getSingularLabelKey(), 'Invoice'));
$linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($basicActionLink);
}
if ($currentUserModel->hasModuleActionPermission($quoteModuleModel->getId(), 'EditView')) {
$basicActionLink = array('linktype' => 'DETAILVIEW', 'linklabel' => '', 'linkurl' => $recordModel->getCreateQuoteUrl(), 'linkicon' => 'glyphicon glyphicon-briefcase', 'title' => vtranslate('LBL_CREATE') . ' ' . vtranslate($quoteModuleModel->getSingularLabelKey(), 'Quotes'));
$linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($basicActionLink);
}
$CalendarActionLinks[] = array();
$CalendarModuleModel = Vtiger_Module_Model::getInstance('Calendar');
if ($currentUserModel->hasModuleActionPermission($CalendarModuleModel->getId(), 'EditView')) {
$CalendarActionLinks[] = array('linktype' => 'DETAILVIEW', 'linklabel' => '', 'linkurl' => $recordModel->getCreateEventUrl(), 'linkicon' => 'glyphicon glyphicon-time', 'title' => vtranslate('LBL_ADD_EVENT'));
$CalendarActionLinks[] = array('linktype' => 'DETAILVIEW', 'linklabel' => '', 'linkurl' => $recordModel->getCreateTaskUrl(), 'linkicon' => 'glyphicon glyphicon-calendar', 'title' => vtranslate('LBL_ADD_TASK'));
}
foreach ($CalendarActionLinks as $basicLink) {
$linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($basicLink);
}
return $linkModelList;
}
示例3: getDetailViewLinks
/**
* Function to get the detail view links (links and widgets)
* @param <array> $linkParams - parameters which will be used to calicaulate the params
* @return <array> - array of link models in the format as below
* array('linktype'=>list of link models);
*/
public function getDetailViewLinks($linkParams)
{
$currentUserModel = Users_Record_Model::getCurrentUserModel();
$recordModel = $this->getRecord();
$recordId = $recordModel->getId();
if (($currentUserModel->isAdminUser() == true || $currentUserModel->get('id') == $recordId) && $recordModel->get('status') == 'Active') {
$recordModel = $this->getRecord();
$detailViewLinks = array(array('linktype' => 'DETAILVIEWBASIC', 'linklabel' => 'LBL_EDIT', 'linkurl' => $recordModel->getEditViewUrl(), 'linkicon' => ''));
if (vglobal('systemMode') != 'demo') {
$detailViewLinks[] = array('linktype' => 'DETAILVIEWBASIC', 'linklabel' => 'LBL_CHANGE_PASSWORD', 'linkurl' => "javascript:Users_Detail_Js.triggerChangePassword('index.php?module=Users&view=EditAjax&mode=changePassword&recordId={$recordId}','Users')", 'linkicon' => '');
}
foreach ($detailViewLinks as $detailViewLink) {
$linkModelList['DETAILVIEWBASIC'][] = Vtiger_Link_Model::getInstanceFromValues($detailViewLink);
}
$detailViewPreferenceLinks = array();
if (vglobal('systemMode') != 'demo') {
$detailViewPreferenceLinks[] = array('linktype' => 'DETAILVIEWPREFERENCE', 'linklabel' => 'LBL_CHANGE_PASSWORD', 'linkurl' => "javascript:Users_Detail_Js.triggerChangePassword('index.php?module=Users&view=EditAjax&mode=changePassword&recordId={$recordId}','Users')", 'linkicon' => '');
}
$detailViewPreferenceLinks[] = array('linktype' => 'DETAILVIEWPREFERENCE', 'linklabel' => 'LBL_EDIT', 'linkurl' => $recordModel->getPreferenceEditViewUrl(), 'linkicon' => '');
foreach ($detailViewPreferenceLinks as $detailViewLink) {
$linkModelList['DETAILVIEWPREFERENCE'][] = Vtiger_Link_Model::getInstanceFromValues($detailViewLink);
}
if ($currentUserModel->isAdminUser() && $currentUserModel->get('id') != $recordId) {
$detailViewActionLinks = array(array('linktype' => 'DETAILVIEW', 'linklabel' => 'LBL_DELETE', 'linkurl' => 'javascript:Users_Detail_Js.triggerDeleteUser("' . $recordModel->getDeleteUrl() . '")', 'linkicon' => ''));
foreach ($detailViewActionLinks as $detailViewLink) {
$linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($detailViewLink);
}
}
return $linkModelList;
}
}
示例4: initializeListViewContents
public function initializeListViewContents(Vtiger_Request $request, Vtiger_Viewer $viewer)
{
global $log;
$log->debug("Entering ./views/FindDuplicates.php::initializeListViewContents");
$currentUser = vglobal('current_user');
$viewer = $this->getViewer($request);
$module = $request->getModule();
$moduleModel = Vtiger_Module_Model::getInstance($module);
$massActionLink = array('linktype' => 'LISTVIEWBASIC', 'linklabel' => 'LBL_DELETE', 'linkurl' => 'Javascript:Vtiger_FindDuplicates_Js.massDeleteRecords("index.php?module=' . $module . '&action=MassDelete");', 'linkicon' => '');
$massActionLinks[] = Vtiger_Link_Model::getInstanceFromValues($massActionLink);
$viewer->assign('LISTVIEW_LINKS', $massActionLinks);
$viewer->assign('MODULE_MODEL', $moduleModel);
$pageNumber = $request->get('page');
if (empty($pageNumber)) {
$pageNumber = '1';
}
$pagingModel = new Vtiger_Paging_Model();
$pagingModel->set('page', $pageNumber);
$pageLimit = $pagingModel->getPageLimit();
$duplicateSearchFields = $request->get('fields');
$dataModelInstance = Vtiger_FindDuplicate_Model::getInstance($module);
$dataModelInstance->set('fields', $duplicateSearchFields);
$ignoreEmpty = $request->get('ignoreEmpty');
$ignoreEmptyValue = false;
if ($ignoreEmpty == 'on' || $ignoreEmpty == 'true' || $ignoreEmpty == '1') {
$ignoreEmptyValue = true;
}
$dataModelInstance->set('ignoreEmpty', $ignoreEmptyValue);
if (!$this->listViewEntries) {
$this->listViewEntries = $dataModelInstance->getListViewEntries($pagingModel);
}
if (!$this->listViewHeaders) {
$this->listViewHeaders = $dataModelInstance->getListViewHeaders();
}
if (!$this->rows) {
$this->rows = $dataModelInstance->getRecordCount();
$viewer->assign('TOTAL_COUNT', $this->rows);
}
$rowCount = 0;
foreach ($this->listViewEntries as $group) {
foreach ($group as $row) {
$rowCount++;
}
}
//for calculating the page range
for ($i = 0; $i < $rowCount; $i++) {
$dummyListEntries[] = $i;
}
$pagingModel->calculatePageRange($dummyListEntries);
$viewer->assign('IGNORE_EMPTY', $ignoreEmpty);
$viewer->assign('LISTVIEW_ENTRIES_COUNT', $rowCount);
$viewer->assign('LISTVIEW_HEADERS', $this->listViewHeaders);
$viewer->assign('LISTVIEW_ENTRIES', $this->listViewEntries);
$viewer->assign('PAGING_MODEL', $pagingModel);
$viewer->assign('PAGE_NUMBER', $pageNumber);
$viewer->assign('MODULE', $module);
$viewer->assign('DUPLICATE_SEARCH_FIELDS', $duplicateSearchFields);
$customViewModel = CustomView_Record_Model::getAllFilterByModule($module);
$viewer->assign('VIEW_NAME', $customViewModel->getId());
}
示例5: getDetailViewLinks
public function getDetailViewLinks($linkParams)
{
$linkModelList = parent::getDetailViewLinks($linkParams);
$currentUserModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$recordModel = $this->getRecord();
$moduleName = $recordModel->getModuleName();
foreach ($linkModelList as $kaytab => $linktab) {
foreach ($linktab as $kay => $link) {
if ($link->linklabel == 'LBL_EXPORT_TO_PDF' || $link->linklabel == 'LBL_SEND_MAIL_PDF') {
unset($linkModelList[$kaytab][$kay]);
}
}
}
$quotesModuleModel = Vtiger_Module_Model::getInstance('Quotes');
if ($currentUserModel->hasModuleActionPermission($quotesModuleModel->getId(), 'EditView')) {
$basicActionLink = array(
'linktype' => 'DETAILVIEWBASIC',
'linklabel' => '',
'linkurl' => "index.php?module=" . $quotesModuleModel->getName() . "&view=" . $quotesModuleModel->getEditViewName() . "&calculation_id=" . $recordModel->getId(),
'linkclass' => 'btn-success',
'linkimg' => 'layouts/vlayout/skins/images/Quotes.png',
'linkhint' => vtranslate('LBL_GENERATE_QUOTES', 'Quotes'),
);
$linkModelList['DETAILVIEWBASIC'][] = Vtiger_Link_Model::getInstanceFromValues($basicActionLink);
}
return $linkModelList;
}
示例6: getDetailViewLinks
/**
* Function to get the detail view links (links and widgets)
* @param <array> $linkParams - parameters which will be used to calicaulate the params
* @return <array> - array of link models in the format as below
* array('linktype'=>list of link models);
*/
public function getDetailViewLinks($linkParams)
{
$currentUserModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$linkModelList = parent::getDetailViewLinks($linkParams);
$recordModel = $this->getRecord();
if ($recordModel->getActiveStatusOfRecord()) {
$quotesModuleModel = Vtiger_Module_Model::getInstance('Quotes');
if ($currentUserModel->hasModuleActionPermission($quotesModuleModel->getId(), 'EditView')) {
$basicActionLink = array('linktype' => 'DETAILVIEW', 'linklabel' => '', 'linkurl' => $recordModel->getCreateQuoteUrl(), 'linkicon' => 'icon-briefcase', 'title' => vtranslate('LBL_CREATE') . ' ' . vtranslate($quotesModuleModel->getSingularLabelKey(), 'Quotes'));
$linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($basicActionLink);
}
$invoiceModuleModel = Vtiger_Module_Model::getInstance('Invoice');
if ($currentUserModel->hasModuleActionPermission($invoiceModuleModel->getId(), 'EditView')) {
$basicActionLink = array('linktype' => 'DETAILVIEW', 'linklabel' => '', 'linkurl' => $recordModel->getCreateInvoiceUrl(), 'linkicon' => 'icon-list-alt', 'title' => vtranslate('LBL_CREATE') . ' ' . vtranslate($invoiceModuleModel->getSingularLabelKey(), 'Invoice'));
$linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($basicActionLink);
}
$purchaseOrderModuleModel = Vtiger_Module_Model::getInstance('PurchaseOrder');
if ($currentUserModel->hasModuleActionPermission($purchaseOrderModuleModel->getId(), 'EditView')) {
$basicActionLink = array('linktype' => 'DETAILVIEW', 'linklabel' => '', 'linkurl' => $recordModel->getCreatePurchaseOrderUrl(), 'linkicon' => 'icon-barcode', 'title' => vtranslate('LBL_CREATE') . ' ' . vtranslate($purchaseOrderModuleModel->getSingularLabelKey(), 'PurchaseOrder'));
$linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($basicActionLink);
}
$salesOrderModuleModel = Vtiger_Module_Model::getInstance('SalesOrder');
if ($currentUserModel->hasModuleActionPermission($salesOrderModuleModel->getId(), 'EditView')) {
$basicActionLink = array('linktype' => 'DETAILVIEW', 'linklabel' => '', 'linkurl' => $recordModel->getCreateSalesOrderUrl(), 'linkicon' => 'icon-shopping-cart', 'title' => vtranslate('LBL_CREATE') . ' ' . vtranslate($salesOrderModuleModel->getSingularLabelKey(), 'SalesOrder'));
$linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($basicActionLink);
}
}
return $linkModelList;
}
示例7: getDetailViewLinks
/**
* Function to get the detail view links (links and widgets)
* @param <array> $linkParams - parameters which will be used to calicaulate the params
* @return <array> - array of link models in the format as below
* array('linktype'=>list of link models);
*/
public function getDetailViewLinks($linkParams)
{
$currentUserModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$recordModel = $this->getRecord();
$linkModelList = parent::getDetailViewLinks($linkParams);
$moduleModel = $this->getModule();
$recordId = $recordModel->getId();
//TODO: update the database so that these separate handlings are not required
$index = 0;
foreach ($linkModelList['DETAILVIEW'] as $link) {
if ($link->linklabel == 'View History' || $link->linklabel == 'Send SMS') {
unset($linkModelList['DETAILVIEW'][$index]);
} else {
if ($link->linklabel == 'LBL_SHOW_ACCOUNT_HIERARCHY') {
$link->linklabel = 'LBL_SHOW_ACCOUNT_HIERARCHY';
$linkURL = 'index.php?module=Accounts&view=AccountHierarchy&record=' . $recordId;
$link->linkurl = 'javascript:Accounts_Detail_Js.triggerAccountHierarchy("' . $linkURL . '");';
$link->linkclass = 'hierarchy';
unset($linkModelList['DETAILVIEW'][$index]);
$linkModelList['DETAILVIEW'][$index] = $link;
}
}
$index++;
}
if ($currentUserModel->hasModuleActionPermission($moduleModel->getId(), 'DetailTransferOwnership')) {
$massActionLink = array('linktype' => 'LISTVIEWMASSACTION', 'linklabel' => 'LBL_TRANSFER_OWNERSHIP', 'linkurl' => 'javascript:Vtiger_Detail_Js.triggerTransferOwnership("index.php?module=' . $moduleModel->getName() . '&view=MassActionAjax&mode=transferOwnership")', 'linkicon' => 'glyphicon glyphicon-random');
$linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($massActionLink);
}
return $linkModelList;
}
示例8: getListViewLinks
/**
* Function to get the list of listview links for the module
* @param <Array> $linkParams
* @return <Array> - Associate array of Link Type to List of Vtiger_Link_Model instances
*/
public function getListViewLinks($linkParams)
{
$currentUserModel = Users_Record_Model::getCurrentUserModel();
$moduleModel = $this->getModule();
$linkTypes = array('LISTVIEWBASIC', 'LISTVIEW', 'LISTVIEWSETTING');
$links = Vtiger_Link_Model::getAllByType($moduleModel->getId(), $linkTypes, $linkParams);
$basicLinks = array();
$createPermission = Users_Privileges_Model::isPermitted($moduleModel->getName(), 'EditView');
if ($createPermission) {
$basicLinks[] = array('linktype' => 'LISTVIEWBASIC', 'linklabel' => 'LBL_ADD_RECORD', 'linkurl' => $moduleModel->getCreateRecordUrl(), 'linkicon' => '');
}
foreach ($basicLinks as $basicLink) {
$links['LISTVIEWBASIC'][] = Vtiger_Link_Model::getInstanceFromValues($basicLink);
}
$advancedLinks = array();
foreach ($advancedLinks as $advancedLink) {
$links['LISTVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($advancedLink);
}
if ($currentUserModel->isAdminUser()) {
$settingsLinks = $this->getSettingLinks();
foreach ($settingsLinks as $settingsLink) {
$links['LISTVIEWSETTING'][] = Vtiger_Link_Model::getInstanceFromValues($settingsLink);
}
}
return $links;
}
示例9: getDetailViewLinks
public function getDetailViewLinks($linkParams)
{
$linkTypes = array('DETAILVIEWBASIC', 'DETAILVIEW');
$moduleModel = $this->getModule();
$recordModel = $this->getRecord();
$recordId = $recordModel->getId();
$linkModelListDetails = Vtiger_Link_Model::getAllByType($moduleModel->getId(), $linkTypes, $linkParams);
//Mark all detail view basic links as detail view links.
//Since ui will be look ugly if you need many basic links
$detailViewBasiclinks = $linkModelListDetails['DETAILVIEWBASIC'];
unset($linkModelListDetails['DETAILVIEWBASIC']);
/*
if(Users_Privileges_Model::isPermitted($moduleName, 'Delete', $recordId) && $recordPermissionToEditView) {
$deletelinkModel = array(
'linktype' => 'DETAILVIEW',
'linklabel' => sprintf("%s %s", getTranslatedString('LBL_DELETE', $moduleName), vtranslate('SINGLE_'. $moduleName, $moduleName)),
'linkurl' => 'javascript:Vtiger_Detail_Js.deleteRecord("'.$recordModel->getDeleteUrl().'")',
'linkicon' => ''
);
$linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($deletelinkModel);
}
*/
if (!empty($detailViewBasiclinks)) {
foreach ($detailViewBasiclinks as $linkModel) {
// Remove view history, needed in vtiger5 to see history but not in vtiger6
if ($linkModel->linklabel == 'View History') {
continue;
}
$linkModelList['DETAILVIEW'][] = $linkModel;
}
}
return $linkModelList;
}
示例10: getWidgets
/**
* Function to get the detail view widgets
* @return <Array> - List of widgets , where each widget is an Vtiger_Link_Model
*/
public function getWidgets()
{
$userPrivilegesModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$widgetLinks = parent::getWidgets();
$widgets = array();
$helpDeskInstance = Vtiger_Module_Model::getInstance('HelpDesk');
if ($userPrivilegesModel->hasModuleActionPermission($helpDeskInstance->getId(), 'DetailView')) {
$createPermission = $userPrivilegesModel->hasModuleActionPermission($helpDeskInstance->getId(), 'EditView');
$widgets[] = array('linktype' => 'DETAILVIEWWIDGET', 'linklabel' => 'HelpDesk', 'linkName' => $helpDeskInstance->getName(), 'linkurl' => 'module=' . $this->getModuleName() . '&view=Detail&record=' . $this->getRecord()->getId() . '&relatedModule=HelpDesk&mode=showRelatedRecords&page=1&limit=5', 'action' => $createPermission == true ? array('Add') : array(), 'actionURL' => $helpDeskInstance->getQuickCreateUrl());
}
$projectMileStoneInstance = Vtiger_Module_Model::getInstance('ProjectMilestone');
if ($userPrivilegesModel->hasModuleActionPermission($projectMileStoneInstance->getId(), 'DetailView')) {
$createPermission = $userPrivilegesModel->hasModuleActionPermission($projectMileStoneInstance->getId(), 'EditView');
$widgets[] = array('linktype' => 'DETAILVIEWWIDGET', 'linklabel' => 'LBL_MILESTONES', 'linkName' => $projectMileStoneInstance->getName(), 'linkurl' => 'module=' . $this->getModuleName() . '&view=Detail&record=' . $this->getRecord()->getId() . '&relatedModule=ProjectMilestone&mode=showRelatedRecords&page=1&limit=5', 'action' => $createPermission == true ? array('Add') : array(), 'actionURL' => $projectMileStoneInstance->getQuickCreateUrl());
}
$projectTaskInstance = Vtiger_Module_Model::getInstance('ProjectTask');
if ($userPrivilegesModel->hasModuleActionPermission($projectTaskInstance->getId(), 'DetailView')) {
$createPermission = $userPrivilegesModel->hasModuleActionPermission($projectTaskInstance->getId(), 'EditView');
$widgets[] = array('linktype' => 'DETAILVIEWWIDGET', 'linklabel' => 'LBL_TASKS', 'linkName' => $projectTaskInstance->getName(), 'linkurl' => 'module=' . $this->getModuleName() . '&view=Detail&record=' . $this->getRecord()->getId() . '&relatedModule=ProjectTask&mode=showRelatedRecords&page=1&limit=5', 'action' => $createPermission == true ? array('Add') : array(), 'actionURL' => $projectTaskInstance->getQuickCreateUrl());
}
$documentsInstance = Vtiger_Module_Model::getInstance('Documents');
if ($userPrivilegesModel->hasModuleActionPermission($documentsInstance->getId(), 'DetailView')) {
$createPermission = $userPrivilegesModel->hasModuleActionPermission($documentsInstance->getId(), 'EditView');
$widgets[] = array('linktype' => 'DETAILVIEWWIDGET', 'linklabel' => 'Documents', 'linkName' => $documentsInstance->getName(), 'linkurl' => 'module=' . $this->getModuleName() . '&view=Detail&record=' . $this->getRecord()->getId() . '&relatedModule=Documents&mode=showRelatedRecords&page=1&limit=5', 'action' => $createPermission == true ? array('Add') : array(), 'actionURL' => $documentsInstance->getQuickCreateUrl());
}
foreach ($widgets as $widgetDetails) {
$widgetLinks[] = Vtiger_Link_Model::getInstanceFromValues($widgetDetails);
}
return $widgetLinks;
}
示例11: getDetailViewLinks
/**
* Function to get the detail view links (links and widgets)
* @param <array> $linkParams - parameters which will be used to calicaulate the params
* @return <array> - array of link models in the format as below
* array('linktype'=>list of link models);
*/
public function getDetailViewLinks($linkParams)
{
$linkModelList = Vtiger_DetailView_Model::getDetailViewLinks($linkParams);
$recordModel = $this->getRecord();
$moduleModel = $this->getModule();
$moduleName = $moduleModel->getName();
$recordId = $recordModel->getId();
//TODO: update the database so that these separate handlings are not required
$index = 0;
foreach ($linkModelList['DETAILVIEW'] as $link) {
if ($link->linklabel == 'View History' || $link->linklabel == 'Send SMS') {
unset($linkModelList['DETAILVIEW'][$index]);
} else {
if ($link->linklabel == 'LBL_SHOW_ACCOUNT_HIERARCHY') {
$link->linklabel = 'LBL_SHOW_ACCOUNT_HIERARCHY';
$linkURL = 'index.php?module=Accounts&view=AccountHierarchy&record=' . $recordId;
$link->linkurl = 'javascript:Accounts_Detail_Js.triggerAccountHierarchy("' . $linkURL . '");';
unset($linkModelList['DETAILVIEW'][$index]);
$linkModelList['DETAILVIEW'][$index] = $link;
}
}
$index++;
}
if (Users_Privileges_Model::isPermitted($moduleModel->getName(), 'ConvertLead', $recordModel->getId()) && Users_Privileges_Model::isPermitted($moduleModel->getName(), 'EditView', $recordModel->getId())) {
$convert = !Leads_Module_Model::checkIfAllowedToConvert($recordModel->get('leadstatus')) ? 'hide' : '';
$basicActionLink = array('linktype' => 'DETAILVIEWBASIC', 'linklabel' => '', 'linkclass' => 'btn-info btn-convertLead ' . $convert, 'linkhint' => vtranslate('LBL_CONVERT_LEAD', $moduleName), 'linkurl' => 'javascript:Leads_Detail_Js.convertLead("' . $recordModel->getConvertLeadUrl() . '",this);', 'linkicon' => 'glyphicon glyphicon-transfer');
$linkModelList['DETAILVIEWBASIC'][] = Vtiger_Link_Model::getInstanceFromValues($basicActionLink);
}
return $linkModelList;
}
示例12: getEditViewLinks
/**
* Function to get the list of listview links for the module
* @param <Array> $linkParams
* @return <Array> - Associate array of Link Type to List of Vtiger_Link_Model instances
*/
public function getEditViewLinks($linkParams)
{
global $log;
$log->debug("Entering ./models/EditView.php::getEditViewLinks");
$currentUserModel = Users_Record_Model::getCurrentUserModel();
$linkTypes = array('LISTVIEWQUICK', 'LISTVIEWQUICKWIDGET', 'LISTVIEWBASIC', 'LISTVIEW', 'LISTVIEWSETTING');
$links = Vtiger_Link_Model::getAllByType($this->getModule()->getId(), $linkTypes, $linkParams);
$quickLinks = array(array('linktype' => 'LISTVIEWQUICK', 'linklabel' => 'Dashboard', 'linkurl' => $this->getModule()->getDefaultUrl(), 'linkicon' => ''), array('linktype' => 'LISTVIEWQUICK', 'linklabel' => $this->getModule()->get('label') . ' List', 'linkurl' => $this->getModule()->getDefaultUrl(), 'linkicon' => ''));
foreach ($quickLinks as $quickLink) {
$links['LISTVIEWQUICK'][] = Vtiger_Link_Model::getInstanceFromValues($quickLink);
}
$quickWidgets = array(array('linktype' => 'LISTVIEWQUICKWIDGET', 'linklabel' => 'Active ' . $this->getModule()->get('label'), 'linkurl' => 'module=' . $this->getModule()->get('name') . '&view=List&mode=showActiveRecords', 'linkicon' => ''));
foreach ($quickWidgets as $quickWidget) {
$links['LISTVIEWQUICKWIDGET'][] = Vtiger_Link_Model::getInstanceFromValues($quickWidget);
}
$basicLinks = array(array('linktype' => 'LISTVIEWBASIC', 'linklabel' => 'Add ' . $this->getModule()->get('name'), 'linkurl' => $this->getModule()->getCreateRecordUrl(), 'linkicon' => ''));
foreach ($basicLinks as $basicLink) {
$links['LISTVIEWBASIC'][] = Vtiger_Link_Model::getInstanceFromValues($basicLink);
}
$advancedLinks = array(array('linktype' => 'LISTVIEW', 'linklabel' => 'Import', 'linkurl' => $this->getModule()->getImportUrl(), 'linkicon' => ''), array('linktype' => 'LISTVIEW', 'linklabel' => 'Export', 'linkurl' => $this->getModule()->getExportUrl(), 'linkicon' => ''), array('linktype' => 'LISTVIEW', 'linklabel' => 'Find Duplicates', 'linkurl' => $this->getModule()->getFindDuplicatesUrl(), 'linkicon' => ''));
foreach ($advancedLinks as $advancedLink) {
$links['LISTVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($advancedLink);
}
if ($currentUserModel->isAdminUser()) {
$settingsLinks = array(array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'Edit Fields', 'linkurl' => $this->getModule()->getSettingsUrl('LayoutEditor'), 'linkicon' => ''), array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'Edit Workflows', 'linkurl' => $this->getModule()->getSettingsUrl('EditWorkflows'), 'linkicon' => ''), array('linktype' => 'LISTVIEWSETTING', 'linklabel' => 'Edit Picklist Values', 'linkurl' => $this->getModule()->getSettingsUrl('PicklistEditor'), 'linkicon' => ''));
foreach ($settingsLinks as $settingsLink) {
$links['LISTVIEWSETTING'][] = Vtiger_Link_Model::getInstanceFromValues($settingsLink);
}
}
return $links;
}
示例13: getListViewMassActions
/**
* Overrided to remove Mass Edit Option
*/
public function getListViewMassActions($linkParams)
{
$currentUserModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$moduleModel = $this->getModule();
$linkTypes = array('LISTVIEWMASSACTION');
$links = Vtiger_Link_Model::getAllByType($moduleModel->getId(), $linkTypes, $linkParams);
return $links;
}
示例14: getListViewLinks
/**
* Function to get the list of listview links
* @param <Array> $linkParams Parameters to be replaced in the link template
* @return <Array> - an array of Vtiger_Link_Model instances
*/
public function getListViewLinks($linkParams)
{
$links = parent::getListViewLinks($linkParams);
$quickLinks = array(array('linktype' => 'LISTVIEWQUICK', 'linklabel' => 'Tasks List', 'linkurl' => $this->getModule()->getDefaultUrl(), 'linkicon' => ''));
foreach ($quickLinks as $quickLink) {
$links['LISTVIEWQUICK'][] = Vtiger_Link_Model::getInstanceFromValues($quickLink);
}
return $links;
}
示例15: getRecordLinks
/**
* Function to get record links
* @return <Array> list of link models <Vtiger_Link_Model>
*/
public function getRecordLinks()
{
$links = array();
$recordLinks = array(array('linktype' => 'LISTVIEWRECORD', 'linklabel' => 'LBL_EDIT', 'linkurl' => $this->getEditViewUrl(), 'linkicon' => 'glyphicon glyphicon-pencil'), array('linktype' => 'LISTVIEWRECORD', 'linklabel' => 'LBL_DELETE', 'linkurl' => $this->getDeleteUrl(), 'linkicon' => 'glyphicon glyphicon-trash'));
foreach ($recordLinks as $recordLink) {
$links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);
}
return $links;
}