function edithtml() { checkPerm('mod'); require_once _base_ . '/lib/lib.form.php'; $query = "\r\n\tSELECT textof\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\tWHERE id_course = '" . $_SESSION['idCourse'] . "'"; $re_htmlfront = sql_query($query); $error = false; if (isset($_POST['save'])) { if (mysql_num_rows($re_htmlfront) > 0) { $upd_query = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\t\t\tSET textof = '" . $_POST['description'] . "'\r\n\t\t\tWHERE id_course = '" . $_SESSION['idCourse'] . "'"; $re = sql_query($upd_query); } else { $ins_query = "\r\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\t\t\t( id_course, textof) VALUES \r\n\t\t\t( \t'" . $_SESSION['idCourse'] . "',\r\n\t\t\t\t'" . $_POST['description'] . "' )"; $re = sql_query($ins_query); } if ($re) { Util::jump_to('index.php?modname=htmlfront&op=showhtml&saveok=1'); } else { $error = true; } } $lang =& DoceboLanguage::createInstance('htmlfront', 'lms'); list($textof) = sql_fetch_row($re_htmlfront); $title_page = array('index.php?modname=htmlfront&op=showhtml' => $lang->def('_HTMLFRONT'), $lang->def('_MOD')); $GLOBALS['page']->add(getTitleArea($title_page, 'htmlfront') . '<div class="std_block">' . getBackUi('index.php?modname=htmlfront&op=showhtml', $lang->def('_BACK')) . ($error ? getErrorUi($lang->def('_ERROR_IN_SAVE')) : '') . Form::openForm('formnotes', 'index.php?modname=htmlfront&op=edithtml') . Form::openElementSpace() . Form::getTextarea($lang->def('_TEXTOF'), 'description', 'description', importVar('description', false, $textof)) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content'); }
function adminConf() { require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('admin_config', 'scs'); $out =& $GLOBALS['page']; $out->setWorkingZone('content'); $out->add(getTitleArea($lang->def('_ADMIN_CONF'), 'admin_conf') . '<div class="std_block">'); if (isset($_POST['save'])) { $query_update = "UPDATE " . $GLOBALS['prefix_scs'] . "_rules_admin SET "; if (isset($_POST['rules'])) { while (list($var_name, $new_value) = each($_POST['rules'])) { $query_update .= " {$var_name} = '" . $new_value . "',"; } $re = sql_query(substr($query_update, 0, -1)); } if ($re) { $out->add(getResultUi($lang->def('_MOD_OK'))); } else { $out->add(getErrorUi($lang->def('_MOD_ERR'))); } } $query_rules_admin = "\r\n\tSELECT server_status, \r\n\t\tenable_recording_function, enable_advice_insert, enable_write, enable_chat_recording, \r\n\t\tenable_private_subroom, enable_public_subroom, \r\n\t\tenable_drawboard_watch, enable_drawboard_write, \r\n\t\tenable_audio, enable_webcam, enable_stream_watch, enable_strem_write, enable_remote_desktop \r\n\tFROM " . $GLOBALS['prefix_scs'] . "_rules_admin"; $re_rules_admin = sql_query($query_rules_admin); $rules = mysql_fetch_array($re_rules_admin); $out->add(Form::openForm('rules_admin', 'index.php?modname=admin_configuration&op=conf') . Form::openElementSpace() . Form::getOpenCombo($lang->def('_SERVER_STATUS')) . Form::getInputRadio('rules_server_status_yes', 'rules[server_status]', 'yes', $rules['server_status'] == 'yes', '') . ' ' . Form::getLabel('', $lang->def('_YES'), 'label_padded') . ' ' . Form::getInputRadio('rules_server_status_no', 'rules[server_status]', 'no', $rules['server_status'] == 'no', '') . ' ' . Form::getLabel('', $lang->def('_NO'), 'label_padded') . ' ' . Form::getCloseCombo() . maskMultiple('enable_recording_function', $rules['enable_recording_function']) . maskMultiple('enable_advice_insert', $rules['enable_advice_insert']) . maskMultiple('enable_write', $rules['enable_write']) . maskMultiple('enable_chat_recording', $rules['enable_chat_recording']) . maskMultiple('enable_private_subroom', $rules['enable_private_subroom']) . maskMultiple('enable_public_subroom', $rules['enable_public_subroom']) . maskMultiple('enable_drawboard_watch', $rules['enable_drawboard_watch']) . maskMultiple('enable_drawboard_write', $rules['enable_drawboard_write']) . maskMultiple('enable_audio', $rules['enable_audio']) . maskMultiple('enable_webcam', $rules['enable_webcam']) . maskMultiple('enable_stream_watch', $rules['enable_stream_watch']) . maskMultiple('enable_strem_write', $rules['enable_strem_write']) . maskMultiple('enable_remote_desktop', $rules['enable_remote_desktop']) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm()); $out->add('</div>'); }
public function getAddEditForm($form_url, $data) { $this->loadJs(); $res = ''; $e = false; if ($data['rule_id'] > 0) { $e = true; } $res .= Form::openForm('main_form', $form_url); $res .= Form::openElementSpace() . Form::getTextfield(Lang::t('_FROM', 'test'), 'from_score', 'from_score', 11, $e ? $data['from_score'] : '') . Form::getTextfield(Lang::t('_TO', 'test'), 'to_score', 'to_score', 11, $e ? $data['to_score'] : '') . '<br />' . '<p class="section_title">' . Lang::t('_COMPETENCES', 'test') . '</p>' . '<div id="competence_box"></div>' . '<div class="form_line_l"> <p><label for="input_add_competence" class="floating">' . Lang::t('_NAME', 'test') . '</label></p> <div class="form_autocomplete_container"> <input type="text" maxlength="255" value="" name="input_add_competence" id="input_add_competence" class="textfield"> <a href="" id="link_add_competence"><img alt="' . Lang::t('_ADD', 'test') . '" src="' . getPathImage() . 'standard/add.png" class="valing-middle"></a> <div id="box_autocomplete_competence"></div> </div> </div>' . '<br />' . '<p class="section_title">' . Lang::t('_COURSES', 'test') . '</p>' . '<div id="course_box"></div>' . '<div class="form_line_l"> <p><label for="input_add_course" class="floating">' . Lang::t('_NEW_COURSE', 'test') . '</label></p> <div class="form_autocomplete_container"> <input type="text" maxlength="255" value="" name="input_add_course" id="input_add_course" class="textfield"> <a href="" id="link_add_course"><img alt="' . Lang::t('_ADD', 'test') . '" src="' . getPathImage() . 'standard/add.png" class="valing-middle"></a> <div id="box_autocomplete_course"></div> </div> </div>' . '<br /><br />' . Form::getTextarea(Lang::t('_FEEDBACK_TEXT', 'test'), 'feedback_txt', 'feedback_txt', $e ? $data['feedback_txt'] : '') . Form::getHidden('rule_id', 'rule_id', (int) $data['rule_id']) . Form::getHidden('competences_list', 'competences_list', '') . Form::getHidden('courses_list', 'courses_list', '') . Form::getHidden('test_id', 'test_id', (int) $data['test_id']) . Form::getHidden('category_id', 'category_id', (int) $data['category_id']) . Form::getHidden('save', 'save', '1') . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('btn_save', 'btn_save', Lang::t('_SAVE', 'test')) . Form::getButton('btn_cancel', 'btn_cancel', Lang::t('_UNDO', 'test')) . Form::closeButtonSpace(); $res .= Form::closeForm(); $res .= '<script type="text/javascript"> var course_ac_url="' . Get::rel_path('adm') . '/ajax.adm_server.php?mn=course&plf=lms&op=course_autocomplete&results=20' . '"; var competence_ac_url="' . Get::rel_path('adm') . '/ajax.adm_server.php?r=adm/competences/competences_autocomplete' . '"; var lang={"remove_item": "' . Lang::t('_DEL', 'test') . '"}; var course_arr=' . ($e && !empty($data['courses_list']) ? $data['courses_list'] : '{}') . '; var competence_arr=' . ($e && !empty($data['competences_list']) ? $data['competences_list'] : '{}') . '; </script>'; return $res; }
function moditem($object_item) { //checkPerm('view', false, 'storage'); require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('item'); $back_coded = htmlentities(urlencode($object_item->back_url)); list($title, $description) = sql_fetch_row(sql_query("\r\n\tSELECT title, description \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_materials_lesson \r\n\tWHERE author = " . getLogUserId() . " AND idLesson = '" . $object_item->getId() . "'")); $GLOBALS['page']->add(getTitleArea($lang->def('_SECTIONNAME_ITEM'), 'item') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&', $object_item->back_url) . '&mod_result=0', $lang->def('_BACK')) . Form::openForm('itemform', 'index.php?modname=item&op=upitem', 'std_form', 'post', 'multipart/form-data') . Form::openElementSpace() . Form::getHidden('idItem', 'idItem', $object_item->getId()) . Form::getHidden('back_url', 'back_url', htmlentities(urlencode($object_item->back_url))) . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', 100, $title) . Form::getFilefield($lang->def('_FILE_MOD'), 'file', 'attach') . Form::getTextarea($lang->def('_DESCRIPTION'), 'description', 'description', $description) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('additem', 'additem', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content'); }
function modpoll() { checkPerm('view', false, 'storage'); $lang =& DoceboLanguage::createInstance('poll'); require_once _base_ . '/lib/lib.form.php'; $id_poll = importVar('id_poll', true, 0); $back_url = urldecode(importVar('back_url')); $url_encode = htmlentities(urlencode($back_url)); list($poll_title, $textof) = sql_fetch_row(sql_query("\r\n\tSELECT title, description\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_poll\r\n\tWHERE id_poll = '" . $id_poll . "'")); $GLOBALS['page']->add(getTitleArea($lang->def('_POLL_SECTION'), 'poll') . '<div class="std_block">' . getBackUi('index.php?modname=poll&op=modpollgui&id_poll=' . $id_poll . '&back_url=' . $url_encode, $lang->def('_BACK')) . Form::OpenForm('addpoll_form', 'index.php?modname=poll&op=uppoll') . Form::openElementSpace() . Form::getHidden('id_poll', 'id_poll', $id_poll) . Form::getHidden('back_url', 'back_url', $url_encode) . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', '255', $poll_title) . Form::getTextarea($lang->def('_DESCRIPTION'), 'textof', 'textof', $textof) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('button_ins', 'button_ins', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content'); }
function list_element_certificate() { checkPerm('view'); require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.table.php'; $mod_perm = checkPerm('mod', true); $id_certificate = importVar('id_certificate', true); // create a language istance for module admin_certificate $lang =& DoceboLanguage::createInstance('certificate', 'lms'); $out =& $GLOBALS['page']; $out->setWorkingZone('content'); $form = new Form(); $page_title = array('index.php?modname=pcertificate&op=certificate' => $lang->def('_TITLE_CERTIFICATE'), $lang->def('_STRUCTURE_CERTIFICATE')); $out->add(getTitleArea($page_title, 'certificate') . '<div class="std_block">' . getBackUi('index.php?modname=pcertificate&op=certificate', $lang->def('_BACK'))); if (isset($_GET['result'])) { switch ($_GET['result']) { case "ok": $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL'))); break; case "err": $out->add(getErrorUi($lang->def('_OPERATION_FAILURE'))); break; case "err_del": $out->add(getErrorUi($lang->def('_OPERATION_FAILURE'))); break; } } $query_structure = "\r\n\tSELECT cert_structure, orientation, bgimage\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_certificate \r\n\tWHERE id_certificate = '" . (int) $id_certificate . "'"; list($structure, $orientation, $bgimage) = sql_fetch_row(sql_query($query_structure)); $out->add('<div class="std_block">'); $out->add(getInfoUi($lang->def('_CERTIFICATE_WARNING'))); $out->add($form->openForm('structure_certificate', 'index.php?modname=pcertificate&op=savecertificate', false, false, 'multipart/form-data')); $out->add($form->openElementSpace() . $form->getTextarea($lang->def('_STRUCTURE_CERTIFICATE'), 'structure', 'structure', $structure) . '<p><b>' . $lang->def('_ORIENTATION') . '</b></p>' . $form->getRadio($lang->def('_PORTRAIT'), 'portrait', 'orientation', 'P', $orientation == 'P') . $form->getRadio($lang->def('_LANDSCAPE'), 'landscape', 'orientation', 'L', $orientation == 'L') . $form->getExtendedFilefield($lang->def('_BACK_IMAGE'), 'bgimage', 'bgimage', $bgimage) . $form->closeElementSpace() . $form->openButtonSpace() . $form->getHidden('id_certificate', 'id_certificate', $id_certificate) . $form->getButton('save_structure', 'save_structure', $lang->def('_SAVE')) . $form->getButton('undo', 'undo', $lang->def('_UNDO')) . $form->closeButtonSpace() . $form->closeForm()); $tb = new Table(0, $lang->def('_TAG_LIST_CAPTION'), $lang->def('_TAG_LIST_SUMMARY')); $tb->setColsStyle(array('', '')); $tb->addHead(array($lang->def('_TAG_CODE'), $lang->def('_TAG_DESCRIPTION'))); //search query of certificates tag $query_format_tag = "\r\n\tSELECT file_name, class_name \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_certificate_tags "; $re_certificate_tags = sql_query($query_format_tag); while (list($file_name, $class_name) = sql_fetch_row($re_certificate_tags)) { if (file_exists($GLOBALS['where_lms'] . '/lib/certificate/' . $file_name)) { require_once $GLOBALS['where_lms'] . '/lib/certificate/' . $file_name; $instance = new $class_name(0, 0); $this_subs = $instance->getSubstitutionTags(); foreach ($this_subs as $tag => $description) { $tb->addBody(array($tag, $description)); } // end foreach } // end if } $out->add($tb->getTable()); $out->add('</div>'); }
function config() { checkPerm('view'); require_once _base_ . '/lib/lib.tab.php'; require_once _base_ . '/lib/lib.form.php'; require_once _adm_ . '/class/class.conf.php'; $lang =& DoceboLanguage::createInstance('configuration', 'framework'); $active_tab = importVar('active_tab', false, 1); //instance class------------------------------------------- $conf = new Config_Framework(); $groups = $conf->getRegroupUnit(); cout(getTitleArea($lang->def('_CONFIGURATION')) . '<div class="std_block">'); //save page if require if (isset($_POST['save_config'])) { if ($conf->saveElement($active_tab)) { cout(getResultUi($lang->def('_OPERATION_SUCCESSFUL'))); } else { cout(getErrorUi($lang->def('_ERROR_IN_SAVE'))); } } cout('<div id="global_conf" class="yui-navset">' . '<ul class="yui-nav">'); while (list($id, $name) = each($groups)) { // print the tab list cout('<li' . ($id == $active_tab ? ' class="selected"' : '') . '><a href="#tab_g_' . $id . '"><em>' . $name['name'] . '</em></a></li>'); } reset($groups); cout('</ul>' . '<div class="yui-content">'); while (list($id, $name) = each($groups)) { // print the tab content cout('<div id="tab_g_' . $id . '">' . '<h2>' . $name['name'] . '</h2>' . '<p style="padding:4px">' . $name['descr'] . '</p>' . Form::openForm('conf_option_' . $id, 'index.php?modname=configuration&op=config') . Form::openElementSpace() . Form::getHidden('active_tab_' . $id, 'active_tab', $id)); switch ($id) { case SMS_GROUP: cout(show_sms_panel($lang) . '<br />'); break; default: cout('<br />'); } cout('' . $conf->getPageWithElement($id) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save_config_' . $id, 'save_config', $lang->def('_SAVE')) . Form::getButton('undo_' . $id, 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::CloseForm() . '<br />' . '</div>'); } cout('<script type="text/javascript"> var targets = YAHOO.util.Selector.query("span[id^=tt_target]"); new YAHOO.widget.Tooltip("tooltip_info", { context:targets, effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.20} }); </script>', 'scripts'); reset($groups); cout('</div>' . '<div style="clear:left"> </div>' . '</div>' . '</div>'); cout('<script type="text/javascript">' . "\tnew YAHOO.widget.TabView('global_conf', {orientation:'left'});" . '</script>', 'scripts'); }
function edit($back_poll) { $lang =& DoceboLanguage::createInstance('poll'); require_once _base_ . '/lib/lib.form.php'; $url_encode = htmlentities(urlencode($back_poll)); if (isset($_POST['add_question'])) { if (!sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\t\t\tSET title_quest = '" . $_POST['title_quest'] . "' \r\n\t\t\tWHERE id_quest = '" . $this->id . "'")) { errorCommunication($lang->def('_ERR_INS_QUEST') . getBackUi('index.php?modname=question_poll&op=edit&type_quest=' . $this->getQuestionType() . '&id_quest=' . $this->id . '&back_poll=' . $url_encode, $lang->def('_BACK'))); } Util::jump_to('' . $back_poll); } list($title_quest) = sql_fetch_row(sql_query("\r\n\t\tSELECT title_quest \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\t\tWHERE id_quest = '" . $this->id . "'")); $GLOBALS['page']->add(getTitleArea($lang->def('_POLL_SECTION'), 'poll') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&', $back_poll), $lang->def('_BACK')) . '<div class="title_big">' . $lang->def('_QUEST_ACRN_' . strtoupper($this->getQuestionType())) . ' - ' . $lang->def('_QUEST_' . strtoupper($this->getQuestionType())) . '</div><br />' . Form::openForm('form_mod_quest', 'index.php?modname=question_poll&op=edit') . Form::openElementSpace() . Form::getHidden('type_quest', 'type_quest', $this->getQuestionType()) . Form::getHidden('id_quest', 'id_quest', $this->id) . Form::getHidden('back_poll', 'back_poll', $url_encode) . Form::getTextarea($lang->def('_POLL_QUEST_TITLE'), 'title_quest', 'title_quest', $title_quest) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('add_question', 'add_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content'); }
function newsletter() { //access control //-TP// funAdminAccess('OP'); checkPerm('view'); require_once _base_ . '/lib/lib.form.php'; $out =& $GLOBALS['page']; $out->setWorkingZone("content"); $lang =& DoceboLanguage::createInstance('admin_newsletter', 'framework'); YuiLib::load(); addJs($GLOBALS['where_framework_relative'] . '/modules/newsletter/', 'newsletter.js'); $form = new Form(); $out->add(getTitleArea($lang->def("_NEWSLETTER"), "newsletter")); $p_size = intval(ini_get('post_max_size')); $u_size = intval(ini_get('upload_max_filesize')); $max_kb = $p_size < $u_size ? $p_size : $u_size; $max = ' (Max. ' . $max_kb . ' Mb) '; $out->add('<script>' . 'var _DEL=\'' . $lang->def('_DEL') . '\';' . 'var _ATTACHMENT=\'' . $lang->def('_ATTACHMENT') . '\';' . 'var _MAX=\'' . $max . '\';' . '</script>'); $out->add("<div class=\"std_block\">\n"); $acl_manager = Docebo::user()->getAclManager(); $user_info = $acl_manager->getUser(Docebo::user()->getIdSt(), false); $myemail = $user_info[ACL_INFO_EMAIL]; if (isset($err) && $err != "") { $out->add("<b><span class=\"fontRed\">{$err}</span><br />\n"); } $out->add($form->openForm("newsletter_form", "index.php?modname=public_newsletter_admin&op=initsend")); $out->add($form->openElementSpace()); $out->add($form->getTextfield($lang->def("_SENDER"), "fromemail", "fromemail", 255, $myemail)); $out->add($form->getTextfield($lang->def("_SUBJECT"), "sub", "sub", 255, "")); $out->add($form->getTextarea($lang->def("_DESCRIPTION"), "msg", "msg", "")); $lang_list = Docebo::langManager()->getAllLangCode(); //array_unshift($lang_list, $lang->def("_DEFAULT"), $lang->def("_ALL")); $lang_list = array(_ANY_LANG_CODE => $lang->def("_ALL")) + $lang_list; $out->add('<div id="file">' . $form->getHidden('file_number', 'file_number', '1') . '<div id="div_file_1">' . $form->getFilefield($lang->def('_ATTACHMENT'), 'file_1', 'file_1', '', '', '<a href="#" onclick="delFile(\'1\'); return false;"><span id="rem_span">' . $lang->def('_DEL') . '</span><a>') . '</div>' . '</div>' . '<br/><a href="#" onclick="addFile(); return false;"><span id="add_span">' . $lang->def('_ADD') . '</span></a>'); $out->add($form->getDropdown($lang->def("_LANGUAGE"), "sel_lang", "sel_lang", $lang_list)); $out->add($form->getRadio($lang->def("_EMAIL"), "send_type_email", "send_type", "email", true)); $out->add($form->getRadio($lang->def("_SEND_SMS"), "send_type_sms", "send_type", "sms", false)); $out->add($form->closeElementSpace()); $out->add($form->openButtonSpace()); $out->add($form->getButton('send', 'send', $lang->def('_SEND'))); $out->add($form->closeButtonSpace()); $out->add($form->closeForm()); $out->add("</div>\n"); }
function additem($object_item) { //checkPerm( 'view', FALSE, 'storage' ); $lang =& DoceboLanguage::createInstance('scorm', 'lms'); require_once _base_ . '/lib/lib.form.php'; $form = new Form(); //area title $GLOBALS['page']->add(getTitleArea($lang->getLangText('_SCORMIMGSECTION'), 'scorm', $lang->getLangText('_SCORMSECTIONNAME'))); $GLOBALS['page']->add('<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&', $object_item->back_url) . '&create_result=0', $lang->getLangText('_BACK_TOLIST'))); $GLOBALS['page']->add(Form::getFormHeader($lang->def('_SCORM_ADD_FORM'))); $GLOBALS['page']->add($form->openForm("scormform", "index.php?modname=scorm&op=insitem", false, false, 'multipart/form-data')); $GLOBALS['page']->add($form->openElementSpace()); $GLOBALS['page']->add($form->getHidden("back_url", "back_url", htmlentities(urlencode($object_item->back_url)))); $GLOBALS['page']->add($form->getFilefield($lang->getLangText('_CONTENTPACKAGE'), "attach", "attach")); $GLOBALS['page']->add($form->getCheckbox($lang->getLangText('_SCORMIMPORTRESOURCES'), "lesson_resources", "lesson_resources", "import")); $GLOBALS['page']->add($form->closeElementSpace()); $GLOBALS['page']->add($form->openButtonSpace()); $GLOBALS['page']->add($form->getButton("scorm_add_submit", "scorm_add_submit", $lang->getLangText('_SCORMLOAD'))); $GLOBALS['page']->add($form->closeButtonSpace()); $GLOBALS['page']->add($form->closeForm() . '</div>'); }
function modpage($object_page) { checkPerm('view', false, 'storage'); require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('htmlpage'); //retriving info list($title, $textof) = sql_fetch_row(sql_query("\r\n\tSELECT title, textof \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_htmlpage \r\n\tWHERE idPage = '" . $object_page->getId() . "'")); // recuper gli allegati $path = '/appLms/htmlpages/'; $query = "SELECT * FROM " . $GLOBALS['prefix_lms'] . "_htmlpage_attachment WHERE idpage = " . $object_page->getId(); $res = mysql_query($query); $attachments = array(); if ($res) { while ($row = mysql_fetch_assoc($res)) { $attachments[] = array('id' => $row['id'], 'title' => $row['title'], 'file' => $GLOBALS['where_files_relative'] . $path . $row['file']); } } $GLOBALS['page']->add(getTitleArea($lang->def('_SECT_PAGE'), 'htmlpage') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&', $object_page->back_url) . '&mod_result=0', $lang->def('_BACK')) . Form::openForm('pageform', 'index.php?modname=htmlpage&op=uppage', false, false, 'multipart/form-data') . Form::openElementSpace() . Form::getHidden('idPage', 'idPage', $object_page->getId()) . Form::getHidden('back_url', 'back_url', htmlentities(urlencode($object_page->back_url))) . '<script>' . "\n" . 'my_n=1;' . "\n" . 'function delAttachment(id) {' . "\n" . ' document.getElementById(id).style.textDecoration="line-through";' . "\n" . ' document.getElementById(\'iddelattachment\').value = document.getElementById(\'iddelattachment\').value+\';\'+id' . "\n" . '}' . "\n" . 'function addAttachment() {' . "\n" . ' my_file = "attach"+my_n;' . "\n" . ' my_filevalue = \'\';' . "\n" . ' if (document.getElementById(my_file))' . "\n" . ' my_filevalue = document.getElementById(my_file).value;' . "\n" . ' my_html = "' . str_replace(array("\r", "\r\n", "\n"), '', addslashes(Form::getFilefield($lang->def('_UPLOAD'), 'attach%%', 'attach%%'))) . '";' . "\n" . ' if (my_filevalue != \'\') {' . "\n" . ' my_n=my_n+1;' . "\n" . ' my_html = my_html.replace(/%%/gi,my_n);' . "\n" . ' newdiv = document.createElement("div");' . "\n" . ' newdiv.innerHTML = my_html;' . "\n" . ' my_divhtml = document.getElementById(\'attachment_area\');' . "\n" . ' my_divhtml.appendChild(newdiv);' . "\n" . ' }' . "\n" . '}' . "\n" . '</script>' . "\n" . '<div class="std_block">' . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', 150, $title) . Form::getTextarea($lang->def('_TEXTOF'), 'textof', 'textof', $textof), 'content'); foreach ($attachments as $attachment) { $GLOBALS['page']->add("<a id=\"" . $attachment['id'] . "\" href=\"" . $attachment['file'] . "\" target=\"_blank\">" . $attachment['title'] . "</a> (<a href=\"javascript:delAttachment(" . $attachment['id'] . ");\">x</a>)<br/>", 'content'); } $GLOBALS['page']->add('<div id="attachment_area">' . Form::getHidden('iddelattachment', 'iddelattachment', '') . Form::getFilefield($lang->def('_UPLOAD'), 'attach1', 'attach1') . '</div>' . '<a href="javascript:addAttachment();">(+)</a>' . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('addhtmlpage', 'addhtmlpage', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '', 'content'); }
function modnotes() { checkPerm('view'); list($title, $textof) = sql_fetch_row(sql_query("\r\n\tSELECT title, textof \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_notes \r\n\tWHERE idNotes = '" . $_GET['idNotes'] . "' AND owner ='" . getLogUserId() . "' AND idCourse='" . $_SESSION['idCourse'] . "'")); require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('notes', 'lms'); $page_title = array('index.php?modname=notes&op=notes' => $lang->def('_NOTES'), $lang->def('_MOD_NOTES')); $GLOBALS['page']->add(getTitleArea(array(), 'notes') . '<div class="std_block">' . getBackUi('index.php?modname=notes&op=notes', $lang->def('_BACK')) . Form::openForm('formnotes', 'index.php?modname=notes&op=upnotes') . Form::openElementSpace() . Form::getHidden('idNotes', 'idNotes', $_GET['idNotes']) . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', 255, $title) . Form::getTextarea($lang->def('_TEXTOF'), 'description', 'description', $textof) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content'); }
function edit($back_test) { $lang =& DoceboLanguage::createInstance('test'); require_once _base_ . '/lib/lib.form.php'; $url_encode = htmlentities(urlencode($back_test)); if (isset($_POST['add_question'])) { if (!sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\t\tSET idCategory = '" . (int) $_POST['idCategory'] . "', \r\n\t\t\t\ttitle_quest = '" . $_POST['title_quest'] . "', \r\n\t\t\t\tdifficult = '" . (int) $_POST['difficult'] . "', \r\n\t\t\t\ttime_assigned = '" . (int) $_POST['time_assigned'] . "' \r\n\t\t\tWHERE idQuest = '" . $this->id . "'")) { errorCommunication($lang->def('_ERR_INS_QUEST') . getBackUi('index.php?modname=question&op=edit&type_quest=' . $this->getQuestionType() . '&idQuest=' . $this->id . '&back_test=' . $url_encode, $lang->def('_BACK'))); } if (!sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\t\tSET score_correct = '" . $this->_checkScore($_POST['max_score']) . "'\r\n\t\t\tWHERE idQuest = '" . $this->id . "'")) { errorCommunication($lang->def('_ERR_INS_QUEST') . getBackUi('index.php?modname=question&op=edit&type_quest=' . $this->getQuestionType() . '&idQuest=' . $this->id . '&back_test=' . $url_encode, $lang->def('_BACK'))); } Util::jump_to('' . $back_test); } //finding categories require_once $GLOBALS['where_lms'] . '/lib/lib.questcategory.php'; $categories = Questcategory::getCategory(); //create array of difficult $arr_dufficult = array(5 => '5 - ' . $lang->def('_VERY_HARD'), 4 => '4 - ' . $lang->def('_HARD'), 3 => '3 - ' . $lang->def('_DIFFICULT_MEDIUM'), 2 => '2 - ' . $lang->def('_DIFFICULT_EASY'), 1 => '1 - ' . $lang->def('_DIFFICULT_VERYEASY')); list($title_quest, $cat_sel, $diff_sel, $sel_time) = sql_fetch_row(sql_query("\r\n\t\tSELECT title_quest, idCategory, difficult, time_assigned \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\tWHERE idQuest = '" . $this->id . "'")); list($max_score) = sql_fetch_row(sql_query("\r\n\t\tSELECT score_correct\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\tWHERE idQuest = '" . $this->id . "'")); $GLOBALS['page']->add(getTitleArea($lang->def('_TEST_SECTION'), 'test') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&', $back_test), $lang->def('_BACK')) . '<div class="title_big">' . $lang->def('_QUEST_ACRN_' . strtoupper($this->getQuestionType())) . ' - ' . $lang->def('_QUEST_' . strtoupper($this->getQuestionType())) . '</div><br />' . Form::openForm('form_mod_quest', 'index.php?modname=question&op=edit') . Form::openElementSpace() . Form::getHidden('type_quest', 'type_quest', $this->getQuestionType()) . Form::getHidden('idQuest', 'idQuest', $this->id) . Form::getHidden('back_test', 'back_test', $url_encode) . Form::getTextarea($lang->def('_QUESTION'), 'title_quest', 'title_quest', $title_quest), 'content'); if (count($categories) > 1) { $GLOBALS['page']->add(Form::getDropdown($lang->def('_TEST_QUEST_CATEGORY'), 'idCategory', 'idCategory', $categories, isset($_POST['idCategory']) ? $_POST['idCategory'] : $cat_sel), 'content'); } $GLOBALS['page']->add(Form::getDropdown($lang->def('_DIFFICULTY'), 'difficult', 'difficult', $arr_dufficult, $diff_sel) . Form::getTextfield($lang->def('_TEST_QUEST_TIMEASS'), 'time_assigned', 'time_assigned', 5, isset($_POST['time_assigned']) ? $_POST['time_assigned'] : $sel_time, $lang->def('_TEST_QUEST_TIMEASS'), $lang->def('_SECONDS')) . Form::getBreakRow() . Form::getTextfield($lang->def('_MAX_SCORE'), 'max_score', 'max_score', 255, isset($_POST['max_score']) ? $_POST['max_score'] : $max_score, $lang->def('_MAX_SCORE')) . Form::getBreakRow() . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('add_question', 'add_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content'); }
/** * this function modify a question * * @param string $back_poll indicates the return url * @return nothing * * @access public * @author Fabio Pirovano (fabio@docebo.com) */ function edit($back_poll) { $lang =& DoceboLanguage::createInstance('poll'); require_once _base_ . '/lib/lib.form.php'; $url_encode = htmlentities(urlencode($back_poll)); //manage number of answer if (isset($_POST['save_question'])) { //update question $ins_query = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_pollquest\r\n\t\t\tSET id_category = '" . (int) $_POST['id_category'] . "',\r\n\t\t\t\ttype_quest = '" . $this->getQuestionType() . "',\r\n\t\t\t\ttitle_quest = '" . $_POST['title_quest'] . "'\r\n\t\t\tWHERE id_quest = '" . (int) $this->id . "'"; if (!sql_query($ins_query)) { getErrorUi($lang->def('_POLL_ERR_INS_QUEST') . getBackUi('index.php?modname=question_poll&op=edit&type_quest=' . $this->getQuestionType() . '&id_quest=' . $this->id . '&back_poll=' . $url_encode, $lang->def('_BACK'))); } //update answer if (!isset($_POST['is_correct'])) { $_POST['is_correct'] = -1; } $min_value = Get::req('min_value', DOTY_INT, 0); $max_value = Get::req('max_value', DOTY_INT, 0); $step_value = (double) str_replace(',', '.', $_POST['step_value']); if ($min_value >= $max_value || $step_value == 0) { $GLOBALS['page']->add(getErrorUi($lang->def('_POLL_ERR_INS_ANSWER') . getBackUi(str_replace('&', '&', $back_poll), $lang->def('_BACK'))), 'content'); } else { $del_answer_query = "DELETE FROM " . $GLOBALS['prefix_lms'] . "_pollquestanswer\r\n\t\t\t\t\t\t\t\t\tWHERE id_quest = '" . (int) $this->id . "'"; if (!sql_query($del_answer_query)) { getErrorUi($lang->def('_POLL_ERR_INS_ANSWER') . getBackUi(str_replace('&', '&', $back_poll), $lang->def('_BACK'))); } else { $query = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_pollquestanswer" . " (id_quest, answer, sequence)" . " VALUES ('" . $this->id . "', '" . $min_value . "', '0')," . " ('" . $this->id . "', '" . $max_value . "', '1')," . " ('" . $this->id . "', '" . $step_value . "', '2');"; if (!sql_query($query)) { getErrorUi($lang->def('_POLL_ERR_INS_ANSWER') . getBackUi(str_replace('&', '&', $back_poll), $lang->def('_BACK'))); } else { Util::jump_to($back_poll); } } } } //insert form require_once _lms_ . '/lib/lib.questcategory.php'; $categories = Questcategory::getCategory(); //writing difficult //load data list($sel_cat, $quest) = sql_fetch_row(sql_query("\r\n\t\tSELECT id_category, title_quest\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquest\r\n\t\tWHERE id_quest = '" . (int) $this->id . "'")); $re_answer = sql_query("\r\n\t\tSELECT id_answer, answer\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquestanswer\r\n\t\tWHERE id_quest = '" . (int) $this->id . "'\r\n\t\tORDER BY sequence"); $array_answer = array(); while (list($id_answer, $answer) = sql_fetch_row($re_answer)) { $array_answer[] = $answer; } if (!empty($array_answer)) { $min_value = $array_answer[0]; $max_value = $array_answer[1]; $step_value = $array_answer[2]; } else { $min_value = ''; $max_value = ''; $step_value = '1'; } $GLOBALS['page']->add(getTitleArea($lang->def('_POLL_SECTION'), 'poll') . '<div class="std_block">' . getBackUi(str_replace('&', '&', $back_poll), $lang->def('_BACK')) . '<div class="title_big">' . $lang->def('_QUEST_ACRN_' . strtoupper($this->getQuestionType())) . ' - ' . $lang->def('_QUEST_' . strtoupper($this->getQuestionType())) . '</div><br />' . Form::openForm('form_add_quest', 'index.php?modname=question_poll&op=edit') . Form::openElementSpace() . Form::getHidden('type_quest', 'type_quest', $this->getQuestionType()) . Form::getHidden('id_quest', 'id_quest', $this->id) . Form::getHidden('back_poll', 'back_poll', $url_encode) . Form::getTextarea($lang->def('_POLL_QUEST_TITLE'), 'title_quest', 'title_quest', isset($_POST['title_quest']) ? stripslashes($_POST['title_quest']) : $quest) . Form::getDropdown($lang->def('_CATEGORY'), 'id_category', 'id_category', $categories, isset($_POST['id_category']) ? $_POST['id_category'] : $sel_cat) . '<div class="no_float"></div><br />' . Form::getTextfield($lang->def('_MIN_VALUE'), 'min_value', 'min_value', 255, $min_value) . Form::getTextfield($lang->def('_MAX_VALUE'), 'max_value', 'max_value', 255, $max_value) . Form::getTextfield($lang->def('_STEP_VALUE'), 'step_value', 'step_value', 255, $step_value), 'content'); $GLOBALS['page']->add(Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save_question', 'save_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content'); }
<?php echo getTitleArea(array('index.php?r=alms/games/show' => Lang::t('_CONTEST', 'games'), Lang::t('_ADD', 'games'))); ?> <div class="std_block"> <?php echo Form::openForm('add_games', 'index.php?r=alms/games/insert', false, false, 'multipart/form-data') . Form::getHidden('title', 'title', 255, Get::req('title', DOTY_MIXED, $data['title'])) . Form::openElementSpace() . Form::getTextfield(Lang::t('_TITLE', 'games'), 'title', 'title', 255, Get::req('title', DOTY_MIXED, $data['title'])) . Form::getDatefield(Lang::t('_START_DATE', 'games'), 'start_date', 'start_date', Get::req('start_date', DOTY_MIXED, $data['start_date'])) . Form::getDatefield(Lang::t('_DATE_END', 'games'), 'end_date', 'end_date', Get::req('end_date', DOTY_MIXED, $data['end_date'])) . Form::getRadioSet(Lang::t('_TYPE', 'games'), 'type_of', 'type_of', array(Lang::t('_LONAME_scormorg', 'storage') => 'scorm'), Get::req('type_of', DOTY_STRING, $data['type_of'])) . Form::getRadioSet(Lang::t('_PLAY_CHANCE', 'games'), 'play_chance', 'play_chance', array(Lang::t('_UNLIMITED', 'games') => 'play_unlimited', Lang::t('_ONLY_ONCE', 'games') => 'play_once'), 'play_unlimited') . Form::getTextarea(Lang::t('_DESCRIPTION', 'games'), 'description', 'description', Get::req('description', DOTY_MIXED, $data['description'])) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', Lang::t('_SAVE', 'games')) . Form::getButton('undo', 'undo', Lang::t('_UNDO', 'games')) . Form::closeButtonSpace() . Form::closeForm(); ?> </div>
Get::title(array('index.php?r=' . $base_link_course . '/show' => Lang::t('_COURSE', 'course'), $id_course === false ? Lang::t('_NEW_COURSE', 'course') : Lang::t('_MOD', 'course') . ': ' . ($course['code'] !== '' ? '[' . $course['code'] . '] ' : '') . $course['name'])); ?> <div class="std_block"> <?php echo Form::openForm('maskcourse_form', 'index.php?r=' . $base_link_course . '/' . ($id_course === false ? 'newcourse' : 'modcourse'), false, 'post', 'multipart/form-data') . Form::getHidden('id_course', 'id_course', $id_course) . Form::openElementSpace() . ($id_course === false ? Form::getLineBox(Lang::t('_CATEGORY_SELECTED', 'course'), $name_category) . Form::getHidden('idCategory', 'idCategory', $_SESSION['course_category']['filter_status']['id_category']) : Form::getDropdown(Lang::t('_CATEGORY_SELECTED', 'course'), 'idCategory', 'idCategory', $model->getCategoryForDropdown(), $course['idCategory'])) . Form::getTextfield(Lang::t('_CODE', 'course'), 'course_code', 'course_code', '50', $course['code']) . Form::getTextfield(Lang::t('_COURSE_NAME', 'course'), 'course_name', 'course_name', '255', $course['name']); if ($course['course_type'] == 'classroom' && $has_editions_or_classrooms) { //this is a classroom course with editions echo Form::getLineBox(Lang::t('_COURSE_TYPE', 'course'), $course_type['classroom']) . Form::getHidden('course_type', 'course_type', 'classroom'); } elseif ($course['course_edition'] > 0 && $has_editions_or_classrooms) { //this is a classroom course with editions echo Form::getLineBox(Lang::t('_COURSE_TYPE', 'course'), $course_type['edition']) . Form::getHidden('course_type', 'course_type', 'edition'); } else { //echo Form::getDropdown(Lang::t('_COURSE_TYPE', 'course'), 'course_type', 'course_type', $course_type, $course['course_type']); echo Form::getDropdown(Lang::t('_COURSE_TYPE', 'course'), 'course_type', 'course_type', $course_type, $id_course === false ? 'elearning' : $course['course_type']); } echo Form::getDropdown(Lang::t('_STATUS', 'course'), 'course_status', 'course_status', $status, $course['status']) . Form::getCheckbox(Lang::t('_DIRECT_PLAY', 'course'), 'direct_play', 'direct_play', '1', $course['direct_play'] == 1) . Form::getTextarea(Lang::t('_DESCRIPTION', 'course'), 'course_descr', 'course_descr', $course['description']) . ($id_course !== false && $course['course_type'] != 'elearning' ? Form::getCheckbox(Lang::t('_CASCADE_MOD_ON_EDITION', 'course'), 'cascade_on_ed', 'cascade_on_ed', 1) : '') . Form::closeElementSpace() . Form::openElementSpace() . Form::openCollasableFieldset(Lang::t('_DETAILS', 'course')) . ($id_course === false ? Form::getDropdown(Lang::t('_COURSE_MENU_TO_ASSIGN', 'course'), 'selected_menu', 'selected_menu', $menu_custom, $sel_custom) : '') . Form::getDropdown(Lang::t('_COURSE_LANG_METHOD', 'course'), 'course_lang', 'course_lang', $array_lang, array_search($course['lang_code'], $array_lang)) . Form::getDropdown(Lang::t('_DIFFICULTY', 'course'), 'course_difficult', 'course_difficult', $difficult_lang, $course['difficult']) . Form::getTextfield(Lang::t('_CREDITS', 'course'), 'credits', 'credits', '50', $course['credits']) . Form::getDropdown(Lang::t('_LABELS', 'label'), 'label', 'label', $label_model->getLabelFromDropdown(true), $id_course === false ? false : $label_model->getCourseLabel($course['idCourse'])) . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_SUBSCRIPTION', 'course')) . Form::getOpenCombo(Lang::t('_COURSE_SUBSRIBE', 'course')) . Form::getRadio(Lang::t('_COURSE_S_GODADMIN', 'course'), 'course_subs_godadmin', 'course_subs', '0', $course['subscribe_method'] == 0) . Form::getRadio(Lang::t('_COURSE_S_MODERATE', 'course'), 'course_subs_moderate', 'course_subs', '1', $course['subscribe_method'] == 1) . Form::getRadio(Lang::t('_COURSE_S_FREE', 'course'), 'course_subs_free', 'course_subs', '2', $course['subscribe_method'] == 2) . Form::getCloseCombo() . Form::getOpenCombo(Lang::t('_USER_CAN_SUBSCRIBE', 'course')) . Form::getRadio(Lang::t('_SUBSCRIPTION_CLOSED', 'course'), 'subscription_closed', 'can_subscribe', '0', $course['can_subscribe'] == 0) . Form::getRadio(Lang::t('_SUBSCRIPTION_OPEN', 'course'), 'subscription_open', 'can_subscribe', '1', $course['can_subscribe'] == 1) . Form::getRadio(Lang::t('_SUBSCRIPTION_IN_PERIOD', 'course') . ":", 'subscription_period', 'can_subscribe', '2', $course['can_subscribe'] == 2) . Form::getCloseCombo() . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_BEGIN', 'course') . ":", 'sub_start_date', 'sub_start_date', $course['sub_start_date']) . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_END', 'course') . ":", 'sub_end_date', 'sub_end_date', $course['sub_end_date']) . Form::getBreakRow() . Form::getOpenCombo(Lang::t('_USER_CAN_UNSUBSCRIBE', 'course')) . Form::getRadio(Lang::t('_COURSE_S_GODADMIN', 'course'), 'no_user_unsubscription', 'auto_unsubscribe', '0', $course['auto_unsubscribe'] == 0) . Form::getRadio(Lang::t('_COURSE_S_MODERATE', 'course'), 'moderated_user_unsubscription', 'auto_unsubscribe', '1', $course['auto_unsubscribe'] == 1) . Form::getRadio(Lang::t('_COURSE_S_FREE', 'course'), 'yes_user_unsubscription', 'auto_unsubscribe', '2', $course['auto_unsubscribe'] == 2) . Form::getCloseCombo() . Form::getDatefield(Lang::t('_UNSUBSCRIBE_DATE_LIMIT', 'course'), 'unsubscribe_date_limit', 'unsubscribe_date_limit', $unsubscribe_date_limit, FALSE, FALSE, '', '', Form::getInputCheckbox('use_unsubscribe_date_limit', 'use_unsubscribe_date_limit', 1, $use_unsubscribe_date_limit, '') . ' ') . Form::getBreakRow() . Form::getTextfield(Lang::t('_COURSE_AUTOREGISTRATION_CODE', 'course'), 'course_autoregistration_code', 'course_autoregistration_code', '255', $course['autoregistration_code']) . Form::getCheckbox(Lang::t('_RANDOM_COURSE_AUTOREGISTRATION_CODE', 'course'), 'random_course_autoregistration_code', 'random_course_autoregistration_code', 0) . Form::getBreakRow() . Form::getCheckbox(Lang::t('_COURSE_SELL', 'course'), 'course_sell', 'course_sell', '1', $course['selling'] == 1) . Form::getTextfield(Lang::t('_COURSE_PRIZE', 'course'), 'course_prize', 'course_prize', '11', $course['prize']) . Form::getTextfield(Lang::t('_COURSE_ADVANCE', 'course'), 'advance', 'advance', '11', $course['advance']) . Form::getHidden('course_em', 'course_em', '0') . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_DISPLAY_MODE', 'course')) . Form::getOpenCombo(Lang::t('_WHERE_SHOW_COURSE', 'course')) . Form::getRadio(Lang::t('_SC_EVERYWHERE', 'course'), 'course_show_rules_every', 'course_show_rules', '0', $course['show_rules'] == 0) . Form::getRadio(Lang::t('_SC_ONLY_IN', 'course'), 'course_show_rules_only_in', 'course_show_rules', '1', $course['show_rules'] == 1) . Form::getRadio(Lang::t('_SC_ONLYINSC_USER', 'course'), 'course_show_rules_onlyinsc_user', 'course_show_rules', '2', $course['show_rules'] == 2) . Form::getCloseCombo() . Form::getOpenCombo(Lang::t('_WHAT_SHOW', 'course')) . Form::getCheckbox(Lang::t('_SHOW_PROGRESS', 'course'), 'course_progress', 'course_progress', '1', $course['show_progress'] == 1) . Form::getCheckbox(Lang::t('_SHOW_TIME', 'course'), 'course_time', 'course_time', '1', $course['show_time'] == 1) . Form::getCheckbox(Lang::t('_SHOW_ADVANCED_INFO', 'course'), 'course_advanced', 'course_advanced', '1', $course['show_extra_info'] == 1) . Form::getCloseCombo() . Form::getDropdown(Lang::t('_SHOW_WHOISONLINE', 'course'), 'show_who_online', 'show_who_online', $show_who_online, $course['show_who_online']) . Form::getOpenCombo(Lang::t('_SHOW_USER_OF_LEVEL', 'course')); while (list($level, $level_name) = each($levels)) { echo Form::getCheckbox($level_name, 'course_show_level_' . $level, 'course_show_level[' . $level . ']', $level, $course['level_show_user'] & 1 << $level); } echo Form::getCloseCombo() . Form::getOpenCombo(Lang::t('_COURSE_STATUS_CANNOT_ENTER', 'course')) . Form::getCheckbox(Lang::t('_USER_STATUS_SUBS', 'course'), 'user_status_' . _CUS_SUBSCRIBED, 'user_status[' . _CUS_SUBSCRIBED . ']', _CUS_SUBSCRIBED, $course['userStatusOp'] & 1 << _CUS_SUBSCRIBED) . Form::getCheckbox(Lang::t('_USER_STATUS_BEGIN', 'course'), 'user_status_' . _CUS_BEGIN, 'user_status[' . _CUS_BEGIN . ']', _CUS_BEGIN, $course['userStatusOp'] & 1 << _CUS_BEGIN) . Form::getCheckbox(Lang::t('_USER_STATUS_END', 'course'), 'user_status_' . _CUS_END, 'user_status[' . _CUS_END . ']', _CUS_END, $course['userStatusOp'] & 1 << _CUS_END) . Form::getCheckbox(Lang::t('_USER_STATUS_SUSPEND', 'course'), 'user_status_' . _CUS_SUSPEND, 'user_status[' . _CUS_SUSPEND . ']', _CUS_SUSPEND, $course['userStatusOp'] & 1 << _CUS_SUSPEND) . Form::getCloseCombo() . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_TIME_OPTION', 'course')) . Form::getDatefield(Lang::t('_DATE_BEGIN', 'course'), 'course_date_begin', 'course_date_begin', $course['date_begin']) . Form::getDatefield(Lang::t('_DATE_END', 'course'), 'course_date_end', 'course_date_end', $course['date_end']) . Form::getLineBox('<label for="hour_begin_hour">' . Lang::t('_HOUR_BEGIN', 'course') . '</label>', Form::getInputDropdown('dropdown_nw', 'hour_begin_hour', 'hour_begin[hour]', $hours, $hb_sel, '') . ' : ' . Form::getInputDropdown('dropdown_nw', 'hour_begin_quarter', 'hour_begin[quarter]', $quarter, $qe_sel, '')) . Form::getLineBox('<label for="hour_end_hour">' . Lang::t('_HOUR_END', 'course') . '</label>', Form::getInputDropdown('dropdown_nw', 'hour_end_hour', 'hour_end[hour]', $hours, $he_sel, '') . ' : ' . Form::getInputDropdown('dropdown_nw', 'hour_end_quarter', 'hour_end[quarter]', $quarter, $qe_sel, '')) . Form::getTextfield(Lang::t('_DAY_OF_VALIDITY', 'course'), 'course_day_of', 'course_day_of', '10', $course['valid_time']) . Form::getTextfield(Lang::t('_MEDIUM_TIME', 'course'), 'course_medium_time', 'course_medium_time', '10', $course['mediumTime']) . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_SPECIAL_OPTION', 'course')) . Form::getTextfield(Lang::t('_MIN_NUM_SUBSCRIBE', 'course'), 'min_num_subscribe', 'min_num_subscribe', '11', $course['min_num_subscribe']) . Form::getTextfield(Lang::t('_MAX_NUM_SUBSCRIBE', 'course'), 'max_num_subscribe', 'max_num_subscribe', '11', $course['max_num_subscribe']) . Form::getCheckbox(Lang::t('_ALLOW_OVERBOOKING', 'course'), 'allow_overbooking', 'allow_overbooking', '1', $course['allow_overbooking'] == 1) . Form::getTextfield(Lang::t('_COURSE_QUOTA', 'course'), 'course_quota', 'course_quota', '11', $course['course_quota'] != COURSE_QUOTA_INHERIT ? $course['course_quota'] : 0) . Form::getCheckbox(Lang::t('_INHERIT_QUOTA', 'course'), 'inherit_quota', 'inherit_quota', '1', $course['course_quota'] == COURSE_QUOTA_INHERIT) . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_DOCUMENT_UPLOAD', 'course')) . Form::getTextfield(Lang::t('_SPONSOR_LINK', 'course'), 'course_sponsor_link', 'course_sponsor_link', '255', $course['linkSponsor']) . Form::getExtendedFilefield(Lang::t('_PATHSPONSOR', 'configuration'), 'course_sponsor_logo', 'course_sponsor_logo', $course["imgSponsor"]) . Form::getExtendedFilefield(Lang::t('_COURSE_LOGO', 'course'), 'course_logo', 'course_logo', $course["img_course"]) . Form::getExtendedFilefield(Lang::t('_COURSE_DEMO', 'course'), 'course_demo', 'course_demo', $course["course_demo"]) . Form::getCheckbox(Lang::t('_USE_LOGO_IN_COURSELIST', 'course'), 'use_logo_in_courselist', 'use_logo_in_courselist', 1, $course["use_logo_in_courselist"]) . Form::getCloseFieldset() . Form::closeElementSpace() . Form::openButtonSpace() . ($_REQUEST['r'] == 'alms/course/newcourse' || $_REQUEST['r'] == 'alms/course/modcourse' && $row[0] == 0 ? Form::getCheckbox(Lang::t('_AUTO_SUBSCRIPTION'), 'auto_subscription', 'auto_subscription', '1', true) : '') . Form::getButton('save', 'save', Lang::t('_SAVE')) . Form::getButton('undo', 'undo', Lang::t('_UNDO')) . Form::closeButtonSpace() . Form::closeForm(); ?> </div> <script type="text/javascript"> var D = YAHOO.util.Dom, E = YAHOO.util.Event; E.onDOMReady(function() { var c = D.get("use_unsubscribe_date_limit"), d = D.get("unsubscribe_date_limit"); E.addListener("no_user_unsubscription", "click", function(e) { var checked = this.checked; c.disabled = checked; d.disabled = checked; });
function mancatalogue($load_id = false) { checkPerm('mod'); require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('catalogue', 'lms'); $out =& $GLOBALS['page']; $title_area = array('index.php?modname=catalogue&op=catlist' => $lang->def('_CATALOGUE')); if ($load_id === false) { $title_area[] = $lang->def('_NEW_CATALOGUE'); $name = ''; $description = ''; } else { $title_area[] = $lang->def('_MOD'); // Retriving data $query_catalogue = "\r\n\t\tSELECT name, description\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_catalogue\r\n\t\tWHERE idCatalogue = '" . (int) $load_id . "'"; list($name, $description) = sql_fetch_row(sql_query($query_catalogue)); } $out->add(getTitleArea($title_area, 'catalogue') . '<div class="std_block">' . Form::openForm('mancatalogue', 'index.php?modname=catalogue&op=savecatalogue') . ($load_id === false ? '' : Form::getHidden('id_cat', 'id_cat', $load_id)) . Form::openElementSpace() . Form::getTextfield($lang->def('_NAME'), 'name', 'name', 255, $name) . Form::getTextarea($lang->def('_DESCRIPTION'), 'description', 'description', $description) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content'); }
function ioTask_UITaskRun(&$module, $action) { checkPerm('view'); require_once _base_ . '/lib/lib.form.php'; $connMgr =& $module->get_connMgr(); $lang =& $module->get_lang(); $out =& $module->get_out(); $form = new Form(); $dimport = new DoceboImport(); $params = $connMgr->get_task_byname(key($action)); $task_name = $params[CONNMGR_TASK_NAME]; $out->setWorkingZone('content'); $out->add(getTitleArea($lang->def('_TASKS'), 'iotask')); $out->add('<div class="std_block">'); $out->add($form->getFormHeader($lang->def('_TASK_RUNNED'))); $out->add($form->openForm('task_delete', 'index.php?modname=iotask&op=display&gotab=tasks')); $out->add($form->openElementSpace()); $out->add($form->getHidden('task_name', 'task_name', $task_name)); $report = $dimport->execute_task($task_name); if (!is_array($report)) { $out->add($report); } else { $out->add($form->getLineBox($lang->def('_TASK_INSERTED'), $report[0]['inserted'])); $out->add($form->getLineBox($lang->def('_OPERATION_SUCCESSFUL'), $report[0]['removed'])); $out->add($form->getLineBox($lang->def('_OPERATION_FAILURE'), count($report) - 1)); foreach ($report as $index => $elem_report) { if ($index !== 0) { $out->add($index . ' - ' . '(' . implode(', ', $report[$index][0]) . ')' . ' - ' . $report[$index][1]); } } } $out->add($form->closeElementSpace()); $out->add($form->openButtonSpace()); $out->add($form->getButton('close', 'close', $lang->def('_CLOSE'))); $out->add($form->closeButtonSpace()); $out->add($form->closeForm()); $out->add('</div>'); }
function showHistory() { checkPerm('mod'); require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.table.php'; $lang =& DoceboLanguage::createInstance('conference', 'lms'); $conference = new Conference_Manager(); cout('<div class="yui-navset yui-navset-top tab_block"> <ul class="yui-nav"> <li class="first"> <a href="index.php?modname=conference&op=show"> <em>' . Lang::t('_ACTIVE', 'conference') . '</em> </a> </li> <li class="selected"> <a href="index.php?modname=conference&op=history"> <em>' . Lang::t('_HISTORY', 'conference') . '</em> </a> </li> </ul> <div class="yui-content">', 'content'); $tb = new Table(10, $lang->def('_OLD_ROOMS'), $lang->def('_OLD_ROOM')); $tb->initNavBar('ini', 'button'); $ini = $tb->getSelectedElement(); if (isset($_POST['unset_filter'])) { unset($_POST['filter_date']); } $date_filter = Get::req('filter_date', DOTY_MIXED, ''); $rooms = $conference->getOldRoom($_SESSION['idCourse'], $ini); $rooms_number = $conference->getOldRoomNumber($_SESSION['idCourse']); if ($rooms_number == 0) { $GLOBALS['page']->add(Form::openForm('history_table', 'index.php?modname=conference&op=history') . Form::openElementSpace() . Form::getDatefield($lang->def('_DATE'), 'filter_date', 'filter_date', $date_filter) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('filter', 'filter', $lang->def('_FILTER')) . Form::getButton('unset_filter', 'unset_filter', $lang->def('_UNDO')) . Form::closeElementSpace() . Form::closeForm() . '<strong id="noroom">' . $lang->def('_NO_ROOM_AVAILABLE') . '</strong>' . '<br/>' . getBackUi('index.php?modname=conference&op=list', $lang->def('_BACK')), 'content'); } else { $cont_h = array($lang->def('_VIDEOCONFERENCE'), $lang->def('_START_DATE'), $lang->def('_MEETING_HOURS'), ''); $type_h = array('table_main_colum', 'align_center nowrap', 'align_center nowrap', 'image'); $tb->setColsStyle($type_h); $tb->addHead($cont_h); foreach ($rooms as $room_info) { $room_id = $room_info['id']; $cont = array(); $cont[] = $room_info['name'] . " (" . $room_info['room_type'] . ")"; $cont[] = Format::date(date('Y-m-d H:i:s', $room_info['starttime']), 'datetime'); $cont[] = $room_info['meetinghours']; $now = time(); if ($room_info['room_type'] == 'teleskill') { $cont[] = '<a href="index.php?modname=conference&op=log&id=' . $room_info['id'] . '" ' . 'title="' . $lang->def('_LOG') . ' : ' . strip_tags($room_info['name']) . '"><img src="' . getPathImage() . '/standard/edit.png' . '" /></a>'; } else { $cont[] = ''; } $tb->addBody($cont); } cout(Form::openForm('history_table', 'index.php?modname=conference&op=history') . Form::openElementSpace() . Form::getDatefield($lang->def('_DATE'), 'filter_date', 'filter_date', $date_filter) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('filter', 'filter', $lang->def('_FILTER')) . Form::getButton('unset_filter', 'unset_filter', $lang->def('_UNDO')) . Form::closeElementSpace() . Form::closeForm() . $tb->getTable() . $tb->getNavBar($ini, $rooms_number) . '<br/>' . getBackUi('index.php?modname=conference&op=list', $lang->def('_BACK')), 'content'); } cout('<div class="nofloat"></div></div></div>', 'content'); }
function loadRenameFolder() { $lang =& DoceboLanguage::CreateInstance('course', 'lms'); $tdb = $this->tdb; $folder = $tdb->getFolderById($this->getSelectedFolderId()); return Form::openElementSpace() . $this->printState() . Form::getTextfield($lang->def('_NAME'), $this->_getFolderNameId(), $this->_getFolderNameId(), 255, $this->getFolderPrintName($folder)) . Form::closeElementSpace() . Form::openButtonSpace() . ' <img src="' . $this->_getRenameImage() . '" alt="' . $this->_getRenameAlt() . '" /> ' . '<input type="submit" class="TreeViewAction" value="' . $lang->def('_MOD') . '"' . ' name="' . $this->_getRenameFolderId() . '" id="' . $this->_getRenameFolderId() . '" />' . ' <img src="' . $this->_getCancelImage() . '" alt="' . $this->_getCancelAlt() . '" /> ' . '<input type="submit" class="TreeViewAction" value="' . $lang->def('_UNDO', 'standard') . '"' . ' name="' . $this->_getCancelId() . '" id="' . $this->_getCancelId() . '" />' . Form::closeButtonSpace(); }
function socialConnectLogin($uid = false, $network_code = false) { require_once _base_ . '/lib/lib.usermanager.php'; $res = ''; $lang = DoceboLanguage::createInstance('login'); $user_manager = new UserManager(); if (!empty($uid) && !empty($network_code)) { session_regenerate_id(); $_SESSION['connect_social']['uid'] = $uid; $_SESSION['connect_social']['network_code'] = $network_code; } $can_connect = false; if (isset($_SESSION['connect_social']) && isset($_SESSION['connect_social']['uid']) && !empty($_SESSION['connect_social']['uid'])) { // read data from session, in case we are on the second step (login attempt) $uid = $_SESSION['connect_social']['uid']; $network_code = $_SESSION['connect_social']['network_code']; $can_connect = true; } // check form submission: if (isset($_POST['undo'])) { // go back to index Util::jump_to('index.php'); } else { if (isset($_POST['login']) && !$can_connect) { // we don't have the social uid to be connected with user account.. Util::jump_to('index.php?modname=login&op=social_connect_login&err=2'); } else { if (isset($_POST['login'])) { // login and connect account $user = DoceboUser::createDoceboUserFromLogin(Get::pReq('login_userid', DOTY_STRING), Get::pReq('login_pwd', DOTY_STRING), 'public_area'); if ($user) { DoceboUser::setupUser($user); $social = new Social(); $social->connectAccount($network_code, $uid); unset($_SESSION['connect_social']); Util::jump_to('index.php?r=lms/elearning/show'); } else { Util::jump_to('index.php?modname=login&op=social_connect_login&err=1'); } } } } switch (Get::gReq('err', DOTY_INT, 0)) { case 1: $res .= UIFeedback::error(Lang::t('_NOACCESS', 'login'), true); break; case 2: $res .= UIFeedback::error(Lang::t('_NO_SOCIAL_ACCOUNT_TO_CONNECT', 'login') . ' <a href="index.php">' . Lang::t('_TRY_AGAIN', 'login') . '</a>', true); break; } $GLOBALS['page']->add(getTitleArea($lang->def('_LOGIN'), 'login') . '<div class="std_block">' . getBackUi('index.php', $lang->def('_BACK')), 'content'); if ($can_connect) { $res .= Get::img('social/' . $network_code . '-24.png') . ' '; $res .= str_replace('[network_code]', Lang::t($network_code, 'social'), Lang::t('_YOU_ARE_CONNECTING_SOCIAL_ACCOUNT', 'social')) . " <b>" . $uid . "</b>"; } $res .= Form::openForm('scl_form', 'index.php?modname=login&op=social_connect_login') . Form::openElementSpace() . Form::getTextfield(Lang::t('_USERNAME', 'login'), 'login_userid', 'login_userid', 255) . Form::getPassword(Lang::t('_PASSWORD', 'login'), 'login_pwd', 'login_pwd', 255) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('login', 'login', Lang::t('_LOGIN', 'login')) . Form::getButton('undo', 'undo', Lang::t('_UNDO', 'login')) . Form::closeButtonSpace() . Form::closeForm(); $GLOBALS['page']->add($res, 'content'); // std_block $GLOBALS['page']->add('</div>', 'content'); // std_block }
<br /> <?php $title = array('index.php?r=' . $base_link_course . '/show' => Lang::t('_COURSE', 'course'), 'index.php?r=' . $base_link_edition . '/show&id_course=' . $model->getIdCourse() => Lang::t('_EDITIONS', 'course'), Lang::t('_ADD', 'course')); echo getTitleArea($title); ?> <div class="std_block"> <?php echo Form::openForm('add_edition_form', 'index.php?r=' . $base_link_edition . '/add&id_course=' . $model->getIdCourse()) . Form::openElementSpace() . Form::getTextfield(Lang::t('_CODE', 'course'), 'code', 'code', 255, $course_info['code']) . Form::getTextfield(Lang::t('_NAME', 'course'), 'name', 'name', 255, $course_info['name']) . Form::getTextarea(Lang::t('_DESCRIPTION', 'course'), 'description', 'description', $course_info['description']) . Form::getDropdown(Lang::t('_STATUS', 'course'), 'status', 'status', $model->getStatusForDropdown()) . Form::getTextfield(Lang::t('_MAX_NUM_SUBSCRIBE', 'course'), 'max_par', 'max_par', 255) . Form::getTextfield(Lang::t('_MIN_NUM_SUBSCRIBE', 'course'), 'min_par', 'min_par', 255) . Form::getTextfield(Lang::t('_COURSE_PRIZE', 'course'), 'price', 'price', 255) . Form::getDatefield(Lang::t('_DATE_BEGIN', 'course'), 'date_begin', 'date_begin') . Form::getDatefield(Lang::t('_DATE_END', 'course'), 'date_end', 'date_end') . '<div class="form_line_l">' . '<p><label for="overbooking" class="floating">' . Lang::t('_ALLOW_OVERBOOKING', 'course') . '</label></p>' . Form::getInputCheckbox('overbooking', 'overbooking', 1, false, false) . '</div>' . '<div class="form_line_l">' . '<p><label for="overbooking" class="floating">' . Lang::t('_SUBSCRIPTION_OPEN', 'course') . '</label></p>' . Form::getInputCheckbox('can_subscribe', 'can_subscribe', 1, false, false) . '</div>' . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_BEGIN', 'course'), 'sub_date_begin', 'sub_date_begin') . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_END', 'course'), 'sub_date_end', 'sub_date_end') . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('ins', 'ins', Lang::t('_SAVE', 'course')) . Form::getButton('undo', 'undo', Lang::t('_UNDO', 'course')) . Form::closeButtonSpace() . Form::closeForm(); ?> </div>
function searchUser(&$url) { checkPerm('view'); require_once _base_ . '/lib/lib.form.php'; require_once $GLOBALS['where_framework'] . '/lib/lib.myfriends.php'; $lang =& DoceboLanguage::createInstance('myfriends', 'lms'); $my_fr = new MyFriends(getLogUserId()); $acl_man =& Docebo::user()->getAclManager(); $GLOBALS['page']->add(getTitleArea(array($url->getUrl() => $lang->def('_MY_FRIENDS'), $lang->def('_SEARCH_USER')), 'myfriends') . '<div class="std_block">', 'content'); if (isset($_POST['send'])) { if ($my_fr->addFriend($_POST['id_friend'], MF_WAITING, $_POST['request'])) { Util::jump_to($url->getUrl('result=ok_del')); } $GLOBALS['page']->add(getErrorUi($lang->def('_ERR_REMOVE_FRIEND'))); } elseif (isset($_GET['id_friend'])) { $GLOBALS['page']->add(Form::openForm('send_request', $url->getUrl('op=searchuser')) . Form::getHidden('id_friend', 'id_friend', $_GET['id_friend']) . Form::openElementSpace() . Form::getTextarea($lang->def('_REQUEST_MESSAGE'), 'request', 'request') . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('send', 'send', $lang->def('_SEND_REQUEST')) . Form::getButton('back_search', 'back_search', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content'); return; } $GLOBALS['page']->add(Form::openForm('', $url->getUrl('op=searchuser')) . Form::getOpenFieldset($lang->def('_SEARCH_USER')) . Form::getTextfield($lang->def('_SEARCH_USERNAME'), 'username', 'username', 255, importVar('username', false, '')) . Form::openButtonSpace() . Form::getButton('search', 'search', $lang->def('_SEARCH')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::getCloseFieldset() . Form::closeForm(), 'content'); if (isset($_POST['username'])) { $finded_user = $acl_man->getUser(false, $acl_man->absoluteId($_POST['username'])); if ($finded_user === false) { $GLOBALS['page']->add($lang->def('_NO_USER_FINDED'), 'content'); } else { require_once _base_ . '/lib/lib.user_profile.php'; if (getLogUserId() != $finded_user[ACL_INFO_IDST]) { $GLOBALS['page']->add('<p class="confirm_friend">' . '<a href="' . $url->getUrl('op=searchuser&id_friend=' . $finded_user[ACL_INFO_IDST] . '') . '">' . $lang->def('_ADD_TO_MY_FIREND') . '</a>' . '</p>', 'content'); } $profile = new UserProfile($finded_user[ACL_INFO_IDST]); $profile->init('profile', 'framework', 'modname=myfriends&op=searchuser', 'ap'); $GLOBALS['page']->add($profile->getUserInfo(), 'content'); } } $GLOBALS['page']->add('</div>', 'content'); }
function select_media(&$out, &$lang) { require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.multimedia.php'; $form = new Form(); $from = importVar("from"); $item_id = (int) importVar("item_id"); $src = ""; $title = ""; $path = ""; switch ($from) { case "cms": if (!canAccessCmsMedia()) { die("You can't access!"); } $path = _FPATH_INTERNAL; $relative_path = _FPATH; $preview_path = _PPATH; $qtxt = "SELECT t1.fname, t1.real_fname, t1.media_url, t2.title FROM " . $GLOBALS["prefix_cms"] . "_media as t1 "; $qtxt .= "LEFT JOIN " . $GLOBALS["prefix_cms"] . "_media_info as t2 ON (t2.idm=t1.idMedia) "; $qtxt .= "WHERE t1.idMedia='" . $item_id . "' AND t1.publish='1'"; $q = sql_query($qtxt); if ($q && mysql_num_rows($q) > 0) { $row = mysql_fetch_array($q); $src = $row["real_fname"]; $title = $row["title"]; if (!empty($row["media_url"])) { $src = $row["media_url"]; } else { $src = $row["real_fname"]; } } break; case "personal": if (!canAccessPersonalMedia()) { die("You can't access!"); } $user_id = Docebo::user()->getIdSt(); $path = _USER_FPATH_INTERNAL; $relative_path = _USER_FPATH; $preview_path = _USER_FPATH; $qtxt = "SELECT real_fname, media_url FROM " . $GLOBALS["prefix_fw"] . "_user_file "; $qtxt .= "WHERE id='" . $item_id . "' AND user_idst='" . $user_id . "' AND type='image'"; $q = sql_query($qtxt); if ($q && mysql_num_rows($q) > 0) { $row = mysql_fetch_array($q); if (!empty($row["media_url"])) { $src = $row["media_url"]; } else { $src = $row["real_fname"]; } } break; } // $src=rawurlencode($src); $res = ""; $url = getPopupBaseUrl() . "&op=main"; if (!empty($row["media_url"])) { $media_url = $row["media_url"]; $popup_file_path = $media_url; } else { $popup_file_path = $path . $src; } addMediaPopupJS($popup_file_path); // TODO: remove inline style if (file_exists($preview_path . $src)) { $style = "width: 100px; padding: 2px; border: 1px solid #AAAAAA; margin-bottom: 0.4em;"; $res .= "<img style=\"" . $style . "\" src=\"" . $preview_path . $src . "\" alt=\"" . $title . "\" title=\"" . $title . "\" />\n"; } else { $media_type = getMediaType($src); $style = "width: 64px; padding: 2px; border: 1px solid #AAAAAA; margin-bottom: 0.4em;"; $res .= "<img style=\"" . $style . "\" src=\"" . getPathImage('fw') . "media/" . $media_type . ".png\" alt=\"" . $title . "\" title=\"" . $title . "\" />\n"; } $res .= $form->openForm("popup_form", $url, false, false, '', "onSubmit=\"insItem();\" onReset=\"closePopup();\""); $res .= $form->openElementSpace(); $type = getPopupSelType(); switch ($type) { case "image": $res .= $form->getTextfield($lang->def("_ALT_TXT"), "alt_text", "alt_text", 255, $title); $res .= $form->getTextfield($lang->def("_TITLE"), "title_text", "title_text", 255, $title); //$res.=$form->getTextfield($lang->def("_BORDER"), "border", "border", 3, "0"); break; case "flash": $flash_info = getSwfInfoArray($relative_path . $src); $res .= $form->getTextfield($lang->def("_WIDTH"), "width", "width", 4, $flash_info["width"]); $res .= $form->getTextfield($lang->def("_HEIGHT"), "height", "height", 4, $flash_info["height"]); $res .= $form->getTextfield($lang->def("_BGCOLOR"), "bgcolor", "border", 7, "#FFF"); break; case "audio": case "video": case "streaming": require_once _base_ . '/lib/lib.json.php'; $json = new Services_JSON(); if (!empty($media_url)) { $code = getStreamingEmbed($media_url, FALSE, $src); } else { $cut_from = strlen($GLOBALS["where_files_relative"]); $base_relative_path = $GLOBALS["base_where_files_relative"] . substr($relative_path, $cut_from); $current_pl = Get::cur_plat(); $site_file_path = getPLSetting($current_pl, "url") . $base_relative_path; $code = getEmbedPlay($site_file_path, $src, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, TRUE); } $code = '<div>' . $code . '</div>'; $core_url = getPLSetting("framework", "url"); $bad_path = $GLOBALS["where_framework_relative"] . "/addons/players/"; $good_path = $core_url . "addons/players/"; $code = str_replace($bad_path, $good_path, $code); $content = array("code" => $code); $embed_code = $json->encode($content); $res .= $form->getHidden("embed_code", "embed_code", rawurlencode($embed_code)); $res .= $src; break; } $res .= $form->closeElementSpace(); $res .= $form->openButtonSpace(); $res .= $form->getButton('apply', 'apply', $lang->def('_SAVE')); $res .= $form->getReset('undo', 'undo', $lang->def('_UNDO')); $res .= $form->closeButtonSpace(); $res .= $form->closeForm(); $out->add($res); }
function modTransaction() { require_once _base_ . '/lib/lib.table.php'; require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.dialog.php'; require_once _lms_ . '/lib/lib.course.php'; require_once _lms_ . '/lib/lib.date.php'; $lang =& DoceboLanguage::createInstance('transaction'); $acl_man = Docebo::user()->getAclManager(); $man_transaction = new Man_Transaction(); $course_man = new Man_Course(); $date_man = new DateManager(); $id_transaction = Get::req('id', DOTY_INT, 0); $transaction_info = $man_transaction->getTransactionInfo($id_transaction); if (isset($_POST['update'])) { $payment_status = Get::req('payment_status', DOTY_INT, 0); $course_status = Get::req('course_status', DOTY_INT, 0); $note = Get::req('note', DOTY_MIXED, ''); if ($man_transaction->updateTransaction($id_transaction, $payment_status, $course_status, $note)) { if (isset($_POST['confirm'])) { $activations = array(); foreach ($_POST['confirm'] as $id => $n) { list($id_course, $id_date) = explode('_', $id); if ($id_date != 0) { $activations[$id_course]['dates'][$id_date] = $id_date; } else { $activations[$id_course] = $id_course; } } if ($man_transaction->activateCourses($id_transaction, $transaction_info['id_user'], $activations)) { Util::jump_to('index.php?modname=transaction&op=transaction&res=ok'); } } else { Util::jump_to('index.php?modname=transaction&op=transaction&res=ok'); } } Util::jump_to('index.php?modname=transaction&op=transaction&res=err_up'); } $array_title = array('index.php?modname=transaction&op=transaction' => $lang->def('_TRANSACTION'), $lang->def('_MOD_TRANSACTION')); //Status info & note $array_payment_status = array('-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_WAITING_PAYMENT'), '1' => $lang->def('_PARTIAL_PAID'), '2' => $lang->def('_PAID')); $array_course_status = array('-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_NO_COURSE_ACTIVATED'), '1' => $lang->def('_SOME_COURSE_ACTIVATED'), '2' => $lang->def('_ALL_COURSE_ACTIVATED')); cout(getTitleArea($array_title) . '<div class="std_block">' . Form::openForm('transaction_info', 'index.php?modname=transaction&op=mod&id=' . $id_transaction) . Form::openElementSpace() . Form::getDropdown($lang->def('_PAYMENT_STATUS_FILTER'), 'payment_status', 'payment_status', $array_payment_status, $transaction_info['payment_status']) . Form::getDropdown($lang->def('_COURSE_STATUS_FILTER'), 'course_status', 'course_status', $array_course_status, $transaction_info['course_status']) . Form::getSimpleTextarea($lang->def('_NOTES'), 'note', 'note', $transaction_info['note']) . Form::closeElementSpace()); //User info $user_info = $acl_man->getUser($transaction_info['id_user'], false); $tb_user = new Table(0, $lang->def('_USER_INFO'), $lang->def('_USER_INFO')); $cont_h = array($lang->def('_USERNAME'), $lang->def('_FIRSTNAME'), $lang->def('_LASTNAME'), $lang->def('_EMAIL')); $type_h = array('', '', '', ''); $tb_user->setColsStyle($type_h); $tb_user->addHead($cont_h); $tb_user->addBody(array($acl_man->relativeId($user_info[ACL_INFO_USERID]), $user_info[ACL_INFO_FIRSTNAME], $user_info[ACL_INFO_LASTNAME], $user_info[ACL_INFO_EMAIL])); cout('<br />' . $tb_user->getTable()); //Payment info if we need it //Product info $tb_product = new Table(0, $lang->def('_PRODUCT_INFO'), $lang->def('_PRODUCT_INFO')); $cont_h = array($lang->def('_CODE'), $lang->def('_NAME'), $lang->def('_DATE_BEGIN'), $lang->def('_DATE_END'), $lang->def('_COURSE_PRIZE'), $lang->def('_CONFIRM_COURSE')); $type_h = array('', '', '', '', '', ''); $tb_product->setColsStyle($type_h); $tb_product->addHead($cont_h); $transaction_course = $man_transaction->getTransactionCourses($id_transaction); foreach ($transaction_course as $id_course => $details) { if (is_array($details)) { foreach ($details['dates'] as $id_date) { $date_info = $date_man->getDateInfo($id_date); $checked = false; $other = ''; if ($man_transaction->controlActivation($id_transaction, $id_course, $id_date)) { $checked = true; $other = 'disabled="disabled"'; } $tb_product->addBody(array($date_info['code'], $date_info['name'], Format::date($date_info['date_begin']), Format::date($date_info['date_end']), $date_info['price'], Form::getInputCheckbox($id_course . '_' . $id_date, 'confirm[' . $id_course . '_' . $id_date . ']', 1, $checked, $other))); } } else { $course_info = $course_man->getCourseInfo($id_course); $checked = false; $other = ''; if ($man_transaction->controlActivation($id_transaction, $id_course)) { $checked = true; $other = 'disabled="disabled"'; } $tb_product->addBody(array($course_info['code'], $course_info['name'], $course_info['date_begin'] !== '0000-00-00' ? Format::date($course_info['date_begin'], 'date') . ($course_info['hour_begin'] !== '-1' ? $course_info['hour_begin'] : '') : '', $course_info['date_end'] !== '0000-00-00' ? Format::date($course_info['date_end'], 'date') . ($course_info['hour_end'] !== '-1' ? $course_info['hour_end'] : '') : '', $course_info['prize'] == '' ? '0' : $course_info['prize'], Form::getInputCheckbox($id_course . '_0', 'confirm[' . $id_course . '_0]', 1, $checked, $other))); } } cout('<br />' . $tb_product->getTable() . Form::openButtonSpace() . Form::getButton('update', 'update', $lang->def('_UPDATE')) . Form::getButton('back_mod', 'back_mod', $lang->def('_BACK')) . Form::closeButtonSpace() . Form::closeForm()); cout('</div>'); }
/** * 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 mycertificate(&$url) { checkPerm('view'); require_once _lms_ . '/lib/lib.course.php'; require_once _base_ . '/lib/lib.table.php'; $lang =& DoceboLanguage::createInstance('profile', 'framework'); $lang =& DoceboLanguage::createInstance('course', 'lms'); $lang =& DoceboLanguage::createInstance('certificate', 'lms'); $admin_level = Docebo::user()->getUserLevelId(); $show_preview = true; //($admin_level == ADMIN_GROUP_ADMIN || $admin_level == ADMIN_GROUP_GODADMIN); $title = $lang->def('_MY_CERTIFICATE', 'certificate'); $html = getTitleArea($title, 'mycertificate') . '<div class="std_block">'; //--- draw time periods dropdown --------------------------------------------- $period_start = ''; $period_end = ''; //extract checking period $p_model = new TimeperiodsAlms(); $year = date("Y"); $p_list = array("0" => $lang->def('_ALL')); $p_selected = Get::req('selected_period', DOTY_INT, 0); $p_data = $p_model->getTimePeriods('', true); if (count($p_data) > 0) { foreach ($p_data as $obj) { $p_list[$obj->id_period] = Format::date($obj->start_date, 'date') . ' - ' . Format::date($obj->end_date, 'date'); if ($p_selected == $obj->id_period) { $period_start = $obj->start_date; $period_end = $obj->end_date; } } } if (!array_key_exists($p_selected, $p_list)) { $p_selected = 0; $period_start = ''; $period_end = ''; } //date dropdown $onchange = ' onchange="javascript:this.form.submit();"'; $html_filter_cert = '' . Form::openForm('selected_period_form_cert', $url->getUrl()) . Form::openElementSpace() . Form::getDropdown(Lang::t('_TIME_PERIODS', 'menu'), 'selected_period_cert', 'selected_period', $p_list, $p_selected, '', '', $onchange) . Form::closeElementSpace() . Form::getHidden('current_tab_cert', 'current_tab', Get::req('current_tab', DOTY_STRING, 'cert')) . Form::getHidden('is_filtering_cert', 'is_filtering_cert', 1) . Form::closeForm(); $html_filter_meta = '' . Form::openForm('selected_period_form_meta', $url->getUrl()) . Form::openElementSpace() . Form::getDropdown(Lang::t('_TIME_PERIODS', 'menu'), 'selected_period_meta', 'selected_period', $p_list, $p_selected, '', '', $onchange) . Form::closeElementSpace() . Form::getHidden('current_tab_meta', 'current_tab', Get::req('current_tab', DOTY_STRING, 'meta')) . Form::getHidden('is_filtering_meta', 'is_filtering_meta', 1) . Form::closeForm(); //---------------------------------------------------------------------------- $cert = new Certificate(); /* * Print certificates tables, subdivided by year and course type */ $html_cert = ''; $tb_cert = new Table(0); $cont_h = array($lang->def('_YEAR', 'standard'), $lang->def('_COURSE_CODE', 'course'), $lang->def('_COURSE', 'course'), $lang->def('_CERTIFICATE_NAME', 'course'), $lang->def('_DATE_END', 'course')); //if ($show_preview) $cont_h[] = '<img src="'.getPathImage('lms').'certificate/preview.gif" alt="'.$lang->def('_PREVIEW').'" />'; //$cont_h[] = '<img src="'.getPathImage('lms').'certificate/certificate.gif" alt="'.$lang->def('_ALT_TAKE_A_COPY').'" />'; if ($show_preview) { $cont_h[] = '<span class="ico-sprite subs_view"><span>' . $lang->def('_PREVIEW') . '"</span></span>'; } $cont_h[] = '<span class="ico-sprite subs_pdf"><span>' . $lang->def('_ALT_TAKE_A_COPY') . '</span></span>'; $type_h = array('img-cell', '', '', 'align-center', 'align-center', 'img-cell', 'img-cell'); if ($show_preview) { $type_h[] = 'nowarp'; } $type_h[] = 'nowarp'; $tb_cert->setColsStyle($type_h); $tb_cert->addHead($cont_h); $available_cert = $cert->certificateForCourses(false, false); $released = $cert->certificateReleased(Docebo::user()->getIdST()); $query_courses = "" . " SELECT c.idCourse, c.code, c.name, u.status AS user_status, c.course_type, c.permCloseLO " . " FROM %lms_course AS c JOIN %lms_courseuser AS u ON (c.idCourse = u.idCourse) " . " WHERE u.idUser = '******' " . ($period_start != '' ? " AND u.date_complete >= '" . $period_start . "' " : "") . ($period_end != '' ? " AND u.date_complete <= '" . $period_end . "' " : "") . " ORDER BY u.date_complete DESC, u.status DESC "; $course_list = sql_query($query_courses); $arr_courses = array(); $arr_courses_ids = array(); while ($obj = sql_fetch_object($course_list)) { $arr_courses[$obj->course_type][] = array($obj->idCourse, $obj->code, $obj->name, $obj->user_status, $obj->permCloseLO); $arr_courses_ids[] = $obj->idCourse; } $arr_course_types = getCourseTypes(); $table_displayed = false; //extract certificates details and availability by courses ids $arr_courses_ids = array_unique($arr_courses_ids); $arr_certificates_availability = array(); $arr_certificates_details = array(); if (count($arr_courses_ids) > 0) { $query = "SELECT id_certificate, id_course, available_for_status " . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_course" . " WHERE id_course IN (" . implode(",", $arr_courses_ids) . ")"; //." WHERE id_certificate = '".$id_cert."'" //." AND id_course IN (".implode(",", $arr_courses_ids).")"; $res = sql_query($query); while (list($id_certificate, $id_course, $available_for_status) = sql_fetch_row($res)) { $arr_certificates_availability[$id_course][$id_certificate] = $available_for_status; } $cont = array(); $query = "SELECT idCourse, date_inscr, date_first_access, date_complete, status" . " FROM %lms_courseuser WHERE idUser = '******'" . " AND idCourse IN (" . implode(",", $arr_courses_ids) . ") " . ($period_start != '' ? " AND date_complete >= '" . $period_start . "' " : "") . ($period_end != '' ? " AND date_complete <= '" . $period_end . "' " : ""); $res = sql_query($query); while (list($id_course, $date_inscr, $date_begin, $date_end, $status) = sql_fetch_row($res)) { $arr_certificate_details[$id_course] = array($date_inscr, $date_begin, $date_end, $status); } } //order arr_courses by key ksort($arr_courses); $years = array(); foreach ($arr_courses as $course_type => $course_data) { if (in_array($course_type, array_keys($arr_course_types))) { //$html .= ''; $tb = new Table(0); $tb->setColsStyle($type_h); $tb->addHead($cont_h); //filter and organize data to display $display_data = array(); foreach ($course_data as $k => $value) { list($id_course, $code, $name, $user_status, $perm_close_lo) = $value; if (isset($available_cert[$id_course])) { $can_rel_exceptional = false; while (list($id_cert, $certificate) = each($available_cert[$id_course])) { if ($cert->certificateAvailableForUser($id_cert, $id_course, getLogUserId())) { if ($certificate[CERT_AV_POINT_REQUIRED] > 0) { $course_score_final = false; if ($perm_close_lo == 0) { require_once $GLOBALS['where_lms'] . '/lib/lib.orgchart.php'; $org_man = new OrganizationManagement(false); $score_final = $org_man->getFinalObjectScore(array(getLogUserId()), array($id_course)); if (isset($score_final[$id_course][getLogUserId()]) && $score_final[$id_course][getLogUserId()]['max_score']) { $course_score_final = $score_final[$id_course][getLogUserId()]['score']; $course_score_final_max = $score_final[$id_course][getLogUserId()]['max_score']; } } else { require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php'; $rep_man = new CourseReportManager(); $score_course = $rep_man->getUserFinalScore(array(getLogUserId()), array($id_course)); if (!empty($score_course)) { $course_score_final = isset($score_course[getLogUserId()][$id_course]) ? $score_course[getLogUserId()][$id_course]['score'] : false; $course_score_final_max = isset($score_course[getLogUserId()][$id_course]) ? $score_course[getLogUserId()][$id_course]['max_score'] : false; } } if ($course_score_final >= $certificate[CERT_AV_POINT_REQUIRED]) { $can_rel_exceptional = true; } } } } reset($available_cert[$id_course]); //count years for rowspans while (list($id_cert, $certificate) = each($available_cert[$id_course])) { //(aggiunto if prima dell'or) if ($cert->certificateAvailableForUser($id_cert, $id_course, getLogUserId())) { //$value[4] = $id_cert; list($available_for_status) = $arr_certificates_availability[$id_course][$id_cert]; list($date_inscr, $date_begin, $date_end, $status) = $arr_certificate_details[$id_course]; if ($available_for_status == 3 && $status == 2 || $available_for_status == 2 && $status == 1 || $available_for_status == 1) { //$year = substr($date_end, 0, 4); switch ($available_for_status) { case 3: $cur_year = substr($date_end, 0, 4); break; case 2: $cur_year = substr($date_begin, 0, 4); break; case 1: $cur_year = substr($date_inscr, 0, 4); break; default: $cur_year = '-'; } // (mi ricreo l'array value perchè manca di date_* BUG FIX) $value = array($id_course, $code, $name, $date_begin, $date_end, $user_status, $perm_close_lo); $value[6] = $id_cert; $query = "SELECT name " . " FROM " . $GLOBALS['prefix_lms'] . "_certificate" . " WHERE id_certificate = " . $id_cert; $res = sql_query($query); list($cname) = sql_fetch_row($res); $value[7] = $cname; if ($can_rel_exceptional && $certificate[CERT_AV_POINT_REQUIRED] > 0) { if (isset($years[$course_type][$cur_year])) { $years[$course_type][$cur_year]++; } else { $years[$course_type][$cur_year] = 1; } $display_data[$cur_year][] = $value; } elseif (!$can_rel_exceptional && $certificate[CERT_AV_POINT_REQUIRED] == 0) { if (isset($years[$course_type][$cur_year])) { $years[$course_type][$cur_year]++; } else { $years[$course_type][$cur_year] = 1; } $display_data[$cur_year][] = $value; } } } } } } if (count($display_data) > 0) { krsort($display_data); } $av_cert = 0; $prev_year = false; $rowspan_counter = 0; require_once $GLOBALS['where_lms'] . '/lib/lib.orgchart.php'; $org_man = new OrganizationManagement(false); foreach ($display_data as $year => $rows) { $first = true; foreach ($rows as $row) { // list($id_course, $code, $name, $user_status, $id_cert) = $row; list($id_course, $code, $name, $date_begin, $date_end, $user_status, $id_cert, $cname) = $row; $cont = array(); if ($first) { $cont[] = array('rowspan' => isset($years[$course_type][$year]) ? $years[$course_type][$year] : 1, 'value' => $year, 'style' => $type_h[0] . ' mycertificate_rowspan' . ($rowspan_counter % 2 > 0 ? '_odd' : '')); $rowspan_counter++; $first = false; } // 2 - the code of the course $cont[] = array('value' => $code, 'style' => $type_h[1]); // 3 - the name of the course $cont[] = array('value' => $name, 'style' => $type_h[2]); // sostituito date_begin con certificate name // 4 - starting date // $cont[] = array( // 'value' => Format::date($date_begin, 'datetime'), // 'style' => $type_h[3] // ); $cont[] = array('value' => $cname, 'style' => $type_h[3]); // 5 - complete date $cont[] = array('value' => Format::date($date_end, 'datetime'), 'style' => $type_h[4]); //-- scores -- $score_start = $org_man->getStartObjectScore(array(Docebo::user()->getIdST()), array($id_course)); $score_final = $org_man->getFinalObjectScore(array(Docebo::user()->getIdST()), array($id_course)); $_value1 = isset($score_start[$id_course][Docebo::user()->getIdST()]) && $score_start[$id_course][Docebo::user()->getIdST()]['max_score'] ? $score_start[$id_course][Docebo::user()->getIdST()]['score'] . ' / ' . $score_start[$id_course][Docebo::user()->getIdST()]['max_score'] : ''; $_value2 = isset($score_final[$id_course][Docebo::user()->getIdST()]) && $score_final[$id_course][Docebo::user()->getIdST()]['max_score'] ? $score_final[$id_course][Docebo::user()->getIdST()]['score'] . ' / ' . $score_final[$id_course][Docebo::user()->getIdST()]['max_score'] : ''; /* hide course scores - remove comment to show // 6 - init score $cont[] = array( 'value' => $_value1, 'style' => $type_h[5] ); // 7 - end score $cont[] = array( 'value' => $_value2, 'style' => $type_h[6] ); */ if (isset($released[$id_course][$id_cert])) { $av_cert++; if ($show_preview) { $cont[] = array('value' => '', 'style' => $type_h[7]); } $_value = '<a class="ico-wt-sprite subs_pdf" href="' . $url->getUrl('op=release_cert&id_certificate=' . $id_cert . '&id_course=' . $id_course) . '" ' . ' title="' . $lang->def('_TAKE_A_COPY') . '"><span>' . $lang->def('_TAKE_A_COPY') . '</span></a>'; $cont[] = array('value' => $_value, 'style' => $type_h[$show_preview ? 8 : 7]); } else { $av_cert++; if ($show_preview) { $_value = '<a class="ico-wt-sprite subs_view" href="' . $url->getUrl('op=preview_cert&id_certificate=' . $id_cert . '&id_course=' . $id_course) . '" ' . ' title="' . $lang->def('_PREVIEW') . '"><span>' . $lang->def('_PREVIEW') . '</span></a>'; $cont[] = array('value' => $_value, 'style' => $type_h[7]); } $_value = '<a class="ico-wt-sprite subs_pdf" href="' . $url->getUrl('op=release_cert&id_certificate=' . $id_cert . '&id_course=' . $id_course) . '" ' . ' title="' . $lang->def('_NEW_CERTIFICATE') . '"><span>' . $lang->def('_NEW_CERTIFICATE') . '</span></a>'; $cont[] = array('value' => $_value, 'style' => $type_h[$show_preview ? 8 : 7]); } $tb->addBody($cont); } } if ($av_cert > 0) { $table_displayed = true; $html_cert .= '<h2 class="mycertificate_title">' . $arr_course_types[$course_type] . '</h2>'; $html_cert .= $tb->getTable(); } } } //end course_type foreach if (!$table_displayed) { $is_filtering = Get::req('is_filtering_cert', DOTY_INT, 0); $html_cert .= '<p>' . ($is_filtering ? $html_filter_cert : '') . $lang->def('_NO_CONTENT') . '</p>'; } else { $html_cert = $html_filter_cert . $html_cert; } //------------------------------------------------------------------------------------------- /* * Print meta-certificates table */ $html_meta = ''; $tb_meta_cert = new Table(0); $cont_h = array(); $cont_h[] = $lang->def('_CODE'); $cont_h[] = $lang->def('_NAME'); $cont_h[] = $lang->def('_COURSE_LIST'); //if ($show_preview) $cont_h[] = '<img src="'.getPathImage('lms').'certificate/preview.gif" alt="'.$lang->def('_PREVIEW').'" />'; //$cont_h[] = '<img src="'.getPathImage('lms').'certificate/certificate.gif" alt="'.$lang->def('_ALT_TAKE_A_COPY').'" />'; if ($show_preview) { $cont_h[] = '<span class="ico-sprite subs_view"><span>' . $lang->def('_PREVIEW') . '"</span></span>'; } $cont_h[] = '<span class="ico-sprite subs_pdf"><span>' . $lang->def('_ALT_TAKE_A_COPY') . '</span></span>'; $type_h = array(); $type_h[] = ''; $type_h[] = ''; $type_h[] = ''; if ($show_preview) { $type_h[] = 'img-cell'; } //'nowrap'; $type_h[] = 'img-cell'; //'nowrap'; $tb_meta_cert->setColsStyle($type_h); $tb_meta_cert->addHead($cont_h); $query = "SELECT c.idMetaCertificate, m.title, m.description, m.idCertificate" . " FROM %lms_certificate_meta_course as c" . " JOIN %lms_certificate_meta as m ON c.idMetaCertificate = m.idMetaCertificate" . " WHERE c.idUser = '******'" . " GROUP BY c.idMetaCertificate" . " ORDER BY m.title, m.description"; $result = sql_query($query); $av_meta_cert = sql_num_rows($result); $cert_meta_html = ''; while (list($id_meta, $name, $description, $id_certificate) = sql_fetch_row($result)) { $cont = array(); $query = "SELECT code, name" . " FROM %lms_certificate" . " WHERE id_certificate = " . " (" . " SELECT idCertificate" . " FROM %lms_certificate_meta" . " WHERE idMetaCertificate = '" . $id_meta . "'" . " )"; list($code, $name) = sql_fetch_row(sql_query($query)); $cont[] = $code; $cont[] = $name; $query_released = "SELECT on_date" . " FROM %lms_certificate_meta_assign" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'"; $result_released = sql_query($query_released); $query = "SELECT user_release" . " FROM %lms_certificate" . " WHERE id_certificate = '" . $id_certificate . "'"; list($user_release) = sql_fetch_row(sql_query($query)); if (sql_num_rows($result_released)) { $course_list = ''; $first = true; $query_course = "SELECT code, name" . " FROM %lms_course" . " WHERE idCourse IN " . "(" . "SELECT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'" . ")"; $result_course = sql_query($query_course); while (list($code, $name) = sql_fetch_row($result_course)) { if ($first) { $first = false; } else { $course_list .= '<br/>'; } $course_list .= '(' . $code . ') - ' . $name; } $cont[] = $course_list; if ($show_preview) { $cont[] = ''; } list($date) = sql_fetch_row($result_released); $cont[] = '<a class="ico-wt-sprite subs_pdf" href="' . $url->getUrl('op=release_cert&id_certificate=' . $id_certificate . '&idmeta=' . $id_meta) . '" ' . ' title="' . $lang->def('_TAKE_A_COPY') . '"><span>' . $lang->def('_TAKE_A_COPY') . '</span></a>'; $tb_meta_cert->addBody($cont); } elseif ($user_release == 0) { $av_meta_cert--; } else { $query = "SELECT idCourse" . " FROM %lms_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'"; $result_int = sql_query($query); $control = true; while (list($id_course) = sql_fetch_row($result_int)) { $query = "SELECT COUNT(*)" . " FROM %lms_courseuser" . " WHERE idCourse = '" . $id_course . "'" . " AND idUser = '******'" . " AND status = '" . _CUS_END . "'"; list($number) = sql_fetch_row(sql_query($query)); if (!$number) { $control = false; } } if ($control) { $course_list = ''; $first = true; $query_course = "SELECT code, name" . " FROM %lms_course" . " WHERE idCourse IN " . "(" . "SELECT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'" . ")"; $result_course = sql_query($query_course); while (list($code, $name) = sql_fetch_row($result_course)) { if ($first) { $first = false; } else { $course_list .= '<br/>'; } $course_list .= '(' . $code . ') - ' . $name; } $cont[] = $course_list; if ($show_preview) { $cont[] = '<a class="ico-wt-sprite subs_view" href="' . $url->getUrl('op=preview_cert&id_certificate=' . $id_certificate . '&idmeta=' . $id_meta) . '" ' . ' title="' . $lang->def('_PREVIEW') . '"><span>' . $lang->def('_PREVIEW') . '</span></a>'; } $cont[] = '<a class="ico-wt-sprite subs_pdf" href="' . $url->getUrl('op=release_cert&id_certificate=' . $id_certificate . '&idmeta=' . $id_meta) . '" ' . ' title="' . $lang->def('_NEW_CERTIFICATE') . '"><span>' . $lang->def('_NEW_CERTIFICATE') . '</span></a>'; $tb_meta_cert->addBody($cont); } else { $av_meta_cert--; } } } if ($av_meta_cert) { $html_meta .= $tb_meta_cert->getTable() . '<br/><br/>'; } else { //$is_filtering = Get::req('is_filtering_meta', DOTY_INT, 0); //$html_meta .= '<p>'.($is_filtering>0 ? $html_filter_meta : '').$lang->def('_NO_CONTENT').'</p>'; $html_meta .= '<p>' . $lang->def('_NO_CONTENT') . '</p>'; } //----------------------------------------------------------------------------- $selected_tab = Get::req('current_tab', DOTY_STRING, 'cert'); $html .= '<div id="mycertificate_tabs" class="yui-navset"> <ul class="yui-nav"> <li' . ($selected_tab == 'cert' ? ' class="selected"' : '') . '><a href="#cert"><em>' . Lang::t('_CERTIFICATE', 'menu') . '</em></a></li> <li' . ($selected_tab == 'meta' ? ' class="selected"' : '') . '><a href="#meta"><em>' . Lang::t('_TITLE_META_CERTIFICATE', 'certificate') . '</em></a></li> </ul> <div class="yui-content"> <div>' . $html_cert . '</div> <div>' . $html_meta . '</div> </div> </div>'; $html .= '</div>'; //close std_block div cout($html, 'content'); YuiLib::load('tabs'); cout('<script type="text/javascript">var myTabs = new YAHOO.widget.TabView("mycertificate_tabs");</script>', 'scripts'); }
<div class="std_block"> <div id="global_conf" class="yui-navset"> <ul class="yui-nav"> <?php while (list($id, $canonical_name) = each($regroup)) { echo '<li' . ($id == $active_tab ? ' class="selected"' : '') . '>' . '<a href="#tab_g_' . $id . '">' . '<em>' . Lang::t('_' . strtoupper($canonical_name), 'configuration') . '</em>' . '</a>' . '</li>'; } reset($regroup); ?> </ul> <div class="yui-content"> <?php while (list($id, $canonical_name) = each($regroup)) { // print the tab content echo '<div id="tab_g_' . $id . '">' . '<h2>' . Lang::t('_' . strtoupper($canonical_name), 'configuration') . '</h2>' . Form::openForm('conf_option_' . $id, 'index.php?r=adm/setting/save') . Form::openElementSpace() . Form::getHidden('active_tab_' . $id, 'active_tab', $id); switch ($id) { case SMS_GROUP: $this->render('sms_group', array()); default: echo '<br />'; } $model->printPageWithElement($id); echo Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save_config_' . $id, 'save_config', Lang::t('_SAVE', 'configuration')) . Form::getButton('undo_' . $id, 'undo', Lang::t('_UNDO', 'configuration')) . Form::closeButtonSpace() . Form::CloseForm() . '<br />' . '</div>'; } ?> </div> <div class="nofloat"> </div> </div> </div> <script type="text/javascript">
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'); }
?> : <?php echo $transaction_info['price']; ?> </li> <li><?php echo Lang::t('_DATE', 'transaction'); ?> : <?php echo Format::date($transaction_info['date_creation'], 'datetime'); ?> </li> <?php if ($transaction_info['paid']) { ?> <li><?php echo Lang::t('_ACTIVE', 'transaction'); ?> : <?php echo Format::date($transaction_info['date_activated'], 'datetime'); ?> </li><?php } ?> </ul> </div> <br/> <?php echo Form::openForm('transaction_mod_form', 'index.php?r=alms/transaction/mod&id_trans=' . $id_trans) . Form::getHidden('id_user', 'id_user', $transaction_info['id_user']) . Form::openElementSpace() . $tb->getTable() . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', Lang::t('_SAVE', 'transaction')) . ($transaction_info['paid'] ? Form::getButton('not_paid', 'not_paid', Lang::t('_SET_NOT_PAID', 'transaction')) : '') . Form::getButton('undo', 'undo', Lang::t('_UNDO', 'transaction')) . Form::closeButtonSpace() . Form::closeForm(); ?> </div>