本文整理汇总了PHP中getColumnVisibilityPermission函数的典型用法代码示例。如果您正苦于以下问题:PHP getColumnVisibilityPermission函数的具体用法?PHP getColumnVisibilityPermission怎么用?PHP getColumnVisibilityPermission使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getColumnVisibilityPermission函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCurrentUserEntityFieldNameDisplay
static function getCurrentUserEntityFieldNameDisplay($module, $fieldsName, $fieldValues) {
global $current_user;
if(!is_array($fieldsName)) {
return $fieldValues[$fieldsName];
} else {
$accessibleFieldNames = array();
foreach($fieldsName as $field) {
if($module == 'Users' || getColumnVisibilityPermission($current_user->id, $field, $module) == '0') {
$accessibleFieldNames[] = $fieldValues[$field];
}
}
if(count($accessibleFieldNames) > 0) {
return implode(' ', $accessibleFieldNames);
}
}
return '';
}
示例2: get_project_tickets
function get_project_tickets($id, $module, $customerid, $sessionid)
{
require_once 'modules/HelpDesk/HelpDesk.php';
require_once 'include/utils/UserInfoUtil.php';
$adb = PearDatabase::getInstance();
$log = vglobal('log');
$log->debug("Entering customer portal function get_project_tickets ..");
$check = checkModuleActive($module);
if ($check == false) {
return array("#MODULE INACTIVE#");
}
if (!validateSession($customerid, $sessionid)) {
return null;
}
$user = new Users();
$userid = getPortalUserid();
$current_user = $user->retrieveCurrentUserInfoFromFile($userid);
$focus = new HelpDesk();
$focus->filterInactiveFields('HelpDesk');
$TicketsfieldVisibilityByColumn = array();
$fields_list = array();
foreach ($focus->list_fields as $fieldlabel => $values) {
foreach ($values as $table => $fieldname) {
$fields_list[$fieldlabel] = $fieldname;
$TicketsfieldVisibilityByColumn[$fieldname] = getColumnVisibilityPermission($current_user->id, $fieldname, 'HelpDesk');
}
}
$query = "SELECT vtiger_troubletickets.*, vtiger_crmentity.smownerid FROM vtiger_troubletickets\n\t\tINNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_troubletickets.ticketid\n\t\tINNER JOIN vtiger_crmentityrel ON (vtiger_crmentityrel.relcrmid = vtiger_crmentity.crmid OR vtiger_crmentityrel.crmid = vtiger_crmentity.crmid)\n\t\tWHERE vtiger_crmentity.deleted = 0 AND (vtiger_crmentityrel.crmid = ? OR vtiger_crmentityrel.relcrmid = ?)";
$params = array($id, $id);
$res = $adb->pquery($query, $params);
$noofdata = $adb->num_rows($res);
for ($j = 0; $j < $noofdata; $j++) {
$i = 0;
foreach ($fields_list as $fieldlabel => $fieldname) {
$fieldper = $TicketsfieldVisibilityByColumn[$fieldname];
//in troubletickets the list_fields has columns so we call this API
if ($fieldper == '1') {
continue;
}
$output[0][$module]['head'][0][$i]['fielddata'] = Vtiger_Language_Handler::getTranslatedString($fieldlabel, 'HelpDesk', vglobal('default_language'));
$fieldvalue = $adb->query_result($res, $j, $fieldname);
$ticketid = $adb->query_result($res, $j, 'ticketid');
if ($fieldname == 'title') {
$fieldvalue = '<a href="index.php?module=HelpDesk&action=index&fun=detail&ticketid=' . $ticketid . '">' . $fieldvalue . '</a>';
}
if ($fieldname == 'parent_id' || $fieldname == 'contact_id') {
$crmid = $fieldvalue;
$entitymodule = getSalesEntityType($crmid);
if ($crmid != '' && $entitymodule != '') {
$fieldvalues = getEntityName($entitymodule, array($crmid));
if ($entitymodule == 'Contacts') {
$fieldvalue = '<a href="index.php?module=Contacts&action=index&id=' . $crmid . '">' . $fieldvalues[$crmid] . '</a>';
} elseif ($entitymodule == 'Accounts') {
$fieldvalue = '<a href="index.php?module=Accounts&action=index&id=' . $crmid . '">' . $fieldvalues[$crmid] . '</a>';
}
} else {
$fieldvalue = '';
}
}
if ($fieldname == 'smownerid') {
$fieldvalue = getOwnerName($fieldvalue);
}
if ($fieldlabel == 'Status') {
$fieldvalue = Vtiger_Language_Handler::getTranslatedString($fieldvalue, 'HelpDesk', vglobal('default_language'));
}
$output[1][$module]['data'][$j][$i]['fielddata'] = $fieldvalue;
$i++;
}
}
$log->debug("Exiting customerportal function get_project_tickets ..");
return $output;
}
示例3: get_pricebooks_list
/**
* Get PriceBook list
*
* @param array $input_array input data
* @return array resulted data
*/
function get_pricebooks_list($input_array)
{
require_once 'modules/PriceBooks/PriceBooks.php';
require_once 'include/utils/UserInfoUtil.php';
global $adb, $log;
global $current_user;
require_once 'modules/Users/Users.php';
$log->debug("Entering customer portal function get_pricebooks_list");
$user = new Users();
$userid = getPortalUserid();
$show_all = show_all('PriceBooks');
$current_user = $user->retrieveCurrentUserInfoFromFile($userid);
$id = $input_array['id'];
$only_mine = $input_array['onlymine'];
$only_base = $input_array['onlybase'];
$sessionid = $input_array['sessionid'];
if (!validateSession($id, $sessionid)) {
return null;
}
$entity_ids_list = array();
if ($only_mine == 'true') {
array_push($entity_ids_list, $id);
} else {
// TODO
}
$focus = new PriceBooks();
$focus->filterInactiveFields('PriceBooks');
foreach ($focus->list_fields as $fieldlabel => $values) {
foreach ($values as $table => $fieldname) {
$fields_list[$fieldlabel] = $fieldname;
}
}
$FieldVisibilityByColumn = array();
foreach ($fields_list as $fieldlabel => $fieldname) {
$FieldVisibilityByColumn[$fieldname] = getColumnVisibilityPermission($current_user->id, $fieldname, 'PriceBooks');
}
// PriceBooks items selection
$query = "SELECT * FROM vtiger_pricebook " . "INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_pricebook.pricebookid AND vtiger_crmentity.deleted = 0 " . "WHERE active = 1 ";
if (count($entity_ids_list) > 0) {
$query .= "AND owner_id IN (" . generateQuestionMarks($entity_ids_list) . ")";
}
$params = array($entity_ids_list);
$res = $adb->pquery($query, $params);
$noofdata = $adb->num_rows($res);
for ($j = 0; $j < $noofdata; $j++) {
$i = 0;
foreach ($fields_list as $fieldlabel => $fieldname) {
if (strcmp($fieldname, 'active') == 0) {
continue;
}
$fieldper = $FieldVisibilityByColumn[$fieldname];
if ($fieldper == '1') {
continue;
}
$output[0]['head'][0][$i]['fielddata'] = $fieldlabel;
$fieldvalue = $adb->query_result($res, $j, $fieldname);
$pricebookid = $adb->query_result($res, $j, 'pricebookid');
if ($fieldname == 'bookname') {
$fieldvalue = '<a href="index.php?module=PriceBooks&action=index&fun=detail&pricebookid=' . $pricebookid . '">' . $fieldvalue . '</a>';
}
if ($fieldname == 'owner_id') {
// TODO
}
$output[1]['data'][$j][$i]['fielddata'] = $fieldvalue;
$i++;
}
}
$log->debug("Exiting customer portal function get_pricebooks_list");
return $output;
}
示例4: getColumnVisibilityPerm
private function getColumnVisibilityPerm($column_str = "")
{
$return = 0;
$adb = PearDatabase::getInstance();
$die_columns = array();
$user_privileges_path = 'user_privileges/user_privileges_' . $this->current_user->id . '.php';
if (file_exists($user_privileges_path)) {
require $user_privileges_path;
}
if (file_exists($user_privileges_path) && ($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0)) {
return $return;
} else {
if ($column_str != "") {
$current_user_id = $this->current_user->id;
$column_array = explode(":", $column_str);
$calculation_type_tmp = $column_array[count($column_array) - 1];
$calculation_type = strtolower($calculation_type_tmp);
if (!in_array($calculation_type, $this->calculation_type_array)) {
$calculation_type = "";
}
if ($calculation_type == "count") {
$return = 0;
} else {
$column_name = $column_array[1];
if (!in_array($column_name, self::$intentory_fields)) {
$module_array = explode("_", $column_array[2]);
$module_name = $module_array[0];
if ($module_name == "Calendar") {
$f_p_sql = "SELECT tabid FROM vtiger_field WHERE columnname=?";
$f_p_result = $adb->pquery($f_p_sql, array($column_name));
if ($adb->num_rows($f_p_result) > 0) {
$f_p_row = $adb->fetchByAssoc($f_p_result);
$f_p_tabid = $f_p_row["tabid"];
$module_name = vtlib_getModuleNameById($f_p_tabid);
}
}
$return = getColumnVisibilityPermission($current_user_id, $column_name, $module_name);
/* if($return==1){
$die_columns[] = $column_name;
} */
}
}
}
if ($return == 1) {
$this->DieDuePermission("columns", $die_columns);
}
}
return $return;
}
示例5: get_list_values
/** function used to get the Quotes/Invoice List
* @param int $id - id -Contactid
* return string $output - Quotes/Invoice list Array
*/
function get_list_values($id, $module, $sessionid, $only_mine = 'true')
{
require_once 'modules/' . $module . '/' . $module . '.php';
require_once 'include/utils/UserInfoUtil.php';
require_once 'modules/Users/Users.php';
global $adb, $log, $current_user;
$log->debug("Entering customer portal function get_list_values");
$check = checkModuleActive($module);
if ($check == false) {
return array("#MODULE INACTIVE#");
}
$user = new Users();
$userid = getPortalUserid();
$current_user = $user->retrieveCurrentUserInfoFromFile($userid);
$focus = new $module();
$focus->filterInactiveFields($module);
foreach ($focus->list_fields as $fieldlabel => $values) {
foreach ($values as $table => $fieldname) {
$fields_list[$fieldlabel] = $fieldname;
}
}
if (!validateSession($id, $sessionid)) {
return null;
}
$entity_ids_list = array();
$show_all = show_all($module);
if ($only_mine == 'true' || $show_all == 'false') {
array_push($entity_ids_list, $id);
} else {
$contactquery = "SELECT contactid, accountid FROM vtiger_contactdetails " . " INNER JOIN vtiger_crmentity ON vtiger_crmentity.crmid = vtiger_contactdetails.contactid" . " AND vtiger_crmentity.deleted = 0 " . " WHERE (accountid = (SELECT accountid FROM vtiger_contactdetails WHERE contactid = ?) AND accountid != 0) OR contactid = ?";
$contactres = $adb->pquery($contactquery, array($id, $id));
$no_of_cont = $adb->num_rows($contactres);
for ($i = 0; $i < $no_of_cont; $i++) {
$cont_id = $adb->query_result($contactres, $i, 'contactid');
$acc_id = $adb->query_result($contactres, $i, 'accountid');
if (!in_array($cont_id, $entity_ids_list)) {
$entity_ids_list[] = $cont_id;
}
if (!in_array($acc_id, $entity_ids_list) && $acc_id != '0') {
$entity_ids_list[] = $acc_id;
}
}
}
if ($module == 'Quotes') {
$query = "select distinct vtiger_quotes.*,vtiger_crmentity.smownerid,\n\t\tcase when vtiger_quotes.contactid is not null then vtiger_quotes.contactid else vtiger_quotes.accountid end as entityid,\n\t\tcase when vtiger_quotes.contactid is not null then 'Contacts' else 'Accounts' end as setype,\n\t\tvtiger_potential.potentialname,vtiger_account.accountid \n\t\tfrom vtiger_quotes left join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_quotes.quoteid \n\t\tLEFT OUTER JOIN vtiger_account\n\t\tON vtiger_account.accountid = vtiger_quotes.accountid\n\t\tLEFT OUTER JOIN vtiger_potential\n\t\tON vtiger_potential.potentialid = vtiger_quotes.potentialid \n\t\twhere vtiger_crmentity.deleted=0 and (vtiger_quotes.accountid in (" . generateQuestionMarks($entity_ids_list) . ") or contactid in (" . generateQuestionMarks($entity_ids_list) . "))";
$params = array($entity_ids_list, $entity_ids_list);
$fields_list['Related To'] = 'entityid';
} else {
if ($module == 'Invoice') {
$query = "select distinct vtiger_invoice.*,vtiger_crmentity.smownerid,\n\t\tcase when vtiger_invoice.contactid !=0 then vtiger_invoice.contactid else vtiger_invoice.accountid end as entityid,\n\t\tcase when vtiger_invoice.contactid !=0 then 'Contacts' else 'Accounts' end as setype\n\t\tfrom vtiger_invoice \n\t\tleft join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_invoice.invoiceid \n\t\twhere vtiger_crmentity.deleted=0 and (accountid in (" . generateQuestionMarks($entity_ids_list) . ") or contactid in (" . generateQuestionMarks($entity_ids_list) . "))";
$params = array($entity_ids_list, $entity_ids_list);
$fields_list['Related To'] = 'entityid';
} else {
if ($module == 'Documents') {
$query = "select vtiger_notes.*, vtiger_crmentity.*, vtiger_senotesrel.crmid as entityid, '' as setype,vtiger_attachmentsfolder.foldername from vtiger_notes " . "inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_notes.notesid " . "left join vtiger_senotesrel on vtiger_senotesrel.notesid=vtiger_notes.notesid " . "LEFT JOIN vtiger_attachmentsfolder ON vtiger_attachmentsfolder.folderid = vtiger_notes.folderid " . "where vtiger_crmentity.deleted = 0 and vtiger_senotesrel.crmid in (" . generateQuestionMarks($entity_ids_list) . ")";
$params = array($entity_ids_list);
$fields_list['Related To'] = 'entityid';
} else {
if ($module == 'Contacts') {
$query = "select vtiger_contactdetails.*,vtiger_crmentity.smownerid from vtiger_contactdetails\n\t\t inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_contactdetails.contactid\n\t\t where vtiger_crmentity.deleted = 0 and contactid IN (" . generateQuestionMarks($entity_ids_list) . ")";
$params = array($entity_ids_list);
}
}
}
}
$res = $adb->pquery($query, $params);
$noofdata = $adb->num_rows($res);
$columnVisibilityByFieldnameInfo = array();
if ($noofdata) {
foreach ($fields_list as $fieldlabel => $fieldname) {
$columnVisibilityByFieldnameInfo[$fieldname] = getColumnVisibilityPermission($current_user->id, $fieldname, $module);
}
}
for ($j = 0; $j < $noofdata; $j++) {
$i = 0;
foreach ($fields_list as $fieldlabel => $fieldname) {
$fieldper = $columnVisibilityByFieldnameInfo[$fieldname];
if ($fieldper == '1' && $fieldname != 'entityid') {
continue;
}
$fieldlabel = getTranslatedString($fieldlabel, $module);
$output[0][$module]['head'][0][$i]['fielddata'] = $fieldlabel;
$fieldvalue = $adb->query_result($res, $j, $fieldname);
if ($module == 'Quotes') {
if ($fieldname == 'subject') {
$fieldid = $adb->query_result($res, $j, 'quoteid');
$filename = $fieldid . '_Quotes.pdf';
$fieldvalue = '<a href="index.php?&module=Quotes&action=index&id=' . $fieldid . '">' . $fieldvalue . '</a>';
}
if ($fieldname == 'total') {
$sym = getCurrencySymbol($res, $j, 'currency_id');
$fieldvalue = $sym . $fieldvalue;
}
}
if ($module == 'Invoice') {
if ($fieldname == 'subject') {
//.........这里部分代码省略.........