Пример #1
0
 function loadBody()
 {
     switch ($GLOBALS['op']) {
         case 'showresults':
             $id_course = Get::req('id_course', DOTY_INT, false);
             $_SESSION['idCourse'] = $id_course;
             Util::jump_to('index.php?modname=organization&op=showresults&idcourse=' . $id_course);
             break;
         case "mycourses":
         case "unregistercourse":
             require_once $GLOBALS['where_lms'] . '/modules/' . $this->module_name . '/course.php';
             require_once _base_ . '/lib/lib.urlmanager.php';
             $url =& UrlManager::getInstance('course');
             $url->setStdQuery('r=' . _after_login_);
             mycourses($url);
             break;
         case "donwloadmaterials":
             downloadMaterials();
             break;
         default:
             require_once $GLOBALS['where_lms'] . '/modules/' . $this->module_name . '/infocourse.php';
             infocourseDispatch($GLOBALS['op']);
             break;
     }
 }
 public function mod()
 {
     $id_trans = Get::req('id_trans', DOTY_INT, 0);
     if (isset($_POST['undo'])) {
         Util::jump_to('index.php?r=alms/transaction/show');
     }
     if (isset($_POST['save']) || isset($_POST['not_paid'])) {
         $product_to_activate = Get::req('product', DOTY_MIXED, array());
         $id_user = Get::req('id_user', DOTY_MIXED, 0);
         if ($this->model->saveTransaction($product_to_activate, $id_trans, $id_user)) {
             $this->model->controlActivation($id_trans, isset($_POST['not_paid']));
             Util::jump_to('index.php?r=alms/transaction/show&res=ok');
         }
         Util::jump_to('index.php?r=alms/transaction/show&res=err');
     }
     $transaction_info = $this->model->getTransactionInfo($id_trans);
     $user_info = $this->acl_man->getUser($transaction_info['id_user'], false);
     $user_info[ACL_INFO_USERID] = $this->acl_man->relativeId($user_info[ACL_INFO_USERID]);
     require_once _base_ . '/lib/lib.table.php';
     $tb = new Table(false, Lang::t('_DETAILS', 'transaction'), Lang::t('_DETAILS', 'transaction'));
     $ts = array('', '', 'min-cell', 'image');
     $th = array(Lang::t('_CODE', 'transaction'), Lang::t('_NAME', 'transaction'), Lang::t('_PRICE', 'transaction'), Lang::t('_MARK_AS_PAID', 'transaction'));
     $tb->setColsStyle($ts);
     $tb->addHead($th);
     foreach ($transaction_info['product'] as $product_info) {
         $tb->addBody(array($product_info['code'], $product_info['name'], $product_info['price'], Form::getInputCheckbox('product_' . $product_info['id_course'] . '_' . $product_info['id_date'] . '_' . $product_info['id_edition'], 'product[' . $product_info['id_course'] . '_' . $product_info['id_date'] . '_' . $product_info['id_edition'] . ']', 1, $product_info['activated'], $product_info['activated'] ? ' disabled="disabled"' : '')));
     }
     $this->render('mod', array('transaction_info' => $transaction_info, 'user_info' => $user_info, 'tb' => $tb, 'id_trans' => $id_trans));
 }
Пример #3
0
 public function showTask()
 {
     $model = new SettingAdm();
     $regroup = $model->getRegroupUnit();
     $active_tab = Get::req('active_tab', DOTY_MIXED, 1);
     $this->render('show', array('model' => $model, 'regroup' => $regroup, 'active_tab' => $active_tab));
 }
 public function init()
 {
     $this->id_date = Get::req('id_date', DOTY_INT, 0);
     $this->model = new PresenceLms($_SESSION['idCourse'], $this->id_date);
     $this->json = new Services_JSON();
     $this->permissions = array('view' => true);
 }
Пример #5
0
function tagslist()
{
    require_once _base_ . '/lib/lib.table.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.tags.php';
    $lang =& DoceboLanguage::createInstance('tags', 'framework');
    $id_tag = Get::req('id_tag', DOTY_INT, 0);
    $tag_name = Get::req('tag', DOTY_STRING, '');
    $filter = Get::req('filter', DOTY_STRING, '');
    $nav_bar = new NavBar('ini', Get::sett('visuItem'), 0);
    $nav_bar->setLink('index.php?modname=tags&op=tags&id_tag=' . $id_tag);
    $ini = $nav_bar->getSelectedElement();
    $tags = new Tags('*');
    $resources = $tags->getResourceByTags($id_tag, false, false, $ini, Get::sett('visuItem'));
    $GLOBALS['page']->add(getTitleArea(array($lang->def('_TAGS')), 'tags') . '<div class="std_block">' . '<div class="tag_list">', 'content');
    while (list(, $res) = each($resources['list'])) {
        $link = $res['permalink'];
        $delim = strpos($link, '?') === false ? '?' : '&';
        if (strpos($link, '#') === false) {
            $link = $link . $delim . 'sop=setcourse&sop_idc=' . $res['id_course'];
        } else {
            $link = str_replace('#', $delim . 'sop=setcourse&sop_idc=' . $res['id_course'] . '#', $link);
        }
        $GLOBALS['page']->add('' . '<h2>' . '<a href="' . $link . '">' . $res['title'] . '</a>' . '</h2>' . '<p>' . $res['sample_text'] . '</p>' . '<div class="tag_cloud">' . '<span>' . $lang->def('_TAGS') . ' : </span>' . '<ul><li>' . implode('</li><li>', $res['related_tags']) . '</li></ul>' . '</div>' . '<br />', 'content');
    }
    $GLOBALS['page']->add('</div>' . $nav_bar->getNavBar($ini, $resources['count']) . '</div>', 'content');
}
Пример #6
0
 public function delete_message()
 {
     $success = false;
     $id = Get::req('id', DOTY_INT, -1);
     if ($id > 0) {
         $success = $this->model->deleteMessage($id);
     }
     $output = array('success' => $success);
     echo $this->json->encode($output);
 }
Пример #7
0
 public function del()
 {
     //Course info
     $id_course = Get::req('id_course', DOTY_INT, 0);
     $id_edition = Get::req('id_edition', DOTY_INT, 0);
     $model = new EditionLms($id_course, $id_edition);
     $res = array('success' => $model->delEdition());
     $this->data = $this->json->encode($res);
     echo $this->data;
 }
 public function editTask()
 {
     YuiLib::load('colorpicker');
     $id = Get::req('id', DOTY_INT, -1);
     if ($id > 0) {
         $params = array('id' => $id, 'data' => $this->model->getTemplateData($id));
     } else {
         $params = array('error' => Lang::t('_INVALID_TEMPLATE', 'template'));
     }
     $this->render("edit", $params);
 }
 /**
  * Set the new fields and policy acceptance, than jump to the proper page
  */
 public function set()
 {
     $id_user = Docebo::user()->getIdst();
     require_once _adm_ . '/lib/lib.field.php';
     $fl = new FieldList();
     $fl->storeFieldsForUser($id_user);
     $accept_policy = Get::req('accept_policy', DOTY_INT, 0) > 0;
     $this->model->setAcceptingPolicy($id_user, $accept_policy);
     $policy_checked = $this->model->getAcceptingPolicy($id_user);
     $fields_checked = $fl->checkUserMandatoryFields($id_user);
     if ($fields_checked && $policy_checked) {
         //send alert
         Util::jump_to($this->jump_url);
     } else {
         //send alert
         Util::jump_to('index.php?r=precompile/show&res=err');
     }
 }
Пример #10
0
 public function getNextStep($current_step)
 {
     $version = Get::req('start_version', DOTY_ALPHANUM, '3603');
     if (version_compare($version, '3600', '>=') && version_compare($version, '4000', '<')) {
         //docebo ce v 3.x.x => go to step 3 (config upgrade )
         $next_step = $current_step + 1;
     } else {
         if (version_compare($version, '4000', '>=') && version_compare($version, '5000', '<')) {
             //docebo ce v 4.x.x => go to step 3 (config upgrade )
             $next_step = $current_step + 1;
         } else {
             // forma v1.x => skip step 3 and 4 (config upgrade, db upgrade from 3 to 4)
             $next_step = $current_step + 1;
             // upgrade config via plugin
         }
     }
     return $next_step;
 }
Пример #11
0
 protected function _profileBackUrl()
 {
     $id_user = Get::req('id_user', DOTY_INT, 0);
     $type = Get::req('type', DOTY_STRING, 'false');
     $from = Get::req('from', DOTY_INT, 0);
     $back_my_friend = Get::req('back', DOTY_INT, 0);
     if ($type !== 'false') {
         if ($from == 0) {
             return getBackUi('index.php?modname=profile&op=profile&id_user='******'&ap=goprofile', Lang::t('_BACK', 'standard'));
         } else {
             return getBackUi('index.php?modname=myfiles&op=myfiles&working_area=' . $type, Lang::t('_BACK', 'standard'));
         }
     }
     if ($back_my_friend) {
         return getBackUi('index.php?modname=myfriends&op=myfriends', Lang::t('_BACK', 'standard'));
     }
     return false;
 }
Пример #12
0
 public function showTask()
 {
     require_once _lms_ . '/lib/lib.middlearea.php';
     $ma = new Man_MiddleArea();
     $block_list = array();
     //if($ma->currentCanAccessObj('user_details_short')) $block_list['user_details_short'] = true;
     if ($ma->currentCanAccessObj('user_details_full')) {
         $block_list['user_details_full'] = true;
     }
     if ($ma->currentCanAccessObj('credits')) {
         $block_list['credits'] = true;
     }
     if ($ma->currentCanAccessObj('news')) {
         $block_list['news'] = true;
     }
     $tb_label = $ma->currentCanAccessObj('tb_label');
     if (!$tb_label) {
         $_SESSION['id_common_label'] = 0;
     } else {
         $id_common_label = Get::req('id_common_label', DOTY_INT, -1);
         if ($id_common_label >= 0) {
             $_SESSION['id_common_label'] = $id_common_label;
         } elseif ($id_common_label == -2) {
             $_SESSION['id_common_label'] = -1;
         }
         $block_list['labels'] = true;
     }
     if ($tb_label && $_SESSION['id_common_label'] == -1) {
         require_once _lms_ . '/admin/models/LabelAlms.php';
         $label_model = new LabelAlms();
         $user_label = $label_model->getLabelForUser(Docebo::user()->getId());
         $this->render('_labels', array('block_list' => $block_list, 'label' => $user_label));
     } else {
         if (!empty($block_list)) {
             $this->render('_tabs_block', array('block_list' => $block_list));
         } else {
             $this->render('_tabs', array());
         }
     }
     require_once _lms_ . '/lib/lib.middlearea.php';
     $ma = new Man_MiddleArea();
     $this->render('pluginslist', array('pluginslist' => $pluginslist));
 }
Пример #13
0
function dontReplaceBaseUrl($field_name, $req_admin = TRUE)
{
    $res = FALSE;
    if (Docebo::user()->isAnonymous()) {
        return $res;
    }
    $level_id = Docebo::user()->getUserLevelId();
    if ($req_admin && $level_id != ADMIN_GROUP_GODADMIN && $level_id != ADMIN_GROUP_ADMIN) {
        return $res;
    }
    $platform = Get::cur_plat();
    $modname = Get::req('modname', DOTY_ALPHANUM, "");
    $op = Get::req('op', DOTY_ALPHANUM, "");
    $res = false;
    if (isset($GLOBALS['clean_url'][$platform . _sep_ . $modname . _sep_ . $op . _sep_ . $field_name])) {
        $res = TRUE;
    }
    return $res;
}
 public function init()
 {
     checkPerm('subscribe', false, 'pcourse', 'lms');
     require_once _base_ . '/lib/lib.json.php';
     //Course info
     $this->id_course = Get::req('id_course', DOTY_INT, 0);
     $this->id_edition = Get::req('id_edition', DOTY_INT, 0);
     $this->id_date = Get::req('id_date', DOTY_INT, 0);
     $this->model = new SubscriptionAlms($this->id_course, $this->id_edition, $this->id_date);
     $this->json = new Services_JSON();
     $this->acl_man = Docebo::user()->getAclManager();
     $this->db = DbConn::getInstance();
     $this->permissions = array('subscribe_course' => checkPerm('subscribe', true, 'pcourse', 'lms'), 'subscribe_coursepath' => false, 'moderate' => checkPerm('moderate', true, 'pcourse'));
     $this->link = 'lms/psubscription';
     $this->link_course = 'lms/pcourse';
     $this->link_edition = 'lms/pedition';
     $this->link_classroom = 'lms/pclassroom';
     $this->_mvc_name = 'subscription';
     $this->checkAdminLimit();
 }
 function gettabledataTask()
 {
     //read from input and prepare filter and pagination variables
     $id_category = Get::req('id_category', DOTY_INT, 0);
     $descendants = Get::req('descendants', DOTY_INT, 0) > 0 ? true : false;
     $startIndex = Get::req('startIndex', DOTY_INT, 0);
     $results = Get::req('results', DOTY_INT, Get::sett('visuItem', 25));
     $rowsPerPage = Get::req('rowsPerPage', DOTY_INT, $results);
     $sort = Get::req('sort', DOTY_STRING, "");
     $dir = Get::req('dir', DOTY_STRING, "asc");
     $filter_text = Get::req('filter_text', DOTY_STRING, '');
     $searchFilter = array('text' => $filter_text);
     //get total from database and validate the results count
     $total = $this->competences_model->getCompetencesTotal($id_category, $descendants, $searchFilter);
     if ($startIndex >= $total) {
         if ($total < $results) {
             $startIndex = 0;
         } else {
             $startIndex = $total - $results;
         }
     }
     //set pagination argument
     $pagination = array('startIndex' => $startIndex, 'results' => $results, 'sort' => $sort, 'dir' => $dir);
     //read records from database
     $list = $this->competences_model->getCompetencesList($id_category, $descendants, $pagination, $searchFilter);
     //prepare the data for sending
     $output_results = array();
     if (is_array($list) && count($list) > 0) {
         foreach ($list as $idst => $record) {
             //format description field
             $description = strip_tags($record->description);
             if (strlen($description) > 200) {
                 $description = substr($description, 0, 197) . '...';
             }
             //prepare output record
             $output_results[] = array('id' => $record->id_competence, 'name' => Layout::highlight($record->name, $filter_text), 'description' => Layout::highlight($description, $filter_text), 'typology' => $record->typology, 'type' => $record->type);
         }
     }
     $output = array('totalRecords' => $total, 'startIndex' => $startIndex, 'sort' => $sort, 'dir' => $dir, 'rowsPerPage' => $rowsPerPage, 'results' => count($list), 'records' => $output_results);
     echo $this->json->encode($output);
 }
Пример #16
0
                require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
                logIntoCourse($id_c, false);
            }
            if (isset($_SESSION['cp_assessment_effect'])) {
                unset($_SESSION['cp_assessment_effect']);
            }
            break;
        case "resetselmodule":
            unset($_SESSION['sel_module_id']);
            break;
        case "unregistercourse":
            if (isset($_SESSION['idCourse'])) {
                TrackUser::closeSessionCourseTrack();
                unset($_SESSION['idCourse']);
                unset($_SESSION['idEdition']);
            }
            if (isset($_SESSION['cp_assessment_effect'])) {
                unset($_SESSION['cp_assessment_effect']);
            }
            break;
        case "changelang":
            Lang::set(Get::req('new_lang', DOTY_MIXED));
            $_SESSION['changed_lang'] = true;
            break;
    }
}
// istance the course description class
if (isset($_SESSION['idCourse']) && !isset($GLOBALS['course_descriptor'])) {
    require_once _lms_ . '/lib/lib.course.php';
    $GLOBALS['course_descriptor'] = new DoceboCourse($_SESSION['idCourse']);
}
Пример #17
0
        $mvc = ucfirst(strtolower($r[1])) . ucfirst(strtolower($r[0])) . 'Controller';
        $action = $r[2];
    } else {
        // Only class and method defined in the path requested
        $mvc = '' . ucfirst(strtolower($r[0])) . 'AdmController';
        $action = $r[1];
    }
    ob_clean();
    $controller = new $mvc(strtolower($r[1]));
    $controller->request($action);
    aout(ob_get_contents());
    ob_clean();
} else {
    if ($mn == '') {
        $fl = Get::req('file', DOTY_ALPHANUM, '');
        $sf = Get::req('sf', DOTY_ALPHANUM, '');
        $aj_file = $GLOBALS['where_' . $plf] . '/lib/' . ($sf ? $sf . '/' : '') . 'ajax.' . $fl . '.php';
    } else {
        if ($plf == 'framework') {
            $aj_file = $GLOBALS['where_' . $plf] . '/modules/' . $mn . '/ajax.' . $mn . '.php';
        } else {
            $aj_file = $GLOBALS['where_' . $plf] . '/admin/modules/' . $mn . '/ajax.' . $mn . '.php';
        }
    }
}
include $aj_file;
// finalize
Boot::finalize();
// remove all the echo
ob_clean();
// Print out the page
Пример #18
0
 function loadCoursepathSelector($noprint = false)
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('coursepath', 'lms');
     $output = '';
     // Filter
     $this->filter['coursepath_name'] = isset($_POST['coursepath_filter_name']) ? $_POST['coursepath_filter_name'] : '';
     if ($this->show_filter === true) {
         /*
         			$form = new Form();
         			$output .= $form->getOpenFieldset($lang->def('_COURSEPATH_FILTER'))
         				.Form::getTextfield($lang->def('_NAME'), 'coursepath_filter_name', 'coursepath_filter_name', '255',
         					( isset($_POST['coursepath_filter_name']) ? $_POST['coursepath_filter_name'] : '' ))
         				.$form->openButtonSpace()
         				.$form->getButton('coursepath_filter', 'coursepath_filter', $lang->def('_SEARCH'))
         				.$form->closeButtonSpace()
         				.$form->getCloseFieldset();*/
         $output .= '<div class="quick_search_form">' . '<div>' . Form::getInputTextfield("search_t", "coursepath_filter_name", "coursepath_filter_name", Get::req('coursepath_filter_name', DOTY_MIXED, ''), '', 255, '') . Form::getButton("coursepath_filter", "coursepath_filter", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>';
     }
     // End Filter
     $tb = new Table(Get::sett('visuItem'), $lang->def('_COURSE_PATH_CAPTION'), $lang->def('_COURSE_PATH_SUMMARY'));
     $tb->initNavBar('ini_cpath', 'button');
     $ini = $tb->getSelectedElement();
     $select = "\r\n\t\tSELECT id_path, path_name, path_descr ";
     $query_coursepath = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_coursepath\r\n\t\tWHERE 1 ";
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         }
         if (isset($admin_courses['course'][-1])) {
             $query = "SELECT id_path" . " FROM %lms_coursepath_user" . " WHERE idUser = '******'";
             $result = sql_query($query);
             $admin_courses['coursepath'] = array();
             while (list($id_path) = sql_fetch_row($result)) {
                 $admin_courses['coursepath'][$id_path] = $id_path;
             }
             if (!empty($admin_courses['coursepath']) && Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         }
         if (!$all_courses) {
             if (empty($admin_courses['coursepath'])) {
                 $query_coursepath .= " AND 0 ";
             } else {
                 $query_coursepath .= " AND id_path IN (" . implode(',', $admin_courses['coursepath']) . ") ";
             }
         }
     }
     if ($this->filter['coursepath_name'] != '') {
         $query_coursepath .= " AND path_name LIKE '%" . $this->filter['coursepath_name'] . "%'";
     }
     list($tot_coursepath) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_coursepath));
     $query_coursepath .= "\r\n\t\tORDER BY path_name\r\n\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem');
     $re_coursepath = sql_query($select . $query_coursepath);
     $type_h = array('image', '', '', '');
     $cont_h = array('<span class="access-only">' . $lang->def('_SELECT') . '</span>', $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     while (list($id_path, $name, $descr) = sql_fetch_row($re_coursepath)) {
         $tb_content = array(Form::getInputCheckbox('new_coursepath_selected_' . $id_path, 'new_coursepath_selected[' . $id_path . ']', $id_path, isset($this->current_selection[$id_path]), ''), '<label for="new_coursepath_selected_' . $id_path . '">' . $name . '</label>', '<label for="new_coursepath_selected_' . $id_path . '">' . $descr . '</label>');
         $tb->addBody($tb_content);
         if (isset($this->current_selection[$id_path])) {
             unset($this->current_selection[$id_path]);
         }
     }
     $output .= $tb->getTable() . $tb->getNavBar($ini, $tot_coursepath) . $this->stateSelection();
     if ($noprint) {
         return $output;
     } else {
         cout($output, 'content');
     }
 }
Пример #19
0
 function ListView($title, &$data, &$rend, $id)
 {
     $this->title = $title;
     $this->data =& $data;
     $this->rend = $rend;
     $this->id = $id;
     $this->itemSelected = array();
     $this->lang =& DoceboLanguage::createInstance('standard', 'framework');
     $this->startRow = Get::req('ini', DOTY_INT, 0);
 }
Пример #20
0
 function delentry()
 {
     checkPerm('mod');
     $id_cat = importVar('id_cat', false);
     $type_of_entry = importVar('type', false);
     $id_entry = importVar('id_entry', true, 0);
     $id_arr = array($id_entry);
     $query_catalogue = "\r\n\tSELECT idCatalogue\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_catalogue_entry\r\n\tWHERE idCatalogue = '" . $id_cat . "' AND idEntry = '" . $id_entry . "' AND type_of_entry = '" . $type_of_entry . "'";
     list($id_cat) = sql_fetch_row(sql_query($query_catalogue));
     if (Get::req('confirm', DOTY_INT, 0)) {
         $re = true;
         if (!sql_query("\r\n\t\tDELETE FROM " . $GLOBALS['prefix_lms'] . "_catalogue_entry\r\n\t\tWHERE idCatalogue = '" . $id_cat . "' AND idEntry = '" . $id_entry . "' AND type_of_entry = '" . $type_of_entry . "'")) {
             Util::jump_to('index.php?modname=coursepath&op=pathlist&result=err');
         }
         Util::jump_to('index.php?modname=catalogue&op=entrylist&id=' . $id_cat . '&result=' . ($re ? 'ok' : 'err'));
     }
 }
Пример #21
0
    case "del":
        $id = Get::req("id", DOTY_INT);
        $calEventClass = Get::req("calEventClass");
        if ($calEventClass != "core") {
            require_once $GLOBALS['where_framework'] . "/lib/lib.calevent_" . $calEventClass . ".php";
        }
        $class = "DoceboCalEvent_" . $calEventClass;
        $event = new $class();
        //$event->id=$id;
        //$event->_owner=$event->getOwner();
        $event->assignVar();
        $event->del();
        aout("{\"result\":\"1\"}");
        break;
    case "getForm":
        $calEventClass = Get::req("calEventClass");
        if ($calEventClass != "core") {
            require_once $GLOBALS['where_framework'] . "/lib/lib.calevent_" . $calEventClass . ".php";
        }
        $class = "DoceboCalEvent_" . $calEventClass;
        $event = new $class();
        $form = $event->getForm();
        aout($form);
        break;
    case "getLang":
        $lang =& DoceboLanguage::createInstance('calendar', 'lms');
        $lang_obj = '{
		"_DN":["' . $lang->def('_SUNDAY') . '","' . $lang->def('_MONDAY') . '","' . $lang->def('_TUESDAY') . '","' . $lang->def('_WEDNESDAY') . '","' . $lang->def('_THURSDAY') . '","' . $lang->def('_FRIDAY') . '","' . $lang->def('_SATURDAY') . '","' . $lang->def('_SUNDAY') . '"],
		"_SDN":["' . $lang->def('_SUN') . '","' . $lang->def('_MON') . '","' . $lang->def('_TUE') . '","' . $lang->def('_WED') . '","' . $lang->def('_THU') . '","' . $lang->def('_FRI') . '","' . $lang->def('_SAT') . '","' . $lang->def('_SUN') . '"],
		"_MN":["' . $lang->def('_JANUARY') . '","' . $lang->def('_FEBRUARY') . '","' . $lang->def('_MARCH') . '","' . $lang->def('_APRIL') . '","' . $lang->def('_MAY') . '","' . $lang->def('_JUNE') . '","' . $lang->def('_JULY') . '","' . $lang->def('_AUGUST') . '","' . $lang->def('_SEPTEMBER') . '","' . $lang->def('_OCTOBER') . '","' . $lang->def('_NOVEMBER') . '","' . $lang->def('_DECEMBER') . '"],
		"_SMN":["' . $lang->def('_JAN') . '","' . $lang->def('_FEB') . '","' . $lang->def('_MAR') . '","' . $lang->def('_APR') . '","' . $lang->def('_MAY') . '","' . $lang->def('_JUN') . '","' . $lang->def('_JUL') . '","' . $lang->def('_AUG') . '","' . $lang->def('_SEP') . '","' . $lang->def('_OCT') . '","' . $lang->def('_NOV') . '","' . $lang->def('_DEC') . '"],
Пример #22
0
 public function standingsTask()
 {
     $id_game = Get::req('id_game', DOTY_INT, 0);
     $model = new GamesAlms();
     $game = $model->findByPk($id_game, Docebo::user()->getArrSt());
     YuiLib::load('base,charts');
     $this->render('standings', array('game' => $game, 'track' => $model->getUserStandings($game['id_game'], getLogUserId()), 'standings' => $model->getStandings($game['id_game'], 0, 30), 'chart_data' => $this->json->encode($model->getStandingsChartData($game['id_game']))));
 }
Пример #23
0
 protected function dellabel()
 {
     if (!$this->permissions['del']) {
         $output = array('success' => false, 'message' => $this->_getMessage("no permission"));
         echo $this->json->encode($output);
         return;
     }
     $id_common_label = Get::req('id_common_label', DOTY_INT, 0);
     $res = array('success' => $this->model->delLabel($id_common_label));
     $this->data = $this->json->encode($res);
     echo $this->data;
 }
Пример #24
0
function modTransaction()
{
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.dialog.php';
    require_once _lms_ . '/lib/lib.course.php';
    require_once _lms_ . '/lib/lib.date.php';
    $lang =& DoceboLanguage::createInstance('transaction');
    $acl_man = Docebo::user()->getAclManager();
    $man_transaction = new Man_Transaction();
    $course_man = new Man_Course();
    $date_man = new DateManager();
    $id_transaction = Get::req('id', DOTY_INT, 0);
    $transaction_info = $man_transaction->getTransactionInfo($id_transaction);
    if (isset($_POST['update'])) {
        $payment_status = Get::req('payment_status', DOTY_INT, 0);
        $course_status = Get::req('course_status', DOTY_INT, 0);
        $note = Get::req('note', DOTY_MIXED, '');
        if ($man_transaction->updateTransaction($id_transaction, $payment_status, $course_status, $note)) {
            if (isset($_POST['confirm'])) {
                $activations = array();
                foreach ($_POST['confirm'] as $id => $n) {
                    list($id_course, $id_date) = explode('_', $id);
                    if ($id_date != 0) {
                        $activations[$id_course]['dates'][$id_date] = $id_date;
                    } else {
                        $activations[$id_course] = $id_course;
                    }
                }
                if ($man_transaction->activateCourses($id_transaction, $transaction_info['id_user'], $activations)) {
                    Util::jump_to('index.php?modname=transaction&op=transaction&res=ok');
                }
            } else {
                Util::jump_to('index.php?modname=transaction&op=transaction&res=ok');
            }
        }
        Util::jump_to('index.php?modname=transaction&op=transaction&res=err_up');
    }
    $array_title = array('index.php?modname=transaction&amp;op=transaction' => $lang->def('_TRANSACTION'), $lang->def('_MOD_TRANSACTION'));
    //Status info & note
    $array_payment_status = array('-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_WAITING_PAYMENT'), '1' => $lang->def('_PARTIAL_PAID'), '2' => $lang->def('_PAID'));
    $array_course_status = array('-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_NO_COURSE_ACTIVATED'), '1' => $lang->def('_SOME_COURSE_ACTIVATED'), '2' => $lang->def('_ALL_COURSE_ACTIVATED'));
    cout(getTitleArea($array_title) . '<div class="std_block">' . Form::openForm('transaction_info', 'index.php?modname=transaction&amp;op=mod&amp;id=' . $id_transaction) . Form::openElementSpace() . Form::getDropdown($lang->def('_PAYMENT_STATUS_FILTER'), 'payment_status', 'payment_status', $array_payment_status, $transaction_info['payment_status']) . Form::getDropdown($lang->def('_COURSE_STATUS_FILTER'), 'course_status', 'course_status', $array_course_status, $transaction_info['course_status']) . Form::getSimpleTextarea($lang->def('_NOTES'), 'note', 'note', $transaction_info['note']) . Form::closeElementSpace());
    //User info
    $user_info = $acl_man->getUser($transaction_info['id_user'], false);
    $tb_user = new Table(0, $lang->def('_USER_INFO'), $lang->def('_USER_INFO'));
    $cont_h = array($lang->def('_USERNAME'), $lang->def('_FIRSTNAME'), $lang->def('_LASTNAME'), $lang->def('_EMAIL'));
    $type_h = array('', '', '', '');
    $tb_user->setColsStyle($type_h);
    $tb_user->addHead($cont_h);
    $tb_user->addBody(array($acl_man->relativeId($user_info[ACL_INFO_USERID]), $user_info[ACL_INFO_FIRSTNAME], $user_info[ACL_INFO_LASTNAME], $user_info[ACL_INFO_EMAIL]));
    cout('<br />' . $tb_user->getTable());
    //Payment info if we need it
    //Product info
    $tb_product = new Table(0, $lang->def('_PRODUCT_INFO'), $lang->def('_PRODUCT_INFO'));
    $cont_h = array($lang->def('_CODE'), $lang->def('_NAME'), $lang->def('_DATE_BEGIN'), $lang->def('_DATE_END'), $lang->def('_COURSE_PRIZE'), $lang->def('_CONFIRM_COURSE'));
    $type_h = array('', '', '', '', '', '');
    $tb_product->setColsStyle($type_h);
    $tb_product->addHead($cont_h);
    $transaction_course = $man_transaction->getTransactionCourses($id_transaction);
    foreach ($transaction_course as $id_course => $details) {
        if (is_array($details)) {
            foreach ($details['dates'] as $id_date) {
                $date_info = $date_man->getDateInfo($id_date);
                $checked = false;
                $other = '';
                if ($man_transaction->controlActivation($id_transaction, $id_course, $id_date)) {
                    $checked = true;
                    $other = 'disabled="disabled"';
                }
                $tb_product->addBody(array($date_info['code'], $date_info['name'], Format::date($date_info['date_begin']), Format::date($date_info['date_end']), $date_info['price'], Form::getInputCheckbox($id_course . '_' . $id_date, 'confirm[' . $id_course . '_' . $id_date . ']', 1, $checked, $other)));
            }
        } else {
            $course_info = $course_man->getCourseInfo($id_course);
            $checked = false;
            $other = '';
            if ($man_transaction->controlActivation($id_transaction, $id_course)) {
                $checked = true;
                $other = 'disabled="disabled"';
            }
            $tb_product->addBody(array($course_info['code'], $course_info['name'], $course_info['date_begin'] !== '0000-00-00' ? Format::date($course_info['date_begin'], 'date') . ($course_info['hour_begin'] !== '-1' ? $course_info['hour_begin'] : '') : '', $course_info['date_end'] !== '0000-00-00' ? Format::date($course_info['date_end'], 'date') . ($course_info['hour_end'] !== '-1' ? $course_info['hour_end'] : '') : '', $course_info['prize'] == '' ? '0' : $course_info['prize'], Form::getInputCheckbox($id_course . '_0', 'confirm[' . $id_course . '_0]', 1, $checked, $other)));
        }
    }
    cout('<br />' . $tb_product->getTable() . Form::openButtonSpace() . Form::getButton('update', 'update', $lang->def('_UPDATE')) . Form::getButton('back_mod', 'back_mod', $lang->def('_BACK')) . Form::closeButtonSpace() . Form::closeForm());
    cout('</div>');
}
Пример #25
0
switch ($op) {
    case "expand":
        $json = new Services_JSON();
        $node_id = Get::req('query', DOTY_INT, 0);
        $result = array();
        $treecat = new Categorytree();
        $re = $treecat->getChildrensById($node_id);
        while (list($idCategory, $idParent, $path, $lev, $left, $right) = sql_fetch_row($re)) {
            $result[] = array('id' => $idCategory, 'label' => end(explode('/', $path)), 'is_leaf' => $right - $left == 1, 'count_content' => '');
            //change this
        }
        aout($json->encode($result));
        break;
    case "getaddnodeform":
        $url = Get::req('server_url', DOTY_ALPHANUM, false);
        $parent_id = Get::req('parent_id', DOTY_ALPHANUM, false);
        $output = array();
        $output['body'] = '<form name="tree_addfolder_form" method="POST" action="' . $url . '">' . '<input type="hidden" id="authentic_request_addfolder" name="authentic_request" value="' . Util::getSignature() . '" />' . '<input type="hidden" name="op" value="add_folder" />' . '<input type="hidden" name="parent_id" value="' . $parent_id . '" />' . '<label for="newname">' . "lang._NEW_FOLDER" . ':</label><input type="text" name="newname" /></form>';
        $json = new Services_JSON();
        aout($json->encode($output));
        break;
    case "add_folder":
        $output = array();
        $output['success'] = true;
        $output['folder_id'] = 666;
        $output['label'] = 'label';
        $output['is_leaf'] = false;
        $json = new Services_JSON();
        aout($json->encode($output));
        break;
    case "add_element":
Пример #26
0
function delete_public_report()
{
    require_once $GLOBALS['where_lms'] . '/lib/lib.report.php';
    $id_filter = Get::req('idrep', DOTY_INT, -1);
    if ($id_filter <= 0) {
        $result = false;
    } else {
        $result = report_delete_filter($id_filter);
    }
    Util::jump_to('index.php?modname=public_report_admin&op=reportlist');
}
Пример #27
0
 function loadCatalogueSelector($noprint = false)
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('catalogue', 'lms');
     // Filter
     $this->filter['catalogue_name'] = isset($_POST['cat_filter_name']) ? $_POST['cat_filter_name'] : '';
     if ($this->show_filter === true) {
         $form = new Form();
         /*$GLOBALS['page']->add(
         			$form->getOpenFieldset($lang->def('_SEARCH'))
         			.Form::getTextfield($lang->def('_NAME'), 'cat_filter_name', 'cat_filter_name', '255',
         				( isset($_POST['cat_filter_name']) ? $_POST['cat_filter_name'] : '' ))
         			.$form->openButtonSpace()
         			.$form->getButton('catalogue_filter', 'catalogue_filter', $lang->def('_SEARCH'))
         			.$form->closeButtonSpace()
         			.$form->getCloseFieldset()
         		, 'content');
         		*/
         cout('<div class="quick_search_form">' . '<div>' . Form::getInputTextfield("search_t", "cat_filter_name", "cat_filter_name", Get::req('cat_filter_name', DOTY_MIXED, ''), '', 255, '') . Form::getButton("catalogue_filter", "catalogue_filter", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>', 'content');
     }
     // End Filter
     $tb = new Table(Get::sett('visuItem'), $lang->def('_CATALOGUE'), $lang->def('_CATALOGUE_SUMMARY'));
     $tb->initNavBar('ini_cat', 'button');
     $ini = $tb->getSelectedElement();
     $select = "\r\n\t\tSELECT c.idCatalogue, c.name, c.description";
     $query_catalogue = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_catalogue AS c\r\n\t\tWHERE 1";
     // Retriving data
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         }
         if (isset($admin_courses['course'][-1])) {
             require_once _lms_ . '/lib/lib.catalogue.php';
             $cat_man = new Catalogue_Manager();
             $admin_courses['catalogue'] = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt());
             if (count($admin_courses['catalogue']) == 0 && Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         }
         if (!$all_courses) {
             if (empty($admin_courses['catalogue'])) {
                 $query_catalogue .= " AND 0 ";
             } else {
                 $query_catalogue .= " AND c.idCatalogue IN (0," . implode(',', $admin_courses['catalogue']) . ") ";
             }
         }
     }
     if ($this->filter['catalogue_name'] != '') {
         $query_catalogue .= " AND c.name LIKE '%" . $this->filter['catalogue_name'] . "%'";
     }
     list($tot_catalogue) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_catalogue));
     $query_catalogue .= " ORDER BY c.name\r\n\t\t\t\t\t\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem');
     $re_catalogue = sql_query($select . $query_catalogue);
     $type_h = array('image', '', '', '');
     $cont_h = array('<span class="access-only">' . $lang->def('_CATALOGUE_SELECTION') . '</span>', $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     while (list($id_catalogue, $name, $descr) = sql_fetch_row($re_catalogue)) {
         $tb_content = array(Form::getInputCheckbox('new_catalogue_selected_' . $id_catalogue, 'new_catalogue_selected[' . $id_catalogue . ']', $id_catalogue, isset($this->current_selection[$id_catalogue]), ''), '<label for="new_catalogue_selected_' . $id_catalogue . '">' . $name . '</label>', '<label for="new_catalogue_selected_' . $id_catalogue . '">' . $descr . '</label>');
         $tb->addBody($tb_content);
         if (isset($this->current_selection[$id_catalogue])) {
             unset($this->current_selection[$id_catalogue]);
         }
     }
     $output = $tb->getTable() . $tb->getNavBar($ini, $tot_catalogue) . $this->stateSelection();
     if ($noprint) {
         return $output;
     } else {
         cout($output, 'content');
     }
 }
 public function getfncroletabledataTask()
 {
     $op = Get::req('op', DOTY_MIXED, false);
     switch ($op) {
         case "selectall":
             $this->_selectAllFncroles();
             return;
             break;
     }
     $startIndex = Get::req('startIndex', DOTY_INT, 0);
     $results = Get::req('results', DOTY_INT, Get::sett('visuItem'));
     $rowsPerPage = Get::req('rowsPerPage', DOTY_INT, $results);
     $sort = Get::req('sort', DOTY_STRING, "");
     $dir = Get::req('dir', DOTY_STRING, "asc");
     $filter = Get::req('filter', DOTY_STRING, "");
     $pagination = array('startIndex' => $startIndex, 'results' => $results, 'sort' => $sort, 'dir' => $dir);
     $list = $this->fncrole_model->getFunctionalRolesList($pagination, array('text' => $filter));
     //format models' data
     $records = array();
     $acl_man = Docebo::user()->getAclManager();
     if (is_array($list)) {
         foreach ($list as $record) {
             $_description = strip_tags($record->description);
             if (strlen($_description) > 100) {
                 $_description = substr($_description, 0, 97) . '...';
             }
             $records[] = array('id' => (int) $record->id_fncrole, 'name' => highlightText($record->name, $filter), 'group' => highlightText($record->group_name, $filter), 'description' => highlightText($_description, $filter), 'users' => $record->users);
         }
     }
     $output = array('startIndex' => $startIndex, 'recordsReturned' => count($records), 'sort' => $sort, 'dir' => $dir, 'totalRecords' => $this->fncrole_model->getFunctionalRolesTotal($filter), 'pageSize' => $rowsPerPage, 'records' => $records);
     echo $this->json->encode($output);
 }
Пример #29
0
function release_cert(&$url)
{
    checkPerm('view');
    $id_certificate = importVar('id_certificate', true, 0);
    $id_course = importVar('id_course', true, 0);
    $id_meta = Get::req('idmeta', DOTY_INT, 0);
    $cert = new Certificate();
    $subs = $cert->getSubstitutionArray(Docebo::user()->getIdST(), $id_course, $id_meta);
    $cert->send_certificate($id_certificate, Docebo::user()->getIdST(), $id_course, $subs);
}
Пример #30
0
function duplicateCourse()
{
    $id_dupcourse = Get::req('id_course', DOTY_INT, 0);
    // read the old course info
    $query_sel = "SELECT *\n\tFROM " . $GLOBALS['prefix_lms'] . "_course\n\tWHERE idCourse = '" . $id_dupcourse . "' ";
    $result_sel = sql_query($query_sel);
    $list_sel = sql_fetch_array($result_sel);
    foreach ($list_sel as $k => $v) {
        $list_sel[$k] = mysql_escape_string($v);
    }
    $new_course_dup = 0;
    $new_file_array = array();
    if ($list_sel['imgSponsor'] !== '') {
        $new_name_array = explode('_', str_replace('course_sponsor_logo_', '', $list_sel['imgSponsor']));
        $filename = 'course_sponsor_logo_' . mt_rand(0, 100) . '_' . time() . '_' . str_replace('course_sponsor_logo_' . $new_name_array[0] . '_' . $new_name_array[1] . '_', '', $list_sel['imgSponsor']);
        $new_file_array[0]['old'] = $list_sel['imgSponsor'];
        $new_file_array[0]['new'] = $filename;
        $list_sel['imgSponsor'] = $filename;
    }
    if ($list_sel['img_course'] !== '') {
        $new_name_array = explode('_', str_replace('course_logo_', '', $list_sel['img_course']));
        $filename = 'course_logo_' . mt_rand(0, 100) . '_' . time() . '_' . str_replace('course_logo_' . $new_name_array[0] . '_' . $new_name_array[1] . '_', '', $list_sel['img_course']);
        $new_file_array[1]['old'] = $list_sel['img_course'];
        $new_file_array[1]['new'] = $filename;
        $list_sel['img_course'] = $filename;
    }
    if ($list_sel['img_material'] !== '') {
        $new_name_array = explode('_', str_replace('course_user_material_', '', $list_sel['img_material']));
        $filename = 'course_user_material_' . mt_rand(0, 100) . '_' . time() . '_' . str_replace('course_user_material_' . $new_name_array[0] . '_' . $new_name_array[1] . '_', '', $list_sel['img_material']);
        $new_file_array[2]['old'] = $list_sel['img_material'];
        $new_file_array[2]['new'] = $filename;
        $list_sel['img_material'] = $filename;
    }
    if ($list_sel['img_othermaterial'] !== '') {
        $new_name_array = explode('_', str_replace('course_otheruser_material_', '', $list_sel['img_othermaterial']));
        $filename = 'course_otheruser_material_' . mt_rand(0, 100) . '_' . time() . '_' . str_replace('course_otheruser_material_' . $new_name_array[0] . '_' . $new_name_array[1] . '_', '', $list_sel['img_othermaterial']);
        $new_file_array[3]['old'] = $list_sel['img_othermaterial'];
        $new_file_array[3]['new'] = $filename;
        $list_sel['img_othermaterial'] = $filename;
    }
    if ($list_sel['course_demo'] !== '') {
        $new_name_array = explode('_', str_replace('course_demo_', '', $list_sel['course_demo']));
        $filename = 'course_demo_' . mt_rand(0, 100) . '_' . time() . '_' . str_replace('course_demo_' . $new_name_array[0] . '_' . $new_name_array[1] . '_', '', $list_sel['course_demo']);
        $new_file_array[4]['old'] = $list_sel['course_demo'];
        $new_file_array[4]['new'] = $filename;
        $list_sel['course_demo'] = $filename;
    }
    // duplicate the entry of learning_course
    $query_ins = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_course\n\t\t( idCategory, code, name, description, lang_code, status, level_show_user,\n\t\tsubscribe_method, linkSponsor, imgSponsor, img_course, img_material, img_othermaterial,\n\t\tcourse_demo, mediumTime, permCloseLO, userStatusOp, difficult, show_progress, show_time, show_extra_info,\n\t\tshow_rules, valid_time, max_num_subscribe, min_num_subscribe,\n\t\tmax_sms_budget, selling, prize, course_type, policy_point, point_to_all, course_edition, classrooms, certificates,\n\t\tcreate_date, security_code, imported_from_connection, course_quota, used_space, course_vote, allow_overbooking, can_subscribe,\n\t\tsub_start_date, sub_end_date, advance, show_who_online, direct_play, autoregistration_code, use_logo_in_courselist )\n\tVALUES\n\t\t( '" . $list_sel['idCategory'] . "', '" . $list_sel['code'] . "', '" . "Copia di " . $list_sel['name'] . "', '" . $list_sel['description'] . "', '" . $list_sel['lang_code'] . "', '" . $list_sel['status'] . "', '" . $list_sel['level_show_user'] . "',\n\t\t'" . $list_sel['subscribe_method'] . "', '" . $list_sel['linkSponsor'] . "', '" . $list_sel['imgSponsor'] . "', '" . $list_sel['img_course'] . "', '" . $list_sel['img_material'] . "', '" . $list_sel['img_othermaterial'] . "',\n\t\t'" . $list_sel['course_demo'] . "', '" . $list_sel['mediumTime'] . "', '" . $list_sel['permCloseLO'] . "', '" . $list_sel['userStatusOp'] . "', '" . $list_sel['difficult'] . "', '" . $list_sel['show_progress'] . "', '" . $list_sel['show_time'] . "', '" . $list_sel['show_extra_info'] . "',\n\t\t'" . $list_sel['show_rules'] . "', '" . $list_sel['valid_time'] . "', '" . $list_sel['max_num_subscribe'] . "', '" . $list_sel['min_num_subscribe'] . "',\n\t\t'" . $list_sel['max_sms_budget'] . "', '" . $list_sel['selling'] . "', '" . $list_sel['prize'] . "', '" . $list_sel['course_type'] . "', '" . $list_sel['policy_point'] . "', '" . $list_sel['point_to_all'] . "', '" . $list_sel['course_edition'] . "', '" . $list_sel['classrooms'] . "', '" . $list_sel['certificates'] . "',\n\t\t'" . $list_sel['create_date'] . "', '" . $list_sel['security_code'] . "', '" . $list_sel['imported_from_connection'] . "', '" . $list_sel['course_quota'] . "', '" . $list_sel['used_space'] . "', '" . $list_sel['course_vote'] . "', '" . $list_sel['allow_overbooking'] . "', '" . $list_sel['can_subscribe'] . "',\n\t\t'" . $list_sel['sub_start_date'] . "', '" . $list_sel['sub_end_date'] . "', '" . $list_sel['advance'] . "', '" . $list_sel['show_who_online'] . "', '" . $list_sel['direct_play'] . "', '" . $list_sel['autoregistration_code'] . "', '" . $list_sel['use_logo_in_courselist'] . "' )";
    $result_ins = sql_query($query_ins);
    if (!$result_ins) {
        //Util::jump_to('index.php?modname=course&op=course_list&result=err_course');
        return false;
    }
    // the id of the new course created
    $new_course_dup = sql_insert_id();
    //Create the new course file
    $path = Get::sett('pathcourse');
    $path = '/appLms/' . Get::sett('pathcourse') . (substr($path, -1) != '/' && substr($path, -1) != '\\' ? '/' : '');
    require_once _base_ . '/lib/lib.upload.php';
    sl_open_fileoperations();
    foreach ($new_file_array as $file_info) {
        sl_copy($path . $file_info['old'], $path . $file_info['new']);
    }
    sl_close_fileoperations();
    // copy the old course menu into the new one
    $query_selmen = "SELECT *\n\tFROM " . $GLOBALS['prefix_lms'] . "_menucourse_main\n\tWHERE idCourse = '" . $id_dupcourse . "' ";
    $result_selmen = sql_query($query_selmen);
    while ($list_selmen = sql_fetch_array($result_selmen)) {
        $query_dupmen = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_menucourse_main " . " (idCourse, sequence, name, image) " . " VALUES " . " ( '" . $new_course_dup . "', '" . $list_selmen['sequence'] . "', '" . $list_selmen['name'] . "', '" . $list_selmen['image'] . "' )";
        $result_dupmen = sql_query($query_dupmen);
        $array_seq[$list_selmen['idMain']] = sql_insert_id();
    }
    $query_selmenun = "SELECT *\n\tFROM " . $GLOBALS['prefix_lms'] . "_menucourse_under\n\tWHERE idCourse = '" . $id_dupcourse . "' ";
    $result_selmenun = sql_query($query_selmenun);
    while ($list_selmenun = sql_fetch_array($result_selmenun)) {
        $valore_idn = $list_selmenun['idMain'];
        $_idMain = $array_seq[$valore_idn];
        $query_dupmen = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_menucourse_under\n\t\t(idMain, idCourse, sequence, idModule, my_name)\n\t\tVALUES\n\t\t('" . $_idMain . "', '" . $new_course_dup . "', '" . $list_selmenun['sequence'] . "', '" . $list_selmenun['idModule'] . "', '" . $list_selmenun['my_name'] . "')";
        $result_dupmen = sql_query($query_dupmen);
    }
    function &getCourseLevelSt($id_course)
    {
        $map = array();
        $levels = CourseLevel::getLevels();
        $acl_man =& $GLOBALS['current_user']->getAclManager();
        // find all the group created for this menu custom for permission management
        foreach ($levels as $lv => $name_level) {
            $group_info = $acl_man->getGroup(FALSE, '/lms/course/' . $id_course . '/subscribed/' . $lv);
            $map[$lv] = $group_info[ACL_INFO_IDST];
        }
        return $map;
    }
    function funAccess($functionname, $mode, $returnValue = false, $custom_mod_name = false)
    {
        return true;
    }
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.manmenu.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.subscribe.php';
    $docebo_course = new DoceboCourse($id_dupcourse);
    $subscribe_man = new CourseSubscribe_Manager();
    $group_idst =& $docebo_course->createCourseLevel($new_course_dup);
    $group_of_from =& $docebo_course->getCourseLevel($id_dupcourse);
    $perm_form =& createPermForCoursebis($group_of_from, $new_course_dup, $id_dupcourse);
    $levels = $subscribe_man->getUserLevel();
    foreach ($levels as $lv => $name_level) {
        foreach ($perm_form[$lv] as $idrole => $v) {
            if ($group_idst[$lv] != 0 && $idrole != 0) {
                $acl_man =& $GLOBALS['current_user']->getAclManager();
                $acl_man->addToRole($idrole, $group_idst[$lv]);
            }
        }
    }
    // duplicate the certificate assigned
    $query_selmenun = "SELECT *\n\tFROM " . $GLOBALS['prefix_lms'] . "_certificate_course\n\tWHERE id_course = '" . $id_dupcourse . "' ";
    $result_selmenun = sql_query($query_selmenun);
    while ($list_selmenun = sql_fetch_array($result_selmenun)) {
        $query_dupmen = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_certificate_course\n\t\t\t(id_certificate, id_course, available_for_status)\n\t\t\tVALUES\n\t\t\t('" . $list_selmenun['id_certificate'] . "', '" . $new_course_dup . "', '" . $list_selmenun['available_for_status'] . "' )";
        $result_dupmen = sql_query($query_dupmen);
    }
    require_once $GLOBALS['where_lms'] . '/modules/organization/orglib.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
    require_once $GLOBALS['where_lms'] . '/class.module/track.object.php';
    require_once $GLOBALS['where_lms'] . '/class.module/learning.object.php';
    function createLO($objectType, $idResource = NULL)
    {
        $query = "SELECT className, fileName FROM " . $GLOBALS['prefix_lms'] . "_lo_types WHERE objectType='" . $objectType . "'";
        $rs = sql_query($query);
        list($className, $fileName) = sql_fetch_row($rs);
        require_once $GLOBALS['where_lms'] . '/class.module/' . $fileName;
        $lo = new $className($idResource);
        return $lo;
    }
    $nullVal = NULL;
    $array_cor = array();
    $map_org = array();
    $tree_course = new OrgDirDb($id_dupcourse);
    $coll = $tree_course->getFoldersCollection($nullVal);
    while ($folder = $coll->getNext()) {
        //if($folder->otherValues[REPOFIELDIDRESOURCE] != 0 ) {
        if (!empty($folder->otherValues[REPOFIELDOBJECTTYPE])) {
            $lo = createLO($folder->otherValues[REPOFIELDOBJECTTYPE]);
            $id_nuovo_lo = $lo->copy($folder->otherValues[REPOFIELDIDRESOURCE]);
            $id_vecchio = $folder->otherValues[REPOFIELDIDRESOURCE];
            $query_selmenun = "SELECT * FROM\n\t\t\t" . $GLOBALS['prefix_lms'] . "_organization\n\t\t\tWHERE idCourse = '" . $id_dupcourse . "'\n\t\t\tAND idResource = '" . $id_vecchio . "' ";
            $result_selmenun = sql_query($query_selmenun);
            while ($list_selmenun = mysql_fetch_array($result_selmenun)) {
                $query_dupmen = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_organization\n\t\t\t\t(idParent, path, lev, title,\n\t\t\t\tobjectType, idResource, idCategory, idUser, idAuthor,\n\t\t\t\tversion, difficult, description, language, resource,\n\t\t\t\tobjective, dateInsert, idCourse, prerequisites, isTerminator,\n\t\t\t\tidParam, visible, milestone)\n\t\t\t\tVALUES\n\t\t\t\t('" . (isset($map_org[$list_selmenun['idParent']]) ? $map_org[$list_selmenun['idParent']] : 0) . "', '" . $list_selmenun['path'] . "', '" . $list_selmenun['lev'] . "', '" . $list_selmenun['title'] . "',\n\t\t\t\t'" . $list_selmenun['objectType'] . "', '" . $id_nuovo_lo . "', '" . $list_selmenun['idCategory'] . "', '" . $list_selmenun['idUser'] . "', '" . $list_selmenun['idAuthor'] . "',\n\t\t\t\t'" . $list_selmenun['version'] . "', '" . $list_selmenun['difficult'] . "', '" . $list_selmenun['description'] . "', '" . $list_selmenun['language'] . "', '" . $list_selmenun['resource'] . "',\n\t\t\t\t'" . $list_selmenun['objective'] . "', '" . $list_selmenun['dateInsert'] . "', '" . $new_course_dup . "', '" . $list_selmenun['prerequisites'] . "', '" . $list_selmenun['isTerminator'] . "',\n\t\t\t\t'" . $list_selmenun['idParam'] . "', '" . $list_selmenun['visible'] . "', '" . $list_selmenun['milestone'] . "')";
                $result_dupmen = sql_query($query_dupmen);
                $id_org = $list_selmenun['idOrg'];
                $id_last = sql_insert_id();
                $array_cor[$id_org] = $id_last;
                $query_lo_par = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_lo_param\n\t\t\t\t(param_name, param_value)\n\t\t\t\tVALUES\n\t\t\t\t('idReference', '" . $id_last . "') ";
                $result_lo_par = sql_query($query_lo_par);
                $id_lo_par = sql_insert_id();
                $query_up_lo = "UPDATE " . $GLOBALS['prefix_lms'] . "_lo_param\n\t\t\t\tSET idParam = '" . $id_lo_par . "'\n\t\t\t\tWHERE id = '" . $id_lo_par . "' ";
                $result_up_lo = sql_query($query_up_lo);
                $query_up_or = "UPDATE " . $GLOBALS['prefix_lms'] . "_organization\n\t\t\t\tSET\tidParam = '" . $id_lo_par . "'\n\t\t\t\tWHERE idOrg = '" . $id_last . "' ";
                $result_up_or = sql_query($query_up_or);
            }
        } else {
            // copy folder
            echo $id_vecchio = $folder->id;
            $query_selmenun = "SELECT * FROM\n\t\t\t" . $GLOBALS['prefix_lms'] . "_organization\n\t\t\tWHERE idCourse = '" . $id_dupcourse . "'\n\t\t\tAND idOrg = '" . $id_vecchio . "' ";
            $result_selmenun = sql_query($query_selmenun);
            $list_selmenun = mysql_fetch_array($result_selmenun);
            $query_dupmen = " INSERT INTO " . $GLOBALS['prefix_lms'] . "_organization\n\t\t\t(idParent, path, lev, title,\n\t\t\tobjectType, idResource, idCategory, idUser, idAuthor,\n\t\t\tversion, difficult, description, language, resource,\n\t\t\tobjective, dateInsert, idCourse, prerequisites, isTerminator,\n\t\t\tidParam, visible, milestone)\n\t\t\tVALUES\n\t\t\t('" . (isset($map_org[$list_selmenun['idParent']]) ? $map_org[$list_selmenun['idParent']] : 0) . "', '" . $list_selmenun['path'] . "', '" . $list_selmenun['lev'] . "', '" . $list_selmenun['title'] . "',\n\t\t\t'" . $list_selmenun['objectType'] . "', '" . $id_nuovo_lo . "', '" . $list_selmenun['idCategory'] . "', '" . $list_selmenun['idUser'] . "', '" . $list_selmenun['idAuthor'] . "',\n\t\t\t'" . $list_selmenun['version'] . "', '" . $list_selmenun['difficult'] . "', '" . $list_selmenun['description'] . "', '" . $list_selmenun['language'] . "', '" . $list_selmenun['resource'] . "',\n\t\t\t'" . $list_selmenun['objective'] . "', '" . $list_selmenun['dateInsert'] . "', '" . $new_course_dup . "', '" . $list_selmenun['prerequisites'] . "', '" . $list_selmenun['isTerminator'] . "',\n\t\t\t'" . $list_selmenun['idParam'] . "', '" . $list_selmenun['visible'] . "', '" . $list_selmenun['milestone'] . "')";
            $result_dupmen = sql_query($query_dupmen);
            $map_org[$id_vecchio] = sql_insert_id();
        }
    }
    $query_cor = "SELECT *\n\tFROM " . $GLOBALS['prefix_lms'] . "_organization\n\tWHERE\n\tidCourse = '" . $new_course_dup . "'\n\tAND prerequisites !='' ";
    $result_cor = sql_query($query_cor);
    while ($list_cor = sql_fetch_array($result_cor)) {
        $id_orgup = $list_cor['prerequisites'];
        $arr_pre = explode(",", $id_orgup);
        for ($i = 0; $i < sizeof($arr_pre); $i++) {
            $arr_pre[$i] = str_replace(intval($arr_pre[$i]), $array_cor[intval($arr_pre[$i])], $arr_pre[$i]);
        }
        $query_updcor = "UPDATE " . $GLOBALS['prefix_lms'] . "_organization\n\t\t\tSET prerequisites = '";
        for ($i = 0; $i < sizeof($arr_pre); $i++) {
            if ($i != 0) {
                $query_updcor .= ",";
            }
            $query_updcor .= $arr_pre[$i];
        }
        $query_updcor .= "' WHERE idOrg = '" . $list_cor['idOrg'] . "' ";
        $result_upcor = sql_query($query_updcor);
    }
    $query_selmenun = "SELECT * FROM\n\t" . $GLOBALS['prefix_lms'] . "_forum\n\tWHERE idCourse = '" . $id_dupcourse . "' ";
    $result_selmenun = sql_query($query_selmenun);
    while ($list_selmenun = sql_fetch_array($result_selmenun)) {
        $query_dupmen = "INSERT INTO\n\t\t" . $GLOBALS['prefix_lms'] . "_forum\n\t\t(idCourse, title, description, locked, sequence, emoticons)\n\t\tVALUES\n\t\t('" . $new_course_dup . "', '" . $list_selmenun['title'] . "', '" . $list_selmenun['description'] . "',\n\t\t'" . $list_selmenun['locked'] . "', '" . $list_selmenun['sequence'] . "', '" . $list_selmenun['emoticons'] . "')";
        $result_dupmen = sql_query($query_dupmen);
    }
    $query_selmenun = "SELECT * FROM\n\t" . $GLOBALS['prefix_lms'] . "_coursereport\n\tWHERE id_course = '" . $id_dupcourse . "' ";
    $sql2 = $query_selmenun;
    $result_selmenun = sql_query($query_selmenun);
    while ($list_selmenun = sql_fetch_array($result_selmenun)) {
        if (!isset($array_organization[$list_selmenun['id_source']]) or $array_organization[$list_selmenun['id_source']] == "") {
            $array_organization[$list_selmenun['id_source']] = 0;
        }
        $query_dupmen = "INSERT INTO\n\t\t" . $GLOBALS['prefix_lms'] . "_coursereport\n\t\t(id_course,title,max_score,required_score,weight,show_to_user,use_for_final,sequence,source_of,id_source)\n\t\tVALUES\n\t\t('" . $new_course_dup . "', '" . $list_selmenun['title'] . "', '" . $list_selmenun['max_score'] . "',\n\t\t'" . $list_selmenun['required_score'] . "', '" . $list_selmenun['weight'] . "', '" . $list_selmenun['show_to_user'] . "', '" . $list_selmenun['use_for_final'] . "', '" . $list_selmenun['sequence'] . "', '" . $list_selmenun['source_of'] . "', '" . $array_organization[$list_selmenun['id_source']] . "')";
        $sql2 = $query_dupmen;
        $result_dupmen = sql_query($query_dupmen);
    }
    $query_selmenun = "SELECT *\n\tFROM " . $GLOBALS['prefix_lms'] . "_htmlfront\n\tWHERE id_course = '" . $id_dupcourse . "' ";
    $result_selmenun = sql_query($query_selmenun);
    while ($list_selmenun = sql_fetch_array($result_selmenun)) {
        $query_dupmen = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_htmlfront\n\t\t(id_course, textof)\n\t\tVALUES\n\t\t('" . $new_course_dup . "', '" . mysql_escape_string($list_selmenun['textof']) . "')";
        $result_dupmen = sql_query($query_dupmen);
    }
    //Util::jump_to('index.php?modname=course&amp;op=course_list&result=ok_course');
    return true;
}