From 51bea4b40cb5cc26ae0db7c516eb1e96f6906c2b Mon Sep 17 00:00:00 2001
From: Yannick Warnier
Date: Mon, 22 May 2017 20:55:29 -0500
Subject: [PATCH 01/12] Lift PHP requirement up from 5.4 to 5.5
---
documentation/changelog.html | 1 +
documentation/dependencies.html | 2 +-
documentation/installation_guide.html | 2 +-
documentation/installation_guide_es_ES.html | 2 +-
documentation/installation_guide_fr_FR.html | 2 +-
documentation/installation_guide_it_IT.html | 2 +-
6 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/documentation/changelog.html b/documentation/changelog.html
index bc5e1d6249..2d755265fa 100755
--- a/documentation/changelog.html
+++ b/documentation/changelog.html
@@ -69,6 +69,7 @@
Possibly breaking changes
+ - Dropped support for PHP 5.4 and inferior (now REQUIRES PHP 5.5 or more)
- As Chamilo becomes more popular, we are facing new security-based challenges that come as consequences of the simplicity
that we offer our users. As such, in this version of Chamilo, the administrator *must* enable a configuration setting as follows
in order to authorize teachers and students to use iframes (embedding things from outside) inside the online text areas in their courses and personal spaces.
diff --git a/documentation/dependencies.html b/documentation/dependencies.html
index 5e70fb87fd..2f058bade3 100755
--- a/documentation/dependencies.html
+++ b/documentation/dependencies.html
@@ -71,7 +71,7 @@ We recommend using HTML5-compatible technology.
Dependencies - server-side
- Apache 2+
- - PHP 5.4 or higher with MySQL bindings (mysqlnd is recommended) and php-gd extension to allow Chamilo to resize pictures. Now also supports PHP 7.0
+ - PHP 5.5 or higher with MySQL bindings (mysqlnd is recommended) and php-gd extension to allow Chamilo to resize pictures. Now also supports PHP 7.0
- MySQL 5.1+ or any version of MariaDB database server
- php5-intl package (for international behaviour support)
- php5-mbstring package (for international behaviour support)
diff --git a/documentation/installation_guide.html b/documentation/installation_guide.html
index e8f6b2bf54..ee044ff075 100755
--- a/documentation/installation_guide.html
+++ b/documentation/installation_guide.html
@@ -78,7 +78,7 @@ Chamilo is mainly a LMS running (the so called
- Apache 2.2+
- MySQL 5.1+ or MariaDB 5+
-- PHP 5.4+ (5.6 recommended for greater efficiency) (support for PHP7 seems OK but not evaluated on high load setups just yet)
+- PHP 5.5+ (5.6 recommended for greater efficiency) (support for PHP7 seems OK but not evaluated on high load setups just yet)
All these pieces of software are free software and freely available.
diff --git a/documentation/installation_guide_es_ES.html b/documentation/installation_guide_es_ES.html
index 39cc87fcd7..9863003a41 100755
--- a/documentation/installation_guide_es_ES.html
+++ b/documentation/installation_guide_es_ES.html
@@ -86,7 +86,7 @@
Chamilo puede ser instalado indiferentemente en servidores Windows, Linux, Mac OS X y UNIX. Sin embargo, nosotros recomendamos el uso de un servidor Linux para una óptima flexibilidad, control remoto y escalabilidad.
-Chamilo es fundamentalmente un LMS que se ejecuta con Apache (2.2+), MySQL 5.1+ (o MariaDB) y PHP 5.4+ (trilogía también llamada AMP).
+Chamilo es fundamentalmente un LMS que se ejecuta con Apache (2.2+), MySQL 5.1+ (o MariaDB) y PHP 5.5+ (trilogía también llamada AMP).
Todo este software es software de código abierto y está disponible libremente.
diff --git a/documentation/installation_guide_fr_FR.html b/documentation/installation_guide_fr_FR.html
index 2ae81a5edd..b4d277299b 100644
--- a/documentation/installation_guide_fr_FR.html
+++ b/documentation/installation_guide_fr_FR.html
@@ -80,7 +80,7 @@
Chamilo est un système de gestion de l'apprentissage (LMS) qui fonctionne
principallement sur base d'un serveur web (Apache 2.2+), de MySQL 5.1+ ou de MariaDB 5+
- (5 ou 10) et de PHP 5.4+ (le support de PHP 7 n'a pas été pleinement testé).
+ (5 ou 10) et de PHP 5.5+ (le support de PHP 7 n'a pas été pleinement testé).
diff --git a/documentation/installation_guide_it_IT.html b/documentation/installation_guide_it_IT.html
index 4d242ec14e..38ecd17bd1 100644
--- a/documentation/installation_guide_it_IT.html
+++ b/documentation/installation_guide_it_IT.html
@@ -73,7 +73,7 @@
Chamilo può essere installato indifferentemente su server Windows, Linux, Mac OS X e Unix. Tuttavia raccomandiamo l’utilizzo di server Linux per sfruttarne al meglio le caratteristiche di flessibilità, controllo remoto e scalabilità.
-Chamilo è principalmente un LMS (Learning Management System) che gira sulla piattaforma composta da Apache (1.3,2.0 or 2.2), MySQL 5.1 (o MariaDB) e PHP 5.4, 5.5 o 5.6, meglio nota come piattaforma AMP.
+Chamilo è principalmente un LMS (Learning Management System) che gira sulla piattaforma composta da Apache (1.3,2.0 or 2.2), MySQL 5.1 (o MariaDB) e PHP 5.5 o 5.6, meglio nota come piattaforma AMP.
Tutti questi software sono gratuiti e liberamente scaricabili.
From d980a6c5843cb5e2d753900357cecedabfd5b71e Mon Sep 17 00:00:00 2001
From: jmontoyaa
Date: Tue, 23 May 2017 08:14:52 +0200
Subject: [PATCH 02/12] Fix mysql error see #1965
---
.../Component/CourseCopy/CourseRestorer.php | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php
index 19bc65d92f..a7ae02647e 100644
--- a/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php
+++ b/src/Chamilo/CourseBundle/Component/CourseCopy/CourseRestorer.php
@@ -1759,8 +1759,8 @@ class CourseRestorer
'c_id' => $this->destination_course_id,
'title' => self::DBUTF8($quiz->title),
'description' => ($quiz->description === false ? '' : self::DBUTF8($quiz->description)),
- 'type' => isset($quiz->quiz_type) ? $quiz->quiz_type : $quiz->type,
- 'random' => $quiz->random,
+ 'type' => isset($quiz->quiz_type) ? (int) $quiz->quiz_type : $quiz->type,
+ 'random' => (int) $quiz->random,
'active' => $quiz->active,
'sound' => self::DBUTF8($doc),
'max_attempt' => (int) $quiz->max_attempt,
@@ -1769,10 +1769,10 @@ class CourseRestorer
'pass_percentage' => $quiz->pass_percentage,
'feedback_type' => (int) $quiz->feedback_type,
'random_answers' => (int) $quiz->random_answers,
- 'random_by_category' => $quiz->random_by_category,
- 'review_answers' => $quiz->review_answers,
- 'propagate_neg' => $quiz->propagate_neg,
- 'text_when_finished' => $quiz->text_when_finished,
+ 'random_by_category' => (int) $quiz->random_by_category,
+ 'review_answers' => (int) $quiz->review_answers,
+ 'propagate_neg' => (int) $quiz->propagate_neg,
+ 'text_when_finished' => (string) $quiz->text_when_finished,
'expired_time' => (int) $quiz->expired_time,
'start_time' => $quiz->start_time,
'end_time' => $quiz->end_time,
From a26a1440f55ee3fb3239c911ba4f1c798acf9cc9 Mon Sep 17 00:00:00 2001
From: jmontoyaa
Date: Tue, 23 May 2017 09:09:22 +0200
Subject: [PATCH 03/12] Move query into a function.
---
app/Migrations/Schema/V111/Version111.php | 8 +++-----
main/install/install.lib.php | 21 +++++++++++++++++++--
2 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/app/Migrations/Schema/V111/Version111.php b/app/Migrations/Schema/V111/Version111.php
index c1f216f8ad..93a54e860e 100644
--- a/app/Migrations/Schema/V111/Version111.php
+++ b/app/Migrations/Schema/V111/Version111.php
@@ -272,6 +272,7 @@ class Version111 extends AbstractMigrationChamilo
$this->addSql('ALTER TABLE ticket_message_attachments ENGINE=InnoDB');
$this->addSql('ALTER TABLE ticket_message_attachments DROP message_attch_id, CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE message_id message_id INT DEFAULT NULL, CHANGE ticket_id ticket_id INT DEFAULT NULL, CHANGE filename filename LONGTEXT NOT NULL, CHANGE size size INT NOT NULL, CHANGE sys_insert_user_id sys_insert_user_id INT NOT NULL, CHANGE sys_insert_datetime sys_insert_datetime DATETIME NOT NULL, CHANGE sys_lastedit_user_id sys_lastedit_user_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE ticket_message_attachments ADD CONSTRAINT FK_70BF9E26700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket_ticket (id);');
+ $this->addSql('ALTER TABLE ticket_message_attachments ADD CONSTRAINT FK_70BF9E26537A1329 FOREIGN KEY (message_id) REFERENCES ticket_message (id);');
$this->addSql('CREATE INDEX IDX_70BF9E26700047D2 ON ticket_message_attachments (ticket_id);');
} else {
$this->addSql('CREATE TABLE IF NOT EXISTS ticket_message_attachments (id INT AUTO_INCREMENT NOT NULL, ticket_id INT DEFAULT NULL, message_id INT DEFAULT NULL, path VARCHAR(255) NOT NULL, filename LONGTEXT NOT NULL, size INT NOT NULL, sys_insert_user_id INT NOT NULL, sys_insert_datetime DATETIME NOT NULL, sys_lastedit_user_id INT DEFAULT NULL, sys_lastedit_datetime DATETIME DEFAULT NULL, INDEX IDX_70BF9E26700047D2 (ticket_id), INDEX IDX_70BF9E26537A1329 (message_id), PRIMARY KEY(id)) DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ENGINE = InnoDB');
@@ -318,7 +319,6 @@ class Version111 extends AbstractMigrationChamilo
$this->addSql('CREATE INDEX IDX_54B65868A76ED395 ON ticket_assigned_log (user_id);');
-
$this->addSql('ALTER TABLE ticket_message DROP message_id, CHANGE id id INT AUTO_INCREMENT NOT NULL, CHANGE ticket_id ticket_id INT DEFAULT NULL, CHANGE subject subject VARCHAR(255) DEFAULT NULL, CHANGE message message LONGTEXT DEFAULT NULL, CHANGE status status VARCHAR(255) NOT NULL, CHANGE ip_address ip_address VARCHAR(255) NOT NULL, CHANGE sys_insert_user_id sys_insert_user_id INT NOT NULL, CHANGE sys_insert_datetime sys_insert_datetime DATETIME NOT NULL, CHANGE sys_lastedit_user_id sys_lastedit_user_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE ticket_message ADD CONSTRAINT FK_BA71692D700047D2 FOREIGN KEY (ticket_id) REFERENCES ticket_ticket (id);');
@@ -326,9 +326,6 @@ class Version111 extends AbstractMigrationChamilo
$this->addSql('ALTER TABLE ticket_ticket CHANGE category_id category_id INT DEFAULT NULL;');
$this->addSql('ALTER TABLE ticket_ticket ADD CONSTRAINT FK_EDE2C76812469DE2 FOREIGN KEY (category_id) REFERENCES ticket_category (id);');
$this->addSql('CREATE INDEX IDX_EDE2C76812469DE2 ON ticket_ticket (category_id);');
- if ($fixTableMessage) {
- $this->addSql('ALTER TABLE ticket_message_attachments ADD CONSTRAINT FK_70BF9E26537A1329 FOREIGN KEY (message_id) REFERENCES ticket_message (id);');
- }
$this->addSql('DELETE FROM settings_current WHERE title = "Ticket"');
} else {
// Plugin was never installed. Create ticket tables
@@ -403,7 +400,8 @@ class Version111 extends AbstractMigrationChamilo
$this->addSql("ALTER TABLE session MODIFY COLUMN name VARCHAR(150) NOT NULL DEFAULT ''");
if (!$schema->hasTable('version')) {
- $this->addSql('CREATE TABLE version (id int unsigned NOT NULL AUTO_INCREMENT, version varchar(255), PRIMARY KEY(id), UNIQUE(version));');
+ $sql = getVersionTable();
+ $this->addSql($sql);
}
if ($schema->hasTable('resource')) {
diff --git a/main/install/install.lib.php b/main/install/install.lib.php
index 3cbe625deb..d0b2815e67 100755
--- a/main/install/install.lib.php
+++ b/main/install/install.lib.php
@@ -2918,8 +2918,7 @@ function finishInstallation(
$files = $finder->files()->in($path);
// Needed for chash
- $sql = 'CREATE TABLE IF NOT EXISTS version (id int unsigned NOT NULL AUTO_INCREMENT, version varchar(255), PRIMARY KEY(id), UNIQUE(version));';
- Database::query($sql);
+ createVersionTable();
foreach ($files as $version) {
$version = str_replace(['Version', '.php'], '', $version->getFilename());
@@ -2928,6 +2927,24 @@ function finishInstallation(
}
}
+/**
+ * Creates 'version' table
+ */
+function createVersionTable()
+{
+ $sql = getVersionTable();
+ Database::query($sql);
+}
+
+/**
+ * Get version creation table query
+ * @return string
+ */
+function getVersionTable()
+{
+ return 'CREATE TABLE IF NOT EXISTS version (id int unsigned NOT NULL AUTO_INCREMENT, version varchar(20), PRIMARY KEY(id), UNIQUE(version));';
+}
+
/**
* Update settings based on installation profile defined in a JSON file
* @param string $installationProfile The name of the JSON file in main/install/profiles/ folder
From 60b2c1b2a3955fd10c310f8188ad37668bddb96b Mon Sep 17 00:00:00 2001
From: jmontoyaa
Date: Tue, 23 May 2017 11:14:50 +0200
Subject: [PATCH 04/12] Fix PHP 7.1 chamilo upgrade
Fixes error:
Return value of ProxyManager\Configuration::setGeneratorStrategy()
must be an instance of ProxyManager\void
---
composer.json | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/composer.json b/composer.json
index e82f9f3dec..b262066985 100755
--- a/composer.json
+++ b/composer.json
@@ -111,7 +111,8 @@
"essence/essence": "2.6.1",
"pclzip/pclzip": "2.8.2",
"chamilo/chash": "dev-master",
- "ircmaxell/random-lib": "^1.2"
+ "ircmaxell/random-lib": "^1.2",
+ "ocramius/proxy-manager" : "~1.0|2.0.*"
},
"require-dev": {
"behat/behat": "@stable",
From 4184102685cf1314956206aacd9d0ce99476da74 Mon Sep 17 00:00:00 2001
From: jmontoyaa
Date: Tue, 23 May 2017 11:22:45 +0200
Subject: [PATCH 05/12] Upgrade PHP version to 5.5, remove array_column package
See https://github.com/chamilo/chamilo-lms/commit/51bea4b40cb5cc26ae0db7c516eb1e96f6906c2b
---
composer.json | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/composer.json b/composer.json
index b262066985..2adb487ffc 100755
--- a/composer.json
+++ b/composer.json
@@ -43,7 +43,7 @@
}
],
"require": {
- "php": ">=5.4",
+ "php": ">=5.5",
"ext-intl": "*",
"ext-gd": "*",
"ext-curl": "*",
@@ -90,7 +90,6 @@
"ircmaxell/password-compat": "~1.0.4",
"sylius/attribute": "0.13.0",
"sylius/translation": "0.13.0",
- "ramsey/array_column": "~1.1",
"patchwork/utf8": "~1.2",
"ddeboer/data-import": "@stable",
"phpoffice/phpexcel": "~1.8",
From ab08b53e8f6484a069efeeec935449122d34327d Mon Sep 17 00:00:00 2001
From: jmontoyaa
Date: Tue, 23 May 2017 12:53:44 +0200
Subject: [PATCH 06/12] Minor - format code
---
main/document/document_quota.php | 1 +
main/lp/lp_upload.php | 9 +++++----
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/main/document/document_quota.php b/main/document/document_quota.php
index 8087ab1645..39267aa45f 100755
--- a/main/document/document_quota.php
+++ b/main/document/document_quota.php
@@ -1,5 +1,6 @@
0 && !empty($_FILES['user_file']['name'])) {
-
+} elseif ($_SERVER['REQUEST_METHOD'] == 'POST' && count($_FILES) > 0 && !empty($_FILES['user_file']['name'])) {
// A file upload has been detected, now deal with the file...
// Directory creation.
$stopping_error = false;
-
$s = $_FILES['user_file']['name'];
// Get name of the zip file without the extension.
@@ -47,7 +45,10 @@ if (isset($_POST) && $is_error) {
$file_base_name = str_replace('.'.$extension, '', $filename);
$new_dir = api_replace_dangerous_char(trim($file_base_name));
- $type = learnpath::get_package_type($_FILES['user_file']['tmp_name'], $_FILES['user_file']['name']);
+ $type = learnpath::get_package_type(
+ $_FILES['user_file']['tmp_name'],
+ $_FILES['user_file']['name']
+ );
$proximity = 'local';
if (!empty($_REQUEST['content_proximity'])) {
From 4d88a2f4f7ea892220466c99c431ffd557822606 Mon Sep 17 00:00:00 2001
From: jmontoyaa
Date: Tue, 23 May 2017 13:27:23 +0200
Subject: [PATCH 07/12] Change UI, update query see BT#12723
---
plugin/studentfollowup/post.php | 18 +++++--
plugin/studentfollowup/posts.php | 4 +-
plugin/studentfollowup/view/post.html.twig | 56 ++++++++++++---------
plugin/studentfollowup/view/posts.html.twig | 2 +-
4 files changed, 50 insertions(+), 30 deletions(-)
diff --git a/plugin/studentfollowup/post.php b/plugin/studentfollowup/post.php
index dfe4842c77..0bcca546ba 100644
--- a/plugin/studentfollowup/post.php
+++ b/plugin/studentfollowup/post.php
@@ -35,34 +35,43 @@ if ($showPrivate == false) {
$criteria->andWhere(Criteria::expr()->eq('id', $postId));
$qb
- ->select('p')
+ ->select('distinct p')
->from('ChamiloPluginBundle:StudentFollowUp\CarePost', 'p')
->addCriteria($criteria)
->setMaxResults(1)
;
$query = $qb->getQuery();
+
/** @var CarePost $post */
$post = $query->getOneOrNullResult();
// Get related posts (post with same parent)
$relatedPosts = [];
-if ($post && !empty($post->getParent())) {
+if ($post) {
$qb = $em->createQueryBuilder();
$criteria = Criteria::create();
if ($showPrivate == false) {
$criteria->andWhere(Criteria::expr()->eq('private', false));
}
- $criteria->andWhere(Criteria::expr()->eq('parent', $post->getParent()));
- $criteria->andWhere(Criteria::expr()->neq('id', $post->getId()));
+
+ if (!empty($post->getParent())) {
+ $criteria->andWhere(Criteria::expr()->eq('parent', $post->getParent()));
+ }
+ $criteria->andWhere(Criteria::expr()->eq('parent', $post->getId()));
+ $criteria->orWhere(Criteria::expr()->eq('id', $post->getId()));
+
$qb
->select('p')
+ ->distinct()
->from('ChamiloPluginBundle:StudentFollowUp\CarePost', 'p')
->addCriteria($criteria)
->orderBy('p.createdAt', 'desc')
;
$query = $qb->getQuery();
+ //var_dump($query->getSQL());
$relatedPosts = $query->getResult();
}
+//var_dump($post->getTitle());
$tpl = new Template($plugin->get_lang('plugin_title'));
$tpl->assign('post', $post);
@@ -77,6 +86,7 @@ $tpl->assign(
)
);
$tpl->assign('information_icon', Display::return_icon('info.png'));
+$tpl->assign('student_info', api_get_user_info($studentId));
$content = $tpl->fetch('/'.$plugin->get_name().'/view/post.html.twig');
// Assign into content
diff --git a/plugin/studentfollowup/posts.php b/plugin/studentfollowup/posts.php
index e931da313f..c91c801ed7 100644
--- a/plugin/studentfollowup/posts.php
+++ b/plugin/studentfollowup/posts.php
@@ -36,6 +36,7 @@ $pageSize = 2;
$qb
->select('p')
+ ->distinct()
->from('ChamiloPluginBundle:StudentFollowUp\CarePost', 'p')
->addCriteria($criteria)
->setFirstResult($pageSize * ($currentPage - 1))
@@ -48,6 +49,7 @@ $posts = new Paginator($query, $fetchJoinCollection = true);
$totalItems = count($posts);
$pagesCount = ceil($totalItems / $pageSize);
+
$pagination = '';
$url = api_get_self().'?student_id='.$studentId;
if ($totalItems > 1) {
@@ -70,7 +72,7 @@ $tpl->assign('current_url', $url);
$url = api_get_path(WEB_PLUGIN_PATH).'studentfollowup/post.php?student_id='.$studentId;
$tpl->assign('post_url', $url);
$tpl->assign('information_icon', Display::return_icon('info.png'));
-
+$tpl->assign('student_info', api_get_user_info($studentId));
$tpl->assign('pagination', $pagination);
$content = $tpl->fetch('/'.$plugin->get_name().'/view/posts.html.twig');
// Assign into content
diff --git a/plugin/studentfollowup/view/post.html.twig b/plugin/studentfollowup/view/post.html.twig
index 62a5d3b1d4..fe090bcfa1 100644
--- a/plugin/studentfollowup/view/post.html.twig
+++ b/plugin/studentfollowup/view/post.html.twig
@@ -20,25 +20,24 @@
{% endif %}
{% if post.parent %}
- Parent
{{ post.parent.title }}
{% endif %}
{% endif %}
- {% if type == 'all' %}
- {% if related_posts %}
- Related
- {% for post in related_posts %}
-
-
- {{ post.title }}
-
-
- {% endfor %}
- {% endif %}
- {% endif %}
+ {#{% if type == 'all' %}#}
+ {#{% if related_posts %}#}
+ {#Related
#}
+ {#{% for post in related_posts %}#}
+ {##}
+ {##}
+ {#{{ post.title }}#}
+ {##}
+ {#
#}
+ {#{% endfor %}#}
+ {#{% endif %}#}
+ {#{% endif %}#}
@@ -60,15 +59,15 @@
- {% if post.children.count %}
- {% for child in post.children %}
- {{ _self.post_template('all', child) }}
-
- {##}
- {#{{ child.title }}#}
- {##}
- {% endfor %}
- {% endif %}
+ {#{% if type == 'all' %}#}
+ {#{% if post.children.count %}#}
+ {#{% for child in post.children %}#}
+ {#{% if child.id != post.id %}#}
+ {#{{ _self.post_template('all', child) }}#}
+ {#{% endif %}#}
+ {#{% endfor %}#}
+ {#{% endif %}#}
+ {#{% endif %}#}
{% endif %}
{% endmacro %}
@@ -78,6 +77,15 @@
{{ back_link }}
-Care detail view
+
+ Care detail view - {{ student_info.complete_name }} - {{ post.title }}
+ {% if post.parent %}
+ {{ post.parent.title }}
+ {% endif %}
+
+
+{% for post in related_posts %}
+ {{ template.post_template('all', post, information_icon, post_url, current_url) }}
+{% endfor %}
-{{ template.post_template('all', post, information_icon, post_url, current_url, related_posts) }}
\ No newline at end of file
+{#{{ template.post_template('all', post, information_icon, post_url, current_url, related_posts) }}#}
\ No newline at end of file
diff --git a/plugin/studentfollowup/view/posts.html.twig b/plugin/studentfollowup/view/posts.html.twig
index 1182e51905..f5bf29f439 100644
--- a/plugin/studentfollowup/view/posts.html.twig
+++ b/plugin/studentfollowup/view/posts.html.twig
@@ -1,6 +1,6 @@
{% import 'studentfollowup/view/post.html.twig' as template %}
-Care detail view
+Care detail view - {{ student_info.complete_name }}
{% if posts %}
{% for post in posts %}
{{ template.post_template('simple', post, information_icon, post_url, current_url) }}
From 4c3ee4f7b07afad5e5cb348831a4bc98ff2f91ea Mon Sep 17 00:00:00 2001
From: jmontoyaa
Date: Tue, 23 May 2017 15:11:01 +0200
Subject: [PATCH 08/12] Fix query
---
plugin/studentfollowup/post.php | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/plugin/studentfollowup/post.php b/plugin/studentfollowup/post.php
index 0bcca546ba..236a109931 100644
--- a/plugin/studentfollowup/post.php
+++ b/plugin/studentfollowup/post.php
@@ -50,6 +50,9 @@ $relatedPosts = [];
if ($post) {
$qb = $em->createQueryBuilder();
$criteria = Criteria::create();
+
+ $criteria->where(Criteria::expr()->eq('parent', $post->getId()));
+
if ($showPrivate == false) {
$criteria->andWhere(Criteria::expr()->eq('private', false));
}
@@ -57,7 +60,7 @@ if ($post) {
if (!empty($post->getParent())) {
$criteria->andWhere(Criteria::expr()->eq('parent', $post->getParent()));
}
- $criteria->andWhere(Criteria::expr()->eq('parent', $post->getId()));
+
$criteria->orWhere(Criteria::expr()->eq('id', $post->getId()));
$qb
@@ -68,7 +71,6 @@ if ($post) {
->orderBy('p.createdAt', 'desc')
;
$query = $qb->getQuery();
- //var_dump($query->getSQL());
$relatedPosts = $query->getResult();
}
//var_dump($post->getTitle());
From e03cf21923990d4b6ddd3ba2dee33b1f56100325 Mon Sep 17 00:00:00 2001
From: jmontoyaa
Date: Tue, 23 May 2017 15:20:52 +0200
Subject: [PATCH 09/12] Fix query see BT#12723
---
plugin/studentfollowup/post.php | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/plugin/studentfollowup/post.php b/plugin/studentfollowup/post.php
index 236a109931..3c79b78a36 100644
--- a/plugin/studentfollowup/post.php
+++ b/plugin/studentfollowup/post.php
@@ -51,16 +51,16 @@ if ($post) {
$qb = $em->createQueryBuilder();
$criteria = Criteria::create();
- $criteria->where(Criteria::expr()->eq('parent', $post->getId()));
+ if (!empty($post->getParent())) {
+ $criteria->where(Criteria::expr()->in('parent', [$post->getParent()->getId(), $post->getId()]));
+ } else {
+ $criteria->where(Criteria::expr()->eq('parent', $post->getId()));
+ }
if ($showPrivate == false) {
$criteria->andWhere(Criteria::expr()->eq('private', false));
}
- if (!empty($post->getParent())) {
- $criteria->andWhere(Criteria::expr()->eq('parent', $post->getParent()));
- }
-
$criteria->orWhere(Criteria::expr()->eq('id', $post->getId()));
$qb
From 198c1dc631ae9039a37bbb353195a1c4f5eeb16b Mon Sep 17 00:00:00 2001
From: jmontoyaa
Date: Tue, 23 May 2017 15:40:43 +0200
Subject: [PATCH 10/12] Minor - format code
---
main/course_description/index.php | 4 ++--
main/course_description/layout.php | 4 ++--
main/course_description/listing.php | 30 ++++++++++++++---------------
main/inc/lib/template.lib.php | 1 +
4 files changed, 20 insertions(+), 19 deletions(-)
diff --git a/main/course_description/index.php b/main/course_description/index.php
index a938003be6..eafd2f1e2c 100755
--- a/main/course_description/index.php
+++ b/main/course_description/index.php
@@ -24,12 +24,12 @@ api_protect_course_script(true);
$actions = array('listing', 'add', 'edit', 'delete', 'history');
$action = 'listing';
if (isset($_GET['action']) && in_array($_GET['action'], $actions)) {
- $action = $_GET['action'];
+ $action = $_GET['action'];
}
$description_type = '';
if (isset($_GET['description_type'])) {
- $description_type = intval($_GET['description_type']);
+ $description_type = intval($_GET['description_type']);
}
$id = null;
diff --git a/main/course_description/layout.php b/main/course_description/layout.php
index 44c484a293..3a40124c1b 100755
--- a/main/course_description/layout.php
+++ b/main/course_description/layout.php
@@ -11,7 +11,7 @@
api_protect_course_script(true);
// Header
-Display :: display_header('');
+Display::display_header('');
// Introduction section
Display::display_introduction_section(TOOL_COURSE_DESCRIPTION);
@@ -23,4 +23,4 @@ Event::event_access_tool(TOOL_COURSE_DESCRIPTION);
echo $content;
// Footer
-Display :: display_footer();
+Display::display_footer();
diff --git a/main/course_description/listing.php b/main/course_description/listing.php
index 07179cf60e..62146aeb79 100755
--- a/main/course_description/listing.php
+++ b/main/course_description/listing.php
@@ -18,27 +18,27 @@ if (api_is_allowed_to_edit(null, true)) {
}
$categories[ADD_BLOCK] = get_lang('NewBloc');
- $i = 1;
- echo '';
}
$history = isset($history) ? $history : null;
// display course description list
if ($history) {
- echo '
+ echo '
'.get_lang('ThematicAdvanceHistory').' |
@@ -49,7 +49,7 @@ if ($history) {
$user_info = api_get_user_info();
if (isset($descriptions) && count($descriptions) > 0) {
- foreach ($descriptions as $id => $description) {
+ foreach ($descriptions as $id => $description) {
if (!empty($description)) {
$actions = '';
if (api_is_allowed_to_edit(null, true) && !$history) {
diff --git a/main/inc/lib/template.lib.php b/main/inc/lib/template.lib.php
index aea15044f0..f2c5ebca88 100755
--- a/main/inc/lib/template.lib.php
+++ b/main/inc/lib/template.lib.php
@@ -427,6 +427,7 @@ class Template
$show_course_navigation_menu = null;
if (!empty($this->course_id) && $this->user_is_logged_in) {
+
if (api_get_setting('show_toolshortcuts') != 'false') {
//Course toolbar
$show_course_shortcut = CourseHome::show_navigation_tool_shortcuts();
From 1507783a39c30305f2484e1a7a856fc35ea4463e Mon Sep 17 00:00:00 2001
From: jmontoyaa
Date: Tue, 23 May 2017 15:42:56 +0200
Subject: [PATCH 11/12] Add missing toolbar see BT#12807
---
main/template/default/layout/show_header.tpl | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/main/template/default/layout/show_header.tpl b/main/template/default/layout/show_header.tpl
index ade002ecdd..8871287c06 100755
--- a/main/template/default/layout/show_header.tpl
+++ b/main/template/default/layout/show_header.tpl
@@ -34,6 +34,11 @@
{% endif %}
{% include template ~ "/layout/page_header.tpl" %}
+{% if show_course_shortcut is not null %}
+
+ {{ show_course_shortcut }}
+
+{% endif %}
{% block breadcrumb %}
From 443dd0a0862ab8dbcd7ab11883bce1b580bf3f03 Mon Sep 17 00:00:00 2001
From: jmontoyaa
Date: Tue, 23 May 2017 15:51:36 +0200
Subject: [PATCH 12/12] Fix UI, update lang see BT#12723
---
main/inc/lib/banner.lib.php | 6 +++---
plugin/studentfollowup/lang/english.php | 2 ++
plugin/studentfollowup/post.php | 1 +
plugin/studentfollowup/posts.php | 1 +
plugin/studentfollowup/view/post.html.twig | 10 ++--------
plugin/studentfollowup/view/posts.html.twig | 2 +-
6 files changed, 10 insertions(+), 12 deletions(-)
diff --git a/main/inc/lib/banner.lib.php b/main/inc/lib/banner.lib.php
index 8705088ab3..605d404eb0 100755
--- a/main/inc/lib/banner.lib.php
+++ b/main/inc/lib/banner.lib.php
@@ -343,9 +343,10 @@ function return_navigation_array()
if (true) {
$params = array('variable = ? AND subkey = ?' => ['status', 'studentfollowup']);
$result = api_get_settings_params_simple($params);
+ $plugin = StudentFollowUpPlugin::create();
if (!empty($result) && $result['selected_value'] === 'installed') {
$navigation['follow_up']['url'] = api_get_path(WEB_PLUGIN_PATH).'studentfollowup/posts.php';
- $navigation['follow_up']['title'] = get_lang('MyDossier');
+ $navigation['follow_up']['title'] = $plugin->get_lang('CareDetailView');
$navigation['follow_up']['key'] = 'homepage';
$navigation['follow_up']['icon'] = 'homepage.png';
}
@@ -363,8 +364,7 @@ function return_navigation_array()
// Reports
if (!empty($possible_tabs['reports'])) {
if (api_get_setting('show_tabs', 'reports') == 'true') {
- if (
- (api_is_platform_admin() || api_is_drh() || api_is_session_admin())
+ if ((api_is_platform_admin() || api_is_drh() || api_is_session_admin())
&& Rights::hasRight('show_tabs:reports')
) {
$navigation['reports'] = $possible_tabs['reports'];
diff --git a/plugin/studentfollowup/lang/english.php b/plugin/studentfollowup/lang/english.php
index 56daa91589..ec282c344b 100644
--- a/plugin/studentfollowup/lang/english.php
+++ b/plugin/studentfollowup/lang/english.php
@@ -5,4 +5,6 @@ $strings['plugin_comment'] = "Care system (Zorgdossier) [CS]
Career follow system (Structuurschema) [CFS]
Competence based evaluation system (Competentie evaluatie systeem) [CBES]";
$strings['tool_enable'] = 'Enable plugin';
+$strings['CareDetailView'] = 'Care detail view';
+
diff --git a/plugin/studentfollowup/post.php b/plugin/studentfollowup/post.php
index 3c79b78a36..85987efd61 100644
--- a/plugin/studentfollowup/post.php
+++ b/plugin/studentfollowup/post.php
@@ -89,6 +89,7 @@ $tpl->assign(
);
$tpl->assign('information_icon', Display::return_icon('info.png'));
$tpl->assign('student_info', api_get_user_info($studentId));
+$tpl->assign('care_title', $plugin->get_lang('CareDetailView'));
$content = $tpl->fetch('/'.$plugin->get_name().'/view/post.html.twig');
// Assign into content
diff --git a/plugin/studentfollowup/posts.php b/plugin/studentfollowup/posts.php
index c91c801ed7..896830c8cf 100644
--- a/plugin/studentfollowup/posts.php
+++ b/plugin/studentfollowup/posts.php
@@ -74,6 +74,7 @@ $tpl->assign('post_url', $url);
$tpl->assign('information_icon', Display::return_icon('info.png'));
$tpl->assign('student_info', api_get_user_info($studentId));
$tpl->assign('pagination', $pagination);
+$tpl->assign('care_title', $plugin->get_lang('CareDetailView'));
$content = $tpl->fetch('/'.$plugin->get_name().'/view/posts.html.twig');
// Assign into content
$tpl->assign('content', $content);
diff --git a/plugin/studentfollowup/view/post.html.twig b/plugin/studentfollowup/view/post.html.twig
index fe090bcfa1..19182badc3 100644
--- a/plugin/studentfollowup/view/post.html.twig
+++ b/plugin/studentfollowup/view/post.html.twig
@@ -14,16 +14,10 @@
{% if countElements > 1 %}
{{ information_icon }} + {{ countElements }}
{% else %}
- {{ information_icon }}
+ {{ information_icon }} + 1
{% endif %}
{% endif %}
-
- {% if post.parent %}
-
- {{ post.parent.title }}
-
- {% endif %}
{% endif %}
{#{% if type == 'all' %}#}
@@ -78,7 +72,7 @@
- Care detail view - {{ student_info.complete_name }} - {{ post.title }}
+ {{ care_title }} - {{ student_info.complete_name }} - {{ post.title }}
{% if post.parent %}
{{ post.parent.title }}
{% endif %}
diff --git a/plugin/studentfollowup/view/posts.html.twig b/plugin/studentfollowup/view/posts.html.twig
index f5bf29f439..39db3694cd 100644
--- a/plugin/studentfollowup/view/posts.html.twig
+++ b/plugin/studentfollowup/view/posts.html.twig
@@ -1,6 +1,6 @@
{% import 'studentfollowup/view/post.html.twig' as template %}
-Care detail view - {{ student_info.complete_name }}
+{{ care_title }} - {{ student_info.complete_name }}
{% if posts %}
{% for post in posts %}
{{ template.post_template('simple', post, information_icon, post_url, current_url) }}