Beispiel #1
0
        public String FolioDisplay(int courseId, int folioID)
        {
            Course c = getCourse();

            if (c == null)
            {
                return(null);
            }

            StringBuilder s = new StringBuilder();

            s.Append(c.FolioDisplay(folioID));

            return(s.ToString());
        }
    /// <summary>
    /// Shows the buttons to the user.
    /// </summary>
    public void CreateButtons()
    {
        /*Hide all the buttons*/
        hideButtons();
        //clean all the panels
        foreach (Transform child in infoParentPanel)
        {
            GameObject.Destroy(child.gameObject);
        }
        foreach (Transform child in folioParentPanel)
        {
            GameObject.Destroy(child.gameObject);
        }

        if (dm.everyThingDone)
        {
            switch (option)
            {
            case 1:     //menu inicial
                Debug.Log(efolios);
                InfoText.gameObject.SetActive(true);
                InfoBox.SetActive(true);
                InfoText.text = updates();
                SetAllTheMenuTrue();
                break;

            case 2:     //menu e-fólios
                Debug.Log(efolios);
                int fol = 0;
                table.SetActive(true);
                UserInfo.Course co = dm.getCourseById(wm.courseId);
                if (!co.checkGradeReport)
                {
                    foreach (UserInfo.Course.Folio f in lf)
                    {
                        if (ItExists("module-" + f.cmid))
                        {
                            GameObject response = (GameObject)Instantiate(newFolioPrefab);
                            response.transform.SetParent(folioParentPanel);
                            response.transform.SetSiblingIndex(folioParentPanel.childCount - 2);
                            string displayMessage = co.FolioDisplay(f.cmid);
                            string stateOfE       = co.FolioFeedback(f.cmid);
                            string feed           = "";
                            if (f.graderaw != -1)
                            {
                                feed = wm.GetFolioPhrase(stateOfE);
                            }
                            else
                            {
                                feed = "O link para o e-fólio que escolheu está agora destacado na página da UC.";
                            }
                            response.GetComponent <MessageFuntions>().ShowMessage(f.name, displayMessage);
                            response.GetComponent <MessageFuntions>().GetDataToShow(feed);
                            response.GetComponent <MessageFuntions>().AddFunctionToButton(7, "module-" + f.cmid);
                            string c = (f.seen > 0) ? "branco" : (f.seen == 0) ? "amarelo" : "vermelho";
                            if (c == "vermelho")
                            {
                                response.GetComponent <MessageFuntions>().itIsNotSeen();
                            }
                            else if (c == "amarelo")
                            {
                                response.GetComponent <MessageFuntions>().itIsANew();
                            }

                            fol++;
                        }
                    }
                }
                if (co.checkGradeReport || fol == 0)
                {
                    GameObject response = (GameObject)Instantiate(newFolioPrefab);
                    response.transform.SetParent(folioParentPanel);
                    response.transform.SetSiblingIndex(folioParentPanel.childCount - 2);
                    response.GetComponent <MessageFuntions>().ShowMessageM("Cartão de Aprendizagem");
                    response.GetComponent <MessageFuntions>().AddFunctionToButtonCA(7);
                }

                scb = scb1;
                itsDown();
                SetTheBackMenuTrue();
                break;

            case 3:     //menu documentos
                //Debug.Log(docs + " : " + tf.Count);
                table2.SetActive(true);
                foreach (UserInfo.Course.Topic t in tf)
                {
                    if (ItExists(t.name))
                    {
                        GameObject response = (GameObject)Instantiate(newInfoPrefab);
                        response.transform.SetParent(infoParentPanel);
                        response.transform.SetSiblingIndex(infoParentPanel.childCount - 2);
                        response.GetComponent <TopicFunctions>().ShowInfo(t.name);
                        response.GetComponent <TopicFunctions>().AddFunctionToButton(5, t.name);
                        //Debug.Log(name);
                        if (t.seen == -1)
                        {
                            response.GetComponent <TopicFunctions>().itIsNotSeen();
                        }
                        else if (t.seen == 0)
                        {
                            response.GetComponent <TopicFunctions>().itIsANew();
                        }
                    }
                }
                scb = scb2;
                itsDown();
                SetTheBackMenuTrue();
                break;

            case 4:     //menu fóruns
                //Debug.Log(foruns + " : " + fo.Count);
                table2.SetActive(true);
                foreach (UserInfo.Course.Forum f in fo)
                {
                    if (ItExists("module-" + f.cmid))
                    {
                        GameObject response = (GameObject)Instantiate(newInfoPrefab);
                        response.transform.SetParent(infoParentPanel);
                        response.transform.SetSiblingIndex(infoParentPanel.childCount - 2);
                        response.GetComponent <TopicFunctions>().ShowInfo(f.name);
                        response.GetComponent <TopicFunctions>().AddFunctionToButton(6, "module-" + f.cmid);
                        if (f.seen == -1)
                        {
                            response.GetComponent <TopicFunctions>().itIsNotSeen();
                        }
                        else if (f.seen == 0)
                        {
                            response.GetComponent <TopicFunctions>().itIsANew();
                        }
                    }
                }
                scb = scb2;
                itsDown();
                SetTheBackMenuTrue();
                break;

            case 5:     //mostrar conteúdos de documentos
                SetTheBackMenuTrue();
                break;

            case 6:     //mostrar conteúdos de fóruns
                SetTheBackMenuTrue();
                break;

            case 7:     //mostrar conteúdos de e-fólios
                SetTheBackMenuTrue();
                break;

            case 8:     //mostrar conteúdos de Q&A
                //SetTheBackMenuTrue();
                SetAskMenu();
                break;

            case 10:     //mostrar conteúdos de Actividades Formativas
                Debug.Log("activities " + mActivities.Count);
                table.SetActive(true);
                if (topicActivities.Count != 0 || foliosActivities.Count != 0 || forumActivities.Count != 0 || mActivities.Count != 0)
                {
                    //topics
                    if (topicActivities.Count != 0)
                    {
                        foreach (UserInfo.Course.Topic t in topicActivities)
                        {
                            GameObject response = (GameObject)Instantiate(newFolioPrefab);
                            response.transform.SetParent(folioParentPanel);
                            response.transform.SetSiblingIndex(folioParentPanel.childCount - 2);
                            response.GetComponent <MessageFuntions>().ShowMessage(" ---- " + t.name + " ---- ");
                        }
                    }
                    //folios
                    if (foliosActivities.Count != 0)
                    {
                        foreach (UserInfo.Course.Folio f in foliosActivities)
                        {
                            GameObject response = (GameObject)Instantiate(newFolioPrefab);
                            response.transform.SetParent(folioParentPanel);
                            response.transform.SetSiblingIndex(folioParentPanel.childCount - 2);
                            response.GetComponent <MessageFuntions>().ShowMessageM(f.name);
                            response.GetComponent <MessageFuntions>().AddFunctionToButton2(14, "module-" + f.cmid);
                        }
                    }
                    //foruns
                    if (forumActivities.Count != 0)
                    {
                        foreach (UserInfo.Course.Forum f in forumActivities)
                        {
                            GameObject response = (GameObject)Instantiate(newFolioPrefab);
                            response.transform.SetParent(folioParentPanel);
                            response.transform.SetSiblingIndex(folioParentPanel.childCount - 2);
                            response.GetComponent <MessageFuntions>().ShowMessageM(f.name);
                            response.GetComponent <MessageFuntions>().AddFunctionToButton2(14, "module-" + f.cmid);
                        }
                    }
                    //modules
                    if (mActivities.Count != 0)
                    {
                        foreach (UserInfo.Course.modules f in mActivities)
                        {
                            GameObject response = (GameObject)Instantiate(newFolioPrefab);
                            response.transform.SetParent(folioParentPanel);
                            response.transform.SetSiblingIndex(folioParentPanel.childCount - 2);
                            response.GetComponent <MessageFuntions>().ShowMessageM(f.name);
                            response.GetComponent <MessageFuntions>().AddFunctionToButton2(14, f.name);
                        }
                    }
                }
                else
                {
                    GameObject response = (GameObject)Instantiate(newFolioPrefab);
                    response.transform.SetParent(folioParentPanel);
                    response.transform.SetSiblingIndex(folioParentPanel.childCount - 2);
                    response.GetComponent <MessageFuntions>().ShowMessage("Não existem Actividades.");
                }
                scb = scb1;
                itsDown();
                SetTheBackMenuTrue();
                break;

            case 11:

                break;

            case 12:
                Debug.Log("Default");
                SetAllTheMenuTrue();
                break;

            case 13:
                SetTheBackMenuTrue();
                break;

            case 14:
                SetTheBackMenuTrue();
                break;

            default:
                Debug.Log("Default");
                SetAllTheMenuTrue();
                break;
            }
        }
        else
        {
            Debug.Log("User não pronto para leitura");
        }
    }