本文整理汇总了PHP中CheckFieldPermission函数的典型用法代码示例。如果您正苦于以下问题:PHP CheckFieldPermission函数的具体用法?PHP CheckFieldPermission怎么用?PHP CheckFieldPermission使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CheckFieldPermission函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: unset
}
if (!$_SESSION['rlvs'][$module]) {
unset($_SESSION['rlvs']);
}
if (isset($_REQUEST['record']) && $_REQUEST['record'] != '') {
$userid = $current_user->id;
$sql = "select fieldname from vtiger_field where uitype = '13' and tabid = 7 and vtiger_field.presence in (0,2)";
$result = $adb->pquery($sql, array());
$num_fieldnames = $adb->num_rows($result);
for ($i = 0; $i < $num_fieldnames; $i++) {
$fieldname = $adb->query_result($result, $i, "fieldname");
$permit = getFieldVisibilityPermission("Leads", $userid, $fieldname);
}
}
$smarty->assign("TODO_PERMISSION", CheckFieldPermission('parent_id', 'Calendar'));
$smarty->assign("EVENT_PERMISSION", CheckFieldPermission('parent_id', 'Events'));
$smarty->assign("CATEGORY", $category);
$parent_email = getEmailParentsList('Leads', $focus->id, $focus);
$smarty->assign("HIDDEN_PARENTS_LIST", $parent_email);
// Module Sequence Numbering
$mod_seq_field = getModuleSequenceField($currentModule);
if ($mod_seq_field != null) {
$mod_seq_id = $focus->column_fields[$mod_seq_field['name']];
} else {
$mod_seq_id = $focus->id;
}
$smarty->assign('MOD_SEQ_ID', $mod_seq_id);
// END
$smarty->assign("ID", $focus->id);
$smarty->assign("NAME", $focus->lastname . ' ' . $focus->firstname);
$smarty->assign("EMAIL", $focus->column_fields['email']);
示例2: getSelectedColumnsList
/** Function to get the selected columns list for a selected vtiger_report
* This function accepts the vtiger_reportid as the argument and get the selected columns
* for the given vtiger_reportid and it forms a combo lists and returns
* HTML of the combo values
*/
function getSelectedColumnsList($reportid)
{
global $adb;
global $modules;
global $log, $current_user;
$ssql = "select vtiger_selectcolumn.* from vtiger_report inner join vtiger_selectquery on vtiger_selectquery.queryid = vtiger_report.queryid";
$ssql .= " left join vtiger_selectcolumn on vtiger_selectcolumn.queryid = vtiger_selectquery.queryid";
$ssql .= " where vtiger_report.reportid = ?";
$ssql .= " order by vtiger_selectcolumn.columnindex";
$result = $adb->pquery($ssql, array($reportid));
$permitted_fields = array();
$selected_mod = split(":", $this->secmodule);
array_push($selected_mod, $this->primodule);
$inventoryModules = getInventoryModules();
while ($columnslistrow = $adb->fetch_array($result)) {
$fieldname = "";
$fieldcolname = $columnslistrow["columnname"];
$selmod_field_disabled = true;
foreach ($selected_mod as $smod) {
if (stripos($fieldcolname, ":" . $smod . "__") > -1 && vtlib_isModuleActive($smod)) {
$selmod_field_disabled = false;
break;
}
}
if ($selmod_field_disabled == false) {
list($tablename, $colname, $module_field, $fieldname, $single) = split(":", $fieldcolname);
require 'user_privileges/user_privileges_' . $current_user->id . '.php';
list($module, $field) = split("__", $module_field);
if (sizeof($permitted_fields) == 0 && $is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) {
$permitted_fields = $this->getaccesfield($module);
}
$querycolumns = $this->getEscapedColumns($selectedfields);
$fieldlabel = trim(str_replace($module, " ", $module_field));
$mod_arr = explode('__', $fieldlabel);
$mod = $mod_arr[0] == '' ? $module : $mod_arr[0];
$fieldlabel = trim(str_replace("__", " ", $fieldlabel));
//modified code to support i18n issue
$mod_lbl = getTranslatedString($mod, $module);
//module
$fld_lbl = getTranslatedString($fieldlabel, $module);
//fieldlabel
$fieldlabel = $mod_lbl . " " . $fld_lbl;
if (in_array($mod, $inventoryModules) && $fieldname == 'serviceid') {
$shtml .= "<option permission='yes' value=\"" . $fieldcolname . "\">" . $fieldlabel . "</option>";
} else {
if (CheckFieldPermission($fieldname, $mod) != 'true' && $colname != "crmid") {
$shtml .= "<option permission='no' value=\"" . $fieldcolname . "\" disabled = 'true'>" . $fieldlabel . "</option>";
} else {
$shtml .= "<option permission='yes' value=\"" . $fieldcolname . "\">" . $fieldlabel . "</option>";
}
}
}
//end
}
$log->info("ReportRun :: Successfully returned getQueryColumnsList" . $reportid);
return $shtml;
}
示例3: CheckColumnPermission
function CheckColumnPermission($tablename, $columnname, $module)
{
global $adb;
static $cache = array();
$cachekey = $module . ":" . $tablename . ":" . $columnname;
if (!array_key_exists($cachekey, $cache)) {
$res = $adb->pquery("select fieldname from vtiger_field where tablename=? and columnname=? and vtiger_field.presence in (0,2)", array($tablename, $columnname));
$fieldname = $adb->query_result($res, 0, 'fieldname');
$cache[$cachekey] = CheckFieldPermission($fieldname, $module);
}
return $cache[$cachekey];
}
示例4: GetFirstSortByField
function GetFirstSortByField($reportid)
{
$adb = PearDatabase::getInstance();
$groupByField = "";
$sortFieldQuery = "SELECT * FROM vtiger_reportsortcol\n LEFT JOIN vtiger_reportgroupbycolumn ON (vtiger_reportsortcol.sortcolid = vtiger_reportgroupbycolumn.sortid and vtiger_reportsortcol.reportid = vtiger_reportgroupbycolumn.reportid)\n WHERE columnname!='none' and vtiger_reportsortcol.reportid=? ORDER By sortcolid";
$sortFieldResult = $adb->pquery($sortFieldQuery, array($reportid));
$inventoryModules = getInventoryModules();
if ($adb->num_rows($sortFieldResult) > 0) {
$fieldcolname = $adb->query_result($sortFieldResult, 0, 'columnname');
list($tablename, $colname, $module_field, $fieldname, $typeOfData) = explode(":", $fieldcolname);
list($modulename, $fieldlabel) = explode('__', $module_field, 2);
$groupByField = $module_field;
if ($typeOfData == "D") {
$groupCriteria = $adb->query_result($sortFieldResult, 0, 'dategroupbycriteria');
if (strtolower($groupCriteria) != 'none') {
if (in_array($groupCriteria, array_keys($this->groupByTimeParent))) {
$parentCriteria = $this->groupByTimeParent[$groupCriteria];
foreach ($parentCriteria as $criteria) {
$groupByCondition[] = $this->GetTimeCriteriaCondition($criteria, $groupByField);
}
}
$groupByCondition[] = $this->GetTimeCriteriaCondition($groupCriteria, $groupByField);
$groupByField = implode(", ", $groupByCondition);
}
} elseif (CheckFieldPermission($fieldname, $modulename) != 'true') {
if (!(in_array($modulename, $inventoryModules) && $fieldname == 'serviceid')) {
$groupByField = $tablename . "." . $colname;
}
}
}
return $groupByField;
}
示例5: getValue
//.........这里部分代码省略.........
if ($relatedentity == 'Accounts') {
require_once 'modules/Accounts/Accounts.php';
$acct_focus = new Accounts();
$acct_focus->retrieve_entity_info($relatedid, "Accounts");
$account_name = getAccountName($relatedid);
$slashes_account_name = popup_from_html($account_name);
$slashes_account_name = htmlspecialchars($slashes_account_name, ENT_QUOTES, $default_charset);
$xyz = array('bill_street', 'bill_city', 'bill_code', 'bill_pobox', 'bill_country', 'bill_state', 'ship_street', 'ship_city', 'ship_code', 'ship_pobox', 'ship_country', 'ship_state');
for ($i = 0; $i < 12; $i++) {
if (getFieldVisibilityPermission('Accounts', $current_user->id, $xyz[$i]) == '0') {
$acct_focus->column_fields[$xyz[$i]] = $acct_focus->column_fields[$xyz[$i]];
} else {
$acct_focus->column_fields[$xyz[$i]] = '';
}
}
$bill_street = str_replace(array("\r", "\n"), array('\\r', '\\n'), popup_decode_html($acct_focus->column_fields['bill_street']));
$ship_street = str_replace(array("\r", "\n"), array('\\r', '\\n'), popup_decode_html($acct_focus->column_fields['ship_street']));
$value = '<a href="javascript:window.close();" onclick=\'set_return_address("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '", "' . $relatedid . '", "' . nl2br(decode_html($slashes_account_name)) . '", "' . $bill_street . '", "' . $ship_street . '", "' . popup_decode_html($acct_focus->column_fields['bill_city']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_city']) . '", "' . popup_decode_html($acct_focus->column_fields['bill_state']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_state']) . '", "' . popup_decode_html($acct_focus->column_fields['bill_code']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_code']) . '", "' . popup_decode_html($acct_focus->column_fields['bill_country']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_country']) . '","' . popup_decode_html($acct_focus->column_fields['bill_pobox']) . '", "' . popup_decode_html($acct_focus->column_fields['ship_pobox']) . '");\'>' . $temp_val . '</a>';
} else {
if ($relatedentity == 'Contacts') {
require_once 'modules/Contacts/Contacts.php';
$contact_name = getContactName($relatedid);
$slashes_contact_name = popup_from_html($contact_name);
$slashes_contact_name = htmlspecialchars($slashes_contact_name, ENT_QUOTES, $default_charset);
$value = '<a href="javascript:window.close();" onclick=\'set_return_contact("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '", "' . $relatedid . '", "' . nl2br(decode_html($slashes_contact_name)) . '");\'>' . $temp_val . '</a>';
} else {
$value = $temp_val;
}
}
} elseif ($popuptype == "set_return_emails") {
if ($module == 'Accounts') {
$name = $adb->query_result($list_result, $list_result_count, 'accountname');
$accid = $adb->query_result($list_result, $list_result_count, 'accountid');
if (CheckFieldPermission('email1', $module) == "true") {
$emailaddress = $adb->query_result($list_result, $list_result_count, "email1");
$email_check = 1;
} else {
$email_check = 0;
}
if ($emailaddress == '') {
if (CheckFieldPermission('email2', $module) == 'true') {
$emailaddress2 = $adb->query_result($list_result, $list_result_count, "email2");
$email_check = 2;
} else {
if ($email_check == 1) {
$email_check = 4;
} else {
$email_check = 3;
}
}
}
$querystr = "SELECT fieldid,fieldlabel,columnname FROM vtiger_field WHERE tabid=? and uitype=13 and vtiger_field.presence in (0,2)";
$queryres = $adb->pquery($querystr, array(getTabid($module)));
//Change this index 0 - to get the vtiger_fieldid based on email1 or email2
$fieldid = $adb->query_result($queryres, 0, 'fieldid');
$slashes_name = popup_from_html($name);
$slashes_name = htmlspecialchars($slashes_name, ENT_QUOTES, $default_charset);
$value = '<a href="javascript:window.close();" onclick=\'return set_return_emails(' . $entity_id . ',' . $fieldid . ',"' . decode_html($slashes_name) . '","' . $emailaddress . '","' . $emailaddress2 . '","' . $email_check . '"); \'>' . textlength_check($name) . '</a>';
} elseif ($module == 'Vendors') {
$name = $adb->query_result($list_result, $list_result_count, 'vendorname');
$venid = $adb->query_result($list_result, $list_result_count, 'vendorid');
if (CheckFieldPermission('email', $module) == "true") {
$emailaddress = $adb->query_result($list_result, $list_result_count, "email");
$email_check = 1;
} else {
$email_check = 0;
示例6: GetPicklistValues
function GetPicklistValues($username, $sessionid, $tablename)
{
global $current_user, $log, $adb;
if (!validateSession($username, $sessionid)) {
return null;
}
require_once "modules/Users/Users.php";
$seed_user = new Users();
$user_id = $seed_user->retrieve_user_id($username);
$current_user = $seed_user;
$current_user->retrieve_entity_info($user_id, 'Users');
require_once "include/utils/UserInfoUtil.php";
$roleid = fetchUserRole($user_id);
checkFileAccessForInclusion('user_privileges/user_privileges_' . $current_user->id . '.php');
require 'user_privileges/user_privileges_' . $current_user->id . '.php';
if ($is_admin == true || $profileGlobalPermission[1] == 0 || $profileGlobalPermission[2] == 0) {
$query = "select " . $adb->sql_escape_string($tablename) . " from vtiger_" . $adb->sql_escape_string($tablename);
$result1 = $adb->pquery($query, array());
for ($i = 0; $i < $adb->num_rows($result1); $i++) {
$output[$i] = decode_html($adb->query_result($result1, $i, $tablename));
}
} else {
if (isPermitted("HelpDesk", "EditView") == "yes" && CheckFieldPermission($tablename, 'HelpDesk') == 'true') {
$query = "select " . $adb->sql_escape_string($tablename) . " from vtiger_" . $adb->sql_escape_string($tablename) . " inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_" . $adb->sql_escape_string($tablename) . ".picklist_valueid where roleid=? and picklistid in (select picklistid from vtiger_" . $adb->sql_escape_string($tablename) . " ) order by sortid";
$result1 = $adb->pquery($query, array($roleid));
for ($i = 0; $i < $adb->num_rows($result1); $i++) {
$output[$i] = decode_html($adb->query_result($result1, $i, $tablename));
}
} else {
$output[] = 'Not Accessible';
}
}
return $output;
}
示例7: getQueryColumnsList
function getQueryColumnsList($reportid, $outputformat = '')
{
// Have we initialized information already?
if ($this->_columnslist !== false) {
return $this->_columnslist;
}
global $adb;
global $modules;
global $log, $current_user, $current_language;
$ssql = "select vtiger_pdfmaker_relblockcol.* from vtiger_pdfmaker_relblocks ";
$ssql .= " left join vtiger_pdfmaker_relblockcol on vtiger_pdfmaker_relblockcol.relblockid = vtiger_pdfmaker_relblocks.relblockid";
$ssql .= " where vtiger_pdfmaker_relblocks.relblockid = ?";
$ssql .= " order by vtiger_pdfmaker_relblockcol.colid";
$result = $adb->pquery($ssql, array($reportid));
$permitted_fields = array();
while ($columnslistrow = $adb->fetch_array($result)) {
$fieldname = "";
$fieldcolname = $columnslistrow["columnname"];
list($tablename, $colname, $module_field, $fieldname, $single) = split(":", $fieldcolname);
list($module, $field) = split("_", $module_field, 2);
$inventory_fields = array('serviceid');
$inventory_modules = getInventoryModules();
require 'user_privileges/user_privileges_' . $current_user->id . '.php';
if (sizeof($permitted_fields[$module]) == 0 && $is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) {
$permitted_fields[$module] = $this->getaccesfield($module);
}
if (in_array($module, $inventory_modules)) {
if (!empty($permitted_fields)) {
foreach ($inventory_fields as $value) {
array_push($permitted_fields[$module], $value);
}
}
}
$selectedfields = explode(":", $fieldcolname);
if ($is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1 && !in_array($selectedfields[3], $permitted_fields[$module])) {
//user has no access to this field, skip it.
continue;
}
$concatSql = getSqlForNameInDisplayFormat(array('first_name' => $selectedfields[0] . ".first_name", 'last_name' => $selectedfields[0] . ".last_name"), 'Users');
$querycolumns = $this->getEscapedColumns($selectedfields);
if (isset($module) && $module != "") {
$mod_strings = return_module_language($current_language, $module);
}
$targetTableName = $tablename;
$fieldname = $selectedfields[3];
$fieldlabel = trim(preg_replace("/{$module}/", " ", $selectedfields[2], 1));
$mod_arr = explode('_', $fieldlabel);
$fieldlabel = trim(str_replace("_", " ", $fieldlabel));
//modified code to support i18n issue
$fld_arr = explode(" ", $fieldlabel);
if ($mod_arr[0] == '') {
$mod = $module;
$mod_lbl = $this->getTranslatedString($module, $module);
//module
} else {
$mod = $mod_arr[0];
array_shift($fld_arr);
$mod_lbl = $this->getTranslatedString($fld_arr[0], $mod);
//module
}
$fld_lbl_str = implode(" ", $fld_arr);
$fld_lbl = $this->getTranslatedString($fld_lbl_str, $module);
//fieldlabel
$fieldlabel = $mod . "_" . $fieldname;
if ($selectedfields[0] == "vtiger_usersRel1" && $selectedfields[1] == 'user_name' && $selectedfields[2] == 'Quotes_Inventory_Manager') {
$columnslist[$fieldcolname] = "trim( {$concatSql} ) as " . $module . "_Inventory_Manager";
$this->queryPlanner->addTable($selectedfields[0]);
continue;
}
if (CheckFieldPermission($fieldname, $mod) != 'true' && $colname != "crmid" && (!in_array($fieldname, $inventory_fields) && in_array($module, $inventory_modules)) || empty($fieldname)) {
continue;
} else {
$this->labelMapping[$selectedfields[2]] = str_replace(" ", "_", $fieldlabel);
$header_label = $fieldlabel;
// To check if the field in the report is a custom field
// and if yes, get the label of this custom field freshly from the vtiger_field as it would have been changed.
// Asha - Reference ticket : #4906
if ($querycolumns == "") {
if ($selectedfields[4] == 'C') {
$field_label_data = split("_", $selectedfields[2]);
$module = $field_label_data[0];
if ($module != $this->primarymodule) {
$columnslist[$fieldcolname] = "case when (" . $selectedfields[0] . "." . $selectedfields[1] . "='1')then 'yes' else case when (vtiger_crmentity{$module}.crmid !='') then 'no' else '-' end end as '{$fieldlabel}'";
$this->queryPlanner->addTable("vtiger_crmentity{$module}");
} else {
$columnslist[$fieldcolname] = "case when (" . $selectedfields[0] . "." . $selectedfields[1] . "='1')then 'yes' else case when (vtiger_crmentity.crmid !='') then 'no' else '-' end end as '{$fieldlabel}'";
$this->queryPlanner->addTable("vtiger_crmentity{$module}");
}
} elseif ($selectedfields[0] == 'vtiger_activity' && $selectedfields[1] == 'status') {
$columnslist[$fieldcolname] = " case when (vtiger_activity.status not like '') then vtiger_activity.status else vtiger_activity.eventstatus end as Calendar_Status";
} elseif ($selectedfields[0] == 'vtiger_activity' && $selectedfields[1] == 'date_start') {
if ($module == 'Emails') {
$columnslist[$fieldcolname] = "cast(concat(vtiger_activity.date_start,' ',vtiger_activity.time_start) as DATE) as Emails_Date_Sent";
} else {
$columnslist[$fieldcolname] = "cast(concat(vtiger_activity.date_start,' ',vtiger_activity.time_start) AS DATETIME) AS Calendar_date_start";
}
} elseif (stristr($selectedfields[0], "vtiger_users") && $selectedfields[1] == 'user_name') {
$temp_module_from_tablename = str_replace("vtiger_users", "", $selectedfields[0]);
if ($module != $this->primarymodule) {
$condition = "and vtiger_crmentity" . $module . ".crmid!=''";
//.........这里部分代码省略.........
示例8: getSelectedFields
/**
* Function returns Report Selected Fields
* @return <Array>
*/
function getSelectedFields()
{
$db = PearDatabase::getInstance();
$result = $db->pquery("SELECT vtiger_selectcolumn.columnname FROM vtiger_report\n\t\t\t\t\tINNER JOIN vtiger_selectquery ON vtiger_selectquery.queryid = vtiger_report.queryid\n\t\t\t\t\tINNER JOIN vtiger_selectcolumn ON vtiger_selectcolumn.queryid = vtiger_selectquery.queryid\n\t\t\t\t\tWHERE vtiger_report.reportid = ? ORDER BY vtiger_selectcolumn.columnindex", array($this->getId()));
$selectedColumns = array();
for ($i = 0; $i < $db->num_rows($result); $i++) {
$column = $db->query_result($result, $i, 'columnname');
list($tableName, $columnName, $moduleFieldLabel, $fieldName, $type) = split(':', $column);
$fieldLabel = explode('__', $moduleFieldLabel);
$module = $fieldLabel[0];
$dbFieldLabel = trim(str_replace(array($module, '__'), " ", $moduleFieldLabel));
$translatedFieldLabel = vtranslate($dbFieldLabel, $module);
if (CheckFieldPermission($fieldName, $module) == 'true' && $columnName != 'crmid') {
$selectedColumns[$translatedFieldLabel] = $column;
}
}
return $selectedColumns;
}
示例9: getGroupingList
/** Function to get getGroupingList for the given reportid
* @ param $reportid : Type Integer
* returns the $grouplist Array in the following format
* $grouplist = Array($tablename:$columnname:$fieldlabel:fieldname:typeofdata=>$tablename:$columnname $sorder,
* $tablename1:$columnname1:$fieldlabel1:fieldname1:typeofdata1=>$tablename1:$columnname1 $sorder,
* $tablename2:$columnname2:$fieldlabel2:fieldname2:typeofdata2=>$tablename2:$columnname2 $sorder)
* This function also sets the return value in the class variable $this->groupbylist
*/
function getGroupingList($reportid)
{
global $adb;
global $modules;
global $log;
// Have we initialized information already?
if ($this->_groupinglist !== false) {
return $this->_groupinglist;
}
$sreportsortsql = "select vtiger_reportsortcol.* from vtiger_report";
$sreportsortsql .= " inner join vtiger_reportsortcol on vtiger_report.reportid = vtiger_reportsortcol.reportid";
$sreportsortsql .= " where vtiger_report.reportid =? AND vtiger_reportsortcol.columnname IN (SELECT columnname from vtiger_selectcolumn WHERE queryid=?) order by vtiger_reportsortcol.sortcolid";
$result = $adb->pquery($sreportsortsql, array($reportid, $reportid));
while ($reportsortrow = $adb->fetch_array($result)) {
$fieldcolname = $reportsortrow["columnname"];
list($tablename, $colname, $module_field, $fieldname, $single) = split(":", $fieldcolname);
$sortorder = $reportsortrow["sortorder"];
if ($sortorder == "Ascending") {
$sortorder = "ASC";
} elseif ($sortorder == "Descending") {
$sortorder = "DESC";
}
if ($fieldcolname != "none") {
$selectedfields = explode(":", $fieldcolname);
if ($selectedfields[0] == "vtiger_crmentity" . $this->primarymodule) {
$selectedfields[0] = "vtiger_crmentity";
}
if (stripos($selectedfields[1], 'cf_') == 0 && stristr($selectedfields[1], 'cf_') == true) {
$sqlvalue = "'" . $adb->sql_escape_string(decode_html($selectedfields[2])) . "' " . $sortorder;
} else {
$sqlvalue = "'" . $selectedfields[2] . "' " . $sortorder;
}
$grouplist[$fieldcolname] = $sqlvalue;
$temp = split("_", $selectedfields[2], 2);
$module = $temp[0];
if (CheckFieldPermission($fieldname, $module) == 'true') {
$this->groupbylist[$fieldcolname] = $selectedfields[0] . "." . $selectedfields[1] . " " . $selectedfields[2];
}
}
}
// Save the information
$this->_groupinglist = $grouplist;
$log->info("ReportRun :: Successfully returned getGroupingList" . $reportid);
return $grouplist;
}
示例10: CheckColumnPermission
function CheckColumnPermission($tablename, $columnname, $module)
{
global $adb;
$res = $adb->pquery("select fieldname from vtiger_field where tablename=? and columnname=? and vtiger_field.presence in (0,2)", array($tablename, $columnname));
$fieldname = $adb->query_result($res, 0, 'fieldname');
return CheckFieldPermission($fieldname, $module);
}
示例11: getSelectedQFColumnsArray
function getSelectedQFColumnsArray($reportid)
{
global $modules;
$adb = PearDatabase::getInstance();
$ssql = "select its4you_reports4you_selectqfcolumn.* from its4you_reports4you";
$ssql .= " left join its4you_reports4you_selectqfcolumn on its4you_reports4you_selectqfcolumn.queryid = its4you_reports4you.reports4youid";
$ssql .= " where its4you_reports4you.reports4youid = ?";
$ssql .= " order by its4you_reports4you_selectqfcolumn.columnindex";
$result = $adb->pquery($ssql, array($reportid));
$permitted_fields = array();
$selected_mod = split(":", $this->relatedmodulesstring);
array_push($selected_mod, $this->primarymoduleid);
$sarray = array();
while ($columnslistrow = $adb->fetch_array($result)) {
$fieldname = "";
$fieldcolname = $columnslistrow["columnname"];
$selmod_field_disabled = true;
foreach ($selected_mod as $smod) {
$smodule = vtlib_getModuleNameById($smod);
if (stripos($fieldcolname, ":" . $smodule . "_") > -1 && vtlib_isModuleActive($smodule)) {
$selmod_field_disabled = false;
break;
}
}
if ($selmod_field_disabled == false) {
list($tablename, $colname, $module_field, $fieldname, $single) = split(":", $fieldcolname);
$user_privileges_path = 'user_privileges/user_privileges_' . $this->current_user->id . '.php';
if (file_exists($user_privileges_path)) {
require $user_privileges_path;
}
list($module, $field) = split("_", $module_field);
if (sizeof($permitted_fields) == 0 && $is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) {
$permitted_fields = $this->getaccesfield($module);
}
$querycolumns = $this->getEscapedColumns($selectedfields);
$fieldlabel = trim(str_replace($module, " ", $module_field));
$mod_arr = explode('_', $fieldlabel);
$mod = $mod_arr[0] == '' ? $module : $mod_arr[0];
$fieldlabel = trim($fieldlabel);
//modified code to support i18n issue
$mod_lbl = vtranslate($mod, $module);
//module
$fld_lbl = vtranslate($fieldlabel, $module);
//fieldlabel
$fieldlabel = $mod_lbl . " " . $fld_lbl;
// ITS4YOU-UP SlOl 4. 9. 2013 15:32:14 disabled options changed / we will remove options which are users not permited to view
/* if(CheckFieldPermission($fieldname,$mod) != 'true' && $colname!="crmid" && !in_array($fieldname,array('prodname','quantity','listprice','discount','comment'))
{
$shtml .= "<option permission='no' value=\"".$fieldcolname."\" disabled = 'true'>".$fieldlabel."</option>";
}
else
{
$shtml .= "<option permission='yes' value=\"".$fieldcolname."\" ".$selected.">".$fieldlabel."</option>";
} */
if (CheckFieldPermission($fieldname, $mod) == 'true' || $colname == "crmid" || in_array($fieldname, self::$intentory_fields)) {
$selected = "";
$sarray[] = array("fieldcolname" => $fieldcolname, "selected" => $selected, "fieldlabel" => $fieldlabel);
}
// ITS4YOU-END 4. 9. 2013 15:33:15
}
//end
}
return $sarray;
}
示例12: getSelectedColumnsList
private function getSelectedColumnsList($primodule, $secmodule, $relblockid, $current_user)
{
$adb = PearDatabase::getInstance();
global $modules;
$ssql = "select vtiger_pdfmaker_relblockcol.* from vtiger_pdfmaker_relblocks";
$ssql .= " left join vtiger_pdfmaker_relblockcol on vtiger_pdfmaker_relblockcol.relblockid = vtiger_pdfmaker_relblocks.relblockid";
$ssql .= " where vtiger_pdfmaker_relblocks.relblockid = ?";
$ssql .= " order by vtiger_pdfmaker_relblockcol.colid";
$result = $adb->pquery($ssql, array($relblockid));
$permitted_fields = array();
$selected_mod = split(":", $secmodule);
array_push($selected_mod, $primodule);
while ($columnslistrow = $adb->fetch_array($result)) {
$fieldname = "";
$fieldcolname = $columnslistrow["columnname"];
$selmod_field_disabled = true;
foreach ($selected_mod as $smod) {
if (stripos($fieldcolname, ":" . $smod . "_") > -1 && vtlib_isModuleActive($smod)) {
$selmod_field_disabled = false;
break;
}
}
if ($selmod_field_disabled == false) {
list($tablename, $colname, $module_field, $fieldname, $single) = split(":", $fieldcolname);
require 'user_privileges/user_privileges_' . $current_user->getId() . '.php';
list($module, $field) = split("_", $module_field);
if (sizeof($permitted_fields) == 0 && $is_admin == false && $profileGlobalPermission[1] == 1 && $profileGlobalPermission[2] == 1) {
$permitted_fields = $this->getaccesfield($module, $primodule, $secmodule);
}
$querycolumns = $this->getEscapedColumns($selectedfields, $primodule, $secmodule);
$fieldlabel = trim(str_replace($module, " ", $module_field));
$mod_arr = explode('_', $fieldlabel);
$mod = $mod_arr[0] == '' ? $module : $mod_arr[0];
$fieldlabel = trim(str_replace("_", " ", $fieldlabel));
//modified code to support i18n issue
//$mod_lbl = getTranslatedString($mod,$module); //module
//$fld_lbl = getTranslatedString($fieldlabel,$module); //fieldlabel
//$fieldlabel = $mod_lbl." ".$fld_lbl;
$fieldlabel = getTranslatedString($fieldlabel, $module);
//fieldlabel
if (CheckFieldPermission($fieldname, $mod) != 'true' && $colname != "crmid") {
$shtml .= "<option permission='no' value=\"" . $fieldcolname . "\" disabled = 'true'>" . $fieldlabel . "</option>";
} else {
$shtml .= "<option permission='yes' value=\"" . $fieldcolname . "\">" . $fieldlabel . "</option>";
}
}
//end
}
return $shtml;
}