コード例 #1
0
 function actionEvent(&$event)
 {
     require_once $GLOBALS['where_lms'] . '/lib/lib.subscribe.php';
     parent::actionEvent($event);
     $acl_man =& Docebo::user()->getACLManager();
     // recover event information
     $id_user = $event->getProperty('userdeleted');
     $man_subs = new CourseSubscribe_Management();
     $man_subs->unsubscribeUserFromAllCourses($id_user);
     return true;
 }
コード例 #2
0
 function actionEvent(&$event)
 {
     parent::actionEvent($event);
     $event_throw = $event->getClassName();
     switch ($event_throw) {
         case "SettingUpdate":
             $field_saved = explode(" - ", $event->getProperty('field_saved'));
             break;
     }
     return true;
 }
コード例 #3
0
 function actionEvent(&$event)
 {
     parent::actionEvent($event);
     $event_throw = $event->getClassName();
     switch ($event_throw) {
         case "UserDel":
             $id_user = $event->getProperty('userdeleted');
             // remove user from associated
             $acl_man =& Docebo::user()->getAclmanager();
             $acl_man->removeFromAllGroup($id_user);
             break;
     }
     return true;
 }
コード例 #4
0
 /**
  * Register a new consumer
  * @param string $consumer_class
  * @param string $consumer_file
  * @return int the id of the registered consumer, FALSE if error
  * @static
  * @access private
  **/
 function _registerConsumer($consumer_class, $consumer_file)
 {
     $consumer_id = DoceboEventConsumer::getConsumerId($consumer_class);
     if ($consumer_id !== FALSE) {
         return $consumer_id;
     } else {
         $query = "INSERT INTO " . $GLOBALS['prefix_fw'] . "_event_consumer" . " (consumer_class, consumer_file) VALUES " . " ('" . $consumer_class . "','" . $consumer_file . "')";
         $result = sql_query($query);
         if ($result) {
             return sql_insert_id();
         } else {
             return FALSE;
         }
     }
 }
コード例 #5
0
 function actionEvent(&$event)
 {
     parent::actionEvent($event);
     // initializing
     require_once _adm_ . '/lib/lib.field.php';
     $acl_man =& Docebo::user()->getACLManager();
     $field_man = new FieldList();
     $send_to_field = Get::sett('sms_cell_num_field');
     $arr_mail_recipients = array();
     $arr_sms_recipients = array();
     // recover event information
     $arr_recipients = explode(',', $event->getProperty('recipientid'));
     $msg_composer = unserialize(urldecode($event->getProperty('MessageComposer')));
     $msg_composer->after_unserialize();
     $force_email_send = $event->getProperty('force_email_send');
     if (!is_array($arr_recipients) || empty($arr_recipients)) {
         return;
     }
     // recover user info and convert to idst if required
     if (is_numeric($arr_recipients[0])) {
         $idst_users =& $arr_recipients;
     } else {
         $idst_users = $acl_man->fromUseridToIdst($arr_recipients);
     }
     $users_info =& $acl_man->getUsers($idst_users);
     // recove setting
     $users_lang = $acl_man->getSettingValueOfUsers('ui.language', false, true);
     $users_sms = $field_man->showFieldForUserArr($idst_users, array($send_to_field));
     // scan all users
     if (!is_array($users_info) || empty($users_info)) {
         return;
     }
     while (list(, $user_dett) = each($users_info)) {
         if ($user_dett[ACL_INFO_VALID] == '1') {
             // recover media setting
             $idst_user = $user_dett[ACL_INFO_IDST];
             $media = usernotifier_getUserEventChannel($idst_user, $event->getClassName());
             $lang = isset($users_lang[$idst_user]) && $users_lang[$idst_user] !== NULL ? $users_lang[$idst_user] : getDefaultLanguage();
             if (in_array('email', $media) || $force_email_send == 'true') {
                 if ($user_dett[ACL_INFO_EMAIL] != '') {
                     $arr_mail_recipients[$lang][$idst_user] = $user_dett[ACL_INFO_EMAIL];
                 }
             }
             if (in_array('sms', $media)) {
                 if ($users_sms[$idst_user][$send_to_field] != '') {
                     $arr_sms_recipients[$lang][$idst_user] = $users_sms[$idst_user][$send_to_field];
                 }
             }
         }
     }
     if (!empty($arr_mail_recipients)) {
         $lang_mail = array_keys($arr_mail_recipients);
         foreach ($lang_mail as $lang_code) {
             reset($arr_mail_recipients[$lang_code]);
             $this->_sendMail($msg_composer->getSubject('email', $lang_code), $msg_composer->getBody('email', $lang_code), $arr_mail_recipients[$lang_code], $users_info);
         }
     }
     if (!empty($arr_sms_recipients)) {
         $lang_sms = array_keys($arr_sms_recipients);
         foreach ($lang_sms as $lang_code) {
             reset($arr_sms_recipients[$lang_sms]);
             $this->_sendSms($msg_composer->getBody('sms', $lang_code), $arr_sms_recipients[$lang_code], $users_info);
         }
     }
     return true;
 }