Пример #1
0
 function addfaqcat($object_faq)
 {
     checkPerm('view', false, 'storage');
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('faq');
     $GLOBALS['page']->add(getTitleArea($lang->def('_SECT_FAQ'), 'faq') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $object_faq->back_url) . '&amp;create_result=0', $lang->def('_BACK')) . Form::openForm('faqform', 'index.php?modname=faq&amp;op=insfaqcat') . Form::openElementSpace() . Form::getHidden('back_url', 'back_url', htmlentities(urlencode($object_faq->back_url))) . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', 255, $lang->def('_TITLE')) . Form::getTextarea($lang->def('_DESCRIPTION'), 'description', 'description', $lang->def('_DESCRIPTION')) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('addfaq', 'addfaq', $lang->def('_INSERT')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
Пример #2
0
 /**
  * function create()
  *
  * @param $back_url	the url where the function retutn at the end of the operation
  * @return nothing
  */
 function create($id_poll, $back_poll)
 {
     if (!sql_query("\r\n\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\t\t( id_poll, type_quest, title_quest, sequence, page ) VALUES \r\n\t\t( \t'" . $id_poll . "', \r\n\t\t\t'" . $this->getQuestionType() . "', \r\n\t\t\t'<span class=\"text_bold\">" . Lang::t('_QUEST_BREAK_PAGE') . "</span>',\r\n\t\t\t'" . $this->_getNextSequence($id_poll) . "', \r\n\t\t\t'" . $this->_getPageNumber($id_poll) . "' ) ")) {
         errorCommunication(def('_POLL_ERR_INS_QUEST') . getBackUi(Util::str_replace_once('&', '&amp;', $back_poll), Lang::t('_BACK')));
     }
     Util::jump_to('' . $back_poll);
 }
Пример #3
0
 /**
  * function create()
  *
  * @param $back_url	the url where the function retutn at the end of the operation
  * @return nothing
  */
 function create($idTest, $back_test)
 {
     if (!sql_query("\r\n\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\t( idTest, type_quest, title_quest, sequence, page, difficult ) VALUES \r\n\t\t( \t'" . $idTest . "', \r\n\t\t\t'" . $this->getQuestionType() . "', \r\n\t\t\t'<span class=\"text_bold\">" . Lang::t('_QUEST_BREAK_PAGE') . "</span>',\r\n\t\t\t'" . $this->_getNextSequence($idTest) . "', \r\n\t\t\t'" . $this->_getPageNumber($idTest) . "',\r\n\t\t\t'0') ")) {
         errorCommunication(def('_OPERATION_FAILURE') . getBackUi(Util::str_replace_once('&', '&amp;', $back_test), Lang::t('_BACK')));
     }
     Util::jump_to('' . $back_test);
 }
Пример #4
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');
 }
Пример #5
0
 function modglossary()
 {
     checkPerm('view', false, 'storage');
     $lang =& DoceboLanguage::createInstance('glossary');
     require_once _base_ . '/lib/lib.form.php';
     $idGlossary = importVar('idGlossary', true, 0);
     $back_url = urldecode(importVar('back_url'));
     $back_coded = htmlentities(urlencode($back_url));
     list($title, $description) = sql_fetch_row(sql_query("\r\n\tSELECT title, description\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_glossary \r\n\tWHERE idGlossary = '" . $idGlossary . "'"));
     $GLOBALS['page']->add(getTitleArea($lang->def('_GLOSSARY'), 'glossary', $lang->def('_GLOSSARY')) . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $back_url) . '&amp;create_result=0', $lang->def('_BACK')) . Form::openForm('glossaryform', 'index.php?modname=glossary&amp;op=upglossary') . Form::openElementSpace() . Form::getHidden('back_url', 'back_url', $back_coded) . Form::getHidden('idGlossary', 'idGlossary', $idGlossary) . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', 150, $title) . Form::getTextarea($lang->def('_DESCRIPTION'), 'description', 'description', $description) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('modglossary', 'modglossary', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
Пример #6
0
    function play($object_link, $id_param)
    {
        //-kb-play-// if(!checkPerm('view', true, 'organization') && !checkPerm('view', true, 'storage')) die("You can't access");
        $lang =& DoceboLanguage::createInstance('link');
        $idCategory = $object_link->getId();
        $mode = importVar('mode', false, 'link');
        $back_coded = htmlentities(urlencode($object_link->back_url));
        require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
        $idReference = getLOParam($id_param, 'idReference');
        // NOTE: Track only if $idReference is present
        if ($idReference !== FALSE) {
            require_once $GLOBALS['where_lms'] . '/class.module/track.link.php';
            list($exist, $idTrack) = Track_Link::getIdTrack($idReference, getLogUserId(), $idCategory, TRUE);
            if ($exist) {
                $ti = new Track_Link($idTrack);
                $ti->setDate(date('Y-m-d H:i:s'));
                $ti->status = 'completed';
                $ti->update();
            } else {
                $ti = new Track_Link(false);
                $ti->createTrack($idReference, $idTrack, getLogUserId(), date('Y-m-d H:i:s'), 'completed', 'link');
            }
        }
        list($title) = sql_fetch_row(sql_query("\r\n\tSELECT title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_link_cat \r\n\tWHERE idCategory = '" . (int) $idCategory . "'"));
        $link = 'index.php?modname=link&amp;op=play&amp;idCategory=' . $idCategory . '&amp;id_param=' . $id_param . '&amp;back_url=' . $back_coded;
        /*$GLOBALS['page']->add('<div id="top" class="std_block">'
        		.'<div class="colum_container">' */
        cout('<div id="top" class="yui-navset yui-navset-top tab_block">
		<ul class="yui-nav">
			<li class="first' . ($mode != 'keyw' ? ' selected' : '') . '">
				<a href="' . $link . '&amp;mode=list">
					<em>' . Lang::t('_SWITCH_TO_LIST', 'link') . '</em>
				</a>
			</li>
			<li' . ($mode == 'keyw' ? ' class="selected"' : '') . '>
				<a href="' . $link . '&amp;mode=keyw">
					<em>' . Lang::t('_SWITCH_TO_KEYWORD', 'link') . '</em>
				</a>
			</li>
		</ul>
		<div class="yui-content">', 'content');
        cout(getBackUi(Util::str_replace_once('&', '&amp;', $object_link->back_url), $lang->def('_BACK')), 'content');
        $GLOBALS['page']->add('<b>' . $lang->def('_TITLE') . ' : ' . $title . '</b><br /><br />' . $lang->def('_LINKIUNNEWWINDOW') . '<br /><br />', 'content');
        if ($mode == 'keyw') {
            displayAsKey($idCategory, $link . '&amp;mode=keyw');
        } else {
            displayAsList($idCategory);
        }
        $GLOBALS['page']->add('<div class="align_center">' . '<a href="#top"><img src="' . getPathImage() . 'standard/up.png" title="' . $lang->def('_BACKTOTOP') . '" />' . $lang->def('_BACKTOTOP') . '</a>' . getBackUi(Util::str_replace_once('&', '&amp;', $object_link->back_url), $lang->def('_BACK')) . '</div>', 'content');
        cout('</div></div>', 'content');
    }
Пример #7
0
 function edit($back_poll)
 {
     $lang =& DoceboLanguage::createInstance('poll');
     require_once _base_ . '/lib/lib.form.php';
     $url_encode = htmlentities(urlencode($back_poll));
     if (isset($_POST['add_question'])) {
         if (!sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\t\t\tSET title_quest = '" . $_POST['title_quest'] . "' \r\n\t\t\tWHERE id_quest = '" . $this->id . "'")) {
             errorCommunication($lang->def('_ERR_INS_QUEST') . getBackUi('index.php?modname=question_poll&amp;op=edit&amp;type_quest=' . $this->getQuestionType() . '&amp;id_quest=' . $this->id . '&amp;back_poll=' . $url_encode, $lang->def('_BACK')));
         }
         Util::jump_to('' . $back_poll);
     }
     list($title_quest) = sql_fetch_row(sql_query("\r\n\t\tSELECT title_quest \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\t\tWHERE id_quest = '" . $this->id . "'"));
     $GLOBALS['page']->add(getTitleArea($lang->def('_POLL_SECTION'), 'poll') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&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_mod_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', $title_quest) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('add_question', 'add_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
Пример #8
0
function additem($object_item)
{
    //checkPerm( 'view', FALSE, 'storage' );
    $lang =& DoceboLanguage::createInstance('scorm', 'lms');
    require_once _base_ . '/lib/lib.form.php';
    $form = new Form();
    //area title
    $GLOBALS['page']->add(getTitleArea($lang->getLangText('_SCORMIMGSECTION'), 'scorm', $lang->getLangText('_SCORMSECTIONNAME')));
    $GLOBALS['page']->add('<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $object_item->back_url) . '&amp;create_result=0', $lang->getLangText('_BACK_TOLIST')));
    $GLOBALS['page']->add(Form::getFormHeader($lang->def('_SCORM_ADD_FORM')));
    $GLOBALS['page']->add($form->openForm("scormform", "index.php?modname=scorm&amp;op=insitem", false, false, 'multipart/form-data'));
    $GLOBALS['page']->add($form->openElementSpace());
    $GLOBALS['page']->add($form->getHidden("back_url", "back_url", htmlentities(urlencode($object_item->back_url))));
    $GLOBALS['page']->add($form->getFilefield($lang->getLangText('_CONTENTPACKAGE'), "attach", "attach"));
    $GLOBALS['page']->add($form->getCheckbox($lang->getLangText('_SCORMIMPORTRESOURCES'), "lesson_resources", "lesson_resources", "import"));
    $GLOBALS['page']->add($form->closeElementSpace());
    $GLOBALS['page']->add($form->openButtonSpace());
    $GLOBALS['page']->add($form->getButton("scorm_add_submit", "scorm_add_submit", $lang->getLangText('_SCORMLOAD')));
    $GLOBALS['page']->add($form->closeButtonSpace());
    $GLOBALS['page']->add($form->closeForm() . '</div>');
}
Пример #9
0
 function modlinkgui($object_link)
 {
     checkPerm('view', false, 'storage');
     $lang =& DoceboLanguage::createInstance('link');
     require_once _base_ . '/lib/lib.table.php';
     $del_perm = checkPerm('view', false, 'storage');
     $back_coded = htmlentities(urlencode($object_link->back_url));
     $textQuery = "\r\n\tSELECT idLink, title, link_address, sequence \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_link \r\n\tWHERE idCategory = '" . $object_link->getId() . "' \r\n\tORDER BY sequence";
     $result = sql_query($textQuery);
     $num_link = mysql_num_rows($result);
     list($title_cat) = sql_fetch_row(sql_query("\r\n\tSELECT title\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_link_cat \r\n\tWHERE idCategory = '" . $object_link->getId() . "'"));
     $GLOBALS['page']->add(getTitleArea($lang->def('_SECT_LINK'), 'link') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&amp;', $object_link->back_url) . '&amp;mod_result=0', $lang->def('_BACK')) . '<b>' . $lang->def('_TITLE') . ' : ' . $title_cat . '</b><br /><br />' . '<div class="mod_container">' . '<a href="index.php?modname=link&amp;op=modlinkcat&amp;idCategory=' . $object_link->getId() . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_MOD_TITLE') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" /> ' . $lang->def('_MOD_TITLE') . '</a>' . '</div><br />', 'content');
     $tableCat = new Table(0, '', $lang->def('_SUMMARY_LINK'));
     $contentH = array($lang->def('_QUESTION'), $lang->def('_URL'), '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" title="' . $lang->def('_MOVE_DOWN') . '" />', '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" title="' . $lang->def('_MOVE_UP') . '" />', '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '" />');
     $typeH = array('', 'image', 'image', 'image', 'image', 'image');
     $tableCat->setColsStyle($typeH);
     $tableCat->addHead($contentH);
     $i = 1;
     while (list($idLink, $title, $link_address, $seq) = sql_fetch_row($result)) {
         $rowContent = array($seq . ') ' . $title, $link_address);
         if ($i != $num_link) {
             $rowContent[] = '<a href="index.php?modname=link&amp;op=movedown&amp;idLink=' . $idLink . '&amp;back_url=' . $back_coded . '">' . '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" title="' . $lang->def('_MOVE_DOWN') . '" /></a>';
         } else {
             $rowContent[] = '&nbsp;';
         }
         if ($i != 1) {
             $rowContent[] = '<a href="index.php?modname=link&amp;op=moveup&amp;idLink=' . $idLink . '&amp;back_url=' . $back_coded . '">' . '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" title="' . $lang->def('_MOVE_UP') . '" /></a>';
         } else {
             $rowContent[] = '&nbsp;';
         }
         $rowContent[] = '<a href="index.php?modname=link&amp;op=modlink&amp;idLink=' . $idLink . '&amp;back_url=' . $back_coded . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" /></a>';
         $rowContent[] = '<a href="index.php?modname=link&amp;op=dellink&amp;idLink=' . $idLink . '&amp;back_url=' . $back_coded . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '" /></a>';
         $tableCat->addBody($rowContent);
         ++$i;
     }
     $tableCat->addActionAdd('<a href="index.php?modname=link&amp;op=newlink&amp;idCategory=' . $object_link->getId() . '&amp;back_url=' . $back_coded . '" title="' . $lang->def('_ADDLINKT') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADDLINK') . '</a>');
     $GLOBALS['page']->add($tableCat->getTable() . '<span class="text_bold text_little">[ ' . '<a href="index.php?modname=link&amp;op=fixsequence&amp;idCategory=' . $object_link->getId() . '&amp;back_url=' . $back_coded . '">' . $lang->def('_FIX_SEQUENCE') . '</a>' . ' ]</span>' . '</div>', 'content');
 }
Пример #10
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');
 }
Пример #11
0
function schedule_recipients($idrep)
{
    checkPerm('mod');
    $lang =& DoceboLanguage::createInstance('report', 'framework');
    if (Get::req('schedule_undo', DOTY_MIXED, false)) {
        //$back_op = Get::req()
        $back_url = 'index.php?modname=report&op=schedulelist&idrep=' . $idrep;
        Util::jump_to($back_url);
    }
    $back_url = 'index.php?modname=report&op=report_schedule&idrep=' . $idrep;
    $jump_url = 'index.php?modname=report&op=report_schedule&idrep=' . $idrep;
    $end_url = 'index.php?modname=report&op=schedulelist&idrep=' . $idrep;
    require_once _base_ . '/lib/lib.form.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.directory.php';
    require_once _base_ . '/lib/lib.userselector.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.report.php';
    //require_once($GLOBALS['where_lms'].'/lib/lib.course.php');
    $aclManager = new DoceboACLManager();
    $user_select = new UserSelector();
    $lang =& DoceboLanguage::createInstance('report', 'framework');
    if (!isset($_POST['is_updating'])) {
        //save filter, if needed
        require_once $GLOBALS['where_lms'] . '/lib/lib.report.php';
        //save schedulation data in session
        if (!isset($_SESSION['schedule_tempdata'])) {
            $_SESSION['schedule_tempdata'] = array();
        }
        switch ($_POST['cron_radio']) {
            case 'day':
                $sched_info = '';
                break;
            case 'week':
                $sched_info = $_POST['cron_weekly'];
                break;
            case 'month':
                $sched_info = $_POST['cron_monthly'];
                break;
            default:
                $sched_info = '';
                break;
        }
        $sched_time = '';
        //$_POST['cron_hours'].':'.$_POST['cron_minutes'].':00';
        $ref =& $_SESSION['schedule_tempdata'];
        $ref['name'] = $_POST['sched_name'];
        $ref['period'] = $_POST['cron_radio'];
        $ref['period_info'] = $sched_info;
        $ref['time'] = $sched_time;
        $user_select->resetSelection($ref['recipients']);
    }
    $save_schedule_failed = false;
    if (isset($_POST['cancelselector'])) {
        //Util::jump_to($back_url);
        Util::jump_to('index.php?modname=report&op=schedulelist&idrep=' . $idrep);
    } elseif (isset($_POST['okselector'])) {
        $ref =& $_SESSION['schedule_tempdata'];
        $entity_selected = $user_select->getSelection($_POST);
        //$_temp = $ref['recipients'];
        $_name = $ref['name'];
        $_time = $ref['time'];
        $_period = $ref['period'] . ',' . $ref['period_info'];
        //get current saved report ID from session (check if report is saved, otherwise -> error)
        if (isset($_SESSION['schedule_update'])) {
            $sched = report_update_schedulation($_SESSION['schedule_update'], $_name, $_period, $_time, $entity_selected);
        } else {
            $id_report = $idrep;
            //$_SESSION['report_saved_data']['id'];
            $sched = report_save_schedulation($id_report, $_name, $_period, $_time, $entity_selected);
        }
        if ($sched !== false) {
            //unset($_SESSION['schedule_tempdata']);
            Util::jump_to($end_url);
        } else {
            $save_schedule_failed = true;
        }
    }
    $error_info = '';
    if ($save_schedule_failed) {
        //$page_title .= ''; //...
        //addforminfo
        $error_info = getErrorUi($lang->def('_OPERATION_FAILURE'));
    }
    //draw selector
    $user_select->show_user_selector = TRUE;
    $user_select->show_group_selector = TRUE;
    $user_select->show_orgchart_selector = TRUE;
    $user_select->show_orgchart_simple_selector = false;
    cout(getTitleArea($lang->def('_SCHEDULE')), 'content');
    //add beck url
    cout('<div class="std_block">', 'content');
    //$user_select->setPageTitle($page_title);
    $user_select->addFormInfo(getBackUi($back_url, $lang->def('_BACK'), 'content') . Form::getHidden('next_step', 'next_step', 'sched_setrecipients') . Form::getHidden('is_updating', 'is_updating', 1));
    $user_select->loadSelector(Util::str_replace_once('&', '&amp;', $jump_url), false, true);
    cout('</div>', 'content');
}
 public function sel_usersTask()
 {
     require_once _adm_ . '/lib/lib.directory.php';
     require_once _adm_ . '/class.module/class.directory.php';
     $base_url = 'index.php?r=adm/functionalroles/show';
     //check permissions: we should have mod privileges to assign users to the role group
     if (!$this->permissions['mod']) {
         Util::jump_to($base_url);
     }
     //read inputs
     $id_fncrole = Get::req('id_fncrole', DOTY_INT, -1);
     if ($id_fncrole <= 0) {
         $this->render('invalid', array('message' => $this->_getErrorMessage('invalid fncrole'), 'back_url' => $base_url));
         return;
     }
     //navigation urls
     $back_url = 'index.php?r=adm/functionalroles/man_users&id=' . (int) $id_fncrole;
     $jump_url = 'index.php?r=adm/functionalroles/sel_users&id_fncrole=' . (int) $id_fncrole;
     //competence details
     $info = $this->model->getFunctionalRoleInfo($id_fncrole);
     $name = $this->model->getFunctionalRoleName($id_fncrole);
     //page_title
     $page_title_arr = array($base_url => Lang::t('_FUNCTIONAL_ROLE', 'fncroles'), $back_url => Lang::t('_USERS', 'fncroles') . ': ' . $name, Lang::t('_ASSIGN_USERS', 'fncroles'));
     if (isset($_POST['cancelselector'])) {
         //--- UNDO: return to catalogue list -------------------------------------
         Util::jump_to($back_url);
     } elseif (isset($_POST['okselector'])) {
         //--- SAVE: users selection has been done --------------------------------
         $acl_man = Docebo::user()->getAclManager();
         $user_selector = new UserSelector();
         $selection = $user_selector->getSelection();
         $members_existent = $this->model->getMembers($id_fncrole);
         //retrieve newly selected users
         $_common_members = array_intersect($members_existent, $selection);
         $_new_members = array_diff($selection, $_common_members);
         //new users to add
         $_old_members = array_diff($members_existent, $_common_members);
         //old users to delete
         unset($_common_members);
         //free some memory
         //insert newly selected users in database
         $res1 = $this->model->assignMembers($id_fncrole, $_new_members);
         $res2 = $this->model->deleteMembers($id_fncrole, $_old_members);
         // apply enroll rules
         $enrollrules = new EnrollrulesAlms();
         $enrollrules->applyRulesMultiLang('_LOG_USERS_TO_FNCROLE', $_new_members, false, $id_fncrole);
         //go back to main page, with result message
         Util::jump_to($back_url . '&res=' . ($res1 && $res2 ? 'ok_users' : 'err_users'));
     } else {
         //--- USER SELECTION IS IN PROGRESS: show selector -----------------------
         $user_selector = new UserSelector();
         $user_selector->show_user_selector = TRUE;
         $user_selector->show_group_selector = TRUE;
         $user_selector->show_orgchart_selector = TRUE;
         $user_selector->show_fncrole_selector = FALSE;
         //we can't assign functional roles to other functional roles ...
         //there should be a "role selector" too ...
         //$user_select->show_orgchart_simple_selector = TRUE;
         //filter selectable user by sub-admin permission
         $acl_man = Docebo::user()->getAclManager();
         $user_selector->setUserFilter('exclude', array($acl_man->getAnonymousId()));
         if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
             require_once _base_ . '/lib/lib.preference.php';
             $adminManager = new AdminPreference();
             $admin_tree = $adminManager->getAdminTree(Docebo::user()->getIdST());
             $admin_users = $acl_man->getAllUsersFromIdst($admin_tree);
             $user_selector->setUserFilter('user', $admin_users);
             $user_selector->setUserFilter('group', $admin_tree);
         }
         if (Get::req('is_updating', DOTY_INT, false)) {
             //...
         } else {
             //set initial selection
             $selection = $this->model->getMembers($id_fncrole);
             $user_selector->requested_tab = PEOPLEVIEW_TAB;
             $user_selector->resetSelection($selection);
         }
         $user_selector->addFormInfo(Form::getHidden('is_updating', 'is_updating', 1) . Form::getHidden('id_fncrole', 'id_fncrole', $id_fncrole));
         //draw selector
         $user_selector->loadSelector(Util::str_replace_once('&', '&amp;', $jump_url), $page_title_arr, Lang::t('_ASSIGN_USERS_TO_FNCROLE', 'fncroles'), true);
     }
 }
Пример #13
0
function modtestgui($object_test)
{
    checkPerm('view', false, 'storage');
    $lang =& DoceboLanguage::createInstance('test');
    YuiLib::load('table');
    Util::get_js(_folder_lms_ . '/modules/quest_bank/ajax.quest_bank.js', true, true);
    // ----------------------------------------------------------------------------------------
    if (!is_a($object_test, 'Learning_Test')) {
        $_SESSION['last_error'] = $lang->def('_OPERATION_FAILURE');
        Util::jump_to('' . $object_test->back_url . '&amp;create_result=0');
    }
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $url_encode = htmlentities(urlencode($object_test->back_url));
    list($test_title) = sql_fetch_row(sql_query("\r\n\tSELECT title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_test \r\n\tWHERE idTest = '" . $object_test->getId() . "'"));
    $re_quest = sql_query("\r\n\tSELECT idQuest, type_quest, title_quest, sequence, page \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\tWHERE idTest = '" . $object_test->getId() . "'\r\n\tORDER BY sequence");
    $num_quest = mysql_num_rows($re_quest);
    list($num_page) = sql_fetch_row(sql_query("\r\n\tSELECT MAX(page) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\tWHERE idTest = '" . $object_test->getId() . "'"));
    $num_page = (int) $num_page;
    $GLOBALS['page']->add(getTitleArea($lang->def('_TEST_SECTION'), 'test') . '<div class="std_block yui-skin-docebo yui-skin-sam">' . getBackUi(Util::str_replace_once('&', '&amp;', $object_test->back_url), $lang->def('_BACK')), 'content');
    if (isset($_GET['mod_operation'])) {
        if ($_GET['mod_operation']) {
            $GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')), 'content');
        } else {
            $GLOBALS['page']->add(getResultUi($lang->def('_QUEST_ERR_MODIFY')), 'content');
        }
    }
    //other areas
    $GLOBALS['page']->add('<b>' . $lang->def('_TITLE') . ' :</b> ' . '<a href="index.php?modname=test&amp;op=modtest&amp;idTest=' . $object_test->getId() . '&amp;back_url=' . $url_encode . '"' . ' class="ico-wt-sprite subs_mod" title="' . $lang->def('_MOD_TITLE', 'standard') . '"><span>' . $test_title . '</span></a><br /><br />', 'content');
    $GLOBALS['page']->add('<ul class="link_list_inline">
		<li>' . '<a href="index.php?modname=test&amp;op=defmodality&amp;idTest=' . $object_test->getId() . '&amp;back_url=' . $url_encode . '" title="' . $lang->def('_TEST_MODALITY') . '">' . $lang->def('_TEST_MODALITY') . '</a>' . '</li>
		<li>' . '<a href="index.php?modname=test&amp;op=deftime&amp;idTest=' . $object_test->getId() . '&amp;back_url=' . $url_encode . '" title="' . $lang->def('_TEST_COMPILE_TIME') . '">' . $lang->def('_TEST_COMPILE_TIME') . '</a>' . '</li>
		<li>' . '<a href="index.php?modname=test&amp;op=defpoint&amp;idTest=' . $object_test->getId() . '&amp;back_url=' . $url_encode . '" title="' . $lang->def('_TEST_POINT_ASSIGNEMENT') . '">' . $lang->def('_TEST_POINT_ASSIGNEMENT') . '</a>' . '</li>
		<li>' . '<a href="index.php?modname=test&amp;op=feedbackman&amp;idTest=' . $object_test->getId() . '&amp;back_url=' . $url_encode . '" title="' . $lang->def('_FEEDBACK_MANAGEMENT') . '">' . $lang->def('_FEEDBACK_MANAGEMENT') . '</a>' . '</li>
	</ul>', 'content');
    $caption = str_replace('%tot_page%', $num_page, str_replace('%tot_element%', $num_quest, $lang->def('_TEST_CAPTION')));
    $tab = new Table(0, $caption, $lang->def('_TEST_SUMMARY'));
    $tab->setColsStyle(array('image', 'image', '', 'image', 'image', 'image', 'image', 'image'));
    $tab->addHead(array($lang->def('_QUEST'), $lang->def('_TYPE'), $lang->def('_QUESTION'), $lang->def('_TEST_QUEST_ORDER'), '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" longdesc="' . $lang->def('_MOVE_DOWN') . '" />', '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" longdesc="' . $lang->def('_MOVE_UP') . '" />', '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />'));
    $i = 0;
    $correct_sequence = 1;
    $seq_error_detected = false;
    $quest_num = 1;
    $title_num = 1;
    $last_type = '';
    $uri_back = '&amp;back_url=' . $url_encode;
    while (list($id_quest, $type, $title, $sequence, $page) = sql_fetch_row($re_quest)) {
        $last_type = $type;
        $content = array($type != 'break_page' && $type != 'title' ? '<span class="text_bold">' . $quest_num++ . '</span>' : '', $lang->def('_QUEST_ACRN_' . strtoupper($type)), $title, $sequence, $i != $num_quest - 1 ? '<a href="index.php?modname=test&amp;op=movedown&amp;idQuest=' . $id_quest . $uri_back . '" title="' . $lang->def('_MOVE_DOWN') . '">' . '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . ' : ' . $lang->def('_ROW') . ' ' . ($i + 1) . '" /></a>' : '', $i != 0 ? '<a href="index.php?modname=test&amp;op=moveup&amp;idQuest=' . $id_quest . $uri_back . '" title="' . $lang->def('_MOVE_UP') . '">' . '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . ' : ' . $lang->def('_ROW') . ' ' . ($i + 1) . '" /></a>' : '', $type != 'break_page' ? '<a href="index.php?modname=test&amp;op=modquest&amp;idQuest=' . $id_quest . $uri_back . '" title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $lang->def('_ROW') . ' ' . ($i + 1) . '" /></a>' : '', '<a href="index.php?modname=test&amp;op=delquest&amp;idQuest=' . $id_quest . $uri_back . '" title="' . $lang->def('_DEL') . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $lang->def('_ROW') . ' ' . ($i + 1) . '" /></a>');
        $tab->addBody($content);
        if ($sequence != $correct_sequence) {
            $seq_error_detected = true;
        }
        $correct_sequence++;
        ++$i;
    }
    //------------------------------------------------------------------
    $move_quest = "";
    if ($num_quest > 1) {
        $move_quest = '<form class="align_right" method="post" action="index.php?modname=test&amp;op=movequest">' . '<div>' . '<input type="hidden" id="authentic_request_test" name="authentic_request" value="' . Util::getSignature() . '" />' . '<input type="hidden" name="back_url" value="' . $url_encode . '" />' . '<input type="hidden" name="idTest" value="' . $object_test->getId() . '" />';
        $move_quest .= '<label class="text_bold" for="source_quest">' . $lang->def('_MOVE') . '</label>&nbsp;' . '<select id="source_quest" name="source_quest">';
        for ($opt = 1; $opt <= $i; $opt++) {
            $move_quest .= '<option value="' . $opt . '"' . ($opt == 1 ? ' selected="selected"' : '') . '>' . $lang->def('_TEST_MOVEQUEST') . ' ' . $opt . '</option>';
        }
        $move_quest .= '</select>';
        $move_quest .= '<label class="text_bold" for="dest_quest"> ' . $lang->def('_TO') . '</label>&nbsp;' . '<select id="dest_quest" name="dest_quest">' . '<option value="1" selected="selected">' . $lang->def('_TEST_FIRST_QUEST') . '</option>';
        for ($opt = 1; $opt < $i; $opt++) {
            $move_quest .= '<option value="' . ($opt + 1) . '">' . $lang->def('_TEST_AFTER_QUEST') . ' ' . $opt . '</option>';
        }
        $move_quest .= '<option value="' . ($i + 1) . '">' . $lang->def('_TEST_LAST_QUEST') . '</option>';
        $move_quest .= '</select>';
        $move_quest .= '&nbsp;<input class="button_nowh" type="submit" id="move_quest" name="move_quest" value="' . $lang->def('_MOVE') . '" />' . '</div>' . '</form>';
        //$tab->addActionAdd( $move_quest );
    }
    //------------------------------------------------------------------
    /*	$re_type = sql_query("
    	SELECT type_quest 
    	FROM ".$GLOBALS['prefix_lms']."_quest_type
    	ORDER BY sequence");
    	$add_quest = '<form method="post" action="index.php?modname=test&amp;op=addquest">'
    		.'<div>'
    		.'<input type="hidden" id="authentic_request_test" name="authentic_request" value="'.Util::getSignature().'" />'
    		.'<input type="hidden" name="back_url" value="'.$url_encode.'" />'
    		.'<input type="hidden" name="idTest" value="'.$object_test->getId().'" />';
    	$add_quest .= '<label class="text_bold" for="add_test_quest">'.$lang->def('_TEST_ADDQUEST').'</label>&nbsp;'
    		.'<select id="add_test_quest" name="add_test_quest">';
    	while(list($type_quest) = sql_fetch_row($re_type)) {
    		$add_quest .= '<option value="'.$type_quest.'"'
    		.( $last_type == $type_quest ? ' selected="selected"' : '' ).'>'
    		.$lang->def('_QUEST_ACRN_'.strtoupper($type_quest)).' - '.$lang->def('_QUEST_'.strtoupper($type_quest)).'</option>';
    	}
    	$add_quest .= '</select>';
    	$add_quest .= '&nbsp;<input class="button_nowh" type="submit" name="add_quest" value="'.$lang->def('_ADD').'" />'
    		.'</div>'
    		.'</form>';*/
    $re_type = sql_query("\r\n\tSELECT type_quest \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_quest_type\r\n\tORDER BY sequence");
    $add_quest = '<form method="post" action="index.php?modname=test&amp;op=addquest">' . '<input type="hidden" id="authentic_request_test" name="authentic_request" value="' . Util::getSignature() . '" />' . '<input type="hidden" name="back_url" value="' . $url_encode . '" />' . '<input type="hidden" name="idTest" value="' . $object_test->getId() . '" />' . '<input type="submit" id="add_quest" name="add_quest" value="' . $lang->def('_TEST_ADDQUEST') . '">
		<select id="add_test_quest" name="add_test_quest">';
    while (list($type_quest) = sql_fetch_row($re_type)) {
        $add_quest .= '<option value="' . $type_quest . '">' . $lang->def('_QUEST_ACRN_' . strtoupper($type_quest)) . ' - ' . $lang->def('_QUEST_' . strtoupper($type_quest)) . '</option>';
    }
    $add_quest .= '</select>' . '</form>';
    //------------------------------------------------------------------
    //$tab->addActionAdd( $add_quest, '' );
    $GLOBALS['page']->add($tab->getTable() . '<div class="table-container-below">' . $move_quest . '</div>' . $add_quest . getBackUi(Util::str_replace_once('&', '&amp;', $object_test->back_url), $lang->def('_BACK')), 'content');
    /*
    $GLOBALS['page']->add(
    	Form::openForm('add_question', 'index.php?modname=test&amp;op=importquest', false, false, 'multipart/form-data')
    	
    	.Form::openElementSpace()
    	.Form::getOpenFieldset($lang->def('_IMPORT_FROM_XML'))
    	.Form::getHidden('back_url', 'back_url', $url_encode)
    	.Form::getHidden('idTest', 'idTest', $object_test->getId())
    	.Form::getFilefield($lang->def('_FILE'), 'xml_file', 'xml_file')
    	.Form::getCloseFieldset()
    	.Form::closeElementSpace()
    	
    	.Form::openButtonSpace()
    	.form::getButton('import', 'import', $lang->def('_IMPORT'))
    	.Form::closeButtonSpace()
    	
    	.Form::closeForm()
    , 'content');
    */
    if ($seq_error_detected) {
        $GLOBALS['page']->add(' <a href="index.php?modname=test&amp;op=fixsequence&amp;idTest=' . $object_test->getId() . $uri_back . '" title="' . $lang->def('_FIX_SEQUENCE') . '">' . $lang->def('_FIX_SEQUENCE') . '</a>', 'content');
    }
    require_once $GLOBALS['where_lms'] . '/lib/lib.quest_bank.php';
    $qb_man = new QuestBankMan();
    $supported_format = $qb_man->supported_format();
    $GLOBALS['page']->add('<form method="post" action="index.php?modname=test&amp;op=modtestgui">' . '<input type="hidden" id="authentic_request_test" name="authentic_request" value="' . Util::getSignature() . '" />' . '<input type="hidden" name="back_url" value="' . $url_encode . '" />' . '<input type="hidden" name="idTest" value="' . $object_test->getId() . '" />' . '<div class="align_right">
			<input type="submit" id="export_quest" name="export_quest" value="' . $lang->def('_EXPORT') . '">
			<select id="export_quest_select" name="export_quest_select">', 'content');
    foreach ($supported_format as $id_exp => $def) {
        cout('<option value="' . $id_exp . '">' . $def . '</option>', 'content');
    }
    cout('<option value="5">' . Lang::t('_QUEST_BANK', 'menu_course') . '</option>', 'content');
    cout('</select>' . Form::getButton('import_quest', 'import_quest', $lang->def('_IMPORT')) . '</div>' . '</form>', 'content');
    $GLOBALS['page']->add('
	<script type="text/javascript">
	YAHOO.util.Event.addListener(window, "load", function() {
		var oSplitExport = new YAHOO.widget.Button("export_quest", { type: "menu", menu: "export_quest_select" });
		//var oPushImport = new YAHOO.widget.Button("import_quest");
		var oMoveQuest = new YAHOO.widget.Button("move_quest");
		var oSplitAddQuest = new YAHOO.widget.Button("add_quest", { type: "menu", menu: "add_test_quest" });
	});
	</script>', 'content');
    $GLOBALS['page']->add('</div>', 'content');
    //fixPageSequence($object_test->getId());
}
Пример #14
0
 /**
  * function edit()
  *
  * @param $back_url	the url where the function retutn at the end of the operation
  * @return nothing
  */
 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'])) {
         //modify question
         if (substr_count($_POST['title_quest'], '[answer]') != 1) {
             errorCommunication($lang->def('_OPERATION_FAILURE') . getBackUi('index.php?modname=question&amp;op=create&amp;type_quest=' . $this->getQuestionType() . '&amp;idQuest=' . $this->id . '&amp;back_test=' . $url_encode, $lang->def('_BACK')));
         }
         $mod_query = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\t\tSET idCategory = '" . $_POST['idCategory'] . "', \r\n\t\t\t\ttype_quest = '" . $this->getQuestionType() . "', \r\n\t\t\t\ttitle_quest = '" . $_POST['title_quest'] . "', \r\n\t\t\t\tdifficult = '" . $_POST['difficult'] . "',\r\n\t\t\t\ttime_assigned = '" . $_POST['time_assigned'] . "'\r\n\t\t\tWHERE idQuest = '" . (int) $this->id . "'";
         if (!sql_query($mod_query)) {
             errorCommunication($lang->def('_TEST_ERR_MOD_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')));
         }
         //modify answer
         $mod_answer_query = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\t\tSET answer = '" . strtolower($_POST['answer']) . "',\r\n\t\t\t\tcomment = '" . $_POST['comment'] . "',\r\n\t\t\t\tscore_correct = '" . $this->_checkScore($_POST['score_correct']) . "', \r\n\t\t\t\tscore_incorrect = '" . $this->_checkScore($_POST['score_incorrect']) . "'\r\n\t\t\tWHERE idQuest = '" . (int) $this->id . "'";
         if (!sql_query($mod_answer_query)) {
             errorCommunication($lang->def('_OPERATION_FAILURE') . getBackUi(Util::str_replace_once('&', '&amp;', $back_test), $lang->def('_BACK')));
         }
         //back to quest list
         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'));
     //load data
     list($cat_sel, $title_quest, $diff_sel, $sel_time) = sql_fetch_row(sql_query("\r\n\t\tSELECT idCategory, title_quest, difficult, time_assigned\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\tWHERE idQuest = '" . (int) $this->id . "'"));
     list($answer, $comment, $score_correct, $score_incorrect) = sql_fetch_row(sql_query("\r\n\t\tSELECT answer, comment, score_correct, score_incorrect \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\tWHERE idQuest = '" . (int) $this->id . "'"));
     //drawing form
     $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')) . '<div class="nofloat"></div><br />' . '<table class="test_answer"  summary="' . $lang->def('_TEST_ANSWER') . '">' . "\n" . '<caption>' . $lang->def('_TEST_ANSWER') . '</caption>' . "\n" . '<tr>' . "\n" . '<th class="image">' . $lang->def('_TEST_CORRECT') . '</th>' . '<th><label for="answer">' . $lang->def('_TEST_TEXT_ANSWER') . '</label></th>' . '<th><label for="comment">' . $lang->def('_COMMENTS') . '</label></th>' . '<th colspan="2">' . $lang->def('_SCORE') . '</th>' . '</tr>' . "\n" . '<tr class="line_answer">' . "\n" . '<td rowspan="2" class="align_center">' . '<img src="' . getPathImage() . 'test/correct.gif" alt="' . $lang->def('_TEST_ISCORRECT') . '" />' . '</td>' . '<td rowspan="2">' . '<input type="text" class="test_text_anwer" id="answer" name="answer" alt="' . $lang->def('_TEST_TEXT_ANSWER') . '" maxlength="255" value="' . $answer . '" />' . '</td>' . '<td rowspan="2" class="image">' . '<textarea class="test_comment" id="comment" name="comment" cols="14" rows="3">' . $comment . '</textarea>' . '</td>' . '<td class="test_ifcorrect">' . '<label for="score_correct">' . $lang->def('_TEST_IFCORRECT') . '</label>' . '</td>' . '<td class="align_right">' . '<input type="text" class="test_point" id="score_correct" name="score_correct" alt="' . $lang->def('_TEST_IFCORRECT') . '" size="5" value="' . $score_correct . '" />' . '</td>' . '</tr>' . "\n" . '<tr class="line_answer">' . "\n" . '<td class="test_ifcorrect">' . '<label for="score_incorrect">' . $lang->def('_TEST_IFINCORRECT') . '</label>' . '</td>' . '<td class="align_right">' . '- <input type="text" class="test_point" id="score_incorrect" name="score_incorrect" alt="' . $lang->def('_TEST_IFINCORRECT') . '" size="5"  value="' . $score_incorrect . '" />' . '</td>' . '</tr>' . "\n" . '</table>' . "\n" . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('add_question', 'add_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
Пример #15
0
 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');
 }
Пример #16
0
function review($object_test, $id_param)
{
    $lang =& DoceboLanguage::createInstance('test');
    require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
    require_once $GLOBALS['where_lms'] . '/class.module/track.test.php';
    $idTest = $object_test->getId();
    $idTrack = importVar('idTrack', true, 0);
    $idReference = getLOParam($id_param, 'idReference');
    //test info---------------------------------------------------------
    list($title, $show_solution, $question_random_number, $order_type) = sql_fetch_row(sql_query("\r\n\tSELECT  title, show_solution, question_random_number, order_type\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_test \r\n\tWHERE idTest = '" . (int) $idTest . "'"));
    list($score, $bonus_score, $date_attempt, $date_attempt_mod) = sql_fetch_row(sql_query("\r\n\tSELECT score, bonus_score, date_attempt, date_attempt_mod \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_testtrack \r\n\tWHERE idTrack = '" . (int) $idTrack . "'"));
    //questions------------------------------------------------------
    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) $idTrack . "' ");
        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  \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest AS q JOIN " . $GLOBALS['prefix_lms'] . "_quest_type AS t \r\n\t\tWHERE q.idTest = '" . $idTest . "' AND q.type_quest = t.type_quest AND q.idQuest IN (" . implode($quest_see, ',') . ") \r\n\t\t\t AND q.type_quest <> 'break_page' AND q.type_quest <> 'title' \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 \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest AS q JOIN " . $GLOBALS['prefix_lms'] . "_quest_type AS t \r\n\t\tWHERE q.idTest = '" . $idTest . "' AND q.type_quest = t.type_quest \r\n\t\t\t AND q.type_quest <> 'break_page' \r\n\t\tORDER BY q.sequence";
    }
    $reQuest = sql_query($query_question);
    //display-----------------------------------------------------------
    $GLOBALS['page']->add('<div class="std_block">' . '<div class="test_title_play">' . $lang->def('_TITLE') . ' : ' . $title . '</div>' . getBackUi(Util::str_replace_once('&', '&amp;', $object_test->back_url), $lang->def('_BACK')) . '<br />', 'content');
    //page display---------------------------------------------------
    $GLOBALS['page']->add('<div class="test_answer_space">', 'content');
    $quest_sequence_number = 1;
    while (list($idQuest, $type_quest, $type_file, $type_class) = sql_fetch_row($reQuest)) {
        require_once $GLOBALS['where_lms'] . '/modules/question/' . $type_file;
        $quest_obj = eval("return new {$type_class}( {$idQuest} );");
        $review = $quest_obj->displayUserResult($idTrack, $type_quest != 'title' ? $quest_sequence_number++ : $quest_sequence_number, $show_solution);
        $GLOBALS['page']->add('<div class="test_quest_review_container">' . $review['quest'], 'content');
        if ($review['score'] !== false) {
            $GLOBALS['page']->add('<div class="test_answer_comment">' . '<div class="test_score_note">' . $lang->def('_SCORE') . ' : ', 'content');
            if ($quest_obj->getScoreSetType() == 'manual' && !$review['manual_assigned']) {
                $GLOBALS['page']->add($lang->def('_NOT_ASSIGNED'), 'content');
            } else {
                if ($review['score'] > 0) {
                    $GLOBALS['page']->add('<span class="test_score_positive">' . $review['score'] . '</span>', 'content');
                } else {
                    $GLOBALS['page']->add('<span class="test_score_negative">' . $review['score'] . '</span>', 'content');
                }
            }
            $GLOBALS['page']->add('</div>' . ($review['comment'] != '' ? $review['comment'] : '') . '</div>', 'content');
        }
        $GLOBALS['page']->add('</div>', 'content');
    }
    $GLOBALS['page']->add('</div>', 'content');
    $GLOBALS['page']->add(getBackUi(Util::str_replace_once('&', '&amp;', $object_test->back_url), $lang->def('_BACK')) . '</div>', 'content');
}
Пример #17
0
 /**
  * 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
     $num_answer = importVar('num_answer', true, 2);
     if (isset($_POST['more_answer'])) {
         ++$num_answer;
     }
     if (isset($_POST['less_answer']) && $num_answer > 1) {
         --$num_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;
         }
         //find saved answer
         $re_answer = sql_query("\r\n\t\t\tSELECT id_answer\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquestanswer \r\n\t\t\tWHERE id_quest = '" . (int) $this->id . "'");
         while (list($id_a) = sql_fetch_row($re_answer)) {
             $existent_answer[$id_a] = 1;
         }
         for ($i = 0; $i < $num_answer; $i++) {
             //scannig answer
             if (isset($_POST['answer_id'][$i])) {
                 //must update
                 $id_answer = $_POST['answer_id'][$i];
                 if (isset($existent_answer[$id_answer])) {
                     unset($existent_answer[$id_answer]);
                 }
                 $upd_ans_query = "\r\n\t\t\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_pollquestanswer \r\n\t\t\t\t\tSET answer = '" . $_POST['answer'][$i] . "'\r\n\t\t\t\t\tWHERE id_answer = '" . (int) $id_answer . "'";
                 if (!sql_query($upd_ans_query)) {
                     getErrorUi($lang->def('_POLL_ERR_INS_ANSWER') . getBackUi(Util::str_replace_once('&', '&amp;', $back_poll), $lang->def('_BACK')));
                 }
             } else {
                 //insert new answer
                 $ins_answer_query = "\r\n\t\t\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_pollquestanswer \r\n\t\t\t\t\t( id_quest, answer, sequence ) VALUES\r\n\t\t\t\t\t( \t'" . $this->id . "', \r\n\t\t\t\t\t\t'" . $_POST['answer'][$i] . "',\r\n\t\t\t\t\t\t'" . $i . "' ) ";
                 if (!sql_query($ins_answer_query)) {
                     getErrorUi($lang->def('_POLL_ERR_INS_ANSWER') . getBackUi(Util::str_replace_once('&', '&amp;', $back_poll), $lang->def('_BACK')));
                 }
             }
         }
         while (list($idA) = each($existent_answer)) {
             //i must delete these answer
             $del_answer_query = "\r\n\t\t\t\tDELETE FROM " . $GLOBALS['prefix_lms'] . "_pollquestanswer\r\n\t\t\t\tWHERE id_quest = '" . (int) $this->id . "' AND id_answer = '" . (int) $idA . "'";
             if (!sql_query($del_answer_query)) {
                 getErrorUi($lang->def('_POLL_ERR_INS_ANSWER') . getBackUi(Util::str_replace_once('&', '&amp;', $back_poll), $lang->def('_BACK')));
             }
         }
         //back to question list
         Util::jump_to('' . $back_poll);
     }
     //insert form
     require_once $GLOBALS['where_lms'] . '/lib/lib.questcategory.php';
     $categories = Questcategory::getCategory();
     //writing difficult
     //load data
     if (!isset($_POST['answer_id'])) {
         list($sel_cat, $quest) = sql_fetch_row(sql_query("\r\n\t\t\tSELECT id_category, title_quest \r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\t\t\tWHERE id_quest = '" . (int) $this->id . "'"));
         $re_answer = sql_query("\r\n\t\t\tSELECT id_answer, answer \r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquestanswer \r\n\t\t\tWHERE id_quest = '" . (int) $this->id . "'\r\n\t\t\tORDER BY sequence");
         $i_load = 0;
         while (list($_POST['answer_id'][$i_load], $_POST['answer'][$i_load]) = sql_fetch_row($re_answer)) {
             ++$i_load;
         }
         $num_answer = $i_load;
     }
     $GLOBALS['page']->add(getTitleArea($lang->def('_POLL_SECTION'), 'poll') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&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::getHidden('num_answer', 'num_answer', $num_answer) . 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="nofloat"></div><br />', 'content');
     $GLOBALS['page']->add('<table class="test_answer" cellspacing="0" summary="' . $lang->def('_POLL_ANSWER_SUMMARY') . '">' . "\n" . '<caption>' . $lang->def('_ANSWER') . '</caption>' . "\n" . '<tr>' . '<th>' . $lang->def('_ANSWER') . '</th>' . '</tr>' . "\n", 'content');
     for ($i = 0; $i < $num_answer; $i++) {
         $this->_lineModAnswer($i);
     }
     $GLOBALS['page']->add('</table>' . Form::getButton('more_answer', 'more_answer', $lang->def('_POLL_ADD_ONE_ANSWER'), 'button_nowh'), 'content');
     if ($num_answer > 1) {
         $GLOBALS['page']->add(Form::getButton('less_answer', 'less_answer', $lang->def('_POLL_SUB_ONE_ANSWER'), 'button_nowh'), 'content');
     }
     $GLOBALS['page']->add(Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save_question', 'save_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
Пример #18
0
 function getAdminMenu()
 {
     $html = '';
     foreach ($this->platform as $platform_code => $pl_info) {
         if ($GLOBALS['where_' . $platform_code] !== false && $pl_info['is_active'] == 'true') {
             require_once $GLOBALS['where_' . $platform_code] . '/class/' . $pl_info['class_file_menu'];
             $menu = eval(" return new " . $pl_info['class_name_menu'] . "( \$GLOBALS['current_user']); ");
             $main_voice = $menu->getLevelOne();
             if (!isset($_SESSION['current_admin_id_menu'])) {
                 $_SESSION['current_admin_id_menu'] = key($main_voice);
             }
             foreach ($main_voice as $id_m => $voice) {
                 $html .= '<li ' . ($_SESSION['current_admin_id_menu'] == $id_m && $_SESSION['current_action_platform'] == $platform_code ? ' class="active"' : '') . '>' . '<a href="' . Util::str_replace_once('&', '&amp;', $voice['link'] . '">' . $voice['name']) . '</a></li>';
             }
         }
     }
     return $html;
 }
Пример #19
0
function kses_normalize_entities($string)
{
    # Disarm all entities by converting & to &amp;
    $string = Util::str_replace_once('&', '&amp;', $string);
    # Change back the allowed entities in our entity whitelist
    $string = preg_replace('/&amp;([A-Za-z][A-Za-z0-9]{0,19});/', '&\\1;', $string);
    $string = preg_replace('/&amp;#0*([0-9]{1,5});/e', 'kses_normalize_entities2("\\1")', $string);
    $string = preg_replace('/&amp;#([Xx])0*(([0-9A-Fa-f]{2}){1,2});/', '&#\\1\\2;', $string);
    return $string;
}
Пример #20
0
 /**
  * this function modify a question
  * 
  * @param  string	$back_test	indicates the return url
  * @return nothing
  * 
  * @access public
  * @author Fabio Pirovano (fabio@docebo.com)
  */
 function edit($back_test)
 {
     $lang =& DoceboLanguage::createInstance('test');
     require_once _base_ . '/lib/lib.form.php';
     $url_encode = htmlentities(urlencode($back_test));
     //manage number of answer
     $num_answer = importVar('num_answer', true, 2);
     if (isset($_POST['more_answer'])) {
         ++$num_answer;
     }
     if (isset($_POST['less_answer']) && $num_answer > 1) {
         --$num_answer;
     }
     if (isset($_POST['add_question'])) {
         //update question
         $ins_query = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquest\r\n\t\t\tSET idCategory = '" . (int) $_POST['idCategory'] . "', \r\n\t\t\t\ttype_quest = '" . $this->getQuestionType() . "', \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\t\tshuffle = '" . (isset($_POST['shuffle']) ? 1 : 0) . "'\r\n\t\t\tWHERE idQuest = '" . (int) $this->id . "'";
         if (!sql_query($ins_query)) {
             $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE') . 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'))), 'content');
         }
         //update answer
         if (!isset($_POST['is_correct'])) {
             $_POST['is_correct'] = -1;
         }
         //find saved answer
         $re_answer = sql_query("\r\n\t\t\tSELECT idAnswer \r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\t\tWHERE idQuest = '" . (int) $this->id . "'");
         while (list($id_a) = sql_fetch_row($re_answer)) {
             $existent_answer[$id_a] = 1;
         }
         for ($i = 0; $i < $num_answer; $i++) {
             //scannig answer
             if (isset($_POST['answer_id'][$i])) {
                 //must update
                 $idAnswer = $_POST['answer_id'][$i];
                 if (isset($existent_answer[$idAnswer])) {
                     unset($existent_answer[$idAnswer]);
                 }
                 $upd_ans_query = "\r\n\t\t\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\t\t\t\tSET is_correct = '" . (isset($_POST['is_correct'][$i]) ? 1 : 0) . "',\r\n\t\t\t\t\t\tanswer = '" . $_POST['answer'][$i] . "',\r\n\t\t\t\t\t\tcomment = '" . $_POST['comment'][$i] . "',\r\n\t\t\t\t\t\tscore_correct = '" . $this->_checkScore($_POST['score_correct'][$i]) . "', \r\n\t\t\t\t\t\tscore_incorrect = '" . $this->_checkScore($_POST['score_incorrect'][$i]) . "'\r\n\t\t\t\t\tWHERE idAnswer = '" . (int) $idAnswer . "'";
                 if (!sql_query($upd_ans_query)) {
                     $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE') . getBackUi(Util::str_replace_once('&', '&amp;', $back_test), $lang->def('_BACK'))), 'content');
                 }
             } else {
                 //insert new answer
                 $ins_answer_query = "\r\n\t\t\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\t\t\t\t( idQuest, is_correct, \r\n\t\t\t\t\t\tanswer, comment,\r\n\t\t\t\t\t\tscore_correct, score_incorrect ) VALUES\r\n\t\t\t\t\t( '" . $this->id . "', '" . (isset($_POST['is_correct'][$i]) ? 1 : 0) . "', \r\n\t\t\t\t\t\t'" . $_POST['answer'][$i] . "', '" . $_POST['comment'][$i] . "', \r\n\t\t\t\t\t\t'" . $this->_checkScore($_POST['score_correct'][$i]) . "', \r\n\t\t\t\t\t\t'" . $this->_checkScore($_POST['score_incorrect'][$i]) . "') ";
                 if (!sql_query($ins_answer_query)) {
                     $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE') . getBackUi(Util::str_replace_once('&', '&amp;', $back_test), $lang->def('_BACK'))), 'content');
                 }
             }
         }
         while (list($idA) = each($existent_answer)) {
             //i must delete these answer
             $del_answer_query = "\r\n\t\t\t\tDELETE FROM " . $GLOBALS['prefix_lms'] . "_testquestanswer\r\n\t\t\t\tWHERE idQuest = '" . (int) $this->id . "' AND idAnswer = '" . (int) $idA . "'";
             if (!sql_query($del_answer_query)) {
                 $GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE') . getBackUi(Util::str_replace_once('&', '&amp;', $back_test), $lang->def('_BACK'))), 'content');
             }
         }
         //back to question list
         Util::jump_to('' . $back_test);
     }
     require_once $GLOBALS['where_lms'] . '/lib/lib.questcategory.php';
     $categories = Questcategory::getCategory();
     //writing difficult array
     $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'));
     //load data
     if (!isset($_POST['answer_id'])) {
         list($sel_cat, $quest, $sel_diff, $sel_time, $shuffle) = sql_fetch_row(sql_query("\r\n\t\t\tSELECT idCategory, title_quest, difficult, time_assigned, shuffle \r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\t\tWHERE idQuest = '" . (int) $this->id . "'"));
         $re_answer = sql_query("\r\n\t\t\tSELECT idAnswer, is_correct, answer, comment, score_correct, score_incorrect \r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\t\tWHERE idQuest = '" . (int) $this->id . "'\r\n\t\t\tORDER BY idAnswer");
         $i_load = 0;
         while (list($_POST['answer_id'][$i_load], $is_correct, $_POST['answer'][$i_load], $_POST['comment'][$i_load], $_POST['score_correct'][$i_load], $_POST['score_incorrect'][$i_load]) = sql_fetch_row($re_answer)) {
             if ($is_correct) {
                 $_POST['is_correct'][$i_load] = 1;
             }
             ++$i_load;
         }
         $num_answer = $i_load;
     }
     $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_add_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::getHidden('num_answer', 'num_answer', $num_answer) . Form::getTextarea($lang->def('_QUESTION'), 'title_quest', 'title_quest', isset($_POST['title_quest']) ? stripslashes($_POST['title_quest']) : $quest), 'content');
     if (count($categories) > 1) {
         $GLOBALS['page']->add(Form::getDropdown($lang->def('_TEST_QUEST_CATEGORY'), 'idCategory', 'idCategory', $categories, isset($_POST['idCategory']) ? $_POST['idCategory'] : $sel_cat), 'content');
     }
     $GLOBALS['page']->add(Form::getDropdown($lang->def('_DIFFICULTY'), 'difficult', 'difficult', $arr_dufficult, isset($_POST['difficult']) ? $_POST['difficult'] : $sel_diff) . Form::getCheckbox($lang->def('_TEST_QUEST_SHUFFLE'), 'shuffle', 'shuffle', '1', $shuffle) . 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')) . '<div class="nofloat"></div><br />' . '<table class="test_answer" cellspacing="0" summary="' . $lang->def('_TEST_ANSWER') . '">' . "\n" . '<caption>' . $lang->def('_TEST_ANSWER') . '</caption>' . "\n" . '<tr>' . '<th class="image">' . $lang->def('_TEST_CORRECT') . '</th>' . '<th>' . $lang->def('_TEST_TEXT_ANSWER') . '</th>' . '<th>' . $lang->def('_COMMENTS') . '</th>' . '<th colspan="2">' . $lang->def('_SCORE') . '</th>' . '</tr>' . "\n", 'content');
     for ($i = 0; $i < $num_answer; $i++) {
         $this->_lineModAnswer($i);
     }
     $GLOBALS['page']->add('</table>' . Form::getButton('more_answer', 'more_answer', $lang->def('_TEST_ADD_ONE_ANSWER'), 'button_nowh'), 'content');
     if ($num_answer > 1) {
         $GLOBALS['page']->add(Form::getButton('less_answer', 'less_answer', $lang->def('_TEST_SUB_ONE_ANSWER'), 'button_nowh'), 'content');
     }
     $GLOBALS['page']->add('' . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('add_question', 'add_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
 }
 public function assignmembers()
 {
     $id = Get::req('id_group', DOTY_INT, -1);
     $base_url = 'index.php?r=adm/groupmanagement/';
     $back_url = $base_url . 'show_users&id=' . (int) $id;
     $jump_url = $base_url . 'assignmembers';
     $next_url = $base_url . 'show_users&id=' . (int) $id;
     //check permissions: we should have add privileges to create groups
     if (!$this->permissions['associate_user']) {
         Util::jump_to($back_url);
     }
     if ($id > 0) {
         $acl = Docebo::user()->getAclManager();
         $selector = new UserSelector();
         $cancel = Get::req('cancelselector', DOTY_MIXED, false);
         $save = Get::req('okselector', DOTY_MIXED, false);
         if ($cancel) {
             Util::jump_to($back_url);
         } elseif ($save) {
             $selection = $selector->getSelection($_POST);
             $res = $this->model->saveGroupMembers($id, $selection);
             // apply rules
             $enrollrules = new EnrollrulesAlms();
             $enrollrules->applyRulesMultiLang('_LOG_USERS_TO_GROUP', $selection, false, $id);
             Util::jump_to($next_url . ($res ? '&res=ok_assignuser' : '&res=err_assignuser'));
         } else {
             $selector->show_user_selector = TRUE;
             $selector->show_group_selector = TRUE;
             $selector->show_orgchart_selector = TRUE;
             $selector->show_fncrole_selector = FALSE;
             $group = $this->model->getGroupInfo($id, true);
             if (Get::req('is_updating', DOTY_INT, false)) {
             } else {
                 $members = $this->model->getGroupMembers($id);
                 $selector->requested_tab = PEOPLEVIEW_TAB;
                 $selector->resetSelection($members);
             }
             $selector->addFormInfo(Form::getHidden('is_updating', 'is_updating', 1) . Form::getHidden('id_group', 'id_group', $id));
             $sel_title = array('index.php?r=adm/groupmanagement/show' => Lang::t('_GROUPS', 'admin_directory'), 'index.php?r=adm/groupmanagement/show_users&amp;id=' . $id => Lang::t('_ASSIGN_USERS', 'admin_directory') . ': ' . Docebo::aclm()->relativeId($group->groupid), Lang::t('_ADD', 'admin_directory'));
             $selector->loadSelector(Util::str_replace_once('&', '&amp;', $jump_url), $sel_title, '', true);
         }
     } else {
     }
 }
Пример #22
0
function showResult($object_poll, $id_param)
{
    //-kb-play-// if(!checkPerm('view', true, 'organization') && !checkPerm('view', true, 'storage')) die("You can't access");
    require_once _base_ . '/lib/lib.form.php';
    require_once $GLOBALS['where_lms'] . '/class.module/track.poll.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.poll.php';
    $lang =& DoceboLanguage::createInstance('poll');
    $id_poll = $object_poll->getId();
    $id_reference = getLoParam($id_param, 'idReference');
    $url_coded = urlencode(serialize($object_poll->back_url));
    $id_track = retriveTrack($id_reference, $id_poll, getLogUserId());
    Track_Poll::createTrack($id_reference, $id_track, getLogUserId(), date('Y-m-d H:i:s'), 'completed', 'poll');
    $poll_man = new PollManagement($id_poll);
    $play_man = new PlayPollManagement($id_poll, getLogUserId(), $id_track, $poll_man);
    $poll_info = $poll_man->getPollAllInfo();
    $track_info = $play_man->getTrackAllInfo();
    $previous_page = importVar('previous_page', false, false);
    if ($id_reference !== false && $id_track != false) {
        if (isset($_POST['page_to_save'])) {
            $play_man->storePage($_POST['page_to_save'], true);
        }
        $now = date('Y-m-d H:i:s');
        $poll_track = new Track_Poll($id_track);
        $poll_track->setDate($now);
        $poll_track->status = 'completed';
        $poll_track->update();
        $poll_track->updateTrack($id_track, array('status' => 'valid'));
    }
    $GLOBALS['page']->add(getTitleArea($lang->def('_TITLE') . ' : ' . $poll_info['title'], 'poll') . '<div class="std_block">' . $lang->def('_POLL_COMPLETED') . '<br /><br />' . Form::openForm('poll_show', Util::str_replace_once('&', '&amp;', $object_poll->back_url)) . '<div class="align_right">' . Form::getButton('end_poll', 'end_poll', $lang->def('_POLL_END_BACKTOLESSON')) . '</div>' . Form::closeForm(), 'content');
    $GLOBALS['page']->add('</div>', 'content');
}
 function get_rows_filter()
 {
     $back_url = $this->back_url;
     $jump_url = $this->jump_url;
     $next_url = $this->next_url;
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_framework'] . '/lib/lib.directory.php';
     require_once _base_ . '/lib/lib.userselector.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.course_managment.php';
     $lang =& DoceboLanguage::createInstance('report', 'framework');
     //update session
     $ref =& $_SESSION['report_tempdata'];
     if (!isset($ref['rows_filter'])) {
         $ref['rows_filter'] = array('select_all' => false, 'selection_type' => 'users', 'selection' => array());
     } else {
         //already resolved in switch block
     }
     $step = Get::req('step', DOTY_ALPHANUM, 'sel_type');
     switch ($step) {
         case 'sel_type':
             $values = array('users' => $this->lang->def('_USERS'), 'groups' => $this->lang->def('_GROUPS'));
             $sel_val = isset($ref['rows_filter']['selection_type']) ? $ref['rows_filter']['selection_type'] : 'users';
             $out = Form::openForm('selection_type_form', $jump_url);
             $out .= Form::getRadioSet($this->lang->def('_AGGREGATE_ON'), 'selection_type', 'selection_type', array_flip($values), $sel_val) . '<div class="nofloat"></div>';
             $out .= Form::openButtonSpace();
             $out .= Form::getButton('ok_selection', 'ok_selection', $this->lang->def('_CONFIRM'));
             $out .= Form::getButton('undo', 'undo', $this->lang->def('_UNDO'));
             $out .= Form::closeButtonSpace();
             $out .= Form::getHidden('step', 'step', 'sel_data');
             $out .= Form::closeForm();
             cout($out);
             break;
         case 'sel_data':
             $type = Get::req('selection_type', DOTY_ALPHANUM, 'users');
             //$aclManager = new DoceboACLManager();
             $user_select = new UserSelector();
             if (Get::req('is_updating', DOTY_INT, 0) > 0) {
                 $ref['rows_filter']['select_all'] = Get::req('select_all', DOTY_INT, 0) > 0 ? true : false;
                 $ref['rows_filter']['selection_type'] = $type;
                 //$ref['rows_filter']['selection'] = $user_select->getSelection($_POST);
             } else {
                 //maybe redoundant
                 if (!isset($ref['rows_filter']['select_all'])) {
                     $ref['rows_filter']['select_all'] = false;
                 }
                 if (!isset($ref['rows_filter']['selection_type'])) {
                     $ref['rows_filter']['selection_type'] = 'groups';
                 }
                 if (!isset($ref['rows_filter']['selection'])) {
                     $ref['rows_filter']['selection'] = array();
                 }
                 $user_select->resetSelection($ref['rows_filter']['selection']);
                 //$ref['users'] = array(); it should already have been set to void array, if non existent
             }
             if (isset($_POST['cancelselector'])) {
                 Util::jump_to($back_url);
             } elseif (isset($_POST['okselector'])) {
                 $ref['rows_filter']['selection'] = $user_select->getSelection($_POST);
                 Util::jump_to($next_url);
             }
             //set page
             switch ($type) {
                 case 'groups':
                     $user_select->show_user_selector = FALSE;
                     $user_select->show_group_selector = TRUE;
                     $user_select->show_orgchart_selector = TRUE;
                     break;
                 case 'users':
                     $user_select->show_user_selector = TRUE;
                     $user_select->show_group_selector = TRUE;
                     $user_select->show_orgchart_selector = TRUE;
                     break;
             }
             //$user_select->show_orgchart_simple_selector = FALSE;
             //$user_select->multi_choice = TRUE;
             $user_select->addFormInfo(($type == 'users' ? Form::getCheckbox($lang->def('_REPORT_FOR_ALL'), 'select_all', 'select_all', 1, $ref['rows_filter']['select_all']) : '') . Form::getBreakRow() . Form::getHidden('selection_type', 'selection_type', $type) . Form::getHidden('step', 'step', 'sel_data') . Form::getHidden('is_updating', 'is_updating', 1) . Form::getHidden('substep', 'substep', 'user_selection') . Form::getHidden('second_step', 'second_step', 1));
             $user_select->setPageTitle('');
             $user_select->loadSelector(Util::str_replace_once('&', '&amp;', $jump_url), false, $this->lang->def('_CHOOSE_USER_FOR_REPORT'), true);
             break;
     }
 }
 public function cataloguesubscribeusersTask()
 {
     require_once _adm_ . '/lib/lib.directory.php';
     require_once _adm_ . '/class.module/class.directory.php';
     require_once _lms_ . '/lib/lib.course.php';
     require_once _lms_ . '/lib/lib.edition.php';
     require_once _lms_ . '/lib/lib.date.php';
     $acl_man =& Docebo::user()->getAclManager();
     $edition_man = new EditionManager();
     $date_man = new DateManager();
     $id_catalogue = Get::req('id_catalogue', DOTY_INT, 0);
     $back_url = 'index.php?modname=catalogue&op=catlist&of_platform=lms';
     $jump_url = 'index.php?r=' . $this->link . '/cataloguesubscribeusers';
     //if we are a subadmin, check which courses/catalogues we can see
     $can_see_catalogue = true;
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         $all_courses = false;
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         }
         if (isset($admin_courses['course'][-1])) {
             require_once _lms_ . '/lib/lib.catalogue.php';
             $cat_man = new Catalogue_Manager();
             $admin_courses['catalogue'] = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt());
             if (count($admin_courses['catalogue']) == 0 && Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         }
         if (!isset($admin_courses['catalogue'][$id_catalogue])) {
             $can_see_catalogue = false;
         }
     }
     //invalid specified catalogue
     if ($id_catalogue <= 0 || !$can_see_catalogue) {
         $this->render('invalid', array('message' => Lang::t('_INVALID_CATALOGUE', 'subscribe'), 'back_url' => $back_url));
         return;
     }
     //check if the selected catalogue has any courses
     $courses_list = $this->_getCatalogueCourses($id_catalogue, isset($admin_courses['course']) ? $admin_courses['course'] : false);
     if (count($courses_list) <= 0) {
         $this->render('invalid', array('message' => Lang::t('_NO_COURSES_IN_THE_CATALOGUE', 'subscribe'), 'back_url' => $back_url));
         return;
     }
     $name = $this->_getCatalogueName($id_catalogue);
     if (isset($_POST['cancelselector'])) {
         //--- UNDO: return to catalogue list -------------------------------------
         Util::jump_to($back_url);
     } elseif (isset($_POST['okselector'])) {
         //--- USERS SELECTION IS CONFIRMED: now select editions (if any) ---------
         //check user selection
         $_selector = new UserSelector();
         $json = new Services_JSON();
         $_entity_selected = $_selector->getSelection($_POST);
         $user_selected =& $acl_man->getAllUsersFromSelection($_entity_selected);
         //free some memory from garbage variables
         unset($_selector);
         unset($_entity_selected);
         //if no user selected, than give invalid screen
         if (!is_array($user_selected) || count($user_selected) <= 0) {
             $this->render('invalid', array('message' => Lang::t('_EMPTY_SELECTION', 'subscribe'), 'back_url' => $back_url));
             return;
         }
         //extract editions info data by courses
         $editions_list = $edition_man->getEditionsInfoByCourses(array_keys($courses_list), true);
         //extract editions info data by courses
         $classrooms_list = $date_man->getDatesInfoByCourses(array_keys($courses_list), true);
         $tables = array('editions' => false, 'classrooms' => false);
         //check if the catalogue has editions; if any, than set the editions selector
         if (count($editions_list) > 0 || count($classrooms_list) > 0) {
             //set title
             $page_title_arr = array($back_url => Lang::t('_SUBSCRIBE', 'subscribe'), $name, Lang::t('_SUBSCRIBE', 'subscribe'));
             if (count($editions_list) > 0) {
                 //instantiate a new table for editions selection
                 require_once _base_ . '/lib/lib.table.php';
                 $tb = new Table(0, Lang::t('_CATALOGUE_SUBSCRIBE_CHOOSE_EDITIONS', 'subscribe'), Lang::t('_CATALOGUE_SUBSCRIBE_CHOOSE_EDITIONS', 'subscribe'));
                 $head_style = array('align_center', '', 'align_center');
                 $head_label = array(Lang::t('_COURSE_CODE', 'course'), Lang::t('_COURSE_NAME', 'course'), Lang::t('_CLASSROOM_EDITION', 'course'));
                 $tb->addHead($head_label, $head_style);
                 //set table rows
                 foreach ($editions_list as $id_course => $editions) {
                     $line = array();
                     $cinfo = $courses_list[$id_course];
                     $line[] = $cinfo->code;
                     $line[] = $cinfo->name;
                     //create the dropdown with the editions for every course
                     $_dropdown = array();
                     foreach ($editions as $id_edition => $ed_info) {
                         $_line_content = '';
                         //print begin and end date
                         if ($ed_info->date_begin != '') {
                             $_line_content .= '[' . $ed_info->code . '] ' . $ed_info->name . ' ' . '(' . Format::date($ed_info->date_begin, 'date') . ' - ' . Format::date($ed_info->date_end, 'date') . ')';
                         }
                         //check if the string is valid
                         if ($_line_content == '') {
                             //...
                         }
                         //add to dropdown list and sort the list alphabetically
                         $_dropdown[$id_edition] = $_line_content;
                         asort($_dropdown);
                     }
                     $line[] = Form::getInputDropdown('dropdown', 'sel_editions_' . $id_course, 'sel_editions[' . $id_course . ']', $_dropdown, false, '');
                     $tb->addBody($line);
                 }
                 $tables['editions'] = $tb;
             }
             if (count($classrooms_list) > 0) {
                 //instantiate a new table for editions selection
                 require_once _base_ . '/lib/lib.table.php';
                 $tb = new Table(0, Lang::t('_COURSE_TYPE_EDITION', 'course'), Lang::t('_CLASSROOM', 'standard'));
                 $head_style = array('align_center', '', 'align_center');
                 $head_label = array(Lang::t('_COURSE_CODE', 'course'), Lang::t('_COURSE_NAME', 'course'), Lang::t('_CLASSROOM_EDITION', 'course'));
                 $tb->addHead($head_label, $head_style);
                 //set table rows
                 foreach ($classrooms_list as $id_course => $classrooms) {
                     $line = array();
                     $cinfo = $courses_list[$id_course];
                     $line[] = $cinfo->code;
                     $line[] = $cinfo->name;
                     //create the dropdown with the editions for every course
                     $_dropdown = array();
                     foreach ($classrooms as $id_date => $cl_info) {
                         $_line_content = '';
                         //print begin and end date
                         if ($cl_info->date_begin != '') {
                             $_line_content .= '[' . $cl_info->code . '] ' . $cl_info->name . ' ' . '(' . Format::date($cl_info->date_begin, 'date') . ' - ' . Format::date($cl_info->date_end, 'date') . ')';
                         }
                         //check if the string is valid
                         if ($_line_content == '') {
                             //...
                         }
                         //add to dropdown list and sort the list alphabetically
                         $_dropdown[$id_date] = $_line_content;
                         asort($_dropdown);
                     }
                     $line[] = Form::getInputDropdown('dropdown', 'sel_classrooms_' . $id_course, 'sel_classrooms[' . $id_course . ']', $_dropdown, false, '');
                     $tb->addBody($line);
                 }
                 $tables['classrooms'] = $tb;
             }
             $this->render('catalogue_editions', array('id_catalogue' => $id_catalogue, 'page_title_arr' => $page_title_arr, 'num_users_selected' => count($user_selected), '_sel_users' => $json->encode($user_selected), 'tables' => $tables));
         } else {
             //no editions in the catalogue's courses, call the save operation directly
             $data = array();
             foreach ($user_selected as $user) {
                 foreach ($courses_list as $idCourse => $course) {
                     $data[] = array($user, $idCourse, false, false);
                 }
             }
             $num_subscribed = $this->_subscribeUsersToCatalogue($data);
             Util::jump_to($back_url . '&res=' . $num_subscribed);
             //_operation_successful
         }
     } else {
         //--- USER SELECTION IS IN PROGRESS: show selector -----------------------
         $user_select = new UserSelector();
         $user_select->show_user_selector = TRUE;
         $user_select->show_group_selector = TRUE;
         $user_select->show_orgchart_selector = TRUE;
         //$user_select->show_orgchart_simple_selector = TRUE;
         //filter selectable user by sub-admin permission
         $user_select->setUserFilter('exclude', array($this->acl_man->getAnonymousId()));
         if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
             require_once _base_ . '/lib/lib.preference.php';
             $adminManager = new AdminPreference();
             $admin_tree = $adminManager->getAdminTree(Docebo::user()->getIdST());
             $admin_users = $this->acl_man->getAllUsersFromIdst($admin_tree);
             $user_select->setUserFilter('user', $admin_users);
             $user_select->setUserFilter('group', $admin_tree);
         }
         if (Get::req('is_updating', DOTY_INT, false)) {
             //...
         } else {
             $user_select->requested_tab = PEOPLEVIEW_TAB;
             $user_select->resetSelection();
         }
         $page_title_arr = array($back_url => Lang::t('_SUBSCRIBE', 'subscribe'), $name, Lang::t('_SUBSCRIBE', 'subscribe'));
         $user_select->addFormInfo(Form::getHidden('is_updating', 'is_updating', 1) . Form::getHidden('id_catalogue', 'id_catalogue', $id_catalogue));
         //$user_select->setPageTitle($page_title_arr);
         //$user_select->resetSelection($_SESSION['report_tempdata']['rows_filter']['users']);
         $user_select->loadSelector(Util::str_replace_once('&', '&amp;', $jump_url), $page_title_arr, false, true);
     }
 }
Пример #25
0
 function get_rows_filter()
 {
     if (!isset($_SESSION['report_tempdata']['rows_filter'])) {
         $_SESSION['report_tempdata']['rows_filter'] = array('users' => array(), 'all_users' => false);
     }
     $back_url = $this->back_url;
     $jump_url = $this->jump_url;
     $next_url = $this->next_url;
     require_once _base_ . '/lib/lib.form.php';
     require_once $GLOBALS['where_framework'] . '/lib/lib.directory.php';
     require_once _base_ . '/lib/lib.userselector.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
     $lang =& DoceboLanguage::createInstance('report', 'framework');
     $org_chart_subdivision = importVar('org_chart_subdivision', true, 0);
     $aclManager = new DoceboACLManager();
     $user_select = new UserSelector();
     $user_select->use_suspended = true;
     if (isset($_POST['cancelselector'])) {
         Util::jump_to($back_url);
     } elseif (isset($_POST['okselector'])) {
         $aclManager = new DoceboACLManager();
         $temp = $user_select->getSelection($_POST);
         $_SESSION['report_tempdata']['rows_filter']['users'] = $temp;
         $_SESSION['report_tempdata']['rows_filter']['all_users'] = Get::req('all_users', DOTY_INT, 0) > 0 ? true : false;
         Util::jump_to($next_url);
     } else {
         // first step load selector
         if ($org_chart_subdivision == 0) {
             $user_select->show_user_selector = TRUE;
             $user_select->show_group_selector = TRUE;
         } else {
             $user_select->show_user_selector = FALSE;
             $user_select->show_group_selector = FALSE;
         }
         $user_select->show_orgchart_selector = TRUE;
         //$user_select->show_orgchart_simple_selector = FALSE;
         //$user_select->multi_choice = TRUE;
         if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN && !Docebo::user()->isAnonymous()) {
             $acl_man = new DoceboACLManager();
             require_once _base_ . '/lib/lib.preference.php';
             $adminManager = new AdminPreference();
             $admin_tree = $adminManager->getAdminTree(Docebo::user()->getIdST());
             $admin_users = $acl_man->getAllUsersFromIdst($admin_tree);
             $user_select->setUserFilter('user', $admin_users);
             $user_select->setUserFilter('group', $admin_tree);
         }
         if (Get::req('is_updating', DOTY_INT, false)) {
             //$_SESSION['report_tempdata']['rows_filter']['users'] = $user_select->getSelection($_POST);
             $_SESSION['report_tempdata']['rows_filter']['all_users'] = Get::req('all_users', DOTY_INT, 0) > 0 ? true : false;
         } else {
             $user_select->requested_tab = PEOPLEVIEW_TAB;
             $user_select->resetSelection($_SESSION['report_tempdata']['rows_filter']['users']);
         }
         $user_select->addFormInfo(Form::getCheckbox($lang->def('_REPORT_FOR_ALL'), 'all_users', 'all_users', 1, $_SESSION['report_tempdata']['rows_filter']['all_users']) . Form::getBreakRow() . Form::getHidden('org_chart_subdivision', 'org_chart_subdivision', $org_chart_subdivision) . Form::getHidden('is_updating', 'is_updating', 1));
         //$user_select->setPageTitle($this->page_title);
         cout($this->page_title, 'content');
         //$user_select->resetSelection($_SESSION['report_tempdata']['rows_filter']['users']);
         $user_select->loadSelector(Util::str_replace_once('&', '&amp;', $jump_url), false, $lang->def('_CHOOSE_USER_FOR_REPORT'), true);
     }
 }
 function assignuser()
 {
     $id = Get::req('id', DOTY_INT, -1);
     $base_url = 'index.php?r=' . $this->link . '/';
     $back_url = $base_url . 'show';
     $jump_url = $base_url . 'assignuser';
     $next_url = $base_url . 'show';
     //check permissions
     if (!$this->permissions['associate_user']) {
         Util::jump_to($back_url);
     }
     if ($id > 0) {
         require_once _adm_ . '/lib/lib.directory.php';
         require_once _adm_ . '/class.module/class.directory.php';
         $aclm = Docebo::user()->getAclManager();
         $selector = new UserSelector();
         $selector->use_suspended = true;
         $cancel = Get::req('cancelselector', DOTY_MIXED, false);
         $save = Get::req('okselector', DOTY_MIXED, false);
         if ($cancel) {
             Util::jump_to($back_url);
         } elseif ($save) {
             $selection = $selector->getSelection($_POST);
             $res = $this->model->assignUsers($id, $selection);
             if ($res) {
                 $enrollrules = new EnrollrulesAlms();
                 $enrollrules->applyRulesMultiLang('_LOG_USERS_TO_ORGCHART', $selection, $id);
             }
             Util::jump_to($next_url . ($res ? '&res=ok_assignuser' : '&res=err_assignuser'));
         } else {
             $selector->show_user_selector = true;
             $selector->show_group_selector = false;
             $selector->show_orgchart_selector = false;
             $selector->show_fncrole_selector = false;
             if (Get::req('is_updating', DOTY_INT, false)) {
             } else {
                 $members = $this->model->getFolderUsers($id);
                 $selector->requested_tab = PEOPLEVIEW_TAB;
                 $selector->resetSelection($members);
             }
             $selector->addFormInfo(Form::getHidden('is_updating', 'is_updating', 1) . Form::getHidden('id', 'id', $id));
             $selector->loadSelector(Util::str_replace_once('&', '&amp;', $jump_url), array('index.php?r=' . $this->link . '/show' => Lang::t('_ORG_CHART', 'organization_chart'), Lang::t('_ASSIGN_USERS', 'organization_chart')), false, true);
         }
     } else {
         Util::jump_to($back_url);
     }
 }
 function LOSelector($module, $back_url)
 {
     $query = "SELECT objectType FROM " . $GLOBALS['prefix_lms'] . "_lo_types";
     $rs = sql_query($query) or die('Table _lo_types not present');
     $out = '<div class="std_block">';
     $out .= '<div class="title">' . Lang::t('_SELECTLO', 'storage', 'lms') . '</div><br />';
     $out .= getBackUi(Util::str_replace_once('&', '&amp;', $back_url), Lang::t('_BACK'));
     $out .= '<form id="LOSelector" method="post" action="index.php?modname=' . $module . '&amp;op=display&amp;' . $this->_getOpCreateLOSel() . '=1" >' . '<input type="hidden" id="authentic_request_lo" name="authentic_request" value="' . Util::getSignature() . '" />';
     $first = TRUE;
     while (list($objectType) = sql_fetch_row($rs)) {
         $out .= '<label for="' . $objectType . '"><img src="' . getPathImage() . 'lobject/' . $objectType . '.gif" alt="' . $objectType . '" ' . 'title="' . $objectType . '" /></label>';
         if ($first) {
             $out .= '<input type="radio" name="radiolo" value="' . $objectType . '" id="' . $objectType . '" checked="true"/>';
         } else {
             $out .= '<input type="radio" name="radiolo" value="' . $objectType . '" id="' . $objectType . '"/>';
         }
         $out .= '<label for="' . $objectType . '">' . Lang::t('_LONAME_' . $objectType) . '</label>' . '<br />';
         $first = FALSE;
     }
     $out .= $this->printState();
     $out .= '<br /><input type="submit" class="button" value="' . Lang::t('_REPOCREATELO') . '" name="' . $this->_getOpCreateLOSel() . '"/>';
     $out .= '</form>';
     $out .= '</div>';
     return $out;
 }
Пример #28
0
    function play($object_faq, $id_param)
    {
        !checkPerm('view', true, 'organization') && !checkPerm('view', true, 'storage');
        require_once _base_ . '/lib/lib.form.php';
        require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
        $lang =& DoceboLanguage::createInstance('faq');
        $idCategory = $object_faq->getId();
        $mode = importVar('mode', false, 'faq');
        $back_coded = htmlentities(urlencode($object_faq->back_url));
        $search = importVar('search');
        if (isset($_POST['empty'])) {
            $search = '';
        }
        $idReference = getLOParam($id_param, 'idReference');
        $link = 'index.php?modname=faq&amp;op=play&amp;idCategory=' . $idCategory . '&amp;id_param=' . $id_param . '&amp;back_url=' . $back_coded;
        // NOTE: Track only if $idReference is present
        if ($idReference !== FALSE) {
            require_once $GLOBALS['where_lms'] . '/class.module/track.faq.php';
            list($exist, $idTrack) = Track_Faq::getIdTrack($idReference, getLogUserId(), $idCategory, TRUE);
            if ($exist) {
                $ti = new Track_Faq($idTrack);
                $ti->setDate(date('Y-m-d H:i:s'));
                $ti->status = 'completed';
                $ti->update();
            } else {
                $ti = new Track_Faq(false);
                $ti->createTrack($idReference, $idTrack, getLogUserId(), date('Y-m-d H:i:s'), 'completed', 'faq');
            }
        }
        list($title) = sql_fetch_row(sql_query("\r\n\tSELECT title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_faq_cat \r\n\tWHERE idCategory = '" . (int) $idCategory . "'"));
        //$GLOBALS['page']->add('<div id="top" class="std_block">', 'content');
        cout('<div class="yui-navset yui-navset-top tab_block">
			<ul class="yui-nav">
				<li class="first' . ($mode == 'faq' ? ' selected' : '') . '">
					<a href="' . $link . '&amp;mode=faq">
						<em>' . Lang::t('_SWITCH_TO_FAQ', 'faq') . '</em>
					</a>
				</li>
				<li' . ($mode == 'help' ? ' class="selected"' : '') . '>
					<a href="' . $link . '&amp;mode=help">
						<em>' . Lang::t('_SWITCH_TO_HELP', 'faq') . '</em>
					</a>
				</li>
			</ul>
			<div class="yui-content">', 'content');
        $GLOBALS['page']->add(getBackUi(Util::str_replace_once('&', '&amp;', $object_faq->back_url), $lang->def('_BACK')));
        $GLOBALS['page']->add('<b>' . $lang->def('_TITLE') . ' : ' . $title . '</b><br />' . '<br />', 'content');
        if ($mode == 'help') {
            $link .= '&amp;mode=help';
            $letter = importVar('letter', true, '');
            $search = urldecode(importVar('search'));
            // Display as help
            $textQuery = "\r\n\t\tSELECT keyword \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_faq \r\n\t\tWHERE idCategory = '" . importVar('idCategory', true) . "'";
            if ($search != '' && !isset($_POST['empty'])) {
                $textQuery .= " AND ( question LIKE '%" . $search . "%' OR answer LIKE '%" . $search . "%' ) ";
            }
            $result = sql_query($textQuery);
            $GLOBALS['page']->add(Form::openForm('glossary_play', 'index.php?modname=faq&amp;op=play') . Form::getOpenFieldset($lang->def('_FILTER')) . Form::getHidden('idCategory', 'idCategory', $idCategory) . Form::getHidden('id_param', 'id_param', $id_param) . Form::getHidden('back_url', 'back_url', $back_coded) . Form::getHidden('mode', 'mode', $mode) . Form::getTextfield($lang->def('_SEARCH'), 'search', 'search', 255, $search != '' && !isset($_POST['empty']) ? $search : ''), 'content');
            $GLOBALS['page']->add('[ ', 'content');
            //letter selection
            for ($i = 97; $i < 123; $i++) {
                if ($letter == $i) {
                    $GLOBALS['page']->add('<span class="text_bold">(', 'content');
                }
                $GLOBALS['page']->add('<a href="' . $link . '&amp;letter=' . $i . '">' . chr($i) . '</a>', 'content');
                if ($letter == $i) {
                    $GLOBALS['page']->add(')</span>', 'content');
                }
                if ($i < 122) {
                    $GLOBALS['page']->add('-', 'content');
                }
            }
            $GLOBALS['page']->add('&nbsp;]&nbsp;[&nbsp;', 'content');
            for ($i = 48; $i < 58; $i++) {
                if ($letter == $i) {
                    $GLOBALS['page']->add('<span class="text_bold">(', 'content');
                }
                $GLOBALS['page']->add('<a href="' . $link . '&amp;letter=' . $i . '">' . chr($i) . '</a>', 'content');
                if ($letter == $i) {
                    $GLOBALS['page']->add(')</span>', 'content');
                }
                if ($i < 57) {
                    $GLOBALS['page']->add('-', 'content');
                }
            }
            $GLOBALS['page']->add(' ] ', 'content');
            $GLOBALS['page']->add(Form::getBreakRow() . Form::openButtonSpace() . Form::getButton('do_search', 'do_search', $lang->def('_SEARCH')) . Form::getButton('empty', 'empty', $lang->def('_RESET')) . Form::closeButtonSpace() . Form::getCloseFieldset() . Form::closeForm(), 'content');
            //analyze keyword
            $keyword_help = array();
            while (list($keyword) = sql_fetch_row($result)) {
                $keyword_split = explode(',', $keyword);
                if (is_array($keyword_split)) {
                    while (list(, $value) = each($keyword_split)) {
                        $value = trim($value);
                        if ($value != '') {
                            if ($letter == 0) {
                                if (isset($keyword_help[$value])) {
                                    ++$keyword_help[$value];
                                } else {
                                    $keyword_help[$value] = 1;
                                }
                            } elseif (substr($value, 0, 1) == chr($letter)) {
                                if (isset($keyword_help[$value])) {
                                    ++$keyword_help[$value];
                                } else {
                                    $keyword_help[$value] = 1;
                                }
                            }
                        }
                    }
                }
            }
            ksort($keyword_help);
            reset($keyword_help);
            $GLOBALS['page']->add('<div class="yui-gf">' . '<div class="yui-u first" >' . '<div class="boxinfo_title">' . $lang->def('_TERM') . '</div>' . '<div class="boxinfo_container">' . '<ul class="link_list">', 'content');
            while (list($key, $value) = each($keyword_help)) {
                $GLOBALS['page']->add('<li><a class="href_block" href="' . $link . '&amp;letter=' . $letter . '&amp;search=' . urlencode($search) . '&amp;word=' . $key . '">' . $key . ' (' . $value . ')</a></li>', 'content');
            }
            $GLOBALS['page']->add('</ul>' . '</div></div>' . '<div class="yui-u">', 'content');
            if (isset($_GET['word'])) {
                $reDef = sql_query("\r\n\t\t\tSELECT title, answer \r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_faq \r\n\t\t\tWHERE keyword LIKE '%" . $_GET['word'] . "%' AND idCategory = '" . (int) $_GET['idCategory'] . "'\r\n\t\t\tORDER BY title");
                while (list($title, $answer) = sql_fetch_row($reDef)) {
                    $GLOBALS['page']->add('<div class="boxinfo_title">' . $title . '</div>' . '<div class="boxinfo_container">' . ($search == '' ? $answer : eregi_replace($search, '<span class="highlight">' . $search . '</span>', $answer)) . '</div><br />', 'content');
                }
            }
            $GLOBALS['page']->add('</div>' . '<div class="nofloat"></div>' . '</div>', 'content');
        } else {
            // Display as faq
            $textQuery = "\r\n\t\tSELECT question, answer \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_faq \r\n\t\tWHERE idCategory = '" . (int) $idCategory . "' " . (isset($_POST['search']) && !isset($_POST['empty']) ? " AND ( question LIKE '%" . $search . "%' OR answer LIKE '%" . $search . "%' ) " : '') . "ORDER BY sequence";
            $result = sql_query($textQuery);
            $GLOBALS['page']->add(Form::openForm('glossary_play', 'index.php?modname=faq&amp;op=play') . Form::getOpenFieldset($lang->def('_FILTER')) . Form::getHidden('idCategory', 'idCategory', $idCategory) . Form::getHidden('id_param', 'id_param', $id_param) . Form::getHidden('back_url', 'back_url', $back_coded) . Form::getTextfield($lang->def('_SEARCH'), 'search', 'search', 255, $search != '' && !isset($_POST['empty']) ? $search : '') . Form::getBreakRow() . Form::openButtonSpace() . Form::getButton('do_search', 'do_search', $lang->def('_SEARCH')) . Form::getButton('empty', 'empty', $lang->def('_RESET')) . Form::closeButtonSpace() . Form::getCloseFieldset() . Form::closeForm(), 'content');
            while (list($question, $answer) = sql_fetch_row($result)) {
                $GLOBALS['page']->add('<div class="boxinfo_title">' . ($search == '' ? $question : eregi_replace($search, '<span class="highlight">' . $search . '</span>', $question)) . '</div>' . '<div class="boxinfo_container">' . ($search == '' ? $answer : eregi_replace($search, '<span class="highlight">' . $search . '</span>', $answer)) . '</div><br />', 'content');
            }
        }
        $GLOBALS['page']->add('<div class="align_center">' . '<a href="#top">' . '<img src="' . getPathImage() . 'standard/upcheck.gif" title="' . $lang->def('_BACKTOTOP') . '" />' . $lang->def('_BACKTOTOP') . '</a>' . getBackUi(Util::str_replace_once('&', '&amp;', $object_faq->back_url), $lang->def('_BACK')), 'content');
        cout('<div class="nofloat"></div>
		</div><!-- yui content -->
		</div></div>', 'content');
    }
Пример #29
0
 foreach ($platforms as $p_code => $p_name) {
     $menu_man =& $p_man->getPlatofmMenuInstance($p_code);
     if ($menu_man !== false) {
         $main_voice = $menu_man->getLevelOne();
         if (!empty($main_voice)) {
             cout('<li class="yuimenuitem">' . '<a class="yuimenuitemlabel" href="#submenu_' . $p_code . '">' . '<span class="admmenu_' . $p_code . '">' . $lang->def('_FIRST_LINE_' . $p_code) . '</span>' . '</a>' . '<div id="submenu_' . $p_code . '" class="yuimenu"><div class="bd"><ul>', 'menu_over');
             foreach ($main_voice as $id_m => $v_main) {
                 $under_voice = $menu_man->getLevelTwo($id_m);
                 if (!isset($v_main['collapse']) || $v_main['collapse'] === false) {
                     cout('<li class="yuimenuitem">' . '<a class="yuimenuitemlabel" href="#submenu_' . $p_code . '_' . $id_m . '">' . $v_main['name'] . '</a>', 'menu_over');
                     if (!empty($under_voice)) {
                         cout('<div id="submenu_' . $p_code . '_' . $id_m . '" class="yuimenu"><div class="bd"><ul>', 'menu_over');
                     }
                 }
                 foreach ($under_voice as $id_m => $voice) {
                     cout('<li class="yuimenuitem">' . '<a class="yuimenuitemlabel" href="' . Util::str_replace_once('&', '&amp;', $voice['link']) . '">' . $voice['name'] . '</a>' . '</li>', 'menu_over');
                 }
                 if (!isset($v_main['collapse']) || $v_main['collapse'] === false) {
                     if (!empty($under_voice)) {
                         cout('</ul></div></div>', 'menu_over');
                     }
                     cout('</li>', 'menu_over');
                 }
             }
             cout('</ul></div></div>' . '</li>', 'menu_over');
         }
     }
 }
 // quick jump
 cout('<li class="yuimenuitem">' . '<a href="' . $GLOBALS['where_lms_relative'] . '">' . '<span class="admmenu_goto">' . $lang->def('_JUMP_TO_PLATFORM', 'menu', 'framework') . ' ' . $lang->def('_LMS', 'platform') . '</span>' . '</a>', 'menu_over');
 /*
Пример #30
0
 /**
  * expands entities, e.g. changes '<' to '&lt;'.
  *
  * @param	string	$val	The string in which to expand entities.
  * @access	private
  */
 function expandEntities($val)
 {
     if ($this->charencoding) {
         $val = Util::str_replace_once('&', '&amp;', $val);
         $val = str_replace("'", '&apos;', $val);
         $val = str_replace('"', '&quot;', $val);
         $val = str_replace('<', '&lt;', $val);
         $val = str_replace('>', '&gt;', $val);
     }
     return $val;
 }