Subversion Repositories wimsdev

Rev

Rev 12980 | Blame | Compare with Previous | Last modification | View Log | RSS feed

!if robot isin $session or _ isin $session
  !exit
!endif
!read adm/class/classlang names.phtml
!default module_title2=$module_title

listlim=100
wims_prefix=class user tmp
wims_module_log=$type $keyword
wims_helper=chapter=3
wims_form_method=post
wims_ref_otherlangs=yes
!default class_bgcolor=$wims_bgcolor
!default class_bgimg=$wims_bgimg
!default class_css=$wims_css

!if $class!=$empty
  ## output auth_method_list, aut_idp_method_list, auth_method, aut_idp_method
  !read adm/class/initclass $class,auth
!endif
!!useful ! if $class=$empty
superclass=!text remove . in $superclass
!if $wims_superclass!=$empty
  superclass=$wims_superclass
!endif

!default superclass2=$superclass
!read tabletheme
!if $auth_method=$empty and $class!=$empty
  !bound type within supervisor,participant,example,\
    authsupervisor,authparticipant,forgetpwd default example
!else
  !bound type within supervisor,participant,example,\
    authsupervisor,authparticipant default example
!endif
!if $type=example
  superclass=
!endif

!if $type=forgetpwd
  !changeto forgetpwd.proc
!endif

!if $superclass=$empty
  indf=wimshome/log/classes/.index
  limited=yes
!else
  indf=wimshome/log/classes/$superclass/.subclasses
  keyword=
!endif
keyword=!items2words $keyword
keyword=!trim $keyword
kw=!words2items $keyword
kw=!deaccent $kw
kw=!tolower $kw
ccnt=!recordcnt $indf
!if $wims_class!=$empty
  !read var.direct
  !if $error!=$empty
    !exit
  !endif
!endif

clcnt=0
encnt=0
lacnt=0
excnt=0
listla=
!if $type=example
  !for i=1 to $ccnt
    l=!record $i of $indf
    c=!item 1 of $l
    !if NaN notin $[$c] and $c<10000
      ltest=!defof class_lang in wimshome/log/classes/$c/.def
      !advance excnt
      !if $module_language iswordof $ltest
        laclasses=!append line $l to $laclasses
        !advance lacnt
      !else
        listla=!append item $ltest to $listla
        !if $ltest=en
          enclasses=!append line $l to $enclasses
          !advance encnt
        !endif
      !endif
    !endif
  !next i

  !if $lacnt>0
    clcnt=$lacnt
    classes=$laclasses
  !else
    clcnt=$encnt
    classes=$enclasses
  !endif

  listla=!listuniq $listla
  listla=!replace internal , by </span>, <span class="tt"> in <span class="tt">$listla</span>
  othercnt=$[$excnt-$lacnt]
!endif

!if $type iswordof supervisor participant
  sccnt=0
  !if $wims_class!=$empty
    !defread wimshome/log/classes/$wims_class/.def
    !! n_type is not always good
    !set wims_ariane=!append line n_$type,8, to $wims_ariane
    !default class_type=0
    !set wims_ariane_self=no
    !if $class_type>=2
      !read adm/class/userdef classes,$wims_class,$wims_user
      supervisable=!defof user_supervisable in $userdef
      super_type=!defof class_type in wimshome/log/classes/$wims_superclass/.def
      !ifval $super_type=4
        stype=$[$super_type]
        sp=!translate internal / to , in $superclass2
        splevel=!itemcnt $sp
        sparent=!item 1 to -2 of $sp
        sparent=!translate internal , to / in $sparent
        sparent=!nospace $sparent
        !if $splevel=1
          classes1=!record 0 of wimshome/log/classes/$superclass2/levels
        !endif
        !if $splevel=2
          classes1=!record 0 of wimshome/log/classes/$superclass2/classes
          classes2=!record 0 of wimshome/log/classes/$superclass2/programs
          !!classes1=!append line $classes2 to $classes1
        !endif
        !if $splevel=3
          classes1=!record 0 of wimshome/log/classes/$superclass2/courses
        !endif
        clcnt=!linecnt $classes1
        clcnt_pr=!linecnt $classes2
        classes=
        classes_pr=
        !for i=1 to $clcnt
          l=!line $i of $classes1
          !distribute items $l into code,Sup,name,sup
          classes=!append line $wims_superclass/$code,,,$name to $classes
        !next i
        !for i=1 to $clcnt_pr
          l=!line $i of $classes2
          !distribute items $l into code,Sup,name,sup
          classes_pr=!append line $wims_superclass/$code,,,$name to $classes_pr
        !next i
        !exit
      !endif
    !endif
  !endif

  !for i=1 to $ccnt
    l=!record $i of $indf
    !distribute items $l into code,expire,inst,cl,la,ty
    l1=!deaccent $l
    l1=!tolower $l1
    c1=!text extract 0123456789 in $code
    k=yes
    !for w in $kw
      !if $w notin $l1
        k=no
        !break
      !endif
    !next w
    !!delete condition on language in a superclass
    !if (/ isin $code or $c1>9999) and ($la=$module_language or $class_type!=) and\
      ($code!=$wims_class or ($wims_user!=supervisor and $type=supervisor)) and \
      $k = yes
      !if $ty isin 24
        sclasses=!append line $l to $sclasses
        !advance sccnt
      !else
        classes=!append line $l to $classes
        !advance clcnt
      !endif
    !endif
    !if $limited = yes and $clcnt+$sccnt > $listlim
      overflow=yes
      !break
    !endif
  !next i
  !if $wims_user!=$empty and $wims_supertype iswordof 2 4
    sccnt=0
  !endif
!endif

!if $type iswordof authparticipant authsupervisor
  !reset class_defined
  class=!text remove . in $class
  !defread wimshome/log/classes/$class/.def
  !!#### la seconde condition pour entrer dans la classe en tant que supervisor :
  !!#### le user est supervisor de cette classe, ou wims_realuser est supervisor ou vide (cas de l'administrateur) ou la classe est la classe test

  !if $type=authsupervisor and ($class isitemof $wims_supervise or $wims_realuser=$empty or $wims_realuser=supervisor or $wims_realuser=SUPERVISOR or /0/ isin $class/)
    !default auth_user=supervisor
  !endif

  !if $save_logincgu!=$empty
    auth_user=$save_logincgu
  !endif

  superclass=!defof class_superclass in wimshome/log/classes/$class/.def
  !default superclass=$class

  !if $class_defined=yes and ($auth_user!=$empty or $auth_method isitemof $auth_method_list)
    !changeto var.auth
  !endif
!endif