本文整理汇总了PHP中phpgw::safe_redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP phpgw::safe_redirect方法的具体用法?PHP phpgw::safe_redirect怎么用?PHP phpgw::safe_redirect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类phpgw
的用法示例。
在下文中一共展示了phpgw::safe_redirect方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: read
//.........这里部分代码省略.........
$where = 'AND';
}
if ($status_id) {
$filtermethod .= " {$where} {$entity_table}.status='{$status_id}' ";
$where = 'AND';
}
if ($query) {
$query = $this->db->db_addslashes($query);
$querymethod[] = "fm_branch.descr {$this->like} '%{$query}%'";
$querymethod[] = "{$entity_table}.name {$this->like} '%{$query}%'";
$this->db->query("SELECT * FROM {$attribute_table} WHERE search='1' AND {$attribute_filter} ");
while ($this->db->next_record()) {
if ($this->db->f('datatype') == 'V' || $this->db->f('datatype') == 'email' || $this->db->f('datatype') == 'CH') {
$querymethod[] = "{$entity_table}." . $this->db->f('column_name') . " {$this->like} '%{$query}%'";
} else {
$querymethod[] = "{$entity_table}." . $this->db->f('column_name') . " = '{$query}'";
}
}
if (isset($querymethod) and is_array($querymethod)) {
$querymethod = " {$where} (" . implode(' OR ', $querymethod) . ')';
$where = 'AND';
}
}
$sql .= " {$filtermethod} {$querymethod}";
$this->db2->query($sql, __LINE__, __FILE__);
$this->total_records = $this->db2->num_rows();
if (!$allrows) {
$this->db->limit_query($sql . $ordermethod, $start, __LINE__, __FILE__);
} else {
$this->db->query($sql . $ordermethod, __LINE__, __FILE__);
}
$j = 0;
$n = count($cols_return);
//_debug_array($cols_return);
$contacts = CreateObject('phpgwapi.contacts');
$agreement_list = array();
while ($this->db->next_record()) {
for ($i = 0; $i < $n; $i++) {
$agreement_list[$j][$cols_return[$i]] = $this->db->f($cols_return[$i]);
$agreement_list[$j]['grants'] = (int) isset($grants[$this->db->f('user_id')]) ? $grants[$this->db->f('user_id')] : '';
}
if (isset($cols_return_extra) && is_array($cols_return_extra)) {
for ($i = 0; $i < count($cols_return_extra); $i++) {
$value = '';
$value = $this->db->f($cols_return_extra[$i]['name']);
if (($cols_return_extra[$i]['datatype'] == 'R' || $cols_return_extra[$i]['datatype'] == 'LB') && $value) {
$sql = "SELECT value FROM {$choice_table} WHERE {$attribute_filter} AND attrib_id=" . $cols_return_extra[$i]['attrib_id'] . " AND id=" . $value;
$this->db2->query($sql);
$this->db2->next_record();
$agreement_list[$j][$cols_return_extra[$i]['name']] = $this->db2->f('value');
} else {
if ($cols_return_extra[$i]['datatype'] == 'AB' && $value) {
$contact_data = $contacts->read_single_entry($value, array('n_given' => 'n_given', 'n_family' => 'n_family', 'email' => 'email'));
$agreement_list[$j][$cols_return_extra[$i]['name']] = $contact_data[0]['n_family'] . ', ' . $contact_data[0]['n_given'];
} else {
if ($cols_return_extra[$i]['datatype'] == 'VENDOR' && $value) {
$sql = "SELECT org_name FROM fm_vendor where id={$value}";
$this->db2->query($sql);
$this->db2->next_record();
$agreement_list[$j][$cols_return_extra[$i]['name']] = $this->db2->f('org_name');
} else {
if ($cols_return_extra[$i]['datatype'] == 'CH' && $value) {
// $ch= unserialize($value);
$ch = explode(',', trim($data['value'], ','));
if (isset($ch) and is_array($ch)) {
for ($k = 0; $k < count($ch); $k++) {
$sql = "SELECT value FROM {$choice_table} WHERE {$attribute_filter} AND attrib_id=" . $cols_return_extra[$i]['attrib_id'] . " AND id=" . $ch[$k];
$this->db2->query($sql);
while ($this->db2->next_record()) {
$ch_value[] = $this->db2->f('value');
}
}
$agreement_list[$j][$cols_return_extra[$i]['name']] = @implode(",", $ch_value);
unset($ch_value);
}
} else {
if ($cols_return_extra[$i]['datatype'] == 'D' && $value) {
$agreement_list[$j][$cols_return_extra[$i]['name']] = date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], strtotime($value));
} else {
if ($cols_return_extra[$i]['datatype'] == 'timestamp' && $value) {
$agreement_list[$j][$cols_return_extra[$i]['name']] = date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], $value);
} else {
if ($cols_return_extra[$i]['datatype'] == 'link' && $value) {
$agreement_list[$j][$cols_return_extra[$i]['name']] = phpgw::safe_redirect($value);
} else {
$agreement_list[$j][$cols_return_extra[$i]['name']] = $value;
}
}
}
}
}
}
}
}
}
$j++;
}
//_debug_array($agreement_list);
return $agreement_list;
}
示例2: get_translated_value
public function get_translated_value($data, $location_id)
{
static $cache_lb = array();
static $cache_contact = array();
static $cache_vendor = array();
static $cache_ch = array();
static $cache_account = array();
static $cache_custom_lookup = array();
if (!$data['value']) {
return $data['value'];
}
$ret = '';
$choice_table = 'phpgw_cust_choice';
$attribute_table = 'phpgw_cust_attribute';
$attribute_filter = " location_id = {$location_id}";
switch ($data['datatype']) {
case 'R':
case 'LB':
if ($data['attrib_id']) {
if (!isset($cache_lb[$location_id][$data['attrib_id']][$data['value']]) || $ret != $cache_lb[$location_id][$data['attrib_id']][$data['value']]) {
$sql = "SELECT value FROM {$choice_table} WHERE {$attribute_filter} AND attrib_id=" . (int) $data['attrib_id'] . " AND id=" . (int) $data['value'];
$this->_db2->query($sql);
$this->_db2->next_record();
$ret = $this->_db2->f('value');
$cache_lb[$location_id][$data['attrib_id']][$data['value']] = $ret;
}
}
break;
case 'AB':
if (!isset($cache_contact[$data['value']]) || $ret != $cache_contact[$data['value']]) {
$contact_data = $this->contacts->read_single_entry($data['value'], array('fn'));
$ret = $contact_data[0]['fn'];
$cache_contact[$data['value']] = $ret;
}
break;
case 'ABO':
if (!isset($cache_contact[$data['value']]) || $ret != $cache_contact[$data['value']]) {
$contact_data = $this->contacts->get_principal_organizations_data($data['value']);
$ret = $contact_data[0]['org_name'];
$cache_contact[$data['value']] = $ret;
}
break;
case 'VENDOR':
if (!isset($cache_vendor[$data['value']]) || $ret != $cache_vendor[$data['value']]) {
$sql = "SELECT org_name FROM fm_vendor where id=" . (int) $data['value'];
$this->_db2->query($sql);
$this->_db2->next_record();
$ret = $this->_db2->f('org_name', true);
$cache_vendor[$data['value']] = $ret;
}
break;
case 'CH':
if ($data['attrib_id']) {
$ret = '';
if (!isset($cache_ch[$location_id][$data['attrib_id']][$data['value']]) || $ret != $cache_ch[$location_id][$data['attrib_id']][$data['value']]) {
$ch = explode(',', trim($data['value'], ','));
if (isset($ch) and is_array($ch)) {
for ($k = 0; $k < count($ch); $k++) {
$sql = "SELECT value FROM {$choice_table} WHERE {$attribute_filter} AND attrib_id= " . (int) $data['attrib_id'] . ' AND id = ' . (int) $ch[$k];
$this->_db2->query($sql);
while ($this->_db2->next_record()) {
$ch_value[] = $this->_db2->f('value');
}
}
$ret = @implode(",", $ch_value);
unset($ch_value);
}
$cache_ch[$location_id][$data['attrib_id']][$data['value']] = $ret;
}
}
break;
case 'D':
$ret = $GLOBALS['phpgw']->common->show_date(strtotime($data['value']), $GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
break;
case 'DT':
$ret = $GLOBALS['phpgw']->common->show_date(strtotime($data['value']));
break;
case 'timestamp':
// $ret = date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'],$data['value']);
$ret = $GLOBALS['phpgw']->common->show_date($data['value']);
break;
case 'link':
$ret = phpgw::safe_redirect($data['value']);
break;
case 'user':
if (!isset($cache_vendor[$data['value']]) || $ret != $cache_vendor[$data['value']]) {
$ret = $GLOBALS['phpgw']->accounts->get($data['value'])->__toString();
$cache_vendor[$data['value']] = $ret;
}
break;
case 'pwd':
$ret = lang('yes');
break;
case 'custom1':
$ret = '';
if ($data['value'] && $data['get_single_function']) {
if (!$data['get_single_function_input']) {
$data['get_single_function_input'] = $data['value'];
}
$_compare_key = $this->_get_compare_key($data['get_single_function'], $data['get_single_function_input']);
//.........这里部分代码省略.........
示例3: index
function index()
{
if (!$this->acl_read) {
$GLOBALS['phpgw']->redirect_link('/index.php', array('menuaction' => 'property.uilocation.stop', 'perm' => 1, 'acl_location' => $this->acl_location));
}
$address = phpgw::get_var('address');
$check_payments = phpgw::get_var('check_payments', 'bool');
$location_code = phpgw::get_var('location_code');
$gaards_nr = phpgw::get_var('gaards_nr', 'int');
$bruksnr = phpgw::get_var('bruksnr', 'int');
$feste_nr = phpgw::get_var('feste_nr', 'int');
$seksjons_nr = phpgw::get_var('seksjons_nr', 'int');
$datatable = array();
$values_combo_box = array();
if (phpgw::get_var('phpgw_return_as') != 'json') {
$datatable['menu'] = $this->bocommon->get_menu();
$datatable['config']['base_url'] = $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'property.uigab.index', 'location_code' => $location_code, 'gaards_nr' => $gaards_nr, 'bruksnr' => $bruksnr, 'feste_nr' => $feste_nr, 'seksjons_nr' => $seksjons_nr, 'address' => $address, 'check_payments' => $check_payments));
$datatable['config']['allow_allrows'] = true;
$datatable['config']['base_java_url'] = "menuaction:'property.uigab.index'," . "location_code:'{$location_code}'," . "gaards_nr:'{$gaards_nr}'," . "bruksnr: '{$bruksnr}'," . "feste_nr:'{$feste_nr}'," . "seksjons_nr:'{$seksjons_nr}'," . "address:'{$address}'," . "check_payments:'{$check_payments}'";
$datatable['actions']['form'] = array(array('action' => $GLOBALS['phpgw']->link('/index.php', array('menuaction' => 'property.uigab.index', 'location_code' => $location_code, 'gaards_nr' => $gaards_nr, 'bruksnr' => $bruksnr, 'feste_nr' => $feste_nr, 'seksjons_nr' => $seksjons_nr, 'address' => $address, 'check_payments' => $check_payments)), 'fields' => array('field' => array(array('type' => 'label', 'id' => 'lbl_address', 'value' => lang('Address'), 'style' => 'filter'), array('name' => 'address', 'id' => 'txt_address', 'value' => '', 'type' => 'text', 'size' => 28, 'tab_index' => 1, 'onkeypress' => 'return pulsar(event)', 'style' => 'filter'), array('type' => 'label', 'id' => 'lbl_check', 'value' => lang('check payments'), 'style' => 'filter'), array('name' => 'check', 'id' => 'txt_check', 'value' => 0, 'type' => 'checkbox', 'tab_index' => 2, 'style' => 'filter'), array('type' => 'hidden', 'name' => 'check_payments', 'id' => 'txt_check_payments', 'value' => 0, 'style' => 'filter'), array('type' => 'label', 'id' => 'lbl_property_id', 'value' => lang('property id'), 'style' => 'filter'), array('name' => 'location_code', 'id' => 'txt_location_code', 'value' => $location_code, 'type' => 'text', 'size' => 6, 'tab_index' => 3, 'onkeypress' => 'return pulsar(event)', 'style' => 'filter'), array('type' => 'label', 'id' => 'lbl_gaards_nr', 'value' => lang('gaards nr'), 'style' => 'filter'), array('name' => 'gaards_nr', 'id' => 'txt_gaards_nr', 'value' => '', 'type' => 'text', 'size' => 6, 'tab_index' => 4, 'onkeypress' => 'return pulsar(event)', 'style' => 'filter'), array('type' => 'label', 'id' => 'lbl_bruksnr', 'value' => lang('bruks nr'), 'style' => 'filter'), array('name' => 'bruksnr', 'id' => 'txt_bruksnr', 'value' => '', 'type' => 'text', 'size' => 6, 'tab_index' => 5, 'onkeypress' => 'return pulsar(event)', 'style' => 'filter'), array('type' => 'label', 'id' => 'lbl_feste_nr', 'value' => lang('Feste nr'), 'style' => 'filter'), array('name' => 'feste_nr', 'id' => 'txt_feste_nr', 'value' => '', 'type' => 'text', 'size' => 6, 'tab_index' => 6, 'onkeypress' => 'return pulsar(event)', 'style' => 'filter'), array('type' => 'label', 'id' => 'lbl_seksjons_nr', 'value' => lang('Seksjons nr'), 'style' => 'filter'), array('name' => 'seksjons_nr', 'id' => 'txt_seksjons_nr', 'value' => '', 'type' => 'text', 'size' => 6, 'tab_index' => 7, 'onkeypress' => 'return pulsar(event)', 'style' => 'filter'), array('id' => 'btn_search', 'name' => 'search', 'value' => lang('search'), 'type' => 'button', 'tab_index' => 8, 'style' => 'filter'), array('id' => 'btn_reset', 'name' => 'reset', 'value' => lang('reset'), 'type' => 'reset', 'tab_index' => 9, 'style' => 'filter'), array('type' => 'button', 'id' => 'btn_new', 'tab_index' => 10, 'value' => lang('add'), 'style' => 'filter'), array('type' => 'button', 'id' => 'btn_export', 'tab_index' => 11, 'value' => lang('download'), 'style' => 'filter')), 'hidden_value' => array())));
}
$gab_list = $this->bo->read($location_code, $gaards_nr, $bruksnr, $feste_nr, $seksjons_nr, $address, $check_payments);
$config = CreateObject('phpgwapi.config', 'property');
$config->read_repository();
$link_to_map = isset($config->config_data['map_url']) ? $config->config_data['map_url'] : '';
if ($link_to_map) {
$text_map = lang('Map');
}
$link_to_gab = isset($config->config_data['gab_url']) ? $config->config_data['gab_url'] : '';
$gab_url_paramtres = isset($config->config_data['gab_url_paramtres']) ? $config->config_data['gab_url_paramtres'] : 'type=eiendom&Gnr=__gaards_nr__&Bnr=__bruks_nr__&Fnr=__feste_nr__&Snr=__seksjons_nr__';
if ($link_to_gab) {
$text_gab = lang('GAB');
}
$payment_date = $this->bo->payment_date;
$uicols = array('input_type' => array('hidden', 'text', 'text', 'text', 'text', 'hidden', 'text', 'text', 'text', 'link', 'link'), 'name' => array('gab_id', 'gaards_nr', 'bruksnr', 'feste_nr', 'seksjons_nr', 'hits', 'owner', 'location_code', 'address', 'map', 'gab'), 'formatter' => array('', '', '', '', '', '', '', '', '', '', ''), 'descr' => array('dummy', lang('Gaards nr'), lang('Bruks nr'), lang('Feste nr'), lang('Seksjons nr'), lang('hits'), lang('Owner'), lang('Location'), lang('Address'), lang('Map'), lang('Gab')), 'className' => array('', '', '', '', '', '', '', '', '', '', ''));
while (is_array($payment_date) && (list(, $date) = each($payment_date))) {
$uicols['input_type'][] = 'date';
$uicols['name'][] = str_replace('/', '_', $date);
$uicols['formatter'][] = '';
$uicols['descr'][] = $date;
$uicols['className'][] = 'rightClasss';
$uicols_add['input_type'][] = 'date';
$uicols_add['name'][] = str_replace('/', '_', $date);
$uicols_add['formatter'][] = '';
$uicols_add['descr'][] = $date;
$uicols_add['className'][] = 'rightClasss';
}
$content = array();
$j = 0;
if (isset($gab_list) && is_array($gab_list)) {
foreach ($gab_list as $gab) {
for ($i = 0; $i < count($uicols['name']); $i++) {
if ($uicols['input_type'][$i] != 'hidden') {
if ($uicols['name'][$i] == 'gaards_nr') {
$value_gaards_nr = substr($gab['gab_id'], 4, 5);
$value = $value_gaards_nr;
} else {
if ($uicols['name'][$i] == 'bruksnr') {
$value_bruks_nr = substr($gab['gab_id'], 9, 4);
$value = $value_bruks_nr;
} else {
if ($uicols['name'][$i] == 'feste_nr') {
$value_feste_nr = substr($gab['gab_id'], 13, 4);
$value = $value_feste_nr;
} else {
if ($uicols['name'][$i] == 'seksjons_nr') {
$value_seksjons_nr = substr($gab['gab_id'], 17, 3);
$value = $value_seksjons_nr;
} else {
$value = isset($gab[$uicols['name'][$i]]) ? $gab[$uicols['name'][$i]] : '';
}
}
}
}
$datatable['rows']['row'][$j]['column'][$i]['value'] = $value;
$datatable['rows']['row'][$j]['column'][$i]['name'] = $uicols['name'][$i];
$datatable['rows']['row'][$j]['column'][$i]['align'] = 'center';
if (isset($uicols['input_type']) && isset($uicols['input_type'][$i]) && $uicols['input_type'][$i] == 'link' && $uicols['name'][$i] == 'map') {
$value_gaards_nr = substr($gab['gab_id'], 4, 5);
$value_bruks_nr = substr($gab['gab_id'], 9, 4);
$value_feste_nr = substr($gab['gab_id'], 13, 4);
$link = phpgw::safe_redirect($link_to_map . '?maptype=Eiendomskart&gnr=' . (int) $value_gaards_nr . '&bnr=' . (int) $value_bruks_nr . '&fnr=' . (int) $value_feste_nr);
$datatable['rows']['row'][$j]['column'][$i]['format'] = 'link';
$datatable['rows']['row'][$j]['column'][$i]['value'] = $text_map;
$datatable['rows']['row'][$j]['column'][$i]['link'] = $link;
$datatable['rows']['row'][$j]['column'][$i]['target'] = '_blank';
}
if (isset($uicols['input_type']) && isset($uicols['input_type'][$i]) && $uicols['input_type'][$i] == 'link' && $uicols['name'][$i] == 'gab') {
$value_kommune_nr = substr($gab['gab_id'], 0, 4);
$value_gaards_nr = substr($gab['gab_id'], 4, 5);
$value_bruks_nr = substr($gab['gab_id'], 9, 4);
$value_feste_nr = substr($gab['gab_id'], 13, 4);
$value_seksjons_nr = substr($gab['gab_id'], 17, 3);
$_param = str_replace(array('__kommune_nr__', '__gaards_nr__', '__bruks_nr__', '__feste_nr__', '__seksjons_nr__'), array($value_kommune_nr, (int) $value_gaards_nr, (int) $value_bruks_nr, (int) $value_feste_nr, (int) $value_seksjons_nr), $gab_url_paramtres);
$link = phpgw::safe_redirect("{$link_to_gab}?{$_param}");
$datatable['rows']['row'][$j]['column'][$i]['format'] = 'link';
$datatable['rows']['row'][$j]['column'][$i]['value'] = $text_gab;
$datatable['rows']['row'][$j]['column'][$i]['link'] = $link;
$datatable['rows']['row'][$j]['column'][$i]['target'] = '_blank';
}
//.........这里部分代码省略.........
示例4: read
//.........这里部分代码省略.........
$__querymethod = array();
// remove block
}
break;
default:
if (!$criteria_id) {
$_querymethod[] = "{$entity_table}." . $this->db->f('column_name') . " = '{$query}'";
$__querymethod = array();
// remove block
}
}
}
}
}
$_joinmethod_datatype = array_merge($_joinmethod_datatype, $_joinmethod_datatype_custom);
foreach ($_joinmethod_datatype as $_joinmethod) {
$sql .= $_joinmethod;
}
$_querymethod = array_merge($__querymethod, $_querymethod);
if ($_querymethod) {
$querymethod = " {$where} (" . implode(' OR ', $_querymethod) . ')';
unset($_querymethod);
}
$sql .= " {$filtermethod} {$querymethod}";
// echo $sql;
$this->db2->query($sql, __LINE__, __FILE__);
$this->total_records = $this->db2->num_rows();
if (!$allrows) {
$this->db->limit_query($sql . $ordermethod, $start, __LINE__, __FILE__);
} else {
$this->db->query($sql . $ordermethod, __LINE__, __FILE__);
}
$j = 0;
$n = count($cols_return);
//_debug_array($cols_return);
$contacts = CreateObject('phpgwapi.contacts');
$s_agreement_list = array();
while ($this->db->next_record()) {
for ($i = 0; $i < $n; $i++) {
$s_agreement_list[$j][$cols_return[$i]] = stripslashes($this->db->f($cols_return[$i]));
// $s_agreement_list[$j]['grants'] = (int)$grants[$this->db->f('user_id')];
}
if (isset($cols_return_extra) && is_array($cols_return_extra)) {
foreach ($cols_return_extra as $return_extra) {
$value = '';
$value = $this->db->f($return_extra['name']);
if (($return_extra['datatype'] == 'R' || $return_extra['datatype'] == 'LB') && $value) {
$sql = "SELECT value FROM {$choice_table} WHERE {$attribute_filter} AND attrib_id=" . $return_extra['attrib_id'] . " AND id=" . $value;
$this->db2->query($sql);
$this->db2->next_record();
$s_agreement_list[$j][$return_extra['name']] = $this->db2->f('value');
} else {
if ($return_extra['datatype'] == 'AB' && $value) {
$contact_data = $contacts->read_single_entry($value, array('n_given' => 'n_given', 'n_family' => 'n_family', 'email' => 'email'));
$s_agreement_list[$j][$return_extra['name']] = $contact_data[0]['n_family'] . ', ' . $contact_data[0]['n_given'];
} else {
if ($return_extra['datatype'] == 'VENDOR' && $value) {
$sql = "SELECT org_name FROM fm_vendor where id={$value}";
$this->db2->query($sql);
$this->db2->next_record();
$s_agreement_list[$j][$return_extra['name']] = $this->db2->f('org_name');
} else {
if ($return_extra['datatype'] == 'CH' && $value) {
$ch = explode(',', trim($value, ','));
if (isset($ch) and is_array($ch)) {
for ($k = 0; $k < count($ch); $k++) {
$sql = "SELECT value FROM {$choice_table} WHERE {$attribute_filter} AND attrib_id=" . $return_extra['attrib_id'] . " AND id=" . $ch[$k];
$this->db2->query($sql);
while ($this->db2->next_record()) {
$ch_value[] = $this->db2->f('value');
}
}
$s_agreement_list[$j][$return_extra['name']] = @implode(",", $ch_value);
unset($ch_value);
}
} else {
if ($return_extra['datatype'] == 'D' && $value) {
$s_agreement_list[$j][$return_extra['name']] = date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], strtotime($value));
} else {
if ($cols_return_extra[$i]['datatype'] == 'timestamp' && $value) {
$s_agreement_list[$j][$return_extra['name']] = date($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'], $value);
} else {
if ($cols_return_extra[$i]['datatype'] == 'link' && $value) {
$s_agreement_list[$j][$return_extra['name']] = phpgw::safe_redirect($value);
} else {
$s_agreement_list[$j][$return_extra['name']] = $value;
}
}
}
}
}
}
}
}
}
$j++;
}
//_debug_array($s_agreement_list);
return $s_agreement_list;
}