From 934de3ad619a9312d093aed57a82052954c506e4 Mon Sep 17 00:00:00 2001 From: Florian Schmitt Date: Thu, 21 Dec 2023 19:34:13 +0300 Subject: [PATCH] add actions and templates folder --- actions/MailAnnuaireAction.php | 79 +++++ actions/StatsAction.php | 427 +++++++++++++++++++++++++++ actions/annuaire.js | 43 +++ actions/yunohostJsAction.php | 19 ++ actions/yunohost_user.js | 54 ++++ templates/bazar/fields/annuaire.twig | 3 + templates/bazar/fields/user.twig | 9 + templates/bazar/inputs/annuaire.twig | 15 + templates/loginldap/modal.tpl.html | 62 ++++ templates/templates/tablestats.twig | 81 +++++ 10 files changed, 792 insertions(+) create mode 100644 actions/MailAnnuaireAction.php create mode 100644 actions/StatsAction.php create mode 100644 actions/annuaire.js create mode 100644 actions/yunohostJsAction.php create mode 100644 actions/yunohost_user.js create mode 100644 templates/bazar/fields/annuaire.twig create mode 100644 templates/bazar/fields/user.twig create mode 100644 templates/bazar/inputs/annuaire.twig create mode 100755 templates/loginldap/modal.tpl.html create mode 100644 templates/templates/tablestats.twig diff --git a/actions/MailAnnuaireAction.php b/actions/MailAnnuaireAction.php new file mode 100644 index 0000000..de8c9d7 --- /dev/null +++ b/actions/MailAnnuaireAction.php @@ -0,0 +1,79 @@ +wiki->userIsAdmin()) { + $entryManager = $this->getService(EntryManager::class); + $peoples = []; + // get all users + $res = $entryManager->search([ + 'queries' => '', // Sélection par clé-valeur + 'formsIds' => [57,15,54,18,60], // Types de fiches (par ID de formulaire) + 'user' => '', // N'affiche que les fiches d'un utilisateur + 'keywords' => '', // Mots-clés pour la recherche fulltext + 'searchOperator' => 'OR', // Opérateur à appliquer aux mots-clés + 'minDate' => '', // Date minimale des fiches + 'correspondance' => '' + ]); + foreach ($res as $k => $r) { + if (empty($r['yunohost_username'])) { + $peoples[$k] = [ + 'bf_titre' => $r['bf_titre'], + 'id_fiche' => $r['id_fiche'], + 'yunohost_username' => $r['yunohost_username'] ?? '', + 'bf_mail' => $r['bf_mail'] + ]; + } + } + $output .= 'Total de personnes ayant a créer ses identifiants : ' . count($peoples) . '
'; + + // format the mail + $subject = '[Réseau Smart Academy] RAPPEL : mettez à jour votre fiche annuaire pour créer votre identifiant unique'; + $from = 'support@apps.reseau.s-mart.fr'; + $fromname = 'Réseau Smart Academy'; + $to = ''; + $messageend = ' +Saisissez les champs manquants demandés dans le formulaire et sauvegardez, vous recevrez un mail de confirmation. + +Ensuite, vous devrez vous connecter une première fois seulement sur les espaces Réseau Smart Academy puis vous serez identifié.es pour une durée de 3 mois (sauf suppression des cookies). Pour le forum, toujours avec ces mêmes identifiants, il sera demandé à la première connexion de créer un pseudo pour ce forum, c\'est l\'ultime action à effectuer pour ensuite être tranquille ! + +Pour toute incompréhension ou difficulté technique, n\'hésitez pas à nous contacter par le formulaire de contact du site sur https://reseau.s-mart.fr/?FormulaireContact . + +Merci de faire cette modification au plus vite, sans quoi vous ne pourrez pas interagir sur S.mart Academy. + +Au plaisir vous retrouver prochainement sur la plateforme ! + +Lionel Roucoules, Directeur du Réseau Smart Academy'; + foreach ($peoples as $k => $fiche) { + $to = $fiche['bf_mail'] ?? ''; + $message = 'Bonjour,' . PHP_EOL . PHP_EOL . + +'La plateforme Réseau Smart Academy évolue et propose maintenant un identifiant unique pour vous connecter au réseau central, à votre communauté (Doctorants, Fabadd-Académie, Ingénieurs techniciens, Sciences humaines et sociales), ainsi qu\'au forum.' . PHP_EOL . PHP_EOL . + +'Pour créer votre identifiant et le mot de passe de votre choix, rendez-vous sur votre fiche :' . PHP_EOL . PHP_EOL . +$GLOBALS['wiki']->href('edit', $fiche['id_fiche']); + + $message .= PHP_EOL . $messageend; + $output .= '

' . $subject . '

'; + $output .= 'Pour ' . $to . ' - Envoyer le mail

'; + $output .= nl2br($message); + $output .= '
'; + if (!empty($_GET['sendmail']) && ($_GET['sendmail'] == $k || $_GET['sendmail'] == 'all')) { + send_mail($from, $fromname, $to, $subject, $message, nl2br($message)); + } + } + } else { + $output .= 'Faut etre admin'; + } + return $output; + } +} + diff --git a/actions/StatsAction.php b/actions/StatsAction.php new file mode 100644 index 0000000..58383e8 --- /dev/null +++ b/actions/StatsAction.php @@ -0,0 +1,427 @@ +wiki->UserIsAdmin() || $this->wiki->UserIsInGroup('indicateurs')) { + $period = $this->getGlobalPeriod(); + $this->communities = [ + 'doctorants' => [ + 'title'=> "Doctorants", + 'idcommu'=>'Doc', + 'indicators' => [], + ], + 'ecocloud' => [ + 'title'=> "Ecocloud", + 'idcommu'=>'EcoC', + 'indicators' => [], + ], + 'ingetech' => [ + 'title'=> "IngéTech", + 'idcommu'=>'IngeTech', + 'indicators' => [], + ], + 'shs' => [ + 'title'=> "Sciences Humaines et Sociales", + 'idcommu'=>'SHS', + 'indicators' => [], + ], + 'fabadd' => [ + 'title'=> "FabAdd-Académie", + 'idcommu'=>'FabAdd', + 'indicators' => [], + ], + 'reseaucentral' => [ + 'title'=> "Réseau central", + 'idcommu'=>'ResC', + 'indicators' => [], + ] + ]; + $community = $this->wiki->GetParameter('community'); + // on vide les autres commus + if (!empty($community) and in_array($community, array_keys($this->communities))) { + $onlyCommunity = $this->communities[$community]; + $this->communities = []; + $this->communities[$community] = $onlyCommunity; + } + $this->indicateurs = [ + 'nb_annuaire' => [ + 'name' => '👫🏻👩🏻‍🤝‍👩🏾👨🏾‍🤝‍👨🏽 Nombre d\'inscrits de l\'annuaire', + 'formsIds' => [60,18,54,15,57], + 'queries' => ['checkboxListeCommunautesbf_checkbox_inscription_commus' => '{idcommu}'], + 'type' => 'bazar' + ], + 'nb_annuaire_ecocloud' => [ + 'name' => '👫🏻👩🏻‍🤝‍👩🏾👨🏾‍🤝‍👨🏽 Nombre d\'inscrits de l\'annuaire du wiki Ecocloud', + 'url' => 'https://ecocloud.s-mart.fr/?api/forms/1/entries', + 'type' => 'bazarapi', + 'onlyfor' => 'ecocloud' + ], + 'nb_besoins_non-resolus' => [ + 'name' => '🙏🏻 Nombre de besoins Non résolus déposés', + 'formsIds' => [51,53,22,58], + 'queries' => [ + 'checkboxListeCommunautesbf_checkbox_besoin_commu' => '{idcommu}', + "listeListeEtatDuBesoinbesoin_etat" => "NR", + ], + 'type' => 'bazar' + ], + 'nb_besoins_en-cours-resolution' => [ + 'name' => '🙏🏻 Nombre de besoins En cours de résolution déposés', + 'formsIds' => [51,53,22,58], + 'queries' => [ + 'checkboxListeCommunautesbf_checkbox_besoin_commu' => '{idcommu}', + "listeListeEtatDuBesoinbesoin_etat" => "ECR", + ], + 'type' => 'bazar' + ], + 'nb_besoins_part-resolus' => [ + 'name' => '🙏🏻 Nombre de besoins Partiellement résolus déposés', + 'formsIds' => [51,53,22,58], + 'queries' => [ + 'checkboxListeCommunautesbf_checkbox_besoin_commu' => '{idcommu}', + "listeListeEtatDuBesoinbesoin_etat" => "PR", + ], + 'type' => 'bazar' + ], + 'nb_besoins_resolus' => [ + 'name' => '🙏🏻 Nombre de besoins résolus déposés', + 'formsIds' => [51,53,22,58], + 'queries' => [ + 'checkboxListeCommunautesbf_checkbox_besoin_commu' => '{idcommu}', + "listeListeEtatDuBesoinbesoin_etat" => "R", + ], + 'type' => 'bazar' + ], + 'nb_besoins_total' => [ + 'name' => '🙏🏻 Nombre total de besoins déposés', + 'formsIds' => [51,53,22,58], + 'queries' => [ + 'checkboxListeCommunautesbf_checkbox_besoin_commu' => '{idcommu}', + ], + 'type' => 'bazar' + ], + + 'nb_ressources_tech' => [ + 'name' => '📚 Nombre de ressources Techno déposées', + 'formsIds' => [4,24,61,21,20,23,55], + 'queries' => [ + 'checkboxListeCommunautesbf_checkbox_commu_ress' => '{idcommu}', + 'checkboxListeConditionnelleRessourcebf_checkbox_categorie_ressource' => 'Tech' + ], + 'type' => 'bazar' + ], + 'nb_ressources_peda' => [ + 'name' => '📚 Nombre de ressources Pédagogiques déposées', + 'formsIds' => [4,24,61,21,20,23,55], + 'queries' => [ + 'checkboxListeCommunautesbf_checkbox_commu_ress' => '{idcommu}', + 'checkboxListeConditionnelleRessourcebf_checkbox_categorie_ressource' => 'Peda' + ], + 'type' => 'bazar' + ], + 'nb_ressources_science' => [ + 'name' => '📚 Nombre de ressources Scientifiques déposées', + 'formsIds' => [4,24,61,21,20,23,55], + 'queries' => [ + 'checkboxListeCommunautesbf_checkbox_commu_ress' => '{idcommu}', + 'checkboxListeConditionnelleRessourcebf_checkbox_categorie_ressource' => 'Sci' + ], + 'type' => 'bazar' + ], + 'nb_ressources_autres' => [ + 'name' => '📚 Nombre de ressources autres déposées', + 'formsIds' => [4,24,61,21,20,23,55], + 'queries' => [ + 'checkboxListeCommunautesbf_checkbox_commu_ress' => '{idcommu}', + 'checkboxListeConditionnelleRessourcebf_checkbox_categorie_ressource' => 'Other' + ], + 'type' => 'bazar' + ], + 'nb_ressources_total' => [ + 'name' => '📚 Nombre total de ressources déposées', + 'formsIds' => [4,24,61,21,20,23,55], + 'queries' => [ + 'checkboxListeCommunautesbf_checkbox_commu_ress' => '{idcommu}', + ], + 'type' => 'bazar' + ], + 'nb_agenda' => [ + 'name' => '📆 Nombre total d\'événements déposés dans l\'agenda', + 'formsIds' => [2,59,17,13,56], + 'queries' => [ + 'checkboxListeCommunautesbf_checkbox_evenement_commu' => '{idcommu}', + ], + 'type' => 'bazar' + ], + 'nb_amelioration_total' => [ + 'name' => '🛠️ Nombre total d’améliorations du site déposées', + 'url' => 'https://reseau.s-mart.fr/doctorants/?api/forms/23/entries', + 'type' => 'bazarapi', + 'onlyfor' => 'doctorants' + ], + 'nb_amelioration_non_resolu' => [ + 'name' => '🛠️ Nombre d’améliorations du site non-résolues', + 'url' => 'https://reseau.s-mart.fr/doctorants/?api/forms/23/entries&query=listeListeSuggestionStatusbf_statut_improvement=U', + 'type' => 'bazarapi', + 'onlyfor' => 'doctorants' + ], + 'nb_amelioration_dev' => [ + 'name' => '🛠️ Nombre d’améliorations du site "demander aux développeurs"', + 'url' => 'https://reseau.s-mart.fr/doctorants/?api/forms/23/entries&query=listeListeSuggestionStatusbf_statut_improvement=AD', + 'type' => 'bazarapi', + 'onlyfor' => 'doctorants' + ], + 'nb_amelioration_resolu' => [ + 'name' => '🛠️ Nombre d’améliorations du site résolus', + 'url' => 'https://reseau.s-mart.fr/doctorants/?api/forms/23/entries&query=listeListeSuggestionStatusbf_statut_improvement=OK', + 'type' => 'bazarapi', + 'onlyfor' => 'doctorants' + ], + 'nb_contribs-page_total' => [ + 'name' => '📝 Nombre de contributions aux pages', + 'sql_query' => 'SELECT count(id) FROM '.$this->wiki->config['table_prefix'].'pages WHERE user IN {commuusers}', + 'type' => 'sql', + ], + 'nb_contribs-page_total' => [ + 'name' => '📝 Nombre total de contributions aux pages', + 'sql_query' => 'SELECT count(id) FROM '.$this->wiki->config['table_prefix'].'pages WHERE 1', + 'type' => 'sql', + ], + 'nb_contribs-page_ariane' => [ + 'name' => '📝 Nombre de contributions aux pages par le groupe Ariane', + 'sql_query' => 'SELECT count(id) FROM '.$this->wiki->config['table_prefix'].'pages WHERE user IN {groupariane}', + 'type' => 'sql', + ], + 'nb_contribs-page_anim' => [ + 'name' => '📝 Nombre de contributions aux pages par le groupe Animateurs', + 'sql_query' => 'SELECT count(id) FROM '.$this->wiki->config['table_prefix'].'pages WHERE user IN {groupanim}', + 'type' => 'sql', + ], + 'nb_contribs-page_other' => [ + 'name' => '📝 Nombre de contributions aux pages par d\'autres contributeurs', + 'sql_query' => 'SELECT count(id) FROM '.$this->wiki->config['table_prefix'].'pages WHERE user NOT IN {groupanim} AND user NOT IN {groupariane}', + 'type' => 'sql', + ], + 'nb_comments-total' => [ + 'name' => '💬 Nombre total de commentaires', + 'sql_query' => 'SELECT count(id) FROM '.$this->wiki->config['table_prefix'].'pages WHERE 1', + 'type' => 'sql', + ], + 'nb_comments-ressources' => [ + 'name' => '💬 Nombre de commentaires sur les ressources', + 'sql_query' => 'SELECT count(id) FROM '.$this->wiki->config['table_prefix'].'pages WHERE comment_on != ""', + 'type' => 'sql', + ], + //todo + 'nb_reactions-ressources-total' => [ + 'name' => '📚 Nombre total de ressources qualifiées', + 'sql_query' => 'SELECT count(id) FROM '.$this->wiki->config['table_prefix'].'pages WHERE 1', + 'type' => 'sql', + ], + 'nb_reactions-ressources-relues' => [ + 'name' => '📚 Nombre total de ressources relues', + 'sql_query' => 'SELECT count(id) FROM '.$this->wiki->config['table_prefix'].'pages WHERE 1', + 'type' => 'sql', + ], + 'nb_reactions-ressources-reutilisees' => [ + 'name' => '📚 Nombre total de ressources réutilisées', + 'sql_query' => 'SELECT count(id) FROM '.$this->wiki->config['table_prefix'].'pages WHERE 1', + 'type' => 'sql', + ], + 'nb_reactions-meme-besoin' => [ + 'name' => '🙏🏻 Nombre de "J\'ai le même besoin"', + 'sql_query' => 'SELECT count(id) FROM '.$this->wiki->config['table_prefix'].'pages WHERE 1', + 'type' => 'sql', + ], +// - Nombre de téléchargements des ressources de cette communauté Se baser sur bf_checkbox_commu_ress + bf_fichier_ressource +// - Nombre de vues de l'ensemble des ressources directement intégrées aux fiches ressources réaction « relue » Se baser sur bf_checkbox_commu_ress + nb de clics sur les fiches du formulaire ressource / communauté ET checkbox_besoin_commu + besoins/communauté +// - Nombre de clics sur liens web des ressources Se baser sur bf_checkbox_commu_ress + bf_url_ressource +// Commentaires - Sur améliorations du site Commentaires des fiches du formulaire 23 dans le wiki Doctorants +// Partage et diffusion des ressources +// - - Delta qualifiées/non qualifiées + +// TODO : +// finir les stats +// modification par la commu des pages du wiki central +// verifier si table des pages avec nb contrib nb commentaires et nb reactions +// mettre les affichages par communautés +// Emoji https://reseau.s-mart.fr/?RecupererLesLiensDesFluxRssDeMonChoixS +// revoir les ecarts type mensuel + + ]; + + $period = [ + 'deb'=> $_GET['datedeb'] ?? $period['deb'], + 'end' => $_GET['datefin'] ?? $period['end'] + ]; + + foreach($this->communities as $k => $com) { + foreach($this->indicateurs as $i => $ind) { + if ($ind['type'] == 'bazar') { + $this->calculateBazarIndicators($i, $k, $period); + } + if ($ind['type'] == 'bazarapi') { + if ($ind['onlyfor'] == $k) { + $this->calculateBazarApiIndicators($i, $k, $period); + } + } + if ($ind['type'] == 'sql') { + $this->calculateSqlIndicators($i, $k, $period); + } + + } + } + $total = []; + if (count($this->communities) > 1) { + $total = $this->calculateTotal(); + } + + return $this->render('@templates/tablestats.twig', [ + 'indicateurs'=> $this->indicateurs, + 'communities'=> $this->communities, + 'period' => $period, + 'selecteddatedeb' => $_GET['datedeb'] ?? $period['deb'], + 'selecteddatefin' => $_GET['datefin'] ?? $period['end'], + 'total' => $total, + 'wiki' => $_GET['wiki'] ?? $this->wiki->getPageTag() + ]); + } else { + return $this->render('@templates/alert-message.twig', [ + 'type'=>'danger', + 'message'=> _t('Page réservée aux admins') + ]); + } + } + public function calculateTotal() { + $total = []; + foreach($this->communities['reseaucentral']['indicators'] as $k => $ind) { + $valcommuperiod = [ + $this->communities['doctorants']['indicators'][$k]['periodvalue'], + $this->communities['ecocloud']['indicators'][$k]['periodvalue'], + $this->communities['ingetech']['indicators'][$k]['periodvalue'], + $this->communities['shs']['indicators'][$k]['periodvalue'], + $this->communities['fabadd']['indicators'][$k]['periodvalue'], + $this->communities['reseaucentral']['indicators'][$k]['periodvalue'], + ]; + $valcommutotal = [ + $this->communities['doctorants']['indicators'][$k]['totalvalue'], + $this->communities['ecocloud']['indicators'][$k]['totalvalue'], + $this->communities['ingetech']['indicators'][$k]['totalvalue'], + $this->communities['shs']['indicators'][$k]['totalvalue'], + $this->communities['fabadd']['indicators'][$k]['totalvalue'], + $this->communities['reseaucentral']['indicators'][$k]['totalvalue'], + ]; + $total[$k]['title'] = $ind['title']; + $total[$k]['periodvalue'] = array_sum($valcommuperiod); + $total[$k]['ecarttype'] = $this->calculateEcartType($valcommuperiod); + $total[$k]['moyenne'] = $this->calculateMoyenne($valcommuperiod); + $total[$k]['totalvalue'] = array_sum($valcommutotal); + $total[$k]['totalecarttype'] = $this->calculateEcartType($valcommutotal); + $total[$k]['totalmoyenne'] = $this->calculateMoyenne($valcommutotal); + } + return $total; + } + public function calculateBazarIndicators($idIndicator, $community, $period) { + $indic = $this->indicateurs[$idIndicator]; + foreach($indic['queries'] as $id => $val) { + $indic['queries'][$id] = str_replace('{idcommu}', $this->communities[$community]['idcommu'], $val); + } + $res = $this->getService(EntryManager::class)->search($indic); + $filterPeriod = []; + foreach($res as $i => $f) { + $deb = new DateTime($period['deb']); + $end = new DateTime($period['end']); + $fiche = new DateTime($f['date_creation_fiche']); + if ($deb < $fiche && $fiche < $end) { + $filterPeriod[$i] = $f; + } + }; + $this->communities[$community]['indicators'][$idIndicator]['periodvalue'] = count($filterPeriod); + $this->communities[$community]['indicators'][$idIndicator]['totalvalue'] = count($res); + $this->communities[$community]['indicators'][$idIndicator]['title'] = $indic['name']; + + } + + public function calculateBazarApiIndicators($idIndicator, $community, $period) { + $indic = $this->indicateurs[$idIndicator]; + + $json = file_get_contents($indic['url']); + $res = json_decode($json,true); + $filterPeriod = []; + foreach($res as $i => $f) { + $deb = new DateTime($period['deb']); + $end = new DateTime($period['end']); + $fiche = new DateTime($f['date_creation_fiche']); + if ($deb < $fiche && $fiche < $end) { + $filterPeriod[$i] = $f; + } + }; + $this->communities[$community]['indicators'][$idIndicator]['periodvalue'] = count($filterPeriod); + $this->communities[$community]['indicators'][$idIndicator]['totalvalue'] = count($res); + $this->communities[$community]['indicators'][$idIndicator]['title'] = $indic['name']; + } + + public function calculateSqlIndicators($idIndicator, $community, $period) { + $indic = $this->indicateurs[$idIndicator]; + $res = []; + $filterPeriod = []; + foreach($res as $i => $f) { + $deb = new DateTime($period['deb']); + $end = new DateTime($period['end']); + $fiche = new DateTime($f['time']); + if ($deb < $fiche && $fiche < $end) { + $filterPeriod[$i] = $f; + } + }; + $this->communities[$community]['indicators'][$idIndicator]['periodvalue'] = rand(0,3); + $this->communities[$community]['indicators'][$idIndicator]['totalvalue'] = rand(0,10); + $this->communities[$community]['indicators'][$idIndicator]['title'] = $indic['name']; + } + + public function getGlobalPeriod() { + $sql = 'select date(min(time)) as deb, date(max(time)) as end from '.$this->wiki->config['table_prefix'].'pages'; + return $this->getService(DbService::class)->loadSingle($sql); + } + + public function getAllMonthsUntilToday($startDate) { + $start = (new DateTime($startDate))->modify('first day of this month'); + $end = (new DateTime('today'))->modify('first day of next month'); + $interval = DateInterval::createFromDateString('1 month'); + $period = new DatePeriod($start, $interval, $end); + + return $period; + } + + public function arrondi($value, $precision = 4) { + round((float) $value, $precision); + } + + public function calculateMoyenne($values) { + return array_sum($values) / count($values); + } + + public function calculateEcartType($values) { + $moyenne = $this->calculateMoyenne($values); + $variances = []; + foreach($values as $key => $val) { + $variances[$key] = pow($val - $moyenne, 2); + } + $p =(count($values) - 1); + if ($p >= 1) { + return sqrt(array_sum($variances) / $p); + } + return null; + } +} + diff --git a/actions/annuaire.js b/actions/annuaire.js new file mode 100644 index 0000000..9d3c442 --- /dev/null +++ b/actions/annuaire.js @@ -0,0 +1,43 @@ +import renderHelper from '../../tools/bazar/presentation/javascripts/form-edit-template/fields/commons/render-helper.js' +import { defaultMapping } from '../../tools/bazar/presentation/javascripts/form-edit-template/fields/commons/attributes.js' + + +window.formBuilderFields.annuaire = { + field: { + label: _t('Annuaire'), + name: 'annuaire', + attrs: { type: 'annuaire' }, + icon: '' + }, + attributes: { + name: { label: _t('Identifiant unique'), value: 'bf_annuaire' }, + entries_field: { + label: _t('Identifiants des formulaires source (séparés par des virgules)'), + value: '' + }, + }, + advancedAttributes: [], + disabledAttributes: [], + attributesMapping: { + ...defaultMapping, + ...{ + 0: 'type', + 1: 'name', + 2: 'label', + 3: 'entries_field' + // 5: '', /* 5:"mailing_list", */ + // 6: 'auto_add_to_group', + // 8: '', + // 9: 'autoupdate_email' + } + }, + renderInput(field) { + return { + field: '', + onRender() { + //renderHelper.defineLabelHintForGroup(field, 'auto_add_to_group', _t('BAZ_FORM_EDIT_ADD_TO_GROUP_HELP')) + } + } + } +} + diff --git a/actions/yunohostJsAction.php b/actions/yunohostJsAction.php new file mode 100644 index 0000000..ffbcf3e --- /dev/null +++ b/actions/yunohostJsAction.php @@ -0,0 +1,19 @@ +wiki->services->get(AssetsManager::class)->AddJavascriptFile('custom/actions/annuaire.js', false, true); + $this->wiki->services->get(AssetsManager::class)->AddJavascriptFile('custom/actions/yunohost_user.js', false, true); + } +} diff --git a/actions/yunohost_user.js b/actions/yunohost_user.js new file mode 100644 index 0000000..c684fca --- /dev/null +++ b/actions/yunohost_user.js @@ -0,0 +1,54 @@ +import renderHelper from '../../tools/bazar/presentation/javascripts/form-edit-template/fields/commons/render-helper.js' +import { defaultMapping } from '../../tools/bazar/presentation/javascripts/form-edit-template/fields/commons/attributes.js' + + +window.formBuilderFields.yunohost_user = { + field: { + label: _t('Utilisateur Yunohost'), + name: 'yunohost_user', + attrs: { type: 'yunohost_user' }, + icon: '' + }, + attributes: { + name_field: { label: _t('BAZ_FORM_EDIT_USERS_WIKINI_NAME_FIELD_LABEL'), value: 'bf_titre' }, + email_field: { + label: _t('BAZ_FORM_EDIT_USERS_WIKINI_EMAIL_FIELD_LABEL'), + value: 'bf_mail' + }, + // mailing_list: { + // label: "Inscrite à une liste de diffusion" + // }, + autoupdate_email: { + label: _t('BAZ_FORM_EDIT_USERS_WIKINI_AUTOUPDATE_MAIL'), + options: { 0: _t('NO'), 1: _t('YES') } + }, + auto_add_to_group: { + label: _t('BAZ_FORM_EDIT_ADD_TO_GROUP_LABEL'), + value: '', + placeholder: _t('BAZ_FORM_EDIT_ADD_TO_GROUP_DESCRIPTION'), + description: _t('BAZ_FORM_EDIT_ADD_TO_GROUP_DESCRIPTION') + } + }, + advancedAttributes: ['autoupdate_email', 'auto_add_to_group'], + // disabledAttributes: [], + attributesMapping: { + ...defaultMapping, + ...{ + 0: 'type', + 1: 'name_field', + 2: 'email_field', + 5: '', /* 5:"mailing_list", */ + 6: 'auto_add_to_group', + 8: '', + 9: 'autoupdate_email' + } + }, + renderInput(field) { + return { + field: '', + onRender() { + renderHelper.defineLabelHintForGroup(field, 'auto_add_to_group', _t('BAZ_FORM_EDIT_ADD_TO_GROUP_HELP')) + } + } + } +} diff --git a/templates/bazar/fields/annuaire.twig b/templates/bazar/fields/annuaire.twig new file mode 100644 index 0000000..464f591 --- /dev/null +++ b/templates/bazar/fields/annuaire.twig @@ -0,0 +1,3 @@ +{% extends "@bazar/layouts/field.twig" %} + +{% block value %}{{ value|raw }}{% endblock %} diff --git a/templates/bazar/fields/user.twig b/templates/bazar/fields/user.twig new file mode 100644 index 0000000..e1a0875 --- /dev/null +++ b/templates/bazar/fields/user.twig @@ -0,0 +1,9 @@ +{% extends "@bazar/layouts/field.twig" %} + +{% block label %}{{ _t('BAZ_GIVEN_ID') }}{% endblock %} + +{% block value %} + {{ value }} + {% if isLoggedUser %} + {% endif %} +{% endblock %} diff --git a/templates/bazar/inputs/annuaire.twig b/templates/bazar/inputs/annuaire.twig new file mode 100644 index 0000000..31d5a3d --- /dev/null +++ b/templates/bazar/inputs/annuaire.twig @@ -0,0 +1,15 @@ +{% extends "@bazar/layouts/input.twig" %} + +{% block input %} +
+ +
+{% endblock %} diff --git a/templates/loginldap/modal.tpl.html b/templates/loginldap/modal.tpl.html new file mode 100755 index 0000000..ee47d4e --- /dev/null +++ b/templates/loginldap/modal.tpl.html @@ -0,0 +1,62 @@ + + + + + + + + + + + diff --git a/templates/templates/tablestats.twig b/templates/templates/tablestats.twig new file mode 100644 index 0000000..9172fd7 --- /dev/null +++ b/templates/templates/tablestats.twig @@ -0,0 +1,81 @@ +{{ include_javascript('javascripts/vendor/datatables-full/jquery.dataTables.min.js') }} +{{ include_css('styles/vendor/datatables-full/dataTables.bootstrap.min.css') }} + +

{{ _t('Tableau de bord') }}

+
+
+ + +
+
+ + +
+ + +
+
+{% for k, com in communities %} +
+

Indicateurs pour la communauté {{ com.title}}

+ + + + + + + + + + {% for key, indic in com.indicators %} + + + + + + {% endfor %} + +
Indicateursur la période du {{ selecteddatedeb }} au {{ selecteddatefin }}depuis la création du site
{{ indic.title }}{{ indic.periodvalue }}{{ indic.totalvalue }}
+
+{% endfor %} +
+{% if total|length != 0 %} +


+
+

Indicateurs pour toutes les communautés

+ + + + + + + + + + + + + + {% for key, indic in total %} + + + + + + + + + + {% endfor %} + +
Indicateursur la période du {{ selecteddatedeb }} au {{ selecteddatefin }}Ecart type mensuel sur la périodeMoyenne mensuelle sur la périodedepuis la création du siteEcart type mensuelMoyenne mensuelle
{{ indic.title }}{{ indic.periodvalue }}{{ indic.ecarttype }}{{ indic.moyenne }}{{ indic.totalvalue }}{{ indic.totalecarttype }}{{ indic.totalmoyenne }}
+
+{% endif %} + +