コード例 #1
0
ファイル: profile_fields.php プロジェクト: babae/etano
        $o = $totalrows - $r;
        $o = $o >= 0 ? $o : 0;
    }
    $query = "SELECT a.`pfield_id`,a.`dbfield`,a.`field_type`,a.`searchable`,a.`at_registration`,a.`reg_page`,a.`required`,b.`lang_value` as `label`,c.`fk_lk_id_pcat` FROM {$from} WHERE {$where} ORDER BY a.`order_num` LIMIT {$o},{$r}";
    if (!($res = @mysql_query($query))) {
        trigger_error(mysql_error(), E_USER_ERROR);
    }
    $i = 0;
    while ($rsrow = mysql_fetch_assoc($res)) {
        $rsrow = sanitize_and_format($rsrow, TYPE_STRING, $__field2format[TEXT_DB2DISPLAY]);
        $temp = new $rsrow['field_type']();
        $rsrow['field_type'] = $temp->display_name;
        $rsrow['searchable'] = !empty($rsrow['searchable']) ? '<img src="skin/images/check.gif" alt="" />' : '';
        $rsrow['reg_page'] = !empty($rsrow['reg_page']) && $rsrow['at_registration'] == 1 ? $rsrow['reg_page'] : ' - ';
        $rsrow['required'] = !empty($rsrow['required']) ? '<img src="skin/images/check.gif" alt="" />' : '';
        $rsrow['fk_pcat_id'] = db_key2value("`{$dbtable_prefix}lang_strings`", '`fk_lk_id`', '`lang_value`', $rsrow['fk_lk_id_pcat'], '', "AND `skin`='{$default_skin_code}'");
        $rsrow['myclass'] = $i % 2 ? 'odd_item' : 'even_item';
        $loop[] = $rsrow;
        ++$i;
    }
    $output['pager2'] = pager($totalrows, $o, $r);
}
$output['field_type'] = vector2options($accepted_fieldtype['direct']);
$output['return2me'] = 'profile_fields.php';
if (!empty($_SERVER['QUERY_STRING'])) {
    $output['return2me'] .= '?' . $_SERVER['QUERY_STRING'];
}
$output['return2me2'] = $output['return2me'];
// this is used in the add form (with method="get")
$output['return2me'] = rawurlencode($output['return2me']);
$tpl->set_file('content', 'profile_fields.html');
コード例 #2
0
 function display($type = 'all')
 {
     global $dbtable_prefix;
     $myreturn = '';
     if ($type == 'all') {
         $myreturn .= db_key2value("`{$dbtable_prefix}loc_countries`", '`country_id`', '`country`', $this->value['country'], $this->empty_value['display']);
         if (!empty($this->value['state'])) {
             $myreturn .= ' / ' . db_key2value("`{$dbtable_prefix}loc_states`", '`state_id`', '`state`', $this->value['state'], $this->empty_value['display']);
         }
         if (!empty($this->value['city'])) {
             $myreturn .= ' / ' . db_key2value("`{$dbtable_prefix}loc_cities`", '`city_id`', '`city`', $this->value['city'], $this->empty_value['display']);
         }
     } elseif ($type == 'country') {
         $myreturn .= db_key2value("`{$dbtable_prefix}loc_countries`", '`country_id`', '`country`', $this->value['country'], $this->empty_value['display']);
     } elseif ($type == 'state' && !empty($this->value['state'])) {
         $myreturn .= db_key2value("`{$dbtable_prefix}loc_states`", '`state_id`', '`state`', $this->value['state'], $this->empty_value['display']);
     } elseif ($type == 'city' && !empty($this->value['city'])) {
         $myreturn .= db_key2value("`{$dbtable_prefix}loc_cities`", '`city_id`', '`city`', $this->value['city'], $this->empty_value['display']);
     }
     return $myreturn;
 }