本文整理汇总了PHP中getFieldVisibilityPermission函数的典型用法代码示例。如果您正苦于以下问题:PHP getFieldVisibilityPermission函数的具体用法?PHP getFieldVisibilityPermission怎么用?PHP getFieldVisibilityPermission使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getFieldVisibilityPermission函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isViewPermitted
function isViewPermitted()
{
// Check if the logged in user has access to the field
global $current_user;
if ($this->parent->module == 'Products' and substr($this->name, 0, 10) == 'deltaimage') {
return true;
}
return getFieldVisibilityPermission($this->parent->module, $current_user->id, $this->name) == '0';
}
示例2: __construct
function __construct($leadid, $current_user)
{
global $adb;
$this->leadid = $leadid;
$this->current_user = $current_user;
$sql = "SELECT * FROM vtiger_leaddetails,vtiger_leadscf,vtiger_crmentity\n\t\t\tWHERE vtiger_leaddetails.leadid=vtiger_leadscf.leadid\n\t\t\tAND vtiger_leaddetails.leadid=vtiger_crmentity.crmid\n\t\t\tAND vtiger_leaddetails.leadid =?";
$result = $adb->pquery($sql, array($this->leadid));
$this->row = $adb->fetch_array($result);
if (getFieldVisibilityPermission('Leads', $current_user->id, 'company') == '1') {
$this->row["company"] = '';
}
$this->setAssignedToInfo();
}
示例3: setRecordFieldValues
/**
* Function to set record module field values
* @param parent record model
*/
function setRecordFieldValues($parentRecordModel)
{
global $log;
$log->debug("Entering RequirementCards_Record_Model::setRecordFieldValues() method ...");
$currentUser = Users_Record_Model::getCurrentUserModel();
$parentModuleName = $parentRecordModel->getModuleName();
if ($parentModuleName == 'QuotesEnquires') {
$fieldsToGenerate = $this->getListFieldsToGenerate($parentModuleName, $this->getModuleName());
foreach ($fieldsToGenerate as $key => $fieldName) {
if (getFieldVisibilityPermission($parentModuleName, $currentUser->getId(), $key) == 0 || $key == 'id') {
$this->set($fieldName, $parentRecordModel->get($key));
}
}
}
$log->debug("Exiting RequirementCards_Record_Model::setRecordFieldValues() method ...");
}
示例4: getConvertSoToInvoice
/** This function returns the vtiger_invoice object populated with the details from sales order object.
* Param $focus - Invoice object
* Param $so_focus - Sales order focus
* Param $soid - sales order id
* Return type is an object array
*/
function getConvertSoToInvoice($focus, $so_focus, $soid)
{
$log = vglobal('log');
$current_user = vglobal('current_user');
$log->debug("Entering getConvertSoToInvoice(" . get_class($focus) . "," . get_class($so_focus) . "," . $soid . ") method ...");
$log->info("in getConvertSoToInvoice " . $soid);
$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 < count($xyz); $i++) {
if (getFieldVisibilityPermission('SalesOrder', $current_user->id, $xyz[$i]) == '0') {
$so_focus->column_fields[$xyz[$i]] = $so_focus->column_fields[$xyz[$i]];
} else {
$so_focus->column_fields[$xyz[$i]] = '';
}
}
$focus->column_fields['salesorder_id'] = $soid;
$focus->column_fields['subject'] = $so_focus->column_fields['subject'];
$focus->column_fields['customerno'] = $so_focus->column_fields['customerno'];
$focus->column_fields['duedate'] = $so_focus->column_fields['duedate'];
$focus->column_fields['contact_id'] = $so_focus->column_fields['contact_id'];
//to include contact name in Invoice
$focus->column_fields['account_id'] = $so_focus->column_fields['account_id'];
$focus->column_fields['exciseduty'] = $so_focus->column_fields['exciseduty'];
$focus->column_fields['salescommission'] = $so_focus->column_fields['salescommission'];
$focus->column_fields['purchaseorder'] = $so_focus->column_fields['purchaseorder'];
$focus->column_fields['bill_street'] = $so_focus->column_fields['bill_street'];
$focus->column_fields['ship_street'] = $so_focus->column_fields['ship_street'];
$focus->column_fields['bill_city'] = $so_focus->column_fields['bill_city'];
$focus->column_fields['ship_city'] = $so_focus->column_fields['ship_city'];
$focus->column_fields['bill_state'] = $so_focus->column_fields['bill_state'];
$focus->column_fields['ship_state'] = $so_focus->column_fields['ship_state'];
$focus->column_fields['bill_code'] = $so_focus->column_fields['bill_code'];
$focus->column_fields['ship_code'] = $so_focus->column_fields['ship_code'];
$focus->column_fields['bill_country'] = $so_focus->column_fields['bill_country'];
$focus->column_fields['ship_country'] = $so_focus->column_fields['ship_country'];
$focus->column_fields['bill_pobox'] = $so_focus->column_fields['bill_pobox'];
$focus->column_fields['ship_pobox'] = $so_focus->column_fields['ship_pobox'];
$focus->column_fields['description'] = $so_focus->column_fields['description'];
$focus->column_fields['terms_conditions'] = $so_focus->column_fields['terms_conditions'];
$focus->column_fields['currency_id'] = $so_focus->column_fields['currency_id'];
$focus->column_fields['conversion_rate'] = $so_focus->column_fields['conversion_rate'];
$log->debug("Exiting getConvertSoToInvoice method ...");
return $focus;
}
示例5: getValue
//.........这里部分代码省略.........
$emailid = $adb->query_result($list_result, $list_result_count, "activityid");
$result = $adb->pquery("SELECT access_count FROM vtiger_email_track WHERE crmid=? AND mailid=?", array($contactid, $emailid));
$value = $adb->query_result($result, 0, "access_count");
if (!$value) {
$value = 0;
}
} elseif ($uitype == 8) {
if (!empty($temp_val)) {
$temp_val = html_entity_decode($temp_val, ENT_QUOTES, $default_charset);
$json = new Zend_Json();
$value = vt_suppressHTMLTags(implode(',', $json->decode($temp_val)));
}
} else {
if ($fieldname == $focus->list_link_field) {
if ($mode == "search") {
if ($popuptype == "specific" || $popuptype == "toDospecific") {
// Added for get the first name of contact in Popup window
if ($colname == "lastname" && $module == 'Contacts') {
$temp_val = getFullNameFromQResult($list_result, $list_result_count, "Contacts");
}
$slashes_temp_val = popup_from_html($temp_val);
$slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
//Added to avoid the error when select SO from Invoice through AjaxEdit
if ($module == 'SalesOrder') {
$value = '<a href="javascript:window.close();" onclick=\'set_return_specific("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '","' . $_REQUEST['form'] . '");\'>' . $temp_val . '</a>';
} elseif ($module == 'Contacts') {
require_once 'modules/Contacts/Contacts.php';
$cntct_focus = new Contacts();
$cntct_focus->retrieve_entity_info($entity_id, "Contacts");
$slashes_temp_val = popup_from_html($temp_val);
//ADDED TO CHECK THE FIELD PERMISSIONS FOR
$xyz = array('mailingstreet', 'mailingcity', 'mailingzip', 'mailingpobox', 'mailingcountry', 'mailingstate', 'otherstreet', 'othercity', 'otherzip', 'otherpobox', 'othercountry', 'otherstate');
for ($i = 0; $i < 12; $i++) {
if (getFieldVisibilityPermission($module, $current_user->id, $xyz[$i]) == '0') {
$cntct_focus->column_fields[$xyz[$i]] = $cntct_focus->column_fields[$xyz[$i]];
} else {
$cntct_focus->column_fields[$xyz[$i]] = '';
}
}
// For ToDo creation the underlying form is not named as EditView
$form = !empty($_REQUEST['form']) ? $_REQUEST['form'] : '';
if (!empty($form)) {
$form = htmlspecialchars($form, ENT_QUOTES, $default_charset);
}
$value = '<a href="javascript:window.close();" onclick=\'set_return_contact_address("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '", "' . popup_decode_html($cntct_focus->column_fields['mailingstreet']) . '", "' . popup_decode_html($cntct_focus->column_fields['otherstreet']) . '", "' . popup_decode_html($cntct_focus->column_fields['mailingcity']) . '", "' . popup_decode_html($cntct_focus->column_fields['othercity']) . '", "' . popup_decode_html($cntct_focus->column_fields['mailingstate']) . '", "' . popup_decode_html($cntct_focus->column_fields['otherstate']) . '", "' . popup_decode_html($cntct_focus->column_fields['mailingzip']) . '", "' . popup_decode_html($cntct_focus->column_fields['otherzip']) . '", "' . popup_decode_html($cntct_focus->column_fields['mailingcountry']) . '", "' . popup_decode_html($cntct_focus->column_fields['othercountry']) . '","' . popup_decode_html($cntct_focus->column_fields['mailingpobox']) . '", "' . popup_decode_html($cntct_focus->column_fields['otherpobox']) . '","' . $form . '");\'>' . $temp_val . '</a>';
} else {
if ($popuptype == 'toDospecific') {
$value = '<a href="javascript:window.close();" onclick=\'set_return_toDospecific("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '");\'>' . $temp_val . '</a>';
} else {
$value = '<a href="javascript:window.close();" onclick=\'set_return_specific("' . $entity_id . '", "' . nl2br(decode_html($slashes_temp_val)) . '");\'>' . $temp_val . '</a>';
}
}
} elseif ($popuptype == "detailview") {
if ($colname == "lastname" && ($module == 'Contacts' || $module == 'Leads')) {
$temp_val = getFullNameFromQResult($list_result, $list_result_count, $module);
}
$slashes_temp_val = popup_from_html($temp_val);
$slashes_temp_val = htmlspecialchars($slashes_temp_val, ENT_QUOTES, $default_charset);
$focus->record_id = $_REQUEST['recordid'];
if ($_REQUEST['return_module'] == "Calendar") {
$value = '<a href="javascript:window.close();" id="calendarCont' . $entity_id . '" LANGUAGE=javascript onclick=\'add_data_to_relatedlist_incal("' . $entity_id . '","' . decode_html($slashes_temp_val) . '");\'>' . $temp_val . '</a>';
} else {
$value = '<a href="javascript:window.close();" onclick=\'add_data_to_relatedlist("' . $entity_id . '","' . $focus->record_id . '","' . $module . '");\'>' . $temp_val . '</a>';
}
} elseif ($popuptype == "formname_specific") {
$slashes_temp_val = popup_from_html($temp_val);
示例6: getRelatedListsInformation
$invited_users[$userid] = $username;
}
$smarty->assign("INVITEDUSERS", $invited_users);
$related_array = getRelatedListsInformation("Calendar", $focus);
$fieldsname = $related_array['Contacts']['header'];
$contact_info = $related_array['Contacts']['entries'];
$entityIds = array_keys($contact_info);
$displayValueArray = getEntityName('Contacts', $entityIds);
$entityname = array();
if (!empty($displayValueArray)) {
foreach ($displayValueArray as $key => $field_value) {
$entityname[$key] = '<a href="index.php?module=Contacts&action=DetailView&record=' . $key . '">' . $field_value . '</a>';
}
}
$smarty->assign("CONTACTS", $entityname);
$is_fname_permitted = getFieldVisibilityPermission("Contacts", $current_user->id, 'firstname');
$smarty->assign("IS_PERMITTED_CNT_FNAME", $is_fname_permitted);
}
global $theme;
$theme_path = "themes/" . $theme . "/";
$image_path = $theme_path . "images/";
$log->info("Calendar-Activities detail view");
$category = getParentTab();
$smarty->assign("CATEGORY", $category);
$smarty->assign("MOD", $mod_strings);
$smarty->assign("CMOD", $c_mod_strings);
$smarty->assign("APP", $app_strings);
$smarty->assign("ACTIVITY_MODE", $activity_mode);
if (isset($focus->name)) {
$smarty->assign("NAME", $focus->name);
} else {
示例7: get_activities
/** Function to form the query to get the list of activities
* @param int $id - ticket id
* @return array - return an array which will be returned from the function GetRelatedList
**/
function get_activities($id, $cur_tab_id, $rel_tab_id, $actions = false)
{
global $log, $singlepane_view, $currentModule, $current_user;
$log->debug("Entering get_activities(" . $id . ") method ...");
$this_module = $currentModule;
$related_module = vtlib_getModuleNameById($rel_tab_id);
require_once "modules/{$related_module}/Activity.php";
$other = new Activity();
vtlib_setup_modulevars($related_module, $other);
$singular_modname = vtlib_toSingular($related_module);
$parenttab = getParentTab();
if ($singlepane_view == 'true') {
$returnset = '&return_module=' . $this_module . '&return_action=DetailView&return_id=' . $id;
} else {
$returnset = '&return_module=' . $this_module . '&return_action=CallRelatedList&return_id=' . $id;
}
$button = '';
$button .= '<input type="hidden" name="activity_mode">';
if ($actions) {
if (is_string($actions)) {
$actions = explode(',', strtoupper($actions));
}
if (in_array('ADD', $actions) && isPermitted($related_module, 1, '') == 'yes') {
if (getFieldVisibilityPermission('Calendar', $current_user->id, 'parent_id', 'readwrite') == '0') {
$button .= "<input title='" . getTranslatedString('LBL_NEW') . " " . getTranslatedString('LBL_TODO', $related_module) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EventEditView\";this.form.module.value=\"Calendar4You\";this.form.return_module.value=\"{$this_module}\";this.form.activity_mode.value=\"Task\";' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString('LBL_TODO', $related_module) . "'> ";
}
if (getFieldVisibilityPermission('Events', $current_user->id, 'parent_id', 'readwrite') == '0') {
$button .= "<input title='" . getTranslatedString('LBL_NEW') . " " . getTranslatedString('LBL_TODO', $related_module) . "' class='crmbutton small create'" . " onclick='this.form.action.value=\"EventEditView\";this.form.module.value=\"Calendar4You\";this.form.return_module.value=\"{$this_module}\";this.form.activity_mode.value=\"Events\";' type='submit' name='button'" . " value='" . getTranslatedString('LBL_ADD_NEW') . " " . getTranslatedString('LBL_EVENT', $related_module) . "'>";
}
}
}
$userNameSql = getSqlForNameInDisplayFormat(array('first_name' => 'vtiger_users.first_name', 'last_name' => 'vtiger_users.last_name'), 'Users');
$query = "SELECT case when (vtiger_users.user_name not like '') then {$userNameSql} else vtiger_groups.groupname end as user_name," . " vtiger_activity.*, vtiger_cntactivityrel.contactid, vtiger_contactdetails.lastname, vtiger_contactdetails.firstname," . " vtiger_crmentity.crmid, vtiger_recurringevents.recurringtype, vtiger_crmentity.smownerid, vtiger_crmentity.modifiedtime," . " vtiger_seactivityrel.crmid as parent_id " . " from vtiger_activity inner join vtiger_seactivityrel on vtiger_seactivityrel.activityid=vtiger_activity.activityid" . " inner join vtiger_crmentity on vtiger_crmentity.crmid=vtiger_activity.activityid" . " left join vtiger_cntactivityrel on vtiger_cntactivityrel.activityid = vtiger_activity.activityid " . " left join vtiger_contactdetails on vtiger_contactdetails.contactid = vtiger_cntactivityrel.contactid" . " left outer join vtiger_recurringevents on vtiger_recurringevents.activityid=vtiger_activity.activityid" . " left join vtiger_users on vtiger_users.id=vtiger_crmentity.smownerid" . " left join vtiger_groups on vtiger_groups.groupid=vtiger_crmentity.smownerid" . " where vtiger_seactivityrel.crmid=" . $id . " and vtiger_crmentity.deleted=0 and (activitytype NOT IN ('Emails'))" . " AND ( vtiger_activity.status is NULL OR vtiger_activity.status != 'Completed' )" . " and ( vtiger_activity.eventstatus is NULL OR vtiger_activity.eventstatus != 'Held') ";
$return_value = GetRelatedList($this_module, $related_module, $other, $query, $button, $returnset);
if ($return_value == null) {
$return_value = array();
}
$return_value['CUSTOM_BUTTON'] = $button;
$log->debug("Exiting get_activities method ...");
return $return_value;
}
示例8: generateArray
function generateArray($ical_activity)
{
$current_user = vglobal('current_user');
$activity = array();
$activitytype = $ical_activity['TYPE'];
if ($activitytype == 'VEVENT') {
$modtype = 'Events';
} else {
$modtype = 'Calendar';
}
foreach ($this->mapping_arr as $key => $comp) {
$type = $comp['type'];
$component = $comp['component'];
if (!is_array($component)) {
if ($type != 'user') {
if (isset($this->field_mapping_arr[$component])) {
if (getFieldVisibilityPermission($modtype, $current_user->id, $this->field_mapping_arr[$component]) == '0') {
$activity[$this->field_mapping_arr[$component]] = $ical_activity[$key];
} else {
$activity[$this->field_mapping_arr[$component]] = '';
}
} else {
if (getFieldVisibilityPermission($modtype, $current_user->id, $component) == '0') {
$activity[$component] = $ical_activity[$key];
} else {
$activity[$component] = '';
}
}
}
} else {
$temp = $ical_activity[$key];
$count = 0;
if ($type == 'string') {
$values = explode('\\,', $temp);
} else {
if ($type == 'datetime' && !empty($temp)) {
$values = $this->strtodatetime($temp);
}
}
foreach ($component as $index) {
if (!isset($activity[$index])) {
if (isset($this->field_mapping_arr[$index])) {
if (getFieldVisibilityPermission($modtype, $current_user->id, $this->field_mapping_arr[$index]) == '0') {
$activity[$this->field_mapping_arr[$index]] = $values[$count];
} else {
$activity[$this->field_mapping_arr[$index]] = '';
}
} else {
if (getFieldVisibilityPermission($modtype, $current_user->id, $index) == '0') {
$activity[$index] = $values[$count];
} else {
$activity[$index] = '';
}
}
}
$count++;
}
unset($values);
}
}
if ($activitytype == 'VEVENT') {
$activity['activitytype'] = 'Meeting';
if (empty($activity['eventstatus'])) {
$activity['eventstatus'] = 'PLL_PLANNED';
}
if (!empty($ical_activity['VALARM'])) {
$temp = str_replace("P", '', $ical_activity['VALARM']['TRIGGER']);
//if there is negative value then ignore it because in vtiger even though its negative or postiview we
//make reminder to be before the event
$temp = str_replace("-", '', $temp);
$durationTypeCharacters = array('W', 'D', 'T', 'H', 'M', 'S');
$reminder_time = 0;
foreach ($durationTypeCharacters as $durationType) {
if (strpos($temp, $durationType) == false) {
continue;
}
$parts = explode($durationType, $temp);
$durationValue = $parts[0];
$temp = $parts[1];
$duration_type = $durationType;
$duration = intval($durationValue);
switch ($duration_type) {
case 'W':
$reminder_time += 24 * 24 * 60 * $durationValue;
break;
case 'D':
$reminder_time += 24 * 60 * $durationValue;
break;
case 'T':
//Skip this symbol since its just indicates the start of time component
break;
case 'H':
$reminder_time += $duration * 60;
break;
case 'M':
$reminder_time = $duration;
break;
}
}
$activity['reminder_time'] = $reminder_time;
//.........这里部分代码省略.........
示例9: setRecordFieldValues
/**
* Function to set record module field values
* @param parent record model
*/
function setRecordFieldValues($parentRecordModel)
{
$currentUser = Users_Record_Model::getCurrentUserModel();
$fieldsList = array_keys($this->getModule()->getFields());
$parentFieldsList = array_keys($parentRecordModel->getModule()->getFields());
$commonFields = array_intersect($fieldsList, $parentFieldsList);
foreach ($commonFields as $fieldName) {
if (getFieldVisibilityPermission($parentRecordModel->getModuleName(), $currentUser->getId(), $fieldName) == 0) {
$this->set($fieldName, $parentRecordModel->get($fieldName));
}
}
$fieldsToGenerate = $this->getListFieldsToGenerate($parentRecordModel->getModuleName(), $this->getModuleName());
foreach ($fieldsToGenerate as $key => $fieldName) {
if (getFieldVisibilityPermission($parentRecordModel->getModuleName(), $currentUser->getId(), $key) == 0) {
$this->set($fieldName, $parentRecordModel->get($key));
}
}
}
示例10: getFieldValues
/** Function to get tablename, columnname, fieldname, fieldlabel and uitypes of fields of merge criteria for a particular module*/
function getFieldValues($module)
{
global $adb, $current_user;
//In future if we want to change a id mapping to name or other string then we can add that elements in this array.
//$fld_table_arr = Array("vtiger_contactdetails.account_id"=>"vtiger_account.accountname");
//$special_fld_arr = Array("account_id"=>"accountname");
$fld_table_arr = array();
$special_fld_arr = array();
$tabid = getTabid($module);
$fieldname_query = "select fieldname,fieldlabel,uitype,tablename,columnname from vtiger_field where fieldid in\n\t\t\t(select fieldid from vtiger_user2mergefields WHERE tabid=? AND userid=? AND visible = ?) and vtiger_field.presence in (0,2)";
$fieldname_result = $adb->pquery($fieldname_query, array($tabid, $current_user->id, 1));
$field_num_rows = $adb->num_rows($fieldname_result);
$fld_arr = array();
$col_arr = array();
for ($j = 0; $j < $field_num_rows; $j++) {
$tablename = $adb->query_result($fieldname_result, $j, 'tablename');
$column_name = $adb->query_result($fieldname_result, $j, 'columnname');
$field_name = $adb->query_result($fieldname_result, $j, 'fieldname');
$field_lbl = $adb->query_result($fieldname_result, $j, 'fieldlabel');
$ui_type = $adb->query_result($fieldname_result, $j, 'uitype');
$table_col = $tablename . "." . $column_name;
if (getFieldVisibilityPermission($module, $current_user->id, $field_name) == 0) {
$fld_name = $special_fld_arr[$field_name] != '' ? $special_fld_arr[$field_name] : $field_name;
$fld_arr[] = $fld_name;
$col_arr[] = $column_name;
if ($fld_table_arr[$table_col] != '') {
$table_col = $fld_table_arr[$table_col];
}
$field_values_array['fieldnames_list'][] = $table_col . "." . $fld_name;
$fld_labl_arr[] = $field_lbl;
$uitype[$field_name] = $ui_type;
}
}
$field_values_array['fieldnames_list'] = implode(",", $field_values_array['fieldnames_list']);
$field_values = implode(",", $fld_arr);
$field_values_array['fieldnames'] = $field_values;
$field_values_array["fieldnames_array"] = $fld_arr;
$field_values_array["columnnames_array"] = $col_arr;
$field_values_array['fieldlabels_array'] = $fld_labl_arr;
$field_values_array['fieldname_uitype'] = $uitype;
return $field_values_array;
}
示例11: constructTodoListView
/**
* Function creates HTML to display Todos ListView
* @param array $todo_list - collection of strings(Todo Information)
* @param array $cal - collection of objects and strings
* return string $list_view - html tags in string format
*/
function constructTodoListView($todo_list, $cal, $subtab, $navigation_array = '')
{
global $mod_strings, $cal_log, $adb, $theme;
$cal_log->debug("Entering constructTodoListView() method...");
global $current_user, $app_strings;
$date_format = $current_user->date_format;
$format = $cal['calendar']->hour_format;
$hour_startat = timeString(array('hour' => date('H:i'), 'minute' => 0), '24');
$hour_endat = timeString(array('hour' => date('H:i', time() + 60 * 60), 'minute' => 0), '24');
$time_arr = getaddEventPopupTime($hour_startat, $hour_endat, $format);
$temp_ts = $cal['calendar']->date_time->ts;
//to get date in user selected date format
$temp_date = $date_format == 'dd-mm-yyyy' ? date('d-m-Y', $temp_ts) : ($date_format == 'mm-dd-yyyy' ? date('m-d-Y', $temp_ts) : ($date_format == 'yyyy-mm-dd' ? date('Y-m-d', $temp_ts) : ''));
if ($cal['calendar']->day_start_hour != 23) {
$endtemp_date = $temp_date;
} else {
$endtemp_ts = $temp_ts + 1 * 24 * 60 * 60;
$endtemp_date = $date_format == 'dd-mm-yyyy' ? date('d-m-Y', $endtemp_ts) : ($date_format == 'mm-dd-yyyy' ? date('m-d-Y', $endtemp_ts) : ($date_format == 'yyyy-mm-dd' ? date('Y-m-d', $endtemp_ts) : ''));
}
$list_view = "";
//labels of listview header
if ($cal['view'] == 'day') {
$colspan = 9;
$header = array('0' => '#', '1' => $mod_strings['LBL_TIME'], '2' => $mod_strings['LBL_LIST_DUE_DATE'], '3' => $mod_strings['LBL_TODO']);
$header_width = array('0' => '5%', '1' => '10%', '2' => '10%', '3' => '38%');
/*if(getFieldVisibilityPermission('Calendar',$current_user->id,'parent_id') == '0')
{
array_push($header,$mod_strings['LBL_RELATEDTO']);
array_push($header_width,'15%');
}
if(getFieldVisibilityPermission('Calendar',$current_user->id,'contact_id') == '0')
{
array_push($header,$mod_strings['LBL_CONTACT_NAME']);
array_push($header_width,'15%');
}*/
if (getFieldVisibilityPermission('Calendar', $current_user->id, 'taskstatus') == '0') {
array_push($header, $mod_strings['LBL_STATUS']);
array_push($header_width, '10%');
}
if (isPermitted("Calendar", "EditView") == "yes" || isPermitted("Calendar", "Delete") == "yes") {
array_push($header, $mod_strings['LBL_ACTION']);
array_push($header_width, '10%');
}
array_push($header, $mod_strings['LBL_ASSINGEDTO']);
array_push($header_width, '15%');
} else {
$colspan = 10;
$header = array('0' => '#', '1' => $mod_strings['LBL_TIME'], '2' => $mod_strings['LBL_START_DATE'], '3' => $mod_strings['LBL_DUE_DATE'], '4' => $mod_strings['LBL_TODO']);
$header_width = array('0' => '5%', '1' => '10%', '2' => '10%', '3' => '10%', '4' => '28%');
/*if(getFieldVisibilityPermission('Calendar',$current_user->id,'parent_id') == '0')
{
array_push($header,$mod_strings['LBL_RELATEDTO']);
array_push($header_width,'15%');
}
if(getFieldVisibilityPermission('Calendar',$current_user->id,'contact_id') == '0')
{
array_push($header,$mod_strings['LBL_CONTACT_NAME']);
array_push($header_width,'15%');
}*/
if (getFieldVisibilityPermission('Calendar', $current_user->id, 'taskstatus') == '0') {
array_push($header, $mod_strings['LBL_STATUS']);
array_push($header_width, '10%');
}
if (isPermitted("Calendar", "EditView") == "yes" || isPermitted("Calendar", "Delete") == "yes") {
array_push($header, $mod_strings['LBL_ACTION']);
}
array_push($header, $mod_strings['LBL_ASSINGEDTO']);
array_push($header_width, '15%');
}
if ($current_user->column_fields['is_admin'] == 'on') {
$Res = $adb->pquery("select * from vtiger_activitytype", array());
} else {
$roleid = $current_user->roleid;
$subrole = getRoleSubordinates($roleid);
if (count($subrole) > 0) {
$roleids = $subrole;
array_push($roleids, $roleid);
} else {
$roleids = $roleid;
}
if (count($roleids) > 1) {
$Res = $adb->pquery("select distinct activitytype from vtiger_activitytype inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_activitytype.picklist_valueid where roleid in (" . generateQuestionMarks($roleids) . ") and picklistid in (select picklistid from vtiger_activitytype) order by sortid asc", array($roleids));
} else {
$Res = $adb->pquery("select distinct activitytype from vtiger_activitytype inner join vtiger_role2picklist on vtiger_role2picklist.picklistvalueid = vtiger_activitytype.picklist_valueid where roleid = ? and picklistid in (select picklistid from vtiger_activitytype) order by sortid asc", array($roleid));
}
}
$eventlist = '';
for ($i = 0; $i < $adb->num_rows($Res); $i++) {
$eventlist .= $adb->query_result($Res, $i, 'activitytype') . ";";
}
$list_view .= "<table align='center' border='0' cellpadding='5' cellspacing='0' width='98%'>\n\t\t\t<tr><td colspan='3'> </td></tr>";
//checking permission for Create/Edit Operation
if (isPermitted("Calendar", "EditView") == "yes") {
$list_view .= "<tr>\n\t\t\t\t<td class='calAddButton' onMouseOver='fnAddEvent(this,\"addEventDropDown\",\"" . $temp_date . "\",\"" . $endtemp_date . "\",\"" . $time_arr['starthour'] . "\",\"" . $time_arr['startmin'] . "\",\"" . $time_arr['startfmt'] . "\",\"" . $time_arr['endhour'] . "\",\"" . $time_arr['endmin'] . "\",\"" . $time_arr['endfmt'] . "\",\"\",\"" . $subtab . "\",\"" . $eventlist . "\");'style='border: 1px solid #666666;cursor:pointer;height:30px' align='center' width='10%'>\n " . $mod_strings['LBL_ADD'] . "\n <img src='" . vtiger_imageurl('menuDnArrow.gif', $theme) . "' style='padding-left: 5px;' border='0'> </td>";
//.........这里部分代码省略.........
示例12: getAdvFilterSqlOLD2
function getAdvFilterSqlOLD2($relblockid)
{
global $current_user;
$advfilter = $this->getAdvFilterByRBid($relblockid);
$advcvsql = "";
foreach ($advfilter as $groupid => $groupinfo) {
$groupcolumns = $groupinfo["columns"];
$groupcondition = $groupinfo["condition"];
$advfiltergroupsql = "";
foreach ($groupcolumns as $columnindex => $columninfo) {
$columnname = $columninfo['columnname'];
$comparator = $columninfo['comparator'];
$value = $columninfo['value'];
$columncondition = $columninfo['column_condition'];
$columns = explode(":", $columnname);
$datatype = isset($columns[4]) ? $columns[4] : "";
if ($columnname != "" && $comparator != "") {
$valuearray = explode(",", trim($value));
if (isset($valuearray) && count($valuearray) > 1 && $comparator != 'bw') {
$advorsql = "";
for ($n = 0; $n < count($valuearray); $n++) {
$advorsql[] = $this->getRealValues($columns[0], $columns[1], $comparator, trim($valuearray[$n]), $datatype);
}
//If negative logic filter ('not equal to', 'does not contain') is used, 'and' condition should be applied instead of 'or'
if ($comparator == 'n' || $comparator == 'k') {
$advorsqls = implode(" and ", $advorsql);
} else {
$advorsqls = implode(" or ", $advorsql);
}
$advfiltersql = " (" . $advorsqls . ") ";
} elseif ($comparator == 'bw' && count($valuearray) == 2) {
$advfiltersql = "(" . $columns[0] . "." . $columns[1] . " between '" . getValidDBInsertDateTimeValue(trim($valuearray[0]), $datatype) . "' and '" . getValidDBInsertDateTimeValue(trim($valuearray[1]), $datatype) . "')";
} elseif ($comparator == 'y') {
$advfiltersql = sprintf("(%s.%s IS NULL OR %s.%s = '')", $columns[0], $columns[1], $columns[0], $columns[1]);
} else {
//Added for getting vtiger_activity Status -Jaguar
if ($this->customviewmodule == "Calendar" && ($columns[1] == "status" || $columns[1] == "eventstatus")) {
if (getFieldVisibilityPermission("Calendar", $current_user->id, 'taskstatus') == '0') {
$advfiltersql = "case when (vtiger_activity.status not like '') then vtiger_activity.status else vtiger_activity.eventstatus end" . $this->getAdvComparator($comparator, trim($value), $datatype);
} else {
$advfiltersql = "vtiger_activity.eventstatus" . $this->getAdvComparator($comparator, trim($value), $datatype);
}
} elseif ($this->customviewmodule == "Documents" && $columns[1] == 'folderid') {
$advfiltersql = "vtiger_attachmentsfolder.foldername" . $this->getAdvComparator($comparator, trim($value), $datatype);
} elseif ($this->customviewmodule == "Assets") {
if ($columns[1] == 'account') {
$advfiltersql = "vtiger_account.accountname" . $this->getAdvComparator($comparator, trim($value), $datatype);
}
if ($columns[1] == 'product') {
$advfiltersql = "vtiger_products.productname" . $this->getAdvComparator($comparator, trim($value), $datatype);
}
if ($columns[1] == 'invoiceid') {
$advfiltersql = "vtiger_invoice.subject" . $this->getAdvComparator($comparator, trim($value), $datatype);
}
} else {
$advfiltersql = $this->getRealValues($columns[0], $columns[1], $comparator, trim($value), $datatype);
}
}
$advfiltergroupsql .= $advfiltersql;
if ($columncondition != NULL && $columncondition != '' && count($groupcolumns) > $columnindex) {
$advfiltergroupsql .= ' ' . $columncondition . ' ';
}
}
}
if (trim($advfiltergroupsql) != "") {
$advfiltergroupsql = "( {$advfiltergroupsql} ) ";
if ($groupcondition != NULL && $groupcondition != '' && $advfilter > $groupid) {
$advfiltergroupsql .= ' ' . $groupcondition . ' ';
}
$advcvsql .= $advfiltergroupsql;
}
}
if (trim($advcvsql) != "") {
$advcvsql = '(' . $advcvsql . ')';
}
return $advcvsql;
}
示例13: module_Chart
//.........这里部分代码省略.........
if ($name_val != "") {
$mod_name = $name_val;
$search_str = $name_val;
}
}
if ($graph_for == "invoiceid") {
$query = "SELECT subject FROM vtiger_invoice WHERE invoiceid=?";
$result = $adb->pquery($query, array($mod_name));
$name_val = $adb->query_result($result, 0, "subject");
$id_name = $mod_name;
if ($name_val != "") {
$mod_name = $name_val;
$search_str = $name_val;
}
}
if ($graph_for == "campaignid") {
//this will return the list of the names of the campaign``:w for the y-axis
$query = "SELECT campaignname FROM vtiger_campaign WHERE campaignid=?";
$result = $adb->pquery($query, array($mod_name));
$name_val = $adb->query_result($result, 0, "campaignname");
$id_name = $mod_name;
if ($name_val != "") {
$mod_name = $name_val;
$search_str = $name_val;
}
}
if ($graph_for == "parent_id" || $graph_for == "related_to") {
$seType = getSalesEntityType($mod_name);
if ($seType == 'Contacts') {
$query = "SELECT lastname, firstname FROM vtiger_contactdetails\r\n\t\t\t\t\t\t\tWHERE contactid=?";
$result = $adb->pquery($query, array($mod_name));
$name_val = $adb->query_result($result, 0, "lastname");
if ($name_val != "") {
if (getFieldVisibilityPermission('Contacts', $current_user->id, 'firstname') == '0') {
$first_name = $adb->query_result($result, 0, "firstname");
if ($first_name != '') {
$name_val .= " " . $first_name;
}
}
}
} else {
$query = "SELECT accountname FROM vtiger_account WHERE accountid=?";
$result = $adb->pquery($query, array($mod_name));
$name_val = $adb->query_result($result, 0, "accountname");
}
$mod_name = $name_val;
$search_str = $name_val;
}
//Passing name to graph
$mod_name = str_replace(":", ":", $mod_name);
if ($mod_name_val != "") {
$mod_name_val .= "::{$mod_name}";
} else {
$mod_name_val = "{$mod_name}";
}
//Passing count to graph
if ($mod_cnt_val != "") {
$mod_cnt_val .= "::{$mod_count_val}";
} else {
$mod_cnt_val = "{$mod_count_val}";
}
if ($module != "") {
//Check for Ticket Priority
if ($graph_type == "ticketsbypriority") {
$graph_for = "ticketpriorities";
}
示例14: getColumnVisibilityPermission
/** Function to check permission to access the column for a given user
* @param $userid -- User Id :: Type integer
* @param $tablename -- tablename :: Type String
* @param $columnname -- columnname :: Type String
* @param $module -- Module Name :: Type varchar
*/
function getColumnVisibilityPermission($userid, $columnname, $module, $accessmode = 'readonly')
{
$adb = PearDatabase::getInstance();
$log = vglobal('log');
$log->debug("in function getcolumnvisibilitypermission {$columnname} -{$userid}");
$tabid = getTabid($module);
// Look at cache if information is available.
$cacheFieldInfo = VTCacheUtils::lookupFieldInfoByColumn($tabid, $columnname);
$fieldname = false;
if ($cacheFieldInfo === false) {
$res = $adb->pquery("select fieldname from vtiger_field where tabid=? and columnname=? and vtiger_field.presence in (0,2)", array($tabid, $columnname));
$fieldname = $adb->query_result($res, 0, 'fieldname');
} else {
$fieldname = $cacheFieldInfo['fieldname'];
}
return getFieldVisibilityPermission($module, $userid, $fieldname, $accessmode);
}
示例15: get_invoicestatushistory
/** Function used to get the Status history of the Invoice
* @param $id - invoice id
* @return $return_data - array with header and the entries in format Array('header'=>$header,'entries'=>$entries_list) where as $header and $entries_list are arrays which contains header values and all column values of all entries
*/
function get_invoicestatushistory($id)
{
$log = vglobal('log');
$log->debug("Entering get_invoicestatushistory(" . $id . ") method ...");
$adb = PearDatabase::getInstance();
global $mod_strings;
global $app_strings;
$query = 'select vtiger_invoicestatushistory.*, vtiger_invoice.invoice_no from vtiger_invoicestatushistory inner join vtiger_invoice on vtiger_invoice.invoiceid = vtiger_invoicestatushistory.invoiceid inner join vtiger_crmentity on vtiger_crmentity.crmid = vtiger_invoice.invoiceid where vtiger_crmentity.deleted = 0 and vtiger_invoice.invoiceid = ?';
$result = $adb->pquery($query, array($id));
$noofrows = $adb->num_rows($result);
$header[] = $app_strings['Invoice No'];
$header[] = $app_strings['LBL_ACCOUNT_NAME'];
$header[] = $app_strings['LBL_AMOUNT'];
$header[] = $app_strings['LBL_INVOICE_STATUS'];
$header[] = $app_strings['LBL_LAST_MODIFIED'];
//Getting the field permission for the current user. 1 - Not Accessible, 0 - Accessible
//Account Name , Amount are mandatory fields. So no need to do security check to these fields.
$current_user = vglobal('current_user');
//If field is accessible then getFieldVisibilityPermission function will return 0 else return 1
$invoicestatus_access = getFieldVisibilityPermission('Invoice', $current_user->id, 'invoicestatus') != '0' ? 1 : 0;
$picklistarray = getAccessPickListValues('Invoice');
$invoicestatus_array = $invoicestatus_access != 1 ? $picklistarray['invoicestatus'] : array();
//- ==> picklist field is not permitted in profile
//Not Accessible - picklist is permitted in profile but picklist value is not permitted
$error_msg = $invoicestatus_access != 1 ? 'Not Accessible' : '-';
while ($row = $adb->fetch_array($result)) {
$entries = array();
// Module Sequence Numbering
//$entries[] = $row['invoiceid'];
$entries[] = $row['invoice_no'];
// END
$entries[] = $row['accountname'];
$entries[] = $row['total'];
$entries[] = in_array($row['invoicestatus'], $invoicestatus_array) ? $row['invoicestatus'] : $error_msg;
$entries[] = DateTimeField::convertToUserFormat($row['lastmodified']);
$entries_list[] = $entries;
}
$return_data = array('header' => $header, 'entries' => $entries_list);
$log->debug("Exiting get_invoicestatushistory method ...");
return $return_data;
}