forked from ZwiiCMS-Team/ZwiiCampus
Clone course
This commit is contained in:
parent
62d1a00a91
commit
2d4e835269
@ -38,6 +38,7 @@ class course extends common
|
|||||||
'userHistoryExport' => self::GROUP_EDITOR,
|
'userHistoryExport' => self::GROUP_EDITOR,
|
||||||
'backup' => self::GROUP_EDITOR,
|
'backup' => self::GROUP_EDITOR,
|
||||||
'restore' => self::GROUP_EDITOR,
|
'restore' => self::GROUP_EDITOR,
|
||||||
|
'clone' => self::GROUP_ADMIN
|
||||||
];
|
];
|
||||||
|
|
||||||
public static $courseAccess = [
|
public static $courseAccess = [
|
||||||
@ -92,9 +93,11 @@ class course extends common
|
|||||||
: '';
|
: '';
|
||||||
$categorieUrl = helper::baseUrl() . 'course/swap/' . $courseId;
|
$categorieUrl = helper::baseUrl() . 'course/swap/' . $courseId;
|
||||||
$info = sprintf('<strong>%s<br /></strong>Auteur : %s<br />Id : <a href="%s" target="_blank">%s<br />', $this->getData(['course', $courseId, 'title']), $author, $categorieUrl, $courseId);
|
$info = sprintf('<strong>%s<br /></strong>Auteur : %s<br />Id : <a href="%s" target="_blank">%s<br />', $this->getData(['course', $courseId, 'title']), $author, $categorieUrl, $courseId);
|
||||||
$enrolment = sprintf('Accès : %s<br />Inscription : %s<br />',
|
$enrolment = sprintf(
|
||||||
|
'Accès : %s<br />Inscription : %s<br />',
|
||||||
self::$courseAccess[$this->getData(['course', $courseId, 'access'])],
|
self::$courseAccess[$this->getData(['course', $courseId, 'access'])],
|
||||||
self::$courseEnrolment[$this->getData(['course', $courseId, 'enrolment'])]);
|
self::$courseEnrolment[$this->getData(['course', $courseId, 'enrolment'])]
|
||||||
|
);
|
||||||
self::$courses[] = [
|
self::$courses[] = [
|
||||||
$info,
|
$info,
|
||||||
$this->getData(['course', $courseId, 'description']),
|
$this->getData(['course', $courseId, 'description']),
|
||||||
@ -311,6 +314,34 @@ class course extends common
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Duplique un cours et l'affiche dans l'éditeur
|
||||||
|
*/
|
||||||
|
public function clone()
|
||||||
|
{
|
||||||
|
// Cours à dupliquer
|
||||||
|
$courseId = $this->getUrl(2);
|
||||||
|
|
||||||
|
// Id du nouveau cours
|
||||||
|
$target = uniqid();
|
||||||
|
|
||||||
|
// Créer la structure de données
|
||||||
|
mkdir(self::DATA_DIR . $target);
|
||||||
|
|
||||||
|
$this->copyDir(self::DATA_DIR . $courseId, self::DATA_DIR . $target);
|
||||||
|
|
||||||
|
$data = $this->getData(['course', $courseId]);
|
||||||
|
$this->setData(['course', $target, $data]);
|
||||||
|
|
||||||
|
// Valeurs en sortie
|
||||||
|
$this->addOutput([
|
||||||
|
'redirect' => helper::baseUrl() . 'course/edit/' . $target,
|
||||||
|
'notification' => helper::translate('Espace dupliqué'),
|
||||||
|
'state' => true
|
||||||
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
public function delete()
|
public function delete()
|
||||||
{
|
{
|
||||||
@ -342,7 +373,7 @@ class course extends common
|
|||||||
|
|
||||||
// Valeurs en sortie
|
// Valeurs en sortie
|
||||||
$this->addOutput([
|
$this->addOutput([
|
||||||
'redirect' => helper::baseUrl() . 'course/manage',
|
'redirect' => helper::baseUrl() . 'course',
|
||||||
'notification' => $success ? helper::translate('Espace supprimé') : helper::translate('Erreur de suppression'),
|
'notification' => $success ? helper::translate('Espace supprimé') : helper::translate('Erreur de suppression'),
|
||||||
'state' => $success
|
'state' => $success
|
||||||
]);
|
]);
|
||||||
|
@ -6,37 +6,45 @@
|
|||||||
'value' => template::ico('left')
|
'value' => template::ico('left')
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
<div class="col1 offset7">
|
<div class="row textAlignCenter">
|
||||||
|
<div class="col2">
|
||||||
<?php echo template::button('categoryUser' . $this->getUrl(2), [
|
<?php echo template::button('categoryUser' . $this->getUrl(2), [
|
||||||
'href' => helper::baseUrl() . 'course/users/' . $this->getUrl(2),
|
'href' => helper::baseUrl() . 'course/users/' . $this->getUrl(2),
|
||||||
'value' => template::ico('users'),
|
'value' => 'Participants',
|
||||||
'help' => 'Participants'
|
'ico' => 'users'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col1">
|
<div class="col2">
|
||||||
<?php echo
|
<?php echo template::button('courseManageEdit' . $this->getUrl(2), [
|
||||||
template::button('courseManageEdit' . $this->getUrl(2), [
|
|
||||||
'href' => helper::baseUrl() . 'course/edit/' . $this->getUrl(2),
|
'href' => helper::baseUrl() . 'course/edit/' . $this->getUrl(2),
|
||||||
'value' => template::ico('pencil'),
|
'value' => 'Éditer',
|
||||||
'help' => 'Éditer'
|
'ico' => 'pencil'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col1">
|
<div class="col2">
|
||||||
|
<?php echo
|
||||||
|
template::button('courseManageDuplicate' . $this->getUrl(2), [
|
||||||
|
'href' => helper::baseUrl() . 'course/clone/' . $this->getUrl(2),
|
||||||
|
'value' => 'Cloner',
|
||||||
|
'ico' => 'clone'
|
||||||
|
]); ?>
|
||||||
|
</div>
|
||||||
|
<div class="col2">
|
||||||
<?php echo
|
<?php echo
|
||||||
template::button('courseManageDownload' . $this->getUrl(2), [
|
template::button('courseManageDownload' . $this->getUrl(2), [
|
||||||
'href' => helper::baseUrl() . 'course/backup/' . $this->getUrl(2),
|
'href' => helper::baseUrl() . 'course/backup/' . $this->getUrl(2),
|
||||||
'value' => template::ico('download-cloud'),
|
'value' => 'Sauvegarder',
|
||||||
'help' => 'Sauvegarder'
|
'ico' => 'download-cloud'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="col1 ">
|
<div class="col2 ">
|
||||||
<?php echo
|
<?php echo
|
||||||
template::button('courseManageDelete' . $this->getUrl(2), [
|
template::button('courseManageDelete' . $this->getUrl(2), [
|
||||||
'class' => 'courseDelete buttonRed',
|
'class' => 'courseDelete buttonRed',
|
||||||
'href' => helper::baseUrl() . 'course/delete/' . $this->getUrl(2),
|
'href' => helper::baseUrl() . 'course/delete/' . $this->getUrl(2),
|
||||||
'value' => template::ico('trash'),
|
'value' => 'Supprimer',
|
||||||
'help' => 'Supprimer'
|
'ico' => 'trash'
|
||||||
]); ?>
|
]); ?>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
Loading…
Reference in New Issue
Block a user