Fix signature enrol popup

move signature to core
This commit is contained in:
Fred Tempez 2023-10-12 15:38:58 +02:00
parent 16132a9b8e
commit 9e708fcd10
4 changed files with 24 additions and 45 deletions

View File

@ -1469,4 +1469,27 @@ class common
} }
} }
/**
* Retourne la signature d'un utilisateur
*/
public function signature($userId)
{
switch ($this->getData(['user', $userId, 'signature'])) {
case 1:
return $userId;
break;
case 2:
return $this->getData(['user', $userId, 'pseudo']);
break;
case 3:
return $this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']);
break;
case 4:
return $this->getData(['user', $userId, 'lastname']) . ' ' . $this->getData(['user', $userId, 'firstname']);
break;
default:
return $this->getData(['user', $userId, 'firstname']);
}
}
} }

View File

@ -1,7 +1,7 @@
<?php echo template::formOpen('courseSwapForm'); ?> <?php echo template::formOpen('courseSwapForm'); ?>
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">
<?php echo "<h3>Auteur : " . $this->getData(['course', $this->getUrl(2), 'author']) . "</h3>"; ?> <?php echo "<h3>Auteur : " . $this->signature($this->getData(['course', $this->getUrl(2), 'author'])). "</h3>"; ?>
<?php echo "<p>Description : " . $this->getData(['course', $this->getUrl(2), 'description']) . "</p>"; ?> <?php echo "<p>Description : " . $this->getData(['course', $this->getUrl(2), 'description']) . "</p>"; ?>
<?php echo "<p>Disponibilité : " . $module::$courseAccess[$this->getData(['course', $this->getUrl(2), 'access'])]; ?> <?php echo "<p>Disponibilité : " . $module::$courseAccess[$this->getData(['course', $this->getUrl(2), 'access'])]; ?>
<?php if ($this->getData(['course', $this->getUrl(2), 'access']) === $module::COURSE_ACCESS_DATE): ?> <?php if ($this->getData(['course', $this->getUrl(2), 'access']) === $module::COURSE_ACCESS_DATE): ?>

View File

@ -897,26 +897,4 @@ class blog extends common
} }
} }
/**
* Retourne la signature d'un utilisateur
*/
public function signature($userId)
{
switch ($this->getData(['user', $userId, 'signature'])) {
case 1:
return $userId;
break;
case 2:
return $this->getData(['user', $userId, 'pseudo']);
break;
case 3:
return $this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']);
break;
case 4:
return $this->getData(['user', $userId, 'lastname']) . ' ' . $this->getData(['user', $userId, 'firstname']);
break;
default:
return $this->getData(['user', $userId, 'firstname']);
}
}
} }

View File

@ -548,28 +548,6 @@ class news extends common
} }
} }
/**
* Retourne la signature d'un utilisateur
*/
private function signature($userId)
{
switch ($this->getData(['user', $userId, 'signature'])) {
case 1:
return $userId;
break;
case 2:
return $this->getData(['user', $userId, 'pseudo']);
break;
case 3:
return $this->getData(['user', $userId, 'firstname']) . ' ' . $this->getData(['user', $userId, 'lastname']);
break;
case 4:
return $this->getData(['user', $userId, 'lastname']) . ' ' . $this->getData(['user', $userId, 'firstname']);
break;
default:
return $this->getData(['user', $userId, 'firstname']);
}
}
/** /**
* Mise à jour du module * Mise à jour du module