예제 #1
0
 public function show()
 {
     $new = true;
     $total_price = $this->model->getTotalPrice();
     $id_trans = Get::req('id_transaction', DOTY_INT, 0);
     $cart_id = Get::gReq('cart', DOTY_MIXED, 0);
     require_once _lms_ . '/admin/models/TransactionAlms.php';
     $trman = new TransactionAlms();
     if (!empty($_GET['cancel'])) {
         $new = false;
     }
     if (!$new && !$this->checkCartTransaction($id_trans, $cart_id)) {
         UIFeedback::error(Lang::t('_INVALID_TRANSACTION', 'cart'));
     } else {
         if (isset($_GET['cancel']) && $_GET['cancel'] == 1) {
             $trman->deleteTransaction($id_trans, true);
             UIFeedback::error(Lang::t('_TRANSACTION_ABORTED', 'cart'));
         } else {
             if (isset($_GET['ok']) && $_GET['ok'] == 1) {
                 UIFeedback::info(Lang::t('_COURSE_ACTIVATION_SUCCESS', 'cart'));
             }
         }
     }
     if (isset($_GET['error']) && $_GET['error'] == 1) {
         $new = false;
         UIFeedback::error(Lang::t('_TRANSACTION_CREATION_ERROR', 'cart'));
     }
     if ($new) {
         $_SESSION['cart_id'] = time() . substr(uniqid('cart'), 0, 20);
     }
     $this->render('show', array('total_price' => $total_price, 'paypal_url' => $this->getPaypalUrl()));
 }
예제 #2
0
 public static function checkStep()
 {
     $ajax_validate = Get::gReq('ajax_validate', DOTY_INT, 0);
     $form_submit = Get::pReq('submit_form', DOTY_INT, 0);
     if ($ajax_validate) {
         $current_step = Get::pReq('step', DOTY_INT, 0);
         $sc = self::loadStepController($current_step);
         $sc->ajax_validate();
         die;
     }
     if ($form_submit == 1) {
         self::goToNextStep();
     }
     self::checkFirstStep();
 }
예제 #3
0
 public function getGoogleUserInfo()
 {
     $res = array();
     $res['email'] = Get::gReq('openid_ext1_value_contact_email', DOTY_STRING);
     $res['firstname'] = Get::gReq('openid_ext1_value_namePerson_first', DOTY_STRING);
     $res['lastname'] = Get::gReq('openid_ext1_value_namePerson_last', DOTY_STRING);
     return $res;
 }
예제 #4
0
function socialConnectLogin($uid = false, $network_code = false)
{
    require_once _base_ . '/lib/lib.usermanager.php';
    $res = '';
    $lang = DoceboLanguage::createInstance('login');
    $user_manager = new UserManager();
    if (!empty($uid) && !empty($network_code)) {
        session_regenerate_id();
        $_SESSION['connect_social']['uid'] = $uid;
        $_SESSION['connect_social']['network_code'] = $network_code;
    }
    $can_connect = false;
    if (isset($_SESSION['connect_social']) && isset($_SESSION['connect_social']['uid']) && !empty($_SESSION['connect_social']['uid'])) {
        // read data from session, in case we are on the second step (login attempt)
        $uid = $_SESSION['connect_social']['uid'];
        $network_code = $_SESSION['connect_social']['network_code'];
        $can_connect = true;
    }
    // check form submission:
    if (isset($_POST['undo'])) {
        // go back to index
        Util::jump_to('index.php');
    } else {
        if (isset($_POST['login']) && !$can_connect) {
            // we don't have the social uid to be connected with user account..
            Util::jump_to('index.php?modname=login&op=social_connect_login&err=2');
        } else {
            if (isset($_POST['login'])) {
                // login and connect account
                $user = DoceboUser::createDoceboUserFromLogin(Get::pReq('login_userid', DOTY_STRING), Get::pReq('login_pwd', DOTY_STRING), 'public_area');
                if ($user) {
                    DoceboUser::setupUser($user);
                    $social = new Social();
                    $social->connectAccount($network_code, $uid);
                    unset($_SESSION['connect_social']);
                    Util::jump_to('index.php?r=lms/elearning/show');
                } else {
                    Util::jump_to('index.php?modname=login&op=social_connect_login&err=1');
                }
            }
        }
    }
    switch (Get::gReq('err', DOTY_INT, 0)) {
        case 1:
            $res .= UIFeedback::error(Lang::t('_NOACCESS', 'login'), true);
            break;
        case 2:
            $res .= UIFeedback::error(Lang::t('_NO_SOCIAL_ACCOUNT_TO_CONNECT', 'login') . '&nbsp;<a href="index.php">' . Lang::t('_TRY_AGAIN', 'login') . '</a>', true);
            break;
    }
    $GLOBALS['page']->add(getTitleArea($lang->def('_LOGIN'), 'login') . '<div class="std_block">' . getBackUi('index.php', $lang->def('_BACK')), 'content');
    if ($can_connect) {
        $res .= Get::img('social/' . $network_code . '-24.png') . '&nbsp;';
        $res .= str_replace('[network_code]', Lang::t($network_code, 'social'), Lang::t('_YOU_ARE_CONNECTING_SOCIAL_ACCOUNT', 'social')) . " <b>" . $uid . "</b>";
    }
    $res .= Form::openForm('scl_form', 'index.php?modname=login&amp;op=social_connect_login') . Form::openElementSpace() . Form::getTextfield(Lang::t('_USERNAME', 'login'), 'login_userid', 'login_userid', 255) . Form::getPassword(Lang::t('_PASSWORD', 'login'), 'login_pwd', 'login_pwd', 255) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('login', 'login', Lang::t('_LOGIN', 'login')) . Form::getButton('undo', 'undo', Lang::t('_UNDO', 'login')) . Form::closeButtonSpace() . Form::closeForm();
    $GLOBALS['page']->add($res, 'content');
    // std_block
    $GLOBALS['page']->add('</div>', 'content');
    // std_block
}
 function downloadDemoMaterialTask()
 {
     require_once _base_ . '/lib/lib.download.php';
     $id = Get::gReq('course_id', DOTY_INT);
     $db = DbConn::getInstance();
     $qtxt = "SELECT course_demo FROM %lms_course WHERE idCourse=" . $id;
     $q = $db->query($qtxt);
     list($fname) = $db->fetch_row($q);
     if (!empty($fname)) {
         sendFile('/appLms/course/', $fname);
     } else {
         echo "nothing found";
     }
     die;
 }
예제 #6
0
<?php

include 'bootstrap.php';
require '../config.php';
$db = mysql_connect($cfg['db_host'], $cfg['db_user'], $cfg['db_pass']);
mysql_select_db($cfg['db_name']);
mysql_query("SET NAMES 'utf8'");
mysql_query("SET CHARACTER SET 'utf8'");
$enabled_step = 4;
$current_step = Get::gReq('cur_step', DOTY_INT);
$upg_step = Get::gReq('upg_step', DOTY_INT);
if ($_SESSION['start_version'] < 3000 || $_SESSION['start_version'] >= 4000) {
    echo 'error: version (' . $_SESSION['start_version'] . ') not supported for upgrade: too new (v4)';
    die;
}
if ($current_step != $enabled_step) {
    echo 'error: procedure must be called from upgrade step ' . $enabled_step . ' only!!';
    die;
}
switch ($upg_step) {
    case "1":
        // --- Upgrade db structure --------------------------------------
        $fn = _upgrader_ . '/data/sql/pre_upgrade.sql';
        importSqlFile($fn);
        break;
    case "2":
        // --- Upgrade learning_module content ---------------------------
        updateLearningModule();
        break;
    case "3":
        // --- Upgrade some db data --------------------------------------
예제 #7
0
function delfbkrule()
{
    checkPerm('view', false, 'storage');
    $res = '';
    require_once _lms_ . '/lib/lib.questcategory.php';
    require_once _lms_ . '/lib/lib.assessment_rule.php';
    $rule_id = Get::gReq('item_id', DOTY_INT, 0);
    $id_test = Get::gReq('idTest', DOTY_INT, 0);
    $back_url = urldecode(Get::gReq('back_url', DOTY_STRING));
    $url_encode = htmlentities(urlencode($back_url));
    $url_base = 'index.php?modname=test&idTest=' . $id_test . '&back_url=' . $url_encode . '&op=';
    $asrule = new AssessmentRuleManager($id_test);
    if (Get::gReq('confirm', DOTY_INT, 0)) {
        //TODO: change me
        $asrule->delete($rule_id);
        Util::jump_to($url_base . 'feedbackman');
        die;
    }
}
예제 #8
0
 public function gettreedata()
 {
     $command = Get::req('command', DOTY_ALPHANUM, "");
     $show_actions = Get::req('show_actions', DOTY_INT, 1);
     //$this->show_actions =$show_actions;
     switch ($command) {
         case "set_selected_node":
             $from_widget = Get::gReq('from_widget', DOTY_INT, 0);
             if (!$from_widget) {
                 $node_id = Get::req('node_id', DOTY_INT, -1);
                 $this->_setSelectedNode($node_id);
             }
             break;
         case "expand":
             $node_id = Get::req('node_id', DOTY_INT, -1);
             $initial = Get::req('initial', DOTY_INT, 0) > 0 ? true : false;
             if ($initial) {
                 //get selected node from session and set the expanded tree
                 $node_id = $this->_getSelectedNode();
                 $nodes = $this->model->getKbInitialNodes($node_id, true);
                 //create actions for every node
                 if ($show_actions) {
                     $this->_assignActions($nodes);
                 }
                 //set output
                 if (is_array($nodes)) {
                     $output = array('success' => true, 'nodes' => $nodes, 'initial' => $initial);
                 } else {
                     $output = array('success' => false);
                 }
             } else {
                 //extract node data
                 $nodes = $this->model->getKbNodes($node_id, false, false, true);
                 //create actions for every node
                 if ($show_actions) {
                     for ($i = 0; $i < count($nodes); $i++) {
                         $nodes[$i]['options'] = $this->_getNodeActions($nodes[$i]);
                     }
                 }
                 //set output
                 $output = array('success' => true, 'nodes' => $nodes, 'initial' => $initial);
             }
             echo $this->json->encode($output);
             break;
         case "getmodform":
             if (!$this->permissions['mod']) {
                 $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission'));
                 echo $this->json->encode($output);
                 return;
             }
             $output = array();
             $id = Get::req('node_id', DOTY_INT, -1);
             if ($id < 0) {
                 $output = array('success' => false, 'message' => Lang::t('_INVALID_INPUT'));
             } else {
                 if ($id == 0) {
                     $root_name = Get::sett('title_organigram_chart', Lang::t('_ORG_CHART', 'organization_chart'));
                     $body = Form::openForm('modfolder_form', "ajax.adm_server.php?r=alms/kb/modrootfolder") . '<p id="addfolder_error_message"></p>' . Form::getTextfield(Lang::t('_ROOT_RENAME', 'organization_chart'), 'modfolder_root', 'modfolder_root', 50, $root_name) . Form::closeForm();
                 } else {
                     $languages = Docebo::langManager()->getAllLanguages(true);
                     //getAllLangCode();
                     $std_lang = getLanguage();
                     $form_content = Form::getHidden('modfolder_id', 'node_id', $id);
                     $translations = $this->model->getFolderTranslations($id, true);
                     foreach ($languages as $language) {
                         $lang_code = $language['code'];
                         $lang_name = $language['description'];
                         $translation = isset($translations[$lang_code]) ? $translations[$lang_code] : "";
                         $form_content .= Form::getTextfield($lang_name, 'modfolder_' . $lang_code, 'modfolder[' . $lang_code . ']', 50, $translation);
                     }
                     $body = Form::openForm('modfolder_form', "ajax.adm_server.php?r=alms/kb/modfolder") . '<p id="addfolder_error_message"></p>' . $form_content . Form::closeForm();
                 }
                 $output = array('success' => true, 'body' => $body);
             }
             echo $this->json->encode($output);
             break;
         case "delete":
             $this->delfolder();
             break;
         case "options":
             $id = Get::req('node_id', DOTY_INT, -1);
             $output = array();
             if ($id <= 0) {
                 $output['success'] = false;
             } else {
                 $output['success'] = true;
                 $output['options'] = $this->_getNodeActions($id);
             }
             echo $this->json->encode($output);
     }
     //end switch command
 }
 public function disconnect()
 {
     $field = false;
     $network = Get::gReq('network', DOTY_STRING);
     $social = new Social();
     $social->disconnectAccount($network);
     Util::jump_to('index.php?r=lms/elearning/show');
 }
예제 #10
0
function send_newsletter($send_id)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.json.php';
    $json = new Services_JSON();
    $path = '/appCore/newsletter/';
    //access control
    $nl_sendpercycle = Get::sett("nl_sendpercycle", 1);
    //-TP// funAdminAccess('OP');
    //@set_time_limit(60*15); // 15 minutes!
    $out =& $GLOBALS['page'];
    $out->setWorkingZone("content");
    $lang =& DoceboLanguage::createInstance('admin_newsletter', 'framework');
    $out->add(getTitleArea($lang->def("_NEWSLETTER"), "newsletter"));
    $out->add("<div class=\"std_block\">\n");
    $info = get_send_info($send_id);
    $sel_groups = $info["sel_groups"];
    $sel_lang = $info["sel_lang"];
    $tot = $info["tot"];
    $sub = $info["sub"];
    $msg = $info["msg"];
    $msg = str_replace("{site_base_url}", getSiteBaseUrl(), $msg);
    $fromemail = $info["fromemail"];
    $file_array = $json->decode($info['file']);
    $attach = array();
    foreach ($file_array as $file) {
        $attach[] = '../files' . $path . $file;
    }
    $cycle = Get::gReq("cycle", DOTY_INT, 0);
    // Items per cycle
    $ipc = $nl_sendpercycle;
    if (($cycle + 1) * $ipc < $tot) {
        $sendcomplete = 0;
    } else {
        $sendcomplete = 1;
    }
    $limit = $cycle * $ipc . ", " . $ipc;
    $arr_st = getSendToIdst($send_id, $limit);
    $acl_manager = Docebo::user()->getAclManager();
    if (!empty($sel_lang) && $sel_lang != _ANY_LANG_CODE) {
        $user_info = $acl_manager->getUsersByLanguage($sel_lang, $arr_st);
    } else {
        // Send to all languages
        $user_info = $acl_manager->getUsers($arr_st);
    }
    $send_type = $info["send_type"];
    switch ($send_type) {
        case "email":
            $tempemail = array();
            foreach ($user_info as $info) {
                // Send the email: ------------------------------
                $email = $info[ACL_INFO_EMAIL];
                if ($email != "") {
                    $tempemail[] = $email;
                }
                // ----------------------------------------------
            }
            require_once _base_ . '/lib/lib.mailer.php';
            $mailer = DoceboMailer::getInstance();
            if (count($attach)) {
                $mailer->SendMail($fromemail, $tempemail, $sub, $msg, $attach, array(MAIL_REPLYTO => $fromemail, MAIL_SENDER_ACLNAME => false));
            } else {
                $mailer->SendMail($fromemail, $tempemail, $sub, $msg, false, array(MAIL_REPLYTO => $fromemail, MAIL_SENDER_ACLNAME => false));
            }
            break;
        case "sms":
            // Collect users sms numbers
            require_once $GLOBALS["where_framework"] . "/lib/lib.field.php";
            $acl_man =& Docebo::user()->getACLManager();
            $field_man = new FieldList();
            $arr_sms_recipients = array();
            $send_to_field = Get::sett('sms_cell_num_field');
            $users_sms = $field_man->showFieldForUserArr($arr_st, array($send_to_field));
            $users_info = $acl_man->getUsers($arr_st);
            while (list(, $user_dett) = each($users_info)) {
                // recover media setting
                $idst_user = $user_dett[ACL_INFO_IDST];
                if ($users_sms[$idst_user][$send_to_field] != '') {
                    $arr_sms_recipients[$idst_user] = $users_sms[$idst_user][$send_to_field];
                }
            }
            require_once $GLOBALS["where_framework"] . "/lib/lib.sms.php";
            $sms_manager = new SmsManager();
            $sms_manager->sendSms($msg, $arr_sms_recipients);
            break;
    }
    if ($sendcomplete) {
        require_once _base_ . '/lib/lib.upload.php';
        if (count($attach)) {
            foreach ($attach as $file) {
                sl_open_fileoperations();
                sl_unlink(str_replace('../files', '', $file));
                sl_close_fileoperations();
            }
        }
        $url = "index.php?modname=newsletter&op=complete";
        Util::jump_to($url);
    } else {
        $url = "index.php?modname=newsletter&op=pause&ipc=" . $ipc . "&cycle=" . ($cycle + 1) . "&id_send=" . $send_id;
        Util::jump_to($url);
    }
    $out->add("</div><br />\n");
    $out->add("<form action=\"index.php?modname=newsletter&amp;op=newsletter\" method=\"post\">\n");
    $out->add("<div class=\"std_block\">\n" . '<input type="hidden" id="authentic_request_newsletter" name="authentic_request" value="' . Util::getSignature() . '" />');
    $out->add("<input class=\"button\" type=\"submit\" value=\"" . $lang->def("_BACK") . "\" />\n");
    $out->add("</div>\n");
    $out->add("</form>\n");
}
예제 #11
0
 public static function setLanguage()
 {
     $lang = Get::gReq('set_lang', DOTY_STRING, '');
     if (!empty($lang)) {
         $_SESSION['sel_lang'] = $lang;
         self::init();
         StepManager::loadCurrentStep();
         ob_clean();
         $res = array();
         $res['intro'] = Lang::t('_INSTALLER_INTRO_TEXT');
         $res['title'] = Lang::t('_INTRODUCTION');
         $res['btn'] = Lang::t('_NEXT') . ' &raquo;';
         require_once _base_ . '/lib/lib.json.php';
         $json = new Services_JSON();
         echo $json->encode($res);
         session_write_close();
         die;
     }
     if (!isset($_SESSION['sel_lang'])) {
         $_SESSION['sel_lang'] = 'english';
     }
 }
예제 #12
0
function editcustom($load = false)
{
    checkPerm('mod');
    require_once _base_ . '/lib/lib.form.php';
    $out =& $GLOBALS['page'];
    $lang =& DoceboLanguage::createInstance('manmenu');
    $mod_perm = checkPerm('mod', true);
    $page_title = array('index.php?modname=amanmenu&amp;op=mancustom' => $lang->def('_TITLE_MANMENU'));
    if ($load == false) {
        $title = $lang->def('_NOTITLE');
        $text = $lang->def('_DESCRIPTION');
        $page_title[] = $lang->def('_ADDCUSTOM');
        $duplicate = Get::gReq('duplicate', DOTY_INT, 0);
        if ($duplicate > 0) {
        }
    } else {
        $id_custom = importVar('id_custom', true);
        $query_custom = "\r\n\t\tSELECT title, description \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_menucustom\r\n\t\tWHERE idCustom = '" . $id_custom . "'";
        list($title, $text) = sql_fetch_row(sql_query($query_custom));
        $page_title[] = $lang->def('_MOD');
    }
    $out->add(getTitleArea($page_title, 'manmenu') . '<div class="std_block">' . Form::openForm('addcustom_form', 'index.php?modname=amanmenu&amp;op=savecustom') . Form::openElementSpace() . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', 255, $title));
    if ($load != false) {
        $out->add(Form::getHidden('id_custom', 'id_custom', $id_custom));
    } else {
        $custom = array(0 => $lang->def('_NOT_ASSIGNED'));
        $query = "\r\n\t\tSELECT idCustom, title \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_menucustom \r\n\t\tORDER BY title";
        $re_custom = sql_query($query);
        while (list($id_c, $title_c) = sql_fetch_row($re_custom)) {
            $custom[$id_c] = $title_c;
        }
        $out->add(Form::getDropdown($lang->def('_FROM_CUSTOM'), 'from_custom', 'from_custom', $custom, $duplicate));
    }
    $out->add(Form::getTextarea($lang->def('_DESCRIPTION'), 'description', 'description', $text) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('addcustom', 'addcustom', $load == false ? $lang->def('_INSERT') : $lang->def('_SAVE')) . Form::getButton('undocustom', 'undocustom', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>');
}
예제 #13
0
|   License http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt            |
\ ======================================================================== */
/**
 * @package course management
 * @subpackage course catalogue
 * @category ajax server
 * @version $Id:$
 *
 */
if (!defined("IN_FORMA") && !defined("IN_AJAX")) {
    die('You can\'t access directly');
}
if ($GLOBALS['current_user']->isAnonymous()) {
    die('You can\'t access');
}
$op = Get::gReq('op', DOTY_ALPHANUM, '');
switch ($op) {
    case "getselected":
        require_once _lms_ . '/lib/lib.quest_bank.php';
        $qbm = new QuestBankMan();
        $quest_category = Get::req('quest_category', DOTY_INT);
        $quest_difficult = Get::req('quest_difficult', DOTY_INT);
        $quest_type = Get::req('quest_type', DOTY_ALPHANUM);
        $re_quest = $qbm->resQuestList($quest_category, $quest_difficult, $quest_type);
        $value = array();
        while (list($id_q) = $qbm->fetch($re_quest)) {
            $value[] = (int) $id_q;
        }
        $json = new Services_JSON();
        $output = $json->encode($value);
        aout($output);
예제 #14
0
<?php

/* ======================================================================== \
|   FORMA - The E-Learning Suite                                            |
|                                                                           |
|   Copyright (c) 2013 (Forma)                                              |
|   http://www.formalms.org                                                 |
|   License  http://www.gnu.org/licenses/old-licenses/gpl-2.0.txt           |
|                                                                           |
\ ======================================================================== */
include 'bootstrap.php';
require '../config.php';
$enabled_step = 3;
$current_step = Get::gReq('cur_step', DOTY_INT);
//$upg_step = Get::gReq('upg_step', DOTY_INT);
//if ($_SESSION['start_version'] >= 3000 && $_SESSION['start_version'] < 4000) {
//	echo 'error: version (' . $_SESSION['start_version'] . ') not supported for upgrade: too old (v3)';
//	die();
//}
// Collapse the upgrade from docebo 3.6xx into this procedure
if ($current_step != $enabled_step) {
    echo 'error: procedure must be called from upgrade step ' . $enabled_step . ' only!!';
    die;
}
if (!empty($_SESSION['to_upgrade_arr'])) {
    $to_upgrade_arr = $_SESSION['to_upgrade_arr'];
} else {
    $to_upgrade_arr = getToUpgradeArray();
}
$last_ver = getVersionIntNumber($GLOBALS['cfg']['endversion']);
$fn_config = _base_ . '/config.php';