public function __construct($userId, $testRefId) { parent::__construct(); $this->setRecipient($userId); $this->setRefId($testRefId); $this->initLanguage($this->getRecipient()); $this->getLanguage()->loadLanguageModule('assessment'); $this->initMail()->enableSoap(false); }
/** * * Send notifications * * @access public * */ public function send() { global $ilDB; parent::send(); if (count($this->getRecipients())) { $res = $ilDB->queryf("SELECT u.usr_id,u.gender,u.firstname,u.lastname,u.login,u.email,u.last_login,u.active," . "u.time_limit_unlimited, " . $ilDB->fromUnixtime("u.time_limit_from") . ", " . $ilDB->fromUnixtime("u.time_limit_until") . "," . "CASE WHEN u.active = 0 THEN '0001-01-01' ELSE CASE WHEN u.time_limit_unlimited=1 THEN '9999-12-31' ELSE " . $ilDB->fromUnixtime("u.time_limit_until") . " END END access_until," . " CASE WHEN " . $ilDB->unixTimestamp() . " BETWEEN u.time_limit_from AND u.time_limit_until THEN 0 ELSE 1 END expired," . "rq.role_disk_quota, system_role.rol_id role_id, " . "p1.value+0 user_disk_quota," . "p2.value+0 disk_usage, " . "p3.value last_update, " . "p5.value language, " . "CASE WHEN rq.role_disk_quota>p1.value+0 OR p1.value IS NULL THEN rq.role_disk_quota ELSE p1.value+0 END disk_quota\t" . "FROM usr_data u " . "JOIN (SELECT u.usr_id usr_id,MAX(rd.disk_quota) role_disk_quota " . "FROM usr_data u " . "JOIN rbac_ua ua ON ua.usr_id=u.usr_id " . "JOIN rbac_fa fa ON fa.rol_id=ua.rol_id AND fa.parent=%s " . "JOIN role_data rd ON rd.role_id=ua.rol_id WHERE u.usr_id=ua.usr_id GROUP BY u.usr_id) rq ON rq.usr_id=u.usr_id " . "LEFT JOIN rbac_ua system_role ON system_role.usr_id=u.usr_id AND system_role.rol_id = %s " . "LEFT JOIN usr_pref p1 ON p1.usr_id=u.usr_id AND p1.keyword = 'disk_quota' " . "LEFT JOIN usr_pref p2 ON p2.usr_id=u.usr_id AND p2.keyword = 'disk_usage' " . "LEFT JOIN usr_pref p3 ON p3.usr_id=u.usr_id AND p3.keyword = 'disk_usage.last_update' " . "LEFT JOIN usr_pref p5 ON p5.usr_id=u.usr_id AND p5.keyword = 'language' " . 'WHERE (((p1.value+0 > rq.role_disk_quota OR rq.role_disk_quota IS NULL) AND p2.value+0 > p1.value+0) OR ((rq.role_disk_quota > p1.value+0 OR p1.value IS NULL) AND p2.value+0 > rq.role_disk_quota)) ' . 'AND (u.active=1 AND (u.time_limit_unlimited = 1 OR ' . $ilDB->unixTimestamp() . ' BETWEEN u.time_limit_from AND u.time_limit_until)) ', array('integer', 'integer'), array(ROLE_FOLDER_ID, SYSTEM_ROLE_ID)); $users = array(); $counter = 0; while ($row = $ilDB->fetchAssoc($res)) { $details = ilDiskQuotaChecker::_lookupDiskUsage($row['usr_id']); $users[$counter]['disk_quota'] = $row['disk_quota']; $users[$counter]['disk_usage'] = $details['disk_usage']; $users[$counter]['email'] = $row['email']; $users[$counter]['firstname'] = $row['firstname']; $users[$counter]['lastname'] = $row['lastname']; ++$counter; } if (count($users)) { foreach ($this->getRecipients() as $rcp) { $usrId = ilObjUser::_lookupId($rcp); $this->initLanguage($usrId); $this->initMail(); $this->setSubject($this->getLanguage()->txt('disk_quota_summary_subject')); $this->setBody(ilMail::getSalutation($usrId, $this->getLanguage())); $this->appendBody("\n\n"); $this->appendBody($this->getLanguage()->txt('disk_quota_exceeded_headline')); $this->appendBody("\n\n"); $first = true; $counter = 0; $numUsers = count($users); foreach ($users as $user) { if (!$first) { $this->appendBody("\n---------------------------------------------------\n\n"); } $this->appendBody($this->getLanguage()->txt('fullname') . ': ' . $user['lastname'] . ', ' . $user['firstname'] . "\n"); $this->appendBody($this->getLanguage()->txt('email') . ': ' . $user['email'] . "\n"); $this->appendBody($this->getLanguage()->txt('disk_quota') . ': ' . ilFormat::formatSize($user['disk_quota'], 'short', $this->getLanguage()) . "\n"); $this->appendBody($this->getLanguage()->txt('currently_used_disk_space') . ': ' . ilFormat::formatSize($user['disk_usage'], 'short', $this->getLanguage()) . "\n"); $this->appendBody($this->getLanguage()->txt('usrf_profile_link') . ': ' . ilUtil::_getHttpPath() . '/goto.php?target=usrf&client_id=' . CLIENT_ID); if ($counter < $numUsers - 1) { $this->appendBody("\n"); } ++$counter; $first = false; } $this->getMail()->appendInstallationSignature(true); $this->sendMail(array($rcp), array('system'), false); } } } }
/** * * Constructor * * @access public * */ public function __construct() { $dqs = new ilSetting('disk_quota'); $rcpt = $dqs->get('summary_rcpt'); $rcpt = explode(',', $rcpt); $loginnames = array(); foreach ($rcpt as $loginname) { $loginname = trim($loginname); if (ilObjUser::_lookupId($loginname)) { $loginnames[] = $loginname; } } $this->setRecipients($loginnames); parent::__construct(); }
/** * Add language module crs * @param object $a_usr_id * @return */ protected function initLanguage($a_usr_id) { parent::initLanguage($a_usr_id); $this->getLanguage()->loadLanguageModule('crs'); }
/** * Send a update booking notification to the participants. * * @param string $a_user_id = userid of creator * @param array $a_participants_ids = userids of participants * */ public function sendUpdateBookingMailToParticipants(array $a_participants_ids) { foreach (array_unique($a_participants_ids) as $participant_id) { $this->composeUpdatingBookingMailForParticipant($participant_id); parent::sendMail(array($participant_id), array('system'), is_numeric($participant_id)); } }
/** * */ public function __construct() { parent::__construct(); }
/** * Send notification to single recipient * * @param mixed $a_rcp * @param string $a_goto_additional * @param string $a_permission * @return bool */ protected function composeAndSendMail($a_user_id, $a_goto_additional = null, $a_permission = "read") { if ($this->compose($a_user_id, $a_goto_additional, $a_permission)) { parent::sendMail(array($a_user_id), array('system'), is_numeric($a_user_id)); return true; } return false; }