本文整理汇总了PHP中Users_Privileges_Model类的典型用法代码示例。如果您正苦于以下问题:PHP Users_Privileges_Model类的具体用法?PHP Users_Privileges_Model怎么用?PHP Users_Privileges_Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Users_Privileges_Model类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: checkPermission
public function checkPermission(Vtiger_Request $request)
{
$moduleName = "Emails";
if (!Users_Privileges_Model::isPermitted($moduleName, 'EditView')) {
throw new AppException('LBL_PERMISSION_DENIED');
}
}
示例2: preProcess
public function preProcess(Vtiger_Request $request, $display = true)
{
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
$viewer->assign('QUALIFIED_MODULE', $moduleName);
Vtiger_Basic_View::preProcess($request, false);
$viewer = $this->getViewer($request);
$moduleName = $request->getModule();
if (!empty($moduleName)) {
//$moduleModel = PDFMaker_PDFMaker_Model::getInstance($moduleName);
$moduleModel = new PDFMaker_PDFMaker_Model('PDFMaker');
$currentUser = Users_Record_Model::getCurrentUserModel();
$userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
$permission = $userPrivilegesModel->hasModulePermission($moduleModel->getId());
$viewer->assign('MODULE', $moduleName);
if (!$permission) {
$viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
$viewer->view('OperationNotPermitted.tpl', $moduleName);
exit;
}
$linkParams = array('MODULE' => $moduleName, 'ACTION' => $request->get('view'));
$linkModels = $moduleModel->getSideBarLinks($linkParams);
$viewer->assign('QUICK_LINKS', $linkModels);
}
$viewer->assign('CURRENT_USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->assign('CURRENT_VIEW', $request->get('view'));
if ($display) {
$this->preProcessDisplay($request);
}
}
示例3: preProcess
public function preProcess(Vtiger_Request $request)
{
parent::preProcess($request);
$viewer = $this->getViewer($request);
$record = $request->get('record');
$moduleName = $request->getModule();
$reportModel = Reports_Record_Model::getCleanInstance($record);
$primaryModule = $reportModel->getPrimaryModule();
$primaryModuleModel = Vtiger_Module_Model::getInstance($primaryModule);
if ($primaryModuleModel) {
$currentUser = Users_Record_Model::getCurrentUserModel();
$userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
$permission = $userPrivilegesModel->hasModulePermission($primaryModuleModel->getId());
if (!$permission) {
$viewer->assign('MODULE', $primaryModule);
$viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
$viewer->view('OperationNotPermitted.tpl', $primaryModule);
exit;
}
}
$viewer->assign('REPORT_MODEL', $reportModel);
$viewer->assign('RECORD_ID', $record);
$viewer->assign('MODULE', $moduleName);
$viewer->assign('VIEW', 'ChartEdit');
$viewer->assign('RECORD_MODE', $request->getMode());
$viewer->view('EditChartHeader.tpl', $request->getModule());
}
示例4: 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;
}
示例5: getRumorsByStatus
/**
* Function returns Rumors grouped by Status
* @param type $data
* @return <Array>
*/
public function getRumorsByStatus($owner, $dateFilter)
{
$db = PearDatabase::getInstance();
$ownerSql = $this->getOwnerWhereConditionForDashBoards($owner);
if (!empty($ownerSql)) {
$ownerSql = ' AND ' . $ownerSql;
}
$params = array();
if (!empty($dateFilter)) {
$dateFilterSql = ' AND createdtime BETWEEN ? AND ? ';
//client is not giving time frame so we are appending it
$params[] = $dateFilter['start'] . ' 00:00:00';
$params[] = $dateFilter['end'] . ' 23:59:59';
}
$result = $db->pquery('SELECT COUNT(*) as count, CASE WHEN vtiger_rumors.rumor_status IS NULL OR vtiger_rumors.rumor_status = "" THEN "" ELSE vtiger_rumors.rumor_status END AS statusvalue
FROM vtiger_rumors INNER JOIN vtiger_crmentity ON vtiger_rumors.rumorsid = vtiger_crmentity.crmid AND vtiger_crmentity.deleted=0
' . Users_Privileges_Model::getNonAdminAccessControlQuery($this->getName()) . $ownerSql . ' ' . $dateFilterSql . ' INNER JOIN vtiger_rumor_status ON vtiger_rumors.rumor_status = vtiger_rumor_status.rumor_status GROUP BY statusvalue ORDER BY vtiger_rumor_status.sortorderid', $params);
$response = array();
for ($i = 0; $i < $db->num_rows($result); $i++) {
$row = $db->query_result_rowdata($result, $i);
$response[$i][0] = $row['count'];
$rumorStatusVal = $row['statusvalue'];
if ($rumorStatusVal == '') {
$rumorStatusVal = 'LBL_BLANK';
}
$response[$i][1] = vtranslate($rumorStatusVal, $this->getName());
$response[$i][2] = $rumorStatusVal;
}
return $response;
}
示例6: 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;
}
示例7: checkPermission
public function checkPermission(Vtiger_Request $request)
{
$moduleName = $request->getModule();
if (!Users_Privileges_Model::isPermitted($moduleName, 'ExportPdf')) {
throw new NoPermittedException('LBL_PERMISSION_DENIED');
}
}
示例8: process
function process(Vtiger_Request $request)
{
$currentUserPriviligeModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$viewer = $this->getViewer($request);
$recordId = $request->get('record');
$moduleName = $request->getModule();
$recordModel = Vtiger_Record_Model::getInstanceById($recordId);
$moduleModel = $recordModel->getModule();
$viewer->assign('MODULE', $moduleName);
$viewer->assign('USER_MODEL', Users_Record_Model::getCurrentUserModel());
$viewer->assign('CURRENT_USER_PRIVILEGE', $currentUserPriviligeModel);
$viewer->assign('RECORD', $recordModel);
$viewer->assign('CONVERT_LEAD_FIELDS', $recordModel->getConvertLeadFields());
$assignedToFieldModel = $moduleModel->getField('assigned_user_id');
$assignedToFieldModel->set('fieldvalue', $recordModel->get('assigned_user_id'));
$viewer->assign('ASSIGN_TO', $assignedToFieldModel);
$potentialModuleModel = Vtiger_Module_Model::getInstance('Potentials');
$accountField = Vtiger_Field_Model::getInstance('related_to', $potentialModuleModel);
$contactField = Vtiger_Field_Model::getInstance('contact_id', $potentialModuleModel);
$viewer->assign('ACCOUNT_FIELD_MODEL', $accountField);
$viewer->assign('CONTACT_FIELD_MODEL', $contactField);
$contactsModuleModel = Vtiger_Module_Model::getInstance('Contacts');
$accountField = Vtiger_Field_Model::getInstance('parent_id', $contactsModuleModel);
$viewer->assign('CONTACT_ACCOUNT_FIELD_MODEL', $accountField);
$state = Settings_Leads_ConvertToAccount_Model::getState();
$viewer->assign('STATE', $state);
$viewer->view('ConvertLead.tpl', $moduleName);
}
示例9: 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;
}
示例10: getDetailViewLinks
/**
* Overrided to remove Edit button, Duplicate button
* To remove related links
*/
public function getDetailViewLinks($linkParams)
{
$linkTypes = array('DETAILVIEWBASIC', 'DETAILVIEW');
$moduleModel = $this->getModule();
$recordModel = $this->getRecord();
$moduleName = $moduleModel->getName();
$recordId = $recordModel->getId();
$detailViewLink = array();
$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)) {
$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;
}
}
$widgets = $this->getWidgets();
foreach ($widgets as $widgetLinkModel) {
$linkModelList['DETAILVIEWWIDGET'][] = $widgetLinkModel;
}
return $linkModelList;
}
示例11: checkPermission
public function checkPermission(Vtiger_Request $request)
{
$moduleName = $request->getModule();
if (!Users_Privileges_Model::isPermitted($moduleName, 'DetailView', $request->get('record'))) {
throw new NoPermittedToRecordException(vtranslate('LBL_PERMISSION_DENIED', $moduleName));
}
}
示例12: checkPermission
public function checkPermission(Vtiger_Request $request)
{
$moduleName = $request->getModule();
if (!Users_Privileges_Model::isPermitted($moduleName, 'RecordMappingList') || !Users_Privileges_Model::isPermitted($moduleName, 'EditView')) {
throw new NoPermittedException('LBL_PERMISSION_DENIED');
}
}
示例13: preProcess
public function preProcess(Vtiger_Request $request)
{
$mode = $request->get('mode');
if ($mode == "ChangeSteps") {
$display = false;
} else {
$display = true;
}
parent::preProcess($request, $display);
$viewer = $this->getViewer($request);
$record = $request->get('record');
$reportModel = ITS4YouReports_Record_Model::getCleanInstance($record);
$primaryModule = $reportModel->getPrimaryModule();
$primaryModuleModel = Vtiger_Module_Model::getInstance($primaryModule);
if ($primaryModuleModel) {
$currentUser = Users_Record_Model::getCurrentUserModel();
$userPrivilegesModel = Users_Privileges_Model::getInstanceById($currentUser->getId());
$permission = $userPrivilegesModel->hasModulePermission($primaryModuleModel->getId());
if (!$permission) {
$viewer->assign('MODULE', $primaryModule);
$viewer->assign('MESSAGE', 'LBL_PERMISSION_DENIED');
$viewer->view('OperationNotPermitted.tpl', $primaryModule);
exit;
}
}
$viewer->assign('RECORD_MODE', $mode);
}
示例14: 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() {
$currentUserModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$massActionLinks = array();
if($currentUserModel->isAdminUser()) {
$massActionLinks[] = array(
'linktype' => 'LISTVIEWMASSACTION',
'linklabel' => 'LBL_DELETE',
'linkurl' => 'javascript:RecycleBin_List_Js.deleteRecords("index.php?module='.$this->get('name').'&action=RecycleBinAjax")',
'linkicon' => ''
);
}
$massActionLinks[] = array(
'linktype' => 'LISTVIEWMASSACTION',
'linklabel' => 'LBL_RESTORE',
'linkurl' => 'javascript:RecycleBin_List_Js.restoreRecords("index.php?module='.$this->get('name').'&action=RecycleBinAjax")',
'linkicon' => ''
);
foreach($massActionLinks as $massActionLink) {
$links[] = Vtiger_Link_Model::getInstanceFromValues($massActionLink);
}
return $links;
}
示例15: 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;
}