Example #1
0
function reservationSendMail()
{
    checkPerm('view');
    $lang =& DoceboLanguage::createInstance('reservation');
    $mod_perm = checkPerm('mod', true);
    $id_course = $_SESSION['idCourse'];
    $id_event = importVar('id_event', true, 0);
    $out = $GLOBALS['page'];
    $out->setWorkingZone('content');
    $man_res = new Man_Reservation();
    $acl_man =& Docebo::user()->getAclManager();
    if (isset($_POST['send_mail'])) {
        $recipients = $man_res->getEventUserMail($id_event);
        $subject = importVar('mail_object', false, '[Nessun Oggetto]');
        $body = importVar('mail_body', false, '');
        $info_user = $acl_man->getUser(getLogUserId());
        $sender = $info_user[ACL_INFO_EMAIL];
        //sendMail($recipients, $subject, $body, $sender);
        require_once _base_ . '/lib/lib.mailer.php';
        $mailer = DoceboMailer::getInstance();
        $mailer->SendMail($sender, $recipients, Lang::t('_MAIL_OBJECT', 'register'), $body, array(MAIL_REPLYTO => $sender, MAIL_SENDER_ACLNAME => false));
        Util::jump_to('index.php?modname=reservation&op=reservation&active_tab=events');
    } else {
        require_once _base_ . '/lib/lib.form.php';
        $out->add(getTitleArea($lang->def('_RESERVATION_MAIL_SEND') . '<div class="std_block">', 'content'));
        $out->add(Form::openForm('form_event', 'index.php?modname=reservation&amp;op=send_mail') . Form::openElementSpace() . Form::getTextfield($lang->def('_SUBJECT'), 'mail_object', 'mail_object', 255) . Form::getTextarea($lang->def('_MAIL_BODY'), 'mail_body', 'mail_body') . Form::getHidden('id_event', 'id_event', $id_event) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('send_mail', 'send_mail', $lang->def('_SEND_MAIL')) . Form::getButton('undo_mail', 'undo_mail', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>');
    }
}
 /**
  * this function manage the entire profile, identify the action to perform and do the right sequence of action
  * @return string the html to display
  */
 function performAction($viewer = false, $start_action = false)
 {
     $this->setViewer($viewer);
     if ($start_action === false) {
         $start_action = 'profileview';
     }
     $ap = Get::req($this->_varname_action, DOTY_MIXED, $start_action);
     if (isset($_POST['undo'])) {
         $ap = 'profileview';
     }
     switch ($ap) {
         case "goprofile":
             $ext_prof = new UserProfile(Get::req('id_user', DOTY_INT, 0), false);
             $ext_prof->init($this->_module_name, $this->_platform, $this->_std_query, $this->_varname_action);
             return $ext_prof->getProfile();
             break;
             // display the mod info gui -------------------------------
         // display the mod info gui -------------------------------
         case "mod_profile":
             return $this->getModUser();
             break;
         case "mod_password":
             return $this->_up_viewer->getUserPwdModUi();
             break;
         case "mod_policy":
             return $this->_up_viewer->modUserPolicyGui();
             break;
             // save modified info of the user -------------------------
         // save modified info of the user -------------------------
         case "save_policy":
             if ($this->_up_data_man->setFieldAccessList($this->_id_user, $this->_up_viewer->getFilledPolicy())) {
                 // all ok --------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPOLICY')) . $this->getProfile();
             } else {
                 // some error saving ---------------------------
                 return getErrorUi($this->_lang->def('_FAILSAVEPOLICY')) . $this->_up_viewer->modUserPolicyGui();
             }
             break;
             // save modified info of the user -------------------------
         // save modified info of the user -------------------------
         case "saveinfo":
             if (!$this->checkUserInfo()) {
                 // some error in data filling ------------------
                 return getErrorUi($this->_last_error) . $this->getModUser();
             }
             if ($this->saveUserInfo()) {
                 // all ok --------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 if (isset($_GET['modname']) && $_GET['modname'] == 'reservation') {
                     require_once $GLOBALS['where_lms'] . '/lib/lib.reservation.php';
                     $id_event = Get::req('id_event', DOTY_INT, 0);
                     $man_res = new Man_Reservation();
                     $result = $man_res->addSubscription(getLogUserId(), $id_event);
                     Util::jump_to('index.php?modname=reservation&op=reservation');
                 } else {
                     return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPROFILE')) . $this->getProfile();
                 }
             } else {
                 // some error saving ---------------------------
                 return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->getModUser();
             }
             break;
             // save password -----------------------------------------
         // save password -----------------------------------------
         case "savepwd":
             $re = $this->_up_viewer->checkUserPwd();
             if ($re !== true) {
                 // some error in data filling --------------------
                 return getErrorUi($re) . $this->_up_viewer->getUserPwdModUi();
             }
             if ($this->saveUserPwd()) {
                 // all ok ----------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 $out = getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPWD'));
                 if (Get::sett('profile_only_pwd') == 'on') {
                     // maybe is better if we display only the confirmation message if all is ok, but if you
                     // want something else add the code here
                 } else {
                     $out .= $this->getProfile();
                 }
                 return $out;
             } else {
                 // some error saving ----------------------------
                 return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->_up_viewer->getUserPwdModUi();
             }
             break;
         case "uploadavatar":
             return $this->_up_viewer->modAvatarGui();
             break;
         case "saveavatar":
             if ($this->saveUserAvatar()) {
                 // all ok --------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULAVATAR')) . $this->getProfile();
             } else {
                 // some error saving ---------------------------
                 return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->_up_viewer->modAvatarGui();
             }
             break;
             // teacher curriculum
         // teacher curriculum
         case "del_teach_curric":
             return $this->_up_viewer->delTeacherCurriculumGui();
             break;
         case "mod_teach_curric":
             return $this->_up_viewer->modTeacherCurriculumGui();
             break;
         case "save_teach_curric":
             if ($this->_up_data_man->saveTeacherCurriculumAndPublication($this->_id_user, $this->_up_viewer->getFilledCurriculum(), false)) {
                 // all ok --------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULCURRICULUM')) . $this->getProfile();
             } else {
                 // some error saving ---------------------------
                 return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->_up_viewer->modTeacherCurriculumGui();
             }
             break;
         case "mod_teach_publ":
             return $this->_up_viewer->modTeacherPublicationsGui();
             break;
         case "save_teach_publ":
             if ($this->_up_data_man->saveTeacherCurriculumAndPublication($this->_id_user, false, $this->_up_viewer->getFilledPublications())) {
                 // all ok --------------------------------------
                 $this->_up_viewer->unloadUserData();
                 if ($this->_end_url !== false) {
                     Util::jump_to($this->_end_url);
                 }
                 return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPUBLICATIONS')) . $this->getProfile();
             } else {
                 // some error saving ---------------------------
                 return getErrorUi($this->_lang->def('_FAILSAVEPUBLICATIONS')) . $this->_up_viewer->modTeacherPublicationsGui();
             }
             break;
             // display the profile ------------------------------------
         // display the profile ------------------------------------
         case "view_files":
             $this->_id_user = Get::req('id_user', DOTY_INT, getLogUserId());
             return $this->_up_viewer->getViewUserFiles();
             break;
         case "file_details":
             $this->_id_user = Get::req('id_user', DOTY_INT, getLogUserId());
             return $this->_up_viewer->getViewUserFileDetail();
             break;
         case "profileview":
         default:
             return $this->getProfile();
             break;
     }
 }
Example #3
0
 function delRegistration()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.form.php';
     $id_event = importVar('id_event', true, 0);
     $id_user = importVar('id_user', true, 0);
     $lang =& DoceboLanguage::createInstance('reservation');
     $out = $GLOBALS['page'];
     $out->setWorkingZone('content');
     $man_res = new Man_Reservation();
     if (Get::req('confirm', DOTY_INT, 0) == 1) {
         $confirm = importVar('confirm', true, 0);
         if ($confirm) {
             $result = $man_res->delSubscription($id_user, $id_event);
         }
         if ($result) {
             Util::jump_to('index.php?modname=reservation&op=view_user_event&id_event=' . $id_event);
         }
         Util::jump_to('index.php?modname=reservation&op=view_user_event&id_event=' . $id_event . '&amp;error=del_registration');
     }
     $GLOBALS['page']->add(getTitleArea($lang->def('_DEL_SUBSCRIPTION_TITLE'), '', $lang->def('_EVENT')) . '<div class="std_block">' . getDeleteUi($lang->def('_AREYOUSURE_DEL_SUBSCRIPTION'), $lang->def('_DEL_SUBSCRIPTION_INFO'), true, 'index.php?modname=reservation&amp;op=del_registration&amp;id_event=' . $id_event . '&amp;id_user='******'&amp;confirm=1', 'index.php?modname=reservation&amp;op=view_user_event&id_event=' . $id_event) . '</div>', 'content');
 }