本文整理汇总了PHP中Util::str_replace_once方法的典型用法代码示例。如果您正苦于以下问题:PHP Util::str_replace_once方法的具体用法?PHP Util::str_replace_once怎么用?PHP Util::str_replace_once使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Util
的用法示例。
在下文中一共展示了Util::str_replace_once方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addfaqcat
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('&', '&', $object_faq->back_url) . '&create_result=0', $lang->def('_BACK')) . Form::openForm('faqform', 'index.php?modname=faq&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: create
/**
* 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('&', '&', $back_poll), Lang::t('_BACK')));
}
Util::jump_to('' . $back_poll);
}
示例3: moditem
function moditem($object_item)
{
//checkPerm('view', false, 'storage');
require_once _base_ . '/lib/lib.form.php';
$lang =& DoceboLanguage::createInstance('item');
$back_coded = htmlentities(urlencode($object_item->back_url));
list($title, $description) = sql_fetch_row(sql_query("\r\n\tSELECT title, description \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_materials_lesson \r\n\tWHERE author = " . getLogUserId() . " AND idLesson = '" . $object_item->getId() . "'"));
$GLOBALS['page']->add(getTitleArea($lang->def('_SECTIONNAME_ITEM'), 'item') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&', $object_item->back_url) . '&mod_result=0', $lang->def('_BACK')) . Form::openForm('itemform', 'index.php?modname=item&op=upitem', 'std_form', 'post', 'multipart/form-data') . Form::openElementSpace() . Form::getHidden('idItem', 'idItem', $object_item->getId()) . Form::getHidden('back_url', 'back_url', htmlentities(urlencode($object_item->back_url))) . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', 100, $title) . Form::getFilefield($lang->def('_FILE_MOD'), 'file', 'attach') . Form::getTextarea($lang->def('_DESCRIPTION'), 'description', 'description', $description) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('additem', 'additem', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
}
示例4: modglossary
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('&', '&', $back_url) . '&create_result=0', $lang->def('_BACK')) . Form::openForm('glossaryform', 'index.php?modname=glossary&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');
}
示例5: play
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&op=play&idCategory=' . $idCategory . '&id_param=' . $id_param . '&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 . '&mode=list">
<em>' . Lang::t('_SWITCH_TO_LIST', 'link') . '</em>
</a>
</li>
<li' . ($mode == 'keyw' ? ' class="selected"' : '') . '>
<a href="' . $link . '&mode=keyw">
<em>' . Lang::t('_SWITCH_TO_KEYWORD', 'link') . '</em>
</a>
</li>
</ul>
<div class="yui-content">', 'content');
cout(getBackUi(Util::str_replace_once('&', '&', $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 . '&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('&', '&', $object_link->back_url), $lang->def('_BACK')) . '</div>', 'content');
cout('</div></div>', 'content');
}
示例6: edit
function edit($back_poll)
{
$lang =& DoceboLanguage::createInstance('poll');
require_once _base_ . '/lib/lib.form.php';
$url_encode = htmlentities(urlencode($back_poll));
if (isset($_POST['add_question'])) {
if (!sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\t\t\tSET title_quest = '" . $_POST['title_quest'] . "' \r\n\t\t\tWHERE id_quest = '" . $this->id . "'")) {
errorCommunication($lang->def('_ERR_INS_QUEST') . getBackUi('index.php?modname=question_poll&op=edit&type_quest=' . $this->getQuestionType() . '&id_quest=' . $this->id . '&back_poll=' . $url_encode, $lang->def('_BACK')));
}
Util::jump_to('' . $back_poll);
}
list($title_quest) = sql_fetch_row(sql_query("\r\n\t\tSELECT title_quest \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\t\tWHERE id_quest = '" . $this->id . "'"));
$GLOBALS['page']->add(getTitleArea($lang->def('_POLL_SECTION'), 'poll') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&', $back_poll), $lang->def('_BACK')) . '<div class="title_big">' . $lang->def('_QUEST_ACRN_' . strtoupper($this->getQuestionType())) . ' - ' . $lang->def('_QUEST_' . strtoupper($this->getQuestionType())) . '</div><br />' . Form::openForm('form_mod_quest', 'index.php?modname=question_poll&op=edit') . Form::openElementSpace() . Form::getHidden('type_quest', 'type_quest', $this->getQuestionType()) . Form::getHidden('id_quest', 'id_quest', $this->id) . Form::getHidden('back_poll', 'back_poll', $url_encode) . Form::getTextarea($lang->def('_POLL_QUEST_TITLE'), 'title_quest', 'title_quest', $title_quest) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('add_question', 'add_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
}
示例7: additem
function additem($object_item)
{
//checkPerm( 'view', FALSE, 'storage' );
$lang =& DoceboLanguage::createInstance('scorm', 'lms');
require_once _base_ . '/lib/lib.form.php';
$form = new Form();
//area title
$GLOBALS['page']->add(getTitleArea($lang->getLangText('_SCORMIMGSECTION'), 'scorm', $lang->getLangText('_SCORMSECTIONNAME')));
$GLOBALS['page']->add('<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&', $object_item->back_url) . '&create_result=0', $lang->getLangText('_BACK_TOLIST')));
$GLOBALS['page']->add(Form::getFormHeader($lang->def('_SCORM_ADD_FORM')));
$GLOBALS['page']->add($form->openForm("scormform", "index.php?modname=scorm&op=insitem", false, false, 'multipart/form-data'));
$GLOBALS['page']->add($form->openElementSpace());
$GLOBALS['page']->add($form->getHidden("back_url", "back_url", htmlentities(urlencode($object_item->back_url))));
$GLOBALS['page']->add($form->getFilefield($lang->getLangText('_CONTENTPACKAGE'), "attach", "attach"));
$GLOBALS['page']->add($form->getCheckbox($lang->getLangText('_SCORMIMPORTRESOURCES'), "lesson_resources", "lesson_resources", "import"));
$GLOBALS['page']->add($form->closeElementSpace());
$GLOBALS['page']->add($form->openButtonSpace());
$GLOBALS['page']->add($form->getButton("scorm_add_submit", "scorm_add_submit", $lang->getLangText('_SCORMLOAD')));
$GLOBALS['page']->add($form->closeButtonSpace());
$GLOBALS['page']->add($form->closeForm() . '</div>');
}
示例8: modlinkgui
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('&', '&', $object_link->back_url) . '&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&op=modlinkcat&idCategory=' . $object_link->getId() . '&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&op=movedown&idLink=' . $idLink . '&back_url=' . $back_coded . '">' . '<img src="' . getPathImage() . 'standard/down.png" alt="' . $lang->def('_DOWN') . '" title="' . $lang->def('_MOVE_DOWN') . '" /></a>';
} else {
$rowContent[] = ' ';
}
if ($i != 1) {
$rowContent[] = '<a href="index.php?modname=link&op=moveup&idLink=' . $idLink . '&back_url=' . $back_coded . '">' . '<img src="' . getPathImage() . 'standard/up.png" alt="' . $lang->def('_UP') . '" title="' . $lang->def('_MOVE_UP') . '" /></a>';
} else {
$rowContent[] = ' ';
}
$rowContent[] = '<a href="index.php?modname=link&op=modlink&idLink=' . $idLink . '&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&op=dellink&idLink=' . $idLink . '&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&op=newlink&idCategory=' . $object_link->getId() . '&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&op=fixsequence&idCategory=' . $object_link->getId() . '&back_url=' . $back_coded . '">' . $lang->def('_FIX_SEQUENCE') . '</a>' . ' ]</span>' . '</div>', 'content');
}
示例9: modpage
function modpage($object_page)
{
checkPerm('view', false, 'storage');
require_once _base_ . '/lib/lib.form.php';
$lang =& DoceboLanguage::createInstance('htmlpage');
//retriving info
list($title, $textof) = sql_fetch_row(sql_query("\r\n\tSELECT title, textof \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_htmlpage \r\n\tWHERE idPage = '" . $object_page->getId() . "'"));
// recuper gli allegati
$path = '/appLms/htmlpages/';
$query = "SELECT * FROM " . $GLOBALS['prefix_lms'] . "_htmlpage_attachment WHERE idpage = " . $object_page->getId();
$res = mysql_query($query);
$attachments = array();
if ($res) {
while ($row = mysql_fetch_assoc($res)) {
$attachments[] = array('id' => $row['id'], 'title' => $row['title'], 'file' => $GLOBALS['where_files_relative'] . $path . $row['file']);
}
}
$GLOBALS['page']->add(getTitleArea($lang->def('_SECT_PAGE'), 'htmlpage') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&', $object_page->back_url) . '&mod_result=0', $lang->def('_BACK')) . Form::openForm('pageform', 'index.php?modname=htmlpage&op=uppage', false, false, 'multipart/form-data') . Form::openElementSpace() . Form::getHidden('idPage', 'idPage', $object_page->getId()) . Form::getHidden('back_url', 'back_url', htmlentities(urlencode($object_page->back_url))) . '<script>' . "\n" . 'my_n=1;' . "\n" . 'function delAttachment(id) {' . "\n" . ' document.getElementById(id).style.textDecoration="line-through";' . "\n" . ' document.getElementById(\'iddelattachment\').value = document.getElementById(\'iddelattachment\').value+\';\'+id' . "\n" . '}' . "\n" . 'function addAttachment() {' . "\n" . ' my_file = "attach"+my_n;' . "\n" . ' my_filevalue = \'\';' . "\n" . ' if (document.getElementById(my_file))' . "\n" . ' my_filevalue = document.getElementById(my_file).value;' . "\n" . ' my_html = "' . str_replace(array("\r", "\r\n", "\n"), '', addslashes(Form::getFilefield($lang->def('_UPLOAD'), 'attach%%', 'attach%%'))) . '";' . "\n" . ' if (my_filevalue != \'\') {' . "\n" . ' my_n=my_n+1;' . "\n" . ' my_html = my_html.replace(/%%/gi,my_n);' . "\n" . ' newdiv = document.createElement("div");' . "\n" . ' newdiv.innerHTML = my_html;' . "\n" . ' my_divhtml = document.getElementById(\'attachment_area\');' . "\n" . ' my_divhtml.appendChild(newdiv);' . "\n" . ' }' . "\n" . '}' . "\n" . '</script>' . "\n" . '<div class="std_block">' . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', 150, $title) . Form::getTextarea($lang->def('_TEXTOF'), 'textof', 'textof', $textof), 'content');
foreach ($attachments as $attachment) {
$GLOBALS['page']->add("<a id=\"" . $attachment['id'] . "\" href=\"" . $attachment['file'] . "\" target=\"_blank\">" . $attachment['title'] . "</a> (<a href=\"javascript:delAttachment(" . $attachment['id'] . ");\">x</a>)<br/>", 'content');
}
$GLOBALS['page']->add('<div id="attachment_area">' . Form::getHidden('iddelattachment', 'iddelattachment', '') . Form::getFilefield($lang->def('_UPLOAD'), 'attach1', 'attach1') . '</div>' . '<a href="javascript:addAttachment();">(+)</a>' . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('addhtmlpage', 'addhtmlpage', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '', 'content');
}
示例10: schedule_recipients
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('&', '&', $jump_url), false, true);
cout('</div>', 'content');
}
示例11: sel_usersTask
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('&', '&', $jump_url), $page_title_arr, Lang::t('_ASSIGN_USERS_TO_FNCROLE', 'fncroles'), true);
}
}
示例12: modtestgui
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 . '&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('&', '&', $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&op=modtest&idTest=' . $object_test->getId() . '&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&op=defmodality&idTest=' . $object_test->getId() . '&back_url=' . $url_encode . '" title="' . $lang->def('_TEST_MODALITY') . '">' . $lang->def('_TEST_MODALITY') . '</a>' . '</li>
<li>' . '<a href="index.php?modname=test&op=deftime&idTest=' . $object_test->getId() . '&back_url=' . $url_encode . '" title="' . $lang->def('_TEST_COMPILE_TIME') . '">' . $lang->def('_TEST_COMPILE_TIME') . '</a>' . '</li>
<li>' . '<a href="index.php?modname=test&op=defpoint&idTest=' . $object_test->getId() . '&back_url=' . $url_encode . '" title="' . $lang->def('_TEST_POINT_ASSIGNEMENT') . '">' . $lang->def('_TEST_POINT_ASSIGNEMENT') . '</a>' . '</li>
<li>' . '<a href="index.php?modname=test&op=feedbackman&idTest=' . $object_test->getId() . '&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 = '&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&op=movedown&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&op=moveup&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&op=modquest&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&op=delquest&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&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> ' . '<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> ' . '<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 .= ' <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&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> '
.'<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 .= ' <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&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>';
//.........这里部分代码省略.........
示例13: edit
/**
* 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&op=create&type_quest=' . $this->getQuestionType() . '&idQuest=' . $this->id . '&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&op=edit&type_quest=' . $this->getQuestionType() . '&idQuest=' . $this->id . '&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('&', '&', $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('&', '&', $back_test), $lang->def('_BACK')) . '<div class="title_big">' . $lang->def('_QUEST_ACRN_' . strtoupper($this->getQuestionType())) . ' - ' . $lang->def('_QUEST_' . strtoupper($this->getQuestionType())) . '</div><br />' . Form::openForm('form_mod_quest', 'index.php?modname=question&op=edit') . Form::openElementSpace() . Form::getHidden('type_quest', 'type_quest', $this->getQuestionType()) . Form::getHidden('idQuest', 'idQuest', $this->id) . Form::getHidden('back_test', 'back_test', $url_encode) . Form::getTextarea($lang->def('_QUESTION'), 'title_quest', 'title_quest', $title_quest), 'content');
if (count($categories) > 1) {
$GLOBALS['page']->add(Form::getDropdown($lang->def('_TEST_QUEST_CATEGORY'), 'idCategory', 'idCategory', $categories, isset($_POST['idCategory']) ? $_POST['idCategory'] : $cat_sel), 'content');
}
$GLOBALS['page']->add(Form::getDropdown($lang->def('_DIFFICULTY'), 'difficult', 'difficult', $arr_dufficult, $diff_sel) . Form::getTextfield($lang->def('_TEST_QUEST_TIMEASS'), 'time_assigned', 'time_assigned', 5, isset($_POST['time_assigned']) ? $_POST['time_assigned'] : $sel_time, $lang->def('_TEST_QUEST_TIMEASS'), $lang->def('_SECONDS')) . '<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');
}
示例14: edit
function edit($back_test)
{
$lang =& DoceboLanguage::createInstance('test');
require_once _base_ . '/lib/lib.form.php';
$url_encode = htmlentities(urlencode($back_test));
if (isset($_POST['add_question'])) {
if (!sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\t\tSET idCategory = '" . (int) $_POST['idCategory'] . "', \r\n\t\t\t\ttitle_quest = '" . $_POST['title_quest'] . "', \r\n\t\t\t\tdifficult = '" . (int) $_POST['difficult'] . "', \r\n\t\t\t\ttime_assigned = '" . (int) $_POST['time_assigned'] . "' \r\n\t\t\tWHERE idQuest = '" . $this->id . "'")) {
errorCommunication($lang->def('_ERR_INS_QUEST') . getBackUi('index.php?modname=question&op=edit&type_quest=' . $this->getQuestionType() . '&idQuest=' . $this->id . '&back_test=' . $url_encode, $lang->def('_BACK')));
}
if (!sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\t\tSET score_correct = '" . $this->_checkScore($_POST['max_score']) . "'\r\n\t\t\tWHERE idQuest = '" . $this->id . "'")) {
errorCommunication($lang->def('_ERR_INS_QUEST') . getBackUi('index.php?modname=question&op=edit&type_quest=' . $this->getQuestionType() . '&idQuest=' . $this->id . '&back_test=' . $url_encode, $lang->def('_BACK')));
}
Util::jump_to('' . $back_test);
}
//finding categories
require_once $GLOBALS['where_lms'] . '/lib/lib.questcategory.php';
$categories = Questcategory::getCategory();
//create array of difficult
$arr_dufficult = array(5 => '5 - ' . $lang->def('_VERY_HARD'), 4 => '4 - ' . $lang->def('_HARD'), 3 => '3 - ' . $lang->def('_DIFFICULT_MEDIUM'), 2 => '2 - ' . $lang->def('_DIFFICULT_EASY'), 1 => '1 - ' . $lang->def('_DIFFICULT_VERYEASY'));
list($title_quest, $cat_sel, $diff_sel, $sel_time) = sql_fetch_row(sql_query("\r\n\t\tSELECT title_quest, idCategory, difficult, time_assigned \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\tWHERE idQuest = '" . $this->id . "'"));
list($max_score) = sql_fetch_row(sql_query("\r\n\t\tSELECT score_correct\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquestanswer \r\n\t\tWHERE idQuest = '" . $this->id . "'"));
$GLOBALS['page']->add(getTitleArea($lang->def('_TEST_SECTION'), 'test') . '<div class="std_block">' . getBackUi(Util::str_replace_once('&', '&', $back_test), $lang->def('_BACK')) . '<div class="title_big">' . $lang->def('_QUEST_ACRN_' . strtoupper($this->getQuestionType())) . ' - ' . $lang->def('_QUEST_' . strtoupper($this->getQuestionType())) . '</div><br />' . Form::openForm('form_mod_quest', 'index.php?modname=question&op=edit') . Form::openElementSpace() . Form::getHidden('type_quest', 'type_quest', $this->getQuestionType()) . Form::getHidden('idQuest', 'idQuest', $this->id) . Form::getHidden('back_test', 'back_test', $url_encode) . Form::getTextarea($lang->def('_QUESTION'), 'title_quest', 'title_quest', $title_quest), 'content');
if (count($categories) > 1) {
$GLOBALS['page']->add(Form::getDropdown($lang->def('_TEST_QUEST_CATEGORY'), 'idCategory', 'idCategory', $categories, isset($_POST['idCategory']) ? $_POST['idCategory'] : $cat_sel), 'content');
}
$GLOBALS['page']->add(Form::getDropdown($lang->def('_DIFFICULTY'), 'difficult', 'difficult', $arr_dufficult, $diff_sel) . Form::getTextfield($lang->def('_TEST_QUEST_TIMEASS'), 'time_assigned', 'time_assigned', 5, isset($_POST['time_assigned']) ? $_POST['time_assigned'] : $sel_time, $lang->def('_TEST_QUEST_TIMEASS'), $lang->def('_SECONDS')) . Form::getBreakRow() . Form::getTextfield($lang->def('_MAX_SCORE'), 'max_score', 'max_score', 255, isset($_POST['max_score']) ? $_POST['max_score'] : $max_score, $lang->def('_MAX_SCORE')) . Form::getBreakRow() . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('add_question', 'add_question', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
}
示例15: review
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('&', '&', $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('&', '&', $object_test->back_url), $lang->def('_BACK')) . '</div>', 'content');
}