/**
  *	return user xmls for given user ids (csv separated ids) as xml based on usr dtd.
  *	@param string sid	session id
  *	@param string a_userids array of user ids, may be numeric or ilias ids
  *	@param boolean attachRoles	if true, role assignments will be attached, nothing will be done otherwise
  *	@return	string	xml string based on usr dtd
  */
 function getUserXML($sid, $a_user_ids, $attach_roles)
 {
     $this->initAuth($sid);
     $this->initIlias();
     if (!$this->__checkSession($sid)) {
         return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
     }
     global $rbacsystem, $ilUser, $ilDB;
     // check if own account
     $is_self = false;
     if (is_array($a_user_ids) and count($a_user_ids) == 1) {
         if (end($a_user_ids) == $ilUser->getId()) {
             $is_self = true;
         }
     } elseif (is_numeric($a_user_ids)) {
         if ($a_user_ids == $ilUser->getId()) {
             $is_self = true;
         }
     }
     if (!$rbacsystem->checkAccess('read', USER_FOLDER_ID) and !$is_self) {
         return $this->__raiseError('Check access failed.', 'Server');
     }
     // begin-patch filemanager
     $data = ilObjUser::_getUserData((array) $a_user_ids);
     // end-patch filemanager
     include_once './Services/User/classes/class.ilUserXMLWriter.php';
     $xmlWriter = new ilUserXMLWriter();
     $xmlWriter->setAttachRoles($attach_roles);
     $xmlWriter->setObjects($data);
     if ($xmlWriter->start()) {
         return $xmlWriter->getXML();
     }
     return $this->__raiseError('User does not exist', 'Client');
 }
Exemplo n.º 2
0
 function sendNotificationMail($user_id, $anonymize_id, $appr_id)
 {
     include_once "./Services/User/classes/class.ilObjUser.php";
     include_once "./Services/User/classes/class.ilUserUtil.php";
     $recipients = preg_split('/,/', $this->mailaddresses);
     foreach ($recipients as $recipient) {
         // #11298
         include_once "./Services/Notification/classes/class.ilSystemNotification.php";
         $ntf = new ilSystemNotification();
         $ntf->setLangModules(array("survey"));
         $ntf->setRefId($this->getRefId());
         $ntf->setSubjectLangId('finished_mail_subject');
         $messagetext = $this->mailparticipantdata;
         if (trim($messagetext)) {
             $data = ilObjUser::_getUserData(array($user_id));
             foreach ($data[0] as $key => $value) {
                 if ($this->getAnonymize()) {
                     $messagetext = str_replace('[' . $key . ']', '', $messagetext);
                 } else {
                     $messagetext = str_replace('[' . $key . ']', $value, $messagetext);
                 }
             }
             $ntf->setIntroductionDirect($messagetext);
         } else {
             $ntf->setIntroductionLangId('survey_notification_finished_introduction');
         }
         // 360°? add appraisee data
         if ($appr_id) {
             $ntf->addAdditionalInfo('survey_360_appraisee', ilUserUtil::getNamePresentation($appr_id));
         }
         $active_id = $this->getActiveID($user_id, $anonymize_id, $appr_id);
         $ntf->addAdditionalInfo('results', $this->getParticipantTextResults($active_id), true);
         $ntf->setGotoLangId('survey_notification_tutor_link');
         $ntf->setReasonLangId('survey_notification_finished_reason');
         $ntf->sendMail(array($recipient), null, null);
     }
 }
 function sendNotificationMail($user_id, $anonymize_id)
 {
     include_once "./Services/User/classes/class.ilObjUser.php";
     include_once "./Services/Mail/classes/class.ilMail.php";
     $mail = new ilMail(ANONYMOUS_USER_ID);
     $recipients = preg_split('/,/', $this->mailaddresses);
     foreach ($recipients as $recipient) {
         $messagetext = $this->mailparticipantdata;
         $data = ilObjUser::_getUserData(array($user_id));
         foreach ($data[0] as $key => $value) {
             if ($this->getAnonymize()) {
                 $messagetext = str_replace('[' . $key . ']', '', $messagetext);
             } else {
                 $messagetext = str_replace('[' . $key . ']', $value, $messagetext);
             }
         }
         $active_id = $this->getActiveID($user_id, $anonymize_id);
         $messagetext .= (strlen($messagetext) ? "\n\n\n" : '') . $this->lng->txt('results') . "\n\n" . $this->getParticipantTextResults($active_id);
         // #11298
         include_once "./Services/Link/classes/class.ilLink.php";
         $link = ilLink::_getStaticLink($this->getRefId(), "svy");
         $messagetext .= "\n\n" . $this->lng->txt('obj_svy') . ": " . $this->getTitle() . "\n";
         $messagetext .= "\n" . $this->lng->txt('survey_notification_tutor_link') . ": " . $link;
         $mail->appendInstallationSignature(true);
         $mail->sendMail($recipient, "", "", $this->lng->txt('finished_mail_subject') . ': ' . $this->getTitle(), $messagetext, array(), array('normal'));
     }
 }