public override void RenderQuestion(VLSurvey survey, VLSurveyPage page, VLSurveyQuestion question)
        {
            Writer.AddAttribute(HtmlTextWriterAttribute.Class, "composite");
            Writer.RenderBeginTag(HtmlTextWriterTag.Div);
            {
                //Τραβάμε τις child ερωτήσεις:
                var childQuestions = SurveyManager.GetChildQuestions(question.Survey, question.QuestionId, question.TextsLanguage);

                foreach (var childQuestion in childQuestions)
                {
                    var _renderer = HtmlRenderers.GetQuestionRenderer(this.SurveyManager, this.Writer, this.RuntimeSession, childQuestion.QuestionType);
                    _renderer.RenderQuestion(survey, page, childQuestion);
                }
            }
            Writer.RenderEndTag();
        }
Exemple #2
0
        protected string GetQuestionsHtml()
        {
            var _html  = new StringBuilder();
            var writer = new HtmlTextWriter(new StringWriter(_html));

            //εάν δεν υπάρχει επιλεγμένη σελίδα, τότε δεν δημιουργούμε αυτό το section:
            if (this.SurveyPageId == -1)
            {
                #region No Pages
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                HttpUtility.HtmlEncode("Το ερωτηματολόγιό σας, δεν περιέχει καμμία σελίδα ερωτήσεων.", writer);
                writer.RenderEndTag();
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                HttpUtility.HtmlEncode("Προσθέστε παρακαλώ, μια σελίδα!", writer);
                writer.RenderEndTag();
                #endregion
                return(_html.ToString());
            }

            var questions = SurveyManager.GetQuestionsForPage(this.Surveyid, this.SurveyPageId, this.TextsLanguage);
            //StringBuilder sb = new StringBuilder();

            foreach (var question in questions)
            {
                AddQuestionButtons(writer, question);

                writer.AddAttribute(HtmlTextWriterAttribute.Class, "questionBox");
                writer.RenderBeginTag(HtmlTextWriterTag.Div);
                {
                    if (question.QuestionType == QuestionType.DescriptiveText)
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "questionHeaderTransparent");
                    }
                    else
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "questionHeader");
                    }
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);
                    if (question.HasSkipLogic)
                    {
                        writer.Write("<img class=\"branchedMarker\" src=\"/content/images/branch-page-icon.png\" />");
                    }
                    if (question.IsRequired)
                    {
                        writer.Write("<div class=\"requiredMarker\">*</div>");
                    }
                    if (SelectedSurvey.UseQuestionNumbering)
                    {
                        writer.Write(string.Format("{0}. ", question.DisplayOrder));
                    }

                    HttpUtility.HtmlEncode(question.QuestionText, writer);
                    if (!string.IsNullOrWhiteSpace(question.Description))
                    {
                        writer.AddAttribute(HtmlTextWriterAttribute.Class, "questionDescription");
                        writer.RenderBeginTag(HtmlTextWriterTag.P);
                        HttpUtility.HtmlEncode(question.Description, writer);
                        writer.RenderEndTag();
                    }

                    writer.RenderEndTag();//Div.questionHeader
                }
                {
                    writer.AddAttribute(HtmlTextWriterAttribute.Class, "questionHeaderTools");
                    writer.RenderBeginTag(HtmlTextWriterTag.Div);

                    DeleteQuestionButton(writer, question);
                    //MoveQuestionButton(writer, question);
                    LogicQuestionButton(writer, question);
                    EditQuestionButton(writer, question);

                    writer.RenderEndTag();//Div.questionHeaderTools
                }

                var renderer = HtmlRenderers.GetQuestionRenderer(SurveyManager, writer, null, question.QuestionType);
                renderer.RenderQuestion(SelectedSurvey, m_selectedSurveyPage, question);

                writer.RenderEndTag();//Div.questionBox
            }
            AddQuestionButtons(writer, null);


            return(_html.ToString());
        }