예제 #1
0
 /**
  * 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
0
 /**
  * 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
0
 /**
  * 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
0
 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
0
	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
0
 /**
  * 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
0
 /**
  * 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
0
 /**
  * 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
0
 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
0
 /**
  * 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
0
 /**
  * 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
0
 /**
  * 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
0
 /**
  * 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
0
 /**
  * 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
0
 /**
  * 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;
 }
예제 #16
0
 /**
  * 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' => 'icon-pencil'), array('linktype' => 'LISTVIEWRECORD', 'linklabel' => 'LBL_DELETE', 'linkurl' => "javascript:Settings_Vtiger_List_Js.triggerDelete(event,'" . $this->getDeleteUrl() . "');", 'linkicon' => 'icon-trash'));
     foreach ($recordLinks as $recordLink) {
         $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);
     }
     return $links;
 }
예제 #17
0
 /**
  * Function to get record links
  * @return <Array> List of link models <Vtiger_Link_Model>
  */
 public function getRecordLinks()
 {
     $qualifiedModuleName = 'Settings::MailConverter';
     $recordLinks = array(array('linktype' => 'LISTVIEW', 'linklabel' => vtranslate('LBL_EDIT', $qualifiedModuleName) . ' ' . vtranslate('RULE', $qualifiedModuleName), 'linkurl' => $this->getEditViewUrl(), 'linkicon' => 'icon-pencil icon-white'), array('linktype' => 'LISTVIEW', 'linklabel' => vtranslate('LBL_DELETE', $qualifiedModuleName) . ' ' . vtranslate('RULE', $qualifiedModuleName), 'linkurl' => $this->getDeleteUrl(), 'linkicon' => 'icon-trash icon-white'));
     foreach ($recordLinks as $recordLink) {
         $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);
     }
     return $links;
 }
예제 #18
0
 public function getRecordLinks()
 {
     $links = array();
     $recordLinks = array();
     foreach ($recordLinks as $recordLink) {
         $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);
     }
     return $links;
 }
예제 #19
0
 /**
  * Function to get the list view actions for the record
  * @return <Array> - Associate array of Vtiger_Link_Model instances
  */
 public function getRecordLinks()
 {
     $links = [];
     $recordLinks = [['linktype' => 'LISTVIEWRECORD', 'linklabel' => 'LBL_EDIT_RECORD', 'linkurl' => $this->getEditViewUrl(), 'linkicon' => 'glyphicon glyphicon-pencil'], ['linktype' => 'LISTVIEWRECORD', 'linklabel' => 'LBL_EXPORT_RECORD', 'linkurl' => 'index.php?module=MappedFields&parent=Settings&action=ExportTemplate&id=' . $this->getId(), 'linkicon' => 'glyphicon glyphicon-export'], ['linktype' => 'LISTVIEWRECORD', 'linklabel' => 'LBL_DELETE_RECORD', 'class' => 'deleteMap', 'linkicon' => 'glyphicon glyphicon-trash']];
     foreach ($recordLinks as $recordLink) {
         $links[] = Vtiger_Link_Model::getInstanceFromValues($recordLink);
     }
     return $links;
 }
예제 #20
0
 /**
  * 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)
 {
     $linkTypes = array('LISTVIEWBASIC', 'LISTVIEW', 'LISTVIEWSETTING');
     $links = Vtiger_Link_Model::getAllByType($this->getModule()->getId(), $linkTypes, $linkParams);
     $basicLinks = array(array('linktype' => 'LISTVIEWBASIC', 'linklabel' => 'LBL_ADD_RECORD', 'linkurl' => $this->getModule()->getCreateRecordUrl(), 'linkicon' => ''));
     foreach ($basicLinks as $basicLink) {
         $links['LISTVIEWBASIC'][] = Vtiger_Link_Model::getInstanceFromValues($basicLink);
     }
     return $links;
 }
예제 #21
0
파일: Module.php 프로젝트: Wasage/werpa
    public function getSideBarLinks($linkParams) {
		$quickLink = array(
            'linktype' => 'SIDEBARLINK',
            'linklabel' => 'LBL_OUR_SITES_LIST',
            'linkurl' => $this->getListViewUrl(),
            'linkicon' => '',
		);
        $links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues($quickLink);
		return $links;
	}
예제 #22
0
 /**
  * Function to get the Quick Links for the module
  * @param <Array> $linkParams
  * @return <Array> List of Vtiger_Link_Model instances
  */
 public function getSideBarLinks($linkParams)
 {
     $linkTypes = array('SIDEBARLINK', 'SIDEBARWIDGET');
     $links = Vtiger_Link_Model::getAllByType($this->getId(), $linkTypes, $linkParams);
     $quickLinks = array(array('linktype' => 'SIDEBARLINK', 'linklabel' => 'LBL_RECORDS_LIST', 'linkurl' => $this->getDefaultUrl(), 'linkicon' => ''));
     foreach ($quickLinks as $quickLink) {
         $links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues($quickLink);
     }
     return $links;
 }
예제 #23
0
 public function getSideBarLinks($linkParams)
 {
     $linkTypes = array('SIDEBARLINK', 'SIDEBARWIDGET');
     $links = parent::getSideBarLinks($linkParams);
     $quickLinks = array(array('linktype' => 'SIDEBARLINK', 'linklabel' => 'LBL_TASKS_LIST', 'linkurl' => $this->getTasksListUrl(), 'linkicon' => ''), array('linktype' => 'SIDEBARLINK', 'linklabel' => 'LBL_MILESTONES_LIST', 'linkurl' => $this->getMilestonesListUrl(), 'linkicon' => ''), array('linktype' => 'SIDEBARLINK', 'linklabel' => 'LBL_DASHBOARD', 'linkurl' => $this->getDashBoardUrl(), 'linkicon' => ''));
     foreach ($quickLinks as $quickLink) {
         $links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues($quickLink);
     }
     return $links;
 }
예제 #24
0
 public function getSideBarLinks($linkParams)
 {
     $linkTypes = array('SIDEBARLINK', 'SIDEBARWIDGET');
     $links = parent::getSideBarLinks($linkParams);
     unset($links['SIDEBARLINK']);
     $quickLinks = array(array('linktype' => 'SIDEBARLINK', 'linklabel' => 'LBL_PROJECTS_LIST', 'linkurl' => $this->getProjectsListUrl(), 'linkicon' => ''), array('linktype' => 'SIDEBARLINK', 'linklabel' => 'LBL_TASKS_LIST', 'linkurl' => $this->getListViewUrl(), 'linkicon' => ''));
     foreach ($quickLinks as $quickLink) {
         $links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues($quickLink);
     }
     return $links;
 }
예제 #25
0
 /**
  * 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)
 {
     $massActionLinks = parent::getListViewMassActions($linkParams);
     $currentUserModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
     $emailModuleModel = Vtiger_Module_Model::getInstance('Emails');
     if ($currentUserModel->hasModulePermission($emailModuleModel->getId())) {
         $massActionLink = array('linktype' => 'LISTVIEWMASSACTION', 'linklabel' => 'LBL_SEND_EMAIL', 'linkurl' => 'javascript:Vtiger_List_Js.triggerSendEmail("index.php?module=' . $this->getModule()->getName() . '&view=MassActionAjax&mode=showComposeEmailForm&step=step1","Emails");', 'linkicon' => '');
         $massActionLinks['LISTVIEWMASSACTION'][] = Vtiger_Link_Model::getInstanceFromValues($massActionLink);
     }
     return $massActionLinks;
 }
예제 #26
0
 /**
  * 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 = parent::getDetailViewLinks($linkParams);
     $recordModel = $this->getRecord();
     $moduleName = $recordModel->getmoduleName();
     if (Users_Privileges_Model::isPermitted($moduleName, 'DetailView', $recordModel->getId())) {
         $sendEmailLink = array('linklabel' => '', 'linkurl' => 'javascript:Inventory_Detail_Js.sendEmailPDFClickHandler(\'' . $recordModel->getSendEmailPDFUrl() . '\')', 'linkicon' => 'icon-envelope', 'title' => vtranslate('LBL_SEND_MAIL_PDF', $moduleName));
         $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($sendEmailLink);
     }
     return $linkModelList;
 }
예제 #27
0
 public function getRecordLinks()
 {
     $soureModule = $this->get('sourceModule');
     $sourceField = $this->get('sourcefield');
     $targetField = $this->get('targetfield');
     $editLink = array('linkurl' => "javascript:Settings_PickListDependency_Js.triggerEdit(event, '{$soureModule}', '{$sourceField}', '{$targetField}')", 'linklabel' => 'LBL_EDIT', 'linkicon' => 'icon-pencil');
     $editLinkInstance = Vtiger_Link_Model::getInstanceFromValues($editLink);
     $deleteLink = array('linkurl' => "javascript:Settings_PickListDependency_Js.triggerDelete(event, '{$soureModule}','{$sourceField}', '{$targetField}')", 'linklabel' => 'LBL_DELETE', 'linkicon' => 'icon-trash');
     $deleteLinkInstance = Vtiger_Link_Model::getInstanceFromValues($deleteLink);
     return array($editLinkInstance, $deleteLinkInstance);
 }
예제 #28
0
 function getSideBarLinks()
 {
     $quickLinks = array();
     $quickLinks[] = array('linktype' => 'SIDEBARLINK', 'linklabel' => 'LBL_RECORDS_LIST', 'linkurl' => $this->getListViewUrl(), 'linkicon' => '');
     if (Vtiger_DashBoard_Model::verifyDashboard($this->getName())) {
         $quickLinks[] = array('linktype' => 'SIDEBARLINK', 'linklabel' => 'LBL_DASHBOARD', 'linkurl' => $this->getDashBoardUrl(), 'linkicon' => '');
     }
     foreach ($quickLinks as $quickLink) {
         $links['SIDEBARLINK'][] = Vtiger_Link_Model::getInstanceFromValues($quickLink);
     }
     return $links;
 }
예제 #29
0
 /**
  * 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();
     $quotesModuleModel = Vtiger_Module_Model::getInstance('Faq');
     if ($currentUserModel->hasModuleActionPermission($quotesModuleModel->getId(), 'DetailView')) {
         $basicActionLink = array('linktype' => 'DETAILVIEW', 'linklabel' => 'LBL_CONVERT_FAQ', 'linkurl' => $recordModel->getConvertFAQUrl(), 'linkicon' => '');
         $linkModelList['DETAILVIEW'][] = Vtiger_Link_Model::getInstanceFromValues($basicActionLink);
     }
     return $linkModelList;
 }
예제 #30
0
 public function getRecordLinks()
 {
     if ($this->isBaseCurrency()) {
         //NO Edit and delete link for base currency
         return array();
     }
     $editLink = array('linkurl' => "javascript:Settings_Currency_Js.triggerEdit(event, '" . $this->getId() . "')", 'linklabel' => 'LBL_EDIT', 'linkicon' => 'glyphicon glyphicon-pencil');
     $editLinkInstance = Vtiger_Link_Model::getInstanceFromValues($editLink);
     $deleteLink = array('linkurl' => "javascript:Settings_Currency_Js.triggerDelete(event,'" . $this->getId() . "')", 'linklabel' => 'LBL_DELETE', 'linkicon' => 'glyphicon glyphicon-trash');
     $deleteLinkInstance = Vtiger_Link_Model::getInstanceFromValues($deleteLink);
     return array($editLinkInstance, $deleteLinkInstance);
 }