
%%%%%%%%%%%%%%%%%%%%%% FRAME PARCOURS / COMPETENCES (1/parcours)
% 1 parcours = 1 frame

% Usage : \frameParcours{abbr_parcours}{n°_parcours}
\newcommand\frameParcours[2]{
\xdef\PARABBR{#1} % Nom du parcours : Cyber
\xdef\COUPAR{#2} % N° du parcours : Cyber
%\def\PARABBR{Cyber}
%\def\COUPAR{1}

  \begin{frame}[plain]{}
		% Titre de la frame
    \begin{tikzpicture}[overlay, remember picture]
			\coordinate(topleftcorner) at ($ (current page.north west) + (10mm,-12mm) $); % Dimension de la frame
			\coordinate(toprightcorner) at ($ (current page.north east) + (-10mm,-10mm) $);
		
      \stdsetup
      \coordinate (bottompoint) at  ($ (lastpoint)+(0,-30mm) $);
      \node[outer sep=0,inner sep=0mm,
						fit=(bottompoint)(toprightcorner),
						align=flush center,
						text=black,fill=titlebg!\COUPAR 0!white,%
						blur shadow={shadow blur steps=5}
      ] (xtitle) {
        \begin{hyphenrules}{nohyphenation}\Large\bfseries Parcours \PARABBR \\[3mm]%
          {\csname parcoursname\PARABBR \endcsname}
        \end{hyphenrules}%
      };
      \coordinate (lastpoint) at ($ (lastpoint|-bottompoint)+(0,-4mm) $);
      \coordinate (topleft) at ($ (lastpoint)+(2mm,-2mm) $);
      \coordinate (offset) at (54mm,0); % 45 
      \coordinate (bottomright) at ($ (lastpoint)+(49mm,-32mm) $); % Réglage largeur des compétences initialement 41
			
			% 1 colonne par compétence
			\xdef\loopcompparcours{\csname loopcompparcours\PARABBR \endcsname}
			\foreach \CNOM/\CTYPE/\CLETTRE [count=\COUXX] in \loopcompparcours { % Boucle sur les compétences : 1 compétence = 1 colonne
			
			\ifcsdef{compname\CNOM}{ %compname#1#2\endcsname{#3}
          \node[%
          outer sep=0,inner sep=2mm,%
          text width=38mm,%
          fit=(topleft)(bottomright),%
          align=flush center,%
          fill=comp\CTYPE\CLETTRE,text=comp\CTYPE\CLETTRE p,%
          blur shadow={shadow blur steps=5}%
          ] (headbox\CNOM) {\begin{hyphenrules}{nohyphenation}
								\large \textbf{\csname compname\CNOM\endcsname}\end{hyphenrules}}; % Le nom de la compétence
					
					\coordinate(highright) at ($ (bottomright)+(2mm,-5mm) $);
          \coordinate(highleft) at ($ (highright-|topleft)+(-2mm,0) $);
          \coordinate(highmid) at ($ .5*(highright)+.5*(highleft) $);
          \coordinate(sep0) at ($ (highright)+(0,1mm) $);
					
					\ifthenelse{\equal{\CTYPE}{S}}{ % type S décalage lié à l'absence de niveau en 1ère année A
					    \coordinate(lowright) at ($ (highright)+(0mm,-30mm) $);
              \coordinate(lowleft) at ($ (highleft)+(0mm,-30mm) $);
              \coordinate(lowmid) at ($ .5*(lowright)+.5*(lowleft)+(0,-5mm) $);
              \coordinate(highright) at ($ (lowright)+(0,-2mm) $);
              \coordinate(highleft) at ($ (lowleft)+(0,-2mm) $);
              \coordinate(highmid) at ($ .5*(highright)+.5*(highleft) $);
							\coordinate (sep1) at ($ (lowright)+(0,-1mm) $); % le sepS1S2
					}{};
					
					\foreach \NIV [count=\COUNIV] in \nivloop {% boucle sur les niveaux : 1 niveau = 1 flèche
					 % niveaudesc#1#2\Alph{cptniveau#1#2}
            \ifcsdef{niveauname\CNOM\NIV}{ % si le niveau existe
              \coordinate(lowright) at ($ (highright)+(0mm,-30mm) $); % 
              \coordinate(lowleft) at ($ (highleft)+(0mm,-30mm) $);
              \coordinate(lowmid) at ($ .5*(lowright)+.5*(lowleft)+(0,-5mm) $);
              \draw[thick,%
              fill=comp\CTYPE\CLETTRE!\csname niveaufill\NIV\endcsname!white,
              draw=comp\CTYPE\CLETTRE!\csname niveaupath\NIV\endcsname!white,
              blur shadow={shadow blur steps=5}
              ](highright)--(highmid)--(highleft)--(lowleft)--(lowmid)--(lowright)--cycle; % pourtour
              \node[%
              outer sep=0,inner sep=0mm,%
              text width=20mm,%
              fit=(highmid)(lowleft)(lowright),%
              align=flush center,%
              fill=comp\CTYPE\CLETTRE!\csname niveaufill\NIV\endcsname!white,
              text=comp\CTYPE\CLETTRE p!\csname niveauink\NIV\endcsname!black,
              ] (headbox\CNOM\NIV) {
                \textbf{\csname niveauname\CNOM\NIV\endcsname}\\
                \begin{hyphenrules}{nohyphenation}
								\csname niveaudesc\CNOM\NIV\endcsname
								\end{hyphenrules}
              };
              \coordinate(highright) at ($ (lowright)+(0,-2mm) $);
              \coordinate(highleft) at ($ (lowleft)+(0,-2mm) $);
              \coordinate(highmid) at ($ (lowmid)+(0,-2mm) $);
            }{
              \coordinate(lowright) at ($ (highright)+(0mm,-30mm) $);
              \coordinate(lowleft) at ($ (highleft)+(0mm,-30mm) $);
              \coordinate(lowmid) at ($ .5*(lowright)+.5*(lowleft)+(0,-5mm) $);
              \coordinate(highright) at ($ (lowright)+(0,-2mm) $);
              \coordinate(highleft) at ($ (lowleft)+(0,-2mm) $);
              \coordinate(highmid) at ($ (lowmid)+(0,-2mm) $);
            }% fin du test sur l'existence du niveau
            

						\ifthenelse{\equal{\CTYPE}{C}}{ % comp communes
							\coordinate (sep\COUNIV) at ($ (lowright)+(0,-1mm) $);
						}{ % comp spécif
							\pgfmathparse{int(\COUNIV+1)};
							\coordinate (sep\pgfmathresult) at ($ (lowright)+(0,-1mm) $);
						}
						
					} % fin de la boucle sur le niveau
			}{} % fin du test sur l'existence de la compétence
			
			    \coordinate (topleft) at ($ (topleft)+(offset) $);
          \coordinate (bottomright) at ($ (bottomright)+(offset) $);
					
				%% Background = la ligne des semestres
      \begin{pgfonlayer}{background}
        \foreach \NIV [count=\COUNIV] in \nivloop {%
          \draw[draw=black,dashed,thin] (sep\COUNIV-|topleftcorner)--(sep\COUNIV-|toprightcorner);
          \pgfmathparse{int(\COUNIV*2)};
          \edef\mylabel{\pgfmathresult}
          \node[anchor=north east,rotate=-90,xshift=-5mm] at (sep\COUNIV-|toprightcorner) {S\mylabel};
          \pgfmathparse{int(\COUNIV*2-1)};
          \edef\mylabel{\pgfmathresult}
          \pgfmathparse{int(\COUNIV-1)};
          \edef\mylabelb{\pgfmathresult}
          \node[anchor=north west,rotate=-90,xshift=5mm] at (sep\mylabelb-|toprightcorner) {S\mylabel};
        }
      \end{pgfonlayer}
					
			} % fin de la boucle sur les compétences
			
				% Le numero de pages
		\node[inner sep=0,outer sep=0,text width=33mm,anchor=north,align=center] (testarrow) at ($ (bottomrightcorner)+(0mm,0mm) $) {
\insertframenumber{}~/~\inserttotalframenumber{}
};

		\end{tikzpicture}
\end{frame}
			
}
