'.
+ Display::img(
api_get_path(WEB_UPLOAD_PATH).$categoryInfo['image'],
get_lang('Image'),
['width' => 256]
diff --git a/main/inc/lib/course_category.lib.php b/main/inc/lib/course_category.lib.php
index a184e9b5355..4fd10c1f7d1 100755
--- a/main/inc/lib/course_category.lib.php
+++ b/main/inc/lib/course_category.lib.php
@@ -1158,6 +1158,11 @@ public static function getCourseCatalogNameTools($action)
*/
public static function saveImage($categoryId, $fileData)
{
+ $categoryInfo = self::getCategoryById($categoryId);
+ if (empty($categoryInfo)) {
+ return;
+ }
+
if (!empty($fileData['error'])) {
return;
}
@@ -1176,7 +1181,31 @@ public static function saveImage($categoryId, $fileData)
$image->send_image($fileDir.$fileName);
$table = Database::get_main_table(TABLE_MAIN_CATEGORY);
+ Database::update(
+ $table,
+ ['image' => $dirName.$fileName],
+ ['id = ?' => $categoryId]
+ );
+ }
- Database::update($table, ['image' => $dirName.$fileName], ['id = ?' => $categoryId]);
+ /**
+ * @param $categoryId
+ * @param string $description
+ *
+ * @return string
+ */
+ public static function saveDescription($categoryId, $description)
+ {
+ $categoryInfo = self::getCategoryById($categoryId);
+ if (empty($categoryInfo)) {
+ return false;
+ }
+ $table = Database::get_main_table(TABLE_MAIN_CATEGORY);
+ Database::update(
+ $table,
+ ['description' => $description],
+ ['id = ?' => $categoryId]
+ );
+ return true;
}
}
diff --git a/main/install/configuration.dist.php b/main/install/configuration.dist.php
index cd959fa15e8..fb46a6a59f8 100755
--- a/main/install/configuration.dist.php
+++ b/main/install/configuration.dist.php
@@ -572,6 +572,7 @@
//$_configuration['show_simple_session_info'] = true;
// Show course category list on My Courses page before the courses. Requires a DB change
//ALTER TABLE course_category ADD image varchar(255) NULL;
+//ALTER TABLE course_category ADD description LONGTEXT NULL;
//$_configuration['my_courses_list_as_category'] = false;
// ------
diff --git a/main/template/default/user_portal/course_categories.tpl b/main/template/default/user_portal/course_categories.tpl
index 7921a67db5e..f547cb4eb75 100644
--- a/main/template/default/user_portal/course_categories.tpl
+++ b/main/template/default/user_portal/course_categories.tpl
@@ -12,6 +12,9 @@
{{ category.code }}
+ {% if category.description %}
+
{{ category.description }}
+ {% endif %}
{{ 'View'|get_lang }}