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 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 importquest() { checkPerm('view', false, 'storage'); $lang =& DoceboLanguage::createInstance('test'); $idTest = importVar('idTest', true, 0); $back_url = urldecode(importVar('back_url')); $back_coded = htmlentities(urlencode($back_url)); require_once _base_ . '/lib/lib.form.php'; $form = new Form(); require_once $GLOBALS['where_lms'] . '/lib/lib.quest_bank.php'; $qb_man = new QuestBankMan(); $supported_format = $qb_man->supported_format(); unset($supported_format[-1]); $title = array('index.php?modname=test&op=modtestgui&idTest=' . $idTest . '&back_url=' . $back_coded => $lang->def('_TEST_SECTION'), $lang->def('_IMPORT')); cout(getTitleArea($title, 'quest_bank') . '<div class="std_block">' . $form->openForm('import_form', 'index.php?modname=test&op=doimportquest', false, false, 'multipart/form-data') . $form->openElementSpace() . '<input type="hidden" name="idTest" value="' . $idTest . '" />' . '<input type="hidden" name="back_url" value="' . $back_coded . '" />' . $form->getFilefield($lang->def('_FILE'), 'import_file', 'import_file') . $form->getRadioSet($lang->def('_TYPE'), 'file_format', 'file_format', array_flip($supported_format), 0) . $form->getTextfield(Lang::t('_LANG_CHARSET', 'admin_lang'), 'file_encode', 'file_encode', 255, 'utf-8') . $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('save', 'save', $lang->def('_IMPORT')) . $form->getButton('undo', 'undo', $lang->def('_UNDO')) . $form->closeButtonSpace() . $form->closeForm() . '</div>', 'content'); }
function importCode_step1() { require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('code'); $id_code_group = Get::req('id_code_group', DOTY_INT, '0'); cout(getTitleArea(array('index.php?modname=code&op=list' => $lang->def('_CODE'), $lang->def('_IMPORT'))) . '<div class="std_block">'); $lang =& DoceboLanguage::createInstance('admin_directory', 'framework'); cout(Form::openForm('directory_importgroupuser', 'index.php?modname=code&op=import_code_2', false, false, 'multipart/form-data')); cout(Form::getFilefield($lang->def('_GROUP_USER_IMPORT_FILE'), 'file_import', 'file_import') . Form::getCheckbox($lang->def('_GROUP_USER_IMPORT_HEADER'), 'import_first_row_header', 'import_first_row_header', 'true') . Form::getTextfield($lang->def('_GROUP_USER_IMPORT_CHARSET'), 'import_charset', 'import_charset', 20, 'UTF-8') . Form::getHidden('id_code_group', 'id_code_group', $id_code_group) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('import_code_2', 'import_code_2', $lang->def('_IMPORT')) . Form::getButton('undo_group', 'undo_group', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm()); cout('</div>'); }
function importquest(&$url) { require_once _lib_ . '/lib.form.php'; $lang =& DoceboLanguage::createInstance('test'); $form = new Form(); require_once _lms_ . '/lib/lib.quest_bank.php'; $qb_man = new QuestBankMan(); $supported_format = array_flip($qb_man->supported_format()); require_once _lms_ . '/lib/lib.questcategory.php'; $quest_categories = array(0 => $lang->def('_NONE')); $cman = new Questcategory(); $arr = $cman->getCategory(); foreach ($arr as $id_category => $name_category) { $quest_categories[$id_category] = $name_category; } unset($arr); $title = array($url->getUrl() => $lang->def('_QUEST_BANK', 'menu_course'), $lang->def('_IMPORT')); cout(getTitleArea($title, 'quest_bank') . '<div class="std_block">' . $form->openForm('import_form', $url->getUrl('op=doimportquest'), false, false, 'multipart/form-data') . $form->openElementSpace() . $form->getFilefield($lang->def('_FILE'), 'import_file', 'import_file') . $form->getRadioSet($lang->def('_FILE_FORMAT'), 'file_format', 'file_format', $supported_format, 0) . $form->getTextfield($lang->def('_FILE_ENCODE'), 'file_encode', 'file_encode', 255, 'utf-8') . $form->getDropdown($lang->def('_QUEST_CATEGORY'), 'quest_category', 'quest_category', $quest_categories) . $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('undo', 'undo', $lang->def('_UNDO')) . $form->getButton('quest_search', 'quest_search', $lang->def('_IMPORT')) . $form->closeButtonSpace() . $form->closeForm() . '</div>', 'content'); }
<?php switch ($step) { //step 1 : choose file and reading options case 1: echo getTitleArea(Lang::t('_ORG_CHART_IMPORT_USERS', 'organization_chart'), 'directory_group'); echo '<div class="std_block">'; echo Form::getFormHeader(Lang::t('_ASSIGN_USERS', 'admin_directory')); echo Form::openForm('directory_importgroupuser', 'index.php?r=' . $this->link . '/importusers', false, false, 'multipart/form-data'); //echo Form::getHidden('id', 'id', $id_org); echo Form::getHidden('step', 'step', 2); echo Form::openElementSpace(); echo Form::getFilefield(Lang::t('_GROUP_USER_IMPORT_FILE', 'admin_directory'), 'file_import', 'file_import'); //echo Form::getTextfield(Lang::t('_GROUP_USER_IMPORT_SEPARATOR', 'admin_directory'), 'import_separator', 'import_separator', 1, ','); echo Form::getRadioSet(Lang::t('_GROUP_USER_IMPORT_SEPARATOR', 'admin_directory'), 'import_separator', 'import_separator', array(Lang::t('_AUTODETECT', 'standard') => 'auto', '<b>,</b>' => 'comma', '<b>;</b>' => 'dotcomma', Lang::t('_MANUAL', 'standard') . ': ' . Form::getInputTextfield('', 'import_separator_manual', 'import_separator_manual', "", "", 255) => 'manual'), 'auto'); echo Form::getCheckbox(Lang::t('_GROUP_USER_IMPORT_HEADER', 'admin_directory'), 'import_first_row_header', 'import_first_row_header', 'true', true); echo Form::getTextfield(Lang::t('_GROUP_USER_IMPORT_CHARSET', 'admin_directory'), 'import_charset', 'import_charset', 20, 'UTF-8'); echo Form::getDropdown(Lang::t('_DIRECTORY_MEMBERTYPETREE', 'admin_directory'), 'id', 'id', $orgchart_list, $id_org); echo Form::getRadioSet(Lang::t('_FORCE_PASSWORD_CHANGE', 'admin_directory'), 'pwd_force_change_policy', 'pwd_force_change_policy', array(Lang::t('_NO', 'standard') => 'false', Lang::t('_YES', 'standard') => 'true', Lang::t('_SERVERINFO', 'configuration') => 'by_setting', Lang::t('_DO_NOTHING', 'preassessment') => 'do_nothing'), 'do_nothing'); echo Form::closeElementSpace(); echo Form::openButtonSpace(); echo Form::getButton('import_groupuser_2', 'import_groupuser_2', Lang::t('_NEXT', 'standard')); echo Form::getButton('import_groupcancel', 'import_groupcancel', Lang::t('_UNDO', 'standard')); echo Form::closeButtonSpace(); echo Form::closeForm(); echo '</div>'; break; //step 2 : set columns //step 2 : set columns case 2: echo getTitleArea(Lang::t('_ORG_CHART_IMPORT_USERS', 'organization_chart'), 'directory_group');
function add_personal_media(&$out, &$lang) { if (!canAccessPersonalMedia()) { die("You can't access!"); } require_once _base_ . "/lib/lib.form.php"; $url = getPopupBaseUrl() . "&op=inspersonal"; $form = new Form(); $GLOBALS['page']->add($form->openForm("popup_form", $url, false, false, "multipart/form-data") . $form->openElementSpace() . $form->getFilefield($lang->def("_FILENAME"), "file", "file") . $form->getTextfield($lang->def("_MEDIA_URL"), "media_url", "media_url", 255) . $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('save', 'save', $lang->def('_SAVE')) . $form->getReset('undo', 'undo', $lang->def('_UNDO')) . $form->closeButtonSpace() . $form->closeForm()); }
<?php echo getTitleArea(array('index.php?r=alms/label/show' => Lang::t('_LABELS', 'label'), Lang::t('_MOD', 'label'))); ?> <div class="std_block"> <?php echo Form::openForm('mod_label_form', 'index.php?r=alms/label/mod&id_common_label=' . $id_common_label, false, false, 'multipart/form-data') . Form::openElementSpace() . Form::getFilefield(Lang::t('_IMAGE', 'label'), 'label_image', 'label_image') . ($model->getLabelFile($id_common_label) !== '' ? '<img style="height: 48px;" src="' . $GLOBALS['where_files_relative'] . '/appLms/label/' . $model->getLabelFile($id_common_label) . '" />' . Form::getCheckbox(Lang::t('_DEL_LABEL_IMAGE', 'label'), 'del_label_image', 'del_label_image', false) : ''); ?> <div id="label_edit" class="yui-navset"> <ul class="yui-nav"> <?php foreach ($all_languages as $lang_code) { echo '<li' . ($lang_code == getLanguage() ? ' class="selected"' : '') . '>' . '<a href="#langs_tab_' . $lang_code . '"><em>' . $lang_code . '</em></a>' . '</li>'; } ?> </ul> <div class="yui-content"> <?php foreach ($all_languages as $lang_code) { echo '<div id="langs_tab_' . $lang_code . '">' . Form::getTextfield(Lang::t('_TITLE', 'label'), $lang_code . '_title', $lang_code . '_title', 255, isset($label_info[$lang_code]) ? $label_info[$lang_code][LABEL_TITLE] : '') . Form::getSimpleTextarea(Lang::t('_DESCRIPTION', 'label'), $lang_code . '_description', $lang_code . '_description', isset($label_info[$lang_code]) ? $label_info[$lang_code][LABEL_DESCRIPTION] : '') . '</div>'; } ?> </div> </div> <script type="text/javascript"> new YAHOO.widget.TabView("label_edit"); </script> <?php echo Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('update', 'update', Lang::t('_UPDATE', 'label')) . Form::getButton('undo', 'undo', Lang::t('_UNDO', 'label')) . Form::closeButtonSpace() . Form::closeForm(); ?> </div>
function modmessage($tk, $perm, $url, $pb) { $res = ""; //global $activeForumUpload; if ((int) $pb != 0) { $pbtxt = "&pb={$pb}"; } else { $pbtxt = ""; } $mod_perm = $perm["can_moderate"]; $read_perm = $perm["can_read"]; $write_perm = $perm["can_write"]; $upload_perm = $perm["can_upload"]; $title_mess = $textof = ''; if (isset($_GET['idMessage'])) { list($title_mess, $textof, $author) = sql_fetch_row(sql_query("\r\n\t\t\tSELECT title, textof, author\r\n\t\t\tFROM " . $this->prefix . "_sysforum\r\n\t\t\tWHERE idMessage = '" . (int) $_GET['idMessage'] . "'")); } else { return; } if ($author != Docebo::user()->getIdSt()) { return; } //if( ($erased_t || $locked_t) && !$mod_perm) { if (!$write_perm && !$mod_perm) { $res .= '<div class="stdBlock">' . $this->lang->def("_CANNOTENTER") . '</div>'; return $res; } require_once _base_ . "/lib/lib.form.php"; $form = new Form(); $form_url = $url . "&sf_op=upmessage" . $this->getUrlExtra(); $res .= $form->openForm("comment_form", $form_url, "", "", "multipart/form-data"); $res .= $form->openElementSpace(); $res .= $form->getTextfield($this->lang->def("_SUBJECT") . ":", "title", "title", 255, $title_mess); $res .= $form->getTextarea($this->lang->def("_DESCRIPTION") . ":", "textof", "textof", $textof); if ($upload_perm) { $res .= $form->getFilefield($this->lang->def("_ATTACHMENT") . ":", "attach", "attach"); } $res .= $form->getHidden("idMessage", "idMessage", (int) $_GET['idMessage']); $res .= $form->closeElementSpace(); $res .= $form->openButtonSpace(); $res .= $form->getButton('save', 'save', $this->lang->def('_SAVE')); $res .= $form->getButton('undo', 'undo', $this->lang->def('_UNDO')); $res .= $form->closeButtonSpace(); $res .= $form->closeForm(); return $res; }
function edit_files($mode = "edit") { require_once _base_ . '/lib/lib.upload.php'; require_once _base_ . '/lib/lib.form.php'; $form = new Form(); $out =& $GLOBALS['page']; $out->setWorkingZone('content'); $lang =& DoceboLanguage::createInstance('project', "lms"); // Controllo che l'utente non cerchi di entrare in progetti a cui non e' iscritto. $id = $_GET["id"]; $itemid = importVar("itemid"); $myprj = user_projects(Docebo::user()->getIdSt()); $view_perm = checkPerm('view', true); if ($view_perm && in_array($id, $myprj) && (is_owner(Docebo::user()->getIdSt(), $id) || is_admin(Docebo::user()->getIdSt(), $id))) { //area title $out->add(getTitleArea($lang->def("_PROJECT_MANAGER"), "project")); $out->add('<div class="std_block">'); if ($mode == "edit") { $goto = "prjedititem"; } if ($mode == "new") { $goto = "prjadditem"; } if (isset($_POST["applychanges"])) { $ftitle = $_POST["ftitle"]; $fver = $_POST["fver"]; $fdesc = $_POST["fdesc"]; if ($mode == "new") { $ok = 1; //save file sl_open_fileoperations(); if (!isset($_FILES['attach']) || $_FILES['attach']['name'] == '') { $savefile = ''; } else { $savefile = $_SESSION['idCourse'] . '_' . mt_rand(0, 100) . '_' . time() . '_' . $_FILES['attach']['name']; if (!file_exists(_FPATH_INTERNAL . $savefile)) { if (!sl_upload($_FILES['attach']['tmp_name'], _FPATH_INTERNAL . $savefile)) { $savefile = ''; $ok = 0; } } else { $savefile = ''; $ok = 0; } } sl_close_fileoperations(); if ($ok && $savefile != "") { $query = sql_query("INSERT INTO " . $GLOBALS["prefix_lms"] . "_prj_files (pid,fname,ftitle,fver,fdesc) VALUES('{$id}','" . (get_magic_quotes_gpc() ? $savefile : mysql_escape_string($savefile)) . "','{$ftitle}','{$fver}','{$fdesc}');"); } } if ($mode == "edit") { $query = sql_query("UPDATE " . $GLOBALS["prefix_lms"] . "_prj_files SET ftitle='{$ftitle}',fver='{$fver}',fdesc='{$fdesc}' WHERE id='{$itemid}' LIMIT 1;"); } Util::jump_to(" index.php?modname=project&op=showprj&id={$id}"); } $url = "index.php?modname=project&op=showprj&id=" . $id; $out->add(getBackUi($url, $lang->def('_BACK'))); if ($mode == "edit") { $query = sql_query("SELECT * FROM " . $GLOBALS["prefix_lms"] . "_prj_files WHERE pid='{$id}' AND id='{$itemid}';"); if ($query && mysql_num_rows($query) > 0) { $row = mysql_fetch_array($query); } $label = $lang->def("_SAVE"); } else { if ($mode == "new") { $row = array(); $label = $lang->def("_SAVE"); } } $ftitle = isset($row["ftitle"]) ? $row["ftitle"] : ''; $fver = isset($row["fver"]) ? $row["fver"] : ''; $fdesc = isset($row["fdesc"]) ? $row["fdesc"] : ''; $url = "index.php?modname=project&op={$goto}&type=file&id={$id}&itemid=" . $itemid; $out->add($form->openForm("form_name", $url, "", "", "multipart/form-data")); $out->add($form->openElementSpace()); if ($mode == "new") { $out->add($form->getFilefield($lang->def("_FILE"), "attach", "attach")); } $out->add($form->getTextfield($lang->def("_TITLE"), "ftitle", "ftitle", 255, $ftitle)); $out->add($form->getTextfield($lang->def("_VERSION"), "fver", "fver", 255, $fver)); $out->add($form->getSimpleTextarea($lang->def("_DESCRIPTION"), "fdesc", "fdesc", $fdesc)); $out->add($form->getHidden("applychanges", "applychanges", 1)); $out->add($form->closeElementSpace()); $out->add($form->openButtonSpace()); $out->add($form->getButton('save', 'save', $label)); $out->add($form->getButton('undo', 'undo', $lang->def('_UNDO'))); $out->add($form->closeButtonSpace()); $out->add($form->closeForm()); $out->add('<br /></div>'); return 0; $out->add("<form method=\"post\" action=\"index.php?modname=project&op={$goto}&type=file&id={$id}&itemid={$itemid}\" enctype=\"multipart/form-data\">\n" . '<input type="hidden" id="authentic_request_prj" name="authentic_request" value="' . Util::getSignature() . '" />'); $query = sql_query("SELECT * FROM " . $GLOBALS["prefix_lms"] . "_prj_files WHERE pid='{$id}' AND id='{$itemid}';"); if ($query && mysql_num_rows($query) > 0 || $mode == "new") { if ($mode == "edit") { $row = mysql_fetch_array($query); } if ($mode == "new") { $row = array(); } $out->add("<table><tr>\n"); if ($mode != "edit") { $out->add($lang->def("_FILE") . ":<br /><input type=\"file\" id=\"attach\" name=\"attach\" size=\"50\" /><br /><br />\n"); } $out->add($lang->def("_TITLE") . ": <input type=\"text\" size=\"40\" id=\"ttitle\" name=\"ftitle\" value=\"" . (isset($row["ftitle"]) ? $row["ftitle"] : '') . "\" /></td>\n"); $out->add("</tr><tr><td>" . $lang->def("_VERSION") . "\n "); $out->add("<input type=\"text\" size=\"35\" id=\"fver\" name=\"fver\" value=\"" . (isset($row["fver"]) ? $row["fver"] : '') . "\" /></td>\n"); $out->add("</tr><tr><td colspan=\"2\"><textarea rows=\"6\" cols=\"30\" id=\"fdesc\" name=\"fdesc\">\n"); $out->add(isset($row["fdesc"]) ? $row["fdesc"] : ''); $out->add("</textarea>\n"); $out->add("</td></tr></table><br />\n"); } if ($mode == "edit") { $label = $lang->def("_SAVE"); } if ($mode == "new") { $label = $lang->def("_SAVE"); } $out->add("<input type=\"hidden\" id=\"applychanges\" name=\"applychanges\" value=\"1\" />\n"); $out->add("<input class=\"button\" type=\"submit\" value=\"" . $label . "\" />\n"); $out->add("</form><br />\n"); //$out->add("<div align=\"center\"><b>[ <a href=\"index.php?modname=project&op=showprj&id=$id\">".$lang->def("_BACK")."</a> ]</b></div>\n"); $url = "index.php?modname=project&op=showprj&id=" . $id; $out->add(getBackUi($url, $lang->def('_BACK'))); $out->add('<br /></div>'); } else { $out->add("You can't access"); } }
function modfiles() { checkPerm('mod'); require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('course'); $id_file = importVar('id_file', true, 0); list($title) = sql_fetch_row(sql_query("\r\n\tSELECT title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_course_file \r\n\tWHERE id_course='" . $_SESSION['idCourse'] . "' AND id_file='" . $id_file . "'")); $GLOBALS['page']->add(getTitleArea(array('index.php?modname=course&op=infocourse' => $lang->def('_INFO'), $lang->def('_MOD')), 'infocourse') . '<div class="std_block">' . getBackUi('index.php?modname=course&op=infocourse', $lang->def('_BACK')) . Form::openForm('', 'index.php?modname=course&op=upfiles', false, false, 'multipart/form-data') . Form::openElementSpace() . Form::getHidden('id_file', 'id_file', $id_file) . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', 50, $title) . Form::getFilefield($lang->def('_UPLOAD'), 'attach', 'attach') . $lang->def('_IF_NEW_FILE') . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('insert', 'insert', $lang->def('_INSERT')) . Form::getButton('undo_info', 'undo_info', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content'); }
<?php echo getTitleArea(array('index.php?r=alms/label/show' => Lang::t('_LABELS', 'label'), Lang::t('_ADD', 'label'))); ?> <div class="std_block"> <?php echo Form::openForm('add_label_form', 'index.php?r=alms/label/add', false, false, 'multipart/form-data') . Form::openElementSpace() . Form::getFilefield(Lang::t('_IMAGE', 'label'), 'label_image', 'label_image'); ?> <div id="label_edit" class="yui-navset"> <ul class="yui-nav"> <?php foreach ($all_languages as $lang_code) { echo '<li' . ($lang_code == getLanguage() ? ' class="selected"' : '') . '>' . '<a href="#langs_tab_' . $lang_code . '"><em>' . $lang_code . '</em></a>' . '</li>'; } ?> </ul> <div class="yui-content"> <?php foreach ($all_languages as $lang_code) { echo '<div id="langs_tab_' . $lang_code . '">' . Form::getTextfield(Lang::t('_TITLE', 'label'), $lang_code . '_title', $lang_code . '_title', 255) . Form::getSimpleTextarea(Lang::t('_DESCRIPTION', 'label'), $lang_code . '_description', $lang_code . '_description') . '</div>'; } ?> </div> </div> <script type="text/javascript"> new YAHOO.widget.TabView("label_edit"); </script> <?php echo Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('insert', 'insert', Lang::t('_INSERT', 'label')) . Form::getButton('undo', 'undo', Lang::t('_UNDO', 'label')) . Form::closeButtonSpace() . Form::closeForm(); ?>
function importCategory() { include_once _base_ . "/lib/lib.form.php"; $um =& UrlManager::getInstance(); $back_url = $um->getUrl(); if (isset($_POST["undo"])) { // -------------------------- Cancel ------- | Util::jump_to($back_url); } else { if (isset($_POST["conf_import"])) { // -------------- Import ------- | $tmp_fname = $_FILES["file"]["tmp_name"]; $import_arr = $this->wikiManager->getImportArrFromXml($tmp_fname); $this->wikiManager->importNewCategory($import_arr); // TODO: add import into category if cat_id > 0 Util::jump_to($back_url); } else { // ------------------------------------------------ Import Form -- | $res = ""; $form = new Form(); $url = ""; $res .= $form->openForm("import_form", $url, FALSE, FALSE, "multipart/form-data"); $res .= $form->openElementSpace(); $res .= $form->getFilefield($this->lang->def("_FILE"), "file", "file"); $res .= $form->closeElementSpace(); $res .= $form->openButtonSpace(); $res .= $form->getButton('conf_import', 'conf_import', $this->lang->def('_IMPORT')); $res .= $form->getButton('undo', 'undo', $this->lang->def('_UNDO')); $res .= $form->closeButtonSpace(); $res .= $form->closeForm(); return $res; } } }
echo Form::getHidden('id_tmpl', 'id_tmpl', $id); } else { echo Form::openForm('create_template_form', 'index.php?r=adm/templatelayout/save', false, 'POST', 'multipart/form-data'); } ?> <?php echo '<label for="color_1">' . Lang::t('_COLOR_1', 'template') . ':</label> <span id="color_1"></span>'; echo Form::getBreakRow(); echo '<label for="color_2">' . Lang::t('_COLOR_2', 'template') . ':</label> <span id="color_2"></span>'; echo Form::getBreakRow(); echo '<label for="color_3">' . Lang::t('_COLOR_3', 'template') . ':</label> <span id="color_3"></span>'; echo Form::getBreakRow(); echo '<label for="color_4">' . Lang::t('_COLOR_4', 'template') . ':</label> <span id="color_4"></span>'; echo Form::getBreakRow(); echo '<label for="color_5">' . Lang::t('_COLOR_5', 'template') . ':</label> <span id="color_5"></span>'; echo Form::getBreakRow(); echo '<label for="color_6">' . Lang::t('_COLOR_6', 'template') . ':</label> <span id="color_6"></span>'; echo Form::getBreakRow(); echo Form::getFilefield(Lang::t('_LOGO_1'), 'logo_1', 'logo_1', isset($data['logo_1']) ? $data['logo_1'] : ''); echo Form::getFilefield(Lang::t('_LOGO_2'), 'logo_2', 'logo_2', isset($data['logo_2']) ? $data['logo_2'] : ''); ?> <?php echo Form::openButtonSpace(); echo Form::getButton('save', 'save', Lang::t('_SAVE', 'standard')); echo Form::getButton('undo', 'undo', Lang::t('_UNDO', 'standard')); echo Form::closeButtonSpace(); echo Form::closeForm(); } echo getBackUi('index.php?r=adm/templatelayout/show', Lang::t('_BACK', 'template'));
<br /> <?php $_subs_url = '&id_course=' . (int) $id_course . ($id_edition ? '&id_edition=' . (int) $id_edition : '') . ($id_date ? '&id_date=' . (int) $id_date : ''); $title = array('index.php?r=' . $this->link . '/show&id_course=' . $model->getIdCourse() => Lang::t('_COURSE', 'course'), 'index.php?r=' . $this->link . '/show' . $_subs_url => Lang::t('_SUBSCRIBE', 'subscribe') . ' : ' . $course_name, Lang::t('_IMPORT', 'course')); echo getTitleArea($title) . '<div class="std_block">' . Form::openForm('import_course_users', 'index.php?r=' . $this->link . '/import_csv&id_course=' . $model->getIdCourse() . '&id_edition=' . $model->getIdEdition() . '&id_date=' . $model->getIdDate(), false, false, 'multipart/form-data') . Form::openElementSpace() . Form::getFilefield(Lang::t('_IMPORT_FILE', 'subscription'), 'file_import', 'file_import') . Form::getCheckbox(Lang::t('_IMPORT_HEADER', 'subscription'), 'import_first_row_header', 'import_first_row_header', 'true', false) . Form::getHidden('import_separator', 'import_separator', ',') . Form::getHidden('import_charset', 'import_charset', 'UTF-8') . Form::getHidden('step', 'step', '1') . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('next', 'next', Lang::t('_NEXT', 'subscription')) . Form::getButton('undo', 'undo', Lang::t('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>';
function newCourseEditionForm($course_id) { checkPerm('mod'); require_once $GLOBALS['where_lms'] . '/lib/lib.course.php'; require_once _base_ . '/lib/lib.form.php'; //require_once(_i18n_.'/lib.lang.php'); require_once _base_ . '/lib/lib.table.php'; $lang =& DoceboLanguage::CreateInstance('course', 'lms'); $form = new Form(); $array_lang = Docebo::langManager()->getAllLangCode(); $array_lang[] = 'none'; // possibile course status $course_status = array(CST_PREPARATION => $lang->def('_CST_PREPARATION'), CST_AVAILABLE => $lang->def('_CST_AVAILABLE'), CST_EFFECTIVE => $lang->def('_CST_CONFIRMED'), CST_CONCLUDED => $lang->def('_CST_CONCLUDED'), CST_CANCELLED => $lang->def('_CST_CANCELLED')); //type of edition $edition_type = array('elearning' => $lang->def('_COURSE_TYPE_ELEARNING'), 'blended' => $lang->def('_COURSE_TYPE_BLENDED'), 'classroom' => $lang->def('_CLASSROOM')); $query_course = "\r\n\tSELECT \tcode, name, description, lang_code, status, level_show_user, subscribe_method,\r\n\t\tlinkSponsor, mediumTime, permCloseLO, userStatusOp, difficult,\r\n\t\tshow_progress, show_time, show_extra_info, show_rules, date_begin, date_end, hour_begin, hour_end, valid_time,\r\n\t\tmin_num_subscribe, max_num_subscribe, max_sms_budget, selling, prize, advance,\r\n\t\tcourse_type, policy_point, point_to_all, course_edition\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_course\r\n\tWHERE idCourse = '" . $course_id . "'"; $course = mysql_fetch_assoc(sql_query($query_course)); $GLOBALS['page']->add(getTitleArea($lang->def('_EDITIONS') . " '" . $course["name"] . "'", 'course_edition') . '<div class="std_block">' . getBackUi('index.php?modname=course&op=course_list', $lang->def('_BACK')) . $form->getFormHeader($lang->def('_EDITIONS') . " '" . $course["name"] . "'") . $form->openForm('course_edition_creation', 'index.php?modname=course&op=add_course_edition', false, false, 'multipart/form-data') . $form->openElementSpace() . $form->getHidden('course_id', 'course_id', $course_id) . $form->getTextfield($lang->def('_CODE'), 'course_edition_code', 'course_edition_code', '50', $course["code"]) . $form->getTextfield($lang->def('_COURSE_NAME'), 'course_edition_name', 'course_edition_name', '255', $course["name"]) . $form->getDropdown($lang->def('_STATUS'), 'course_edition_status', 'course_edition_status', $course_status, $course['status']) . $form->getTextarea($lang->def('_DESCRIPTION'), 'course_edition_descr', 'course_edition_descr', $course['description']) . $form->getDropdown($lang->def('_COURSE_TYPE'), 'edition_type', 'edition_type', $edition_type, $course["course_type"]), 'content'); $GLOBALS['page']->add($form->getOpenFieldset($lang->def('_COURSE_SUBSCRIPTION')) . $form->getOpenCombo($lang->def('_USER_CAN_SUBSCRIBE')) . $form->getRadio($lang->def('_SUBSCRIPTION_CLOSED'), 'subscription_closed', 'can_subscribe', '0', TRUE) . $form->getRadio($lang->def('_SUBSCRIPTION_OPEN'), 'subscription_open', 'can_subscribe', '1', FALSE) . $form->getRadio($lang->def('_SUBSCRIPTION_IN_PERIOD') . ":", 'subscription_period', 'can_subscribe', '2', FALSE) . $form->getCloseCombo() . $form->getDatefield($lang->def('_SUBSCRIPTION_DATE_BEGIN') . ":", 'sub_start_date', 'sub_start_date', "") . $form->getDatefield($lang->def('_SUBSCRIPTION_DATE_END') . ":", 'sub_end_date', 'sub_end_date', "") . $form->getCloseFieldset(), 'content'); $GLOBALS['page']->add($form->getOpenFieldset($lang->def('_COURSE_SPECIAL_OPTION')) . $form->getTextfield($lang->def('_COURSE_PRIZE'), 'edition_price', 'edition_price', 11, $course["prize"]) . $form->getTextfield($lang->def('_COURSE_ADVANCE'), 'edition_advance', 'edition_advance', 11, $course['advance']) . $form->getTextfield($lang->def('_MIN_NUM_SUBSCRIBE'), 'min_num_subscribe', 'min_num_subscribe', 11, $course["min_num_subscribe"]) . $form->getTextfield($lang->def('_MAX_NUM_SUBSCRIBE'), 'max_num_subscribe', 'max_num_subscribe', 11, $course["max_num_subscribe"]) . $form->getCheckbox($lang->def('_ALLOW_OVERBOOKING'), 'allow_overbooking', 'allow_overbooking', 1) . $form->getCloseFieldset(), 'content'); $hours = array('-1' => '- -', '0' => '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23'); $quarter = array('-1' => '- -', '00' => '00', '15' => '15', '30' => '30', '45' => '45'); if ($course['hour_begin'] != '-1') { $hb_sel = (int) substr($course['hour_begin'], 0, 2); $qb_sel = substr($course['hour_begin'], 3, 2); } else { $hb_sel = $qb_sel = '-1'; } if ($course['hour_end'] != '-1') { $he_sel = (int) substr($course['hour_end'], 0, 2); $qe_sel = substr($course['hour_end'], 3, 2); } else { $he_sel = $qe_sel = '-1'; } $GLOBALS['page']->add($form->getDatefield($lang->def('_DATE_BEGIN'), 'course_edition_date_begin', 'course_edition_date_begin', Format::date($course["date_begin"])) . $form->getDatefield($lang->def('_DATE_END'), 'course_edition_date_end', 'course_edition_date_end', Format::date($course["date_end"])) . $form->getLineBox('<label for="hour_begin_hour">' . $lang->def('_HOUR_BEGIN') . '</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->def('_HOUR_END') . '</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, '')), 'content'); $GLOBALS['page']->add($form->getOpenFieldset($lang->def('_DOCUMENT_UPLOAD')) . $form->getFilefield($lang->def('_USER_MATERIAL'), 'course_edition_user_material', 'course_edition_user_material') . $form->getFilefield($lang->def('_OTHER_USER_MATERIAL'), 'course_edition_otheruser_material', 'course_edition_otheruser_material') . $form->getCloseFieldset() . $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('course_create', 'course_create', $lang->def('_CREATE')) . $form->getButton('course_undo_edition', 'course_undo_edition', $lang->def('_UNDO')) . $form->closeButtonSpace() . $form->closeForm() . '</div>', 'content'); }
<?php Get::title(array('index.php?r=adm/lang/show' => Lang::t('_LANGUAGE', 'admin_lang'), Lang::t('_IMPORT', 'admin_lang'))); ?> <div class="std_block"> <?php echo Form::openForm('import_lang', 'index.php?r=adm/lang/doimport', false, 'post', 'multipart/form-data') . Form::getFilefield(Lang::t('_FILE', 'admin_lang'), 'lang_file', 'lang_file') . Form::getCheckbox(Lang::t('_OVERWRITE_EXISTENT', 'admin_lang'), 'overwrite', 'overwrite', '1') . Form::getCheckbox(Lang::t('_DO_NOT_ADD_MISS', 'admin_lang'), 'noadd_miss', 'noadd_miss', '1') . Form::openButtonSpace() . Form::getButton('save', 'save', Lang::t('_SAVE', 'admin_lang')) . Form::getButton('undo', 'undo', Lang::t('_UNDO', 'admin_lang')) . Form::closeButtonSpace() . Form::closeForm(); ?> </div>
function writemessage() { $send_all = true; // checkPerm('send_all', true); $send_upper = true; // checkPerm('send_upper', true); if (!$send_all && !$send_upper) { die("You can't access"); } require_once _base_ . '/lib/lib.userselector.php'; $out = $GLOBALS['page']; $out->setWorkingZone('content'); $from = importVar('out'); $acl_man =& Docebo::user()->getAclManager(); $um =& UrlManager::getInstance("message"); if (!isset($_POST['message']['recipients'])) { if (isset($_GET['reply_recipients'])) { $user_selected = unserialize(stripslashes(urldecode($_GET['reply_recipients']))); $recipients = urlencode(serialize($user_selected)); } else { $user_select = new UserSelector(); $user_selected = $user_select->getSelection($_POST); $recipients = urlencode(serialize($user_selected)); } } else { $user_selected = unserialize(urldecode($_POST['message']['recipients'])); $recipients = urlencode($_POST['message']['recipients']); } $title_url = $this->mvc_urls ? "index.php?r=message/show" . ($from == 'out' ? '&active_tab=outbox' : '') : $um->getUrl($from == 'out' ? '&active_tab=outbox' : ''); $output = ""; $output .= $this->messageGetTitleArea(array($title_url => Lang::t('_MESSAGES'), Lang::t('_SEND')), 'message') . '<div class="std_block">'; if (isset($_POST['send'])) { if ($_POST['message']['subject'] == '') { $output .= getErrorUi(Lang::t('_MUST_INS_SUBJECT')); } else { // send message $attach = ''; if ($_FILES['message']['tmp_name']['attach'] != '') { $attach = $this->saveMessageAttach($_FILES['message']); } $query_mess = "\r\n\t\t\t\tINSERT INTO %adm_message\r\n\t\t\t\t( idCourse, sender, posted, title, textof, attach, priority ) VALUES\r\n\t\t\t\t(\r\n\t\t\t\t\t'" . $_POST['msg_course_filter'] . "',\r\n\t\t\t\t\t'" . getLogUserId() . "',\r\n\t\t\t\t\t'" . date("Y-m-d H:i:s") . "',\r\n\t\t\t\t\t'" . $_POST['message']['subject'] . "',\r\n\t\t\t\t\t'" . $_POST['message_textof'] . "',\r\n\t\t\t\t\t'" . addslashes($attach) . "',\r\n\t\t\t\t\t'" . $_POST['message']['priority'] . "'\r\n\t\t\t\t)"; if (!$this->db->query($query_mess)) { if ($attach) { deleteAttach($attach); } $jump_url = $this->mvc_urls ? "index.php?r=message/show&result=err" : $um->getUrl('result=err'); Util::jump_to($jump_url); } list($id_message) = $this->db->fetch_row($this->db->query("SELECT LAST_INSERT_ID()")); if (!in_array(getLogUserId(), $user_selected)) { $user_selected[] = getLogUserId(); } $send_to_idst =& $acl_man->getAllUsersFromIdst($user_selected); $re = true; $recip_alert = array(); if (is_array($send_to_idst)) { $logged_user = getLogUserId(); while (list(, $id_recipient) = each($send_to_idst)) { $query_recipients = "\r\n\t\t\t\t\t\tINSERT INTO %adm_message_user\r\n\t\t\t\t\t\t( idMessage, idUser, idCourse, `read` ) VALUES\r\n\t\t\t\t\t\t(\r\n\t\t\t\t\t\t\t'" . $id_message . "',\r\n\t\t\t\t\t\t\t'" . $id_recipient . "',\r\n\t\t\t\t\t\t\t'" . $_POST['msg_course_filter'] . "',\r\n\t\t\t\t\t\t\t'" . ($id_recipient == $logged_user ? _MESSAGE_MY : _MESSAGE_UNREADED) . "'\r\n\t\t\t\t\t\t) "; $re_single = $this->db->query($query_recipients); if ($re_single && $id_recipient != $logged_user) { $recip_alert[] = $id_recipient; } $re &= $re_single; } if (!empty($recip_alert)) { require_once _lms_ . '/lib/lib.course.php'; require_once _base_ . '/lib/lib.eventmanager.php'; $is_course = false; if (isset($_SESSION['idCourse']) && isset($GLOBALS['course_descriptor'])) { $course_name = $GLOBALS['course_descriptor']->getValue('name'); $is_course = true; } elseif ($_POST['msg_course_filter'] != 0 && is_numeric($_POST['msg_course_filter'])) { $idCourse = $_POST['msg_course_filter']; $query_course = "SELECT name FROM %lms_course WHERE idCourse = " . $idCourse; $course_result = $this->db->fetch_row($this->db->query($query_course)); list($name) = $course_result; $course_name = $name; $is_course = true; } else { $course_name = ''; } // message to user that is odified $msg_composer = new EventMessageComposer(); $msg_composer->setSubjectLangText('email', '_YOU_RECIVE_MSG_SUBJECT', false); if (!$is_course) { $msg_composer->setBodyLangText('email', '_YOU_RECIVE_MSG_TEXT', array('[url]' => _MESSAGE_PL_URL, '[course]' => $course_name, '[from]' => Docebo::user()->getUsername())); $msg_composer->setBodyLangText('sms', '_YOU_RECIVE_MSG_TEXT_SMS', array('[url]' => _MESSAGE_PL_URL, '[course]' => $course_name, '[from]' => Docebo::user()->getUsername())); } else { $msg_composer->setBodyLangText('email', '_YOU_RECIVE_MSG_TEXT_COURSE', array('[url]' => _MESSAGE_PL_URL, '[course]' => $course_name, '[from]' => Docebo::user()->getUsername())); $msg_composer->setBodyLangText('sms', '_YOU_RECIVE_MSG_TEXT_SMS_COURSE', array('[url]' => _MESSAGE_PL_URL, '[course]' => $course_name, '[from]' => Docebo::user()->getUsername())); } createNewAlert('MsgNewReceived', 'directory', 'moderate', '1', 'User group subscription to moderate', $recip_alert, $msg_composer); } } $jump_url = $this->mvc_urls ? "index.php?r=message/show&result=" . ($re ? 'ok' : 'err') : $um->getUrl('result=' . ($re ? 'ok' : 'err')); Util::jump_to($jump_url); } } $prio_arr = array('5' => Lang::t('_VERYHIGH', 'message'), '4' => Lang::t('_HIGH', 'message'), '3' => Lang::t('_NORMAL', 'message'), '2' => Lang::t('_LOW', 'message'), '1' => Lang::t('_VERYLOW', 'message')); $first = true; $attach = ''; if (!is_array($user_selected) || empty($user_selected)) { $write_url = $this->mvc_urls ? 'index.php?r=message/write' : $um->getUrl('op=writemessage'); $output .= '<span class="text_bold">' . Lang::t('_NO_RECIPIENTS_SELECTED') . '</span>' . Form::openForm('message', $write_url, false, false, 'multipart/form-data') . Form::getHidden('out', 'out', $from) . Form::getHidden('msg_course_filter', 'msg_course_filter', $_POST['msg_course_filter']) . Form::getHidden('message_recipients', 'message[recipients]', $recipients) . Form::openButtonSpace() . Form::getButton('back_recipients', 'back_recipients', Lang::t('_BACK')) . Form::closeButtonSpace() . Form::closeForm(); return; } $only_users =& $acl_man->getUsers($user_selected); $only_groups = $acl_man->getGroups($user_selected); $output .= '<span class="text_bold">' . Lang::t('_RECIPIENTS') . '</span>' . '<div class="recipients">'; if (is_array($only_groups) && !empty($only_groups)) { $output .= '<strong>'; while (list(, $group_info) = each($only_groups)) { if ($first) { $first = false; } else { $attach = ', '; } $groupid = substr($group_info[ACL_INFO_GROUPID], strrpos($group_info[ACL_INFO_GROUPID], '/') + 1); $output .= $attach . $groupid; // find user of group $members = $acl_man->getGroupAllUser($group_info[ACL_INFO_IDST]); $group_users =& $acl_man->getUsers($members); $output .= ' <span class="message_group_members">( '; $m_first = true; while (list(, $user_info) = each($group_users)) { if ($m_first) { $m_first = false; } else { $attach = ', '; } $output .= $attach . ($user_info[ACL_INFO_LASTNAME] . $user_info[ACL_INFO_FIRSTNAME] ? $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME] : $acl_man->relativeId($user_info[ACL_INFO_USERID])); } $output .= ' )</span> '; } $output .= '</strong>'; } $acl_man->setContext('/'); if (is_array($only_users) && !empty($only_users)) { while (list(, $user_info) = each($only_users)) { if ($first) { $first = false; } else { $attach = ', '; } $output .= $attach . ($user_info[ACL_INFO_LASTNAME] . $user_info[ACL_INFO_FIRSTNAME] ? $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME] : $acl_man->relativeId($user_info[ACL_INFO_USERID])); } } $id_forward = importVar('id_forward', true, 0); $sql_text = "SELECT message.textof, message.title FROM %adm_message AS message WHERE message.idMessage = '" . $id_forward . "'"; $title = ''; $text_message = ''; if ($message_forward = $this->db->fetch_row($this->db->query($sql_text))) { list($text_message, $title) = $message_forward; $title = 'Reply: ' . $title; $text_message = '<br /><br /><font color="#808080">-------<br /><br />' . $text_message . '</font>'; } $write_url = $this->mvc_urls ? 'index.php?r=message/write' : $um->getUrl('op=writemessage'); $output .= '</div><br />' . Form::openForm('message', $write_url, false, false, 'multipart/form-data') . Form::getHidden('out', 'out', $from) . Form::getHidden('msg_course_filter', 'msg_course_filter', $_POST['msg_course_filter']) . Form::getHidden('message_recipients', 'message[recipients]', $recipients) . Form::getTextfield(Lang::t('_SUBJECT'), 'message_subject', 'message[subject]', 255, isset($_POST['message']['subject']) ? $_POST['message']['subject'] : "{$title}") . Form::getDropdown(Lang::t('_PRIORITY'), 'message_priority', 'message[priority]', $prio_arr, isset($_POST['message']['priority']) ? $_POST['message']['priority'] : 3) . Form::getTextarea(Lang::t('_TEXTOF'), 'message_textof', 'message_textof', isset($_POST['message_textof']) ? $_POST['message_textof'] : "{$text_message}") . Form::getFilefield(Lang::t('_ATTACHMENT'), 'message_attach', 'message[attach]', 255) . Form::openButtonSpace() . Form::getButton('back_recipients', 'back_recipients', Lang::t('_BACK')) . Form::getButton('send', 'send', Lang::t('_SEND')) . Form::getButton('undo', 'undo', Lang::t('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>'; cout($output, 'content'); }
function importToGroup() { require_once _base_ . '/lib/lib.form.php'; $form = new Form(); $tree = getTitleArea($this->lang->def('_ORG_CHART_IMPORT_USERS', 'organization_chart'), 'directory_group') . '<div class="std_block">' . $form->getFormHeader($this->lang->def('_ASSIGN_USERS')) . $form->openForm('directory_importgroupuser', 'index.php?modname=directory&op=import_groupuser_2', false, false, 'multipart/form-data'); $tree .= $form->openElementSpace(); $tree .= $form->getFilefield($this->lang->def('_GROUP_USER_IMPORT_FILE'), 'file_import', 'file_import') . $form->getTextfield($this->lang->def('_GROUP_USER_IMPORT_SEPARATOR'), 'import_separator', 'import_separator', 1, ',') . $form->getCheckbox($this->lang->def('_GROUP_USER_IMPORT_HEADER'), 'import_first_row_header', 'import_first_row_header', 'true', TRUE) . $form->getTextfield($this->lang->def('_GROUP_USER_IMPORT_CHARSET'), 'import_charset', 'import_charset', 20, 'ISO-8859-1'); $tree .= $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('import_groupuser_2', 'import_groupuser_2', $this->lang->def('_NEXT')) . $form->getButton('import_groupcancel', 'import_groupcancel', $this->lang->def('_UNDO')) . $form->closeButtonSpace(); $tree .= Form::closeForm() . '</div>'; $GLOBALS['page']->add($tree, 'content'); }
/** * display the field for interaction * * @param int $id_user if alredy exists a entry for the user load as default value * @param bool $freeze if true, disable the user interaction * * @return string of field xhtml code * * @access public */ function play($id_user, $freeze, $mandatory = false, $do_not_show_label = false, $value = NULL) { require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.mimetype.php'; list($user_entry) = sql_fetch_row(sql_query("\r\n\t\tSELECT user_entry\r\n\t\tFROM " . $this->_getUserEntryTable() . "\r\n\t\tWHERE id_user = '******' AND\r\n\t\t\tid_common = '" . (int) $this->id_common . "' AND\r\n\t\t\tid_common_son = '0'")); $re_field = sql_query("\r\n\t\tSELECT translation\r\n\t\tFROM " . $this->_getMainTable() . "\r\n\t\tWHERE lang_code = '" . getLanguage() . "' AND id_common = '" . (int) $this->id_common . "' AND type_field = '" . $this->getFieldType() . "'"); list($translation) = sql_fetch_row($re_field); if ($user_entry != '') { $entry_link = '<a href="' . Get::rel_path('adm') . '/index.php?modname=field&op=manage&fo=special&type_field=' . $this->getFieldType() . '&id_user='******'&id_common=' . $this->id_common . '">' . '<img src="' . getPathImage() . mimeDetect($user_entry) . '" alt="' . Lang::t('_MIME_TYPE') . '" />' . ' ' . Lang::t('_DOWNLOAD') . '</a> <a id="4upLLoad" href="javascript:void();" onclick="document.getElementById(\'upLLoad\').style.display = \'inline\';document.getElementById(\'4upLLoad\').style.display=\'none\'">' . Lang::t('_MOD', 'standard', 'framework') . '</a>'; } else { $entry_link = Lang::t('_NO_FILE_UPLOADED', 'field', 'framework') . ' <a id="4upLLoad" href="javascript:void();" onclick="document.getElementById(\'upLLoad\').style.display = \'inline\';document.getElementById(\'4upLLoad\').style.display=\'none\'">' . Lang::t('_MODIFY', 'field', 'framework') . '</a>'; } if ($value !== NULL) { $user_entry = $value; } if ($freeze) { return Form::getLineBox($translation . ' : ', $entry_link); } return Form::getFilefield($translation . ($mandatory ? ' <span class="mandatory">*</span>' : ''), 'field_' . $this->getFieldType() . '_' . $this->id_common, 'field_' . $this->getFieldType() . '[' . $this->id_common . ']', '', $translation, '', '', $entry_link); }
function modfiles(&$url) { checkPerm('view'); require_once _base_ . '/lib/lib.form.php'; $file_man = new MyFile(getLogUserId()); $lang =& DoceboLanguage::createInstance('myfiles'); $area = importVar('working_area', false, $file_man->getDefaultArea()); $id_file = importVar('id_file', true, 0); $title = ''; $description = ''; $file_policy = MF_POLICY_FREE; if ($id_file != 0) { $f_info = $file_man->getFileInfo($id_file); $title = $f_info[MYFILE_TITLE]; $description = $f_info[MYFILE_DESCRIPTION]; $file_policy = $f_info[MYFILE_POLICY]; } $arr_policy = array(MF_POLICY_FREE => $lang->def('_MF_POLICY_FREE'), MF_POLICY_TEACHER => $lang->def('_MF_POLICY_TEACHER'), MF_POLICY_FRIENDS => $lang->def('_MF_POLICY_FRIENDS'), MF_POLICY_TEACHER_AND_FRIENDS => $lang->def('_MF_POLICY_TEACHER_AND_FRIENDS'), MF_POLICY_NOONE => $lang->def('_MF_POLICY_NOONE')); $title_page = array($url->getUrl('op=myfiles') => $lang->def('_MYFILE'), $lang->def('_ADD_' . $area)); $GLOBALS['page']->add(getTitleArea($title_page, 'myfile') . '<div class="std_block">' . getBackUi($url->getUrl('op=myfiles'), $lang->def('_BACK')) . Form::openForm('add_file', $url->getUrl('op=savefiles'), false, false, 'multipart/form-data') . Form::openElementSpace() . Form::getHidden('id_file', 'id_file', $id_file) . Form::getHidden('working_area', 'working_area', $area) . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', 255, $title) . Form::getFilefield($lang->def('_UPLOAD'), 'uploaded_file', 'uploaded_file') . Form::getDropdown($lang->def('_FILE_POLICY'), 'file_policy', 'file_policy', $arr_policy, $file_policy) . Form::getTextarea($lang->def('_DESCRIPTION'), 'description', 'description', $description) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $id_file == 0 ? $lang->def('_INSERT') : $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content'); }
function loadImportCourseUser() { $out =& $GLOBALS['page']; $out->setWorkingZone('content'); $lang =& DoceboLanguage::CreateInstance('subscribe', 'lms'); $id_course = importVar('id_course', true, 0); $id_course_edition = importVar('edition', true, 0); require_once _base_ . '/lib/lib.form.php'; $form = new Form(); $out->add(getTitleArea($lang->def('_SUBSCRIBE')) . '<div class="std_block">'); $out->add($form->openForm('import_course_users', 'index.php?modname=subscribe&op=import_course_user_2', false, false, 'multipart/form-data')); $out->add($form->openElementSpace()); $out->add($form->getFilefield($lang->def('_IMPORT_FILE'), 'file_import', 'file_import')); $out->add($form->getCheckbox($lang->def('_IMPORT_HEADER'), 'import_first_row_header', 'import_first_row_header', 'true', false)); $out->add('<p>' . $lang->def('_IMPORT_INFO') . '</p>'); $out->add($form->getHidden('import_separator', 'import_separator', ',')); $out->add($form->getHidden('import_charset', 'import_charset', 20, 'UTF-8')); $out->add($form->getHidden('id_course', 'id_course', $id_course)); $out->add($form->getHidden('edition', 'edition', $id_course_edition)); $out->add($form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('next', 'next', $lang->def('_NEXT')) . $form->getButton('cancelselector', 'cancelselector', $lang->def('_UNDO')) . $form->closeButtonSpace() . $form->closeForm()); $out->add('</div>'); }
function modAvatarGui() { require_once _base_ . '/lib/lib.form.php'; require_once _base_ . '/lib/lib.preference.php'; $this->loadUserData(getLogUserId()); $html = '<div class="up_user_info">' . '<div class="up_name">' . $this->resolveUsername(false, getLogUserId()) . '</div>'; // user standard info ----------------------------------------------------------------- $html .= getInfoUi(str_replace('[max_px]', $this->max_dim_avatar, $this->_lang->def('_AVATAR_PHOTO_INSTRUCTION'))); $html .= Form::openForm('mod_avatar', $this->_url_man->getUrl($this->_varname_action . '=saveavatar'), false, false, 'multipart/form-data'); $html .= Form::getFilefield($this->_lang->def('_AVATAR'), 'up_avatar', 'up_avatar'); if ($this->user_info[ACL_INFO_AVATAR] != '') { $html .= Form::getButton('delete_current', 'delete_current', $this->_lang->def('_DEL'), 'up_delete_current'); } $html .= Form::openButtonSpace() . Form::getButton('save', 'save', $this->_lang->def('_SAVE')) . Form::getButton('undo', 'undo', $this->_lang->def('_UNDO')) . Form::closeButtonSpace(); $html .= Form::closeForm() . '</div>'; return $html; }
function modmessage() { checkPerm('view'); require_once _base_ . '/lib/lib.form.php'; $lang =& DoceboLanguage::createInstance('forum', 'lms'); $id_message = importVar('idMessage', true, 0); $ini = importVar('ini'); $moderate = checkPerm('moderate', true); $mod_perm = checkPerm('mod', true); $acl_man =& Docebo::user()->getAclManager(); // retrive info about message $mess_query = "\r\n\tSELECT idThread, title, textof, author\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage\r\n\tWHERE idMessage = '" . $id_message . "'"; list($id_thread, $title, $textof, $author) = sql_fetch_row(sql_query($mess_query)); if (!$moderate && !$mod_perm && $author != getLogUserId()) { die("You can't access"); } // Some info about forum and thread $thread_query = "\r\n\tSELECT idForum, title , locked, erased\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\tWHERE idThread = '" . $id_thread . "'"; list($id_forum, $thread_title, $locked_t, $erased_t) = sql_fetch_row(sql_query($thread_query)); $forum_query = "\r\n\tSELECT title, locked\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum\r\n\tWHERE idForum = '" . $id_forum . "'"; list($forum_title, $locked_f) = sql_fetch_row(sql_query($forum_query)); $page_title = array('index.php?modname=forum&op=forum' => $lang->def('_FORUM'), 'index.php?modname=forum&op=thread&idForum=' . $id_forum => $forum_title, 'index.php?modname=forum&op=message&idThread=' . $id_thread . '&ini=' . $ini => $thread_title, $lang->def('_MOD_MESSAGE')); if ($erased_t && !$mod_perm && !$moderate) { $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . $lang->def('_CANNOTENTER') . '</div>', 'content'); return; } $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . getBackUi('index.php?modname=forum&op=message&idThread=' . $id_thread . '&ini=' . $ini, $lang->def('_BACK')) . Form::openForm('form_forum', 'index.php?modname=forum&op=upmessage', false, false, 'multipart/form-data') . Form::openElementSpace() . Form::getHidden('idMessage', 'idMessage', $id_message) . Form::getHidden('ini', 'ini', $ini) . Form::getTextfield($lang->def('_SUBJECT'), 'title', 'title', 255, $title) . Form::getTextarea($lang->def('_TEXTOF'), 'textof', 'textof', $textof), 'content'); if (checkPerm('upload', true)) { $GLOBALS['page']->add(Form::getFilefield($lang->def('_UPLOAD'), 'attach', 'attach'), 'content'); } $GLOBALS['page']->add(Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('post_thread', 'post_thread', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace(), 'content'); showMessageForAdd($id_thread, 3); $GLOBALS['page']->add(Form::openButtonSpace() . Form::getButton('post_thread_2', 'post_thread', $lang->def('_SAVE')) . Form::getButton('undo_2', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content'); }
/** * @param string $label_name * @param string $id * @param string $name * @param string $value * @param string $filename * @param string $show_current * @param string $show_del_checkbox * @param string $add_old_info * @param string $old_prefix * @param string $del_arr_name * @param string $alt_name * @param string $other_after * @param string $other_before */ public static function getExtendedFileField($label_name, $id, $name, $value = FALSE, $filename = FALSE, $show_current = TRUE, $show_del_checkbox = TRUE, $add_old_info = TRUE, $old_prefix = FALSE, $del_arr_name = FALSE, $alt_name = '', $other_after = '', $other_before = '') { $res = ""; $res .= '<div class="form_extended_file_field">'; $res .= Form::getFilefield($label_name, $id, $name, $value, $alt_name, $other_after, $other_before); if ($show_current) { if ($value !== FALSE && !empty($value)) { if ($filename === FALSE) { if (substr_count($value, "_") >= 3) { $break_apart = explode('_', $value); $break_apart[0] = $break_apart[1] = $break_apart[2] = ''; $filename = substr(implode('_', $break_apart), 3); } else { $filename = $value; } } require_once _base_ . '/lib/lib.mimetype.php'; $ext = strtolower(end(explode(".", $filename))); $img = "<img src=\"" . getPathImage('fw') . mimeDetect($filename) . "\" "; $img .= "alt=\"" . $ext . "\" title=\"" . $ext . "\" />"; if ($show_del_checkbox) { $del_arr_name = $del_arr_name !== FALSE ? $del_arr_name : "file_to_del"; $check_id = $del_arr_name . "_" . $id; $check_name = $del_arr_name . "[" . $id . "]"; $checkbox = Form::getInputCheckbox($check_id, $check_name, $value, FALSE, "") . " "; $checkbox .= Form::getLabel($check_id, Lang::t("_DELETE_FILE", "standard", "framework"), "nofloat"); $res .= Form::getLineBox($img . " " . $filename, $checkbox); } else { $res .= Form::openFormLine(); $res .= Lang::t("_CURRENT_FILE", "standard", "framework") . ": " . $img . " " . $filename; $res .= Form::closeFormLine(); } } else { $res .= Form::openFormLine(); $res .= Lang::t("_CURRENT_FILE", "standard", "framework") . ": " . Lang::t("_NONE", "standard", "framework"); $res .= Form::closeFormLine(); } } if ($add_old_info) { $old_prefix = $old_prefix !== FALSE ? $old_prefix : "old"; $res .= "\n"; $res .= Form::getHidden($old_prefix . "_" . $id, $old_prefix . "_" . $name, $value); } $res .= "</div>\n"; return $res; }
function loadImportUsers() { $tdb =& $this->tdb; $folder = $tdb->getFolderById($this->getSelectedFolderId()); require_once _base_ . '/lib/lib.form.php'; $form = new Form(); $tree = $form->getFormHeader($this->lang->def('_ORG_CHART_IMPORT_USERS')); $tree .= $form->openElementSpace(); $tree .= $this->printState(); $tree .= $form->getFilefield($this->lang->def('_ORG_CHART_IMPORT_FILE'), 'file_import', 'file_import'); $tree .= $form->getTextfield($this->lang->def('_ORG_CHART_IMPORT_SEPARATOR'), 'import_separator', 'import_separator', 1, ','); $tree .= $form->getCheckbox($this->lang->def('_ORG_CHART_IMPORT_HEADER'), 'import_first_row_header', 'import_first_row_header', 'true', TRUE); $tree .= $form->getTextfield($this->lang->def('_ORG_CHART_IMPORT_CHARSET'), 'import_charset', 'import_charset', 20, 'ISO-8859-1'); $tree .= $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('next1_importusers' . $this->id, $this->id . '[next1_importusers]', $this->lang->def('_NEXT')) . $form->getButton($this->_getCancelId(), $this->_getCancelId(), $this->lang->def('_UNDO')) . $form->closeButtonSpace(); return $tree; }