Ejemplo n.º 1
0
                    if ($data['date'] > $lastvisit) {
                        echo ' style="font-weight:bold;"><a href="#" discussionid="' . $discussionId . '" component="forum">' . $data['title'] . '</a>
		 									</td><td style="font-size:13px; font-weight:bold;">' . $data['from'] . '</td><td style="font-weight:bold;">' . $date . '</td>';
                        //		  									<td><button type="button" class="btn btn-primary btn-sm" style="color:#E5E3FB">
                        //		   									<span class="glyphicon glyphicon-share-alt" aria-hidden="true"></span>&nbsp<b> share
                        //		 									</b></button></td>
                        echo '</tr>';
                    } else {
                        echo '><a href="#" discussionid="' . $discussionId . '" component="forum">' . $data['title'] . '</a>
 									</td><td style="font-size:13px">' . $data['from'] . '</td><td>' . $date . '</td>';
                        // 									<td> <button type="button" class="btn btn-default btn-sm" style="color:#909090;">
                        //   									<span class="glyphicon glyphicon-share-alt" aria-hidden="true"></span>&nbsp<b> share
                        // 									</b></button></td>
                        echo '</tr>';
                    }
                    $postData = get_posts_from_discussion($discussionId);
                    ?>
						<!-- Modal -->
						<div class="modal fade" id="m<?php 
                    echo $discussionId;
                    ?>
" tabindex="-1" role="dialog" aria-labelledby="modal">
						  <div class="modal-dialog" role="document">
						    <div class="modal-content">
						      <div class="modal-body">
						      <?php 
                    foreach ($postData as $post) {
                        $date = $post['date'];
                        echo "<div align='left'style='background-color:#E6E6E6; border-radius: 4px 4px 0 0; padding:4px; color:#333333;'><img src='images/post.png'>\n \t\t\t\t\t\t\t\t\t<b>&nbsp&nbsp" . $data['title'] . "<br>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp" . $post['user'] . ", " . date('l d-F-Y', $date) . "</b></div>";
                        echo "<div align='left' style='border-radius: 0 0 4px 4px; \tword-wrap: break-word;'>" . $post['message'] . "</div>";
                        echo "<br>";
Ejemplo n.º 2
0
                                $assignmodal = "<div class='modal fade' id='a" . $module['id'] . "' tabindex='-1' role='dialog' aria-labelledby='modal'>\n\t\t\t\t\t\t\t\t\t<div class='modal-dialog' role='document'>\n\t\t\t\t\t\t\t\t\t\t<div class='modal-content'>\n\t\t\t\t\t\t\t\t\t\t\t<div class='modal-title' align='center'><h4>" . $module['title'] . "</h4></div>\n\t\t\t\t\t\t\t\t\t\t\t<div class='modal-body' id='emarking-modal-body'>\n\t\t\t\t\t\t\t\t\t\t\t\t<div class='row'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div class='col-md-5 col-md-offset-1'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<b>" . get_string('submitstatus', 'local_facebook') . "</b>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<b>" . get_string('gradestatus', 'local_facebook') . "</b>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<b>" . get_string('duedate', 'local_facebook') . "</b>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t<b>" . get_string('lastmodified', 'local_facebook') . "</b>\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t\t<div class='col-md-5'>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $module['status'] . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $module['grade'] . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $module['due'] . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t<br>\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $module['modified'] . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t\t<div class='modal-footer'>\n\t\t\t\t\t\t\t\t\t\t\t\t<a class='btn btn-primary' href='" . $module['link'] . "' role='button' target='_blank'>" . get_string('viewassign', 'local_facebook') . "</a>\n\t\t\t\t\t\t\t\t\t\t\t\t<button type='button' class='btn btn-default' data-dismiss='modal' component='close-modal'>" . get_string('close', 'local_facebook') . "</button>\n\t\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t\t</div>\n\t\t\t\t\t\t\t\t</div>";
                                $htmltable .= $assignmodal;
                            }
                        }
                    }
                }
            }
            if ($new == 1) {
                $htmltable .= "</td><td><a style='font-weight:bold;' {$link} component={$component} {$id}>" . $module['title'] . "</a></td>\n\t\t\t\t\t\t<td>" . $module['from'] . "</td><td>" . $date . "</td></tr>";
            } else {
                $htmltable .= "</td><td><a {$link} component={$component} {$id}>" . $module['title'] . "</a></td>\n\t\t\t\t\t\t<td>" . $module['from'] . "</td><td>" . $date . "</td></tr>";
            }
        }
    }
    $htmltable .= "</tbody></table>";
    $jsfunction = "<script>\n\t\t\t\$( document ).ready(function() {\n \t\t\t\t\$('a').click(function () {\n\t \t\t\t\tvar aclick = \$(this).attr('style');\n\t\t\n\t \t\t\t\tif (\$(this).attr('component') == 'forum') {\n\t \t\t\t\t\tdiscussionId = \$(this).attr('discussionid');\n\t\t\t\t\t\tmoduleId = \$(this).attr('moduleid');\n\t\t\t\t\t\tvar url = \$('#divurl').attr('url');\n\t \t\t\t\t\tjQuery.ajax({\n\t \t \t\t\t\t\turl : url+'?action=get_discussion&discussionid=' + discussionId + '&moduleid=' + moduleId,\n\t \t \t\t\t\t\tasync : true,\n\t \t \t\t\t\t\tdata : {},\n\t \t \t\t\t\t\tsuccess : function (response) {\n\t \t\t\t\t\t\t\t\$('#modal-content').empty();\n\t \t \t\t\t\t\t\t\$('#modal-content').append(response);\n\t \t \t\t\t\t\t\t\$('#forum-modal').modal();\n\t  \t\t\t\t\t\t}\n\t  \t\t\t\t\t});\n\t \t\t\t\t}\n\t\t\n\t \t\t\t\telse if(\$(this).attr('component') == 'emarking') {\n\t \t\t\t\t\temarkingId = \$(this).attr('emarkingid');\n\t\t\n\t \t\t\t\t\t\$('#e' + emarkingId).modal();\n\t \t\t\t\t}\n\t\t\n\t \t\t\t\telse if (\$(this).attr('component') == 'assign') {\n\t \t\t\t\t\tassignId = \$(this).attr('assignid');\n\t\t\n\t \t\t\t\t\t\$('#a' + assignId).modal();\n\t \t\t\t\t}\n\t\t\n\t\t\t\t\tif(aclick == 'font-weight:bold;'){\n\t\t\t\t\t\tvar courseid = \$('#coursename').attr('courseid');\n\t\t\t\t\t\t\$(this).css('font-weight','normal');\n\t\t\t\t\t\t\$(this).parent().parent().find('span').remove();\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\$( '.name' ).each(function( index ) {\n\t\t\t\t  \t\t\tvar este = \$(this).attr('courseid');\n\t\t\t\t\t\t\n\t\t\t\t\t\t\tif(este == courseid){\n\t\t\t\t\t\t\tvar badgecourse = \$(this).parent().find('.badge');\n\t\t\t\t\t\t\t\tif(badgecourse.text() == 1) {\n\t\t\t\t\t\t\t\t\tbadgecourse.remove();\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\telse{\n\t\t\t\t\t\t\t\t\tbadgecourse.text(badgecourse.text()-1);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t});\n \t\t\t</script>";
    $htmltable .= $jsfunction;
    echo $htmltable;
} else {
    if ($action == 'get_discussion') {
        $discussionposts = get_posts_from_discussion($discussionid);
        $htmlmodal = "<div class='modal-body' id='modal-body'>";
        $moodlelink = new moodle_url('/mod/forum/discuss.php', array('d' => $discussionid));
        foreach ($discussionposts as $post) {
            $date = $post['date'];
            $htmlmodal .= "<div align='left' style='background-color: #E6E6E6; border-radius: 4px 4px 0 0; padding: 4px; color: #333333;'>\n\t\t\t\t\t\t<img src='images/post.png'>\n\t\t\t\t\t\t\t<b>&nbsp&nbsp" . $post['subject'] . "<br>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp" . $post['user'] . ", " . date('l d-F-Y', $date) . "</b>\n\t\t\t\t\t    </div>\n\t\t\t\t\t<div align='left' style='border-radius: 0 0 4px 4px; word-wrap: break-word;'>" . $post['message'] . "</div><br>";
        }
        $htmlmodal .= "</div>\n\t\t   \t\t<div class='modal-footer'>\n\t\t\t\t   \t<a class='btn btn-primary' href='" . $moodlelink . "' role='button' target='_blank'>" . get_string('viewforum', 'local_facebook') . "</a>\n\t\t\t\t\t<button id='close' type='button' class='btn btn-default' data-dismiss='modal' component='close-modal' modalid='forum-modal'>" . get_string('close', 'local_facebook') . "</button>\n\t\t\t\t</div>\n\t\t\t\t<script type='text/javascript' src='js/modalclose.js'></script>";
        echo $htmlmodal;
    }
}