Public Member Functions

ilCronCheckUserAccounts Class Reference

Public Member Functions

 ilCronCheckUserAccounts ()
 check ()
 txt ($language, $key, $module= 'common')

Detailed Description

Definition at line 34 of file class.ilCronCheckUserAccounts.php.


Member Function Documentation

ilCronCheckUserAccounts::check (  ) 

Definition at line 44 of file class.ilCronCheckUserAccounts.php.

References $data, $query, $res, $row, and txt().

        {
                $two_weeks_in_seconds = 60 * 60 * 24 * 14;

                $this->log->write('Cron: Start ilCronCheckUserAccounts::check()');

                $query = "SELECT * FROM usr_data,usr_pref ".
                        "WHERE time_limit_message = '0' ".
                        "AND time_limit_unlimited = '0' ".
                        "AND time_limit_from < '".time()."' ".
                        "AND time_limit_until > '".$two_weeks_in_seconds."' ".
                        "AND usr_data.usr_id = usr_pref.usr_id ".
                        "AND keyword = 'language'";

                $res = $this->db->query($query);

                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        include_once './classes/class.ilMimeMail.php';

                        $data['expires'] = $row->time_limit_until;
                        $data['email'] = $row->email;
                        $data['login'] = $row->login;
                        $data['usr_id'] = $row->usr_id;
                        $data['language'] = $row->value;
                        $data['owner'] = $row->time_limit_owner;

                        // Send mail
                        $mail =& new ilMimeMail();
                        
                        $mail->From('noreply');
                        $mail->To($data['email']);
                        $mail->Subject($this->txt($data['language'],'account_expires_subject'));
                        $mail->Body($this->txt($data['language'],'account_expires_body')." ".strftime('%Y-%m-%d %R',$data['expires']));
                        $mail->send();

                        // set status 'mail sent'
                        $query = "UPDATE usr_data SET time_limit_message = '1' WHERE usr_id = '".$data['usr_id']."'";
                        $this->db->query($query);
                        
                        // Send log message
                        $this->log->write('Cron: (checkUserAccounts()) sent message to '.$data['login'].'.');


                }

                $this->log->write('Cron: End ilCronCheckUserAccounts::check()');
        }

Here is the call graph for this function:

ilCronCheckUserAccounts::ilCronCheckUserAccounts (  ) 

Definition at line 36 of file class.ilCronCheckUserAccounts.php.

References $ilLog.

        {
                global $ilLog,$ilDB;

                $this->log =& $ilLog;
                $this->db =& $ilDB;
        }

ilCronCheckUserAccounts::txt ( language,
key,
module = 'common' 
)

Definition at line 92 of file class.ilCronCheckUserAccounts.php.

References $key, $query, $res, and $row.

Referenced by check().

        {
                $query = "SELECT value FROM lng_data ".
                        "WHERE module = '".$module."' ".
                        "AND identifier = '".$key."' ".
                        "AND lang_key = '".$language."'";

                $res = $this->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $value = $row->value;
                }
                return $value ? $value : $key;
        }

Here is the caller graph for this function:


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