Exemplo n.º 1
0
        public Comments_On_Answer(List <Comment> sumbissionComments)
        {
            Title = "Комментарии к ответу";

            var comments_Layout = new StackLayout();

            if (sumbissionComments.Count != 0)
            {
                foreach (var comment in Variables.sumbissionComments.comments)
                {
                    var commentsOnAnswer = Structure_Frame.Comment_on_the_answer_frame(comment);
                    comments_Layout.Children.Add(commentsOnAnswer);
                }
            }
            else
            {
                //Добавить картинку что нет комментариев
            }

            Padding         = 1;
            BackgroundColor = Color.FromHex("#293991");

            var scrollView = new ScrollView
            {
                Content = comments_Layout
            };

            this.Content = comments_Layout;
        }
Exemplo n.º 2
0
        public Submission_List()
        {
            Title = "Ответы";

            goToGradingParticipantsPage = new Command <int>(Go_To_Grading_Participants_Page);

            var subm_List_Layout = new StackLayout();

            var participantsList = Task.Run(
                () => API.Get_Mod_assign_list_participants(Variables.assignId, 0, "", 0, 0, 0, 1));

            foreach (var participants in participantsList.Result)
            {
                if (participants.submitted == true)
                {
                    var participantInformation = Structure_Frame.List_Submissions_Information_Frame(participants);
                    subm_List_Layout.Children.Add(participantInformation);
                }
            }

            Padding         = 1;
            BackgroundColor = Color.FromHex("#293991");

            var scrollView = new ScrollView
            {
                Content = subm_List_Layout
            };

            this.Content = scrollView;

            this.BindingContext = this;
        }
        public Edit_Comment_On_Grade(string commentText)
        {
            Title = Variables.true_assign.name;

            var edit_Comment_Layout = new StackLayout();

            var saveResult = new ToolbarItem
            {
                Text    = "Сохранить",
                Command = new Command(this.Save_Result),
            };

            var edit_Comment = Structure_Frame.Save_Or_Edit_Comment_On_Grade_Frame(commentText);

            edit_Comment_Layout.Children.Add(edit_Comment);

            this.ToolbarItems.Add(saveResult);

            Padding         = 1;
            BackgroundColor = Color.FromHex("#293991");

            var scroll_View = new ScrollView
            {
                Content = edit_Comment_Layout
            };

            this.Content = scroll_View;

            this.BindingContext = this;
        }
Exemplo n.º 4
0
        public void Handle_ValueChanged(
            object o,
            SegmentedControl.FormsPlugin.Abstractions.ValueChangedEventArgs e)
        {
            view_frames.Children.Clear();
            switch (e.NewValue)
            {
            case 0:
                if (Variables.submissionInfo.lastattempt.submission.status == "new")
                {
                    view_frames.Children.Add(Structure_Frame.Value_comments_on_the_answer_frame(
                                                 Variables.sumbissionComments.comments));

                    view_frames.Children.Add(Structure_Frame.Can_Edit_Status_Frame(
                                                 Variables.submissionInfo.lastattempt.caneditowner));
                }
                else
                {
                    view_frames.Children.Add(Structure_Frame.Answer_Frame(
                                                 Variables.submissionInfo.lastattempt.submission.plugins));

                    view_frames.Children.Add(Structure_Frame.Value_comments_on_the_answer_frame(
                                                 Variables.sumbissionComments.comments));

                    view_frames.Children.Add(Structure_Frame.Last_Change_Frame(
                                                 Variables.submissionInfo.lastattempt.submission.timemodified));

                    view_frames.Children.Add(Structure_Frame.Can_Edit_Status_Frame(
                                                 Variables.submissionInfo.lastattempt.caneditowner));
                }
                break;

            case 1:
                if (Variables.submissionInfo.lastattempt.gradingstatus == "graded")
                {
                    view_frames.Children.Add(Structure_Frame.Rate_Participant_Submission_Frame(
                                                 Variables.true_assign.grade,
                                                 Variables.submissionInfo.feedback.grade.grade));
                }
                else
                {
                    var frame = Structure_Frame.Rate_Participant_Submission_Frame(
                        Variables.true_assign.grade, "");

                    view_frames.Children.Add(frame);
                }

                view_frames.Children.Add(Structure_Frame.Edit_Comment_On_Grade_Frame());

                if (Variables.submissionInfo.feedback != null)
                {
                    var frame = Structure_Frame.Grader_Frame(
                        Variables.grader_inf, Variables.submissionInfo.feedback.grade.timemodified);

                    view_frames.Children.Add(frame);
                }

                break;
            }
        }
        public void Handle_ValueChanged(
            object o,
            SegmentedControl.FormsPlugin.Abstractions.ValueChangedEventArgs e)
        {
            view_frames.Children.Clear();
            switch (e.NewValue)
            {
            case 0:
                Function.Check_Submission_Status_View(view_frames,
                                                      Variables.submissionInfo.lastattempt);
                break;

            case 1:

                if (Variables.submissionInfo.lastattempt.gradingstatus == "graded")
                {
                    view_frames.Children.Add(Structure_Frame.Grade_In_Journal_Frame(
                                                 Variables.submissionInfo.feedback.gradefordisplay));
                }

                view_frames.Children.Add(Structure_Frame.Comment_Grader_On_The_Answer_Frame(
                                             Variables.submissionInfo.feedback.plugins));

                view_frames.Children.Add(Structure_Frame.Grader_Frame(
                                             Variables.grader_inf, Variables.submissionInfo.feedback.grade.timemodified));
                break;
            }
        }
Exemplo n.º 6
0
        public static void Check_Plugins_View(StackLayout view, List <Plugins> plugins)
        {
            List <File> files = new List <File>();

            List <Filearea>    fileareas    = new List <Filearea>();
            List <Editorfield> editorfields = new List <Editorfield>();

            foreach (var item in plugins)
            {
                //для файлов
                if (item.type == "file")
                {
                    fileareas = item.fileareas;
                    foreach (var item_ in fileareas)
                    {
                        files = item_.files;
                    }
                }
                //для ответа в виде комментария
                if (item.type == "onlinetext")
                {
                    editorfields = item.editorfields;
                }
            }

            if (editorfields.Count != 0)
            {
                view.Children.Add(Structure_Frame.Answer_comments_frame(editorfields));
            }

            if (files.Count != 0)
            {
                view.Children.Add(Structure_Frame.Answer_files_frame(files));
            }
        }
        public Participants_List()
        {
            Title = "Участники";

            //Команды
            goToGradingParticipantsPage = new Command <int>(Go_To_Grading_Participant_Page);

            var part_List_Layout = new StackLayout();

            //Запрашиваем список студентов на задание (Второй параметр не понятен зачем и для чего)
            var participantsList = Task.Run(
                () => API.Get_Mod_assign_list_participants(Variables.assignId, 0, "", 0, 0, 0, 1));

            foreach (var participants in participantsList.Result)
            {
                var participantInformation = Structure_Frame.List_Submissions_Information_Frame(participants);
                part_List_Layout.Children.Add(participantInformation);
            }

            Padding         = 1;
            BackgroundColor = Color.FromHex("#293991");

            var scrollView = new ScrollView
            {
                Content = part_List_Layout
            };

            this.Content = scrollView;

            this.BindingContext = this;
        }
        public async void Cross_File_Picker()
        {
            Variables.file = await CrossFilePicker.Current.PickFile();

            if (Variables.file != null)
            {
                //Нужно сделать так, кнопка с вызовом crossfilepicker видна пока не достигнут лимит файлов
                //То что сейчас сделано прокатит только с 1 файлом
                fileView.Children.Add(Structure_Frame.File_Ready_For_Upload_Frame(Variables.file.FileName));
            }
        }
Exemplo n.º 9
0
        //не закончено (НУЖНО ДЛЯ ПРОСМОТРА КАКИЕ ОТВЕТЫ МОЖНО ДАТЬ НА ЗАДАНИЕ)
        public static void Check_Configs_In_Assignments(StackLayout view)
        {
            foreach (var config in Variables.true_assign.configs)
            {
                if (config.plugin == "onlinetext" && config.name == "enabled" && config.value == "1")
                {
                    #region wordLimit

                    /*
                     * Проверка на ограничение символов (по хорошему нужно сперва найти wordlimitEnable если оно 0
                     * то нету ограничение, если 1, то есть и кидаем его в wordlimit, но я думаю что если
                     * wordlimitEnable равен 1, то wordlimit должен быть больше 0 и тем самым проверка на wordlimitEnable
                     * не нужна)
                     */
                    #endregion
                    Variables.wordLimit = Convert.ToInt32(Variables.true_assign.configs.Find(x => x.name == "wordlimit").value);

                    foreach (var plugin in Variables.submissionInfo.lastattempt.submission.plugins)
                    {
                        if (plugin.type == "onlinetext")
                        {
                            foreach (var editorfield in plugin.editorfields)
                            {
                                var onlineTextFrame = Structure_Frame.Comment_On_Submission_Frame(editorfield.text);
                                view.Children.Add(onlineTextFrame);
                            }
                        }
                    }
                }

                if (config.plugin == "file" && config.name == "enabled" && config.value == "1")
                {
                    //незаконечно для ответов в виде файла
                    Variables.fileCountLimit = Convert.ToInt32(Variables.true_assign.configs.Find(x => x.name == "maxfilesubmissions").value);
                    Variables.fileSizeLimit  = Convert.ToInt32(Variables.true_assign.configs.Find(x => x.name == "maxsubmissionsizebytes").value);

                    foreach (var plugin in Variables.submissionInfo.lastattempt.submission.plugins)
                    {
                        if (plugin.type == "file")
                        {
                            foreach (var fileareas in plugin.fileareas)
                            {
                                /*
                                 *Тут писать вызов frame с ответом в виде файла
                                 *Если появляется вопрос почему именно через Variables.submissionInfo
                                 *Надо учитывать что это может быть редактировать ответ и файлы уже могут быть на сервере и нам нужно их вытащить
                                 */
                            }
                        }
                    }
                }
            }
        }
        public Save_or_edit_submission(StackLayout practical_Work_Layout, List <Frame> List_Header_Assing)
        {
            this.practical_Work_Layout = practical_Work_Layout;
            this.List_Header_Assing    = List_Header_Assing;
            var save_or_edit_Layout = new StackLayout();

            Title = Variables.true_assign.name;

            openFilePicker = new Command(Cross_File_Picker);

            var saveResult = new ToolbarItem
            {
                Text    = "Сохранить",
                Command = new Command(this.Save_Result),
            };

            this.ToolbarItems.Add(saveResult);

            Variables.submissionInfo = Task.Run(
                () => API.Get_Mod_Assign_Submission_Status(Variables.assignId, Variables.userId)).Result;

            var save_Or_Edit_Submission = Structure_Frame.Save_Or_Edit_Submission_Frame();

            save_or_edit_Layout.Children.Add(save_Or_Edit_Submission);

            Padding         = 1;
            BackgroundColor = Color.FromHex("#293991");

            var scrollView = new ScrollView
            {
                Content = save_or_edit_Layout
            };

            this.Content = save_or_edit_Layout;

            this.BindingContext = this;
        }
Exemplo n.º 11
0
        public Practical_Work()
        {
            practical_Work_Layout = new StackLayout();

            downloadSubmissionFile   = new Command <string>(Download_Submission_File);
            goToSaveOrEditPage       = new Command(Go_To_Save_Of_Edit_Submission);
            goToCommentOnAnswerPage  = new Command(Go_To_Comments_On_Answer_Page);
            goToSubmissionListPage   = new Command(Go_To_Submission_List_Page);
            goToParticipantsListPage = new Command(Go_To_Participants_List_Page);

            try
            {
                if (!CrossConnectivity.Current.IsConnected)
                {
                    throw new Exception();
                }

                var coursesInfo = Task.Run(
                    () => API.Get_Mod_Assign_Assignments(Variables.courseId)).Result;

                foreach (var course in coursesInfo.courses)
                {
                    Variables.true_assign = course.assignments.Find(x => x.id == Variables.assignId);
                }

                Title = Variables.true_assign.name;

                List_Header_Assing = new List <Frame>();

                //Вывод темы и описания задания
                if (Variables.true_assign.intro != "")
                {
                    var theme_and_description = Structure_Frame.Theme_And_Description_Frame(
                        Variables.true_assign.intro);
                    practical_Work_Layout.Children.Add(theme_and_description);
                    List_Header_Assing.Add(theme_and_description);
                }

                //Вывод приложеных файлов
                if (Variables.true_assign.introattachments.Count != 0)
                {
                    var intro_attachments_files = Structure_Frame.Intro_Attachments_Files_Frame(
                        Variables.true_assign.introattachments);
                    practical_Work_Layout.Children.Add(intro_attachments_files);
                    List_Header_Assing.Add(intro_attachments_files);
                }


                #region Info_For_Submission

                /*
                 * Вызываем функцию в которой провериться, студент или преподователь в курсе
                 * Проверит наличие feedback
                 * и вызывет нужные Frame
                 */
                #endregion
                Function.Info_For_Submission(practical_Work_Layout);
            }
            catch (Exception ex)
            {
                Function.Alert_Message_App(ex.Message);
            }
            Padding = 0;
            this.BackgroundColor = Color.White;

            var scrollView = new ScrollView
            {
                Content = practical_Work_Layout
            };
            this.Content = scrollView;

            this.BindingContext = this;
        }
Exemplo n.º 12
0
        public Grading_Participants(int participantId)
        {
            Title = Variables.true_assign.name;

            var grading_Part_Layout = new StackLayout();

            goToCommentOnAnswerPage = new Command(Go_To_Comments_On_Answer_Page);
            goToEditCommentOnGrade  = new Command(Go_To_Edit_Comment_On_Grade);

            var save_Result = new ToolbarItem
            {
                Text             = "Сохранить",
                Command          = new Command <int>(this.Save_Result),
                CommandParameter = participantId
            };

            this.ToolbarItems.Add(save_Result);

            Variables.submissionInfo = Task.Run(
                () => API.Get_Mod_Assign_Submission_Status(Variables.assignId, participantId)).Result;

            commentLabel = Structure_Label.Description_Label(
                Function.Check_Feedback_Plugins_For_Comments(Variables.submissionInfo.feedback));

            //Если задание оценено то берем информацию о том кто оценил
            if (Variables.submissionInfo.feedback != null)
            {
                var userInf = Task.Run(() => API.Get_Core_user_get_users_by_field(
                                           "id", Variables.submissionInfo.feedback.grade.grader.ToString()));
                foreach (var item in userInf.Result)
                {
                    if (item.id == Variables.submissionInfo.feedback.grade.grader)
                    {
                        Variables.grader_inf = item;
                    }
                }
                ;
            }

            Variables.sumbissionComments = Task.Run(
                () => API.Get_core_comment_get_comments("module", Variables.true_assign.cmid, "assignsubmission_comments",
                                                        Variables.submissionInfo.lastattempt.submission.id, "submission_comments", 0)).Result;

            var participantInformationList = Task.Run(() => API.Get_Core_user_get_users_by_field(
                                                          "id", participantId.ToString())).Result;
            var participantInformation = participantInformationList.Find(x => x.id == participantId);;

            var participantInformationFrame = Structure_Frame.Participants_Information_Frame(
                Variables.submissionInfo.lastattempt.submission.status,
                Variables.submissionInfo.lastattempt.gradingstatus,
                participantInformation.profileimageurl, participantInformation.fullname);

            grading_Part_Layout.Children.Add(participantInformationFrame);

            var tab_control = new Segmented_Control_Grading_Participant();

            grading_Part_Layout.Children.Add(tab_control);

            Padding         = 1;
            BackgroundColor = Color.FromHex("#293991");

            var scroll_View = new ScrollView
            {
                Content = grading_Part_Layout
            };

            this.Content = scroll_View;

            this.BindingContext = this;
        }
Exemplo n.º 13
0
        public static void Check_Submission_Status_View(StackLayout view, Lastattempt lastattempt)
        {
            if (lastattempt.submission.status == "new")
            {
                if (lastattempt.gradingstatus == "graded")
                {
                    view.Children.Add(Structure_Frame.Value_comments_on_the_answer_frame(
                                          Variables.sumbissionComments.comments));

                    view.Children.Add(Structure_Frame.Time_Left_Frame(
                                          Variables.submissionInfo.lastattempt.submission.timemodified,
                                          Variables.true_assign.duedate));

                    view.Children.Add(Structure_Frame.Grading_Due_Date_Frame(
                                          Variables.true_assign.duedate));
                }
                else
                {
                    view.Children.Add(Structure_Frame.Value_comments_on_the_answer_frame(
                                          Variables.sumbissionComments.comments));

                    view.Children.Add(Structure_Frame.Time_Left_Frame(
                                          Variables.submissionInfo.lastattempt.submission.timemodified,
                                          Variables.true_assign.duedate));

                    view.Children.Add(Structure_Frame.Grading_Due_Date_Frame(
                                          Variables.true_assign.duedate));
                }

                if (lastattempt.canedit == true)
                {
                    view.Children.Add(Structure_Frame.Go_To_Submission_Page_Frame("Добавить ответ на задание"));
                }
            }
            else
            {
                if (lastattempt.gradingstatus == "graded")
                {
                    view.Children.Add(Structure_Frame.Answer_Frame(
                                          lastattempt.submission.plugins));

                    view.Children.Add(Structure_Frame.Value_comments_on_the_answer_frame(
                                          Variables.sumbissionComments.comments));

                    view.Children.Add(Structure_Frame.Last_Change_Frame(
                                          Variables.submissionInfo.lastattempt.submission.timemodified));

                    view.Children.Add(Structure_Frame.Attempt_number_frame(
                                          Variables.submissionInfo.lastattempt.submission.attemptnumber,
                                          Variables.true_assign.maxattempts.ToString()));
                }
                else
                {
                    view.Children.Add(Structure_Frame.Answer_Frame(
                                          Variables.submissionInfo.lastattempt.submission.plugins));

                    view.Children.Add(Structure_Frame.Value_comments_on_the_answer_frame(
                                          Variables.sumbissionComments.comments));

                    view.Children.Add(Structure_Frame.Last_Change_Frame(
                                          Variables.submissionInfo.lastattempt.submission.timemodified));

                    view.Children.Add(Structure_Frame.Time_Left_Frame(
                                          Variables.submissionInfo.lastattempt.submission.timemodified,
                                          Variables.true_assign.duedate));

                    view.Children.Add(Structure_Frame.Grading_Due_Date_Frame(
                                          Variables.true_assign.duedate));

                    view.Children.Add(Structure_Frame.Attempt_number_frame(
                                          Variables.submissionInfo.lastattempt.submission.attemptnumber,
                                          Variables.true_assign.maxattempts.ToString()));
                }

                if (lastattempt.canedit == true)
                {
                    view.Children.Add(Structure_Frame.Go_To_Submission_Page_Frame("Редактировать ответ"));
                }
            }
        }
Exemplo n.º 14
0
        public static void Info_For_Submission(StackLayout view)
        {
            if (!CrossConnectivity.Current.IsConnected)
            {
                throw new Exception();
            }

            if (Variables.u_grader == 0)
            {
                Variables.submissionInfo = Task.Run(
                    () => API.Get_Mod_Assign_Submission_Status(Variables.assignId, Variables.userId)).Result;

                var comments = Task.Run(
                    () => API.Get_core_comment_get_comments("module", Variables.true_assign.cmid, "assignsubmission_comments",
                                                            Variables.submissionInfo.lastattempt.submission.id, "submission_comments", 0));

                Variables.sumbissionComments = comments.Result;

                var task_response_status = Structure_Frame.Task_Response_Status_Frame(
                    Variables.submissionInfo.lastattempt.submission.status,
                    Variables.submissionInfo.lastattempt.gradingstatus);
                view.Children.Add(task_response_status);

                #region

                /*
                 * для ответа вне системы (submissionsenabled если true то можно
                 * дать ответ, если false то нельзя), можно так же отследить в
                 * ответ вне системы или нет (но это не точно, лучше проверять plugins на наличие onlinetext и file)
                 */
                #endregion

                if (Variables.submissionInfo.feedback != null)
                {
                    //Если feedack не пустой то будет segmented_control, а значит нужен кто оценил
                    var grader_list = Task.Run(() => API.Get_Core_user_get_users_by_field(
                                                   "id",
                                                   Variables.submissionInfo.feedback.grade.grader.ToString())).Result;
                    foreach (var item in grader_list)
                    {
                        Variables.grader_inf = item;
                    }

                    var segmented_Control = new Segmented_Control_Practical_Work();
                    view.Children.Add(segmented_Control);
                }
                else
                {
                    Function.Check_Submission_Status_View(view,
                                                          Variables.submissionInfo.lastattempt);
                }
            }
            else
            {
                var participantsListFrame = Structure_Frame.Go_Participants_List_Page();
                view.Children.Add(participantsListFrame);

                var submissionListFrame = Structure_Frame.Go_Submission_List_Page();
                view.Children.Add(submissionListFrame);
            }
        }