!if $user!=$empty
  !readproc adm/class/userdef ,$wims_class,$user
  !set tmp_=!getdef user_lastname,user_firstname in $userdef
  !distribute item $tmp_ into lastname,firstname
!endif
!default name_student=!nosubst $lastname, $firstname
!if $status!=OK
  !form reply
  <input type="hidden" name="job" value="select">
  <input type="hidden" name="status" value="OK">
  <fieldset class="property_fields halfwidth blockcenter">
    <legend>$name_title
  !if $user!=$empty
    ($name_student)
  !endif
    </legend>
   <div class="field box">
      <label for="showsheet">$name_showsheet</label>
      <br>
  !set wims_formselect_switch=multiple size="$[min($activelist_cnt,10)]"
  !formselect showsheet list $activlist prompt $(shs_title[$(activlist)])
    </div>
    <div class="wimscenter wimsform">
      <input type="submit" value="$wims_name_Show">
    </div>
  !read script/choix.phtml
   </fieldset>
  !formend
!else
  !if $usercnt==0
    $name_noparticipant
  !else
    !default showsheet=$activlist
    !default graphics=0
    !if $graphics=1
      !default choice=first
      !if $choice=all
        !set choice=first
      !endif
    !else
      !if $choice!=login
        !reset loginlist
      !endif
    !endif
    !set nbth=4
    !if $user=$empty
      <p>$name_click</p>
    !endif
    !if $graphics!=1
      !set table_id=TABLE_userlist
      !set table_class=sortable
    !endif
    $table_header
    <thead>
    <tr>
    <th colspan="5"></th>
    !for j in $showsheet
      !if $(activ[$j])>0
        <th colspan="2" class="small">$wims_name_Sheet $j <br>$(shs_title[$j])<br>($(nbexo$j) $name_exo)</th>
        !increase nbth
        !increase nbth
      !endif
    !next j
    </tr>
    $table_hdtr
    <th scope="col">$wims_name_lastname, $wims_name_firstname</th>
    <th scope="col">$name_lastconnexion</th>
    <th scope="col" data-sort-method="number">$name_nbsessions</th>
    <th scope="col" class="small" data-sort-method="number">$wims_name_cnt_exo<br> ($nbexototal $name_exo)</th>
    <th>$name_total</th>
    !for j in $showsheet
      !if $(activ[$j])>0
        <th class="small" scope="col" data-sort-method="number">$name_cnt_exo</th>
        <th class="small" scope="col" data-sort-method="number">$name_time</th>
      !endif
    !next j
    </tr>
    </thead>
    <tbody>
    !!!no efficient !
    !set nbpart=0
    !for m=1 to $usercnt
      !if $nbpart > $limitpart and $choice!=all
        !break
      !endif
      !set uu=!record $m of wimshome/log/classes/$wims_class/.userlist
      !distribute items $uu into lastname,firstname,uu
      !if $choice=first and $m=1
        !default user=$uu
      !endif
      !if $choice=all or ($choice=login and $uu isitemof $loginlist and $user=$empty) \
          or ($choice=select and $uu isitemof $select_user)\
        or $uu=$user\
        or ($choice=filter and $varfilter_!=$empty)
        !if $varfilter_!=$empty
          !reset var_filter_test
          !readproc adm/vfilter/testfilter $uu\
$varfilter_
          !if $var_filter_test!=1
            !goto enduser
          !endif
        !endif
        !set getraw=$uu
        !increase nbpart
        !readproc script/raw.proc
        $table_tr
        <td>
          !href cmd=reply&job=useractivity&user=$uu $name_student
        </td>
        !for h = 1 to 2*$sheetcnt + 4
          !set h1=$[($h+$h%2)/2-2]
          !if $h <=4 or ($h>4 and $(activ[$h1])>0) and $h1 isitemof $showsheet
            !if $h>2 and . notin $[$h/2]
              !if $(data[$h])!=$empty
                !let tmp=!replace internal : by , in $(data[$h])
                !let tmp=$[$(tmp[1])*3600+$(tmp[2])*60+$(tmp[3])]
              !else
                !let tmp=-1
              !endif
              <td data-sort="$tmp">$(data[$h])
            !else
              <td data-sort="$(data[$h])">$(data[$h])
            !endif
            !if $h=3 and $(data[$h])!=$empty and $(data[-1])>0
              <span style="color:orange">+ $(data[-1])</span>
            !endif
            !set h2=$[$h%2]
            !if $h1 isitemof $showsheet and $h2=1
              !if , isin $showsheet
                !set bb=!select $databyday where column 1=$h1
              !else
                !set bb=$(databyday[1;])
              !endif
              !if $bb!=$empty
                !set bb=!exec pari vecsum($(bb[6]))
                <span style="color:orange">+ $bb</span>
              !endif
            !endif
            </td>
          !endif
        !next h
        </tr>
        !if $graphics=1
          $table_tr
          <td colspan="$[$nbth+1]" style="text-align:left;">
          !read script/exobyday.phtml
          </td></tr>
        !endif
      !endif
  :enduser
    !next m
    </tbody>
    $table_end
    !read tablesort.phtml
  !endif
!endif

!if $choice!=all
  !read adm/class/getnextuser $wims_class,$user,activity,user
!endif
