소스 검색

Add blog icon see BT#12723

jmontoyaa 7 년 전
부모
커밋
33a4ff908c
3개의 변경된 파일40개의 추가작업 그리고 4개의 파일을 삭제
  1. 26 2
      main/mySpace/myStudents.php
  2. 14 0
      plugin/studentfollowup/StudentFollowUpPlugin.php
  3. 0 2
      plugin/studentfollowup/post.php

+ 26 - 2
main/mySpace/myStudents.php

@@ -366,7 +366,7 @@ if (!empty($student_id)) {
     echo '<a href="'.api_get_self().'?'.Security::remove_XSS($_SERVER['QUERY_STRING']).'&export=xls">'.
     Display::return_icon('export_excel.png', get_lang('ExportAsXLS'), '', ICON_SIZE_MEDIUM).'</a> ';
 
-    if (!empty ($user_info['email'])) {
+    if (!empty($user_info['email'])) {
         $send_mail = '<a href="mailto:'.$user_info['email'].'">'.
             Display::return_icon('mail_send.png', get_lang('SendMail'), '', ICON_SIZE_MEDIUM).'</a>';
     } 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 '</div>';
 
     // is the user online ?

+ 14 - 0
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) {

+ 0 - 2
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);