Commit 0c9f43be authored by sylvieg's avatar sylvieg

[MOD]field displayed in user info can be of any type (not only text and img)

parent 90f13567
......@@ -1366,7 +1366,7 @@ class TrackerLib extends TikiLib {
}
// Lists all the fields for an existing tracker
function list_tracker_fields($trackerId, $offset=0, $maxRecords=-1, $sort_mode='position_asc', $find='', $tra_name=true) {
function list_tracker_fields($trackerId, $offset=0, $maxRecords=-1, $sort_mode='position_asc', $find='', $tra_name=true, $filter='') {
global $feature_multilingual, $language;
if ($find) {
$findesc = '%' . $find . '%';
......@@ -1377,6 +1377,17 @@ class TrackerLib extends TikiLib {
$bindvars=array((int) $trackerId);
}
if (!empty($filter)) {
foreach ($filter as $type=>$val) {
if ($type == 'fields') {
if (count($val) > 0) {
$mid .= ' and `fieldId` in ('.implode(",",array_fill(0,count($val),'?')).')';
$bindvars = array_merge($bindvars, $val);
}
}
}
}
$query = "select * from `tiki_tracker_fields` $mid order by ".$this->convert_sortmode($sort_mode);
$query_cant = "select count(*) from `tiki_tracker_fields` $mid";
$result = $this->query($query,$bindvars,$maxRecords,$offset);
......
<?php
// $Header: /cvsroot/tikiwiki/tiki/tiki-user_information.php,v 1.40 2007-03-21 18:10:00 gillesm Exp $
// $Header: /cvsroot/tikiwiki/tiki/tiki-user_information.php,v 1.41 2007-05-04 14:09:48 sylvieg Exp $
// Copyright (c) 2002-2007, Luis Argerich, Garland Foster, Eduardo Polidor, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
......@@ -135,24 +135,18 @@ if ($feature_display_my_to_others == 'y') {
}
if ( $user_tracker_infos ) {
// arg passed 11,56,58,68
$trackerinfo=explode(',',$user_tracker_infos) ;
$UserTrackerID=$trackerinfo[0] ;
array_shift ($trackerinfo);
foreach ( $trackerinfo as $value )
{
$field=$trklib->get_tracker_field($value) ;
$FieldTrk[$value]=$field;
$ValueTrk[$value]=$trklib->get_item_value($UserTrackerID,$trklib->get_user_item($UserTrackerID,array('oneUserItem'=>'y'),$userwatch),$value);
$FieldTrk[$value]["options"]=explode(',', $FieldTrk[$value]["options"]);
}
$smarty->assign_by_ref('FieldTrk',$FieldTrk);
$smarty->assign_by_ref('ValueTrk',$ValueTrk);
// arg passed 11,56,58,68=trackerId,fieldId...
$trackerinfo = explode(',',$user_tracker_infos) ;
$userTrackerId = $trackerinfo[0] ;
array_shift ($trackerinfo);
$fields = $trklib->list_tracker_fields($userTrackerId, 0, -1, 'position_asc', '', true, array('fields'=>$trackerinfo));
foreach ($fields['data'] as $field) {
$lll[$field['fieldId']] = $field;
}
$items = $trklib->list_items($userTrackerId, 0, 1, '', $lll, $trklib->get_field_id_from_type($userTrackerId, 'u', '1'), $userwatch);
$smarty->assign_by_ref('userItem',$items['data'][0]);
}
ask_ticket('user-information');
// disallow robots to index page:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment