From 33a4ff908c34880722a19c154ab408c36441a44b Mon Sep 17 00:00:00 2001 From: jmontoyaa Date: Tue, 16 May 2017 14:36:14 +0200 Subject: [PATCH] Add blog icon see BT#12723 --- main/mySpace/myStudents.php | 28 +++++++++++++++++-- .../studentfollowup/StudentFollowUpPlugin.php | 14 ++++++++++ plugin/studentfollowup/post.php | 2 -- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/main/mySpace/myStudents.php b/main/mySpace/myStudents.php index 8881e984d3..dc3ad39569 100755 --- a/main/mySpace/myStudents.php +++ b/main/mySpace/myStudents.php @@ -366,7 +366,7 @@ if (!empty($student_id)) { echo ''. Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).' '; - if (!empty ($user_info['email'])) { + if (!empty($user_info['email'])) { $send_mail = ''. Display::return_icon('mail_send.png', get_lang('SendMail'), '', ICON_SIZE_MEDIUM).''; } else { @@ -385,11 +385,35 @@ if (!empty($student_id)) { if (api_is_platform_admin(false, true) || api_is_student_boss()) { echo Display::url( - Display::return_icon('skill-badges.png', get_lang('AssignSkill'), null, ICON_SIZE_MEDIUM), + Display::return_icon( + 'skill-badges.png', + get_lang('AssignSkill'), + null, + ICON_SIZE_MEDIUM + ), api_get_path(WEB_CODE_PATH).'badge/assign.php?'.http_build_query(['user' => $student_id]) ); } + $permissions = StudentFollowUpPlugin::getPermissions( + $student_id, + api_get_user_id() + ); + $isAllow = $permissions['is_allow']; + if ($isAllow) { + echo Display::url( + Display::return_icon( + 'blog.png', + get_lang('Blog'), + null, + ICON_SIZE_MEDIUM + ), + api_get_path(WEB_PLUGIN_PATH).'studentfollowup/posts.php?student_id='.$student_id + ); + } + + + echo ''; // is the user online ? diff --git a/plugin/studentfollowup/StudentFollowUpPlugin.php b/plugin/studentfollowup/StudentFollowUpPlugin.php index 2571deb9bb..24db6dc35a 100644 --- a/plugin/studentfollowup/StudentFollowUpPlugin.php +++ b/plugin/studentfollowup/StudentFollowUpPlugin.php @@ -86,6 +86,20 @@ class StudentFollowUpPlugin extends Plugin */ public static function getPermissions($studentId, $currentUserId) { + $params = ['variable = ? AND subkey = ?' => ['status', 'studentfollowup']]; + $result = api_get_settings_params_simple($params); + $installed = false; + if (!empty($result) && $result['selected_value'] === 'installed') { + $installed = true; + } + + if ($installed == false) { + return [ + 'is_allow' => false, + 'show_private' => false, + ]; + } + $isAllow = false; $showPrivate = false; if ($studentId === $currentUserId) { diff --git a/plugin/studentfollowup/post.php b/plugin/studentfollowup/post.php index 8e63a40c81..dfe4842c77 100644 --- a/plugin/studentfollowup/post.php +++ b/plugin/studentfollowup/post.php @@ -62,10 +62,8 @@ if ($post && !empty($post->getParent())) { ; $query = $qb->getQuery(); $relatedPosts = $query->getResult(); - } - $tpl = new Template($plugin->get_lang('plugin_title')); $tpl->assign('post', $post); $tpl->assign('related_posts', $relatedPosts);