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;
    }
Example #2
0
 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('&', '&amp;', $object_item->back_url) . '&amp;mod_result=0', $lang->def('_BACK')) . Form::openForm('itemform', 'index.php?modname=item&amp;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&amp;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");
}
Example #4
0
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&amp;op=modpollgui&amp;id_poll=' . $id_poll . '&amp;back_url=' . $url_encode, $lang->def('_BACK')) . Form::OpenForm('addpoll_form', 'index.php?modname=poll&amp;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');
}
 public function addGroup()
 {
     if (Get::req('confirm', DOTY_INT, 0) == 1) {
         $name = Get::req('name', DOTY_MIXED, '');
         $output = array();
         if ($name == '') {
             $name = Lang::t('_UNDEFINED', 'adminrules');
         }
         $result = $this->model->addGroup($name);
         $output['success'] = $result;
         echo $this->json->encode($output);
     } else {
         $output = array();
         $body = Form::openForm('add_rules_form', 'ajax.adm_server.php?r=adm/adminrules/addGroup&confirm=1') . Form::openElementSpace() . Form::getTextfield(Lang::t('_NAME', 'adminrules'), 'name', 'name', '255', '') . Form::closeElementSpace() . Form::closeForm();
         $output['success'] = true;
         $output['header'] = Lang::t('_MOD', 'adminrules') . '&nbsp;';
         $output['body'] = $body;
         echo $this->json->encode($output);
     }
 }
Example #6
0
 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('&', '&amp;', $object_page->back_url) . '&amp;mod_result=0', $lang->def('_BACK')) . Form::openForm('pageform', 'index.php?modname=htmlpage&amp;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');
 }
 /**
  * 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&amp;op=edit&amp;type_quest=' . $this->getQuestionType() . '&amp;id_quest=' . $this->id . '&amp;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('&', '&amp;', $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('&', '&amp;', $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('&', '&amp;', $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('&', '&amp;', $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&amp;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');
 }
Example #8
0
<?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>
Example #9
0
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;
	});
	E.addListener("moderated_user_unsubscription", "click", function(e) {
		var checked = this.checked;
		c.disabled = !checked;
		d.disabled = !checked;
Example #10
0
 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();
 }
Example #11
0
//if we are editing an existent role, print its id
if (isset($id_fncrole)) {
    $content .= Form::getHidden('id_fncrole', 'id_fncrole', $id_fncrole);
}
//edit name and description in all languages (in a TabView widget)
$content .= '<div id="fncrole_langs_tab" class="yui-navset">';
$_tabview_titles = '<ul class="yui-nav">';
$_tabview_contents = '<div class="yui-content">';
//edit name and description in all languages
$_langs = Docebo::langManager()->getAllLanguages(true);
foreach ($_langs as $_lang_code => $_lang_data) {
    $_name = isset($fncrole_langs[$_lang_code]) ? $fncrole_langs[$_lang_code]['name'] : "";
    $_desc = isset($fncrole_langs[$_lang_code]) ? $fncrole_langs[$_lang_code]['description'] : "";
    $_tabview_titles .= '<li' . ($_lang_code == getLanguage() ? ' class="selected"' : '') . '>' . '<a href="#langs_tab_' . $_lang_code . '"><em>' . $_lang_code . ($_name == '' && isset($id_group) ? ' (*)' : '') . '</em></a></li>';
    $_tabview_contents .= '<div id="langs_tab_' . $_lang_code . '">';
    $_tabview_contents .= Form::getTextfield(Lang::t('_NAME', 'standard'), 'name_' . $_lang_code, 'name[' . $_lang_code . ']', 255, $_name);
    $_tabview_contents .= Form::getSimpleTextarea(Lang::t('_DESCRIPTION', 'standard'), 'description_' . $_lang_code, 'description[' . $_lang_code . ']', $_desc);
    $_tabview_contents .= '</div>';
}
//end for
$_tabview_titles .= '</ul>';
$_tabview_contents .= '</div>';
$content .= $_tabview_titles . $_tabview_contents;
$content .= '</div>';
$content .= Form::closeForm();
//send output
if (isset($json)) {
    $params = array('success' => true, 'header' => $title, 'body' => $content);
    echo $json->encode($params);
} else {
    echo '<h2>' . $title . '</h2>';
Example #12
0
function conference_startnewconf($url)
{
    checkPerm('view');
    $mod_perm = checkPerm('mod');
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::createInstance('conference', 'lms');
    if (isset($_POST['create_conf'])) {
        $conference = new Conference_Manager();
        $start_date = Format::dateDb($_POST['start_date'], 'date');
        $start_date = substr($start_date, 0, 10);
        $start_time = (strlen($_POST['start_time']['hour']) == 1 ? '0' : '') . $_POST['start_time']['hour'] . ':' . (strlen($_POST['start_time']['minute']) == 1 ? '0' : '') . $_POST['start_time']['minute'] . ':00';
        $start_timestamp = fromDatetimeToTimestamp($start_date . ' ' . $start_time);
        $conference_name = trim($_POST["conference_name"]) ? trim($_POST["conference_name"]) : $lang->def('_VIDEOCONFERENCE');
        $meetinghours = (int) $_POST["meetinghours"];
        $end_timestamp = $start_timestamp + $meetinghours * 3600;
        $maxparticipants = (int) $_POST["maxparticipants"];
        $idCourse = $_SESSION['idCourse'];
        $room_type = $_POST["room_type"];
        if ($conference->can_create_room_limit(getLogUserId(), $idCourse, $room_type, $start_timestamp, $end_timestamp) && $conference->can_create_user_limit(getLogUserId(), $idCourse, $start_timestamp)) {
            $conference->insert_room($idCourse, getLogUserId(), $conference_name, $room_type, $start_timestamp, $end_timestamp, $meetinghours, $maxparticipants, isset($_POST['bookable']) ? 1 : 0, $start_date, (int) $_POST['start_time']['hour'], (int) $_POST['start_time']['minute']);
            Util::jump_to('index.php?modname=conference&amp;op=list');
        } else {
            $title_page = array('index.php?modname=conference&amp;op=list' => $lang->def('_VIDEOCONFERENCE'), $lang->def('_CREATE'));
            $GLOBALS['page']->add(getTitleArea($title_page, 'conference', $lang->def('_VIDEOCONFERENCE')) . '<div class="std_block">' . '<span><strong>' . $lang->def('_NO_MORE_ROOM') . '</strong></span>' . '</div>', 'content');
            return false;
        }
    }
    $start_time['hour'] = date('H');
    $start_time['minute'] = date('i');
    $start_date = importVar('start_date', false, date("Y-m-d H:i:s"));
    $conf_system = array();
    //$conf_system[""]="";
    $default = "";
    $default_maxp = 30;
    if (Get::sett('code_teleskill')) {
        $conf_system["teleskill"] = "teleskill";
    }
    if (Get::sett('dimdim_server') and Get::sett('dimdim_user') and Get::sett('dimdim_password')) {
        $conf_system["dimdim"] = "dimdim";
    }
    if (Get::sett('bbb_server') and Get::sett('bbb_user') and Get::sett('bbb_salt') and Get::sett('bbb_password_moderator') and Get::sett('bbb_password_viewer')) {
        $conf_system["bbb"] = "Big Blue Button";
        $default = "bbb";
        $default_maxp = Get::sett('bbb_max_participant');
    }
    YuiLib::load();
    //addJs($GLOBALS['where_lms_relative'].'/modules/conference/', 'ajax_conference.js');
    $GLOBALS['page']->add(getTitleArea($lang->def('_VIDEOCONFERENCE'), 'conference') . '<div class="std_block">', 'content');
    $GLOBALS['page']->add(Form::openForm('create_conference', $url->getUrl('op=startnewconf')) . Form::openElementSpace() . Form::getTextfield($lang->def('_VIDEOCONFERENCE'), 'conference_name', 'conference_name', 255, importVar('conference_name')) . Form::getLineBox($lang->def('_CONFERENCE_SYSTEM'), Form::getInputDropdown('', 'room_type', 'room_type', $conf_system, $default, '')) . Form::getDatefield($lang->def('_START_DATE'), 'start_date', 'start_date', Format::date($start_date, 'date')) . Form::getLineBox($lang->def('_AT_HOUR'), Form::getInputDropdown('', 'start_time_hour', 'start_time[hour]', range(0, 23), importVar('start_time_hour', false, date("H")), '') . ' : ' . Form::getInputDropdown('', 'start_time_minute', 'start_time[minute]', range(0, 59), importVar('start_time_hour', false, date("i")), '')) . Form::getLineBox($lang->def('_MEETING_HOURS'), Form::getInputDropdown('', 'meetinghours', 'meetinghours', range(0, 5), importVar('meetinghours', false, 2), '')) . Form::getTextfield($lang->def('_MAX_PARTICIPANTS'), 'maxparticipants', 'maxparticipants', 6, importVar('maxparticipants', true, $default_maxp)), 'content');
    if (Get::sett('use_dimdim_api') === 'on') {
        $GLOBALS['page']->add('<div id="dimdim_conf" style="' . ($default === 'dimdim' ? 'display:block;' : 'display:none;') . '">' . Form::getOpenFieldset(Lang::t('_DIMDIM_FEATURES', 'conference'), 'dimdim_features') . Form::getCheckbox(Lang::t('_SHOW_WAITING_AREA', 'conference'), 'lobbyEnabled', 'lobbyEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_PRIVATE_CHAT', 'conference'), 'privateChatEnabled', 'privateChatEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_PUBLIC_CHAT', 'conference'), 'publicChatEnabled', 'publicChatEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_DESKTOP_SHARING', 'conference'), 'screenShareEnabled', 'screenShareEnabled', '1') . Form::getCheckbox(Lang::t('_ASSIGN_MIC_TO_ATTENDEES', 'conference'), 'autoAssignMikeOnJoin', 'autoAssignMikeOnJoin', '1') . Form::getCheckbox(Lang::t('_ENABLE_WHITEBOARD', 'conference'), 'whiteboardEnabled', 'whiteboardEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_DOCUMENTS_SHARING', 'conference'), 'documentSharingEnabled', 'documentSharingEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_RECORDING', 'conference'), 'recordingEnabled', 'recordingEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_HANDS_FREE', 'conference'), 'autoHandsFreeOnAVLoad', 'autoHandsFreeOnAVLoad', '1') . Form::getCheckbox(Lang::t('_START_MAIL', 'conference'), 'joinEmailRequired', 'joinEmailRequired', '1') . '<script type="text/javascript">' . ' var room_type = YAHOO.util.Dom.get(\'room_type\');' . ' YAHOO.util.Event.addListener(room_type, \'change\', dimdimEvent);' . ' function dimdimEvent(e)' . ' {' . ' var room_type = YAHOO.util.Dom.get(\'room_type\');' . ' var dimdim_conf = YAHOO.util.Dom.get(\'dimdim_conf\');' . ' if(room_type.value == "dimdim")' . ' dimdim_conf.style.display = "block";' . ' else' . ' dimdim_conf.style.display = "none";' . ' }' . '</script>' . Form::getCloseFieldset() . '</div>', 'content');
    }
    $GLOBALS['page']->add(Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('create_conf', 'create_conf', $lang->def('_CREATE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
}
 function show_report_LO($report_data = NULL, $other = '')
 {
     $jump_url = '';
     //show_report
     checkPerm('view');
     $lang =& DoceboLanguage::createInstance('report', 'framework');
     if (isset($_POST['send_mail_confirm'])) {
         $op = 'send_mail_confirm';
     } elseif (isset($_POST['send_mail'])) {
         $op = 'send_mail';
     } else {
         $op = 'show_result';
     }
     switch ($op) {
         case 'send_mail_confirm':
             $subject = importVar('mail_object', false, '[' . $lang->def('_SUBJECT') . ']');
             //'[No subject]');
             $body = importVar('mail_body', false, '');
             $acl_man = new DoceboACLManager();
             $user_info = $acl_man->getUser(getLogUserId(), false);
             if ($user_info) {
                 $sender = $user_info[ACL_INFO_EMAIL];
             }
             $mail_recipients = unserialize(urldecode(Get::req('mail_recipients', DOTY_STRING, '')));
             // prepare intestation for email
             $from = "From: " . $sender . $GLOBALS['mail_br'];
             $header = "MIME-Version: 1.0" . $GLOBALS['mail_br'] . "Content-type: text/html; charset=" . getUnicode() . $GLOBALS['mail_br'];
             $header .= "Return-Path: " . Get::sett('sender_event') . $GLOBALS['mail_br'];
             $header .= "Reply-To: " . Get::sett('sender_event') . $GLOBALS['mail_br'];
             $header .= "X-Sender: " . Get::sett('sender_event') . $GLOBALS['mail_br'];
             $header .= "X-Mailer: PHP/" . phpversion() . $GLOBALS['mail_br'];
             // send mail
             $arr_recipients = array();
             foreach ($mail_recipients as $recipient) {
                 $rec_data = $acl_man->getUser($recipient, false);
                 //mail($rec_data[ACL_INFO_EMAIL] , stripslashes($subject), stripslashes(nl2br($body)), $from.$header."\r\n");
                 $arr_recipients[] = $rec_data[ACL_INFO_EMAIL];
             }
             $mailer = DoceboMailer::getInstance();
             $mailer->SendMail($sender, $arr_recipients, stripslashes($subject), stripslashes(nl2br($body)));
             $result = getResultUi($lang->def('_OPERATION_SUCCESSFUL'));
             cout($this->_get_LO_query('html', NULL, $result));
             break;
         case 'send_mail':
             require_once _base_ . '/lib/lib.form.php';
             $mail_recipients = Get::req('mail_recipients', DOTY_MIXED, array());
             cout('' . Form::openElementSpace() . Form::getTextfield($lang->def('_SUBJECT'), 'mail_object', 'mail_object', 255) . Form::getTextarea($lang->def('_MAIL_BODY'), 'mail_body', 'mail_body') . Form::getHidden('mail_recipients', 'mail_recipients', urlencode(serialize($mail_recipients))) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('send_mail_confirm', 'send_mail_confirm', $lang->def('_SEND_MAIL')) . Form::getButton('undo_mail', 'undo_mail', $lang->def('_UNDO')) . Form::closeButtonSpace() . '</div>', 'content');
             break;
         default:
             cout($this->_get_LO_query('html', $report_data, $other));
     }
 }
Example #14
0
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') . ':&nbsp;' . 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');
        echo '<div class="std_block">';
Example #15
0
 /**
  * @return 	string 	contains the displayable information for a selected group
  *
  * @access 	public
  */
 function getPageWithElement($regroup)
 {
     require_once _base_ . '/lib/lib.form.php';
     if ($regroup == 'templ_man') {
         return $this->_maskTemplateManager();
     } elseif ($regroup == 'suiteman') {
         return $this->_maskSuiteManager();
     }
     $lang =& DoceboLanguage::createInstance('configuration', 'framework');
     $reSetting = sql_query("\r\n\t\tSELECT param_name, param_value, value_type, max_size\r\n\t\tFROM " . $this->table . "\r\n\t\tWHERE regroup = '" . $regroup . "' AND\r\n\t\t\thide_in_modify = '0'\r\n\t\tORDER BY regroup, pack, sequence");
     $html = '';
     while (list($var_name, $var_value, $value_type, $max_size) = sql_fetch_row($reSetting)) {
         $i_after = ' <span class="ico-tooltip" id="tt_target_' . $var_name . '" title="' . $lang->def('_CONF_DESCR_' . strtoupper($var_name)) . '">info</span>';
         switch ($value_type) {
             case "register_type":
                 //on off
                 $html .= Form::getOpenCombo($lang->def('_' . strtoupper($var_name))) . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_SELF'), $var_name . '_self', 'option[' . $var_name . ']', 'self', $var_value == 'self') . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_SELF_OPTIN'), $var_name . '_self_optin', 'option[' . $var_name . ']', 'self_optin', $var_value == 'self_optin') . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_MODERATE'), $var_name . '_moderate', 'option[' . $var_name . ']', 'moderate', $var_value == 'moderate') . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_ADMIN'), $var_name . '_admin', 'option[' . $var_name . ']', 'admin', $var_value == 'admin') . Form::getCloseCombo($i_after);
                 break;
             case "register_tree":
                 $register_possible_option = array('off' => $lang->def('_DONT_USE_TREE_REGISTRATION'), 'manual_insert' => $lang->def('_USE_WITH_MANUALEINSERT'), 'selection' => $lang->def('_USE_WITH_SELECTION'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $register_possible_option, $var_value, $i_after);
                 break;
             case "field_tree":
                 require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
                 $fl = new FieldList();
                 $all_fields = $fl->getAllFields(false);
                 $fields[0] = $lang->def('_NO_VALUE');
                 foreach ($all_fields as $key => $val) {
                     $fields[$val[FIELD_INFO_ID]] = $val[FIELD_INFO_TRANSLATION];
                 }
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $fields, $var_value, $i_after);
                 break;
             case "save_log_attempt":
                 //on off
                 $html .= Form::getOpenCombo($lang->def('_' . strtoupper($var_name))) . Form::getLineRadio('', 'label_bold', $lang->def('_SAVE_LA_ALL'), $var_name . '_all', 'option[' . $var_name . ']', 'all', $var_value == 'all') . Form::getLineRadio('', 'label_bold', $lang->def('_SAVE_LA_AFTER_MAX'), $var_name . '_after_max', 'option[' . $var_name . ']', 'after_max', $var_value == 'after_max') . Form::getLineRadio('', 'label_bold', $lang->def('_NO'), $var_name . '_no', 'option[' . $var_name . ']', 'no', $var_value == 'no') . Form::getCloseCombo($i_after);
                 break;
             case "language":
                 //drop down language
                 $langs = Docebo::langManager()->getAllLangCode();
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $langs, array_search($var_value, $langs), $i_after);
                 break;
             case "template":
                 //drop down template
                 $templ = getTemplateList();
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $templ, array_search($var_value, $templ), $i_after);
                 break;
             case "hteditor":
                 //drop down hteditor
                 $ht_edit = getHTMLEditorList();
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $ht_edit, $var_value, $i_after);
                 break;
             case "layout_chooser":
                 //drop down hteditor
                 $layout = array('left' => Lang::t('_LAYOUT_LEFT'), 'over' => Lang::t('_LAYOUT_OVER'), 'right' => Lang::t('_LAYOUT_RIGHT'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $layout, $var_value, $i_after);
                 break;
             case "pubflow_method_chooser":
                 //drop down hteditor
                 $options = array('onestate' => Lang::t('_PUBFLOW_ONESTATE'), 'twostate' => Lang::t('_PUBFLOW_TWOSTATE'), 'advanced' => Lang::t('_PUBFLOW_ADVANCED'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $options, $var_value, $i_after);
                 break;
             case "field_select":
                 require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
                 $fl = new FieldList();
                 $all_fields = $fl->getAllFields();
                 $fields = array();
                 foreach ($all_fields as $key => $val) {
                     $fields[$val[FIELD_INFO_ID]] = $val[FIELD_INFO_TRANSLATION];
                 }
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $fields, $var_value, $i_after);
                 break;
             case "sel_sms_gateway":
                 $options = array('0' => Lang::t('_SMS_GATEWAY_AUTO'), '1' => Lang::t('_SMS_GATEWAY_1'), '2' => Lang::t('_SMS_GATEWAY_2'), '3' => Lang::t('_SMS_GATEWAY_3'), '4' => Lang::t('_SMS_GATEWAY_4'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $options, $var_value, $i_after);
                 break;
             case "menuvoice":
             case "menuvoice_course_public":
             case "layout_chooser":
                 //drop down hteditor
                 $layout = array('left' => Lang::t('_LAYOUT_LEFT'), 'over' => Lang::t('_LAYOUT_OVER'), 'right' => Lang::t('_LAYOUT_RIGHT'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $layout, $var_value, $i_after);
                 break;
             case "grpsel_chooser":
                 $layout = array('group' => $lang->def('_GROUPS'), 'orgchart' => $lang->def('_ORGCHART'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $layout, $var_value, $i_after);
                 break;
             case "tablist_coursecatalogue":
                 $lang_c =& DoceboLanguage::createInstance('catalogue', 'lms');
                 $tab_selected = unserialize(urldecode($var_value));
                 $tab_list = array('time' => $lang_c->def('_TAB_VIEW_TIME'), 'category' => $lang_c->def('_TAB_VIEW_CATEGORY'), 'all' => $lang_c->def('_ALL'));
                 if (Get::sett('use_coursepath') == '1') {
                     $tab_list['pathcourse'] = $lang_c->def('_COURSEPATH');
                 }
                 if (Get::sett('use_social_courselist') == 'on') {
                     $tab_list['mostscore'] = $lang_c->def('_TAB_VIEW_MOSTSCORE');
                     $tab_list['popular'] = $lang_c->def('_TAB_VIEW_MOSTPOPULAR');
                     $tab_list['recent'] = $lang_c->def('_TAB_VIEW_RECENT');
                 }
                 foreach ($tab_list as $tab_code => $name) {
                     $html .= Form::getCheckbox($name, 'tablist_' . $tab_code, 'tablist[' . $tab_code . ']', 1, isset($tab_selected[$tab_code]), '', $i_after);
                 }
                 break;
             case "first_coursecatalogue_tab":
                 $lang_c =& DoceboLanguage::createInstance('catalogue', 'lms');
                 $tab_list = array('time' => $lang_c->def('_TAB_VIEW_TIME'), 'category' => $lang_c->def('_TAB_VIEW_CATEGORY'), 'all' => $lang_c->def('_ALL'));
                 if (Get::sett('use_coursepath') == '1') {
                     $tab_list['pathcourse'] = $lang_c->def('_COURSEPATH');
                 }
                 if (Get::sett('use_social_courselist') == 'on') {
                     $tab_list['mostscore'] = $lang_c->def('_TAB_VIEW_MOSTSCORE');
                     $tab_list['popular'] = $lang_c->def('_TAB_VIEW_MOSTPOPULAR');
                     $tab_list['recent'] = $lang_c->def('_TAB_VIEW_RECENT');
                 }
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $tab_list, $var_value, $i_after);
                 break;
             case "tablist_mycourses":
                 //$var_value=deformat($var_value);
                 $arr_value = explode(',', $var_value);
                 //$arr_value=array();
                 $tab_list = array();
                 $tab_list[''] = $lang->def('_MYCOURSES_NOTUSED');
                 $tab_list['status'] = $lang->def('_STATUS');
                 $tab_list['name'] = $lang->def('_NAME');
                 $tab_list['code'] = $lang->def('_CODE');
                 $html .= '<div class="form_line_l"><p>' . '<label class="floating">' . $lang->def('_' . strtoupper($var_name)) . '</label></p>';
                 for ($i = 0; $i < 3; $i++) {
                     $html .= Form::getInputDropdown('dropdown', $var_name . '_' . $i, "mycourses[{$i}]", $tab_list, isset($arr_value[$i]) ? $arr_value[$i] : '', '');
                 }
                 $html .= $i_after . '</div>';
                 break;
             case "point_field":
                 require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
                 $fl = new FieldList();
                 $all_fields = $fl->getAllFields();
                 $fields[0] = $lang->def('_NO_VALUE');
                 foreach ($all_fields as $key => $val) {
                     $fields[$val[FIELD_INFO_ID]] = $val[FIELD_INFO_TRANSLATION];
                 }
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $fields, $var_value, $i_after);
                 break;
             case "rest_auth_sel_method":
                 $value_set = array($lang->def('_REST_AUTH_UCODE') => 0, $lang->def('_REST_AUTH_TOKEN') => 1);
                 $html .= Form::getRadioSet($lang->def('_REST_AUTH_SEL_METHOD'), $var_name, 'option[' . $var_name . ']', $value_set, $var_value, $i_after);
                 break;
                 // Common types
             // Common types
             case "password":
                 $html .= Form::getPassword($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $max_size, $var_value, $i_after);
                 break;
             case "textarea":
                 $html .= Form::getSimpletextarea($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $var_value, $i_after);
                 break;
             case "check":
                 $html .= Form::getCheckbox($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', 1, $var_value == 1, '', '', $i_after . ' ');
                 break;
             case "enum":
                 $html .= Form::getCheckbox($lang->def('_' . strtoupper($var_name)), $var_name . '_on', 'option[' . $var_name . ']', 'on', $var_value == 'on', '', '', $i_after . ' ');
                 break;
             default:
                 //string or int
                 $html .= Form::getTextfield($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $max_size, $var_value, false, $i_after);
         }
     }
     return $html;
 }
Example #16
0
function presence()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    YuiLib::load();
    Util::get_js(Get::rel_path('lms') . '/admin/views/classroom/classroom.js', true, true);
    $id_date = Get::req('id_date', DOTY_INT, 0);
    $lang =& DoceboLanguage::CreateInstance('admin_date', 'lms');
    $date_man = new DateManager();
    $user_date = $date_man->getUserDateForCourse(getLogUserId(), $_SESSION['idCourse']);
    $date_info = $date_man->getDateInfoForPublicPresence($user_date);
    foreach ($date_info as $info_date) {
        $date_for_dropdown[$info_date['id_date']] = $info_date['code'] . ' - ' . $info_date['name'] . ' (' . Format::date($info_date['date_begin'], 'date') . ')';
    }
    if ($id_date == 0) {
        $id_date = isset($date_info[0]['id_date']) ? $date_info[0]['id_date'] : 0;
    }
    cout(getTitleArea(Lang::t('_ATTENDANCE')) . '<div class="std_block">', 'content');
    if (isset($_POST['save'])) {
        require_once $GLOBALS['where_lms'] . '/lib/lib.date.php';
        $date_man = new DateManager();
        $id_date = Get::req('id_date', DOTY_INT, 0);
        $score_min = Get::req('score_min', DOTY_INT, 0);
        $user = $date_man->getUserForPresence($id_date);
        $day = $date_man->getDateDay($id_date);
        $test_type = $date_man->getTestType($id_date);
        foreach ($user as $id_user => $user_info) {
            $user[$id_user]['score'] = Get::req('score_' . $id_user, DOTY_INT, 0);
            $user[$id_user]['note'] = Get::req('note_' . $id_user, DOTY_MIXED, '');
            $user[$id_user]['day_presence'] = array();
            for ($i = 0; $i < count($day); $i++) {
                $user[$id_user]['day_presence'][$day[$i]['id_day']] = Get::req('date_' . $day[$i]['id_day'] . '_' . $id_user, DOTY_INT, 0);
            }
        }
        if ($date_man->insDatePresence($_SESSION['id_course_date'], $id_date, $user, $day, $score_min)) {
            UIFeedback::info(Lang::t('_ATTENDANCE_SAVED', 'admin_date'));
        } else {
            UIFeedback::error(Lang::t('_ATTENDANCE_SAVED_ERROR', 'admin_date'));
        }
    }
    if ($id_date == 0) {
        cout(Lang::t('_NO_CONTENT', 'admin_date'), 'content');
    } else {
        $user = $date_man->getUserForPresence($id_date);
        $day = $date_man->getDateDay($id_date);
        $test_type = $date_man->getTestType($id_date);
        $user_presence = $date_man->getUserPresenceForDate($id_date);
        $tb = new Table(0, Lang::t('_ATTENDANCE', 'admin_date'), Lang::t('_ATTENDANCE', 'admin_date'));
        $cont_h = array(Lang::t('_USERNAME', 'admin_date'), Lang::t('_FULLNAME', 'admin_date'));
        $type_h = array('', '');
        foreach ($day as $id_day => $day_info) {
            $cont_h[] = Format::date($day_info['date_begin'], 'date') . '<br />' . '<a href="javascript:;" onClick="checkAllDay(' . $id_day . ')">' . Get::img('standard/checkall.png', Lang::t('_CHECK_ALL_DAY', 'presence') . '</a>') . ' ' . '<a href="javascript:;" onClick="unCheckAllDay(' . $id_day . ')">' . Get::img('standard/uncheckall.png', Lang::t('_UNCHECK_ALL_DAY', 'presence') . '</a>');
            $type_h[] = 'align_center';
        }
        $cont_h[] = '';
        $type_h[] = 'img-cell';
        if ($test_type == _DATE_TEST_TYPE_PAPER) {
            $cont_h[] = Lang::t('_SCORE', 'admin_date');
            $type_h[] = 'align_center';
        }
        $cont_h[] = Lang::t('_NOTES', 'admin_date');
        $type_h[] = 'align_center';
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        cout(Form::openForm('presence_form', 'index.php?modname=presence&amp;op=presence') . Form::openElementSpace() . Form::getDropdown(Lang::t('_SELECT_EDITION', 'admin_date'), 'id_date', 'id_date', $date_for_dropdown, $id_date) . Form::closeElementSpace() . Form::openElementSpace() . ($test_type == 1 ? Form::getTextfield(Lang::t('_MIN_SCORE', 'admin_date'), 'score_min', 'score_min', 255, '') : ''), 'content');
        $array_user_id = array();
        foreach ($user as $id_user => $user_info) {
            reset($day);
            $array_user_id[] = $id_user;
            $cont = array();
            $cont[] = $user_info['userid'];
            $cont[] = $user_info['lastname'] . ' ' . $user_info['firstname'];
            foreach ($day as $id_day => $day_info) {
                if (isset($user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]) && $user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]['presence'] == 1) {
                    $presence = true;
                } elseif (isset($user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]) && $user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]['presence'] == 0) {
                    $presence = false;
                } else {
                    $presence = false;
                }
                $cont[] = Form::getInputCheckbox('date_' . $id_day . '_' . $id_user, 'date_' . $id_day . '_' . $id_user, 1, $presence, false);
            }
            $cont[] = '<a href="javascript:;" onClick="checkAllUser(' . $id_user . ')">' . Get::img('standard/checkall.png', Lang::t('_CHECK_ALL_USER', 'presence') . '</a>') . '<br />' . '<a href="javascript:;" onClick="unCheckAllUser(' . $id_user . ')">' . Get::img('standard/uncheckall.png', Lang::t('_UNCHECK_ALL_USER', 'presence') . '</a>');
            if ($test_type == _DATE_TEST_TYPE_PAPER) {
                if (isset($user_presence[$id_user]['0000-00-00']) && $user_presence[$id_user]['0000-00-00']['presence'] == 1) {
                    $passed = true;
                } else {
                    $passed = false;
                }
                $cont[] = Form::getTextfield('', 'score_' . $id_user, 'score_' . $id_user, 255, isset($user_presence[$id_user]['0000-00-00']['score']) ? $user_presence[$id_user]['0000-00-00']['score'] : '0');
            }
            $cont[] = Form::getSimpleTextarea('', 'note_' . $id_user, 'note_' . $id_user, isset($user_presence[$id_user]['0000-00-00']['note']) ? $user_presence[$id_user]['0000-00-00']['note'] : '', false, false, false, 2);
            $tb->addBody($cont);
        }
        cout($tb->getTable() . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', Lang::t('_SAVE', 'admin_date')) . Form::closeElementSpace() . Form::closeForm() . '</div>', 'content');
        cout('<script type="text/javascript">' . 'var _MIN_SCORE_NOT_SET = "' . Lang::t('_MIN_SCORE_NOT_SET', 'admin_date') . '";' . 'YAHOO.util.Event.addListener("save", "click", controlMinScore);' . 'YAHOO.util.Event.addListener("id_date", "change", formSubmit);' . 'function checkAllDay(id_day)
{
	var days = YAHOO.util.Selector.query(\'input[id*=_\' + id_day + \'_]\');
	var i;

	for(i = 0; i < days.length; i++)
		days[i].checked = true;
}

function unCheckAllDay(id_day)
{
	var days = YAHOO.util.Selector.query(\'input[id*=_\' + id_day + \'_]\');
	var i;

	for(i = 0; i < days.length; i++)
		days[i].checked = false;
}

function checkAllUser(id_user)
{
	var days = YAHOO.util.Selector.query(\'input[id*=_\' + id_user + \']\');
	var i;

	for(i = 0; i < days.length; i++)
		days[i].checked = true;
}

function unCheckAllUser(id_user)
{
	var days = YAHOO.util.Selector.query(\'input[id*=_\' + id_user + \']\');
	var i;

	for(i = 0; i < days.length; i++)
		days[i].checked = false;
}' . '</script>', 'content');
    }
    cout('</div>', 'content');
}
Example #17
0
function editUserReport($id_user, $id_test, $id_track)
{
    $lang =& DoceboLanguage::createInstance('test');
    //test info---------------------------------------------------------
    list($title, $mod_doanswer, $point_type, $point_required, $question_random_number, $show_score, $show_score_cat, $show_doanswer, $show_solution, $order_type) = sql_fetch_row(sql_query("\r\n\tSELECT  title, mod_doanswer, point_type, point_required, question_random_number, \r\n\t\t\tshow_score, show_score_cat, show_doanswer, \r\n\t\t\tshow_solution, order_type\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_test \r\n\tWHERE idTest = '" . (int) $id_test . "'"));
    list($score, $bonus_score, $date_attempt, $date_attempt_mod, $date_end_attempt) = sql_fetch_row(sql_query("\r\n\tSELECT score, bonus_score, date_attempt, date_attempt_mod, date_end_attempt\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_testtrack \r\n\tWHERE idTrack = '" . (int) $id_track . "'"));
    $point_do = 0;
    $max_score = 0;
    $num_manual = 0;
    $manual_score = 0;
    $quest_sequence_number = 1;
    $report_test = '';
    $point_do_cat = array();
    if ($order_type >= 2) {
        $re_visu_quest = sql_query("SELECT idQuest \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testtrack_quest \r\n\t\tWHERE idTrack = '" . (int) $id_track . "' ");
        while (list($id_q) = sql_fetch_row($re_visu_quest)) {
            $quest_see[] = $id_q;
        }
        $query_question = "\r\n\t\tSELECT q.idQuest, q.type_quest, t.type_file, t.type_class, q.idCategory \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest AS q JOIN " . $GLOBALS['prefix_lms'] . "_quest_type AS t \r\n\t\tWHERE q.idTest = '" . $id_test . "' AND q.type_quest = t.type_quest AND  q.idQuest IN (" . implode($quest_see, ',') . ") \r\n\t\tORDER BY q.sequence";
    } else {
        $query_question = "\r\n\t\tSELECT q.idQuest, q.type_quest, t.type_file, t.type_class, q.idCategory \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest AS q JOIN " . $GLOBALS['prefix_lms'] . "_quest_type AS t \r\n\t\tWHERE q.idTest = '" . $id_test . "' AND q.type_quest = t.type_quest \r\n\t\tORDER BY q.sequence";
    }
    $reQuest = sql_query($query_question);
    while (list($id_quest, $type_quest, $type_file, $type_class, $id_cat) = sql_fetch_row($reQuest)) {
        require_once $GLOBALS['where_lms'] . '/modules/question/' . $type_file;
        $quest_point_do = 0;
        $quest_obj = eval("return new {$type_class}( {$id_quest} );");
        $quest_point_do = $quest_obj->userScore($id_track);
        $quest_max_score = $quest_obj->getMaxScore();
        if ($type_quest != 'title' && $type_quest != 'break_page') {
            $review = $quest_obj->displayUserResult($id_track, $type_quest != 'title' ? $quest_sequence_number++ : $quest_sequence_number, $quest_sequence_number);
            $report_test .= '<div class="test_quest_review_container">' . $review['quest'];
            if ($review['score'] !== false) {
                $report_test .= '<div class="test_answer_comment_nomargin">' . '<div class="test_score_note">' . $lang->def('_SCORE') . ' : ';
                if ($quest_obj->getScoreSetType() == 'manual' && !$review['manual_assigned']) {
                    $report_test .= $lang->def('_NOT_ASSIGNED');
                } else {
                    if ($review['score'] > 0) {
                        $report_test .= '<span class="test_score_positive">' . $review['score'] . '</span>';
                    } else {
                        $report_test .= '<span class="test_score_negative">' . $review['score'] . '</span>';
                    }
                }
                $report_test .= '</div>' . ($review['comment'] != '' ? $review['comment'] : '') . '</div>';
            }
            $report_test .= '<div class="test_edit_scores">' . Form::getTextfield($lang->def('_NEW_SCORE_FOR_QUESTION'), 'new_user_score_' . $id_quest, 'new_user_score[' . $id_quest . ']', 8, '') . '</div>' . "\n" . '</div>' . "\n";
        }
    }
    $total_time = 0;
    $total_time = fromDatetimeToTimestamp($date_end_attempt) - fromDatetimeToTimestamp($date_attempt);
    if ($total_time > 0) {
        $seconds = $total_time % 60;
        $total_time -= $seconds;
        $minutes = $total_time / 60;
    }
    $GLOBALS['page']->add('<div class="title">' . $lang->def('_TITLE') . ' : ' . $title . '</div>', 'content');
    $GLOBALS['page']->add('<br />' . Form::getTextfield($lang->def('_BONUS_SCORE_FOR_TEST'), 'bonus_score', 'bonus_score', 8, $bonus_score) . '<br />' . ($total_time > 0 ? '<b>' . Lang::t('_DATE_BEGIN', 'standard') . '</b> : ' . Format::date($date_attempt, 'datetime') . '<br />' . '<b>' . Lang::t('_DATE_END', 'standard') . '</b> : ' . Format::date($date_end_attempt, 'datetime') . '<br />' . '<b>' . Lang::t('_TOTAL_TIME', 'test') . '</b> : ' . $minutes . ':' . $seconds . '<br />' . '<br />' : '') . '<div class="test_answer_space">' . $report_test . '</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&amp;op=edit&amp;type_quest=' . $this->getQuestionType() . '&amp;idQuest=' . $this->id . '&amp;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&amp;op=edit&amp;type_quest=' . $this->getQuestionType() . '&amp;idQuest=' . $this->id . '&amp;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('&', '&amp;', $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&amp;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');
 }
Example #19
0
 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&amp;op=notes' => $lang->def('_NOTES'), $lang->def('_MOD_NOTES'));
     $GLOBALS['page']->add(getTitleArea(array(), 'notes') . '<div class="std_block">' . getBackUi('index.php?modname=notes&amp;op=notes', $lang->def('_BACK')) . Form::openForm('formnotes', 'index.php?modname=notes&amp;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');
 }
Example #20
0
 /**
  * gui for user info management
  */
 function getUserInfoModUi()
 {
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.preference.php';
     $this->loadUserData($this->_user_profile->getIdUser());
     $preference = new UserPreferences($this->_user_profile->getIdUser());
     $html = '<div class="up_user_info">' . '<div class="up_name">' . $this->resolveUsername(false, $this->_user_profile->getIdUser()) . '</div>';
     // user standard info -----------------------------------------------------------------
     $html .= Form::openForm('mod_up', $this->_url_man->getUrl($this->_varname_action . '=saveinfo'), false, false, 'multipart/form-data');
     if ($this->_user_profile->godMode()) {
         $html .= Form::getTextfield($this->_lang->def('_USERNAME'), 'up_userid', 'up_userid', '255', Get::req('up_userid', DOTY_MIXED, $this->acl_man->relativeId($this->user_info[ACL_INFO_USERID]), true));
     } else {
         $html .= Form::getLineBox($this->_lang->def('_USERNAME'), $this->acl_man->relativeId($this->user_info[ACL_INFO_USERID]));
     }
     $html .= Form::getTextfield($this->_lang->def('_LASTNAME'), 'up_lastname', 'up_lastname', '255', Get::req('up_lastname', DOTY_MIXED, $this->user_info[ACL_INFO_LASTNAME], true)) . Form::getTextfield($this->_lang->def('_FIRSTNAME'), 'up_firstname', 'up_firstname', '255', Get::req('up_firstname', DOTY_MIXED, $this->user_info[ACL_INFO_FIRSTNAME], true)) . Form::getTextfield($this->_lang->def('_EMAIL'), 'up_email', 'up_email', '255', Get::req('up_email', DOTY_MIXED, $this->user_info[ACL_INFO_EMAIL], true));
     // user extra field ------------------------------------------------------------------
     $html .= $this->getPlayField();
     $html .= $preference->getModifyMask('ui.');
     if ($this->_user_profile->godMode()) {
         $acl_man =& Docebo::user()->getAclManager();
         $html .= Form::getPassword(Lang::t('_NEW_PASSWORD', 'register'), 'up_new_pwd', 'up_new_pwd', '255');
         $html .= Form::getPassword(Lang::t('_RETYPE_PASSWORD', 'register'), 'up_repeat_pwd', 'up_repeat_pwd', '255');
         if (Docebo::user()->getUserLevelId() == ADMIN_GROUP_GODADMIN && Get::cur_plat() === 'framework') {
             $html .= Form::getCheckBox(Lang::t('_FORCE_PASSWORD_CHANGE', 'admin_directory'), 'force_changepwd', 'force_changepwd', 1, $this->user_info[ACL_INFO_FORCE_CHANGE]);
         }
         $lv_lang =& DoceboLanguage::createInstance('admin_directory', 'framework');
         if (Docebo::user()->getUserLevelId() == ADMIN_GROUP_GODADMIN) {
             $level_list = array(ADMIN_GROUP_GODADMIN => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_GODADMIN), ADMIN_GROUP_ADMIN => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_ADMIN), ADMIN_GROUP_PUBLICADMIN => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_PUBLICADMIN), ADMIN_GROUP_USER => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_USER));
         } else {
             $level_list = array(ADMIN_GROUP_USER => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_USER));
         }
         $html .= Form::getDropdown($this->_lang->def('_LEVEL'), 'up_level', 'up_level', $level_list, $acl_man->getUserLevelId($this->_user_profile->getIdUser()));
     }
     // Social ------------------------------------------------------------------
     /* $html.=Form::getTextfield(	$this->_lang->def('_FACEBOOK_ID'),
     										'facebook_id',
     										'facebook_id',
     										'255',
     										Get::req('facebook_id', DOTY_MIXED, $this->user_info[ACL_INFO_FACEBOOK_ID], true ) );
     
     		$html.=Form::getTextfield(	$this->_lang->def('_TWITTER_ID'),
     										'twitter_id',
     										'twitter_id',
     										'255',
     										Get::req('twitter_id', DOTY_MIXED, $this->user_info[ACL_INFO_TWITTER_ID], true ) );
     
     		$html.=Form::getTextfield(	$this->_lang->def('_LINKEDIN_ID'),
     										'linkedin_id',
     										'linkedin_id',
     										'255',
     										Get::req('linkedin_id', DOTY_MIXED, $this->user_info[ACL_INFO_LINKEDIN_ID], true ) );
     
     		$html.=Form::getTextfield(	$this->_lang->def('_GOOGLE_ID'),
     										'google_id',
     										'google_id',
     										'255',
     										Get::req('google_id', DOTY_MIXED, $this->user_info[ACL_INFO_GOOGLE_ID], true ) ); */
     //signature --------------------------------------------------------------------------
     $html .= Form::getTextarea($this->_lang->def('_SIGNATURE'), 'up_signature', 'up_signature', Get::req('up_signature', DOTY_MIXED, $this->user_info[ACL_INFO_SIGNATURE], true));
     if (isset($_GET['modname']) && $_GET['modname'] == 'reservation') {
         $html .= Form::openButtonSpace() . Form::getButton('save', 'save', $this->_lang->def('_SAVE')) . Form::getButton('undo_profile', 'undo_profile', $this->_lang->def('_UNDO')) . Form::closeButtonSpace();
         $html .= Form::closeForm() . '</div>';
     } else {
         $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;
 }
Example #21
0
<?php

echo Form::openForm('add_location', 'ajax.adm_server.php?r=alms/location/insertLocation') . Form::getTextfield(Lang::t('_LOCATION', 'lms'), 'location', 'location', 255, $location->location) . Form::closeForm();
Example #22
0
/**
 * The UI for create a new task
 * @param Module $module the caller module
 **/
function ioTask_UITaskNew_step2(&$module, &$params)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    $connMgr =& $module->get_connMgr();
    $lang =& $module->get_lang();
    $out =& $module->get_out();
    $form = new Form();
    $out->add($form->getLineBox($lang->def('_NAME'), $params[CONNMGR_TASK_NAME]));
    $out->add($form->getRadioSet($lang->def('_IMPORT_TYPE'), 'task_import_type', 'task_params[' . CONNMGR_TASK_IMPORT_TYPE . ']', array($lang->def('_IMPORT_TYPE_INSERTONLY') => TASK_IMPORT_TYPE_INSERTONLY, $lang->def('_IMPORT_TYPE_INSERTREMOVE') => TASK_IMPORT_TYPE_INSERTREMOVE), $params[CONNMGR_TASK_IMPORT_TYPE]));
    $out->add($form->getRadioSet($lang->def('_SCHEDULE'), 'task_schedule_type', 'task_params[' . CONNMGR_TASK_SCHEDTYPE . ']', array($lang->def('_SCHEDULE_TYPE_AT') => 'at', $lang->def('_SCHEDULE_TYPE_INTERVAL') => 'interval'), $params[CONNMGR_TASK_SCHEDTYPE]));
    $tmp_um = $form->getInputListbox('', 'task_schedule_um', 'task_params[' . CONNMGR_TASK_SCHEDULE . '][um]', array('hour' => $lang->def('_HOUR'), 'day' => $lang->def('_DAY')), array($params[CONNMGR_TASK_SCHEDULE]['um']), FALSE, '');
    $out->add($form->getTextfield($lang->def('_SCHEDULE'), 'task_schedule_qt', 'task_params[' . CONNMGR_TASK_SCHEDULE . '][qt]', 10, $params[CONNMGR_TASK_SCHEDULE]['qt'], '', $tmp_um, ''));
    $out->add("\n<script type='text/javascript'>\n" . "var field_um = document.getElementById('task_schedule_um');\n" . "var field = document.getElementById('task_schedule_type_0');\n" . "field.onclick = function() {\n" . "\tfield_um.style.display = 'none';\n" . "}\n" . "field = document.getElementById('task_schedule_type_1');\n" . "field.onclick = function() {\n" . "\tfield_um.style.display = 'inline';\n" . "}\n" . "</script>\n");
}
Example #23
0
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&amp;op=social_connect_login&amp;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&amp;op=social_connect_login&amp;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') . '&nbsp;<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') . '&nbsp;';
        $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&amp;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
}
Example #24
0
 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&amp;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&amp;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');
 }
Example #25
0
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');
}
Example #26
0
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() . "&amp;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);
}
Example #27
0
<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&amp;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>
Example #28
0
 /**
  * display the field for filters
  *
  * @param	string	$field_id		the id of the field used for id/name
  * @param 	mixed 	$value 			(optional) the value to put in the field
  *										retrieved from $_POST if not given
  * @param	string	$label			(optional) the label to use if not given the
  *									value will be retrieved from custom field
  *									$id_field
  * @param	string	$field_prefix 	(optional) the prefix to give to
  *									the field id/name
  * @param 	string 	$other_after 	optional html code added after the input element
  * @param	string 	$other_before 	optional html code added before the label element
  * @param   mixed 	$field_special	(optional) not used
  *
  * @return string 	of field xhtml code
  *
  * @access public
  */
 function play_filter($id_field, $value = FALSE, $label = FALSE, $field_prefix = FALSE, $other_after = '', $other_before = '', $field_special = FALSE)
 {
     require_once _base_ . '/lib/lib.form.php';
     if ($value === FALSE) {
         $value = Field::getFieldValue_Filter($_POST, $id_field, $field_prefix, '');
     }
     if ($label === FALSE) {
         $re_field = sql_query("\r\n\t\t\tSELECT translation\r\n\t\t\tFROM " . Field::_getMainTable() . "\r\n\t\t\tWHERE id_common = '" . (int) $id_field . "' AND type_field = '" . Field_Freetext::getFieldType() . "'");
         list($label) = sql_fetch_row($re_field);
     }
     return Form::getTextfield($label, Field::getFieldId_Filter($id_field, $field_prefix), Field::getFieldName_Filter($id_field, $field_prefix), 255, $value, $label, $other_after, $other_before);
     /* in filter all in one line
     		return Form::getSimpleTextarea($label,
     								Field::getFieldId_Filter($id_field, $field_prefix),
     								Field::getFieldName_Filter($id_field, $field_prefix),
     								$value );*/
 }
if (!$_is_editing) {
    echo Form::getHidden('id_location', 'id_location', (int) $id_location);
}
if ($_is_editing) {
    echo Form::getHidden('id_classroom', 'id_classroom', $info->idClassroom);
}
if ($_is_editing) {
    echo Form::getHidden('id_location', 'id_location', $info->location_id);
}
echo Form::getTextfield(Lang::t('_BUILDING_ROOM', 'classroom'), 'room', 'room', 255, $_is_editing ? $info->room : "");
echo Form::getTextfield(Lang::t('_CAPACITY', 'classroom'), 'capacity', 'capacity', 255, $_is_editing ? $info->capacity : "");
echo Form::getTextfield(Lang::t('_RESPONSABLE', 'classroom'), 'responsable', 'responsable', 255, $_is_editing ? $info->responsable : "");
echo Form::getTextfield(Lang::t('_STREET', 'classroom'), 'street', 'street', 255, $_is_editing ? $info->street : "");
echo Form::getTextfield(Lang::t('_CITY', 'classroom'), 'city', 'city', 255, $_is_editing ? $info->city : "");
echo Form::getTextfield(Lang::t('_STATE', 'classroom'), 'state', 'state', 255, $_is_editing ? $info->state : "");
echo Form::getTextfield(Lang::t('_ZIP_CODE', 'classroom'), 'zip_code', 'zip_code', 255, $_is_editing ? $info->zip_code : "");
echo Form::getTextfield(Lang::t('_PHONE', 'classroom'), 'phone', 'phone', 255, $_is_editing ? $info->phone : "");
echo Form::getTextfield(Lang::t('_FAX', 'classroom'), 'fax', 'fax', 255, $_is_editing ? $info->fax : "");
echo Form::getTextarea(Lang::t('_DISPOSITION', 'classroom'), 'disposition', 'disposition', $_is_editing ? $info->disposition : "");
echo Form::getTextarea(Lang::t('_INSTRUMENT', 'classroom'), 'instrument', 'instrument', $_is_editing ? $info->instrument : "");
echo Form::getTextarea(Lang::t('_AVAILABLE_INSTRUMENT', 'classroom'), 'available_instrument', 'available_instrument', $_is_editing ? $info->available_instrument : "");
echo Form::getTextarea(Lang::t('_NOTES', 'classroom'), 'note', 'note', $_is_editing ? $info->note : "");
echo Form::openButtonSpace();
echo $_is_editing ? Form::getButton('save', 'save', Lang::t('_SAVE', 'classroom')) : Form::getButton('save', 'save', Lang::t('_SAVE', 'classroom'));
echo Form::getButton('undo', 'undo', Lang::t('_UNDO', 'classroom'));
echo Form::closeButtonSpace();
echo Form::closeForm();
?>
</div>

Example #30
0
 /**
  * @return 	string 	contains the displayable information for a selected group
  *
  * @access 	public
  */
 function getPageWithElement($regroup)
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('admin_config', 'scs');
     if ($regroup == 'root') {
         return $this->_getRoot();
     }
     $reSetting = sql_query("\r\n\t\tSELECT param_name, param_value, value_type, max_size \r\n\t\tFROM " . $this->table . " \r\n\t\tWHERE regroup = '" . $regroup . "' AND \r\n\t\t\thide_in_modify = '0'\r\n\t\tORDER BY sequence");
     $html = '';
     while (list($var_name, $var_value, $value_type, $max_size) = sql_fetch_row($reSetting)) {
         switch ($value_type) {
             case "template":
                 //drop down template
                 $templ = getTemplateList();
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $templ, array_search($var_value, $templ));
                 break;
             case "enum":
                 //on off
                 $html .= Form::openFormLine() . Form::getLabel($var_name . '_on', $lang->def('_' . strtoupper($var_name))) . Form::getInputCheckbox($var_name . '_on', 'option[' . $var_name . ']', 'on', $var_value == 'on', '') . Form::closeFormLine();
                 break;
             case "check":
                 //on off
                 $html .= Form::getCheckbox($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', 1, $var_value == 1);
                 break;
                 //string or int
             //string or int
             default:
                 $html .= Form::getTextfield($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $max_size, $var_value);
         }
     }
     return $html;
 }