本文整理汇总了PHP中Users_Privileges_Model类的典型用法代码示例。如果您正苦于以下问题:PHP Users_Privileges_Model类的具体用法?PHP Users_Privileges_Model怎么用?PHP Users_Privileges_Model使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Users_Privileges_Model类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: checkPermission
public function checkPermission(Vtiger_Request $request)
{
$moduleName = "Emails";
if (!Users_Privileges_Model::isPermitted($moduleName, 'EditView')) {
throw new AppException('LBL_PERMISSION_DENIED');
}
}
开发者ID:cin-system,项目名称:cinrepo,代码行数:7,代码来源:SendEmail.php
示例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);
}
}
开发者ID:jmangarret,项目名称:vtigercrm,代码行数:30,代码来源:Edit.php
示例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());
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:27,代码来源:ChartEdit.php
示例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;
}
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:36,代码来源:DetailView.php
示例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;
}
开发者ID:andreadanzi,项目名称:sws,代码行数:35,代码来源:Module.php
示例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;
}
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:34,代码来源:DetailView.php
示例7: checkPermission
public function checkPermission(Vtiger_Request $request)
{
$moduleName = $request->getModule();
if (!Users_Privileges_Model::isPermitted($moduleName, 'ExportPdf')) {
throw new NoPermittedException('LBL_PERMISSION_DENIED');
}
}
开发者ID:nikdejan,项目名称:YetiForceCRM,代码行数:7,代码来源:PDF.php
示例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);
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:28,代码来源:ConvertLead.php
示例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;
}
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:36,代码来源:DetailView.php
示例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;
}
开发者ID:xrstf,项目名称:vtiger-mirror,代码行数:36,代码来源:DetailView.php
示例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));
}
}
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:7,代码来源:CheckFileIntegrity.php
示例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');
}
}
开发者ID:yozhi,项目名称:YetiForceCRM,代码行数:7,代码来源:GenerateRecords.php
示例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);
}
开发者ID:cin-system,项目名称:cinrepo,代码行数:27,代码来源:Edit.php
示例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;
}
开发者ID:Wasage,项目名称:werpa,代码行数:32,代码来源:Module.php
示例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;
}
开发者ID:rcrrich,项目名称:UpdatePackages,代码行数:35,代码来源:DetailView.php
示例16: searchRecord
public function searchRecord($searchValue, $searchModule, $potentialId)
{
$db = PearDatabase::getInstance();
$potentialId = intval($potentialId);
if ($searchModule == 'Products') {
$sql = "SELECT\n\t\t\t\t\t\tcrm.*,\n\t\t\t\t\t\tprod.*\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`vtiger_products` prod\n\t\t\t\t\t\tINNER JOIN `vtiger_crmentity` crm\n\t\t\t\t\t\t\tON crm.`crmid` = prod.`productid`\n\t\t\t\t\t\tINNER JOIN `vtiger_seproductsrel` prodrel\n\t\t\t\t\t\t\tON prod.`productid` = prodrel.`productid`\n\t\t\t\t\t\t\tAND prodrel.`setype` = 'Potentials'\n\t\t\t\t\tWHERE prod.`productname` LIKE '%{$searchValue}%'\n\t\t\t\t\t\tAND crm.`setype` = 'Products'\n\t\t\t\t\t\tAND crm.`deleted` = 0\n\t\t\t\t\t\tAND prodrel.`crmid` = '{$potentialId}';";
} else {
$sql = "SELECT\n\t\t\t\t\t\tcrm.*,\n\t\t\t\t\t\tserv.*\n\t\t\t\t\tFROM\n\t\t\t\t\t\t`vtiger_service` serv\n\t\t\t\t\t\tINNER JOIN `vtiger_crmentity` crm\n\t\t\t\t\t\t\tON crm.`crmid` = serv.`serviceid`\n\t\t\t\t\t\tINNER JOIN `vtiger_crmentityrel` crmrel\n\t\t\t\t\t\t\tON serv.`serviceid` = crmrel.`relcrmid`\n\t\t\t\t\t\t\tAND crmrel.`module` = 'Potentials'\n\t\t\t\t\tWHERE serv.`servicename` LIKE '%{$searchValue}%'\n\t\t\t\t\t\tAND crm.`setype` = 'Services'\n\t\t\t\t\t\tAND crm.`deleted` = 0\n\t\t\t\t\t\tAND crmrel.`crmid` = '{$potentialId}';";
}
$result = $db->pquery($sql, array());
$noOfRows = $db->num_rows($result);
$moduleModels = array();
$matchingRecords = array();
for ($i = 0; $i < $noOfRows; ++$i) {
$row = $db->query_result_rowdata($result, $i);
if (Users_Privileges_Model::isPermitted($row['setype'], 'DetailView', $row['crmid'])) {
$row['id'] = $row['crmid'];
$moduleName = $row['setype'];
if (!array_key_exists($moduleName, $moduleModels)) {
$moduleModels[$moduleName] = Vtiger_Module_Model::getInstance($moduleName);
}
$moduleModel = $moduleModels[$moduleName];
$modelClassName = Vtiger_Loader::getComponentClassName('Model', 'Record', $moduleName);
$recordInstance = new $modelClassName();
$matchingRecords[$moduleName][$row['id']] = $recordInstance->setData($row)->setModuleFromInstance($moduleModel);
}
}
return $matchingRecords;
}
开发者ID:Bergdahls,项目名称:YetiForceCRM,代码行数:29,代码来源:BasicAjax.php
示例17: 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;
}
开发者ID:epsilonsc,项目名称:YetiForceCRM,代码行数:32,代码来源:DetailView.php
示例18: getAll
/**
* Static Function to get all the accessible menu models with/without ordering them by sequence
* @param <Boolean> $sequenced - true/false
* @return <Array> - List of Vtiger_Menu_Model instances
*/
public static function getAll($sequenced = false)
{
global $log;
$log->debug("Entering ./models/Menu.php::staticgetAll");
$currentUser = Users_Record_Model::getCurrentUserModel();
$userPrivModel = Users_Privileges_Model::getCurrentUserPrivilegesModel();
$restrictedModulesList = array('Emails', 'ProjectMilestone', 'ProjectTask', 'ModComments', 'ExtensionStore', 'ExtensionStorePro', 'Integration', 'Dashboard', 'Home', 'vtmessages', 'vttwitter');
$allModules = parent::getAll(array('0', '2'));
$menuModels = array();
$moduleSeqs = array();
$moduleNonSeqs = array();
foreach ($allModules as $module) {
if ($module->get('tabsequence') != -1) {
$moduleSeqs[$module->get('tabsequence')] = $module;
} else {
$moduleNonSeqs[] = $module;
}
}
ksort($moduleSeqs);
$modules = array_merge($moduleSeqs, $moduleNonSeqs);
foreach ($modules as $module) {
if (($userPrivModel->isAdminUser() || $userPrivModel->hasGlobalReadPermission() || $userPrivModel->hasModulePermission($module->getId())) & !in_array($module->getName(), $restrictedModulesList) && $module->get('parent') != '') {
$menuModels[$module->getName()] = $module;
}
}
return $menuModels;
}
开发者ID:cin-system,项目名称:cinrepo,代码行数:32,代码来源:Menu.php
示例19: process
public function process(Vtiger_Request $request)
{
$moduleName = $request->getModule();
$moduleModel = Vtiger_Module_Model::getInstance($moduleName);
if ($request->get('selected_ids') == 'all' && $request->get('mode') == 'FindDuplicates') {
$recordIds = Vtiger_FindDuplicate_Model::getMassDeleteRecords($request);
} else {
$recordIds = $this->getRecordsListFromRequest($request);
}
foreach ($recordIds as $recordId) {
if (Users_Privileges_Model::isPermitted($moduleName, 'Delete', $recordId)) {
$recordModel = Vtiger_Record_Model::getInstanceById($recordId, $moduleModel);
$recordModel->delete();
} else {
$permission = 'No';
}
}
if ($permission === 'No') {
throw new AppException(vtranslate('LBL_PERMISSION_DENIED'));
}
$cvId = $request->get('viewname');
$response = new Vtiger_Response();
$response->setResult(array('viewname' => $cvId, 'module' => $moduleName));
$response->emit();
}
开发者ID:awflu,项目名称:YetiForceCRM,代码行数:25,代码来源:MassDelete.php
示例20: getTimeEmployee
public function getTimeEmployee($id)
{
$db = PearDatabase::getInstance();
$moduleModel = Vtiger_Record_Model::getCleanInstance('OSSTimeControl');
$Ids = $moduleModel->getProjectRelatedIDS($id);
foreach ($Ids as $module) {
foreach ($module as $moduleId) {
$idArray .= $moduleId . ',';
}
}
if (null == $idArray) {
$response = false;
} else {
$idArray = substr($idArray, 0, -1);
$addSql = ' WHERE vtiger_osstimecontrol.osstimecontrolid IN (' . $idArray . ') ';
//TODO need to handle security
$result = $db->pquery('SELECT count(*) AS count, concat(vtiger_users.first_name, " " ,vtiger_users.last_name) as name, vtiger_users.id as id, SUM(vtiger_osstimecontrol.sum_time) as time FROM vtiger_osstimecontrol
INNER JOIN vtiger_crmentity ON vtiger_osstimecontrol.osstimecontrolid = vtiger_crmentity.crmid
INNER JOIN vtiger_users ON vtiger_users.id=vtiger_crmentity.smownerid AND vtiger_users.status="ACTIVE"
AND vtiger_crmentity.deleted = 0' . Users_Privileges_Model::getNonAdminAccessControlQuery($this->getName()) . $addSql . ' GROUP BY smownerid', array());
$data = array();
$numRows = $db->num_rows($result);
for ($i = 0; $i < $numRows; $i++) {
$row = $db->query_result_rowdata($result, $i);
$data[$i]['label'] = $row['name'];
$ticks[$i][0] = $i;
$ticks[$i][1] = $row['name'];
$data[$i]['data'][0][0] = $i;
$data[$i]['data'][0][1] = $row['time'];
}
$response['ticks'] = $ticks;
$response['chart'] = $data;
}
return $response;
}
开发者ID:noclav,项目名称:UpdatePackages,代码行数:35,代码来源:Module.php
注:本文中的Users_Privileges_Model类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论