コード例 #1
0
 public function courseSelectionInfo($id_course)
 {
     $query = "SELECT course_type, selling" . " FROM %lms_course" . " WHERE idCourse = " . (int) $id_course;
     list($type, $selling) = sql_fetch_row(sql_query($query));
     $res['success'] = true;
     $res['title'] = Lang::t('_EDITION_LIST', 'catalogue');
     $res['body'] = '';
     $login_link = '<a href="index.php">' . Lang::t('_LOG_IN', 'login') . '</a>';
     $signin_link = '<a href="index.php?modname=login&op=register">' . Lang::t('_SIGN_IN', 'login') . '</a>';
     require_once _lib_ . '/lib.usermanager.php';
     $option = new UserManagerOption();
     $register_type = $option->getOption('register_type');
     $action = '<p class="can_subscribe">' . str_replace(array('[login]', '[signin]'), array($login_link, $signin_link), $register_type === 'self' || $register_type === 'self_optin' || $register_type === 'moderate' ? Lang::t('_REGISTER_FOR_COURSE', 'login') : Lang::t('_REGISTER_FOR_COURSE_NO_REG', 'login')) . '</p>';
     if ($type === 'classroom') {
         $classrooms = $this->classroom_man->getCourseDate($id_course, false);
         foreach ($classrooms as $classroom_info) {
             $res['body'] .= '<div class="edition_container">' . Lang::t('_NAME', 'catalogue') . ': ' . $classroom_info['name'] . '<br/>' . ($classroom_info['code'] !== '' ? Lang::t('_CODE', 'catalogue') . ': ' . $classroom_info['code'] . '<br/>' : '') . ($classroom_info['date_begin'] !== '0000-00-00' ? Lang::t('_DATE_BEGIN', 'course') . ': ' . Format::date($classroom_info['date_begin'], 'date') . '<br/>' : '') . ($classroom_info['date_end'] !== '0000-00-00' ? Lang::t('_DATE_END', 'course') . ': ' . Format::date($classroom_info['date_end'], 'date') . '<br/>' : '') . ($selling == 1 ? Lang::t('_PRICE') . ' : ' . $classroom_info['price'] . ' ' . Get::sett('currency_symbol', '&euro;') : '') . '<div class="edition_subscribe">' . '</div>' . '</div>';
         }
         $res['footer'] = '<a href="javascript:;" onclick="hideDialog();"><p class="close_dialog">' . Lang::t('_UNDO', 'catalogue') . '</p></a>';
     } else {
         $editions = $this->edition_man->getEditionAvailableWithInfo(Docebo::user()->getIdSt(), $id_course);
         foreach ($editions as $edition_info) {
             $res['body'] .= '<div class="edition_container">' . Lang::t('_NAME', 'catalogue') . ': ' . $edition_info['name'] . '<br/>' . ($edition_info['code'] !== '' ? Lang::t('_CODE', 'catalogue') . ': ' . $edition_info['code'] . '<br/>' : '') . ($edition_info['date_begin'] !== '0000-00-00' ? Lang::t('_DATE_BEGIN', 'course') . ': ' . Format::date($edition_info['date_begin'], 'date') . '<br/>' : '') . ($edition_info['date_end'] !== '0000-00-00' ? Lang::t('_DATE_END', 'course') . ': ' . Format::date($edition_info['date_end'], 'date') . '<br/>' : '') . ($selling == 1 ? Lang::t('_PRICE') . ' : ' . $edition_info['price'] . ' ' . Get::sett('currency_symbol', '&euro;') : '') . '<div class="edition_subscribe">' . '</div>' . '</div>';
         }
         $res['footer'] = '<div class="edition_cancel"><a href="javascript:;" onclick="hideDialog();"><span class="close_dialog">' . Lang::t('_CLOSE', 'catalogue') . '</span></a></div>';
     }
     $res['body'] .= '<br/><br/>' . $action;
     return $res;
 }
コード例 #2
0
 /**
  * return html about the lost password and user action and send email
  *
  * @return string	html
  */
 function performLostpwdAction($mail_url)
 {
     $lang = DoceboLanguage::createInstance('register');
     //lost userid
     if ($this->_render->haveToLostuserAction()) {
         $mail = $this->_render->getLostUserParam();
         if (eregi("\r", $mail) || eregi("\n", $mail)) {
             die("This isn't a good email address !");
         }
         $acl_man =& Docebo::user()->getAclManager();
         $user_info = $acl_man->getUserByEmail($mail);
         if ($user_info !== false) {
             //compose e-mail --------------------------------------------
             $mail_sender = $this->_option->getOption('mail_sender');
             /*$from = "From: ".$mail_sender.$GLOBALS['mail_br'];
             				$intestazione  = "MIME-Version: 1.0".$GLOBALS['mail_br'];
             				$intestazione .= "Content-type: text/html; charset=".getUnicode().$GLOBALS['mail_br'];
             
             				$intestazione .= "Return-Path: ".$mail_sender.$GLOBALS['mail_br'];
             				$intestazione .= "Reply-To: ".$mail_sender.$GLOBALS['mail_br'];
             				$intestazione .= "X-Sender: ".$mail_sender.$GLOBALS['mail_br'];
             				$intestazione .= "X-Mailer: PHP/". phpversion().$GLOBALS['mail_br'];*/
             $mail_text = $lang->def('_LOST_USERID_MAILTEXT');
             $mail_text = str_replace('[date_request]', date("d-m-Y"), $mail_text);
             $mail_text = str_replace('[url]', Get::sett('url', ''), $mail_text);
             $mail_text = str_replace('[userid]', $acl_man->relativeId($user_info[ACL_INFO_USERID]), $mail_text);
             //if(!@mail($user_info[ACL_INFO_EMAIL], $lang->def('_LOST_USERID_TITLE'), $mail_text, $from.$intestazione)) {
             require_once _base_ . '/lib/lib.mailer.php';
             $mailer = DoceboMailer::getInstance();
             $success = $mailer->SendMail($mail_sender, $user_info[ACL_INFO_EMAIL], $lang->def('_LOST_USERID_TITLE'), $mail_text, false, array(MAIL_SENDER_ACLNAME => false));
             if (!$success) {
                 return $lang->def('_OPERATION_FAILURE') . '<br/>';
             } else {
                 return $lang->def('_MAIL_SEND_SUCCESSFUL') . '<br/>';
             }
         } else {
             return $lang->def('_INEXISTENT_USER') . '<br/>';
         }
     }
     //lost pwd
     if ($this->_render->haveToLostpwdAction()) {
         $userid = $this->_render->getLostPwdParam();
         $acl_man =& Docebo::user()->getAclManager();
         $user_info = $acl_man->getUser(false, $acl_man->absoluteId($userid));
         if ($user_info !== false) {
             //compose e-mail --------------------------------------------
             $mail_sender = $this->_option->getOption('mail_sender');
             /*$from = "From: ".$mail_sender.$GLOBALS['mail_br'];
             				$intestazione  = "MIME-Version: 1.0".$GLOBALS['mail_br'];
             				$intestazione .= "Content-type: text/html; charset=".getUnicode().$GLOBALS['mail_br'];
             
             				$intestazione .= "Return-Path: ".$mail_sender.$GLOBALS['mail_br'];
             				$intestazione .= "Reply-To: ".$mail_sender.$GLOBALS['mail_br'];
             				$intestazione .= "X-Sender: ".$mail_sender.$GLOBALS['mail_br'];
             				$intestazione .= "X-Mailer: PHP/". phpversion().$GLOBALS['mail_br'];*/
             $code = md5(mt_rand() . mt_rand());
             $exist_code = $this->getPwdRandomCode($user_info[ACL_INFO_IDST]);
             if ($exist_code === false) {
                 if (!$this->insertPwdRandomCode($user_info[ACL_INFO_IDST], $code)) {
                     return $lang->def('_OPERATION_FAILURE');
                 }
             } else {
                 if (!$this->savePwdRandomCode($user_info[ACL_INFO_IDST], $code)) {
                     return $lang->def('_OPERATION_FAILURE');
                 }
             }
             $link = Get::sett('url', '') . $mail_url . '&amp;pwd=retrpwd&amp;code=' . $code;
             $mail_text = str_replace('[link]', $link, $lang->def('_LOST_PWD_MAILTEXT'));
             require_once _base_ . '/lib/lib.mailer.php';
             $mailer = DoceboMailer::getInstance();
             $success = $mailer->SendMail($mail_sender, $user_info[ACL_INFO_EMAIL], $lang->def('_LOST_PWD_TITLE'), $mail_text, false, array(MAIL_SENDER_ACLNAME => false));
             if (!$success) {
                 return $lang->def('_OPERATION_FAILURE') . '<br/>';
             } else {
                 return $lang->def('_MAIL_SEND_SUCCESSFUL_PWD') . '<br/>';
             }
         } else {
             return $lang->def('_INEXISTENT_USER') . '<br/>';
         }
     }
 }