Public Member Functions | Data Fields

ilUserAgreement Class Reference

Public Member Functions

 ilUserAgreement ()
 Constructor public.
 _getText ()
 get user agreement text (static)

Data Fields

 $ilias

Detailed Description

Definition at line 33 of file class.ilUserAgreement.php.


Member Function Documentation

ilUserAgreement::_getText (  ) 

get user agreement text (static)

public

Definition at line 59 of file class.ilUserAgreement.php.

References $ilias, $ilLog, $key, $lng, and ilUtil::getWebspaceDir().

Referenced by ilRegistrationGUI::displayForm(), and ilStartUpGUI::showUserAgreement().

        {
                global $lng, $ilias, $ilLog;
        
                $tmpPath = getcwd();
                $tmpsave = getcwd();
                
                // 1st try: client specific / user language agreement
                $client_dir = ilUtil::getWebspaceDir()."/agreement/";
                $agreement = $client_dir."agreement_".$lng->lang_key.".html";
        
                // 2nd try: client specific / default language
                if (!file_exists($agreement))
                {
                        $agreement = $client_dir."agreement_".$lng->lang_default.".html";
                }
        
                // 3rd try: client specific / english
                if (!file_exists($agreement))
                {
                        $agreement = $client_dir."agreement_en.html";
                }
                
                // 4th try: global / user language
                if (!file_exists($agreement))
                {
                        $agrPath = $tmpPath."/agreement";
                        chdir($agrPath);
                        $agreement = "agreement_".$lng->lang_key.".html";
                }
        
                // 5th try: global / default language
                if (!file_exists($agreement))
                {
                        $ilLog->write("view_usr_agreement.php: Agreement file ".$agreement." has not been found (user language).");
                        $agreement = "agreement_".$lng->lang_default.".html";
                }
        
                // last try: global / english
                if (!file_exists($agreement))
                {
                        $ilLog->write("view_usr_agreement.php: Agreement file ".$agreement." has not been found (system language).");
                        $agreement = "agreement_en.html";
                }
                
                if (file_exists($agreement))
                {
                        if ($content = file($agreement))
                        {
                                foreach ($content as $key => $val)
                                {
                                        $text .= trim(nl2br($val));
                                }
                                chdir($tmpsave);
                                return $text;
                        }
                        else
                        {
                                $ilias->raiseError($lng->txt("usr_agreement_empty"),$ilias->error_obj->MESSAGE);
                        }
                }
                else
                {
                        $ilias->raiseError($lng->txt("file_not_found").": ".$agreement,
                                $ilias->error_obj->MESSAGE);
                }
        
                chdir($tmpsave);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilUserAgreement::ilUserAgreement (  ) 

Constructor public.

Definition at line 47 of file class.ilUserAgreement.php.

References $ilias.

        {
                global $ilias;

                $this->ilias = &$ilias;
        }


Field Documentation

ilUserAgreement::$ilias

Definition at line 40 of file class.ilUserAgreement.php.

Referenced by _getText(), and ilUserAgreement().


The documentation for this class was generated from the following file: