Example #1
0
function doimportquest()
{
    checkPerm('view', false, 'storage');
    $lang =& DoceboLanguage::createInstance('test');
    $idTest = importVar('idTest', true, 0);
    $back_url = urldecode(importVar('back_url'));
    $back_coded = htmlentities(urlencode($back_url));
    require_once $GLOBALS['where_lms'] . '/lib/lib.quest_bank.php';
    $qb_man = new QuestBankMan();
    $file_format = Get::req('file_format', DOTY_INT, 0);
    $file_encode = Get::req('file_encode', DOTY_ALPHANUM, 'utf-8');
    $file_readed = file($_FILES['import_file']['tmp_name']);
    YuiLib::load('table');
    $title = array('index.php?modname=test&op=modtestgui&idTest=' . $idTest . '&back_url=' . $back_coded => $lang->def('_QUEST_BANK'), $lang->def('_IMPORT'));
    cout(getTitleArea($title, 'quest_bank') . '<div class="std_block yui-skin-docebo">' . getBackUi('index.php?modname=test&amp;op=defpoint&amp;idTest=' . $idTest . '&amp;back_url=' . $back_coded, $lang->def('_BACK')));
    $import_result = $qb_man->import_quest($file_readed, $file_format, $idTest);
    fixQuestSequence($idTest);
    cout('<table id="import_result"><caption>' . $lang->def('_IMPORT') . '</caption>');
    cout('<tr>' . '<td>' . $lang->def('_QUEST_TYPE') . '</td>' . '<td>' . $lang->def('_SUCCESS') . '</td>' . '<td>' . $lang->def('_FAIL') . '</td>' . '</tr>');
    foreach ($import_result as $type_quest => $i_result) {
        cout('<tr>' . '<td>' . $lang->def('_QUEST_' . strtoupper($type_quest)) . '</td>' . '<td>' . $i_result['success'] . '</td>' . '<td>' . $i_result['fail'] . '</td>' . '</tr>');
    }
    cout('</table>');
    cout('</div>');
}
Example #2
0
function doimportquest(&$url)
{
    require_once _lms_ . '/lib/lib.quest_bank.php';
    $lang_t =& DoceboLanguage::createInstance('test');
    $qb_man = new QuestBankMan();
    $file_format = Get::pReq('file_format', DOTY_INT, 0);
    $file_encode = Get::pReq('file_encode', DOTY_ALPHANUM, 'utf-8');
    $file_readed = file($_FILES['import_file']['tmp_name']);
    $quest_category = Get::req('quest_category', DOTY_INT, 0);
    addCss('style_yui_docebo');
    $title = array($url->getUrl() => $lang_t->def('_QUEST_BANK', 'menu_course'), $lang_t->def('_IMPORT'));
    cout(getTitleArea($title, 'quest_bank') . '<div class="std_block">' . getBackUi($url->getUrl(), $lang_t->def('_BACK')), 'content');
    $import_result = $qb_man->import_quest($file_readed, $file_format, 0, $quest_category);
    cout('<table clasS="type-one" id="import_result">' . '<caption>' . $lang_t->def('_IMPORT') . '</caption>', 'content');
    cout('<thead>', 'content');
    cout('<tr class="type-one-header">' . '<th>' . $lang_t->def('_QUEST_TYPE') . '</th>' . '<th>' . $lang_t->def('_SUCCESS') . '</th>' . '<th>' . $lang_t->def('_FAIL') . '</th>' . '</tr>', 'content');
    cout('</thead>', 'content');
    cout('<tbody>', 'content');
    foreach ($import_result as $type_quest => $i_result) {
        cout('<tr>' . '<td>' . $lang_t->def('_QUEST_' . strtoupper($type_quest)) . '</td>' . '<td>' . (isset($i_result['success']) ? $i_result['success'] : '') . '</td>' . '<td>' . (isset($i_result['fail']) ? $i_result['fail'] : '') . '</td>' . '</tr>', 'content');
    }
    cout('</tbody>', 'content');
    cout('</table>', 'content');
    cout('</div>', 'content');
}