本文整理汇总了PHP中getErrorUi函数的典型用法代码示例。如果您正苦于以下问题:PHP getErrorUi函数的具体用法?PHP getErrorUi怎么用?PHP getErrorUi使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getErrorUi函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: edithtml
function edithtml()
{
checkPerm('mod');
require_once _base_ . '/lib/lib.form.php';
$query = "\r\n\tSELECT textof\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\tWHERE id_course = '" . $_SESSION['idCourse'] . "'";
$re_htmlfront = sql_query($query);
$error = false;
if (isset($_POST['save'])) {
if (mysql_num_rows($re_htmlfront) > 0) {
$upd_query = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\t\t\tSET textof = '" . $_POST['description'] . "'\r\n\t\t\tWHERE id_course = '" . $_SESSION['idCourse'] . "'";
$re = sql_query($upd_query);
} else {
$ins_query = "\r\n\t\t\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_htmlfront \r\n\t\t\t( id_course, textof) VALUES \r\n\t\t\t( \t'" . $_SESSION['idCourse'] . "',\r\n\t\t\t\t'" . $_POST['description'] . "' )";
$re = sql_query($ins_query);
}
if ($re) {
Util::jump_to('index.php?modname=htmlfront&op=showhtml&saveok=1');
} else {
$error = true;
}
}
$lang =& DoceboLanguage::createInstance('htmlfront', 'lms');
list($textof) = sql_fetch_row($re_htmlfront);
$title_page = array('index.php?modname=htmlfront&op=showhtml' => $lang->def('_HTMLFRONT'), $lang->def('_MOD'));
$GLOBALS['page']->add(getTitleArea($title_page, 'htmlfront') . '<div class="std_block">' . getBackUi('index.php?modname=htmlfront&op=showhtml', $lang->def('_BACK')) . ($error ? getErrorUi($lang->def('_ERROR_IN_SAVE')) : '') . Form::openForm('formnotes', 'index.php?modname=htmlfront&op=edithtml') . Form::openElementSpace() . Form::getTextarea($lang->def('_TEXTOF'), 'description', 'description', importVar('description', false, $textof)) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
}
示例2: adminConf
function adminConf()
{
require_once _base_ . '/lib/lib.form.php';
$lang =& DoceboLanguage::createInstance('admin_config', 'scs');
$out =& $GLOBALS['page'];
$out->setWorkingZone('content');
$out->add(getTitleArea($lang->def('_ADMIN_CONF'), 'admin_conf') . '<div class="std_block">');
if (isset($_POST['save'])) {
$query_update = "UPDATE " . $GLOBALS['prefix_scs'] . "_rules_admin SET ";
if (isset($_POST['rules'])) {
while (list($var_name, $new_value) = each($_POST['rules'])) {
$query_update .= " {$var_name} = '" . $new_value . "',";
}
$re = sql_query(substr($query_update, 0, -1));
}
if ($re) {
$out->add(getResultUi($lang->def('_MOD_OK')));
} else {
$out->add(getErrorUi($lang->def('_MOD_ERR')));
}
}
$query_rules_admin = "\r\n\tSELECT server_status, \r\n\t\tenable_recording_function, enable_advice_insert, enable_write, enable_chat_recording, \r\n\t\tenable_private_subroom, enable_public_subroom, \r\n\t\tenable_drawboard_watch, enable_drawboard_write, \r\n\t\tenable_audio, enable_webcam, enable_stream_watch, enable_strem_write, enable_remote_desktop \r\n\tFROM " . $GLOBALS['prefix_scs'] . "_rules_admin";
$re_rules_admin = sql_query($query_rules_admin);
$rules = mysql_fetch_array($re_rules_admin);
$out->add(Form::openForm('rules_admin', 'index.php?modname=admin_configuration&op=conf') . Form::openElementSpace() . Form::getOpenCombo($lang->def('_SERVER_STATUS')) . Form::getInputRadio('rules_server_status_yes', 'rules[server_status]', 'yes', $rules['server_status'] == 'yes', '') . ' ' . Form::getLabel('', $lang->def('_YES'), 'label_padded') . ' ' . Form::getInputRadio('rules_server_status_no', 'rules[server_status]', 'no', $rules['server_status'] == 'no', '') . ' ' . Form::getLabel('', $lang->def('_NO'), 'label_padded') . ' ' . Form::getCloseCombo() . maskMultiple('enable_recording_function', $rules['enable_recording_function']) . maskMultiple('enable_advice_insert', $rules['enable_advice_insert']) . maskMultiple('enable_write', $rules['enable_write']) . maskMultiple('enable_chat_recording', $rules['enable_chat_recording']) . maskMultiple('enable_private_subroom', $rules['enable_private_subroom']) . maskMultiple('enable_public_subroom', $rules['enable_public_subroom']) . maskMultiple('enable_drawboard_watch', $rules['enable_drawboard_watch']) . maskMultiple('enable_drawboard_write', $rules['enable_drawboard_write']) . maskMultiple('enable_audio', $rules['enable_audio']) . maskMultiple('enable_webcam', $rules['enable_webcam']) . maskMultiple('enable_stream_watch', $rules['enable_stream_watch']) . maskMultiple('enable_strem_write', $rules['enable_strem_write']) . maskMultiple('enable_remote_desktop', $rules['enable_remote_desktop']) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm());
$out->add('</div>');
}
示例3: loadBody
function loadBody()
{
require_once $GLOBALS['where_framework'] . '/modules/' . $this->module_name . '/' . $this->module_name . '.php';
$out =& $this->get_out();
$lang =& $this->get_lang();
if (isset($_GET['addconnector']) && !isset($_POST['cancel'])) {
require_once $GLOBALS['where_framework'] . '/lib/lib.iotask.php';
$connMgr =& $this->get_connMgr();
$filename = key($_POST['file']);
if ($connMgr->add_connector($filename)) {
$out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
} else {
$out->add(getErrorUi($lang->def('_OPERATION_FAILURE')) . $connMgr->get_last_error());
}
}
if (isset($_GET['addconnectionok']) && !isset($_POST['cancel'])) {
$out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
}
if (isset($_GET['addtaskok']) && !isset($_POST['cancel'])) {
$out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
}
if (isset($_GET['deleteconnectionok']) && !isset($_POST['cancel'])) {
$out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
} elseif (isset($_GET['deleteconnectionerror']) && !isset($_POST['cancel'])) {
$out->add(getErrorUi($lang->def('_ERR_FAIL_DELETE_CONNECTOR')));
}
if (isset($_GET['deletetaskok']) && !isset($_POST['cancel'])) {
$out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
} elseif (isset($_GET['deletetakserror']) && !isset($_POST['cancel'])) {
$out->add(getErrorUi($lang->def('_ERR_FAIL_DELETE_TASK')));
}
if (isset($_POST['action'])) {
switch (key($_POST['action'])) {
case 'new_connector':
ioTask_UIConnectorNew($this);
break;
case 'run_task':
ioTask_UITaskRun($this, current($_POST['action']), key($_POST['action']));
break;
case 'new_task':
case 'edit_task':
ioTask_UITaskNew($this, current($_POST['action']), key($_POST['action']));
break;
case 'delete_task':
ioTask_UITaskDelete($this, current($_POST['action']), key($_POST['action']));
break;
case 'new_connection':
case 'edit_connection':
ioTask_UIConnectionNew($this, current($_POST['action']), key($_POST['action']));
break;
case 'delete_connection':
ioTask_UIConnectionDelete($this, current($_POST['action']), key($_POST['action']));
break;
}
} elseif (isset($_GET['addconnection']) && !isset($_POST['cancel'])) {
ioTask_UIConnectionNew($this, '', '');
} else {
ioTask_UITab($this, $GLOBALS['op']);
}
}
示例4: notes
function notes()
{
checkPerm('view');
require_once _base_ . '/lib/lib.table.php';
$lang =& DoceboLanguage::createInstance('notes', 'lms');
$nav_bar = new NavBar('ini', Get::sett('visuItem'), 0);
$ini = $nav_bar->getSelectedElement();
$ord = importVar('ord');
$inv = importVar('inv');
switch ($ord) {
case "tit":
$ord = $order = 'title';
if ($inv != 'y') {
$a_down = '&inv=y';
} else {
$order .= ' DESC';
$a_down = '';
}
break;
default:
$ord = $order = 'data';
if ($inv == 'y') {
$a_down = '';
} else {
$order .= ' DESC';
$a_down = '&inv=y';
}
}
$reNotes = sql_query("\r\n\tSELECT idNotes, data, title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_notes \r\n\tWHERE owner ='" . getLogUserId() . "' AND idCourse='" . $_SESSION['idCourse'] . "' \r\n\tORDER BY {$order} \r\n\tLIMIT {$ini}," . Get::sett('visuItem'));
list($num_notes) = sql_fetch_row(sql_query("SELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_notes \r\n\tWHERE owner ='" . getLogUserId() . "' AND idCourse='" . $_SESSION['idCourse'] . "' "));
$nav_bar->setElementTotal($num_notes);
$img_up = '<img class="valing-middle" src="' . getPathImage() . 'standard/up_arrow.png" alt="' . $lang->def('_UP') . '"/>';
$img_down = '<img class="valing-middle" src="' . getPathImage() . 'standard/down_arrow.png" alt="' . $lang->def('_DOWN') . '"/>';
$tb = new Table(Get::sett('visuItem'), $lang->def('_NOTES'), $lang->def('_NOTES'));
$contentH = array(($ord == 'data' ? $inv == 'y' ? $img_up : $img_down : '') . '<a href="index.php?modname=notes&op=notes' . $a_down . '"> ' . $lang->def('_DATE') . '</a>', ($ord == 'title' ? $inv == 'y' ? $img_up : $img_down : '') . '<a href="index.php?modname=notes&op=notes&ord=tit' . $a_down . '">' . $lang->def('_TITLE') . '</a>', '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />');
$typeH = array('min-cell', '', 'image', 'image');
$tb->setColsStyle($typeH);
$tb->addHead($contentH);
while (list($idNotes, $data, $title) = sql_fetch_row($reNotes)) {
$content = array(Format::date($data), '<a href="index.php?modname=notes&op=displaynotes&idNotes=' . $idNotes . '" title="' . $lang->def('_MORET') . '">' . $title . '</a>', '<a href="index.php?modname=notes&op=modnotes&idNotes=' . $idNotes . '">
<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" /></a>', '<a id="delnotes_' . $idNotes . '"' . ' href="index.php?modname=notes&op=delnotes&idNotes=' . $idNotes . '"' . ' title="' . $lang->def('_TITLE') . ' : ' . strip_tags(str_replace(array('"', "'"), '', $title)) . '">
<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" /></a>');
$tb->addBody($content);
}
$tb->addActionAdd('<a href="index.php?modname=notes&op=addnotes">' . '<img src="' . getPathImage() . 'standard/add.png" title="' . $lang->def('_ADD') . '" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_ADD_NOTES') . '</a>');
$GLOBALS['page']->add(getTitleArea(array($lang->def('_NOTES')), 'notes') . '<div class="std_block">', 'content');
if (isset($_POST['result'])) {
switch ($_POST['result']) {
case "ok":
$GLOBALS['page']->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')), 'content');
case "err":
$GLOBALS['page']->add(getErrorUi($lang->def('_OPERATION_FAILURE')), 'content');
}
}
$GLOBALS['page']->add($tb->getTable() . $nav_bar->getNavBar($ini), 'content');
require_once _base_ . '/lib/lib.dialog.php';
setupHrefDialogBox('a[href*=delnotes]');
$GLOBALS['page']->add('</div>', 'content');
}
示例5: 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)
{
$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\tINSERT INTO " . $GLOBALS['prefix_lms'] . "_pollquest \r\n\t\t\t( id_poll, type_quest, title_quest, sequence, page ) VALUES \r\n\t\t\t( \t'" . $id_poll . "', \r\n\t\t\t\t'" . $this->getQuestionType() . "', \r\n\t\t\t\t'" . $_POST['title_quest'] . "',\r\n\t\t\t\t'" . $this->_getNextSequence($id_poll) . "', \r\n\t\t\t\t'" . $this->_getPageNumber($id_poll) . "' ) ")) {
$GLOBALS['page']->out(getErrorUi($lang->def('_POLL_ERR_INS_QUEST') . getBackUi('index.php?modname=question_poll&op=create&type_quest=' . $this->getQuestionType() . '&id_poll=' . $id_poll . '&back_poll=' . $url_encode, $lang->def('_BACK'))), 'content');
}
Util::jump_to('' . $back_poll);
}
$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_add_quest', 'index.php?modname=question_poll&op=create') . Form::openElementSpace() . Form::getHidden('type_quest', 'type_quest', $this->getQuestionType()) . Form::getHidden('id_poll', 'id_poll', $id_poll) . Form::getHidden('back_poll', 'back_poll', $url_encode) . Form::getTextarea($lang->def('_POLL_QUEST_TITLE'), 'title_quest', 'title_quest') . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('add_question', 'add_question', $lang->def('_INSERT')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
}
示例6: config
function config()
{
checkPerm('view');
require_once _base_ . '/lib/lib.tab.php';
require_once _base_ . '/lib/lib.form.php';
require_once _adm_ . '/class/class.conf.php';
$lang =& DoceboLanguage::createInstance('configuration', 'framework');
$active_tab = importVar('active_tab', false, 1);
//instance class-------------------------------------------
$conf = new Config_Framework();
$groups = $conf->getRegroupUnit();
cout(getTitleArea($lang->def('_CONFIGURATION')) . '<div class="std_block">');
//save page if require
if (isset($_POST['save_config'])) {
if ($conf->saveElement($active_tab)) {
cout(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
} else {
cout(getErrorUi($lang->def('_ERROR_IN_SAVE')));
}
}
cout('<div id="global_conf" class="yui-navset">' . '<ul class="yui-nav">');
while (list($id, $name) = each($groups)) {
// print the tab list
cout('<li' . ($id == $active_tab ? ' class="selected"' : '') . '><a href="#tab_g_' . $id . '"><em>' . $name['name'] . '</em></a></li>');
}
reset($groups);
cout('</ul>' . '<div class="yui-content">');
while (list($id, $name) = each($groups)) {
// print the tab content
cout('<div id="tab_g_' . $id . '">' . '<h2>' . $name['name'] . '</h2>' . '<p style="padding:4px">' . $name['descr'] . '</p>' . Form::openForm('conf_option_' . $id, 'index.php?modname=configuration&op=config') . Form::openElementSpace() . Form::getHidden('active_tab_' . $id, 'active_tab', $id));
switch ($id) {
case SMS_GROUP:
cout(show_sms_panel($lang) . '<br />');
break;
default:
cout('<br />');
}
cout('' . $conf->getPageWithElement($id) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save_config_' . $id, 'save_config', $lang->def('_SAVE')) . Form::getButton('undo_' . $id, 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::CloseForm() . '<br />' . '</div>');
}
cout('<script type="text/javascript">
var targets = YAHOO.util.Selector.query("span[id^=tt_target]");
new YAHOO.widget.Tooltip("tooltip_info",
{ context:targets,
effect:{effect:YAHOO.widget.ContainerEffect.FADE,duration:0.20}
});
</script>', 'scripts');
reset($groups);
cout('</div>' . '<div style="clear:left"> </div>' . '</div>' . '</div>');
cout('<script type="text/javascript">' . "\tnew YAHOO.widget.TabView('global_conf', {orientation:'left'});" . '</script>', 'scripts');
}
示例7: news
function news()
{
checkPerm('view');
require_once _base_ . '/lib/lib.form.php';
require_once _base_ . '/lib/lib.table.php';
require_once _base_ . '/lib/lib.navbar.php';
$mod_perm = checkPerm('mod', true);
$lang =& DoceboLanguage::createInstance('admin_news', 'lms');
$out =& $GLOBALS['page'];
$out->setWorkingZone('content');
$tb = new Table(Get::sett('visuItem'), $lang->def('_NEWS'), $lang->def('_NEWS_SUMMARY'));
$nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'link');
$ini = $nav_bar->getSelectedElement();
//search query
$query_news = "\r\n\tSELECT idNews, publish_date, title, short_desc, important\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_news_internal\r\n\tORDER BY important DESC, publish_date DESC\r\n\tLIMIT {$ini}," . Get::sett('visuItem');
$query_news_tot = "\r\n\tSELECT COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_news_internal ";
$re_news = sql_query($query_news);
list($tot_news) = sql_fetch_row(sql_query($query_news_tot));
$nav_bar->setElementTotal($tot_news);
$impo_gif = '<img src="' . getPathImage('lms') . 'standard/important.png" ' . 'title="' . $lang->def('_TITLE_IMPORTANT') . '" ' . 'alt="' . $lang->def('_IMPORTANT') . '" />';
$type_h = array('image', '', '', 'news_short_td');
$cont_h = array($impo_gif, $lang->def('_DATE'), $lang->def('_TITLE'), $lang->def('_SHORTDESC'));
if ($mod_perm) {
$cont_h[] = '<img src="' . getPathImage() . 'standard/moduser.png" title="' . $lang->def('_RECIPIENTS') . '" ' . 'alt="' . $lang->def('_RECIPIENTS') . '" />';
$type_h[] = 'image';
$cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_MOD') . '" ' . 'alt="' . $lang->def('_MOD') . '" />';
$type_h[] = 'image';
$cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" ' . 'alt="' . $lang->def('_DEL') . '"" />';
$type_h[] = 'image';
}
$tb->setColsStyle($type_h);
$tb->addHead($cont_h);
while (list($id_news, $publish_date, $title, $short_desc, $impo) = sql_fetch_row($re_news)) {
$cont = array($impo ? $impo_gif : '', Format::date($publish_date), $title, Util::cut($short_desc));
if ($mod_perm) {
$cont[] = '<a href="index.php?modname=internal_news&op=editviewer&load=1&id_news=' . $id_news . '" ' . 'title="' . $lang->def('_RECIPIENTS') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/moduser.png" alt="' . $lang->def('_RECIPIENTS') . ' : ' . $title . '" /></a>';
$cont[] = '<a href="index.php?modname=internal_news&op=modnews&id_news=' . $id_news . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $title . '" /></a>';
$cont[] = '<a href="index.php?modname=internal_news&op=delnews&id_news=' . $id_news . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . $title . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $title . '" /></a>';
}
$tb->addBody($cont);
}
require_once _base_ . '/lib/lib.dialog.php';
setupHrefDialogBox('a[href*=delnews]');
if ($mod_perm) {
$tb->addActionAdd('<a href="index.php?modname=internal_news&op=addnews" title="' . $lang->def('_NEW') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_NEW') . '</a>');
}
$out->add(getTitleArea($lang->def('_NEWS'), 'news') . '<div class="std_block">');
if (isset($_GET['result'])) {
switch ($_GET['result']) {
case "ok":
$out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
break;
case "err":
$out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
break;
case "err_del":
$out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
break;
}
}
if ($mod_perm) {
$form = new Form();
$how_much = Get::sett('visuNewsHomePage');
if (isset($_POST['save_homepage'])) {
$query_how_news = "\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_setting\r\n\t\t\tSET param_value = '" . abs((int) $_POST['howmuch']) . "'\r\n\t\t\tWHERE param_name = 'visuNewsHomePage'";
if (sql_query($query_how_news)) {
$how_much = abs((int) $_POST['howmuch']);
}
}
}
$out->add($tb->getTable() . $nav_bar->getNavBar($ini) . '</div>');
}
示例8: classroom
function classroom()
{
checkPerm('view');
require_once _base_ . '/lib/lib.form.php';
require_once _base_ . '/lib/lib.table.php';
$mod_perm = true;
// create a language istance for module admin_classroom
$lang =& DoceboLanguage::createInstance('admin_classroom', 'lms');
$out =& $GLOBALS['page'];
$out->setWorkingZone('content');
$tb = new Table(Get::sett('visuItem'), $lang->def('_CLASSROOM_CAPTION'), $lang->def('_CLASSROOM_SUMMARY'));
$tb->initNavBar('ini', 'link');
$tb->setLink('index.php?modname=reservation&op=classroom&id_course=' . $_SESSION['idCourse']);
$ini = $tb->getSelectedElement();
//search query of classrooms
$query_classroom = "\r\n\t\tSELECT idClassroom, name, description\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_classroom\r\n\t\tORDER BY name\r\n\t\tLIMIT {$ini}," . Get::sett('visuItem');
$query_classroom_tot = "\r\n\t\tSELECT COUNT(*)\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_classroom";
$re_classroom = sql_query($query_classroom);
list($tot_classroom) = sql_fetch_row(sql_query($query_classroom_tot));
$type_h = array('', 'news_short_td', "image", "image");
$cont_h = array($lang->def('_NAME'), $lang->def('_DESCRIPTION'));
if ($mod_perm) {
$cont_h[] = '<img src="' . getPathImage() . 'standard/edit.png" title="' . $lang->def('_TITLE_MOD_CLASSROOM') . '" ' . 'alt="' . $lang->def('_MOD') . '" />';
$type_h[] = 'image';
$cont_h[] = '<img src="' . getPathImage() . 'standard/delete.png" title="' . $lang->def('_DEL') . '" ' . 'alt="' . $lang->def('_DEL') . '"" />';
$type_h[] = 'image';
}
$tb->setColsStyle($type_h);
$tb->addHead($cont_h);
while (list($idClassroom, $name, $descr) = sql_fetch_row($re_classroom)) {
$cont = array($name, $descr);
if ($mod_perm) {
$cont[] = '<a href="index.php?modname=reservation&op=modclassroom&idClassroom=' . $idClassroom . '" ' . 'title="' . $lang->def('_TITLE_MOD_CLASSROOM') . ' : ' . $name . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $name . '" /></a>';
$cont[] = '<a href="index.php?modname=reservation&op=delclassroom&idClassroom=' . $idClassroom . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . $name . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . $name . '" /></a>';
}
$tb->addBody($cont);
}
if ($mod_perm) {
$tb->addActionAdd('<a href="index.php?modname=reservation&op=addclassroom" title="' . $lang->def('_TITLE_NEW_CLASSROOM') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_NEW_CLASSROOM') . '</a>');
}
$out->add(getTitleArea($lang->def('_TITLE_CLASSROOM'), 'classroom', $lang->def('_ALT_TITLE_CLASSROOM')) . '<div class="std_block">');
if (isset($_GET['result'])) {
switch ($_GET['result']) {
case "ok":
$out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
break;
case "err":
$out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
break;
case "err_del":
$out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
break;
}
}
$out->add(getBackUi('index.php?modname=reservation&op=reservation&active_tab=subscribed_user', $lang->def('_BACK')));
$out->add($tb->getTable() . $tb->getNavBar($ini, $tot_classroom) . '</div>');
}
示例9: create_report_name
function create_report_name()
{
checkPerm('mod');
require_once $GLOBALS['where_lms'] . '/admin/modules/report/class.report.php';
//reportbox class
require_once $GLOBALS['where_lms'] . '/lib/lib.report.php';
require_once _base_ . '/lib/lib.form.php';
load_categories();
$lang =& DoceboLanguage::createInstance('report');
$step_index = 0;
//$GLOBALS['page']->add( get_page_title($step_index) );
$_SESSION['report_tempdata'] = array();
$page_title = getTitleArea(array('index.php?modname=public_report_admin&op=reportlist' => $lang->def('_REPORT'), $lang->def('_NEW')), 'report');
$GLOBALS['page']->add($page_title . '<div class="std_block">', 'content');
$error = Get::req('err', DOTY_STRING, false);
switch ($error) {
case 'noname':
$GLOBALS['page']->add(getErrorUi($lang->def('_REPORT_NONAME')));
break;
}
$temp = array();
foreach ($GLOBALS['report_categories'] as $key => $value) {
$temp[$key] = $lang->def($value);
}
$GLOBALS['page']->add(Form::openForm('repcat_form', 'index.php?modname=public_report_admin&op=create_rows') . Form::getHidden('set_category', 'set_category', 1) . Form::getTextField($lang->def('_NAME'), 'report_name', 'report_name', '200') . Form::getDropDown($lang->def('_SELECT_REPORT_CATEGORY'), '', 'id_report', $temp) . Form::openButtonSpace() . Form::getButton('', 'cat_forward', $lang->def('_NEXT'), false) . Form::getButton('', 'cat_undo', $lang->def('_UNDO'), false) . Form::closeButtonSpace() . Form::closeForm(), 'content');
/*$lang->def('_REPORT_SCHEDMAN');$lang->def('_REPORT_SCHEDMAN_DESC');*/
$GLOBALS['page']->add('</div>', 'content');
}
示例10: savesel
function savesel()
{
checkPerm('view');
require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
require_once _base_ . '/lib/lib.form.php';
$lang =& DoceboLanguage::createInstance('register', 'lms');
$mand_sym = '<span class="mandatory">*</span>';
$extra_field = new FieldList();
$GLOBALS['page']->add(getTitleArea($lang->def('_MYGROUP'), 'mygroup') . '<div class="std_block">', 'content');
$selected = array();
if (isset($_POST['group_sel'])) {
$selected = $_POST['group_sel'];
} elseif (isset($_POST['group_sel_implode'])) {
$selected = explode(',', $_POST['group_sel_implode']);
}
$play_field = $extra_field->playFieldsForUser(getLogUserId(), $selected, false, false, array('readonly'));
if (isset($_POST['save_field']) || $play_field === false || $play_field == '') {
$re_filled = $extra_field->isFilledFieldsForUser(getLogUserId(), $selected);
if (!$re_filled) {
$GLOBALS['page']->add(getErrorUi($lang->def('_SOME_MANDATORY_EMPTY')), 'content');
} else {
$acl =& Docebo::user()->getAcl();
$acl_man =& Docebo::user()->getAclManager();
$groups =& $acl_man->getAllGroupsId(array('free', 'moderate'));
$groups_id = array_keys($groups);
$user_group = $acl->getSTGroupsST(getLogUserId());
$add_groups = array_diff($selected, $user_group);
$del_groups = array_diff($groups_id, $selected);
$moderate_add = false;
if (!empty($add_groups)) {
while (list(, $idst) = each($add_groups)) {
if ($groups[$idst]['type'] == 'free') {
$acl_man->addToGroup($idst, getLogUserId());
} elseif ($groups[$idst]['type'] == 'moderate') {
$acl_man->addToWaitingGroup($idst, getLogUserId());
$moderate_add = true;
}
}
}
if ($moderate_add === true) {
require_once _base_ . '/lib/lib.eventmanager.php';
// message to user that is odified
$msg_composer = new EventMessageComposer();
$msg_composer->setSubjectLangText('email', '_TO_APPROVE_GROUP_USER_SBJ', false);
$msg_composer->setBodyLangText('email', '_TO_APPROVE_GROUP_USER_TEXT', array('[url]' => Get::sett('url')));
$msg_composer->setBodyLangText('sms', '_TO_APPROVE_GROUP_USER_TEXT_SMS', array('[url]' => Get::sett('url')));
$idst_approve = $acl->getRoleST('/framework/admin/directory/editgroup');
$recipients = $acl_man->getAllRoleMembers($idst_approve);
createNewAlert('UserGroupModerated', 'directory', 'moderate', '1', 'User group subscription to moderate', $recipients, $msg_composer);
}
if (!empty($del_groups)) {
while (list(, $idst_group) = each($del_groups)) {
$extra_field->removeUserEntry(getLogUserId(), $idst_group);
$acl_man->removeFromGroup($idst_group, getLogUserId());
}
}
// Save fields
$extra_field->storeFieldsForUser(getLogUserId());
Util::jump_to('index.php?modname=mygroup&op=group');
}
}
$GLOBALS['page']->add('<div class="reg_note">' . $lang->def('_GROUPS_FIELDS') . '<ul class="reg_instruction">' . '<li>' . str_replace('[mandatory]', $mand_sym, $lang->def('_REG_MANDATORY')) . '</li>' . '</ul>' . '</div>' . Form::openForm('group_subscription', 'index.php?modname=mygroup&op=savesel') . Form::openElementSpace() . Form::getHidden('group_sel_implode', 'group_sel_implode', isset($_POST['group_sel_implode']) ? $_POST['group_sel_implode'] : implode(',', $selected)) . $play_field . Form::getBreakRow() . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save_field', 'save_field', $lang->def('_SAVE')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
}
示例11: performAction
/**
* this function manage the entire profile, identify the action to perform and do the right sequence of action
* @return string the html to display
*/
function performAction($viewer = false, $start_action = false)
{
$this->setViewer($viewer);
if ($start_action === false) {
$start_action = 'profileview';
}
$ap = Get::req($this->_varname_action, DOTY_MIXED, $start_action);
if (isset($_POST['undo'])) {
$ap = 'profileview';
}
switch ($ap) {
case "goprofile":
$ext_prof = new UserProfile(Get::req('id_user', DOTY_INT, 0), false);
$ext_prof->init($this->_module_name, $this->_platform, $this->_std_query, $this->_varname_action);
return $ext_prof->getProfile();
break;
// display the mod info gui -------------------------------
// display the mod info gui -------------------------------
case "mod_profile":
return $this->getModUser();
break;
case "mod_password":
return $this->_up_viewer->getUserPwdModUi();
break;
case "mod_policy":
return $this->_up_viewer->modUserPolicyGui();
break;
// save modified info of the user -------------------------
// save modified info of the user -------------------------
case "save_policy":
if ($this->_up_data_man->setFieldAccessList($this->_id_user, $this->_up_viewer->getFilledPolicy())) {
// all ok --------------------------------------
$this->_up_viewer->unloadUserData();
if ($this->_end_url !== false) {
Util::jump_to($this->_end_url);
}
return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPOLICY')) . $this->getProfile();
} else {
// some error saving ---------------------------
return getErrorUi($this->_lang->def('_FAILSAVEPOLICY')) . $this->_up_viewer->modUserPolicyGui();
}
break;
// save modified info of the user -------------------------
// save modified info of the user -------------------------
case "saveinfo":
if (!$this->checkUserInfo()) {
// some error in data filling ------------------
return getErrorUi($this->_last_error) . $this->getModUser();
}
if ($this->saveUserInfo()) {
// all ok --------------------------------------
$this->_up_viewer->unloadUserData();
if ($this->_end_url !== false) {
Util::jump_to($this->_end_url);
}
if (isset($_GET['modname']) && $_GET['modname'] == 'reservation') {
require_once $GLOBALS['where_lms'] . '/lib/lib.reservation.php';
$id_event = Get::req('id_event', DOTY_INT, 0);
$man_res = new Man_Reservation();
$result = $man_res->addSubscription(getLogUserId(), $id_event);
Util::jump_to('index.php?modname=reservation&op=reservation');
} else {
return getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPROFILE')) . $this->getProfile();
}
} else {
// some error saving ---------------------------
return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->getModUser();
}
break;
// save password -----------------------------------------
// save password -----------------------------------------
case "savepwd":
$re = $this->_up_viewer->checkUserPwd();
if ($re !== true) {
// some error in data filling --------------------
return getErrorUi($re) . $this->_up_viewer->getUserPwdModUi();
}
if ($this->saveUserPwd()) {
// all ok ----------------------------------------
$this->_up_viewer->unloadUserData();
if ($this->_end_url !== false) {
Util::jump_to($this->_end_url);
}
$out = getResultUi($this->_lang->def('_OPERATION_SUCCESSFULPWD'));
if (Get::sett('profile_only_pwd') == 'on') {
// maybe is better if we display only the confirmation message if all is ok, but if you
// want something else add the code here
} else {
$out .= $this->getProfile();
}
return $out;
} else {
// some error saving ----------------------------
return getErrorUi($this->_lang->def('_OPERATION_FAILURE')) . $this->_up_viewer->getUserPwdModUi();
}
break;
//.........这里部分代码省略.........
示例12: showResult
function showResult($object_test, $id_param)
{
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.test.php';
require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
require_once $GLOBALS['where_lms'] . '/lib/lib.test.php';
$lang =& DoceboLanguage::createInstance('test');
$id_test = $object_test->getId();
$id_reference = getLoParam($id_param, 'idReference');
$url_coded = urlencode(serialize($object_test->back_url));
$id_track = retriveTrack($id_reference, $id_test, Docebo::user()->getIdst());
if ($id_track === false) {
$GLOBALS['page']->add(getErrorUi($lang->def('_TEST_TRACK_FAILURE') . getBackUi(Util::str_replace_once('&', '&', $object_test->back_url), $lang->def('_BACK'))), 'content');
}
$test_man = new TestManagement($id_test);
$play_man = new PlayTestManagement($id_test, Docebo::user()->getIdst(), $id_track, $test_man);
$test_info = $test_man->getTestAllInfo();
$track_info = $play_man->getTrackAllInfo();
$previous_page = importVar('previous_page', false, false);
$new_info = array('last_page_seen' => $previous_page, 'score_status' => 'doing');
if (isset($_POST['page_to_save']) && ($_POST['page_to_save'] > $track_info['last_page_saved'] || $test_info['mod_doanswer'])) {
$play_man->storePage($_POST['page_to_save'], $test_info['mod_doanswer']);
$play_man->closeTrackPageSession($_POST['page_to_save']);
}
$now = date('Y-m-d H:i:s');
$point_do = 0;
$max_score = 0;
$num_manual = 0;
$manual_score = 0;
$point_do_cat = array();
$re_visu_quest = sql_query("SELECT idQuest \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_testtrack_quest \r\n\tWHERE idTrack = '" . $id_track . "' ");
while (list($id_q) = sql_fetch_row($re_visu_quest)) {
$quest_see[] = $id_q;
}
$reQuest = sql_query("\r\n\tSELECT q.idQuest, q.type_quest, t.type_file, t.type_class, q.idCategory \r\n\tFROM %lms_testquest AS q JOIN " . $GLOBALS['prefix_lms'] . "_quest_type AS t\r\n\tWHERE q.idTest = '" . $id_test . "' AND q.type_quest = t.type_quest AND q.idQuest IN (" . implode($quest_see, ',') . ") \r\n\tORDER BY q.sequence");
//#2093: Conto le domande
$tot_questions = 0;
$tot_answers = 0;
$tot_rightanswers = 0;
$tot_questions = $test_man->getNumberOfQuestion();
while (list($id_quest, $type_quest, $type_file, $type_class, $id_cat) = sql_fetch_row($reQuest)) {
require_once $GLOBALS['where_lms'] . '/modules/question/' . $type_file;
$quest_point_do = 0;
$quest_obj = new $type_class($id_quest);
$quest_point_do = $quest_obj->userScore($id_track);
$quest_max_score = $quest_obj->getMaxScore();
if ($quest_obj->getScoreSetType() == 'manual') {
++$num_manual;
$manual_score = round($manual_score + $quest_max_score, 2);
}
//#2093: Conto le risposte, conto le risposte corrette
$tot_answers++;
if ($quest_point_do == $quest_max_score) {
$tot_rightanswers++;
}
$point_do = round($point_do + $quest_point_do, 2);
$max_score = round($max_score + $quest_max_score, 2);
if (isset($point_do_cat[$id_cat])) {
$point_do_cat[$id_cat] = round($quest_point_do + $point_do_cat[$id_cat], 2);
} else {
$point_do_cat[$id_cat] = round($quest_point_do, 2);
}
}
if ($test_info['point_type'] == '1') {
// percentage score (%)
// x:100=$point_do:$max_score
//#2093: calcolo effettivo solo se ho tutte le risposte
if ($tot_questions == $tot_answers) {
$point_do = round(100 * $point_do / $max_score);
//$max_score$test_info['point_required']
} else {
$point_do = round(100 * $tot_rightanswers / $tot_questions);
//$max_score$test_info['point_required']
}
}
$save_score = $point_do;
// save new status in track
if ($point_do >= $test_info['point_required']) {
$next_status = 'passed';
if ($test_info['show_only_status']) {
$score_status = 'passed';
}
} else {
$next_status = 'failed';
if ($test_info['show_only_status']) {
$score_status = 'not_passed';
}
}
if (!$test_info['show_only_status']) {
if ($num_manual != 0) {
$score_status = 'not_checked';
} else {
$score_status = 'valid';
}
}
$test_track = new Track_Test($id_track);
$test_track->setDate($now);
//.........这里部分代码省略.........
示例13: archiveList
function archiveList()
{
require_once _base_ . '/lib/lib.table.php';
$lang =& DoceboLanguage::createInstance('advice');
$mod_perm = checkPerm('mod', true);
$out = $GLOBALS['page'];
$out->setWorkingZone('content');
$nav_bar = new NavBar('ini', Get::sett('visuItem'), 0, 'button');
$ini = $nav_bar->getSelectedElement();
$query_my_arch_advice = "\r\n\t\tSELECT DISTINCT idAdvice\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_adviceuser\r\n\t\tWHERE idUser = '" . getLogUserId() . "' AND archivied = '1'";
$re_my_arch_advice = sql_query($query_my_arch_advice);
while (list($id) = sql_fetch_row($re_my_arch_advice)) {
$advice_arch[] = $id;
}
if (!empty($advice_arch)) {
$query_advice = "\r\n\t\t\tSELECT idAdvice, posted, title, description, important, author\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_advice\r\n\t\t\tWHERE idCourse='" . $_SESSION['idCourse'] . "' AND idAdvice IN ( " . implode($advice_arch, ',') . " )\r\n\t\t\tORDER BY posted DESC\r\n\t\t\tLIMIT {$ini}," . Get::sett('visuItem');
$re_advice = sql_query($query_advice);
list($numofadvice) = sql_fetch_row(sql_query("\r\n\t\t\tSELECT COUNT(DISTINCT idAdvice)\r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_advice\r\n\t\t\tWHERE idCourse='" . $_SESSION['idCourse'] . "' AND idAdvice IN ( " . implode($advice_arch, ',') . " )"));
$nav_bar->setElementTotal($numofadvice);
if (isset($_GET['result'])) {
switch ($_GET['result']) {
case "ok":
$out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
break;
case "err":
$out->add(getErrorUi($lang->def('_ERR_INSERT')));
break;
case "err_user":
$out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
break;
}
}
while (list($idA, $posted, $title, $description, $impo, $author) = sql_fetch_row($re_advice)) {
$out->add('<div class="list_block">' . '<h2 class="heading">');
if ($impo) {
$out->add('<img src="' . getPathImage() . 'standard/important.png" alt="' . $lang->def('_IMPORTANT') . '" /> ');
} else {
$out->add('');
}
$out->add($title . '</h2>' . '<div class="content"><p class="publish-date">' . Format::date($posted) . '</p>' . $description . '</div>' . '<div class="actions">');
if ($mod_perm) {
$out->add('<ul class="link_list_inline">' . '<li><a class="ico-wt-sprite subs_users" href="index.php?modname=advice&op=modreader&id_advice=' . $idA . '&load=1" title="' . $lang->def('_VIEW_PERMISSION') . ' : ' . $title . '">' . '<span>' . $lang->def('_MOD') . '</span></a></li>' . '<li><a class="ico-wt-sprite subs_mod" href="index.php?modname=advice&op=modadvice&idAdvice=' . $idA . '" title="' . $lang->def('_MOD') . ' : ' . $title . '">' . '<span>' . $lang->def('_MOD') . '</span></a></li>' . '<li><a class="ico-wt-sprite subs_del" href="index.php?modname=advice&op=deladvice&idAdvice=' . $idA . '" title="' . $lang->def('_DEL') . ' : ' . $title . '">' . '<span>' . $lang->def('_DEL') . '</span></a></li>' . '</ul>');
require_once _base_ . '/lib/lib.dialog.php';
setupHrefDialogBox('a[href*=deladvice]');
}
$out->add('</div>' . '</div><br />');
}
}
$form = new Form();
$out->add($form->getHidden('archive_status', 'archive_status', '1') . $nav_bar->getNavBar($ini));
}
示例14: view_report_certificate
function view_report_certificate()
{
checkPerm('view');
require_once _lms_ . '/lib/lib.certificate.php';
require_once _lms_ . '/lib/lib.course.php';
$out =& $GLOBALS['page'];
$out->setWorkingZone('content');
$lang =& DoceboLanguage::createInstance('certificate', 'lms');
$deletion = importVar('deletion', true, 0);
if ($deletion) {
switch ($deletion) {
case 1:
$out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
break;
case 2:
$out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
break;
case 3:
$out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
break;
}
}
$certificate = new Certificate();
$id_certificate = importVar('id_certificate', true, 0);
$id_course = importVar('id_course', true, 0);
$selection = importVar('selection', false, array());
//all possible selected values
$selected = importVar('selected', false, array());
//effectively selected values with checkbox
$sel = importVar('old_selection', false, '');
//selected values from previous table pages
if ($sel != '') {
$total_selection = explode(',', $sel);
} else {
$total_selection = array();
}
//update total selection
foreach ($selection as $key => $val) {
if (in_array($val, $selected)) {
if (!in_array($val, $total_selection)) {
$total_selection[] = $val;
}
} else {
$index = array_search($val, $total_selection);
if ($index !== false) {
array_splice($total_selection, $index, 1);
}
}
}
$search_filter = importVar('filter', false, '');
$only_released = importVar('only_released', true, 0);
//which command?
if (importVar('search_button', false, false) !== false) {
}
if (importVar('reset_button', false, false) !== false) {
$search_filter = '';
$only_released = 0;
}
if (importVar('print_button', false, false) !== false) {
}
$numtablerows = Get::sett('visuItem', 25);
$tb = new Table($numtablerows, $lang->def('_CERTIFICATE_VIEW_CAPTION'), $lang->def('_CERTIFICATE_VIEW_CAPTION'));
$tb->initNavBar('ini', 'button');
$ini = $tb->getSelectedElement();
$ini_param = Get::req('ini', DOTY_MIXED, array());
//floor($ini / Get::sett('visuItem', 25));
if (empty($ini_param)) {
$ini_param = 1;
} else {
list($ini_param) = each($ini_param);
}
$tca = $GLOBALS['prefix_lms'] . "_certificate_assign as ca";
$tcc = $GLOBALS['prefix_lms'] . "_certificate_course as cc";
$tcu = $GLOBALS['prefix_lms'] . "_courseuser as cu";
$tu = $GLOBALS['prefix_fw'] . "_user as u";
$where = "";
if ($search_filter != '') {
$where .= " AND (u.userid LIKE '%" . $search_filter . "%' OR u.lastname LIKE '%" . $search_filter . "%' OR u.firstname LIKE '%" . $search_filter . "%') ";
}
if ($only_released > 0) {
$where = " AND ca.on_date " . ($only_released == 1 ? "IS NOT" : "IS") . " NULL ";
}
//$where .= " AND ".$aval_status." ".($only_released==1 ? "<" : ">=")." cu.status ";
list($aval_status) = sql_fetch_row(sql_query("SELECT available_for_status FROM " . $tcc . " " . " WHERE id_certificate='" . (int) $id_certificate . "' AND id_course='" . (int) $id_course . "'"));
switch ($aval_status) {
case AVS_ASSIGN_FOR_ALL_STATUS:
$aval_status = " 1 ";
break;
case AVS_ASSIGN_FOR_STATUS_INCOURSE:
$aval_status = " cu.status = " . _CUS_BEGIN . " ";
break;
case AVS_ASSIGN_FOR_STATUS_COMPLETED:
$aval_status = " cu.status = " . _CUS_END . " ";
break;
}
list($totalrows) = sql_fetch_row(sql_query("SELECT COUNT(*) " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where));
$query = "SELECT u.userid, u.firstname, u.lastname, cu.date_complete, ca.on_date, cu.idUser as id_user, cu.status " . " FROM ( " . $tu . " JOIN " . $tcu . " ON (u.idst = cu.idUser) ) LEFT JOIN " . $tca . " " . " ON ( ca.id_course = cu.idCourse AND ca.id_user=cu.idUser ) " . " WHERE (ca.id_certificate='" . (int) $id_certificate . "' OR ca.id_certificate IS NULL) AND " . $aval_status . " " . " AND cu.idCourse='" . (int) $id_course . "' " . $where . " ORDER BY u.userid LIMIT " . $ini . ", " . $numtablerows;
//cout('<pre>'.print_r($_POST, true).'</pre>');
//cout($query);
$res = sql_query($query);
//.........这里部分代码省略.........
示例15: edit
/**
* 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&op=edit&type_quest=' . $this->getQuestionType() . '&id_quest=' . $this->id . '&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('&', '&', $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('&', '&', $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('&', '&', $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('&', '&', $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&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');
}