!distribute item $user_lastname,$user_firstname into lastname,firstname
!default name_student=!nosubst $lastname, $firstname

!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="field box">
      $name_graphics
      !formradio graphics list 0,1 prompt $wims_name_no,$wims_name_yes
    </div>
    <div class="wimscenter wimsform">
      <input type="submit" value="$wims_name_Show">
    </div>
   </fieldset>
!formend
!if $showsheet!=$empty
  !default showsheet=$activlist
  !default graphics=0
  !set nbth=4
  !if $graphics!=1
    !set table_id=TABLE_userlist
    !set table_class=sortable
  !endif
  $table_header
  <thead>
    <tr>
      <th colspan="4"></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">$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>
  !set getraw=$user
  !readproc script/raw.proc
  $table_tr
  !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
      <td>
      !if $h>2 and . notin $[$h/2]
        $(data[$h])
      !else
        $(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
  </tbody>
  $table_end
!endif


