public function validate() { $_SESSION['adm_info'] = Get::pReq('adm_info'); $_SESSION['lang_install'] = Get::pReq('lang_install'); $this->saveConfig(); return true; }
public function validate() { $agree = Get::pReq('agree', DOTY_INT, 0); if ($agree != 1 && !isset($_SESSION['license_accepted'])) { return false; } else { $_SESSION['license_accepted'] = 1; return true; } }
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(); }
public function save() { // TODO: check that user can access to the test object $rule_id = Get::pReq('rule_id', DOTY_INT, 0); $test_id = Get::pReq('test_id', DOTY_INT, 0); $category_id = Get::pReq('category_id', DOTY_INT, 0); $from_score = Get::pReq('from_score', DOTY_INT, 0); $to_score = Get::pReq('to_score', DOTY_INT, 0); $competences_list = Get::pReq('competences_list', DOTY_STRING, ''); $courses_list = Get::pReq('courses_list', DOTY_STRING, ''); $feedback_txt = Get::pReq('feedback_txt', DOTY_STRING, ''); if ($rule_id <= 0) { $qtxt = "INSERT INTO %lms_assessment_rule\r\n\t\t\t\t(test_id, category_id, from_score, to_score,\r\n\t\t\t\tcompetences_list, courses_list, feedback_txt)\r\n\t\t\t\tVALUES ('" . $test_id . "', '" . $category_id . "',\r\n\t\t\t\t\t'" . $from_score . "', '" . $to_score . "', '" . $competences_list . "',\r\n\t\t\t\t\t'" . $courses_list . "', '" . $feedback_txt . "')"; } else { $qtxt = "UPDATE %lms_assessment_rule SET\r\n\t\t\t\ttest_id='" . $test_id . "', category_id='" . $category_id . "',\r\n\t\t\t\tfrom_score='" . $from_score . "', to_score='" . $to_score . "',\r\n\t\t\t\tcompetences_list='" . $competences_list . "',\r\n\t\t\t\tcourses_list='" . $courses_list . "', feedback_txt='" . $feedback_txt . "'\r\n\t\t\t\tWHERE rule_id='" . $rule_id . "' LIMIT 1"; } $q = $this->db->query($qtxt); return $q; }
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') . ' <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') . ' '; $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&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 }
/** * return the standard data filled by the user in the mod gui * @return array the data filed by the user (lastname, firstname, email, password, signature) */ function getFilledData() { $std_filled = array('lastname' => Get::req('up_lastname', DOTY_MIXED, ''), 'firstname' => Get::req('up_firstname', DOTY_MIXED, ''), 'email' => Get::req('up_email', DOTY_MIXED, ''), 'signature' => Get::req('up_signature', DOTY_MIXED, ''), 'facebook_id' => Get::pReq('facebook_id', DOTY_MIXED, ''), 'twitter_id' => Get::pReq('twitter_id', DOTY_MIXED, ''), 'linkedin_id' => Get::pReq('linkedin_id', DOTY_MIXED, ''), 'google_id' => Get::pReq('google_id', DOTY_MIXED, '')); if ($this->_user_profile->godMode()) { $std_filled['userid'] = Get::req('up_userid', DOTY_MIXED, ''); $std_filled['new_pwd'] = Get::req('up_new_pwd', DOTY_MIXED, ''); $std_filled['repeat_pwd'] = Get::req('up_repeat_pwd', DOTY_MIXED, ''); $std_filled['force_change'] = isset($_POST['force_changepwd']) ? Get::req('force_changepwd', DOTY_INT, 0) : 'no_mod'; $std_filled['level'] = Get::req('up_level', DOTY_MIXED, ''); } return $std_filled; }
/** * Resolve the selection generated by the selector * @param array $arrayData the array with the data for the selections, $_POST is the standard selections * @param string $selector_id the id of the main array with the selections in it * @return array the idsts selected */ public function getSelection($arrayData, $selector_id = false) { $selector_id = empty($selector_id) ? 'main_selector' : $selector_id; $userselector_input = Get::pReq('userselector_input', DOTY_MIXED, false); if (is_array($userselector_input) && isset($userselector_input[$selector_id])) { if (!empty($userselector_input[$selector_id])) { $this->selection = explode(',', $userselector_input[$selector_id]); } else { $this->selection = array(); } } return $this->selection; }
public function validate() { $_SESSION['site_url'] = Get::pReq('site_url', DOTY_STRING); $_SESSION['db_info'] = Get::pReq('db_info'); $_SESSION['upload_method'] = Get::pReq('upload_method'); $_SESSION['ul_info'] = Get::pReq('ul_info'); return true; }
function editfbkrule() { 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); $cat_id = Get::gReq('cat_id', 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='; $back_link_url = $url_base . 'feedbackman'; $asrule = new AssessmentRuleManager($id_test); $save = Get::pReq('save', DOTY_INT, 0); if ($save) { $asrule->save(); Util::jump_to($url_base . 'feedbackman'); die; } $res .= getTitleArea(array($back_link_url => Lang::t('_TEST_SECTION', 'test'), $url_base . 'feedbackman' => Lang::t('_FEEDBACK_MANAGEMENT', 'test'), Lang::t('_MOD', 'test')), 'test') . '<div class="std_block">' . getBackUi($back_link_url, Lang::t('_BACK')); $form_url = ''; $data = $asrule->getRuleInfo($rule_id); $res .= $asrule->getAddEditForm($form_url, $data); $res .= getBackUi($back_link_url, Lang::t('_BACK')) . '</div>'; $GLOBALS['page']->add($res, 'content'); }
public function edit() { require_once _lms_ . '/lib/lib.kbres.php'; $kbres = new KbRes(); $res_id = Get::req('id', DOTY_INT, 0); if (isset($_POST['subcategorize_switch'])) { $cat_sub_items = Get::pReq('subcategorize_switch', DOTY_INT); $kbres->saveResourceSubCategorizePref($res_id, $cat_sub_items); Util::jump_to('index.php?r=alms/kb/show&success=1'); //Util::jump_to('index.php?r=alms/kb/edit&id='.$res_id); die; } if (isset($_POST['org_categorize_save'])) { $name = Get::req('r_name', DOTY_STRING, ""); $original_name = ''; // won't update this field $desc = Get::req('r_desc', DOTY_STRING, ""); $r_item_id = Get::req('r_item_id', DOTY_INT, 0); $type = Get::req('r_type', DOTY_STRING, ""); $env = Get::req('r_env', DOTY_STRING, ""); $env_parent_id = Get::req('r_env_parent_id', DOTY_INT, 0); $param = ''; //Get::req('', DOTY_STRING, ""); $alt_desc = ''; $lang_id = Get::req('r_lang', DOTY_INT, ""); $lang_arr = Docebo::langManager()->getAllLangCode(); $lang = $lang_arr[$lang_id]; $force_visible = Get::req('force_visible', DOTY_INT, 0); $is_mobile = Get::req('is_mobile', DOTY_INT, 0); $folders = Get::req('h_selected_folders', DOTY_STRING, ""); $json_tags = Util::strip_slashes(Get::req('tag_list', DOTY_STRING, "[]")); $res_id = $kbres->saveResource($res_id, $name, $original_name, $desc, $r_item_id, $type, $env, $env_parent_id, $param, $alt_desc, $lang, $force_visible, $is_mobile, $folders, $json_tags); Util::jump_to('index.php?r=alms/kb/show&res=' . ($res_id ? 'ok' : 'err')); } else { if (isset($_POST['org_categorize_cancel'])) { Util::jump_to('index.php?r=alms/kb/show'); } else { $this->render('edit', array('res_id' => $res_id)); } } }
<?php include 'bootstrap.php'; require_once _installer_ . '/lib/lib.lang_import.php'; $db = mysql_connect($_SESSION['db_info']['db_host'], $_SESSION['db_info']['db_user'], $_SESSION['db_info']['db_pass']); mysql_select_db($_SESSION['db_info']['db_name']); mysql_query("SET NAMES 'utf8'"); mysql_query("SET CHARACTER SET 'utf8'"); $platform_code = Get::pReq('platform', DOTY_STRING); $lang = Get::pReq('lang', DOTY_STRING); $upgrade = Get::pReq('upgrade', DOTY_INT); $lang_arr = array_keys($_SESSION["lang_install"]); $pl_arr = array('framework'); $cur = each($pl_arr); $prev = ''; while ($cur && $prev != $platform_code) { $prev = $cur['value']; $cur = each($pl_arr); } $next_platform = $cur ? $cur['value'] : false; if ($next_platform === false) { $cur = each($lang_arr); $prev = ''; while ($cur && $prev != $lang) { $prev = $cur['value']; $cur = each($lang_arr); } $next_lang = $cur ? $cur['value'] : false; $next_platform = $pl_arr[0]; } else { $next_lang = $lang;
public function categorize() { if (!$this->permissions['mod']) { $this->render('invalid', array('message' => $this->_getMessage('no permission'), 'back_url' => 'index.php?r=alms/games/show')); return; } $id_game = Get::req('id_game', DOTY_INT, 0); require_once _lms_ . '/lib/lib.kbres.php'; $kbres = new KbRes(); if ($id_game > 0) { $data = $this->model->findByPk($id_game); $r_data = $kbres->getResourceFromItem($data['id_resource'], $data['type_of'], 'games'); } if (isset($_POST['subcategorize_switch'])) { $cat_sub_items = Get::pReq('subcategorize_switch', DOTY_INT); $res_id = (int) $r_data['res_id']; $r_env_parent_id = (int) $r_data['r_env_parent_id']; $kbres->saveResourceSubCategorizePref($res_id, $cat_sub_items); Util::jump_to('index.php?r=alms/games/categorize&id_game=' . $r_env_parent_id); die; } else { if (isset($_POST['org_categorize_save'])) { require_once _lms_ . '/lib/lib.kbres.php'; $res_id = Get::req('res_id', DOTY_INT, 0); $name = Get::req('r_name', DOTY_STRING, ""); $original_name = ''; // won't update this field $desc = Get::req('r_desc', DOTY_STRING, ""); $r_item_id = Get::req('r_item_id', DOTY_INT, 0); $type = Get::req('r_type', DOTY_STRING, ""); $env = Get::req('r_env', DOTY_STRING, ""); $env_parent_id = Get::req('r_env_parent_id', DOTY_INT, 0); $param = Get::req('r_param', DOTY_STRING, ""); $alt_desc = ''; $lang_id = Get::req('r_lang', DOTY_INT, ""); $lang_arr = Docebo::langManager()->getAllLangCode(); $lang = $lang_arr[$lang_id]; $force_visible = Get::req('force_visible', DOTY_INT, 0); $is_mobile = Get::req('is_mobile', DOTY_INT, 0); $folders = Get::req('h_selected_folders', DOTY_STRING, ""); $json_tags = Util::strip_slashes(Get::req('tag_list', DOTY_STRING, "[]")); $kbres = new KbRes(); $res_id = $kbres->saveResource($res_id, $name, $original_name, $desc, $r_item_id, $type, $env, $env_parent_id, $param, $alt_desc, $lang, $force_visible, $is_mobile, $folders, $json_tags); Util::jump_to('index.php?r=alms/games/show'); } else { if (isset($_POST['org_categorize_cancel'])) { Util::jump_to('index.php?r=alms/games/show'); } else { if ($data['type_of'] == 'scorm' && $r_data && $r_data['sub_categorize'] == 1) { $this->categorize_sco($id_game, $data); } else { $data = $this->model->findByPk($id_game); $data['item_id'] = $id_game; $this->render('categorize', array('id_game' => $id_game, 'data' => $data, 'r_param' => '', 'back_url' => 'index.php?r=alms/games/show', 'form_url' => 'index.php?r=alms/games/categorize&id_game=' . $id_game)); } } } } }
public function importusers() { $base_url = 'index.php?r=' . $this->link . '/show'; //check permissions if (!$this->permissions['add_user']) { Util::jump_to($base_url); } $idOrg = Get::req('id', DOTY_INT, -1); if ($idOrg < 0) { return false; } $step = Get::req('step', DOTY_INT, 1); $params = array('id_org' => $idOrg, 'step' => $step); $undo = Get::req('import_groupcancel', DOTY_MIXED, false); if ($undo) { Util::jump_to($base_url); } switch ($step) { case 1: $params['orgchart_list'] = $this->model->getOrgChartDropdownList(Docebo::user()->getIdSt()); break; case 2: require_once _base_ . '/lib/lib.upload.php'; // ----------- file upload ----------------------------------------- if ($_FILES['file_import']['name'] == '') { //$_SESSION['last_error'] = Lang::t('_FILEUNSPECIFIED'); Util::jump_to($base_url . '&err=no_file'); } else { $path = '/appCore/'; $savefile = mt_rand(0, 100) . '_' . time() . '_' . $_FILES['file_import']['name']; if (!file_exists(Get::rel_path('base') . '/files' . $path . $savefile)) { sl_open_fileoperations(); if (!sl_upload($_FILES['file_import']['tmp_name'], $path . $savefile)) { sl_close_fileoperations(); //$_SESSION['last_error'] = Lang::t('_ERROR_UPLOAD'); Util::jump_to($base_url . '&err=no_upload'); } sl_close_fileoperations(); } else { $_SESSION['last_error'] = Lang::t('_ERROR_UPLOAD'); Util::jump_to($base_url . '&err=no_upload'); } } require_once _adm_ . '/modules/org_chart/import.org_chart.php'; $separator_info = Get::req('import_separator', DOTY_STRING, ','); $separator = false; switch ($separator_info) { case "comma": $separator = ","; break; case "dotcomma": $separator = ";"; break; case "manual": $separator = Get::req('import_separator_manual', DOTY_STRING, ""); break; } $first_row_header = Get::req('import_first_row_header', DOTY_STRING, 'false') == 'true'; $import_charset = Get::req('import_charset', DOTY_STRING, 'UTF-8'); if (trim($import_charset) === '') { $import_charset = 'UTF-8'; } $pwd_force_change_policy = Get::req('pwd_force_change_policy', DOTY_STRING, 'do_nothing'); $src = new DeceboImport_SourceCSV(array('filename' => $GLOBALS['where_files_relative'] . $path . $savefile, 'separator' => $separator, 'first_row_header' => $first_row_header, 'import_charset' => $import_charset)); $dst = new ImportUser(array('dbconn' => $GLOBALS['dbConn'], 'tree' => $idOrg, 'pwd_force_change_policy' => $pwd_force_change_policy, 'send_alert' => 0, 'insert_update' => 0)); $src->connect(); $dst->connect(); $importer = new DoceboImport(); $importer->setSource($src); $importer->setDestination($dst); $params['UIMap'] = $importer->getUIMap(); $params['filename'] = $GLOBALS['where_files_relative'] . $path . $savefile; $params['first_row_header'] = $first_row_header; $params['separator'] = $separator; $params['import_charset'] = $import_charset; $params['pwd_force_change_policy'] = $pwd_force_change_policy; break; case 3: $filename = Get::req('filename', DOTY_STRING, ""); if ($filename == "") { return false; } $separator = Get::req('import_separator', DOTY_STRING, ','); $first_row_header = Get::req('import_first_row_header', DOTY_STRING, 'false') == 'true'; $import_charset = Get::req('import_charset', DOTY_STRING, 'UTF-8'); if (trim($import_charset) === '') { $import_charset = 'UTF-8'; } require_once _adm_ . '/modules/org_chart/import.org_chart.php'; $src = new DeceboImport_SourceCSV(array('filename' => $filename, 'separator' => $separator, 'first_row_header' => $first_row_header, 'import_charset' => $import_charset)); $dst = new ImportUser(array('dbconn' => $GLOBALS['dbConn'], 'tree' => $idOrg, 'pwd_force_change_policy' => Get::req('pwd_force_change_policy', DOTY_STRING, 'do_nothing'), 'send_alert' => Get::pReq('send_alert', DOTY_INT, 0), 'insert_update' => Get::pReq('insert_update', DOTY_INT, 0))); $src->connect(); $dst->connect(); $importer = new DoceboImport(); $importer->setSource($src); $importer->setDestination($dst); $importer->parseMap(); $results = $importer->doImport(); $users = $dst->getNewImportedIdst(); //apply enroll rules if (!empty($users)) { $enrollrules = new EnrollrulesAlms(); $enrollrules->newRules('_NEW_IMPORTED_USER', $users, 'all', $idOrg); } $src->close(); $dst->close(); $buffer = ""; if (count($results) > 1) { require_once _base_ . '/lib/lib.table.php'; $buffer .= Lang::t('_ERRORS', 'admin_directory') . ': <b>' . (count($results) - 1) . '</b><br/>'; $table = new Table(Get::sett('visuItem', 25), Lang::t('_ERRORS', 'admin_directory'), Lang::t('_ERRORS', 'admin_directory')); $table->setColsStyle(array('', '')); $table->addHead(array(Lang::t('_ROW', 'admin_directory'), Lang::t('_DESCRIPTION', 'admin_directory'))); foreach ($results as $key => $err_val) { if ($key != 0) { $table->addBody(array($key, $err_val)); } } $buffer .= $table->getTable(); } if ($buffer === '') { $buffer = '<br/><br/>'; } $params['backUi'] = getBackUi($base_url, Lang::t('_BACK', 'standard')); $params['resultUi'] = Lang::t('_IMPORT', 'standard') . ': <b>' . ($first_row_header ? $results[0] - 1 : $results[0]) . '</b><br />'; $params['results'] = $results; $params['table'] = $buffer; // remove uploaded file: require_once _base_ . '/lib/lib.upload.php'; sl_open_fileoperations(); unlink($filename); sl_close_fileoperations(); break; } $this->render('importusers', $params); }
require_once _lms_ . '/lib/lib.quest_bank.php'; $qman = new QuestBankMan(); $result = $qman->delQuest($id_quest); $value = array("result" => $result, "id_quest" => $id_quest, "row_quest" => $row_quest, "error" => $qman->last_error); $json = new Services_JSON(); $output = $json->encode($value); aout($output); break; default: require_once _lms_ . '/lib/lib.quest_bank.php'; $qbm = new QuestBankMan(); $quest_category = Get::pReq('quest_category', DOTY_INT); $quest_difficult = Get::pReq('quest_difficult', DOTY_INT); $quest_type = Get::pReq('quest_type', DOTY_ALPHANUM); $startIndex = Get::pReq('startIndex', DOTY_INT, 0); $results = Get::pReq('results', DOTY_INT, 30); $totalRecords = $qbm->totalQuestList($quest_category, $quest_difficult, $quest_type); $re_quest = $qbm->resQuestList($quest_category, $quest_difficult, $quest_type, $startIndex, $results); /* 'totalRecords' => $tot_courses, 'startIndex' => $start_index, 'sort' => 'date', 'dir' => 'asc', 'rowsPerPage' => $rows_per_page, 'results' => count($courses), 'records' => $courses_html */ $value = array("totalRecords" => (int) $totalRecords, "startIndex" => (int) $startIndex, 'sort' => 'category_quest', 'dir' => 'asc', 'rowsPerPage' => $results, "results" => (int) $qbm->num_rows($re_quest), "records" => array(), "qc" => $quest_category, "qd" => $quest_difficult, "qt" => $quest_type, "si" => $startIndex, "re" => $results); while (list($id_q, $id_c, $type, $title, $difficult) = $qbm->fetch($re_quest)) { $value['records'][] = array("id_quest" => $id_q, "category_quest" => $id_c, "type_quest" => $type, "title_quest" => $title, "difficult" => $difficult); }
function exportquest(&$url) { require_once _lms_ . '/lib/lib.quest_bank.php'; $lang =& DoceboLanguage::createInstance('test'); $qb_man = new QuestBankMan(); $file_format = Get::pReq('export_quest_select', DOTY_INT, 0); $quest_category = Get::pReq('quest_category', DOTY_INT); $quest_difficult = Get::pReq('quest_difficult', DOTY_INT); $quest_type = Get::pReq('quest_type', DOTY_ALPHANUM); $quest_selection = Get::req('selected_quest', DOTY_NUMLIST, ''); $quest_selection = array_filter(preg_split('/,/', $quest_selection, -1, PREG_SPLIT_NO_EMPTY)); if ($file_format == -1) { $new_test_step = Get::pReq('new_test_step', DOTY_INT); if (Get::req('button_undo', DOTY_MIXED, false) !== false) { questbank($url); return; } if ($new_test_step == 2) { $title = trim($_POST['title']); if ($title == '') { $title = $lang->def('_NOTITLE'); } if (is_array($quest_selection) && !empty($quest_selection)) { //Insert the test $ins_query = "\r\n\t\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_test\r\n\t\t\t\t( author, title, description )\r\n\t\t\t\t\tVALUES\r\n\t\t\t\t( '" . (int) getLogUserId() . "', '" . $title . "', '" . $_POST['textof'] . "' )"; //TODO: if (!mysql_query($ins_query)) { $_SESSION['last_error'] = $lang->def('_OPERATION_FAILURE'); } list($id_test) = sql_fetch_row(sql_query("SELECT LAST_INSERT_ID()")); if ($id_test) { //Insert the question for the test $reQuest = sql_query("\r\n\t\t\t\t\tSELECT q.idQuest, q.type_quest, t.type_file, t.type_class\r\n\t\t\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest AS q JOIN " . $GLOBALS['prefix_lms'] . "_quest_type AS t\r\n\t\t\t\t\tWHERE q.idQuest IN (" . implode(',', $quest_selection) . ") AND q.type_quest = t.type_quest"); while (list($idQuest, $type_quest, $type_file, $type_class) = sql_fetch_row($reQuest)) { require_once _lms_ . '/modules/question/' . $type_file; $quest_obj = new $type_class($idQuest); $new_id = $quest_obj->copy($id_test); } //Adding the item to the tree require_once _lms_ . '/modules/organization/orglib.php'; $odb = new OrgDirDb($_SESSION['idCourse']); $odb->addItem(0, $title, 'test', $id_test, '0', '0', getLogUserId(), '1.0', '_DIFFICULT_MEDIUM', '', '', '', '', date('Y-m-d H:i:s')); } } questbank($url); } else { if (is_array($quest_selection) && !empty($quest_selection)) { require_once _lib_ . '/lib.form.php'; cout(getTitleArea($lang->def('_QUEST_BANK', 'menu_course')) . '<div class="std_block yui-skin-docebo yui-skin-sam">', 'content'); $form = new Form(); cout($form->openForm('search_form', $url->getUrl(), false, 'POST') . $form->getHidden('new_test_step', 'new_test_step', '2') . $form->getHidden('export_quest', 'export_quest', $lang->def('_EXPORT')) . $form->getHidden('export_quest_select', 'export_quest_select', $file_format) . $form->getHidden('quest_category', 'quest_category', $quest_category) . $form->getHidden('quest_difficult', 'quest_difficult', $quest_difficult) . $form->getHidden('quest_type', 'quest_type', $quest_type) . $form->getHidden('selected_quest', 'selected_quest', $_POST['selected_quest']) . $form->openElementSpace() . $form->getTextfield($lang->def('_TITLE'), 'title', 'title', '255') . $form->getTextarea($lang->def('_DESCRIPTION'), 'textof', 'textof') . $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('button_ins', 'button_ins', $lang->def('_TEST_INSERT')) . $form->getButton('button_undo', 'button_undo', $lang->def('_UNDO')) . $form->closeButtonSpace() . $form->closeForm(), 'content'); } else { $_SESSION['last_error'] = $lang->def('_EMPTY_SELECTION'); questbank($url); } } } else { $quests = $qb_man->getQuestFromId($quest_selection); $quest_export = $qb_man->export_quest($quests, $file_format); require_once _lib_ . '/lib.download.php'; sendStrAsFile($quest_export, 'export_' . date("Y-m-d") . '.txt'); } }
function organization_categorize_switch_subcat(&$treeView, $idItem) { require_once _lms_ . '/lib/lib.kbres.php'; $kbres = new KbRes(); $folder = $treeView->tdb->getFolderById($idItem); $data = $folder->otherValues; $type = $data[REPOFIELDOBJECTTYPE]; $r_data = $kbres->getResourceFromItem($data[REPOFIELDIDRESOURCE], $type, 'course_lo'); $cat_sub_items = Get::pReq('subcategorize_switch', DOTY_INT); $res_id = (int) $r_data['res_id']; $r_env_parent_id = (int) $r_data['r_env_parent_id']; $kbres->saveResourceSubCategorizePref($res_id, $cat_sub_items); if ($cat_sub_items == 1) { organization_jump_select_sco($treeView, $idItem, $folder, $data, $type); die; } else { organization_categorize($treeView, $idItem); } }