function organization_categorize_save(&$treeView, $idItem) { require_once _lms_ . '/lib/lib.kbres.php'; $folder = $treeView->tdb->getFolderById($idItem); $data = $folder->otherValues; $res_id = Get::req('res_id', DOTY_INT, 0); $name = Get::req('r_name', DOTY_STRING, ""); $original_name = Get::req('original_name', DOTY_STRING, ""); $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, "[]")); $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); $json_tags = str_replace("[", "", $json_tags); $json_tags = str_replace("]", "", $json_tags); $json_tags = str_replace('"', "", $json_tags); $json_tags = str_replace("\\", "", $json_tags); $tags_arr = explode(",", $json_tags); if ($res_id > 0) { $kbres->setResourceTags($res_id, $tags_arr); $kbres->assignToFolders($res_id, explode(',', $folders)); } }
function getLmsLangFlags() { $lang =& DoceboLanguage::createInstance('blind_navigation'); $blind_link = "<li><a href=\"#lang_box\">" . $lang->def("_LANG_SELECT") . "</a></li>"; $GLOBALS["page"]->add($blind_link, "blind_navigation"); $all_lang = Docebo::langManager()->getAllLangCode(); if (!is_array($all_lang)) { return ''; } $res = '<ul id="lang_box">'; foreach ($all_lang as $k => $lang_code) { $res .= '<a href="index.php?sop=changelang&new_lang=' . $lang_code . '" title="' . $lang_code . '">' . '<img src="' . getPathImage('fw') . 'language/' . $lang_code . '.png" alt="' . $lang_code . '" /></a>'; } $res .= '</ul>'; return $res; }
public function getInitData($js = true) { //produces languages' list variable $temp1 = array('{ id: "standard", value: "[ ' . addslashes(Lang::t('_DEFAULT_LANGUAGE')) . ' ]" }'); foreach (Docebo::langManager()->getAllLanguages() as $lang) { $temp1[] = '{ id: "' . $lang[0] . '", value: "' . addslashes($lang[0] . ' (' . $lang[1] . ')') . '" }'; } //produce admin levels list $temp2 = array(); $arr_admin_levels = $this->acl_man->getAdminLevels(); foreach ($arr_admin_levels as $lev => $idst) { $temp2[] = '{ id: "' . $lev . '", value: "' . addslashes(Lang::t('_DIRECTORY_' . $lev, 'admin_directory')) . '" }'; } if (!$js) { $output = array('languages' => $temp1, 'levels' => $temp2); } else { $js_langs = "[" . implode(",", $temp1) . "]"; $js_levels = "[" . implode(",", $temp2) . "]"; $output = array('languages' => $js_langs, 'levels' => $js_levels); } return $output; }
function homerepo_itemproperties(&$treeView, &$arrayData, $idItem) { //function loadFields( $arrayData, &$lo, $idLO ) { $lang =& DoceboLanguage::createInstance('homerepo', 'lms'); $langClassification =& DoceboLanguage::createInstance('classification', 'lms'); $GLOBALS['page']->add('<form id="manHomerepo" method="post"' . ' action="index.php?' . $_SERVER['QUERY_STRING'] . '"' . ' >' . "\n" . '<input type="hidden" id="authentic_request_hrs" name="authentic_request" value="' . Util::getSignature() . '" />'); $GLOBALS['page']->add('<div class="std_block">'); $GLOBALS['page']->add($treeView->printState()); global $defaultLanguage; //including language //includeLang("classification"); //finding category $reCategory = sql_query("\r\n\tSELECT idCategory, title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_coursecategory\r\n\tORDER BY title"); //searching languages /*$langl = dir('menu/language/'); while($ele = $langl->read()) if(ereg("lang-",$ele)) { $langArray[] = ereg_replace("lang-","",ereg_replace(".php","",$ele)); } closedir($langl->handle); sort($langArray);*/ $langArray = Docebo::langManager()->getAllLangCode(); if (!isset($_POST['idItem'])) { if ($idItem !== NULL) { $folder = $treeView->tdb->getFolderById($idItem); $GLOBALS['page']->add('<input type="hidden" name="idItem" id="idItem" value="' . $idItem . '" />'); $title = $folder->otherValues[REPOFIELDTITLE]; $arrayData['version'] = $folder->otherValues[REPOFIELDVERSION]; $arrayData['difficult'] = $folder->otherValues[REPOFIELDDIFFICULT]; $arrayData['language'] = $folder->otherValues[REPOFIELDLANGUAGE]; $arrayData['resource'] = $folder->otherValues[REPOFIELDRESOURCE]; $arrayData['objective'] = $folder->otherValues[REPOFIELDOBJECTIVE]; } } else { $GLOBALS['page']->add('<input type="hidden" name="idItem" id="idItem" value="' . $idItem . '" />'); $title = $_POST['title']; } // ========================================================== $GLOBALS['page']->add('<input type="hidden" name="title" id="title" value="' . $title . '" />'); $GLOBALS['page']->add('<div class="ObjectForm">'); $GLOBALS['page']->add('<span class="mainTitle">' . $langClassification->def('_CATEGORIZATION') . ' ' . $title . '</span><br /><br />'); $GLOBALS['page']->add('</div>'); //------------------------------------------------- /* .'<div class="title">'._CATEGORY.'</div>' .'<div class="content">' .'<select name="idCategory">'; if( isset($arrayData['idCategory']) ) $selectedIdCat = $arrayData['idCategory']; else $selectedIdCat = ""; while(list($idCat, $catTitle) = sql_fetch_row($reCategory)) { if( $selectedIdCat == $idCat ) echo '<option value="'.$idCat.'" selected >'.$catTitle.'</option>'; else echo '<option value="'.$idCat.'">'.$catTitle.'</option>'; } echo '</select> ( '.sql_num_rows($reCategory).' '._DISP.')' .'</div>'*/ //------------------------------------------------- $GLOBALS['page']->add('<div class="title">' . $langClassification->def('_VERSION') . '</div>' . '<div class="content">'); if (isset($arrayData['version'])) { $GLOBALS['page']->add('<input type="text" name="version" maxlength="8" size="10" value="' . $arrayData['version'] . '" />'); } else { $GLOBALS['page']->add('<input type="text" name="version" maxlength="8" size="10" value="1.0" />'); } $GLOBALS['page']->add('</div>' . '<div class="title">' . $langClassification->def('_DIFFICULTY') . '</div>' . '<div class="content">' . '<select name="difficult">'); if (isset($arrayData['difficult'])) { $selDiff = $arrayData['difficult']; switch ($selDiff) { case '_DIFFICULT_VERYEASY': $selDiff = "1"; break; case '_DIFFICULT_EASY': $selDiff = "2"; break; case '_DIFFICULT_MEDIUM': $selDiff = "3"; break; case '_DIFFICULT_DIFFICULT': $selDiff = "4"; break; case '_DIFFICULT_VERYDIFFICULT': $selDiff = "5"; break; } } else { $selDiff = ""; } $GLOBALS['page']->add('<option value="1" ' . ($selDiff == "1" ? 'selected' : '') . ' >' . $langClassification->def('_DIFFICULT_VERYEASY') . '</option>' . '<option value="2" ' . ($selDiff == "2" ? 'selected' : '') . ' >' . $langClassification->def('_DIFFICULT_EASY') . '</option>' . '<option value="3" ' . ($selDiff == "3" ? 'selected' : '') . ' >' . $langClassification->def('_DIFFICULT_MEDIUM') . '</option>' . '<option value="4" ' . ($selDiff == "4" ? 'selected' : '') . ' >' . $langClassification->def('_DIFFICULT_DIFFICULT') . '</option>' . '<option value="5" ' . ($selDiff == "5" ? 'selected' : '') . ' >' . $langClassification->def('_DIFFICULT_VERYDIFFICULT') . '</option>' . '</select>' . '</div>'); //------------------------------------------------- /*.'<div class="title">'._DESCRIPTION.'</div>' .'<div class="content">' .'<div id="breakfloat">' .'<textarea id="description" name="description" rows="10" cols="75"></textarea></div>' .'</div>'*/ //------------------------------------------------- $GLOBALS['page']->add('<div class="title">' . $langClassification->def('_LANGUAGE') . '</div>' . '<div class="content">' . '<select name="language">'); if (isset($arrayData['language'])) { $selLang = $arrayData['language']; } else { $selLang = $defaultLanguage; } while (list(, $valueLang) = each($langArray)) { $GLOBALS['page']->add('<option value="' . $valueLang . '"'); if ($valueLang == $selLang) { $GLOBALS['page']->add(' selected="selected"'); } $GLOBALS['page']->add('>' . $valueLang . '</option>'); } $GLOBALS['page']->add('</select>' . '</div>' . '<div class="title">' . $langClassification->def('_RESOURCE') . '</div>' . '<div class="content">'); if (isset($arrayData['resource'])) { $GLOBALS['page']->add('<input type="text" name="resource" maxlength="255" size="60" value="' . $arrayData['resource'] . '" />'); } else { $GLOBALS['page']->add('<input type="text" name="resource" maxlength="255" size="60" value="http://" />'); } $GLOBALS['page']->add('</div>' . '<div class="title">' . $langClassification->def('_OBJECTIVE') . '</div>' . '<div class="content">'); if (isset($arrayData['objective'])) { $GLOBALS['page']->add('<textarea name="objective" rows="6" cols="75">' . $arrayData['objective'] . '</textarea>'); } else { $GLOBALS['page']->add('<textarea name="objective" rows="6" cols="75"></textarea>'); } $GLOBALS['page']->add('<br />'); $GLOBALS['page']->add('<img src="' . $treeView->_getSaveImage() . '" alt="' . $lang->def('_SAVE') . '" /> ' . '<input type="submit" value="' . $lang->def('_SAVE') . '" class="LVAction"' . ' name="' . $treeView->_getOpSaveFile() . '" />'); $GLOBALS['page']->add(' <img src="' . $treeView->_getCancelImage() . '" alt="' . $treeView->_getCancelAlt() . '" />' . '<input type="submit" class="LVAction" value="' . $treeView->_getCancelLabel() . '"' . ' name="' . $treeView->_getCancelId() . '" id="' . $treeView->_getCancelId() . '" />'); $GLOBALS['page']->add('</div>'); $GLOBALS['page']->add('</div>'); $GLOBALS['page']->add('</form>'); }
public function getPolicyTranslations($id_policy) { $output = false; $query = "SELECT * FROM %adm_privacypolicy_lang WHERE id_policy=" . (int) $id_policy; $res = $this->db->query($query); if ($res && $this->db->num_rows($res) > 0) { //initialize output $lang_codes = Docebo::langManager()->getAllLangCode(); $output = array(); foreach ($lang_codes as $lang_code) { $output[$lang_code] = ""; } //read values from DB and prepare output while ($obj = $this->db->fetch_obj($res)) { if (isset($output[$obj->lang_code])) { $output[$obj->lang_code] = $obj->translation; } } } return $output; }
function _step0() { // ---- name ----- $out = $this->form->getTextfield($this->lang->def('_NAME'), $this->_get_base_name() . '_name', $this->_get_base_name() . '[name]', 255, $this->post_params['name']); // ---- description ----- $out .= $this->form->getSimpleTextarea($this->lang->def('_DESCRIPTION'), $this->_get_base_name() . '_description', $this->_get_base_name() . '[description]', $this->post_params['description']); // ---- access type read/write ----- $out .= $this->form->getRadioSet($this->lang->def('_ACCESSTYPE'), $this->_get_base_name() . '_readwrite', $this->_get_base_name() . '[readwrite]', array($this->lang->def('_READ') => '1', $this->lang->def('_WRITE') => '2', $this->lang->def('_READWRITE') => '3'), $this->post_params['readwrite']); // ---- remove or not folders ---- $out .= $this->form->getRadioSet($this->lang->def('_CANCELED_FOLDER'), $this->_get_base_name() . '_canceled', $this->_get_base_name() . '[canceled]', array($this->lang->def('_DONTDELETE') => '1', $this->lang->def('_DEL') => '2'), $this->post_params['canceled']); // ---- default lang ---- $languages = Docebo::langManager()->getAllLangCode(); $lang_key = array(); for ($index = 0; $index < count($languages); $index++) { $lang_key[$languages[$index]] = $languages[$index]; } $out .= $this->form->getDropdown($this->lang->def('_LANGUAGE'), $this->_get_base_name() . 'default_lang', $this->_get_base_name() . '[default_lang]', $lang_key, $this->post_params['default_lang']); return $out; }
public function mod() { if (!$this->permissions['mod']) { $this->render('invalid', array('message' => $this->_getMessage('no permission'), 'back_url' => 'index.php?r=alms/label/show')); return; } $id_common_label = Get::req('id_common_label', DOTY_INT, 0); if (isset($_POST['undo'])) { Util::jump_to('index.php?r=alms/label/show'); } $all_languages = Docebo::langManager()->getAllLangCode(); $res = true; if (isset($_POST['update'])) { require_once _base_ . '/lib/lib.upload.php'; $path = '/appLms/label/'; if (isset($_POST['del_label_image'])) { $file_name = $this->model->getLabelFile($id_common_label); if ($file_name !== '' && sl_file_exists($path . $file_name)) { sl_open_fileoperations(); sl_unlink($path . $file_name); sl_close_fileoperations(); } $file_name = ''; } else { $file_name = $this->model->getLabelFile($id_common_label); } if ($_FILES['label_image']['error'] == 0) { $extension = end(explode('.', $_FILES['label_image']['name'])); $file_name = 'label_image_' . $id_common_label . '.' . $extension; sl_open_fileoperations(); $file_name_del = $this->model->getLabelFile($id_common_label); if ($file_name_del !== '' && sl_file_exists($path . $file_name_del)) { sl_unlink($path . $file_name_del); } sl_upload($_FILES['label_image']['tmp_name'], $path . $file_name); sl_close_fileoperations(); } foreach ($all_languages as $lang_code) { $title = Get::req($lang_code . '_title', DOTY_MIXED, ''); $description = Get::req($lang_code . '_description', DOTY_MIXED, ''); $tmp_res = $this->model->updateLabel($id_common_label, $lang_code, $title, $description, $file_name); if (!$tmp_res) { $res = false; } } if ($res) { Util::jump_to('index.php?r=alms/label/show&res=_ok_mod'); } Util::jump_to('index.php?r=alms/label/show&err=_err_mod'); } $label_info = $this->model->getLabelInfo($id_common_label); $params = array('model' => $this->model, 'all_languages' => $all_languages, 'label_info' => $label_info, 'id_common_label' => $id_common_label); $this->render('mod', $params); }
public function upCourse() { require_once _base_ . '/lib/lib.upload.php'; require_once _base_ . '/lib/lib.multimedia.php'; require_once _lms_ . '/lib/lib.course.php'; require_once _lms_ . '/lib/lib.manmenu.php'; $array_lang = Docebo::langManager()->getAllLangCode(); $array_lang[] = 'none'; $acl_man =& Docebo::user()->getAclManager(); $id_course = Get::req('id_course', DOTY_INT, 0); require_once _lms_ . '/admin/models/LabelAlms.php'; $label_model = new LabelAlms(); $label = Get::req('label', DOTY_INT, 0); $label_model->associateLabelToCourse($label, $id_course); // calc quota limit $quota = $_POST['course_quota']; if (isset($_POST['inherit_quota'])) { $quota = Get::sett('course_quota'); $_POST['course_quota'] = COURSE_QUOTA_INHERIT; } $quota = $quota * 1024 * 1024; $course_man = new DoceboCourse($id_course); $used = $course_man->getUsedSpace(); if ($_POST['course_name'] == '') { $_POST['course_name'] = Lang::t('_NO_NAME', 'course', 'lms'); } // restriction on course status ------------------------------------------ $user_status = 0; if (isset($_POST['user_status'])) { while (list($status) = each($_POST['user_status'])) { $user_status |= 1 << $status; } } // level that will be showed in the course -------------------------------- $show_level = 0; if (isset($_POST['course_show_level'])) { while (list($lv) = each($_POST['course_show_level'])) { $show_level |= 1 << $lv; } } // save the file uploaded ------------------------------------------------- $error = false; $quota_exceeded = false; $path = Get::sett('pathcourse'); $path = '/appLms/' . Get::sett('pathcourse') . (substr($path, -1) != '/' && substr($path, -1) != '\\' ? '/' : ''); $old_file_size = 0; if (is_array($_FILES) && !empty($_FILES) || is_array($_POST["file_to_del"])) { sl_open_fileoperations(); } // load user material --------------------------------------------------------------------------- $arr_file = $this->manageCourseFile('course_user_material', $_POST["old_course_user_material"], $path, $quota != 0 ? $quota - $used : false, isset($_POST['file_to_del']['course_user_material'])); $error |= $arr_file['error']; $quota_exceeded |= $arr_file['quota_exceeded']; $file_material = $arr_file['filename']; $used = $used + ($arr_file['new_size'] - $arr_file['old_size']); $old_file_size += $arr_file['old_size']; // course otheruser material ------------------------------------------------------------------- $arr_file = $this->manageCourseFile('course_otheruser_material', $_POST["old_course_otheruser_material"], $path, $quota != 0 ? $quota - $used : false, isset($_POST['file_to_del']['course_otheruser_material'])); $error |= $arr_file['error']; $quota_exceeded |= $arr_file['quota_exceeded']; $file_othermaterial = $arr_file['filename']; $used = $used + ($arr_file['new_size'] - $arr_file['old_size']); $old_file_size += $arr_file['old_size']; // course demo----------------------------------------------------------------------------------- $arr_file = $this->manageCourseFile('course_demo', $_POST["old_course_demo"], $path, $quota != 0 ? $quota - $used : false, isset($_POST['file_to_del']['course_demo'])); $error |= $arr_file['error']; $quota_exceeded |= $arr_file['quota_exceeded']; $file_demo = $arr_file['filename']; $used = $used + ($arr_file['new_size'] - $arr_file['old_size']); $old_file_size += $arr_file['old_size']; // course sponsor--------------------------------------------------------------------------------- $arr_file = $this->manageCourseFile('course_sponsor_logo', $_POST["old_course_sponsor_logo"], $path, $quota != 0 ? $quota - $used : false, isset($_POST['file_to_del']['course_sponsor_logo']), true); $error |= $arr_file['error']; $quota_exceeded |= $arr_file['quota_exceeded']; $file_sponsor = $arr_file['filename']; $used = $used + ($arr_file['new_size'] - $arr_file['old_size']); $old_file_size += $arr_file['old_size']; // course logo----------------------------------------------------------------------------------- $arr_file = $this->manageCourseFile('course_logo', $_POST["old_course_logo"], $path, $quota != 0 ? $quota - $used : false, isset($_POST['file_to_del']['course_logo']), true); $error |= $arr_file['error']; $quota_exceeded |= $arr_file['quota_exceeded']; $file_logo = $arr_file['filename']; $used = $used + ($arr_file['new_size'] - $arr_file['old_size']); $old_file_size += $arr_file['old_size']; // ---------------------------------------------------------------------------------------------- sl_close_fileoperations(); $date_begin = Format::dateDb($_POST['course_date_begin'], "date"); $date_end = Format::dateDb($_POST['course_date_end'], "date"); if ($_POST["can_subscribe"] == "2") { $sub_start_date = Format::dateDb($_POST["sub_start_date"], "date"); $sub_end_date = Format::dateDb($_POST["sub_end_date"], "date"); } $hour_begin = '-1'; $hour_end = '-1'; if ($_POST['hour_begin']['hour'] != '-1') { $hour_begin = strlen($_POST['hour_begin']['hour']) == 1 ? '0' . $_POST['hour_begin']['hour'] : $_POST['hour_begin']['hour']; if ($_POST['hour_begin']['quarter'] == '-1') { $hour_begin .= ':00'; } else { $hour_begin .= ':' . $_POST['hour_begin']['quarter']; } } if ($_POST['hour_end']['hour'] != '-1') { $hour_end = strlen($_POST['hour_end']['hour']) == 1 ? '0' . $_POST['hour_end']['hour'] : $_POST['hour_end']['hour']; if ($_POST['hour_end']['quarter'] == '-1') { $hour_end .= ':00'; } else { $hour_end .= ':' . $_POST['hour_end']['quarter']; } } // update database ---------------------------------------------------- $query_course = "\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_course\n\t\tSET code \t\t\t\t= '" . $_POST['course_code'] . "',\n\t\t\tname \t\t\t\t= '" . $_POST['course_name'] . "',\n\t\t\tidCategory \t\t\t= '" . (int) $_POST['idCategory'] . "',\n\t\t\tdescription \t\t= '" . $_POST['course_descr'] . "',\n\t\t\tlang_code \t\t\t= '" . $array_lang[$_POST['course_lang']] . "',\n\t\t\tstatus \t\t\t\t= '" . (int) $_POST['course_status'] . "',\n\t\t\tlevel_show_user \t= '" . $show_level . "',\n\t\t\tsubscribe_method \t= '" . (int) $_POST['course_subs'] . "',\n\t\t\tidCategory\t\t\t= '" . (int) $_POST['idCategory'] . "',\n\t\t\tcredits\t\t\t\t= '" . (int) $_POST['credits'] . "',\n\n\t\t\tlinkSponsor \t\t= '" . $_POST['course_sponsor_link'] . "',\n\n\t\t\timgSponsor \t\t\t= '" . $file_sponsor . "',\n\t\t\timg_course \t\t\t= '" . $file_logo . "',\n\t\t\timg_material \t\t= '" . $file_material . "',\n\t\t\timg_othermaterial \t= '" . $file_othermaterial . "',\n\t\t\tcourse_demo \t\t= '" . $file_demo . "',\n\n\t\t\tmediumTime \t\t\t= '" . $_POST['course_medium_time'] . "',\n\t\t\tpermCloseLO \t\t= '" . $_POST['course_em'] . "',\n\t\t\tuserStatusOp \t\t= '" . $user_status . "',\n\t\t\tdifficult \t\t\t= '" . $_POST['course_difficult'] . "',\n\n\t\t\tshow_progress \t\t= '" . (isset($_POST['course_progress']) ? 1 : 0) . "',\n\t\t\tshow_time \t\t\t= '" . (isset($_POST['course_time']) ? 1 : 0) . "',\n\n\t\t\tshow_who_online\t\t= '" . $_POST['show_who_online'] . "',\n\n\t\t\tshow_extra_info \t= '" . (isset($_POST['course_advanced']) ? 1 : 0) . "',\n\t\t\tshow_rules \t\t\t= '" . (int) $_POST['course_show_rules'] . "',\n\n\t\t\tdirect_play \t\t= '" . (isset($_POST['direct_play']) ? 1 : 0) . "',\n\n\t\t\tdate_begin \t\t\t= '" . $date_begin . "',\n\t\t\tdate_end \t\t\t= '" . $date_end . "',\n\t\t\thour_begin \t\t\t= '" . $hour_begin . "',\n\t\t\thour_end \t\t\t= '" . $hour_end . "',\n\n\t\t\tvalid_time \t\t\t= '" . (int) $_POST['course_day_of'] . "',\n\n\t\t\tmin_num_subscribe \t= '" . (int) $_POST['min_num_subscribe'] . "',\n\t\t\tmax_num_subscribe \t= '" . (int) $_POST['max_num_subscribe'] . "',\n\n\t\t\tcourse_type \t\t= '" . $_POST['course_type'] . "',\n\t\t\tpoint_to_all \t\t= '" . (isset($_POST['point_to_all']) ? $_POST['point_to_all'] : 0) . "',\n\t\t\tcourse_edition \t\t= '" . (isset($_POST['course_edition']) ? $_POST['course_edition'] : 0) . "',\n\t\t\tselling \t\t\t= '" . (isset($_POST['course_sell']) ? 1 : 0) . "',\n\t\t\tprize \t\t\t\t= '" . (isset($_POST['course_prize']) ? $_POST['course_prize'] : 0) . "',\n\t\t\tpolicy_point \t\t= '" . $_POST['policy_point'] . "',\n\n\t\t\tcourse_quota \t\t= '" . $_POST['course_quota'] . "',\n\n\t\t\tallow_overbooking \t= '" . (isset($_POST["allow_overbooking"]) ? 1 : 0) . "',\n\t\t\tcan_subscribe \t\t= '" . (int) $_POST["can_subscribe"] . "',\n\t\t\tsub_start_date \t\t= " . ($_POST["can_subscribe"] == "2" ? "'" . $sub_start_date . "'" : 'NULL') . ",\n\t\t\tsub_end_date \t\t= " . ($_POST["can_subscribe"] == "2" ? "'" . $sub_end_date . "'" : 'NULL') . ",\n\n\t\t\tadvance \t\t\t= '" . $_POST['advance'] . "',\n\t\t\tshow_result \t\t= '" . (isset($_POST['show_result']) ? 1 : 0) . "',\n\n\n\t\t\tuse_logo_in_courselist = '" . (isset($_POST['use_logo_in_courselist']) ? '1' : '0') . "',\n\n\t\t\tauto_unsubscribe = '" . (int) $_POST['auto_unsubscribe'] . "',\n\t\t\tunsubscribe_date_limit = " . (isset($_POST['use_unsubscribe_date_limit']) && $_POST['use_unsubscribe_date_limit'] > 0 ? "'" . Format::dateDb($_POST['unsubscribe_date_limit'], 'date') . "'" : 'NULL') . ""; if (isset($_POST['random_course_autoregistration_code'])) { $control = 1; $str = ''; while ($control) { for ($i = 0; $i < 10; $i++) { $seed = mt_rand(0, 10); if ($seed > 5) { $str .= mt_rand(0, 9); } else { $str .= chr(mt_rand(65, 90)); } } $control_query = "SELECT COUNT(*)" . " " . $GLOBALS['prefix_lms'] . "_course" . " WHERE autoregistration_code = '" . $str . "'" . " AND idCourse <> '" . $id_course . "'"; $control_result = sql_query($control_query); list($result) = sql_fetch_row($control_result); $control = $result; } $query_course .= ", autoregistration_code = '" . $str . "'"; } else { $query_course .= ", autoregistration_code = '" . $_POST['course_autoregistration_code'] . "'"; } $query_course .= " WHERE idCourse = '" . $id_course . "'"; if (!sql_query($query_course)) { if ($file_sponsor != '') { sl_unlink($path . $file_sponsor); } if ($file_logo != '') { sl_unlink($path . $file_logo); } if ($file_material != '') { sl_unlink($path . $file_material); } if ($file_othermaterial != '') { sl_unlink($path . $file_othermaterial); } if ($file_demo != '') { sl_unlink($path . $file_demo); } $course_man->subFileToUsedSpace(false, $old_file_size); return array('err' => '_err_course'); } // cascade modify on all the edition of the course if (isset($_POST['cascade_on_ed']) && $id_course > 0) { $cinfo = $this->getInfo($id_course); $has_editions = $cinfo['course_edition'] > 0; $has_classrooms = $cinfo['course_type'] == 'classroom'; if ($has_editions) { $query_editon = "UPDATE %lms_course_editions " . " SET code = '" . $_POST['course_code'] . "', " . " name = '" . $_POST['course_name'] . "', " . " description = '" . $_POST['course_descr'] . "' " . " WHERE id_course = '" . $id_course . "' "; sql_query($query_editon); } if ($has_classrooms) { $query_editon = "UPDATE %lms_course_date " . " SET code = '" . $_POST['course_code'] . "', " . " name = '" . $_POST['course_name'] . "', " . " description = '" . $_POST['course_descr'] . "' " . " WHERE id_course = '" . $id_course . "' "; sql_query($query_editon); } } $res = array(); if ($quota_exceeded) { $res['limit_reach'] = 1; } //AUTO SUBSCRIPTION $userId = Docebo::user()->getIdSt(); $userSubscribed = $this->isUserSubscribedInCourse($userId, $id_course); if (intval($userSubscribed[0]) <= 0) { if (isset($_POST['auto_subscription']) && $_POST['auto_subscription'] == 1) { if (!$this->autoUserRegister($userId, $id_course)) { die('Error during autosubscription'); } } } $res['res'] = '_ok_course'; return $res; }
/** * @return bool true if the operation was successfull false otherwise * * @access public */ function saveElement($regroup) { if ($regroup == 'templ_man') { return $this->_saveTemplateManager(); } if ($regroup == 'suiteman') { return $this->_saveSuiteManager(); } $reSetting = sql_query("\r\n\t\tSELECT param_name, value_type, extra_info\r\n\t\tFROM " . $this->table . "\r\n\t\tWHERE regroup = '" . $regroup . "' AND hide_in_modify = '0'"); $re = true; while (list($var_name, $value_type, $extra_info) = sql_fetch_row($reSetting)) { switch ($value_type) { case "menuvoice": require_once $GLOBALS['where_framework'] . '/lib/lib.menu.php'; $menu_man = new MenuManager(); if (isset($_POST['option'][$var_name]) && $_POST['option'][$var_name] == 1) { $menu_man->addPerm(ADMIN_GROUP_GODADMIN, '/lms/admin' . $extra_info); $new_value = 1; } else { $menu_man->removePerm(ADMIN_GROUP_GODADMIN, '/lms/admin' . $extra_info); $new_value = 0; } break; case "menuvoice_course_public": $after_reload_perm = true; require_once $GLOBALS['where_framework'] . '/lib/lib.menu.php'; $menu_man = new MenuManager(); if (isset($_POST['option'][$var_name]) && $_POST['option'][$var_name] == 1) { $perm = explode(';', $extra_info); foreach ($perm as $k => $perm_suffix) { $menu_man->addPerm('/oc_0', '/lms/course' . trim($perm_suffix)); } $new_value = 1; } else { $perm = explode(';', $extra_info); foreach ($perm as $k => $perm_suffix) { $menu_man->removePerm('/oc_0', '/lms/course' . trim($perm_suffix)); } $new_value = 0; } break; case "tablist_coursecatalogue": $tab_selected = array(); foreach ($_POST['tablist'] as $tab_code => $v) { $tab_selected[$tab_code] = 1; } $new_value = urlencode(serialize($tab_selected)); break; case "tablist_mycourses": $temp_arr = array(); for ($i = 0; $i < 3; $i++) { $temp_var = $_POST['mycourses'][$i]; if ($temp_var != '' && !in_array($temp_var, $temp_arr)) { //avoid repeated params $temp_arr[] = $temp_var; } } $new_value = implode(',', $temp_arr); break; //if is int cast it //if is int cast it case "language": $lang = Docebo::langManager()->getAllLangCode(); $new_value = $lang[$_POST['option'][$var_name]]; break; case "template": $templ = getTemplateList(); $new_value = $templ[$_POST['option'][$var_name]]; break; case "int": $new_value = (int) $_POST['option'][$var_name]; break; //if is enum switch value to on or off //if is enum switch value to on or off case "enum": if (isset($_POST['option'][$var_name])) { $new_value = 'on'; } else { $new_value = 'off'; } break; case "check": if (isset($_POST['option'][$var_name]) && $_POST['option'][$var_name] == 1) { $new_value = 1; } else { $new_value = 0; } break; case "menuvoice": require_once $GLOBALS['where_framework'] . '/lib/lib.menu.php'; $menu_man = new MenuManager(); if (isset($_POST['option'][$var_name]) && $_POST['option'][$var_name] == 1) { $menu_man->addPerm(ADMIN_GROUP_GODADMIN, '/framework/admin' . $extra_info); $new_value = 1; } else { $menu_man->removePerm(ADMIN_GROUP_GODADMIN, '/framework/admin' . $extra_info); $new_value = 0; } break; //else simple assignament //else simple assignament default: $new_value = $_POST['option'][$var_name]; } if (!sql_query("UPDATE " . $this->table . "\r\n\t\t\tSET param_value = '{$new_value}'\r\n\t\t\tWHERE param_name = '{$var_name}' AND regroup = '" . $regroup . "'")) { $re = false; } } return $re; }
public function getCategoryInfo($id_category) { //extract competence data $query = "SELECT * FROM %lms_communication_category " . " WHERE id_category = " . (int) $id_category; $res = $this->db->query($query); $output = $this->db->fetch_obj($res); //initialize languages array $lang_codes = Docebo::langManager()->getAllLangCode(); $langs = array(); for ($i = 0; $i < count($lang_codes); $i++) { $langs[$lang_codes[$i]] = array('name' => '', 'description' => ''); } //extract languages from database $query = "SELECT * FROM %lms_communication_category_lang " . " WHERE id_category = " . (int) $id_category; $res = $this->db->query($query); while ($obj = $this->db->fetch_obj($res)) { if (in_array($obj->lang_code, $lang_codes)) { $langs[$obj->lang_code]['name'] = $obj->translation; $langs[$obj->lang_code]['description'] = ""; //$obj->description; } } $output->langs = $langs; return $output; }
function multiLangStoreDirect($id_user, $value, $is_id, $no_overwrite, $int_userid = TRUE) { $res = TRUE; if ($int_userid || empty($id_user)) { $id_user = (int) $id_user; } $q = sql_query("\n SELECT user_entry, language\n FROM " . $this->_getUserEntryTable() . "\n WHERE id_user = '******' AND\n id_common = '" . (int) $this->id_common . "' AND\n id_common_son = '0'"); $lang_with_entry = array(); if ($q && sql_num_rows($q) > 0) { $some_entry = TRUE; while ($row = sql_fetch_assoc($q)) { $lang_with_entry[] = $row["language"]; } } else { $some_entry = FALSE; } if ($some_entry) { if ($no_overwrite) { return $res; } // (TRUE) $larr = Docebo::langManager()->getAllLangCode(); foreach ($larr as $lang) { if (isset($value[$lang])) { $user_entry = $value[$lang]; $user_entry = addslashes(stripslashes($user_entry)); } else { $user_entry = ""; } if (in_array($lang, $lang_with_entry)) { $qtxt = "UPDATE " . $this->_getUserEntryTable() . " "; $qtxt .= "SET user_entry = '" . $user_entry . "' "; $qtxt .= "WHERE id_user = '******' AND "; $qtxt .= "id_common = '" . (int) $this->id_common . "' AND "; $qtxt .= "id_common_son = '0' AND language='" . $lang . "'"; } else { $qtxt = "INSERT INTO " . $this->_getUserEntryTable() . " "; $qtxt .= "(id_user, id_common, id_common_son, language, user_entry) VALUES "; $qtxt .= "(\t'" . $id_user . "', '" . (int) $this->id_common . "', '0', '" . $lang . "', "; $qtxt .= "'" . $user_entry . "')"; } $q = sql_query($qtxt); if (!$q) { $res = FALSE; } } } else { $ins_arr = array(); $qtxt = "INSERT INTO " . $this->_getUserEntryTable() . " "; $qtxt .= "(id_user, id_common, id_common_son, language, user_entry) VALUES "; $larr = Docebo::langManager()->getAllLangCode(); foreach ($larr as $lang) { if (isset($value[$lang])) { $ins_line = "(\t'" . $id_user . "', '" . (int) $this->id_common . "', '0', '" . $lang . "', "; $ins_line .= "'" . addslashes(stripslashes($value[$lang])) . "')"; $ins_arr[] = $ins_line; } } if (!empty($ins_arr)) { $qtxt .= implode(", ", $ins_arr); $q = sql_query($qtxt); $res = $q ? TRUE : FALSE; } } return $res; }
public static function lang_dropdown() { $lang_sel = Lang::get(); $langs_var = Docebo::langManager()->getAllLanguages(); $html = Form::openForm('language_selection', '?special=changelang') . '<select id="new_lang" name="new_lang" onchange="submit();">'; foreach ($langs_var as $k => $v) { $html .= '<option value="' . rawurlencode($v[0]) . '"' . ($v[0] == $lang_sel ? ' selected="selected"' : '') . '>' . $v[0] . '</option>'; } $html .= '</select>' . Form::closeForm(); return $html; }
protected function _getAddFolderDialogContent($id_parent) { $languages = Docebo::langManager()->getAllLanguages(true); //getAllLangCode(); $std_lang = getLanguage(); $form_content = Form::getHidden('addfolder_id_parent', 'id_parent', $id_parent); //$form_content .= Form::getBreakRow(); foreach ($languages as $language) { $lang_code = $language['code']; $lang_name = $language['description']; $form_content .= Form::getTextfield($lang_name, 'newfolder_' . $lang_code, 'newfolder_' . $lang_code, 50); } $body = Form::openForm('addfolder_form', "ajax.adm_server.php?r=alms/kb/createfolder") . '<p id="addfolder_error_message"></p>' . $form_content . Form::closeForm(); $footer = '' . Form::openButtonSpace() . Form::getButton('addfolder_save', 'addfolder_save', Lang::t('_SAVE', 'standard'), false, '', false) . Form::getButton('addfolder_undo', 'addfolder_undo', Lang::t('_UNDO', 'standard'), false, '', false) . Form::closeButtonSpace(); $output['header'] = Lang::t('_ORGCHART_ADDNODE', 'organization_chart'); $output['body'] = $body; $output['buttons'] = array(array('text' => Lang::t('_CONFIRM', 'standard'), 'handler' => 'addfolder_save', 'isDefault' => true), array('text' => Lang::t('_UNDO', 'standard'), 'handler' => 'addfolder_undo')); $output['script'] = ' YAHOO.util.Event.addListener("addfolder_form", "submit", function(e) { YAHOO.util.stopEvent(e); }); var addfolder_undo = function(e) { Dialog_add_folder_dialog.hide(); }; var addfolder_save = function(e) { var id_parent = YAHOO.util.Dom.get("addfolder_id_parent").value; var list = YAHOO.util.Selector.query("input[id^=newfolder_]"), postdata = ["id_parent="+id_parent]; for (var i=0; i<list.length; i++) { postdata.push("langs["+list[i].name.split("_")[1]+"]="+list[i].value); } YAHOO.util.Connect.asyncRequest("POST", YAHOO.util.Dom.get("addfolder_form").action, { success: function(o) { var res = YAHOO.lang.JSON.parse(o.responseText); if (res.success) { for (var i=0; i<list.length; i++) list[i].value = ""; if (res.node) { parent = TreeView_kbtree._getNodeById(res.id_parent); TreeView_kbtree.appendNode(parent, res.node, false); } Dialog_add_folder_dialog.hide(); } else { YAHOO.util.Dom.get("addfolder_error_message").innerHTML = (res.message ? res.message : "error"); } }, failure: function() { } }, postdata.join("&")); }; '; return $output; }
function init_send() { checkPerm('view'); require_once _base_ . '/lib/lib.upload.php'; require_once _base_ . '/lib/lib.json.php'; $json = new Services_JSON(); $savefile = ''; $max_file = Get::req('file_number', DOTY_INT, 0); $savefile = array(); for ($i = 1; $i <= $max_file; $i++) { if ($_FILES['file_' . $i]['error'] == 0) { //$savefile = rand(0,100).'_'.time().'_'.$_FILES['file']['name']; $savefile[] = $_FILES['file_' . $i]['name']; $path = '/appCore/newsletter/'; sl_open_fileoperations(); sl_upload($_FILES['file_' . $i]['tmp_name'], $path . $_FILES['file_' . $i]['name']); sl_close_fileoperations(); } } $lang_list = Docebo::langManager()->getAllLangCode(); array_unshift($lang_list, "default", "any"); $sel_lang = importVar('sel_lang'); if ($sel_lang > 0) { $lang_selected = $lang_list[$sel_lang]; } else { if ($sel_lang === 0) { // Default language $lang_selected = getLanguage(); } else { $lang_selected = $sel_lang; } } $translate_table = getTranslateTable(); $sub = translateChr($_POST["sub"], $translate_table, true); $msg = translateChr($_POST["msg"], $translate_table, true); $fromemail = $_POST["fromemail"]; $send_type = $_POST["send_type"]; // ..who said spring cleanings have to be done in spring?? $qtxt = "DELETE FROM " . $GLOBALS["prefix_fw"] . "_newsletter WHERE stime < (DATE_SUB(NOW(), INTERVAL 1 DAY))"; $q = sql_query($qtxt); $qtxt = "DELETE FROM " . $GLOBALS["prefix_fw"] . "_newsletter_sendto WHERE stime < (DATE_SUB(NOW(), INTERVAL 1 DAY))"; $q = sql_query($qtxt); $qtxt = "INSERT INTO " . $GLOBALS["prefix_fw"] . "_newsletter (sub, msg, fromemail, language, send_type, stime) "; $qtxt .= "VALUES ('" . $sub . "', '" . $msg . "', '" . $fromemail . "', '" . $lang_selected . "', '" . $send_type . "', NOW())"; $q = sql_query($qtxt); //echo mysql_error(); $qtxt = "SELECT LAST_INSERT_ID() as last_id FROM " . $GLOBALS["prefix_fw"] . "_newsletter"; $q = sql_query($qtxt); $row = mysql_fetch_array($q); $last_id = $row["last_id"]; $qtxt = "UPDATE " . $GLOBALS["prefix_fw"] . "_newsletter SET id_send='" . $last_id . "' WHERE id='{$last_id}'"; $q = sql_query($qtxt); $url = "index.php?modname=public_newsletter_admin&op=selsendto&id_send=" . $last_id . "&load=1"; Util::jump_to($url); }
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)); } } } } }
function _mod_son() { $idSon = importVar('idSon', true, 0); $std_lang =& DoceboLanguage::createInstance('standard'); $lang =& DoceboLanguage::createInstance('field'); $out =& $GLOBALS['page']; $array_lang = array(); $array_lang = Docebo::langManager()->getAllLangCode(); if (isset($_POST['undo'])) { Util::jump_to($this->getUrl() . '&id_common=' . $this->id_common . '&type_field=' . $this->getFieldType() . '&back=' . $this->back_coded); } if (isset($_POST['save_field_' . $this->getFieldType()])) { //insert mandatory translation $mand_lang = getLanguage(); //control if all is ok if (!isset($_POST['mod_dropdown_son'][$mand_lang])) { $out->add(getErrorUi($lang->def('_ERR_MUST_DEF_MANADATORY_TRANSLATION')) . getBackUi($this->getUrl() . '&type_field=' . $this->getFieldType() . '&back=' . $this->back_coded, $std_lang->def('_BACK')), 'content'); return; } if ($_POST['mod_dropdown_son'][$mand_lang] == $lang->def('_FIELD_NAME') || trim($_POST['mod_dropdown_son'][$mand_lang]) == '') { $out->add(getErrorUi($lang->def('_ERR_MUST_DEF_MANADATORY_TRANSLATION')) . getBackUi($this->getUrl() . '&type_field=' . $this->getFieldType() . '&back=' . $this->back_coded, $std_lang->def('_BACK')), 'content'); return; } $existsing_translation = array(); $re_trans = sql_query("\r\n\t\t\tSELECT lang_code\r\n\t\t\tFROM " . $this->_getElementTable() . "\r\n\t\t\tWHERE id_common_son = '" . (int) $idSon . "' AND\r\n\t\t\t\tidField = '" . (int) $this->id_common . "'"); while (list($l_code) = sql_fetch_row($re_trans)) { $existsing_translation[$l_code] = 1; } $re = true; //insert other field foreach ($_POST['mod_dropdown_son'] as $lang_code => $translation) { if (isset($existsing_translation[$lang_code])) { if (!sql_query("\r\n\t\t\t\t\tUPDATE " . $this->_getElementTable() . "\r\n\t\t\t\t\tSET translation = '" . $translation . "'\r\n\t\t\t\t\tWHERE id_common_son = '" . (int) $idSon . "' AND\r\n\t\t\t\t\t\tidField = '" . (int) $this->id_common . "' AND\r\n\t\t\t\t\t\tlang_code = '" . $lang_code . "'")) { $re = false; } } else { if (!sql_query("\r\n\t\t\t\t\tINSERT INTO " . $this->_getElementTable() . "\r\n\t\t\t\t\t(idField, id_common_son, lang_code, translation) VALUES\r\n\t\t\t\t\t('" . (int) $this->id_common . "', '" . (int) $idSon . "', '" . $lang_code . "', '" . $translation . "') ")) { $re = false; } } } Util::jump_to($this->getUrl() . '&id_common=' . $this->id_common . '&type_field=' . $this->getFieldType() . '&back=' . $this->back_coded . '&result=' . ($re ? 'success' : 'fail')); } //load value form database $re_trans = sql_query("\r\n\t\tSELECT lang_code, translation\r\n\t\tFROM " . $this->_getElementTable() . "\r\n\t\tWHERE id_common_son = '" . $idSon . "' AND idField = '" . (int) $this->id_common . "'"); while (list($l_code, $trans) = sql_fetch_row($re_trans)) { $translation[$l_code] = $trans; } require_once _base_ . '/lib/lib.form.php'; $form = new Form(); $out->setWorkingZone('content'); $out->add('<div class="std_block">'); $out->add($form->openForm('del_' . $this->getFieldType(), $this->getUrl()) . $form->openElementSpace() . $form->getHidden('type_field', 'type_field', $this->getFieldType()) . $form->getHidden('id_common', 'id_common', $this->id_common) . $form->getHidden('idSon', 'idSon', $idSon) . $form->getHidden('back', 'back', $this->back_coded) . $form->getHidden('iop', 'iop', 'mod')); $mand_lang = getLanguage(); foreach ($array_lang as $k => $lang_code) { $out->add($form->getTextfield(($mand_lang == $lang_code ? '<span class="mandatory">*</span>' : '') . $lang_code, 'mod_dropdown_son_' . $lang_code, 'mod_dropdown_son[' . $lang_code . ']', 255, isset($translation[$lang_code]) ? $translation[$lang_code] : '', $lang_code . ' ' . $lang->def('_FIELD_NAME'))); } $out->add($form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('save_field', 'save_field_' . $this->getFieldType(), $std_lang->def('_SAVE', 'standard')) . $form->getButton('undo', 'undo', $std_lang->def('_UNDO', 'standard')) . $form->closeButtonSpace() . $form->closeForm()); $out->add('</div>'); }
function saveclassroom() { //checkPerm('mod'); $idClassroom = importVar('idClassroom', true, 0); $load = importVar('load', true, 0); $all_languages = Docebo::langManager()->getAllLangCode(); $lang =& DoceboLanguage::createInstance('admin_classroom', 'lms'); if ($_POST['title'] == '') { $_POST['title'] = $lang->def('_NOTITLE'); } $lang_sel = $_POST['language']; if ($load == 1) { $query_insert = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_classroom\r\n\t\t\tSET\tname = '" . $_POST['name'] . "' ,\r\n\t\t\t\tdescription = '" . $_POST['descr'] . "',\r\n\t\t\t\tlocation_id = '" . (int) $_POST['location_id'] . "',\r\n\t\t\t\troom = '" . $_POST['room'] . "',\r\n\t\t\t\tstreet = '" . $_POST['street'] . "',\r\n\t\t\t\tcity = '" . $_POST['city'] . "',\r\n\t\t\t\tstate = '" . $_POST['state'] . "' ,\r\n\t\t\t\tzip_code = '" . $_POST['zip_code'] . "',\r\n\t\t\t\tphone = '" . $_POST['phone'] . "',\r\n\t\t\t\tfax = '" . $_POST['fax'] . "',\r\n\t\t\t\tcapacity = '" . $_POST['capacity'] . "',\r\n\t\t\t\tdisposition = '" . $_POST['disposition'] . "',\r\n\t\t\t\tinstrument = '" . $_POST['instrument'] . "',\r\n\t\t\t\tavailable_instrument = '" . $_POST['available_instrument'] . "',\r\n\t\t\t\tnote = '" . $_POST['note'] . "',\r\n\t\t\t\tresponsable = '" . $_POST['responsable'] . "'\r\n\t\t\t\tWHERE idClassroom = '" . $idClassroom . "'"; if (!sql_query($query_insert)) { Util::jump_to('index.php?modname=classroom&op=classroom&result=err'); } Util::jump_to('index.php?modname=reservation&op=classroom&result=ok'); echo $query_insert; } else { $query_insert = "\r\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_classroom\r\n\t\t\t(name, description , location_id , room , street, city, state , zip_code,\r\n\t\t\tphone,fax, capacity, disposition, instrument, available_instrument,note,responsable) VALUES\r\n\t\t\t( \t'" . $_POST['name'] . "' ,\r\n\t\t\t\t'" . $_POST['descr'] . "',\r\n\t\t\t\t'" . (int) $_POST['location_id'] . "',\r\n\t\t\t\t'" . $_POST['room'] . "',\r\n\t\t\t\t'" . $_POST['street'] . "',\r\n\t\t\t\t'" . $_POST['city'] . "',\r\n\t\t\t\t'" . $_POST['state'] . "',\r\n\t\t\t\t'" . $_POST['zip_code'] . "',\r\n\t\t\t\t'" . $_POST['phone'] . "',\r\n\t\t\t\t'" . $_POST['fax'] . "',\r\n\t\t\t\t'" . $_POST['capacity'] . "',\r\n\t\t\t\t'" . $_POST['disposition'] . "',\r\n\t\t\t\t'" . $_POST['instrument'] . "',\r\n\t\t\t\t'" . $_POST['available_instrument'] . "',\r\n\t\t\t\t'" . $_POST['note'] . "',\r\n\t\t\t\t'" . $_POST['responsable'] . "'\r\n\t\t\t\t)"; if (!sql_query($query_insert)) { Util::jump_to('index.php?modname=classroom&op=classroom&result=err'); } Util::jump_to('index.php?modname=reservation&op=classroom&result=ok'); echo $query_insert; } }
function saveMetaCertificate() { checkPerm('mod'); $id_certificate = importVar('id_certificate', true, 0); $load = importVar('load', true, 0); $all_languages = Docebo::langManager()->getAllLangCode(); $lang =& DoceboLanguage::createInstance('certificate', 'lms'); if ($_POST['name'] == '') { $_POST['name'] = $lang->def('_NOTITLE'); } if (isset($_POST['structure_certificate'])) { $path = '/appLms/certificate/'; $path = $path . (substr($path, -1) != '/' && substr($path, -1) != '\\' ? '/' : ''); $bgimage = manageCertificateFile('bgimage', $_POST["old_bgimage"], $path, isset($_POST['file_to_del']['bgimage'])); if (!$bgimage) { $bgimage = ''; } $query_insert = "\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_certificate\r\n\t\tSET\tcert_structure = '" . $_POST['structure'] . "',\r\n\t\t\torientation = '" . $_POST['orientation'] . "'\r\n\t\t\t" . ($bgimage != '' && !isset($_POST['file_to_del']['bgimage']) ? " , bgimage = '" . $bgimage . "'" : '') . "\r\n\t\tWHERE id_certificate = '" . $id_certificate . "'"; if (!sql_query($query_insert)) { Util::jump_to('index.php?modname=meta_certificate&op=meta_certificate&result=err'); } Util::jump_to('index.php?modname=meta_certificate&op=meta_certificate&result=ok'); } if ($load == 1) { $query_insert = "\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_certificate\r\n\t\tSET\tcode = '" . $_POST['code'] . "',\r\n\t\t\tname = '" . $_POST['name'] . "',\r\n\t\t\tbase_language = '" . $_POST['base_language'] . "',\r\n\t\t\tdescription = '" . $_POST['descr'] . "',\r\n\t\t\tuser_release = '" . (isset($_POST['user_release']) ? 1 : 0) . "'\r\n\t\tWHERE id_certificate = '" . $id_certificate . "'"; if (!sql_query($query_insert)) { Util::jump_to('index.php?modname=meta_certificate&op=meta_certificate&result=err'); } Util::jump_to('index.php?modname=meta_certificate&op=meta_certificate&result=ok'); } else { $query_insert = "\r\n\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_certificate\r\n\t\t( code, name, base_language, description, meta, user_release ) VALUES\r\n\t\t( \t'" . $_POST['code'] . "' ,\r\n\t\t\t'" . $_POST['name'] . "' ,\r\n\t\t \t'" . $_POST['base_language'] . "' ,\r\n\t\t\t'" . $_POST['descr'] . "',\r\n\t\t\t'1',\r\n\t\t\t'" . (isset($_POST['user_release']) ? 1 : 0) . "'\r\n\t\t)"; if (!sql_query($query_insert)) { Util::jump_to('index.php?modname=meta_certificate&op=meta_certificate&result=err'); } list($id_certificate) = sql_fetch_row(sql_query("SELECT LAST_INSERT_ID()")); Util::jump_to('index.php?modname=meta_certificate&op=elemmetacertificate&id_certificate=' . $id_certificate); } }
function savenews() { checkPerm('mod'); $id_news = importVar('id_news', true, 0); $load = importVar('load', true, 0); $all_languages = Docebo::langManager()->getAllLangCode(); $lang =& DoceboLanguage::createInstance('admin_news', 'lms'); if ($_POST['title'] == '') { $_POST['title'] = $lang->def('_NOTITLE'); } $lang_sel = $_POST['language']; if ($load == 1) { $query_insert = "\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_news_internal\r\n\t\tSET\ttitle = '" . $_POST['title'] . "' ,\r\n\t\t\tshort_desc = '" . $_POST['short_desc'] . "' ,\r\n\t\t\timportant = '" . (isset($_POST['impo']) ? 1 : 0) . "' ,\r\n\t\t\tlanguage = '" . ($lang_sel == -1 ? 'all' : $all_languages[$lang_sel]) . "'\r\n\t\tWHERE idNews = '" . $id_news . "'"; if (!sql_query($query_insert)) { Util::jump_to('index.php?modname=internal_news&op=news&result=err'); } Util::jump_to('index.php?modname=internal_news&op=news&result=ok'); } else { $query_insert = "\r\n\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_news_internal\r\n\t\t( title, publish_date, short_desc, important, language ) VALUES\r\n\t\t( \t'" . $_POST['title'] . "' ,\r\n\t\t\t'" . date("Y-m-d H:i:s") . "',\r\n\t\t\t'" . $_POST['short_desc'] . "' ,\r\n\t\t\t'" . (isset($_POST['impo']) ? 1 : 0) . "' ,\r\n\t\t\t'" . ($lang_sel == -1 ? 'all' : $all_languages[$lang_sel]) . "' )"; if (!sql_query($query_insert)) { Util::jump_to('index.php?modname=internal_news&op=news&result=err'); } Util::jump_to('index.php?modname=internal_news&op=news&result=ok'); } }
/** * this function manage a field * * @param string $back indicates the return url * @return nothing * * @access public */ function edit($back) { $back_coded = htmlentities(urlencode($back)); $array_lang = array(); $std_lang =& DoceboLanguage::createInstance('standard'); $lang =& DoceboLanguage::createInstance('field'); $array_lang = Docebo::langManager()->getAllLangCode(); $out =& $GLOBALS['page']; if (isset($_POST['undo'])) { //undo action Util::jump_to($back . '&result=undo'); } if (isset($_POST['save_field_' . $this->getFieldType()])) { //insert mandatory translation $mand_lang = getLanguage(); $show_on = ''; if (isset($_POST['show_on_platform'])) { while (list($code, ) = each($_POST['show_on_platform'])) { $show_on .= $code . ','; } } //control if all is ok if (!isset($_POST['new_freetext'][$mand_lang])) { $out->add(getErrorUi($lang->def('_ERR_MUST_DEF_MANADATORY_TRANSLATION')) . getBackUi($this->getUrl() . '&type_field=' . $this->getFieldType() . '&back=' . $back_coded, $std_lang->def('_BACK')), 'content'); return; } if ($_POST['new_freetext'][$mand_lang] == $lang->def('_FIELD_NAME') || trim($_POST['new_freetext'][$mand_lang]) == '') { $out->add(getErrorUi($lang->def('_ERR_MUST_DEF_MANADATORY_TRANSLATION')) . getBackUi($this->getUrl() . '&type_field=' . $this->getFieldType() . '&back=' . $back_coded, $std_lang->def('_BACK')), 'content'); return; } $existsing_translation = array(); $re_trans = sql_query("\r\n\t\t\tSELECT lang_code\r\n\t\t\tFROM " . $this->_getMainTable() . "\r\n\t\t\tWHERE id_common = '" . $this->id_common . "'"); while (list($l_code) = sql_fetch_row($re_trans)) { $existsing_translation[$l_code] = 1; } $use_multilang = isset($_POST['use_multi_lang']) ? 1 : 0; $re = true; //insert other field foreach ($_POST['new_freetext'] as $lang_code => $translation) { if (isset($existsing_translation[$lang_code])) { if (!sql_query("\r\n\t\t\t\t\tUPDATE " . $this->_getMainTable() . "\r\n\t\t\t\t\tSET translation = '" . $translation . "',\r\n\t\t\t\t\t\tshow_on_platform = '" . $show_on . "',\r\n\t\t\t\t\t\tuse_multilang = '" . $use_multilang . "'\r\n\t\t\t\t\tWHERE id_common = '" . (int) $this->id_common . "' AND lang_code = '" . $lang_code . "'")) { $re = false; } } else { if (!sql_query("\r\n\t\t\t\t\tINSERT INTO " . $this->_getMainTable() . "\r\n\t\t\t\t\t(type_field, id_common, lang_code, translation, show_on_platform, use_multilang) VALUES\r\n\t\t\t\t\t('" . $this->getFieldType() . "', '" . (int) $this->id_common . "', '" . $lang_code . "', '" . $translation . "', '" . $show_on . "', '" . $use_multilang . "') ")) { $re = false; } } } Util::jump_to($back . '&result=' . ($re ? 'success' : 'fail')); } //load value form database $re_trans = sql_query("\r\n\t\tSELECT lang_code, translation, show_on_platform, use_multilang\r\n\t\tFROM " . $this->_getMainTable() . "\r\n\t\tWHERE id_common = '" . $this->id_common . "'"); while (list($l_code, $trans, $show_on, $db_use_multilang) = sql_fetch_row($re_trans)) { $translation[$l_code] = $trans; if (!isset($show_on_platform)) { $show_on_platform = array_flip(explode(',', $show_on)); } if (!isset($use_multilang)) { $use_multilang = $db_use_multilang; } } require_once _base_ . '/lib/lib.form.php'; $form = new Form(); $out->setWorkingZone('content'); $out->add('<div class="std_block">'); $out->add($form->openForm('create_' . $this->getFieldType(), $this->getUrl()) . $form->openElementSpace() . $form->getHidden('type_field', 'type_field', $this->getFieldType()) . $form->getHidden('id_common', 'id_common', $this->id_common) . $form->getHidden('back', 'back', $back_coded)); $mand_lang = getLanguage(); foreach ($array_lang as $k => $lang_code) { $out->add($form->getTextfield(($mand_lang == $lang_code ? '<span class="mandatory">*</span>' : '') . $lang_code, 'new_freetext_' . $lang_code, 'new_freetext[' . $lang_code . ']', 255, isset($translation[$lang_code]) ? $translation[$lang_code] : '', $lang_code . ' ' . $lang->def('_FIELD_NAME'))); } $GLOBALS['page']->add($this->getMultiLangCheck($use_multilang), 'content'); $GLOBALS['page']->add($this->getShowOnPlatformFieldset($show_on_platform), 'content'); $out->add($form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('save_field', 'save_field_' . $this->getFieldType(), $std_lang->def('_SAVE', 'standard')) . $form->getButton('undo', 'undo', $std_lang->def('_UNDO', 'standard')) . $form->closeButtonSpace() . $form->closeForm()); $out->add('</div>'); }
function userCourseList(&$url, $use_tab = true, $page_add = true) { YuiLib::load(array('animation' => 'animation-min.js', 'dragdrop' => 'dragdrop-min.js', 'button' => 'button-min.js', 'container' => 'container-min.js', 'my_window' => 'windows.js'), array('container/assets/skins/sam' => 'container.css', 'button/assets/skins/sam' => 'button.css')); if ($page_add) { addJs($GLOBALS['where_lms_relative'] . '/modules/coursecatalogue/', 'ajax.coursecatalogue.js'); } require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.user_profile.php'; require_once _base_ . '/lib/lib.navbar.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.preassessment.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.catalogue.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php'; require_once $GLOBALS['where_lms'] . '/lib/lib.coursepath.php'; require_once $GLOBALS["where_framework"] . "/lib/lib.ajax_comment.php"; require_once $GLOBALS['where_lms'] . '/lib/lib.classroom.php'; // pre-loading coursepath ------------------------------------------------------------------ $path_man = new CoursePath_Manager(); // search for the coursepath ---------------------------------------------------------- $user_coursepath = $path_man->getUserSubscriptionsInfo(getLogUserId(), true); $coursepath = $path_man->getCoursepathAllInfo(array_keys($user_coursepath)); if (!empty($coursepath)) { // find structures of the course path --------------------------------------------- $path_courses = $path_man->getPathStructure(array_keys($coursepath)); $cp_info = $path_man->getAllCoursesInfo($path_courses['all_paths']); /*echo "<pre>\n\n"; print_r($cp_info); echo "\n\n</pre>";*/ } // ------------------------------------------------------------------------ $course_stats = array('total' => 0, 'u_can_enter' => 0, 'with_status' => array(CST_AVAILABLE => 0, CST_EFFECTIVE => 0, CST_CONCLUDED => 0, CST_CANCELLED => 0), 'with_ustatus' => array(_CUS_SUBSCRIBED => 0, _CUS_BEGIN => 0, _CUS_END => 0, _CUS_SUSPEND => 0), 'with_wstatus' => array(_CUS_RESERVED => 0, _CUS_WAITING_LIST => 0), 'with_ulevel' => array(), 'expiring' => 0, 'cert_relesable' => 0); // ------------------------------------------------------------------------ $filter = importVar('filter', false, 'total'); if ($filter == 'level') { $filter_level = importVar('filter_on', true, 0); } $current_tab = importVar('current_tab', false, 'lo_plan'); if ($use_tab && $page_add) { addCss('style_tab'); $lo_plan = importVar('lo_plan', false, 0); $lo_history = importVar('lo_history', false, 0); if ($lo_plan != 0) { $current_tab = 'lo_plan'; } if ($lo_history != 0) { $current_tab = 'lo_history'; } } if ($use_tab && $page_add) { addCss('style_tab'); $lo_plan = importVar('lo_plan', false, 0); $lo_history = importVar('lo_history', false, 0); if ($lo_plan != 0) { $current_tab = 'lo_plan'; } if ($lo_history != 0) { $current_tab = 'lo_history'; } } require_once $GLOBALS['where_lms'] . '/lib/lib.certificate.php'; $cert = new Certificate(); $released = $cert->certificateReleased(getLogUserId()); $available_cert = $cert->certificateForCourses(false, false); // cahce classroom ----------------------------------------------------------------- $classroom_man = new ClassroomManager(); $classrooms = $classroom_man->getClassroomNameList(); $lang =& DoceboLanguage::createInstance('catalogue'); $lang_c =& DoceboLanguage::createInstance('course'); $man_course = new Man_Course(); $subcourse_list = sql_query("" . " SELECT u.idCourse, u.edition_id, level, u.date_inscr, u.date_first_access, " . "\t\tu.date_complete, u.status AS user_status, u.waiting, u.edition_id " . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser AS u" . " WHERE idUser = '******'"); $subscription = array(); while ($cinfo = mysql_fetch_assoc($subcourse_list)) { $subscription['course'][$cinfo['idCourse']] = $cinfo; if ($cinfo['edition_id'] != 0) { $subscription['edition'][$cinfo['idCourse']][$cinfo['edition_id']] = $cinfo; } } // searching courses --------------------------------------------------------------- $select_course = "" . " SELECT c.idCourse, c.course_type, c.idCategory, c.code, c.name, c.description, c.lang_code, c.difficult, " . "\tc.subscribe_method, c.date_begin, c.date_end, c.max_num_subscribe, " . "\tc.selling, c.prize, c.create_date, c.status AS course_status, c.course_edition, " . "\tc.classrooms, c.img_othermaterial, c.course_demo, c.course_vote, " . "\tc.can_subscribe, c.sub_start_date, c.sub_end_date, c.valid_time, c.userStatusOp, c.show_result, u.status AS user_status, u.level " . ", c.use_logo_in_courselist, c.img_course, c.direct_play "; $from_course = " FROM " . $GLOBALS['prefix_lms'] . "_course AS c " . "\t JOIN " . $GLOBALS['prefix_lms'] . "_courseuser AS u "; $where_course = " c.idCourse = u.idCourse " . " AND u.idUser = '******' " . " AND ( c.status <> '" . CST_PREPARATION . "' OR u.level > 3 )" . " AND c.course_type <> 'assessment' "; $selected_year = 0; $selected_search = ''; if (isset($_POST['apply_filter'])) { if ($_POST['year']) { $where_course .= " AND c.create_date BETWEEN '" . $_POST['year'] . "-01-01 00:00:00' AND '" . $_POST['year'] . "-12-31 23:59:59'"; $selected_year = $_POST['year']; } if ($_POST['search'] !== '') { $where_course .= " AND c.name LIKE '%" . $_POST['search'] . "%'"; $selected_search = $_POST['search']; } } $group_by_course = " GROUP BY c.idCourse "; $order_course = " ORDER BY "; $tablist = Get::sett('tablist_mycourses', ''); if ($tablist != '') { $arr_order_course = explode(',', $tablist); $arr_temp = array(); foreach ($arr_order_course as $key => $value) { switch ($value) { case 'status': $arr_temp[] = ' u.status '; break; case 'code': $arr_temp[] = ' c.code '; break; case 'name': $arr_temp[] = ' c.name '; break; } } $order_course = $order_course . implode(', ', $arr_temp); } if ($order_course == " ORDER BY ") { //default without parameter $order_course .= " u.status, c.name "; } // apply search filter -------------------------------------------------------------- $all_lang = Docebo::langManager()->getAllLangCode(); $re_course = sql_query($select_course . $from_course . " WHERE " . $where_course . $group_by_course . $order_course); // retrive editions ---------------------------------------------------------------- $select_edition = " SELECT e.* "; $from_edition = " FROM " . $GLOBALS["prefix_lms"] . "_course_editions AS e " . " JOIN " . $GLOBALS["prefix_lms"] . "_courseuser AS u "; $where_edition = " WHERE e.status <> '" . CST_PREPARATION . "' AND e.id_edition = u.edition_id "; $re_edition = sql_query($select_edition . $from_edition . $where_edition); // -------------------------------------------------------------------------------- $editions = array(); if ($re_edition) { while ($edition_elem = mysql_fetch_assoc($re_edition)) { $edition_elem['classrooms'] = isset($classrooms[$edition_elem['classrooms']]) ? $classrooms[$edition_elem['classrooms']] : ''; $editions[$edition_elem["id_course"]][$edition_elem["id_course"]] = $edition_elem; } } $man_courseuser = new Man_CourseUser(); $ax_comm = new AjaxComment('course', 'lms'); $comment_count = $ax_comm->getResourceCommentCount(); $user_score = $man_courseuser->getUserCourseScored(getLogUserId()); // ----------------------------------------------------------------------------- $needed_info_for = array(); if (!empty($subscription['course'])) { $id_course_list = array_keys($subscription['course']); // find last access to the courses --------------------------------------------------------------------- require_once $GLOBALS['where_lms'] . '/lib/lib.track_user.php'; $last_access_courses = TrackUser::getLastAccessToCourse(getLogUserId()); // retrive unreaded advice ----------------------------------------------------------------------------- require_once $GLOBALS['where_lms'] . '/lib/lib.advice.php'; $advices = Man_Advice::getCountUnreaded(getLogUserId(), $id_course_list, $last_access_courses); // retrive unreaded forum messages --------------------------------------------------------------------- require_once $GLOBALS['where_lms'] . '/lib/lib.forum.php'; $forums = Man_Forum::getCountUnreaded(getLogUserId(), $id_course_list, $last_access_courses); // retrive new lesson ---------------------------------------------------------------------------------- require_once $GLOBALS['where_lms'] . '/lib/lib.orgchart.php'; $org_chart = OrganizationManagement::getCountUnreaded(getLogUserId(), $id_course_list, $last_access_courses); if (!empty($path_courses['all_items'])) { $needed_info_for = array_diff($path_courses['all_items'], $id_course_list); } $first_is_scorm = OrganizationManagement::objectFilter($id_course_list, 'scormorg'); $enroll_list = sql_query("" . " SELECT u.idCourse, u.edition_id, COUNT(*) as number " . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser AS u" . " WHERE u.idCourse IN (" . implode($id_course_list, ',') . ") " . " AND u.level = '3'" . " AND u.status IN ('" . _CUS_CONFIRMED . "', '" . _CUS_SUBSCRIBED . "', '" . _CUS_BEGIN . "', '" . _CUS_END . "', '" . _CUS_SUSPEND . "', '" . _CUS_WAITING_LIST . "')" . " AND u.absent = '0'" . " GROUP BY u.idCourse, u.edition_id "); $enrolled = array(); while ($cinfo = mysql_fetch_assoc($enroll_list)) { $enrolled[$cinfo['idCourse']][$cinfo['edition_id']] = $cinfo['number']; } } // search pre-assessment ----------------------------------------------------------- $select_assess = "" . " SELECT c.idCourse, c.course_type, c.idCategory, c.code, c.name, c.description, c.lang_code, c.difficult, " . "\tc.subscribe_method, c.date_begin, c.date_end, c.max_num_subscribe, " . "\tc.selling, c.prize, c.create_date, c.status AS course_status, c.course_edition, " . "\tc.classrooms, c.img_othermaterial, c.course_demo, c.course_vote, " . "\tc.can_subscribe, c.sub_start_date, c.sub_end_date, c.valid_time, c.userStatusOp, " . "\tu.level, u.date_inscr, u.date_first_access, u.date_complete, u.status AS user_status, u.waiting, c.advance, u.waiting "; $from_assess = " FROM " . $GLOBALS['prefix_lms'] . "_course AS c " . "\t JOIN " . $GLOBALS['prefix_lms'] . "_courseuser AS u "; $where_assess = " c.idCourse = u.idCourse " . " AND u.idUser = '******' " . " AND c.course_type = 'assessment' " . " AND ( c.status <> '" . CST_PREPARATION . "' OR u.level > 3 ) " . ($filter == 'level' ? " AND level = '" . $filter_level . "'" : ""); //." AND ( u.status <> '"._CUS_END."' OR u.level > 3 ) "; $preass_list = sql_query($select_assess . $from_assess . " WHERE " . $where_assess . " ORDER BY c.name "); // pre assessment list --------------------------------------------------------------------------------------- $i = 0; if (mysql_num_rows($preass_list) && $current_tab == 'lo_plan') { if ($page_add) { $GLOBALS['page']->add('<div id="mycourse_asses">' . '<h1>' . $lang_c->def('_ASSESSMENT_LIST') . '</h1>', 'content'); } while ($cinfo = mysql_fetch_assoc($preass_list)) { $cinfo['user_score'] = isset($user_score[$cinfo['idCourse']]) ? $user_score[$cinfo['idCourse']] : NULL; if (isset($comment_count[$cinfo['idCourse']])) { $cinfo['comment_count'] = $comment_count[$cinfo['idCourse']]; } if ($page_add) { $GLOBALS['page']->add(dashmyassess($url, $lang_c, $cinfo, $i++), 'content'); } } if ($page_add) { $GLOBALS['page']->add('</div>', 'content'); } } // page intest ------------------------------------------------------------ require_once $GLOBALS['where_lms'] . '/lib/lib.levels.php'; $lvl = CourseLevel::getLevels(); $title = $lang->def('_COURSE_LIST'); switch ($filter) { case "access": $title = $lang->def('_COURSE_YOU_CAN_ACCESS'); break; case "expiring": $title = $lang->def('_COURSE_EXPIRING'); break; case "subscribed": $title = $lang->def('_COURSE_SUBSCRIBED'); break; case "begin": $title = $lang->def('_COURSE_BEGIN'); break; case "end": $title = $lang->def('_COURSE_END'); break; case "level": $title = str_replace('[level]', $lvl[$_GET['filter_on']], $lang->def('_COURSE_AS')); break; } if ($page_add) { $GLOBALS['page']->add('<div id="mycourse_list">' . '<h1>' . $title . '</h1>', 'content'); } $i = 0; $direct_play = false; while ($cinfo = mysql_fetch_assoc($re_course)) { $access = Man_Course::canEnterCourse($cinfo); if ($cinfo['direct_play'] == 1) { $direct_play = true; } $course_stats['total']++; if ($cinfo['user_status'] == _CUS_RESERVED || $cinfo['user_status'] == _CUS_WAITING_LIST) { $course_stats['with_wstatus'][$cinfo['user_status']]++; } elseif ($access['can']) { $course_stats['u_can_enter']++; } if (isset($course_stats['with_ustatus'][$cinfo['user_status']])) { $course_stats['with_ustatus'][$cinfo['user_status']]++; } else { $course_stats['with_ustatus'][$cinfo['user_status']] = 1; } if (!isset($course_stats['with_ulevel'][$cinfo['level']])) { $course_stats['with_ulevel'][$cinfo['level']] = 1; } else { $course_stats['with_ulevel'][$cinfo['level']]++; } if (isset($available_cert[$cinfo['idCourse']])) { while (list($id_cert, $certificate) = each($available_cert[$cinfo['idCourse']])) { if (!isset($released[$id_cert]) && $cert->canRelease($certificate[CERT_AV_STATUS], $cinfo['user_status'])) { $course_stats['cert_relesable']++; } } } } if (mysql_num_rows($re_course)) { mysql_data_seek($re_course, 0); } while ($cinfo = mysql_fetch_assoc($re_course)) { $cinfo['edition_list'] = isset($editions[$cinfo['idCourse']]) ? $editions[$cinfo['idCourse']] : array(); $cinfo['user_score'] = isset($user_score[$cinfo['idCourse']]) ? $user_score[$cinfo['idCourse']] : NULL; $cinfo['enrolled'] = isset($enrolled[$cinfo['idCourse']]) ? $enrolled[$cinfo['idCourse']] : false; if (isset($comment_count[$cinfo['idCourse']])) { $cinfo['comment_count'] = $comment_count[$cinfo['idCourse']]; } $cinfo['classrooms'] = isset($classrooms[$cinfo['classrooms']]) ? $classrooms[$cinfo['classrooms']] : ''; // advertising -------------------------------------------------------------------------------------------- $cinfo['to_read']['advice'] = isset($advices[$cinfo['idCourse']]) ? $advices[$cinfo['idCourse']] : 0; $cinfo['to_read']['forum'] = isset($forums[$cinfo['idCourse']]) ? $forums[$cinfo['idCourse']] : 0; $cinfo['to_read']['lobj'] = isset($org_chart[$cinfo['idCourse']]) ? $org_chart[$cinfo['idCourse']] : 0; // 10 days in the future $range = time() + 10 * 24 * 60 * 60; $expiring = false; if ($cinfo['date_end'] != '0000-00-00') { $time_end = fromDatetimeToTimestamp($cinfo['date_end']); if ($range > $time_end) { $expiring = true; $course_stats['expiring']++; } } if ($cinfo['valid_time'] != '0' && $cinfo['valid_time'] != '' && $cinfo['date_first_access'] != '') { $time_first_access = fromDatetimeToTimestamp($cinfo['date_first_access']); if ($range > $time_first_access + $cinfo['valid_time'] * 24 * 3600) { $expiring = true; $course_stats['expiring']++; } } if (isset($first_is_scorm[$cinfo['idCourse']])) { $cinfo['first_is_scorm'] = $first_is_scorm[$cinfo['idCourse']]; } else { $cinfo['first_is_scorm'] = false; } $access = Man_Course::canEnterCourse($cinfo); // -------------------------------------------------------------------- if (!isset($path_courses['all_items'][$cinfo['idCourse']])) { // the course is not related with a coursepath, so i can print it -------------- if ($filter == 'level') { if ($subscription['course'][$cinfo['idCourse']]['level'] == $filter_level) { $dash = dashmycourse($url, $lang_c, $subscription, $cinfo, $i++); } else { $dash = ''; } } else { $dash = dashmycourse($url, $lang_c, $subscription, $cinfo, $i++); } if ($use_tab == true) { if ($course_stats['with_ustatus'][_CUS_END] == $course_stats['total']) { $current_tab = 'lo_history'; } if ($current_tab == 'lo_history') { if ($cinfo['user_status'] == _CUS_END && $page_add) { $GLOBALS['page']->add($dash, 'content'); } } else { if (($cinfo['user_status'] != _CUS_END || $cinfo['level'] >= 4) && $page_add) { $GLOBALS['page']->add($dash, 'content'); } } } else { switch ($filter) { case "access": if ($access['can'] && $page_add) { $GLOBALS['page']->add($dash, 'content'); } break; case "expiring": if ($expiring && $page_add) { $GLOBALS['page']->add($dash, 'content'); } break; case "subscribed": if ($cinfo['user_status'] == _CUS_SUBSCRIBED && $page_add) { $GLOBALS['page']->add($dash, 'content'); } break; case "begin": if ($cinfo['user_status'] == _CUS_BEGIN && $page_add) { $GLOBALS['page']->add($dash, 'content'); } break; case "end": if ($cinfo['user_status'] == _CUS_END && $page_add) { $GLOBALS['page']->add($dash, 'content'); } break; case "level": if ($_GET['filter_on'] == $cinfo['level'] && $page_add) { $GLOBALS['page']->add($dash, 'content'); } break; default: if ($page_add) { $GLOBALS['page']->add($dash, 'content'); } } } } else { // the course is related with a coursepath, so i must wait to print it ---------- //$cinfo['prerequisites'] = $path_courses['all_items'][$cinfo['idCourse']]; // <- useless? //$courses =array($cinfo['idCourse']=>$cinfo); $prere = $cp_info[$cinfo['idCourse']]["prerequisites"]; if ($path_man->checkPrerequisites($prere, $subscription)) { $cinfo['prerequisites_satisfied'] = true; } else { $cinfo['prerequisites_satisfied'] = false; } if ($filter == 'level') { if ($subscription['course'][$cinfo['idCourse']]['level'] == $filter_level) { $course_cache[$cinfo['idCourse']] = dashmycourse($url, $lang_c, $subscription, $cinfo, 1, true, 4); } else { $course_cache[$cinfo['idCourse']] = ''; } } else { $course_cache[$cinfo['idCourse']] = dashmycourse($url, $lang_c, $subscription, $cinfo, 1, true, 4); } } // end else-if ------------------------------------------------------- } // end while ------------------------------------------------------------ if ($direct_play && $page_add) { $GLOBALS['page']->add('' . ' <link href="' . getPathTemplate() . '/style/shadowbox.css" rel="stylesheet" type="text/css" />' . '<script type="text/javascript" src="' . $GLOBALS['where_framework_relative'] . '/addons/shadowbox/shadowbox-yui.js"></script>' . "\n" . '<script type="text/javascript" src="' . $GLOBALS['where_framework_relative'] . '/addons/shadowbox/shadowbox.js"></script>' . "\n", 'page_head'); $GLOBALS['page']->add('<script type="text/javascript"> YAHOO.util.Event.onDOMReady(function() { var options = { listenOverlay:false, overlayOpacity:"0.8", loadingImage:"' . getPathImage('lms') . 'standard/loading.gif", overlayBgImage:"' . getPathImage('lms') . 'standard/overlay-85.png", text: {close: "' . Lang::t('_CLOSE') . '", cancel: "' . Lang::t('_UNDO') . '", loading:"' . Lang::t('_LOADING') . '" }, onOpen: function (gallery) { window.onbeforeunload = function() { return "' . Lang::t('_CONFIRM_EXIT', 'organization', 'lms') . '"; } } }; Shadowbox.init(options); Shadowbox.close = function() { window.frames[\'shadowbox_content\'].uiPlayer.closePlayer(true, window); } }); </script>'); } if ($course_stats['total'] == 0 && $page_add) { $GLOBALS['page']->add('' . '<b>' . $lang->def('_NO_COURSE') . '</b> ' . '<br />', 'content'); } if ($page_add) { $GLOBALS['page']->add('</div>', 'content'); } // Coursepath -------------------------------------------------------------- if (!empty($coursepath)) { // find structures of the course path ---------------------------------- $path_slot = $path_man->getPathSlot(array_keys($coursepath)); // coursepath list ----------------------------------------------------- if ($page_add) { $GLOBALS['page']->add('<div id="mycoursepath_list">' . '<h1>' . $lang->def('_COURSEPATH_LIST') . '</h1>', 'content'); } $i = 0; // find course basilar information ------------------------------------- if (!empty($needed_info_for)) { $course_info = $man_course->getAllCourses(false, false, $needed_info_for); } else { $course_info = array(); } while (list($id_path, $path) = each($coursepath)) { $html = '<div class="coursepath_container coursepath_container_simple">'; $html .= '<h2>' . ($path[COURSEPATH_CODE] != '' ? '[' . $path[COURSEPATH_CODE] . '] ' : '') . $path[COURSEPATH_NAME] . '</h2>'; if (!isset($path_courses[$id_path]) || empty($path_courses[$id_path])) { $html .= $lang->def('_NO_COURSE_ASSIGNED_TO_COURSEPATH') . '<br />'; } else { // display the slots foreach ($path_slot[$id_path] as $id_slot => $slot_info) { if ($id_slot == 0) { $html .= '<h3>' . $lang->def('_MANDATORY') . '</h3>'; if (!empty($path_courses[$id_path][$id_slot])) { $html .= '<ul class="coursepath_mainslot">'; } } else { if ($slot_info['min_selection'] > 0 && $slot_info['max_selection'] > 0) { $title = str_replace(array('[min_selection]', '[max_selection]'), array($slot_info['min_selection'], $slot_info['max_selection']), $lang->def('_COURSE_PATH_SLOT_MIN_MAX')); } elseif ($slot_info['max_selection'] > 0) { $title = str_replace('[max_selection]', $slot_info['max_selection'], $lang->def('_COURSE_PATH_SLOT_MAX')); } else { $title = $lang->def('_COURSE_PATH_SLOT'); } $html .= '<h3>' . $title . '</h3>'; if (!empty($path_courses[$id_path][$id_slot])) { $html .= '<ul class="coursepath_otherslot">'; } } while (list($id) = each($path_courses[$id_path][$id_slot])) { if (isset($course_cache[$id])) { $html .= '<li>' . $course_cache[$id] . '</li>'; } else { $html .= '<li>' . dashAcourse($id, 4) . '</li>'; } } if (!empty($path_courses[$id_path][$id_slot])) { $html .= '</ul>'; } } } $html .= '</div>'; if ($page_add) { $GLOBALS['page']->add($html, 'content'); } } if ($page_add) { $GLOBALS['page']->add('</div>', 'content'); } } if ($course_stats['cert_relesable'] < 0) { $course_stats['cert_relesable'] = 0; } return $course_stats; }
public function getBaseEntityRule($id_rule, $id_entities = false, $only_existing = false) { $entities = Docebo::langManager()->getAllLangCode(); array_unshift($entities, 'all'); $entities_name = array(); foreach ($entities as $i => $en) { $ename = new stdClass(); $ename->id_entity = $en; $ename->title = $en; $ename->course_list = array(); $entities_name[$ename->id_entity] = $ename; } if ($only_existing) { $entities_name = array(); } $query = "SELECT id_rule, id_entity, course_list " . "FROM %adm_rules_entity " . "WHERE id_rule = " . (int) $id_rule . ""; if ($id_entities != false) { $query .= " AND id_entity IN ( '" . implode("','", $id_entities) . "' ) "; } $result = $this->db->query($query); while ($entity = $this->db->fetch_obj($result)) { //$entity->course_list = $this->json->decode($entity->course_list); $entities_name[$entity->id_entity]->course_list = $this->json->decode($entity->course_list); } return $entities_name; }
public function mod_group_actionTask() { //check permissions: we should have mod privileges to edit groups if (!$this->permissions['mod']) { $output = array('success' => false, 'message' => $this->_getErrorMessage('no permission')); echo $this->json->encode($output); return; } //read inputs $id_group = Get::req('id_group', DOTY_INT, -1); if ($id_group <= 0) { $output = array('success' => false, 'message' => $this->_getErrorMessage('invalid group')); echo $this->json->encode($output); return; } $_lang_name = Get::req('name', DOTY_MIXED, array()); $_lang_desc = Get::req('description', DOTY_MIXED, array()); $_arr_langs = array(); $arr = Docebo::langManager()->getAllLangcode(); foreach ($arr as $lang_code) { $_arr_langs[$lang_code] = array('name' => isset($_lang_name[$lang_code]) ? $_lang_name[$lang_code] : '', 'description' => isset($_lang_desc[$lang_code]) ? $_lang_desc[$lang_code] : ''); } //update data in DB $res = $this->model->updateGroup($id_group, $_arr_langs); if ($res) { $output = array('success' => true); } else { $output = array('success' => false, 'message' => $this->_getErrorMessage('edit group')); } echo $this->json->encode($output); }
<div class="panel_left_small"> <?php /** * Tree */ $root_node_actions = ''; $languages = array('_ROOT' => Get::sett('title_kb_tree', Lang::t('_ALL_CATEGORIES', 'kb')), '_YES' => Lang::t('_CONFIRM', 'kb'), '_NO' => Lang::t('_UNDO', 'kb'), '_LOADING' => Lang::t('_LOADING', 'standard'), '_NEW_FOLDER_NAME' => Lang::t('_ORGCHART_ADDNODE', 'kb'), '_AREYOUSURE' => Lang::t('_AREYOUSURE', 'kb'), '_NAME' => Lang::t('_NAME', 'standard'), '_MOD' => Lang::t('_MOD', 'standard'), '_DEL' => Lang::t('_DEL', 'standard')); $this->widget('tree', array('id' => 'kbcategorizetree', 'ajaxUrl' => 'ajax.adm_server.php?r=alms/kb/gettreedata&show_actions=0&from_widget=1', 'treeClass' => 'KbFolderTree', 'treeFile' => Get::rel_path('lms') . '/admin/views/kb/kbfoldertree.js', 'languages' => $languages, 'initialSelectedNode' => (int) $selected_node, 'rootActions' => array(), 'show' => 'tree', 'useCheckboxes' => 'true', 'initialSelectorData' => $c_folders, 'hiddenSelection' => 'h_selected_folders')); ?> </div> <div class="panel_right_big"> <?php $all_languages = Docebo::langManager()->getAllLangCode(); $all_languages_id = array_flip($all_languages); $sel_lang = $all_languages_id[$data["r_lang"]]; if ($data['r_type'] == 'scorm') { echo '<div class="align-right">'; echo '<a href="#" id="subcategorize_switch" class="ico-wt-sprite subs_del"><span>' . Lang::t('_CATEGORIZE_OBJECT_ITEMS', 'kb') . '</span></a>'; echo "</div>\n"; $body = Form::openForm('add_res', $form_url) . Form::getHidden('subcategorize_switch', 'subcategorize_switch', '1') . Form::getHidden('org_categorize_switch_subcat', 'org_categorize_switch_subcat', '1'); if (!empty($form_extra_hidden)) { foreach ($form_extra_hidden as $field_id => $val) { $body .= Form::getHidden($field_id, $field_id, $val); } } $body .= Form::closeForm(); $body .= Lang::t('_YOU_WILL_LOSE_PREVIOUS_CATEGORIZATION', 'kb'); $this->widget('dialog', array('id' => 'subcategorize_switch_dialog', 'dynamicContent' => false, 'dynamicAjaxUrl' => false, 'directSubmit' => true, 'header' => Lang::t('_AREYOUSURE', 'kb'), 'body' => $body, 'callback' => 'function() { this.destroy(); }', 'callEvents' => array(array('caller' => 'subcategorize_switch', 'event' => 'click'))));
} else { $_form_id = 'add_group_form'; $_form_action = 'ajax.adm_server.php?r=adm/functionalroles/add_fncrole_action'; } $content .= Form::openForm($_form_id, $_form_action); $content .= Form::getDropdown(Lang::t('_GROUPS', 'fncroles'), 'id_group', 'id_group', $groups_list, isset($id_group) ? $id_group : 0); //if we are editing an existent role, print its id if (isset($id_fncrole)) { $content .= Form::getHidden('id_fncrole', 'id_fncrole', $id_fncrole); } //edit name and description in all languages (in a TabView widget) $content .= '<div id="fncrole_langs_tab" class="yui-navset">'; $_tabview_titles = '<ul class="yui-nav">'; $_tabview_contents = '<div class="yui-content">'; //edit name and description in all languages $_langs = Docebo::langManager()->getAllLanguages(true); foreach ($_langs as $_lang_code => $_lang_data) { $_name = isset($fncrole_langs[$_lang_code]) ? $fncrole_langs[$_lang_code]['name'] : ""; $_desc = isset($fncrole_langs[$_lang_code]) ? $fncrole_langs[$_lang_code]['description'] : ""; $_tabview_titles .= '<li' . ($_lang_code == getLanguage() ? ' class="selected"' : '') . '>' . '<a href="#langs_tab_' . $_lang_code . '"><em>' . $_lang_code . ($_name == '' && isset($id_group) ? ' (*)' : '') . '</em></a></li>'; $_tabview_contents .= '<div id="langs_tab_' . $_lang_code . '">'; $_tabview_contents .= Form::getTextfield(Lang::t('_NAME', 'standard'), 'name_' . $_lang_code, 'name[' . $_lang_code . ']', 255, $_name); $_tabview_contents .= Form::getSimpleTextarea(Lang::t('_DESCRIPTION', 'standard'), 'description_' . $_lang_code, 'description[' . $_lang_code . ']', $_desc); $_tabview_contents .= '</div>'; } //end for $_tabview_titles .= '</ul>'; $_tabview_contents .= '</div>'; $content .= $_tabview_titles . $_tabview_contents; $content .= '</div>'; $content .= Form::closeForm();
function savepages() { checkPerm('mod'); $lang =& DoceboLanguage::createInstance('admin_webpages', 'lms'); $all_languages = Docebo::langManager()->getAllLangCode(); $id_page = importVar('id_page', true, 0); if ($_POST['title'] == '') { $_POST['title'] = $lang->def('_NOTITLE'); } $lang_sel = $_POST['language']; if (isset($_POST['in_home'])) { if (!sql_query("UPDATE " . $GLOBALS['prefix_lms'] . "_webpages SET in_home = 0 \r\n\t\t\tWHERE in_home = 1 \r\n\t\t\t\tAND language = '" . $all_languages[$lang_sel] . "'")) { unset($_POST['in_home']); } } if (isset($_POST['load'])) { $query_insert = "\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_webpages\r\n\t\tSET title = '" . $_POST['title'] . "',\r\n\t\t\tdescription = '" . $_POST['description'] . "',\r\n\t\t\tlanguage = '" . $all_languages[$lang_sel] . "',\r\n\t\t\tin_home = '" . (isset($_POST['in_home']) ? 1 : 0) . "',\r\n\t\t\tpublish = '" . (isset($_POST['publish']) ? 1 : 0) . "'\r\n\t\tWHERE idPages = '" . $id_page . "'"; } else { /**/ list($seq) = sql_fetch_row(sql_query("\r\n\t\tSELECT MAX(sequence) + 1\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_webpages")); $query_insert = "\r\n\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_webpages\r\n\t\t( title, description, language, in_home, publish, sequence ) VALUES \r\n\t\t( \t'" . $_POST['title'] . "',\r\n\t\t\t'" . $_POST['description'] . "',\r\n\t\t\t'" . $all_languages[$lang_sel] . "',\r\n\t\t\t'" . (isset($_POST['in_home']) ? 1 : 0) . "',\r\n\t\t\t'" . (isset($_POST['publish']) ? 1 : 0) . "',\r\n\t\t\t'" . $seq . "')"; } if (!sql_query($query_insert)) { Util::jump_to('index.php?modname=webpages&op=webpages&result=err'); } Util::jump_to('index.php?modname=webpages&op=webpages&result=ok'); }
public function getCategoriesLangs() { //initialize output $output = array(); $lang_codes = Docebo::langManager()->getAllLangCode(); $_langs = array(); for ($i = 0; $i < count($lang_codes); $i++) { $_langs[$lang_codes[$i]] = array('name' => '', 'description' => ''); } $query = "SELECT id_category FROM " . $this->_getCategoriesTable(); $res = $this->db->query($query); if ($res) { while (list($id_category) = $this->db->fetch_row($res)) { $output[$id_category] = $_langs; } } //extract languages from DB $query = "SELECT c.id_category, cl.lang_code, cl.name, cl.description " . " FROM " . $this->_getCategoriesTable() . " as c " . " LEFT JOIN " . $this->_getCategoriesLangTable() . " as cl " . " ON (c.id_category = cl.id_category)"; $res = $this->db->query($query); if ($res) { while ($obj = $this->db->fetch_obj($res)) { if (isset($output[$obj->id_category][$obj->lang_code])) { //avoid possible invalid data in DB $output[$obj->id_category][$obj->lang_code]['name'] = $obj->name; $output[$obj->id_category][$obj->lang_code]['description'] = $obj->description; } } } return $output; }
function confirmModCourseEdition() { checkPerm('mod'); require_once _base_ . '/lib/lib.upload.php'; require_once _base_ . '/lib/lib.multimedia.php'; $array_lang = Docebo::langManager()->getAllLangCode(); $array_lang[] = 'none'; list($id_course_edition) = each($_POST['mod_course_edition']); $path = '/appLms/' . Get::sett('pathcourse'); if (substr($path, -1) != '/' && substr($path, -1) != '\\') { $path = $path . '/'; } $error = 0; $show_level = 0; $file_edition_material = ''; $file_edition_othermaterial = ''; // manage file upload ----------------------------------------- if (is_array($_FILES) && !empty($_FILES) || is_array($_POST["file_to_del"])) { sl_open_fileoperations(); } if (is_array($_POST["file_to_del"])) { foreach ($_POST["file_to_del"] as $field_id => $old_file) { sl_unlink($path . $old_file); } } if (isset($_FILES['course_edition_material']) && $_FILES['course_edition_material']['tmp_name'] != '') { // delete old file if (isset($_POST["old_course_edition_material"]) && !empty($_POST["old_course_edition_material"])) { sl_unlink($path . $_POST["old_course_edition_material"]); } // upload new file $file_edition_material = 'usermaterial_' . mt_rand(0, 100) . '_' . time() . '_' . $_FILES['course_edition_material']['name']; if (!sl_upload($_FILES['course_edition_material']['tmp_name'], $path . $file_edition_material)) { $error = true; $file_edition_material = ''; } } elseif (!isset($_POST["file_to_del"]["course_edition_material"])) { // new not loaded use old file $file_edition_material = isset($_POST["old_course_edition_material"]) ? $_POST["old_course_edition_material"] : ""; } if (isset($_FILES['course_edition_othermaterial']) && $_FILES['course_edition_othermaterial']['tmp_name'] != '') { // delete old file if (isset($_POST["old_course_edition_othermaterial"]) && !empty($_POST["old_course_edition_othermaterial"])) { sl_unlink($path . $_POST["old_course_edition_othermaterial"]); } // upload new file $file_edition_othermaterial = 'otherusermaterial_' . mt_rand(0, 100) . '_' . time() . '_' . $_FILES['course_edition_othermaterial']['name']; if (!sl_upload($_FILES['course_edition_othermaterial']['tmp_name'], $path . $file_edition_othermaterial)) { $error = true; $file_edition_othermaterial = ''; } } else { if (!isset($_POST["file_to_del"]["course_edition_othermaterial"])) { // new not loaded use old file $file_edition_othermaterial = isset($_POST["old_course_edition_othermaterial"]) ? $_POST["old_course_edition_othermaterial"] : ""; } } sl_close_fileoperations(); // save mod in db --------------------------------------- if ($_POST["can_subscribe"] != "2") { $sub_start_date = "NULL"; $sub_end_date = "NULL"; } else { $sub_start_date = "'" . Format::dateDb($_POST["sub_start_date"], "date") . "'"; $sub_end_date = "'" . Format::dateDb($_POST["sub_end_date"], "date") . "'"; } $date_begin = Format::dateDb($_POST['course_edition_date_begin'], 'date'); $date_end = Format::dateDb($_POST['course_edition_date_end'], 'date'); $hour_begin = '-1'; $hour_end = '-1'; if ($_POST['hour_begin']['hour'] != '-1') { $hour_begin = strlen($_POST['hour_begin']['hour']) == 1 ? '0' . $_POST['hour_begin']['hour'] : $_POST['hour_begin']['hour']; if ($_POST['hour_begin']['quarter'] == '-1') { $hour_begin .= ':00'; } else { $hour_begin .= ':' . $_POST['hour_begin']['quarter']; } } if ($_POST['hour_end']['hour'] != '-1') { $hour_end = strlen($_POST['hour_end']['hour']) == 1 ? '0' . $_POST['hour_end']['hour'] : $_POST['hour_end']['hour']; if ($_POST['hour_end']['quarter'] == '-1') { $hour_end .= ':00'; } else { $hour_end .= ':' . $_POST['hour_end']['quarter']; } } $query_course_edition = "\r\n\tUPDATE " . $GLOBALS['prefix_lms'] . "_course_edition\r\n\tSET code \t\t\t\t= '" . $_POST['course_edition_code'] . "',\r\n\t\tname \t\t\t\t= '" . $_POST['course_edition_name'] . "',\r\n\t\tdescription \t\t= '" . $_POST['course_edition_descr'] . "',\r\n\t\tstatus \t\t\t\t= '" . (int) $_POST['course_edition_status'] . "',\r\n\r\n\t\timg_material \t\t='" . $file_edition_material . "',\r\n\t\timg_othermaterial \t='" . $file_edition_othermaterial . "',\r\n\r\n\t\tdate_begin \t\t\t= '" . $date_begin . "',\r\n\t\tdate_end \t\t\t= '" . $date_end . "',\r\n\t\thour_begin \t\t\t= '" . $hour_begin . "',\r\n\t\thour_end \t\t\t= '" . $hour_end . "',\r\n\r\n\t\tmin_num_subscribe \t= '" . (int) $_POST["min_num_subscribe"] . "',\r\n\t\tmax_num_subscribe \t= '" . (int) $_POST["max_num_subscribe"] . "',\r\n\t\tprice \t\t\t\t= '" . $_POST["edition_price"] . "',\r\n\t\tadvance \t\t\t= '" . $_POST["edition_advance"] . "',\r\n\r\n\t\tedition_type \t\t= '" . $_POST["edition_type"] . "',\r\n\t\tallow_overbooking \t= '" . (isset($_POST["allow_overbooking"]) ? 1 : 0) . "',\r\n\t\tcan_subscribe \t\t= '" . (int) $_POST["can_subscribe"] . "',\r\n\t\tsub_start_date \t\t= " . $sub_start_date . ",\r\n\t\tsub_end_date \t\t= " . $sub_end_date . "\r\n\r\n\tWHERE idCourseEdition = '" . $id_course_edition . "'"; if (!sql_query($query_course_edition)) { $error = 1; if ($file_edition_material != '') { sl_unlink($path . $file_edition_material); } if ($file_edition_othermaterial != '') { sl_unlink($path . $file_edition_othermaterial); } } else { $acl_manager =& Docebo::user()->getAclManager(); $group = '/lms/course_edition/' . $id_course_edition . '/subscribed'; $group_idst = $acl_manager->getGroupST($group); if ($group_idst === FALSE) { $group_idst = $acl_manager->registerGroup($group, 'all the user of a course edition', true, "course"); } // -- Let's update the classroom occupation schedule if course type is classroom ---- if (hasClassroom($_POST["edition_type"])) { $old_date_begin = $_POST["old_date_begin"]; $old_date_end = $_POST["old_date_end"]; updateCourseTimtable($_POST["course_id"], $id_course_edition, $date_begin, $date_end, $old_date_begin, $old_date_end); } // ---------------------------------------------------------------------------------- } Util::jump_to('index.php?modname=course&op=course_list&course_category_status=' . importVar('course_category_status') . '&result=ok_course'); }
function adminManager_lang_course() { checkPerm('view'); require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('adminrules', 'framework'); $adminidst = importVar('adminidst', true, 0); $user_pref = new UserPreferences($adminidst); if (isset($_POST['save'])) { $re = $user_pref->setPreference('admin_rules.user_lang_assigned', isset($_POST['admin_lang']) ? urlencode(serialize($_POST['admin_lang'])) : ''); Util::jump_to('index.php?modname=admin_manager&op=view&result=' . ($re ? 1 : 0)); } $all_languages = Docebo::langManager()->getAllLangCode(); $assigned_lang = unserialize(urldecode($user_pref->getAdminPreference('admin_rules.user_lang_assigned'))); $GLOBALS['page']->add(getTitleArea($lang->def('_ADMIN_MANAGMENT'), 'admin_managmer', $lang->def('_ADMIN_MANAGMENT')) . '<div class="std_block">' . Form::getFormHeader($lang->def('_SELECT_LANG_TO_ASSIGN')) . Form::openForm('admin_lang_editing', 'index.php?modname=admin_manager&op=edit_lang') . Form::openElementSpace() . Form::getHidden('adminidst', 'adminidst', $adminidst), 'content'); while (list(, $lang_code) = each($all_languages)) { $GLOBALS['page']->add(Form::getCheckbox('<img src="' . getPathImage('cms') . 'language/' . $lang_code . '.png" alt="' . $lang_code . '" /> ' . $lang_code, 'admin_lang_' . $lang_code, 'admin_lang[' . $lang_code . ']', '1', isset($assigned_lang[$lang_code])), 'content'); } $GLOBALS['page']->add(Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo_pref', 'undo_pref', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content'); }
public function getLangModifyMask($idst) { $old_rules = $this->getProfileRules($idst); $all_languages = Docebo::langManager()->getAllLangCode(); $res = ''; if (isset($old_rules[_RULES_LANG])) { $old_rules[_RULES_LANG] = array_flip($old_rules[_RULES_LANG]); } while (list(, $lang_code) = each($all_languages)) { $res .= Form::getCheckbox('<img src="' . getPathImage('cms') . 'language/' . $lang_code . '.png" alt="' . $lang_code . '" /> ' . $lang_code, 'admin_lang_' . $lang_code, 'admin_lang[' . $lang_code . ']', '1', isset($old_rules[_RULES_LANG][$lang_code])); } return $res; }