Example #1
0
/**
 * @package  DoceboSCS
 * @version  $Id: functions.php 113 2006-03-08 18:08:42Z ema $
 */
function getWriteBox(&$out, &$lang)
{
    require_once _base_ . '/lib/lib.form.php';
    $res = "";
    if (isset($_POST["refreshrate"])) {
        $_SESSION["refreshrate"] = (int) $_POST["refreshrate"];
    }
    $form = new Form();
    $res .= $form->openForm('refresh_form', getPopupBaseUrl() . '&amp;op=refresh') . '<div class="refresh_form">';
    $res .= '<label for="refreshrate">' . $lang->def("_AUTOREFRESH") . '</label>' . $form->getInputTextfield('refreshtext', 'refreshrate', 'refreshrate', $_SESSION["refreshrate"], strip_tags($lang->def("_AUTOREFRESH")), 1000, '');
    $res .= $lang->def("_SECONDS") . "\n";
    $res .= $form->getButton('refresh', 'refresh', $lang->def("_REFRESH"), 'button_refresh');
    $res .= '</div>' . $form->closeForm();
    $res .= $form->openForm('msg_form', getPopupBaseUrl() . '&amp;op=send') . '<div class="msg_form">';
    $res .= '<label for="msgtxt">' . $lang->def("_MSGTXT") . '</label>' . $form->getInputTextfield('msgtext', 'msgtxt', 'msgtxt', '', strip_tags($lang->def("_MSGTXT")), 1000, '');
    $res .= $form->getButton('send', 'send', $lang->def("_SEND"), 'button_send');
    $res .= $form->getButton('savechat', 'savechat', $lang->def("_SAVE"), 'button_save');
    $res .= '</div>' . $form->closeForm();
    $res .= "<script type=\"text/javascript\">\n";
    $res .= "document.forms[1].msgtxt.focus();";
    $res .= "</script>\n";
    $res .= '<div class="emoticons_container"><b>';
    $res .= $lang->def("_EMOTICONS") . "</b>:&nbsp;\n";
    $res .= $GLOBALS["chat_emo"]->emoticonList();
    $res .= '</div>';
    if ($_SESSION["refreshrate"] > 0) {
        $ref_meta = "<meta http-equiv=refresh content=\"" . $_SESSION["refreshrate"] . "; url=";
        $ref_meta .= getPopupBaseUrl() . "&amp;op=refresh\" />\n";
        $out->add($ref_meta, "page_head");
    }
    return $res;
}
Example #2
0
 /**
  * this function write a gui line for answer insertion,projected for modify
  * 
  * @param  int	$i	indicate the line number
  * @return nothing
  * 
  * @access private
  * @author Fabio Pirovano (fabio@docebo.com)
  */
 function _lineModAnswer($i)
 {
     $lang =& DoceboLanguage::createInstance('test');
     $GLOBALS['page']->add('<tr class="line_answer">' . '<td class="image">' . '<label class="access-only" for="is_correct_' . $i . '">' . $lang->def('_TEST_CORRECT') . '</label><br /><br />', 'content');
     if (isset($_POST['answer_id'][$i])) {
         $GLOBALS['page']->add('<input type="hidden" id="answer_id_' . $i . '" name="answer_id[' . $i . ']" value="' . $_POST['answer_id'][$i] . '" />', 'content');
     }
     $GLOBALS['page']->add('' . '<label class="access-only" for="answer_' . $i . '">' . $lang->def('_TEST_TEXT_ANSWER') . '</label>' . Form::getInputTextfield('', 'answer_' . $i, 'answer[' . $i . ']', isset($_POST['answer'][$i]) ? stripslashes($_POST['answer'][$i]) : '', false, '25', '') . '</td>' . '<td class="image">' . '<label class="access-only" for="answer_' . $i . '">' . $lang->def('_TEST_TEXT_ANSWER') . '</label>' . Form::getInputTextfield('', 'tolerance_' . $i, 'tolerance[' . $i . ']', isset($_POST['tolerance'][$i]) ? stripslashes($_POST['tolerance'][$i]) : '', false, '25', '') . '</td>' . '<td class="image">' . '<label class="access-only" for="comment_' . $i . '">' . $lang->def('_COMMENTS') . '</label>' . '<textarea class="test_comment" id="comment_' . $i . '" name="comment[' . $i . ']" rows="6">' . (isset($_POST['comment'][$i]) ? stripslashes($_POST['comment'][$i]) : '') . '</textarea>' . '</td>' . '<td class="test_ifcorrect">' . '</td>' . '<td class="align_right">' . '<label class="access-only" for="score_correct_' . $i . '">' . $lang->def('_TEST_IFCORRECT') . '</label>' . '<input type="text" class="test_point" id="score_correct_' . $i . '" name="score_correct[' . $i . ']" alt="' . $lang->def('_TEST_IFCORRECT') . '" size="5" value="' . (isset($_POST['score_correct'][$i]) ? $_POST['score_correct'][$i] : '0.0') . '" />' . '</td>' . '</tr>' . "\n", 'content');
 }
Example #3
0
function showWriteForm(&$out, &$lang)
{
    require_once _base_ . '/lib/lib.form.php';
    $form = new Form();
    $res = "";
    $res .= $form->openForm('msg_form', getPopupBaseUrl() . '&amp;op=send') . '<div class="msg_form">';
    $res .= '<label for="msgtxt">' . $lang->def("_MSGTXT") . '</label>' . $form->getInputTextfield('msgtext', 'msgtxt', 'msgtxt', '', strip_tags($lang->def("_MSGTXT")), 1000, '');
    $res .= $form->getButton('send', 'send', $lang->def("_SEND"), 'button_send');
    $res .= $form->getButton('savechat', 'savechat', $lang->def("_SAVE"), 'button_save');
    $res .= '</div>' . $form->closeForm();
    $res .= "<script type=\"text/javascript\">\n";
    $res .= "document.forms[0].msgtxt.focus();";
    $res .= "</script>\n";
    $res .= $GLOBALS["chat_emo"]->emoticonList();
    $out->add($res);
}
/**
 * @package  DoceboLms
 * @version  $Id: meta_certificate.php,v 1
 * @author	 Marco Valloni <marco [at] docebo [dot] com>
 */
function metaCertificate()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    $mod_perm = checkPerm('mod', true);
    $lang =& DoceboLanguage::createInstance('certificate', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_META_CERTIFICATE_CAPTION'), $lang->def('_META_CERTIFICATE_SUMMARY'));
    $tb->initNavBar('ini', 'link');
    $tb->setLink("index.php?modname=meta_certificate&amp;op=meta_certificate");
    $ini = $tb->getSelectedElement();
    $form = new Form();
    if (isset($_POST['toggle_filter'])) {
        unset($_POST['filter_text']);
    }
    //search query of certificates
    $query_certificate = "\r\n\tSELECT id_certificate, code, name, description\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_certificate" . " WHERE meta = 1";
    if (isset($_POST['filter'])) {
        if ($_POST['filter_text'] !== '') {
            $query_certificate .= " AND ( name LIKE '%" . $_POST['filter_text'] . "%'" . " OR code LIKE '%" . $_POST['filter_text'] . "%' )";
        }
    }
    $query_certificate .= " ORDER BY id_certificate\r\n\tLIMIT {$ini}," . Get::sett('visuItem');
    $query_certificate_tot = "\r\n\tSELECT COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_certificate";
    $re_certificate = sql_query($query_certificate);
    list($tot_certificate) = sql_fetch_row(sql_query($query_certificate_tot));
    $type_h = array('', '', '', 'image', 'image');
    $cont_h = array($lang->def('_CODE'), $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
    if ($mod_perm) {
        $cont_h[] = Lang::t('_TEMPLATE', 'certificate');
    }
    $cont_h[] = '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('_PREVIEW') . '" />';
    if ($mod_perm) {
        $cont_h[] = Get::img('standard/moduser.png', Lang::t('_TITLE_ASSIGN_META_CERTIFICATE', 'certificate'));
        $type_h[] = 'image';
        $cont_h[] = Get::sprite('subs_print', Lang::t('_TITLE_CREATE_META_CERTIFICATE', 'certificate'));
        $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_certificate, $code, $name, $descr) = sql_fetch_row($re_certificate)) {
        $title = strip_tags($name);
        $cont = array($code, $name, Util::cut($descr));
        if ($mod_perm) {
            $cont[] = '<a href="index.php?modname=meta_certificate&amp;op=elemmetacertificate&amp;id_certificate=' . $id_certificate . '" ' . 'title="' . Lang::t('_TEMPLATE', 'certificate') . '">' . Lang::t('_TEMPLATE', 'certificate') . '</a>';
        }
        $cont[] = '<a href="index.php?modname=meta_certificate&amp;op=preview&amp;id_certificate=' . $id_certificate . '">' . '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('_PREVIEW') . ' : ' . $title . '" /></a>';
        if ($mod_perm) {
            $cont[] = '<a href="index.php?modname=meta_certificate&amp;op=assign&amp;id_certificate=' . $id_certificate . '" ' . 'title="' . $lang->def('_TITLE_ASSIGN_META_CERTIFICATE') . ' : ' . $name . '">' . Get::img('standard/moduser.png', Lang::t('_TITLE_ASSIGN_META_CERTIFICATE', 'certificate')) . '</a>';
            /*
            			$cont[] =	'<a href="index.php?modname=meta_certificate&amp;op=create&amp;id_certificate='.$id_certificate.'" '
            						.'title="'.$lang->def('_TITLE_CREATE_META_CERTIFICATE').' : '.$name.'">'
            						.Get::img('course/certificate.png', Lang::t('_TITLE_CREATE_META_CERTIFICATE', 'certificate'))
            						.'</a>';*/
            $cont[] = Get::sprite_link('subs_print', 'index.php?modname=meta_certificate&amp;op=create&amp;id_certificate=' . $id_certificate, Lang::t('_TITLE_CREATE_META_CERTIFICATE', 'certificate'));
            $cont[] = '<a href="index.php?modname=meta_certificate&amp;op=modmetacertificate&amp;id_certificate=' . $id_certificate . '" ' . 'title="' . $lang->def('_MOD') . ' : ' . $name . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . $title . '" /></a>';
            $cont[] = '<a href="index.php?modname=meta_certificate&amp;op=delmetacertificate&amp;id_certificate=' . $id_certificate . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . $name . '">' . '<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*=delmetacertificate]');
    if ($mod_perm) {
        $tb->addActionAdd('<a class="ico-wt-sprite subs_add" href="index.php?modname=meta_certificate&amp;op=addmetacertificate" title="' . $lang->def('_NEW_CERTIFICATE') . '"><span>' . $lang->def('_NEW_CERTIFICATE') . '</span></a>');
    }
    $out->add(getTitleArea($lang->def('_TITLE_META_CERTIFICATE'), 'certificate') . '<div class="std_block">');
    $out->add($form->openForm('certificate_filter', 'index.php?modname=meta_certificate&amp;op=meta_certificate') . '<div class="quick_search_form">
			<div>
				<div class="simple_search_box">' . Form::getInputTextfield("search_t", "filter_text", "filter_text", Get::req('filter_text', DOTY_MIXED, ''), '', 255, '') . Form::getButton("filter", "filter", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("toggle_filter", "toggle_filter", Lang::t('_RESET', 'standard'), "reset_b") . '</div>
			</div>
		</div>' . $form->closeForm());
    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($tb->getTable() . $tb->getNavBar($ini, $tot_certificate) . '</div>');
}
Example #5
0
<?php

echo getTitleArea(array('index.php?r=alms/communication/show' => Lang::t('_COMMUNICATIONS', 'communication'), Lang::t('_ADD', 'communication')));
?>
<div class="std_block">
<?php 
echo Form::openForm('add_comm', 'index.php?r=alms/communication/insert', false, false, 'multipart/form-data') . Form::getHidden('title', 'title', 255, Get::req('title', DOTY_MIXED, $data['title'])) . Form::openElementSpace() . Form::getTextfield(Lang::t('_TITLE', 'communication'), 'title', 'title', 255, Get::req('title', DOTY_MIXED, $data['title'])) . Form::getDatefield(Lang::t('_DATE', 'communication'), 'publish_date', 'publish_date', Get::req('publish_date', DOTY_MIXED, $data['publish_date'])) . Form::getRadioSet(Lang::t('_TYPE', 'communication'), 'type_of', 'type_of', array(Lang::t('_NONE', 'communication') => 'none', Lang::t('_LONAME_item', 'storage') => 'file', Lang::t('_LONAME_scormorg', 'storage') => 'scorm'), Get::req('type_of', DOTY_STRING, $data['type_of'])) . Form::getTextarea(Lang::t('_DESCRIPTION', 'communication'), 'description', 'description', Get::req('description', DOTY_MIXED, $data['description'])) . '<div class="quick_search_form qsf_left">' . '<div class="form_line_l">' . '<label class="label_effect" for="set_course">' . Lang::t('_COURSE', 'course') . '</label>&nbsp;' . Form::getInputTextfield('search_t', 'set_course', 'set_course', '', '', 255, '') . '<div id="set_course_container"></div>' . '</div>' . '</div>' . Form::getHidden('id_course', 'id_course', $data['id_course']) . Form::getHidden('id_category', 'id_category', $data['id_category']) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', Lang::t('_SAVE', 'communication')) . Form::getButton('undo', 'undo', Lang::t('_UNDO', 'communication')) . Form::closeButtonSpace() . Form::closeForm();
?>
</div>
<script type="text/javascript">
//courses autocomplete
YAHOO.util.Event.onDOMReady(function() {
	var oDS = new YAHOO.util.XHRDataSource('ajax.adm_server.php?mn=course&plf=lms&op=course_autocomplete');
	oDS.responseType = YAHOO.util.XHRDataSource.TYPE_JSON;
	oDS.responseSchema = {
		resultsList : "courses",
		fields: ["cname", "id_course", "code", "name", "code_highlight", "name_highlight", "has_editions", "editions", "has_classrooms", "classrooms"]
	};

	var oAC = new YAHOO.widget.AutoComplete("set_course", "set_course_container", oDS);
	oAC.forceSelection = true;
	oAC.useShadow = true;
	oAC.resultTypeList = false;
	oAC.formatResult = function(oResultData, sQuery, sResultMatch) {
		return (oResultData.code_highlight != "" ? '['+oResultData.code_highlight+'] ' : '')+oResultData.name_highlight;
	};
	oAC.itemSelectEvent.subscribe(function(sType, oArgs) {
		var D = YAHOO.util.Dom;
		D.get('id_course').value = oArgs[2].id_course;
	});
	oAC.generateRequest = function(sQuery) { return "&results=20&query=" + sQuery; };
Example #6
0
 function loadCatalogueSelector($noprint = false)
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('catalogue', 'lms');
     // Filter
     $this->filter['catalogue_name'] = isset($_POST['cat_filter_name']) ? $_POST['cat_filter_name'] : '';
     if ($this->show_filter === true) {
         $form = new Form();
         /*$GLOBALS['page']->add(
         			$form->getOpenFieldset($lang->def('_SEARCH'))
         			.Form::getTextfield($lang->def('_NAME'), 'cat_filter_name', 'cat_filter_name', '255',
         				( isset($_POST['cat_filter_name']) ? $_POST['cat_filter_name'] : '' ))
         			.$form->openButtonSpace()
         			.$form->getButton('catalogue_filter', 'catalogue_filter', $lang->def('_SEARCH'))
         			.$form->closeButtonSpace()
         			.$form->getCloseFieldset()
         		, 'content');
         		*/
         cout('<div class="quick_search_form">' . '<div>' . Form::getInputTextfield("search_t", "cat_filter_name", "cat_filter_name", Get::req('cat_filter_name', DOTY_MIXED, ''), '', 255, '') . Form::getButton("catalogue_filter", "catalogue_filter", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>', 'content');
     }
     // End Filter
     $tb = new Table(Get::sett('visuItem'), $lang->def('_CATALOGUE'), $lang->def('_CATALOGUE_SUMMARY'));
     $tb->initNavBar('ini_cat', 'button');
     $ini = $tb->getSelectedElement();
     $select = "\r\n\t\tSELECT c.idCatalogue, c.name, c.description";
     $query_catalogue = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_catalogue AS c\r\n\t\tWHERE 1";
     // Retriving data
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         }
         if (isset($admin_courses['course'][-1])) {
             require_once _lms_ . '/lib/lib.catalogue.php';
             $cat_man = new Catalogue_Manager();
             $admin_courses['catalogue'] = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt());
             if (count($admin_courses['catalogue']) == 0 && Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         }
         if (!$all_courses) {
             if (empty($admin_courses['catalogue'])) {
                 $query_catalogue .= " AND 0 ";
             } else {
                 $query_catalogue .= " AND c.idCatalogue IN (0," . implode(',', $admin_courses['catalogue']) . ") ";
             }
         }
     }
     if ($this->filter['catalogue_name'] != '') {
         $query_catalogue .= " AND c.name LIKE '%" . $this->filter['catalogue_name'] . "%'";
     }
     list($tot_catalogue) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_catalogue));
     $query_catalogue .= " ORDER BY c.name\r\n\t\t\t\t\t\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem');
     $re_catalogue = sql_query($select . $query_catalogue);
     $type_h = array('image', '', '', '');
     $cont_h = array('<span class="access-only">' . $lang->def('_CATALOGUE_SELECTION') . '</span>', $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     while (list($id_catalogue, $name, $descr) = sql_fetch_row($re_catalogue)) {
         $tb_content = array(Form::getInputCheckbox('new_catalogue_selected_' . $id_catalogue, 'new_catalogue_selected[' . $id_catalogue . ']', $id_catalogue, isset($this->current_selection[$id_catalogue]), ''), '<label for="new_catalogue_selected_' . $id_catalogue . '">' . $name . '</label>', '<label for="new_catalogue_selected_' . $id_catalogue . '">' . $descr . '</label>');
         $tb->addBody($tb_content);
         if (isset($this->current_selection[$id_catalogue])) {
             unset($this->current_selection[$id_catalogue]);
         }
     }
     $output = $tb->getTable() . $tb->getNavBar($ini, $tot_catalogue) . $this->stateSelection();
     if ($noprint) {
         return $output;
     } else {
         cout($output, 'content');
     }
 }
Example #7
0
			if(searched) {
				var regexp = new RegExp(searched, 'gi');
				elLiner.innerHTML = oData.replace(regexp, '<span class="highlight">'+searched+'</span>');
			} else elLiner.innerHTML = oData;
		}
		YAHOO.util.Event.addListener("lang_filters", "submit", function(e) {
			YAHOO.util.Event.preventDefault(e);
			DataTable_lang_table.refresh();
		});
		YAHOO.util.Event.addListener("filter_reset", "click", function(e) {
			YAHOO.util.Event.preventDefault(e);
			YAHOO.util.Dom.get('la_module').value = '0';
			YAHOO.util.Dom.get('la_text').value = '';
			DataTable_lang_table.refresh();
		});
	</script>
	<div class="quick_search_form">
		<?php 
echo Form::openForm('lang_filters', 'index.php?r=adm/lang/list') . '<label for="la_module">' . Lang::t('_LANG_MODULE', 'admin_lang') . '</label> : ' . Form::getInputDropdown("search_d", "la_module", "la_module", $module_list, '', ' onchange=" DataTable_lang_table.refresh(); "') . ' ' . '<label for="la_text">' . Lang::t('_SEARCH', 'admin_lang') . '</label> : ' . Form::getInputTextfield("search_t", "la_text", "la_text", '', '', 255, '') . Form::getButton("filter_set", "filter_set", Lang::t('_SEARCH', 'admin_lang'), "search_b") . Form::getButton("filter_reset", "filter_reset", Lang::t('_RESET', 'admin_lang'), "reset_b");
echo '<br /><div class="">' . '<label for="lang_code">' . Lang::t('_LANGUAGE', 'admin_lang') . '</label>: ' . Form::getInputDropdown("search_d", "lang_code", "lang_code", $language_list, array_search($lang_code, $language_list), ' onchange=" DataTable_lang_table.refresh(); "') . '&nbsp;&nbsp;&nbsp;' . '<label for="lang_code_diff">' . Lang::t('_LANG_COMPARE', 'admin_lang') . '</label>: ' . Form::getInputDropdown("search_d", "lang_code_diff", "lang_code_diff", $language_list_diff, '', ' onchange=" DataTable_lang_table.refresh(); "') . '&nbsp;&nbsp;&nbsp;' . Form::getInputCheckbox('only_empty', 'only_empty', '1', false, '') . ' <label class="label_normal" for="waiting">' . Lang::t('_ONLY_EMPTY', 'admin_lang') . '</label>' . '</div>';
echo Form::closeForm();
?>
	</div>
	<?php 
$this->widget('table', array('id' => 'lang_table', 'ajaxUrl' => 'ajax.adm_server.php?r=adm/lang/get&', 'rowsPerPage' => 200, 'row_per_page_select' => '[50,100,250,500,1000]', 'startIndex' => 0, 'results' => Get::sett('visuItem', 250), 'sort' => 'text_module', 'dir' => 'asc', 'generateRequest' => 'requestBuilder', 'columns' => array(array('key' => 'text_module', 'label' => Lang::t('_LANG_MODULE', 'admin_lang'), 'className' => 'min-cell', 'sortable' => true), array('key' => 'text_key', 'label' => Lang::t('_LANG_KEY', 'admin_lang'), 'className' => 'min-cell', 'sortable' => true), array('key' => 'translation_text', 'label' => Lang::t('_LANG_TRANSLATION', 'admin_lang'), 'formatter' => 'TranslationFormatter', 'editor' => 'new YAHOO.widget.TextareaCellEditor({asyncSubmitter: saveTranslation})', 'sortable' => true), array('key' => 'translation_text_diff', 'label' => Lang::t('_LANG_COMPARE', 'admin_lang'), 'editor' => 'new YAHOO.widget.TextareaCellEditor({asyncSubmitter: saveComparisonTranslation})', 'sortable' => true), array('key' => 'save_date', 'label' => Lang::t('_DATE', 'admin_lang'), 'className' => 'min-cell', 'sortable' => true), array('key' => 'delete', 'label' => '<span class="ico-sprite subs_del"><span>' . Lang::t('_DEL', 'standard') . '</span></span>', 'formatter' => 'stdDelete', 'className' => 'img-cell')), 'fields' => array('id', 'text_module', 'text_key', 'translation_text', 'translation_text_diff', 'save_date', 'delete'), 'stdSelection' => false, 'delDisplayField' => 'text_key', 'rel_actions' => array('<a id="add_translation_top" href="ajax.adm_server.php?r=adm/lang/addmask" class="ico-wt-sprite subs_add" title="' . Lang::t('_ADD', 'standard') . '"><span>' . Lang::t('_ADD', 'standard') . '</span></a>', '<a id="add_translation_bottom" href="ajax.adm_server.php?r=adm/lang/addmask" class="ico-wt-sprite subs_add" title="' . Lang::t('_ADD', 'standard') . '"><span>' . Lang::t('_ADD', 'standard') . '</span></a>')));
?>
</div>
<?php 
$this->widget('dialog', array('id' => 'translation_add', 'dynamicContent' => true, 'ajaxUrl' => 'ajax.adm_server.php?r=adm/lang/translatemask', 'renderEvent' => 'function() {
		new YAHOO.widget.TabView("translation_tab");
	}', 'callback' => 'function() { this.destroy(); DataTable_lang_table.refresh(); }', 'callEvents' => array(array('caller' => 'add_translation_top', 'event' => 'click'), array('caller' => 'add_translation_bottom', 'event' => 'click'))));
Example #8
0
function get_report_table($url = '')
{
    checkPerm('view');
    $can_mod = checkPerm('mod', true);
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $acl_man =& Docebo::user()->getACLManager();
    $level = Docebo::user()->getUserLevelId(Docebo::user()->getIdst());
    $lang =& DoceboLanguage::createInstance('report');
    $output = '';
    $is_admin = $level == ADMIN_GROUP_GODADMIN || $level == ADMIN_GROUP_ADMIN ? true : false;
    if ($is_admin || $can_mod) {
        //if ($can_mod) {
        cout('<script type="text/javascript">
		var _FAILURE = "error";
		var ajax_path = "' . Get::rel_path('lms') . '/ajax.adm_server.php?mn=report&plf=lms";

		function public_report(o, id_rep) {
			o.disabled=true; //no more operations allowed on the checkbox while ajaxing

			var val_el=document.getElementById("enable_value_"+id_rep);
			var value=val_el.value;

			var data = "&op=public_rep&id="+id_rep+"&val="+value;
			var objAjax = YAHOO.util.Connect.asyncRequest("POST", ajax_path+data, {
			success:function(t) {
				var temp=o.src;
				if (value==1)	{ o.src=temp.replace("unpublish.png", "publish.png"); val_el.value=0; }
				if (value==0)	{ o.src=temp.replace("publish.png", "unpublish.png"); val_el.value=1; }
					o.disabled=false;
				},
			failure:function(t) {
					o.disabled=false;
					alert(_FAILURE); //...
				} });
			}

			function setReportFilter() {
				var el = document.createElement("INPUT");
				el.type = "hidden";
				el.name = "search";
				el.value = "1";
				var form = YAHOO.util.Dom.get("report_searchbox_form");
				if (form) {
					form.appendChild(el);
					form.submit();
				}
			}
		</script>', 'page_head');
    }
    //filter by author
    YuiLib::load();
    $current_user = $acl_man->getUser(Docebo::user()->getIdst(), false);
    //dropdown data arrays
    $authors = array(0 => '(' . $lang->def('_ALL') . ')', $current_user[ACL_INFO_IDST] => $acl_man->relativeId($current_user[ACL_INFO_USERID]));
    $query = "SELECT u.idst, u.userid FROM %lms_report_filter as r JOIN %adm_user as u ON (r.author=u.idst) WHERE u.idst<>" . Docebo::user()->getIdst() . " ORDER BY u.userid";
    $res = sql_query($query);
    while ($row = sql_fetch_assoc($res)) {
        $authors[$row['idst']] = $acl_man->relativeId($row['userid']);
    }
    $arr_report_types = array(0 => '(' . $lang->def('_ALL') . ')');
    //initializa session variable for filters
    if (!isset($_SESSION['report_admin_filter'])) {
        $_SESSION['report_admin_filter'] = array('author' => 0, 'name' => '', 'type' => 0);
    }
    if (Get::req('search', DOTY_MIXED, false) !== false) {
        $_SESSION['report_admin_filter']['author'] = Get::req('filter_author', DOTY_INT, (int) $_SESSION['report_admin_filter']['author']);
        $_SESSION['report_admin_filter']['name'] = Get::req('filter_name', DOTY_STRING, $_SESSION['report_admin_filter']['name']);
        $_SESSION['report_admin_filter']['type'] = Get::req('filter_type', DOTY_INT, (int) $_SESSION['report_admin_filter']['type']);
    }
    if (Get::req('reset', DOTY_MIXED, false) !== false) {
        $_SESSION['report_admin_filter']['author'] = 0;
        $_SESSION['report_admin_filter']['name'] = '';
        $_SESSION['report_admin_filter']['type'] = 0;
    }
    $dropdown_onclick = 'onchange="javascript:setReportFilter();"';
    $output .= Form::openForm('report_searchbox_form', 'index.php?modname=report&op=reportlist&of_platform=lms', false, 'POST');
    $output .= Form::getHidden('op', 'op', 'reportlist');
    $output .= Form::getHidden('modname', 'modname', 'report');
    $output .= '<div class="quick_search_form">
			<div>
				<div class="simple_search_box" id="report_searchbox_simple_filter_options" style="display: block;">' . Form::getInputDropdown('dropdown', 'report_searchbox_filter_author', 'filter_author', $authors, $_SESSION['report_admin_filter']['author'], $dropdown_onclick) . "&nbsp;&nbsp;&nbsp;" . Form::getInputTextfield("search_t", "report_searchbox_filter_name", "filter_name", $_SESSION['report_admin_filter']['name'], '', 255, '') . Form::getButton("report_searchbox_filter_set", "search", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("report_searchbox_filter_reset", "reset", Lang::t('_RESET', 'standard'), "reset_b") . '</div>
			</div>
		</div>';
    $output .= Form::closeForm();
    //end filter
    //compose search query
    $qconds = array();
    $query = "SELECT t1.*, t2.userid FROM %lms_report_filter as t1 LEFT JOIN %adm_user as t2 ON t1.author=t2.idst ";
    switch ($level) {
        case ADMIN_GROUP_GODADMIN:
            if ($_SESSION['report_admin_filter']['author'] > 0) {
                $qconds[] = " t1.author = " . $_SESSION['report_admin_filter']['author'] . " ";
            }
            break;
        case ADMIN_GROUP_ADMIN:
        case ADMIN_GROUP_PUBLICADMIN:
        case ADMIN_GROUP_USER:
        default:
            if ($_SESSION['report_admin_filter']['author'] > 0) {
                $qconds[] = " ( t1.author = " . $_SESSION['report_admin_filter']['author'] . " AND t1.is_public = 1 ) ";
            } else {
                $qconds[] = " ( t1.author = " . Docebo::user()->getIdst() . " OR t1.is_public = 1 ) ";
            }
            break;
    }
    if (trim($_SESSION['report_admin_filter']['name']) != "") {
        $qconds[] = " t1.filter_name LIKE '%" . $_SESSION['report_admin_filter']['name'] . "%' ";
    }
    if (trim($_SESSION['report_admin_filter']['type']) > 0) {
        //$qconds[] = " t1.filter_name LIKE '".$_SESSION['report_admin_filter']['name']."' ";
    }
    if (!empty($qconds)) {
        $query .= " WHERE " . implode(" AND ", $qconds);
    }
    //$_SESSION['report_admin_filter']['type']
    //end query
    $tb = new Table(Get::sett('visu_course'));
    $tb->initNavBar('ini', 'button');
    $col_type = array('', '', 'align_center', 'image', 'image', 'img-cell', 'img-cell', 'image');
    //,'image','image');
    $col_content = array($lang->def('_NAME'), $lang->def('_TAB_REP_CREATOR'), $lang->def('_CREATION_DATE'), $lang->def('_TAB_REP_PUBLIC'), '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('_VIEW') . '" title="' . $lang->def('_VIEW') . '" />', '<span class="ico-sprite subs_csv"><span>' . Lang::t('_EXPORT_CSV', 'report') . '</span></span>', '<span class="ico-sprite subs_xls"><span>' . Lang::t('_EXPORT_XLS', 'report') . '</span></span>', '<img src="' . getPathImage() . 'standard/wait_alarm.png" alt="' . $lang->def('_SCHEDULE') . '" title="' . $lang->def('_SCHEDULE') . '" />');
    if ($is_admin || $can_mod) {
        $col_type[] = 'image';
        $col_type[] = 'image';
        $col_content[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" title="' . $lang->def('_MOD') . '" />';
        $col_content[] = '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" title="' . $lang->def('_DEL') . '" />';
    }
    $tb->setColsStyle($col_type);
    $tb->addHead($col_content);
    if ($res = sql_query($query)) {
        while ($row = sql_fetch_assoc($res)) {
            $id = $row['id_filter'];
            $opn_link = '<a href="index.php?modname=report&amp;op=show_results&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('_VIEW') . '">' . '<img src="' . getPathImage() . 'standard/view.png" alt="' . $lang->def('_VIEW') . '" />' . '</a>';
            $sch_link = '<a href="index.php?modname=report&amp;op=schedulelist&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('_SCHEDULE') . '">' . '<img src="' . getPathImage() . 'standard/wait_alarm.png" alt="' . $lang->def('_SCHEDULE') . '" />' . '</a>';
            $mod_link = '<a href="' . $url . '&amp;action=modify&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('_MOD') . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />' . '</a>';
            $rem_link = '<a href="' . $url . '&amp;action=delete&amp;idrep=' . $id . '" ' . ' title="' . $lang->def('_DEL') . ' : ' . ($row['author'] == 0 ? $lang->def($row['filter_name']) : $row['filter_name']) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
            //.
            '</a>';
            $can_public = $can_mod ? true : ($is_admin && $row['author'] == Docebo::user()->getIdst() ? true : false);
            $public = '<image ' . ($can_public ? 'class="handover"' : '') . ' src="' . getPathImage('lms') . 'standard/' . ($row['is_public'] == 1 ? '' : 'un') . 'publish.png' . '" ' . ($is_admin || $can_mod ? 'onclick="public_report(this, ' . $row['id_filter'] . ');" ' : '') . ' />' . '<input type="hidden" id="enable_value_' . $row['id_filter'] . '" ' . 'value="' . ($row['is_public'] == 1 ? '0' : '1') . '" />';
            $export_url = 'index.php?modname=report&op=show_results&idrep=' . (int) $id;
            $export_link_csv = '<a class="ico-sprite subs_csv" href="' . $export_url . '&dl=csv" title="' . Lang::t('_EXPORT_CSV', 'report') . '"><span></span>' . Lang::t('_EXPORT_CSV', 'report') . '</a>';
            $export_link_xls = '<a class="ico-sprite subs_xls" href="' . $export_url . '&dl=xls" title="' . Lang::t('_EXPORT_XLS', 'report') . '"><span></span>' . Lang::t('_EXPORT_XLS', 'report') . '</a>';
            $_name = $row['author'] == 0 ? $lang->def($row['filter_name']) : $row['filter_name'];
            if (trim($_SESSION['report_admin_filter']['name']) != "") {
                $_name = Layout::highlight($_name, $_SESSION['report_admin_filter']['name']);
            }
            $tb_content = array(_REP_KEY_NAME => $_name, _REP_KEY_CREATOR => $row['author'] == 0 ? '<div class="align_center">-</div>' : $acl_man->relativeId($row['userid']), _REP_KEY_CREATION => Format::date($row['creation_date']), _REP_KEY_PUBLIC => $public, _REP_KEY_OPEN => $opn_link, $export_link_csv, $export_link_xls, _REP_KEY_SCHED => $sch_link);
            if ($is_admin || $can_mod) {
                if ($row['author'] == Docebo::user()->getIdst() || $can_mod) {
                    $tb_content[_REP_KEY_MOD] = $mod_link;
                    $tb_content[_REP_KEY_REM] = $rem_link;
                } else {
                    $tb_content[_REP_KEY_MOD] = '&nbsp;';
                    $tb_content[_REP_KEY_REM] = '&nbsp;';
                }
            }
            $tb->addBody($tb_content);
        }
    }
    if ($is_admin || $can_mod) {
        //if ($can_mod) {
        $tb->addActionAdd('
			<a href="index.php?modname=report&amp;op=report_category">' . '<img src="' . getPathImage() . 'standard/add.png" ' . 'title="' . $lang->def('_NEW') . '" /> ' . $lang->def('_NEW') . '</a>');
    }
    $output .= $tb->getTable();
    require_once _base_ . '/lib/lib.dialog.php';
    setupHrefDialogBox('a[href*=delete]');
    return $output;
}
Example #9
0
function transaction()
{
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.dialog.php';
    YuiLib::load();
    $lang =& DoceboLanguage::createInstance('transaction');
    $acl_man = Docebo::user()->getAclManager();
    $man_transaction = new Man_Transaction();
    cout(getTitleArea($lang->def('_TRANSACTION')) . '<div class="std_block">');
    $tb = new Table(Get::sett('visuItem'), $lang->def('_TRANSACTION_TABLE'), $lang->def('_TRANSACTION_TABLE'));
    $tb->initNavBar('ini', 'button');
    $tb->setLink('index.php?modname=transaction&amp;op=transaction');
    $page = ($tb->getSelectedPage() - 1) * Get::sett('visuItem');
    $status_filter = Get::req('payment_status', DOTY_INT, '-2');
    $course_filter = Get::req('course_status', DOTY_INT, '-2');
    $tran_filter = Get::req('tran', DOTY_MIXED, '');
    $display = false;
    if ($status_filter != -2) {
        $display = true;
    }
    if ($course_filter != -2) {
        $display = true;
    }
    $transactions = $man_transaction->getTransaction($page, $status_filter == '-2' ? false : $status_filter, $course_filter == '-2' ? false : $course_filter, $tran_filter);
    $tot_transaction = $man_transaction->getTotTransaction($status_filter == '-2' ? false : $status_filter, $course_filter == '-2' ? false : $course_filter, $tran_filter);
    if (count($transactions) > 0 || $display) {
        $mod_img = '<img src="' . getPathImage() . '/standard/edit.png" title="' . $lang->def('_MOD') . '" alt="' . $lang->def('_MOD') . '" />';
        $del_img = '<img src="' . getPathImage() . '/standard/delete.png" title="' . $lang->def('_DEL') . '" alt="' . $lang->def('_DEL') . '" />';
        $cont_h = array($lang->def('_USER'), $lang->def('_DATE'), $lang->def('_COURSE_PRIZE'), $lang->def('_PAYMENT_METHOD'), $lang->def('_PAYMENT_STATUS'), $lang->def('COURSE_STATUS'), $mod_img, $del_img);
        $type_h = array('', '', '', '', 'image', 'image', 'image', 'image');
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        foreach ($transactions as $transaction_info) {
            if ($transaction_info['firstname'] !== '' && $transaction_info['lastname'] !== '') {
                $user = $transaction_info['firstname'] . ' ' . $transaction_info['lastname'] . ' (' . $acl_man->relativeId($transaction_info['userid']) . ')';
            } elseif ($transaction_info['firstname'] !== '') {
                $user = $transaction_info['firstname'] . ' (' . $acl_man->relativeId($transaction_info['userid']) . ')';
            } elseif ($transaction_info['lastname'] !== '') {
                $user = $transaction_info['lastname'] . ' (' . $acl_man->relativeId($transaction_info['userid']) . ')';
            } else {
                $user = $acl_man->relativeId($transaction_info['userid']);
            }
            switch ($transaction_info['payment_status']) {
                case '-1':
                    $payment_status = '<img src="' . getPathImage() . '/standard/dot_red.gif" alt="' . $lang->def('_CANCELLED') . '" title="' . $lang->def('_CANCELLED') . '" />';
                    break;
                case '0':
                    $payment_status = '<img src="' . getPathImage() . '/standard/dot_grey.gif" alt="' . $lang->def('_WAITING_PAYMENT') . '" title="' . $lang->def('_WAITING_PAYMENT') . '" />';
                    break;
                case '1':
                    $payment_status = '<img src="' . getPathImage() . '/standard/dot_yellow.gif" alt="' . $lang->def('_PARTIAL_PAID') . '" title="' . $lang->def('_PARTIAL_PAID') . '" />';
                    break;
                case '2':
                    $payment_status = '<img src="' . getPathImage() . '/standard/dot_green.gif" alt="' . $lang->def('_PAID') . '" title="' . $lang->def('_PAID') . '" />';
                    break;
            }
            switch ($transaction_info['course_status']) {
                case '-1':
                    $course_status = '<img src="' . getPathImage() . '/standard/dot_red.gif" alt="' . $lang->def('_CANCELLED') . '" title="' . $lang->def('_CANCELLED') . '" />';
                    break;
                case '0':
                    $course_status = '<img src="' . getPathImage() . '/standard/dot_grey.gif" alt="' . $lang->def('_NO_COURSE_ACTIVATED') . '" title="' . $lang->def('_NO_COURSE_ACTIVATED') . '" />';
                    break;
                case '1':
                    $course_status = '<img src="' . getPathImage() . '/standard/dot_yellow.gif" alt="' . $lang->def('_SOME_COURSE_ACTIVATED') . '" title="' . $lang->def('_SOME_COURSE_ACTIVATED') . '" />';
                    break;
                case '2':
                    $course_status = '<img src="' . getPathImage() . '/standard/dot_green.gif" alt="' . $lang->def('_ALL_COURSE_ACTIVATED') . '" title="' . $lang->def('_ALL_COURSE_ACTIVATED') . '" />';
                    break;
            }
            $tb->addBody(array($user, Format::date($transaction_info['date']), $transaction_info['price'], $lang->def('_' . strtoupper($transaction_info['method'])), $payment_status, $course_status, '<a href="index.php?modname=transaction&amp;op=mod&amp;id=' . $transaction_info['id_transaction'] . '">' . $mod_img . '</a>', '<a href="index.php?modname=transaction&amp;op=del&amp;id=' . $transaction_info['id_transaction'] . '">' . $del_img . '</a>'));
        }
        $array_payment_status = array('-2' => $lang->def('_ALL_STATUS'), '-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_WAITING_PAYMENT'), '1' => $lang->def('_PARTIAL_PAID'), '2' => $lang->def('_PAID'));
        $array_course_status = array('-2' => $lang->def('_ALL_STATUS'), '-1' => $lang->def('_CANCELLED'), '0' => $lang->def('_NO_COURSE_ACTIVATED'), '1' => $lang->def('_SOME_COURSE_ACTIVATED'), '2' => $lang->def('_ALL_COURSE_ACTIVATED'));
        cout(Form::openForm('transaction_filter', 'index.php?modname=transaction&amp;op=transaction') . $tb->getNavBar($page, $tot_transaction) . '<div class="quick_search_form">' . Form::getInputTextfield('search_t', 'tran', 'tran', $tran_filter, '', 255, '') . Form::getButton("filter", "filter", $lang->def('_FILTER'), "search_b") . '<br />' . '<a class="advanced_search" href="javascript:;" onclick="( this.nextSibling.style.display != \'block\' ?  this.nextSibling.style.display = \'block\' : this.nextSibling.style.display = \'none\' );">' . $lang->def("_ADVANCED_SEARCH") . '</a>' . '<div class="overlay_menu" style="display:' . ($display ? 'block' : 'none') . '">' . Form::getDropdown($lang->def('_PAYMENT_STATUS_FILTER'), 'payment_status', 'payment_status', $array_payment_status, $status_filter) . Form::getDropdown($lang->def('_COURSE_STATUS_FILTER'), 'course_status', 'course_status', $array_course_status, $course_filter) . '</div>' . '</div>' . '<script type="text/javascript">' . 'var payment_status = YAHOO.util.Dom.get(\'payment_status\');' . 'var course_status = YAHOO.util.Dom.get(\'course_status\');' . 'var form = YAHOO.util.Dom.get(\'transaction_filter\');' . 'YAHOO.util.Event.on(payment_status, \'change\', function() { this.submit() } , form, true);' . 'YAHOO.util.Event.on(course_status, \'change\', function() { this.submit() } , form, true);' . '</script>' . $tb->getTable() . $tb->getNavBar($page, $tot_transaction) . Form::closeForm());
        setupHrefDialogBox('a[href*=del]');
    } else {
        cout(Lang::t('_NO_CONTENT', 'transaction'));
    }
    cout('</div>');
}
Example #10
0
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);
    $from = Get::req('from', DOTY_MIXED, '');
    if ($from === 'course') {
        $back_ui = getBackUi('index.php?r=alms/course/certificate&amp;id_course=' . (int) $id_course, $lang->def('_BACK'));
        $out->add(getTitleArea(array('index.php?r=alms/course/certificate&amp;id_course=' . (int) $id_course => $lang->def('_CERTIFICATE_ASSIGN_STATUS', 'course'), $lang->def('_COURSES')), 'certificate'));
    } else {
        $back_ui = getBackUi('index.php?modname=certificate&amp;op=report_certificate&amp;id_certificate=' . (int) $id_certificate, $lang->def('_BACK'));
        $out->add(getTitleArea(array('index.php?modname=certificate&amp;op=certificate' => $lang->def('_TITLE_CERTIFICATE'), 'index.php?modname=certificate&amp;op=report_certificate&amp;id_certificate=' . (int) $id_certificate => $lang->def('_COURSES'), $lang->def('_CERTIFICATE_VIEW_CAPTION')), 'certificate'));
    }
    $out->add('<div class="std_block">' . $back_ui);
    $numrows = sql_num_rows($res);
    $downloadables = array();
    if ($numrows > 0) {
        $clang =& DoceboLanguage::CreateInstance('course', 'lms');
        $type_h = array('image', '', '', '', '', '', '', 'image', 'image');
        $cont_h = array('', $lang->def('_USERNAME'), $lang->def('_LASTNAME'), $lang->def('_FIRSTNAME'), $clang->def('_STATUS'), $lang->def('_DATE'), $lang->def('_RELASE_DATE'), Get::sprite('subs_pdf', Lang::t('_TITLE_VIEW_CERT', 'certificate')), Get::sprite('subs_del', Lang::t('_DEL', 'certificate')));
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $acl_man =& $GLOBALS['current_user']->getAclManager();
        $arr_status = array(_CUS_CONFIRMED => $clang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $clang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $clang->def('_USER_STATUS_BEGIN'), _CUS_END => $clang->def('_USER_STATUS_END'), _CUS_SUSPEND => $clang->def('_USER_STATUS_SUSPEND'));
        //foreach($report_info as $info_report)
        while ($info = sql_fetch_assoc($res)) {
            $cont = array();
            $can_assign = (bool) ($info['on_date'] == '');
            $input_id = $info['id_user'];
            $sel_cell_content = '';
            $label_open = '';
            $label_close = '';
            if ($can_assign) {
                $input = '<input type="hidden" id="selection_' . $input_id . '" name="selection[' . $input_id . ']" value="' . $input_id . '"/> ';
                if (in_array($input_id, $total_selection)) {
                    $checked = ' checked="checked"';
                } else {
                    $checked = '';
                }
                $sel_cell_content .= $input . '<input type="checkbox" id="selected_' . $input_id . '" name="selected[' . $input_id . ']" value="' . $input_id . '"' . $checked . '/>';
                $label_open = '<label for="selected_' . $input_id . '">';
                $label_close = '</label>';
            }
            $userid = $acl_man->relativeId($info['userid']);
            $cont[] = $sel_cell_content;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($userid, $search_filter) : $userid) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['lastname'], $search_filter) : $info['lastname']) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['firstname'], $search_filter) : $info['firstname']) . $label_close;
            $cont[] = $arr_status[$info['status']];
            $cont[] = $info['date_complete'];
            $cont[] = $info['on_date'];
            $url = 'index.php?modname=certificate&amp;certificate_id=' . $id_certificate . '&amp;course_id=' . $id_course . '&amp;user_id=' . $info['id_user'];
            $dl_url = $url . "&amp;op=send_certificate";
            if ($can_assign) {
                $downloadables[] = 'dl_single_' . $input_id;
            }
            $cont[] = $can_assign ? '<a id="dl_single_' . $input_id . '" class="ico-wt-sprite subs_pdf" href="javascript:;" title="' . $lang->def('_GENERATE') . '"><span>' . $lang->def('_GENERATE') . '</span></a>' : '<a id="dl_single_' . $input_id . '" class="ico-wt-sprite subs_pdf" href="' . $dl_url . '" title="' . $lang->def('_DOWNLOAD') . '"><span>' . $lang->def('_DOWNLOAD') . '</span></a>';
            $cont[] = $can_assign ? '' : Get::sprite_link('subs_del', $url . '&amp;op=del_report_certificate', Lang::t('_DEL', 'certificate'));
            $tb->addBody($cont);
        }
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=del_report_certificate]');
        //search filter ...
        $release_options = array($lang->def('_ALL') => 0, $lang->def('_RELEASED') => 1, $lang->def('_TO_RELEASE') => 2);
        //search and store all non-available certificates
        $all_selection = array();
        $query = "SELECT cu.idUser as id_user " . " 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 . "' " . ($search_filter != '' ? " AND (u.userid LIKE '%" . $search_filter . "%' OR u.lastname LIKE '%" . $search_filter . "%' OR u.firstname LIKE '%" . $search_filter . "%') " : "") . " AND ca.on_date IS NULL ";
        $res = sql_query($query);
        while (list($id_user) = sql_fetch_row($res)) {
            $all_selection[] = $id_user;
        }
        //---
        $form = new Form();
        $submit_url = "index.php?modname=certificate&amp;op=view_report_certificate&amp;id_certificate=" . (int) $id_certificate . "&amp;id_course=" . (int) $id_course;
        $out->add($form->openForm("certificates_emission", $submit_url) . $form->getHidden('old_selection', 'old_selection', implode(',', $total_selection)) . $form->getHidden('all_selection', 'all_selection', implode(',', $all_selection)) . $form->getHidden('active_text_filter', 'active_text_filter', $search_filter) . $form->getHidden('active_only_released', 'active_only_released', $only_released) . $form->getHidden('active_ini', 'active_ini', $ini_param) . '<div class="quick_search_form">' . '<div class="simple_search_box">' . Form::getInputTextfield("search_t", "filter", "filter", $search_filter, '', 255, '') . Form::getButton("search_button", "search_button", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("reset_button", "reset_button", Lang::t('_RESET', 'standard'), "reset_b") . '</div>' . '<a id="advanced_search" class="advanced_search" href="javascript:;">' . Lang::t("_ADVANCED_SEARCH", 'standard') . '</a>' . '<div id="certificate_release_as" class="advanced_search_options" style="display: ' . ($only_released != 0 ? 'block' : 'none') . '">' . Form::getRadioHoriz(Lang::t('_FILTER', 'certificate'), 'only_released', 'only_released', $release_options, $only_released) . '</div>' . '</div>' . '<script type="text/javascript">' . 'YAHOO.util.Event.addListener("advanced_search", "click", function(e){
				var el = YAHOO.util.Dom.get("certificate_release_as");
				if (el.style.display != \'block\') el.style.display = \'block\';
				else el.style.display = \'none\';
			});' . '</script>', 'content');
        $delgen_url = 'index.php?modname=certificate&amp;op=del_gen_certificate' . '&amp;id_certificate=' . (int) $id_certificate . '&amp;id_course=' . (int) $id_course;
        $delgen_txt = Lang::t('_DELETE_ALL_GENERATED', 'certificate');
        $print_button_1 = '<div>' . '<a id="print_selected_button_1" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a>' . '</div>';
        $print_button_2 = '<div><a id="print_selected_button_2" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a>' . '</div>';
        $print_button_1 .= Lang::t('_SELECT', 'directory') . ': ';
        $print_button_2 .= Lang::t('_SELECT', 'directory') . ': ';
        /*	
        		$print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_page_1">'.Lang::t('_SELECT_PAGE', 'standard').'</a>';
        		$print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_page_2">'.Lang::t('_SELECT_PAGE', 'standard').'</a>';
        		$print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_page_1">'.Lang::t('_UNSELECT_PAGE', 'standard').'</a>';
        		$print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_page_2">'.Lang::t('_UNSELECT_PAGE', 'standard').'</a>';
        */
        $print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_all_1">' . Lang::t('_ALL_PAGES', 'directory') . '</a>';
        $print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="select_all_2">' . Lang::t('_ALL_PAGES', 'directory') . '</a>';
        $print_button_1 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_all_1">' . Lang::t('_NONE', 'directory') . '</a>';
        $print_button_2 .= '&nbsp;&nbsp;&nbsp;<a href="javascript:;" id="unselect_all_2">' . Lang::t('_NONE', 'directory') . '</a>';
        $navbar = $tb->getNavBar($ini, $totalrows);
        $out->add($print_button_1 . '<br />' . $navbar . $tb->getTable() . $navbar . '<br />' . $print_button_2);
        $out->add($form->closeForm());
    } else {
        $out->add($lang->def('_NO_CONTENT'));
    }
    $out->add($back_ui . '</div>');
    addCss('style_menu', 'lms');
    Util::get_js(Get::rel_path('base') . '/widget/dialog/dialog.js', true, true);
    Util::get_js(Get::rel_path('lms') . '/admin/modules/certificate/certificate.js?rnd=' . time(), true, true);
    //addJs($GLOBALS['where_lms_relative'].'/admin/modules/certificate/', 'certificate.js');
    $script = 'var ajax_url="ajax.adm_server.php?plf=lms&mn=certificate"; var _STOP="' . $lang->def('_STOP') . '"; ' . 'var glob_id_certificate = ' . (int) $id_certificate . ', glob_id_course = ' . (int) $id_course . ';' . 'var single_list = [' . (count($downloadables) ? '"' . implode('","', $downloadables) . '"' : '') . ']; ' . 'var reload_url = "' . str_replace('&amp;', '&', isset($submit_url) ? $submit_url : '') . '", ' . '_ERROR_PARSE = "' . $lang->def('_OPERATION_FAILURE') . '", _SUCCESS = "' . $lang->def('_OPERATION_SUCCESSFUL') . '", ' . '_AREYOUSURE="' . Lang::t('_AREYOUSURE', 'standard') . '";';
    $out->add('<script type="text/javascript">' . $script . '</script>', 'page_head');
}
Example #11
0
 public function getPresenceTable()
 {
     $user = $this->classroom_man->getUserForPresence($this->id_date);
     $day = $this->getDateDay($this->id_date);
     $test_type = $this->getTestType();
     $user_presence = $this->classroom_man->getUserPresenceForDate($this->id_date);
     $tb = new Table(0, Lang::t('_ATTENDANCE', 'course'), Lang::t('_ATTENDANCE', 'course'));
     $cont_h = array(Lang::t('_USERNAME', 'course'), Lang::t('_FULLNAME', 'course'));
     $type_h = array('', '');
     foreach ($day as $id_day => $day_info) {
         $cont_h[] = Format::date($day_info['date_begin'], 'date') . '<br />' . '<a href="javascript:;" onClick="checkAllDay(' . $id_day . ')">' . Get::img('standard/checkall.png', Lang::t('_CHECK_ALL_DAY', 'presence') . '</a>') . ' ' . '<a href="javascript:;" onClick="unCheckAllDay(' . $id_day . ')">' . Get::img('standard/uncheckall.png', Lang::t('_UNCHECK_ALL_DAY', 'presence') . '</a>');
         $type_h[] = 'img-cell';
     }
     $cont_h[] = '';
     $type_h[] = 'img-cell';
     if ($test_type == _DATE_TEST_TYPE_PAPER) {
         $cont_h[] = Lang::t('_SCORE', 'course');
         $type_h[] = 'img-cell';
     }
     $cont_h[] = Lang::t('_NOTES', 'course');
     $type_h[] = 'img-cell';
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     $array_user_id = array();
     foreach ($user as $id_user => $user_info) {
         reset($day);
         $array_user_id[] = $id_user;
         $cont = array();
         $cont[] = $user_info['userid'];
         $cont[] = $user_info['lastname'] . ' ' . $user_info['firstname'];
         foreach ($day as $id_day => $day_info) {
             if (isset($user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]) && $user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]['presence'] == 1) {
                 $presence = true;
             } elseif (isset($user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]) && $user_presence[$id_user][substr($day_info['date_begin'], 0, 10)]['presence'] == 0) {
                 $presence = false;
             } else {
                 $presence = false;
             }
             $cont[] = Form::getInputCheckbox('date_' . $id_day . '_' . $id_user, 'date_' . $id_day . '_' . $id_user, 1, $presence, false);
         }
         $cont[] = '<a href="javascript:;" onClick="checkAllUser(' . $id_user . ')">' . Get::img('standard/checkall.png', Lang::t('_CHECK_ALL_USER', 'presence') . '</a>') . '<br />' . '<a href="javascript:;" onClick="unCheckAllUser(' . $id_user . ')">' . Get::img('standard/uncheckall.png', Lang::t('_UNCHECK_ALL_USER', 'presence') . '</a>');
         if ($test_type == _DATE_TEST_TYPE_PAPER) {
             if (isset($user_presence[$id_user]['0000-00-00']) && $user_presence[$id_user]['0000-00-00']['presence'] == 1) {
                 $passed = true;
             } else {
                 $passed = false;
             }
             //$cont[] = Form::getTextfield('', 'score_'.$id_user, 'score_'.$id_user, 255, (isset($user_presence[$id_user]['0000-00-00']['score']) ? $user_presence[$id_user]['0000-00-00']['score'] : '0'));
             $cont[] = Form::getInputTextfield('', 'score_' . $id_user, 'score_' . $id_user, isset($user_presence[$id_user]['0000-00-00']['score']) ? $user_presence[$id_user]['0000-00-00']['score'] : '0', Lang::t('_SCORE', 'course'), 255, '');
         }
         //$cont[] = Form::getSimpleTextarea('', 'note_'.$id_user, 'note_'.$id_user, (isset($user_presence[$id_user]['0000-00-00']['note']) ? $user_presence[$id_user]['0000-00-00']['note'] : ''), false, false, false, 2);
         $cont[] = Form::getInputTextarea('note_' . $id_user, 'note_' . $id_user, isset($user_presence[$id_user]['0000-00-00']['note']) ? $user_presence[$id_user]['0000-00-00']['note'] : '', '', 5, 22);
         $tb->addBody($cont);
     }
     return $tb->getTable();
 }
Example #12
0
/**
 * Only for input. Special function.
 **/
function event_special_view($op)
{
    checkPerm('view_event_manager');
    require_once _base_ . '/lib/lib.table.php';
    //require_once(_i18n_.'/lib.lang.php');
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::createInstance('event_manager', 'framework');
    $out =& $GLOBALS['page'];
    $form = new Form();
    $out->setWorkingZone('content');
    $out->add(getTitleArea($lang->def('_EVENT_MANAGER'), 'event_manager'));
    $out->add('<div class="std_block">');
    if ($op == 'special_save') {
        $arr_platform = $_POST['platform'];
        $arr_class = $_POST['class'];
        $arr_description = $_POST['description'];
        $arr_recipients = $_POST['recipients'];
        $arr_show_level = $_POST['show_level'];
        $idClass = 0;
        foreach ($arr_platform as $key => $platform) {
            if ($key == 0) {
                if ($platform != '') {
                    $result1 = sql_query("INSERT INTO " . $GLOBALS['prefix_fw'] . "_event_class " . " (platform,class,description) VALUES " . " ('" . $platform . "','" . $arr_class[$key] . "','" . $arr_description[$key] . "') ");
                    if ($result1 === FALSE) {
                        break;
                    }
                    $idClass = mysql_insert_id();
                    DoceboEventManager::registerEventConsumer(array($arr_class[$key]), 'DoceboUserNotifier', $GLOBALS['where_framework'] . '/lib/lib.usernotifier.php');
                    $result1 = sql_query("INSERT INTO " . $GLOBALS['prefix_fw'] . "_event_manager " . " (idClass,recipients,show_level) VALUES " . " ('" . $idClass . "','" . $arr_recipients[$key] . "','" . $arr_show_level[$key] . "') ");
                }
            } else {
                $result1 = sql_query("UPDATE " . $GLOBALS['prefix_fw'] . "_event_class " . "   SET platform='" . $platform . "'," . "       class='" . $arr_class[$key] . "'," . "       description='" . $arr_description[$key] . "'" . " WHERE idClass = '" . (int) $key . "'");
            }
            if ($result1 === FALSE) {
                break;
            }
        }
        foreach ($arr_recipients as $key => $recipients) {
            if ($key == 0) {
                // do nothing
            } else {
                $result2 = sql_query("UPDATE " . $GLOBALS['prefix_fw'] . "_event_manager " . "   SET recipients='" . $recipients . "'," . "       show_level='" . $arr_show_level[$key] . "'" . " WHERE idEventMgr = '" . (int) $key . "'");
            }
            if ($result1 === FALSE) {
                break;
            }
        }
        if ($result1 && $result2) {
            $out->add(getResultUi($lang->def('_OPERATION_SUCCESSFUL')));
        } else {
            $out->add(getErrorUi($lang->def('_ERROR_IN_SAVE')));
        }
    }
    $out->add($form->openForm('event_special_insert', 'index.php?modname=event_manager&amp;op=special_save'));
    $out->add($form->openElementSpace());
    $tb_event_classes = new Table(400, $lang->def('_EVENT_SETTINGS'), $lang->def('_EVENT_SETTINGS'));
    $content_h = array($lang->def('_EVENT_PLATFORM'), $lang->def('_NAME'), $lang->def('_DESCRIPTION'), $lang->def('_RECIPIENTS'), 'show_level');
    $type_h = array('', '', '', 'image', 'image', 'image', 'image', 'image', '');
    $tb_event_classes->setColsStyle($type_h);
    $tb_event_classes->addHead($content_h);
    $rs = sql_query("SELECT ec.idClass, class, platform, description, idEventMgr, recipients, show_level" . " FROM " . $GLOBALS['prefix_fw'] . "_event_class as ec" . " JOIN " . $GLOBALS['prefix_fw'] . "_event_manager as em" . " WHERE ec.idClass = em.idClass" . " ORDER BY ec.idClass");
    while (list($idClass, $class, $platform, $description, $idEventMgr, $recipients, $show_level) = sql_fetch_row($rs)) {
        $cont = array();
        $cont[] = $form->getInputTextfield('', 'platform_' . $idClass, 'platform[' . $idClass . ']', $platform, '', 50, '');
        $cont[] = $form->getInputTextfield('', 'class_' . $idClass, 'class[' . $idClass . ']', $class, '', 50, '');
        $cont[] = $form->getInputTextfield('', 'description_' . $idClass, 'description[' . $idClass . ']', $description, '', 50, '');
        $cont[] = $form->getInputTextfield('', 'recipients_' . $idEventMgr, 'recipients[' . $idEventMgr . ']', $recipients, '', 50, '');
        $cont[] = $form->getInputTextfield('', 'show_level_' . $idEventMgr, 'show_level[' . $idEventMgr . ']', $show_level, '', 50, '');
        $tb_event_classes->addBody($cont);
    }
    $cont = array();
    $cont[] = $form->getInputTextfield('', 'platform_0', 'platform[0]', '', '', 50, '');
    $cont[] = $form->getInputTextfield('', 'class_0', 'class[0]', '', '', 50, '');
    $cont[] = $form->getInputTextfield('', 'description_0', 'description[0]', '', '', 50, '');
    $cont[] = $form->getInputTextfield('', 'recipients_0', 'recipients[0]', '', '', 50, '');
    $cont[] = $form->getInputTextfield('', 'show_level_0', 'show_level[0]', '', '', 50, '');
    $tb_event_classes->addBody($cont);
    $out->add($tb_event_classes->getTable());
    $out->add($form->closeElementSpace());
    $out->add($form->openButtonSpace());
    $out->add($form->getButton('save', 'save', $lang->def('_SAVE')));
    $out->add($form->closeButtonSpace());
    $out->add($form->closeForm());
    $out->add('</div>');
}
Example #13
0
function forumsearchmessage()
{
    checkPerm('view');
    $search_arg = $_SESSION['forum']['search_arg'];
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::createInstance('forum', 'lms');
    $id_thread = importVar('idThread', true, 0);
    $ini_thread = importVar('ini_thread');
    $sema_perm = checkPerm('sema', true);
    $moderate = checkPerm('moderate', true);
    $mod_perm = checkPerm('mod', true);
    $acl_man =& Docebo::user()->getAclManager();
    $tb = new Table(Get::sett('visuItem'), $lang->def('_CAPTION_FORUM_MESSAGE'), $lang->def('_CAPTION_FORUM_MESSAGE'));
    $tb->initNavBar('ini', 'link');
    $tb->setLink('index.php?modname=forum&amp;op=searchmessage&amp;idThread=' . $id_thread . '&amp;ini_thread=' . $ini_thread);
    $ini = $tb->getSelectedElement();
    $ini_page = $tb->getSelectedPage();
    // Some info about forum and thread
    $thread_query = "\r\n\tSELECT idForum, title, num_post, locked, erased\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\tWHERE idThread = '" . $id_thread . "'";
    list($id_forum, $thread_title, $tot_message, $locked_t, $erased_t) = sql_fetch_row(sql_query($thread_query));
    $forum_query = "\r\n\tSELECT title, locked\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum\r\n\tWHERE idForum = '" . $id_forum . "'";
    list($forum_title, $locked_f) = sql_fetch_row(sql_query($forum_query));
    ++$tot_message;
    //set as readed if needed
    if (isset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread])) {
        unset($_SESSION['unreaded_forum'][$_SESSION['idCourse']][$id_forum][$id_thread]);
    }
    if ($ini == 0 && !isset($_GET['result'])) {
        sql_query("\r\n\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_forumthread\r\n\t\tSET num_view = num_view + 1\r\n\t\tWHERE idThread = '" . $id_thread . "'");
    }
    $page_title = array('index.php?modname=forum&amp;op=forum' => $lang->def('_FORUM'), 'index.php?modname=forum&amp;op=search&amp;ini=' . $ini_thread => $thread_title, $lang->def('_SEARCH_RESULT_FOR') . ' : ' . $search_arg);
    if ($erased_t && !$mod_perm && !$moderate) {
        $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . $lang->def('_CANNOTENTER') . '</div>', 'content');
        return;
    }
    // Who have semantic evaluation
    $re_sema = sql_query("\r\n\tSELECT DISTINCT idmsg\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forum_sema");
    while (list($msg_sema) = sql_fetch_row($re_sema)) {
        $forum_sema[$msg_sema] = 1;
    }
    // Find post
    $messages = array();
    $authors = array();
    $authors_names = array();
    $authors_info = array();
    $re_message = sql_query("\r\n\tSELECT idMessage, posted, title, textof, attach, locked, author, modified_by, modified_by_on\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage\r\n\tWHERE idThread = '" . $id_thread . "'\r\n\tORDER BY posted\r\n\tLIMIT {$ini}, " . Get::sett('visuItem'));
    while ($record = mysql_fetch_assoc($re_message)) {
        $messages[$record['idMessage']] = $record;
        $authors[$record['author']] = $record['author'];
        if ($record['modified_by'] != 0) {
            $authors[$record['modified_by']] = $record['modified_by'];
        }
    }
    $authors_names =& $acl_man->getUsers($authors);
    $level_name = CourseLevel::getLevels();
    // Retriving level and number of post of th authors
    $re_num_post = sql_query("\r\n\tSELECT u.idUser, u.level, COUNT(*)\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_forummessage AS m, " . $GLOBALS['prefix_lms'] . "_courseuser AS u\r\n\tWHERE u.idCourse = '" . (int) $_SESSION['idCourse'] . "' AND m.author = u.idUser AND m.author IN ( " . implode($authors, ',') . " )\r\n\tGROUP BY u.idUser, u.level");
    while (list($id_u, $level_u, $num_post_a) = sql_fetch_row($re_num_post)) {
        $authors_info[$id_u] = array('num_post' => $num_post_a, 'level' => $level_name[$level_u]);
    }
    $type_h = array('forum_sender', 'forum_text');
    $cont_h = array($lang->def('_AUTHOR'), $lang->def('_TEXTOF'));
    $tb->setColsStyle($type_h);
    $tb->addHead($cont_h);
    // Compose messagges display
    $path = $GLOBALS['where_files_relative'] . '/appCore/' . Get::sett('pathphoto');
    while (list($id_message, $message_info) = each($messages)) {
        // sender info
        $m_author = $message_info['author'];
        if (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '') {
            $img_size = @getimagesize($path . $authors_names[$m_author][ACL_INFO_AVATAR]);
        }
        $sender = '<div class="forum_author">' . (isset($authors_names[$m_author]) ? $authors_names[$m_author][ACL_INFO_LASTNAME] . $authors_names[$m_author][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$m_author][ACL_INFO_USERID]) : $authors_names[$m_author][ACL_INFO_LASTNAME] . ' ' . $authors_names[$m_author][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR')) . '</div>' . '<div class="forum_level">' . $lang->def('_LEVEL') . ' : ' . $authors_info[$m_author]['level'] . '</div>' . (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_AVATAR] != '' ? '<img class="forum_avatar' . ($img_size[0] > 150 || $img_size[1] > 150 ? ' image_limit' : '') . '" src="' . $path . $authors_names[$m_author][ACL_INFO_AVATAR] . '" alt="' . $lang->def('_AVATAR') . '" />' : '') . '<div class="forum_numpost">' . $lang->def('_NUMPOST') . ' : ' . (isset($authors_info[$m_author]['num_post']) ? $authors_info[$m_author]['num_post'] : 0) . '</div>' . '<img src="' . getPathImage() . 'standard/identity.png" alt="&gt;" />&nbsp;' . '<a href="index.php?modname=forum&amp;op=viewprofile&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '&amp;idThread=' . $id_thread . '">' . $lang->def('_VIEW_PROFILE') . '</a>';
        // msg info
        $msgtext = '';
        $msgtext .= '<div class="forum_post_posted">' . $lang->def('_DATE') . ' : ' . Format::date($message_info['posted']) . ' ( ' . loadDistance($message_info['posted']) . ' )' . '</div>';
        if ($message_info['locked']) {
            $msgtext .= '<div class="forum_post_locked">' . $lang->def('_LOCKEDMESS') . '</div>';
        } else {
            if ($message_info['attach'] != '') {
                $msgtext .= '<div class="forum_post_attach">' . '<a href="index.php?modname=forum&amp;op=download&amp;id=' . $id_message . '">' . $lang->def('_ATTACHMENT') . ' : ' . '<img src="' . getPathImage() . mimeDetect($message_info['attach']) . '" alt="' . $lang->def('_ATTACHMENT') . '" /></a>' . '</div>';
            }
            $textof = str_replace('[quote]', '<blockquote class="forum_quote">', str_replace('[/quote]', '</blockquote>', $message_info['textof']));
            $msgtext .= '<div class="forum_post_title">' . $lang->def('_SUBJECT') . ' : ' . ($search_arg !== '' ? eregi_replace($search_arg, '<span class="filter_evidence">' . $search_arg . '</span>', $message_info['title']) : $message_info['title']) . '</div>';
            $msgtext .= '<div class="forum_post_text">' . ($search_arg !== '' ? eregi_replace($search_arg, '<span class="filter_evidence">' . $search_arg . '</span>', $textof) : $textof) . '</div>';
            if ($message_info['modified_by'] != 0) {
                $modify_by = $message_info['modified_by'];
                $msgtext .= '<div class="forum_post_modified_by">' . $lang->def('_MODIFY_BY') . ' : ' . (isset($authors_names[$modify_by]) ? $authors_names[$modify_by][ACL_INFO_LASTNAME] . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] == '' ? $acl_man->relativeId($authors_names[$modify_by][ACL_INFO_USERID]) : $authors_names[$modify_by][ACL_INFO_LASTNAME] . ' ' . $authors_names[$modify_by][ACL_INFO_FIRSTNAME] : $lang->def('_UNKNOWN_AUTHOR')) . ' ' . $lang->def('_ON') . ' : ' . Format::date($message_info['modified_by_on']) . '</div>';
            }
            if (isset($authors_names[$m_author]) && $authors_names[$m_author][ACL_INFO_SIGNATURE] != '') {
                $msgtext .= '<div class="forum_post_sign_separator"></div>' . '<div class="forum_post_sign">' . $authors_names[$m_author][ACL_INFO_SIGNATURE] . '</div>';
            }
        }
        $content = array($sender, $msgtext);
        $tb->addBody($content);
        // some action that you can do with this message
        $action = '';
        if ($moderate || $mod_perm) {
            if ($message_info['locked']) {
                $action .= '<a href="index.php?modname=forum&amp;op=moderatemessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/demoderate.png" alt="' . $lang->def('_DEMODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEMODERATE') . '</a> ';
            } else {
                $action .= '<a href="index.php?modname=forum&amp;op=moderatemessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MODERATE') . '</a> ';
            }
        }
        if (!$locked_t && !$locked_f || $mod_perm || $moderate) {
            $action .= '<a href="index.php?modname=forum&amp;op=addmessage&amp;idThread=' . $id_thread . '&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/reply.png" alt="' . $lang->def('_REPLY') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_QUOTE') . '</a>';
        }
        if ($moderate || $mod_perm || $m_author == getLogUserId()) {
            $action .= '<a href="index.php?modname=forum&amp;op=modmessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_MOD_MESSAGE') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_MOD') . '</a>' . '<a href="index.php?modname=forum&amp;op=delmessage&amp;idMessage=' . $id_message . '&amp;ini=' . $ini_page . '" ' . 'title="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . ' : ' . strip_tags($message_info['title']) . '" /> ' . $lang->def('_DEL') . '</a> ';
        }
        $tb->addBodyExpanded($action, 'forum_action');
    }
    if (!$locked_t && !$locked_f || $mod_perm || $moderate) {
        $tb->addActionAdd('<a href="index.php?modname=forum&amp;op=addmessage&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '" title="' . $lang->def('_REPLY') . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" /> ' . $lang->def('_REPLY') . '</a>');
    }
    $GLOBALS['page']->add(getTitleArea($page_title, 'forum') . '<div class="std_block">' . Form::openForm('search_forum', 'index.php?modname=forum&amp;op=search&amp;idThread=' . $id_thread) . '<div class="quick_search_form">' . '<label for="search_arg">' . $lang->def('_SEARCH_LABEL') . '</label> ' . Form::getInputTextfield('search_t', 'search_arg', 'search_arg', $search_arg, $lang->def('_SEARCH'), 255, '') . '<input class="search_b" type="submit" id="search_button" name="search_button" value="' . $lang->def('_SEARCH') . '" />' . '</div>' . Form::closeForm(), 'content');
    if ($moderate || $mod_perm) {
        $GLOBALS['page']->add('<div class="forum_action_top">' . '<a href="index.php?modname=forum&amp;op=modstatusthread&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a> ' . '<a href="index.php?modname=forum&amp;op=changeerased&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>' . '</div>', 'content');
    }
    $GLOBALS['page']->add($tb->getTable(), 'content');
    if ($moderate || $mod_perm) {
        $GLOBALS['page']->add('<div class="forum_action_bottom">' . '<a href="index.php?modname=forum&amp;op=modstatusthread&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($locked_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_FREE') . '" /> ' . $lang->def('_FREETHREAD') : '<img src="' . getPathImage() . 'standard/locked.png" alt="' . $lang->def('_LOCKTHREAD') . '" /> ' . $lang->def('_LOCKTHREAD')) . '</a> ' . '<a href="index.php?modname=forum&amp;op=changeerased&amp;idThread=' . $id_thread . '&amp;ini=' . $ini_page . '">' . ($erased_t ? '<img src="' . getPathImage() . 'standard/msg_read.png" alt="' . $lang->def('_UNERASE') . '" /> ' . $lang->def('_UNERASE') : '<img src="' . getPathImage() . 'standard/moderate.png" alt="' . $lang->def('_MODERATE') . '" /> ' . $lang->def('_MODERATE')) . '</a>' . '</div>', 'content');
    }
    $GLOBALS['page']->add($tb->getNavBar($ini, $tot_message) . '</div>', 'content');
}
Example #14
0
 function loadCourseSelector($noprint = false, $with_assesment = false)
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('course', 'lms');
     $output = '';
     $output .= $this->treeview->load();
     // Filter
     $this->filter['course_flat'] = isset($_POST['c_flatview']);
     //$this->filter['course_code'] = ( isset($_POST['c_filter_code']) ? $_POST['c_filter_code'] : '' );
     $this->filter['course_name'] = isset($_POST['c_filter_name']) ? $_POST['c_filter_name'] : '';
     if ($this->show_filter === true) {
         $output .= '<div class="quick_search_form">' . '<div class="common_options">' . Form::getInputCheckbox('c_flatview', 'c_flatview', '1', Get::req('c_flatview', DOTY_INT, '0') == '1' ? true : false, ' onclick="submit();" ') . ' <label class="label_normal" for="c_flatview">' . Lang::t('_DIRECTORY_FILTER_FLATMODE', 'admin_directory') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . '</div>' . '<div>' . Form::getInputTextfield("search_t", "c_filter_name", "c_filter_name", Get::req('c_filter_name', DOTY_ALPHANUM, ''), '', 255, '') . Form::getButton("c_filter_set", "c_filter_set", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>';
     }
     // End Filter
     $tb = new Table(Get::sett('visu_course'), $lang->def('_COURSE_LIST'), $lang->def('_COURSE_LIST_SUMMARY'));
     $tb->initNavBar('ini', 'button');
     $ini = $tb->getSelectedElement();
     $category_selected = $this->treeview->getSelectedFolderId();
     if ($this->filter['course_flat']) {
         $id_categories = $this->treeDB->getDescendantsId($this->treeDB->getFolderById($category_selected));
         $id_categories[] = $category_selected;
     }
     $select = "\r\n\t\tSELECT c.idCourse, c.code, c.name, c.description, c.status, c.difficult,\r\n\t\t\tc.subscribe_method, c.permCloseLo, c.show_rules, c.max_num_subscribe ";
     $query_course = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_course AS c\r\n\t\tWHERE " . ($with_assesment ? '1' : "c.course_type <> 'assessment'") . " AND c.idCategory IN ( " . (!$this->filter['course_flat'] ? $category_selected : implode(",", $id_categories)) . " )";
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         $all_courses = false;
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         } elseif (isset($admin_courses['course'][-1])) {
             require_once _lms_ . '/lib/lib.catalogue.php';
             $cat_man = new Catalogue_Manager();
             $user_catalogue = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt());
             if (count($user_catalogue) > 0) {
                 $courses = array(0);
                 foreach ($user_catalogue as $id_cat) {
                     $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true);
                     $courses = array_merge($courses, $catalogue_course);
                 }
                 foreach ($courses as $id_course) {
                     if ($id_course != 0) {
                         $admin_courses['course'][$id_course] = $id_course;
                     }
                 }
             } elseif (Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         } else {
             $array_courses = array();
             $array_courses = array_merge($array_courses, $admin_courses['course']);
             if (!empty($admin_courses['coursepath'])) {
                 require_once _lms_ . '/lib/lib.coursepath.php';
                 $path_man = new CoursePath_Manager();
                 $coursepath_course =& $path_man->getAllCourses($admin_courses['coursepath']);
                 $array_courses = array_merge($array_courses, $coursepath_course);
             }
             if (!empty($admin_courses['catalogue'])) {
                 require_once _lms_ . '/lib/lib.catalogue.php';
                 $cat_man = new Catalogue_Manager();
                 foreach ($admin_courses['catalogue'] as $id_cat) {
                     $catalogue_course =& $cat_man->getCatalogueCourse($id_cat, true);
                     $array_courses = array_merge($array_courses, $catalogue_course);
                 }
             }
             $admin_courses['course'] = array_merge($admin_courses['course'], $array_courses);
         }
         if (!$all_courses) {
             if (empty($admin_courses['course'])) {
                 $query_course .= " AND 0 ";
             } else {
                 $query_course .= " AND c.idCourse IN (" . implode(',', $admin_courses['course']) . ") ";
             }
         }
     }
     /*
     		if($this->filter['course_code'] != '') {
     			$query_course .= " AND c.code LIKE '%".$this->filter['course_code']."%'";
     		}*/
     if ($this->filter['course_name'] != '') {
         $query_course .= " AND ( c.code LIKE '%" . $this->filter['course_name'] . "%' OR c.name LIKE '%" . $this->filter['course_name'] . "%' ) ";
     }
     list($tot_course) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_course));
     $query_course .= " ORDER BY c.name\r\n\t\t\t\t\t\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem', 25);
     $re_course = sql_query($select . $query_course);
     $type_h = array('image', '', '', '');
     $cont_h = array('<span class="access-only">' . $lang->def('_COURSE_SELECTION') . '</span>', $lang->def('_CODE'), $lang->def('_COURSE_NAME'), $lang->def('_STATUS'));
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     $status_array = array(CST_PREPARATION => Lang::t('_CST_PREPARATION', 'course'), CST_AVAILABLE => Lang::t('_CST_AVAILABLE', 'course'), CST_EFFECTIVE => Lang::t('_CST_CONFIRMED', 'course'), CST_CONCLUDED => Lang::t('_CST_CONCLUDED', 'course'), CST_CANCELLED => Lang::t('_CST_CANCELLED', 'course'));
     while (list($id_course, $code, $name, $desc, $status, $difficult, $auto_sub, $end_mode, $show_rules, $max_user_sub) = sql_fetch_row($re_course)) {
         $tb_content = array(Form::getInputCheckbox('new_course_selected_' . $id_course, 'new_course_selected[' . $id_course . ']', $id_course, isset($this->current_selection[$id_course]), ''), '<label for="new_course_selected_' . $id_course . '">' . $code . '</label>', '<label for="new_course_selected_' . $id_course . '">' . $name . '</label>');
         $tb_content[] = $status_array[$status];
         $tb->addBody($tb_content);
         if (isset($this->current_selection[$id_course])) {
             unset($this->current_selection[$id_course]);
         }
     }
     $output .= $tb->getTable() . $tb->getNavBar($ini, $tot_course) . $this->stateSelection();
     //, 'content');
     if ($noprint) {
         return $output;
     } else {
         cout($output);
     }
 }
 public function mod_course_competencesTask()
 {
     $id_course = Get::req('id_course', DOTY_INT, 0);
     if ($id_course <= 0) {
         $this->render('invalid', array('message' => $this->_getErrorMessage("invalid course"), 'back_url' => 'index.php?r=' . $this->base_link_competence . '/show'));
         return;
     }
     $back_url = 'index.php?r=' . $this->base_link_competence . '/man_course&id_course=' . (int) $id_course;
     $arr_competences = $this->model->getCourseCompetences($id_course);
     require_once _base_ . '/lib/lib.table.php';
     $table = new Table();
     $label_h = array(Lang::t('_NAME', 'standard'), Lang::t('_DESCRIPTION', 'standard'), Lang::t('_TYPOLOGY', 'competences'), Lang::t('_SCORE', 'competences'));
     $style_h = array('', '', 'img-cell', 'img-cell');
     $table->addHead($label_h, $style_h);
     $counter = 0;
     //how many score type competences
     $info = $this->model->getCompetencesInfo($arr_competences);
     $lang_code = getLanguage();
     $std_value = 0;
     foreach ($info as $id => $competence) {
         if ($competence->type == 'score') {
             $counter++;
             $line = array();
             $line[] = $competence->langs[$lang_code]['name'];
             $line[] = $competence->langs[$lang_code]['description'];
             $line[] = $competence->typology;
             $line[] = Form::getInputTextfield('textfield', 'score_assigned_' . $id, 'score_assigned[' . $id . ']', $std_value, '', 255, '');
             $table->addBody($line);
         }
     }
     if ($counter > 0) {
         $foot = array(array('colspan' => 3, 'label' => ''), Form::getInputTextfield('textfield', 'score_assigned', false, $std_value, '', 255, '') . '<br />' . Form::getButton('set_score', 'set_score', Lang::t('_SET', 'standard'), false, '', true, false) . Form::getButton('reset_score', 'reset_score', Lang::t('_RESET', 'standard'), false, '', true, false));
         $table->addFoot($foot);
         $title_arr = array('index.php?r=' . $this->base_link_course . '/show' => Lang::t('_COURSES', 'course'), $back_url => Lang::t('_COMPETENCES', 'competences'), Lang::t('_SCORE'));
         $this->render('mod_course_assign_score', array('id_course' => $id_course, 'title_arr' => $title_arr, 'table' => $table));
     } else {
         //go back to main page, no score to assign
         Util::jump_to($back_url);
     }
 }
Example #16
0
 /**
  * @return string the html needed for the lost user / password mask
  */
 function getLostpwd($jump_url, $platform)
 {
     $lang =& DoceboLanguage::createInstance('register', $platform);
     require_once _base_ . '/lib/lib.form.php';
     $html = '';
     // request form
     $html .= '<div class="lostpwd_box">' . "\n" . '<span class="text_bold">' . $lang->def('_LOST_TITLE_USER') . ' - </span>' . $lang->def('_LOST_INSTRUCTION_USER');
     if (Get::sett('ldap_used') == 'off') {
         $html .= Form::openForm('lost_user', $jump_url) . Form::openElementSpace('form_right') . Form::getLabel('email', $lang->def('_EMAIL'), 'text_bold') . Form::getInputTextfield('textfield', 'email', 'email', '', strip_tags($lang->def('_EMAIL')), 255, '') . Form::getButton('email_ins', 'email_ins', $lang->def('_SEND'), 'button_nowh') . Form::closeElementSpace() . Form::closeForm();
     } else {
         $html .= '<div class="form_right"><span class="font_red">' . $lang->def('_LDAPACTIVE') . '</span></div>';
     }
     $html .= '</div>';
     $html .= '<div class="lostpwd_box">' . "\n" . '<span class="text_bold">' . $lang->def('_LOST_TITLE_PWD') . ' - </span>' . $lang->def('_LOST_INSTRUCTION_PWD') . Form::openForm('lost_pwd', $jump_url) . Form::openElementSpace('form_right') . Form::getLabel('email', $lang->def('_USERNAME'), 'text_bold') . Form::getInputTextfield('textfield', 'userid', 'userid', '', strip_tags($lang->def('_USERNAME')), 255, '') . Form::getButton('userid_ins', 'userid_ins', $lang->def('_SEND'), 'button_nowh') . Form::closeElementSpace() . Form::closeForm() . '</div>';
     return $html;
 }
 public function man_competences_properties()
 {
     $base_url = 'index.php?r=adm/functionalroles/show';
     //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_competences&id=' . (int) $id_fncrole;
     $list = $this->model->getCompetences($id_fncrole);
     if (count($list) <= 0) {
         Util::jump_to($back_url);
     }
     //no competences to edit
     $cmodel = new CompetencesAdm();
     $cinfo = $cmodel->getCompetencesInfo($list);
     require_once _base_ . '/lib/lib.table.php';
     $table = new Table();
     $head_label = array(Lang::t('_NAME', 'standard'), Lang::t('_DESCRIPTION', 'standard'), Lang::t('_TYPOLOGY', 'competences'), Lang::t('_TYPE', 'competences'), Lang::t('_MIN_SCORE', 'comeptences'), Lang::t('_EXPIRATION_DAYS', 'competences'));
     $head_style = array('', '', 'img-cell', 'img-cell', 'img-cell', 'img-cell');
     $table->addHead($head_label, $head_style);
     $count_score = 0;
     $_std_score = 0;
     $_std_expiration = 0;
     $lang_code = getLanguage();
     $properties = $this->model->getCompetencesProperties($list);
     while (list($key, $value) = each($cinfo)) {
         $line = array();
         $line[] = $value->langs[$lang_code]['name'];
         $line[] = $value->langs[$lang_code]['description'];
         $line[] = $value->typology;
         $line[] = $value->type;
         $line[] = $value->type == 'score' ? Form::getInputTextfield('textfield', 'score_assigned_' . $key, 'properties[' . $key . '][score]', $properties[$key]->score, '', 255) : '-' . Form::getHidden('score_flag_' . $key, 'properties[' . $key . '][score]', 1);
         $line[] = Form::getInputTextfield('textfield', 'expiration_' . $key, 'properties[' . $key . '][expiration]', $properties[$key]->expiration, '', 255);
         $table->addBody($line);
         if ($value->type == 'score') {
             $count_score++;
         }
     }
     $foot = array(array('colspan' => $count_score > 0 ? 4 : 5));
     if ($count_score > 0) {
         //set score to all competences
         $foot[] = Form::getInputTextfield('textfield', 'score_value', false, $_std_score, '', 255) . '<br />' . Form::getButton('set_score', 'set_score', Lang::t('_SET', 'standard'), false, '', true, false) . Form::getButton('reset_score', 'reset_score', Lang::t('_RESET', 'standard'), false, '', true, false);
     }
     //set expiration days to all competences
     $foot[] = Form::getInputTextfield('textfield', 'expiration_value', false, $_std_expiration, '', 255) . '<br />' . Form::getButton('set_expiration', 'set_expiration', Lang::t('_SET', 'standard'), false, '', true, false) . Form::getButton('reset_expiration', 'reset_expiration', Lang::t('_RESET', 'standard'), false, '', true, false);
     $table->addFoot($foot);
     $title_arr = array($base_url => Lang::t('_FUNCTIONAL_ROLE', 'fncroles'), $back_url => Lang::t('_COMPETENCES', 'fncroles') . ': ' . $this->model->getFunctionalRoleName($id_fncrole), Lang::t('_PROPERTIES', 'fncroles'));
     $this->render('man_competences_properties', array('id_fncrole' => $id_fncrole, 'title_arr' => $title_arr, 'table' => $table));
 }
Example #18
0
function mycourses(&$url)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.user_profile.php';
    $lang =& DoceboLanguage::createInstance('catalogue');
    require_once $GLOBALS['where_lms'] . '/lib/lib.middlearea.php';
    $ma = new Man_MiddleArea();
    $course_stats = userCourseList($url, $ma->currentCanAccessObj('lo_tab'));
    $access_career = $ma->currentCanAccessObj('career');
    $access_news = $ma->currentCanAccessObj('news');
    $access_search_form = $ma->currentCanAccessObj('search_form');
    $access_user_details_full = $ma->currentCanAccessObj('user_details_full');
    $access_user_details_short = $ma->currentCanAccessObj('user_details_short');
    $onecol = !$access_career && !$access_news && !$access_user_details_full && !$access_user_details_short;
    require_once $GLOBALS['where_framework'] . '/lib/lib.myfriends.php';
    $friends = new MyFriends(getLogUserId());
    $pendent = count($friends->getPendentRequest());
    $GLOBALS['page']->addStart('' . '<div id="mycourse_top">' . ($onecol ? '' : '<div class="mycourse_left">'), 'content');
    // user_details_short ------------------------------------------------------------------------
    if ($access_user_details_short) {
        $profile = new UserProfile(getLogUserId());
        $profile->init('profile', 'framework', 'index.php?r=' . _after_login_, 'ap');
        $GLOBALS['page']->addStart($profile->userIdMailProfile('normal', false, false), 'content');
    }
    // user_details_full ------------------------------------------------------------------------
    if ($access_user_details_full) {
        $profile = new UserProfile(getLogUserId());
        $profile->init('profile', 'framework', 'index.php?r=' . _after_login_, 'ap');
        $GLOBALS['page']->addStart($profile->homeUserProfile('normal', false, false), 'content');
    }
    // career ------------------------------------------------------------------------
    if ($access_career) {
        $base_url = 'index.php?r=' . _after_login_ . '&amp;filter=';
        $end = 0;
        if (isset($course_stats['with_ustatus'][_CUS_END]) && $course_stats['with_ustatus'][_CUS_END] != 0) {
            $end = $course_stats['with_ustatus'][_CUS_END];
        }
        $GLOBALS['page']->addStart('' . '<div class="course_stat">' . '<table summary="">' . '<caption>' . $lang->def('_CAREER') . '</caption>' . '<tr><th scope="row">' . $lang->def('_TOTAL_COURSE') . ' :</th><td><a href="' . $base_url . 'nothing">' . ($course_stats['total'] - $end) . '</a></td></tr>' . (isset($course_stats['with_ustatus'][_CUS_END]) && $course_stats['with_ustatus'][_CUS_END] != 0 ? '<tr><th scope="row">' . $lang->def('_COURSE_END') . ' :</th><td><a href="' . $base_url . 'end">' . $course_stats['with_ustatus'][_CUS_END] . '</a></td></tr>' : '') . (isset($course_stats['expiring']) && $course_stats['expiring'] != 0 ? '<tr><th scope="row">' . $lang->def('_COURSE_EXPIRING') . ' :</th><td><a href="' . $base_url . 'expiring">' . $course_stats['expiring'] . '</a></td></tr>' : ''), 'content');
        if (count($course_stats['with_ulevel']) > 1) {
            require_once $GLOBALS['where_lms'] . '/lib/lib.levels.php';
            $lvl = CourseLevel::getLevels();
            foreach ($course_stats['with_ulevel'] as $lvl_num => $quantity) {
                $GLOBALS['page']->addStart('' . '<tr><th scope="row">' . str_replace('[level]', $lvl[$lvl_num], $lang->def('_COURSE_AS')) . ' :</th><td><a href="' . $base_url . 'level&amp;filter_on=' . $lvl_num . '">' . $quantity . '</a></td></tr>', 'content');
            }
            //end foreach
        }
        $query = "SELECT c.idMetaCertificate, m.idCertificate" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course as c" . " JOIN " . $GLOBALS['prefix_lms'] . "_certificate_meta as m ON c.idMetaCertificate = m.idMetaCertificate" . " WHERE c.idUser = '******'" . " GROUP BY c.idMetaCertificate" . " ORDER BY m.title, m.description";
        $result = sql_query($query);
        $num_meta_cert = mysql_num_rows($result);
        while (list($id_meta, $id_certificate) = sql_fetch_row($result)) {
            $query_released = "SELECT on_date" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_assign" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'";
            $result_released = sql_query($query_released);
            $query = "SELECT user_release" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate" . " WHERE id_certificate = '" . $id_certificate . "'";
            list($user_release) = sql_fetch_row(sql_query($query));
            if (mysql_num_rows($result_released)) {
            } elseif ($user_release == 0) {
                $num_meta_cert--;
            } else {
                $query = "SELECT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'";
                $result_int = sql_query($query);
                $control = true;
                while (list($id_course) = sql_fetch_row($result_int)) {
                    $query = "SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser" . " WHERE idCourse = '" . $id_course . "'" . " AND idUser = '******'" . " AND status = '" . _CUS_END . "'";
                    list($number) = sql_fetch_row(sql_query($query));
                    if (!$number) {
                        $control = false;
                    }
                }
                if (!$control) {
                    $num_meta_cert--;
                }
            }
        }
        $tot_cert = $num_meta_cert + $course_stats['cert_relesable'];
        $GLOBALS['page']->addStart('' . (isset($course_stats['cert_relesable']) && $tot_cert != 0 ? '<tr><th scope="row">' . $lang->def('_CERT_RELESABLE') . ' :</th><td><a href="index.php?modname=mycertificate&amp;op=mycertificate">' . $tot_cert . '</a></td></tr>' : '') . ($pendent != 0 ? '<tr><th scope="row">' . $lang->def('_FRIEND_PENDENT') . ' :</th><td><a href="index.php?modname=myfriends&amp;op=myfriends">' . $pendent . '</a></td></tr>' : '') . '</table>' . '</div>', 'content');
    }
    // career ------------------------------------------------------------------------
    if ($access_search_form) {
        $year_array = array(0 => $lang->def('_ALL_YEAR'));
        $query_year = "SELECT DISTINCT create_date" . " FROM " . $GLOBALS['prefix_lms'] . "_course";
        $result = sql_query($query_year);
        while (list($year) = sql_fetch_row($result)) {
            $year_array[$year[0] . $year[1] . $year[2] . $year[3]] = $year[0] . $year[1] . $year[2] . $year[3];
        }
        if (isset($year_array['0000'])) {
            unset($year_array['0000']);
        }
        $GLOBALS['page']->addStart('' . '<div class="course_search">' . '<h2>' . $lang->def('_SEARCH') . '</h2>' . Form::openForm('course_filter', 'index.php?modname=course&amp;op=mycourses') . '<p>' . Form::getLabel('search', $lang->def('_WORD')) . '</p>' . Form::getInputTextfield('textfield_nowh', 'search', 'search', importVar('search'), $lang->def('_WORD'), '255', '') . '<br/>' . '<p>' . Form::getLabel('year', $lang->def('_YEAR')) . '</p>' . Form::getInputDropdown('dropdown_nowh', 'year', 'year', $year_array, importVar('year'), '') . Form::getButton('apply_filter', 'apply_filter', $lang->def('_SEARCH')) . Form::closeForm() . '</div>', 'content');
    }
    // news ------------------------------------------------------------------------
    if ($access_news) {
        $GLOBALS['page']->addStart('' . '<div class="course_news">' . '<h2>' . $lang->def('_NEWS') . '</h2>', 'content');
        $user_level = Docebo::user()->getUserLevelId();
        $user_assigned = Docebo::user()->getArrSt();
        $query_news = "\r\n\t\tSELECT idNews, publish_date, title, short_desc, important, viewer\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_news_internal\r\n\t\tWHERE language = '" . getLanguage() . "'\r\n\t\tORDER BY important DESC, publish_date DESC ";
        $re_news = sql_query($query_news);
        $displayed = 0;
        while (list($id_news, $publish_date, $title, $short_desc, $impo, $viewer) = sql_fetch_row($re_news)) {
            $viewer = is_string($viewer) && $viewer != false ? unserialize($viewer) : array();
            $intersect = array_intersect($user_assigned, $viewer);
            if (!empty($intersect) || empty($viewer)) {
                $GLOBALS['page']->addStart('<h3>' . $title . '</h3>' . '<div class="news_textof">' . '<span class="news_data">' . Format::date($publish_date, 'date') . ' - </span>' . $short_desc . '</div>', 'content');
                $displayed++;
            }
        }
        // end news display
        if (!$displayed) {
            $GLOBALS['page']->addStart($lang->def('_NO_CONTENT'), 'content');
        }
        $GLOBALS['page']->addStart('' . '</div>', 'content');
    }
    if (!$onecol) {
        $GLOBALS['page']->addStart('' . '</div>', 'content');
        $GLOBALS['page']->addStart('' . '<div id="mycourse_right">', 'content');
    }
    // ------------------------------------------------------------------------
    if (!$onecol) {
        $GLOBALS['page']->addEnd('' . '</div>' . '<div class="nofloat"></div>', 'content');
    }
    $GLOBALS['page']->addEnd('' . '</div>', 'content');
    if ($ma->currentCanAccessObj('lo_tab')) {
        $current_tab = importVar('current_tab', false, 'lo_plan');
        $GLOBALS['page']->addStart('<div class="lo_tab">' . '<h1>' . $lang->def('_WELCOME') . ': ' . '<span>' . Docebo::user()->getUserName() . '</span>' . '</h1>' . '<ul class="flat_tab">' . ($course_stats['with_ustatus'][_CUS_END] != $course_stats['total'] ? '<li ' . ($current_tab == 'lo_plan' ? 'class="now_selected"' : '') . '>' . '<a href="index.php?modname=course&amp;op=mycourses&amp;current_tab=lo_plan"><span>' . $lang->def('_COURSE') . '</span></a></li>' : '') . ($course_stats['with_ustatus'][_CUS_END] != 0 ? '<li ' . ($current_tab == 'lo_history' ? 'class="now_selected"' : '') . '>' . '<a href="index.php?modname=course&amp;op=mycourses&amp;current_tab=lo_history"><span>' . $lang->def('_COMPLETED') . '</span></a></li>' : '') . ($course_stats['with_wstatus'][_CUS_RESERVED] != 0 || $course_stats['with_wstatus'][_CUS_WAITING_LIST] != 0 ? '<li ' . ($current_tab == 'lo_waiting' ? 'class="now_selected"' : '') . '>' . '<a href="index.php?modname=course&amp;op=mycourses&amp;current_tab=lo_waiting"><span>' . $lang->def('_LO_WAITING') . '</span></a></li>' : '') . '</ul>' . '</div>', 'content');
    } else {
        $GLOBALS['page']->addStart('<div class="lo_tab">' . '<h1 class="no_tab">' . $lang->def('_WELCOME') . ': ' . '<span>' . Docebo::user()->getUserName() . '</span>' . '</h1>' . '</div>', 'content');
    }
}
Example #19
0
function course()
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    //require_once(_i18n_.'/lib.lang.php');
    require_once _base_ . '/lib/lib.table.php';
    require_once _lms_ . '/lib/lib.course.php';
    $GLOBALS['page']->setWorkingZone('content');
    $lang =& DoceboLanguage::CreateInstance('course', 'lms');
    $db =& DbConn::getInstance();
    Util::get_js(Get::rel_path('base') . '/widget/dialog/dialog.js', true, true);
    // Setup the tree viewer class ----------------------------------------------
    require_once _lms_ . '/lib/folder_tree/class.category_tree.php';
    $treeView = new CategoryFolderTree('courses_categories', true);
    $treeView->useDOMReady = true;
    //to change
    $treeView->isGlobalVariable = true;
    //just for debug purpose
    $treeView->initLibraries();
    $print_tree = $treeView->get();
    // Setup the course table ---------------------------------------------------
    //$man_course = new Man_Course();
    //$course_list = $man_course->getCoursesRequest($table_status['startIndex'], Get::sett('visuItem'), $table_status['sort'], $table_status['dir']);
    //$db->num_rows($course_list),
    //$man_course->getCoursesCountFiltered(),
    if (!isset($_SESSION['course_category']['filter_status'])) {
        $_SESSION['course_category']['filter_status'] = array('c_category' => 0, 'c_filter' => '', 'c_flatview' => false, 'c_waiting' => false);
    }
    $filter_status =& $_SESSION['course_category']['filter_status'];
    if (isset($filter_status['c_flatview']) || isset($filter_status['c_waiting'])) {
        $open = true;
    } else {
        $open = false;
    }
    if (!isset($_SESSION['course_category']['table_status'])) {
        $_SESSION['course_category']['table_status'] = array('startIndex' => 0, 'sort' => 'name', 'dir' => 'asc');
    }
    $table_status =& $_SESSION['course_category']['table_status'];
    // Setup the course table ---------------------------------------------------
    $table_config = array('startIndex' => $table_status['startIndex'], 'results' => Get::sett('visuItem'), 'sort' => $table_status['sort'], 'dir' => $table_status['dir'], 'pageSize' => 0, 'totalRecords' => 0, 'recordsReturned' => array());
    require_once _lms_ . '/lib/table_view/class.coursetableview.php';
    $tableView = new CourseTableView("courses_list");
    $tableView->useDOMReady = true;
    //to change
    $tableView->isGlobalVariable = true;
    //just for debug purpose
    $tableView->initLibraries();
    $tableView->setInitialData($table_config);
    $print_table = $tableView->get();
    //Script for saving data from inline editor
    cout("\n" . '<script type="text/javascript">
			function saveData(callback, newData) {
			var new_value = newData;
			var col = this.getColumn().key;
			var old_value =  this.value;
			var datatable = this.getDataTable();
			var idCourse = this.getRecord().getData("idCourse");

			var myCallback =
			{
				success: function(o)
				{
					var r = YAHOO.lang.JSON.parse(o.responseText);
					if (r.success)
					{
						callback(true, stripSlashes(r.new_value));
					}
					else
					{
						callback(true, stripSlashes(r.old_value));
					}
				},
				failure:
				{
				}
			}

			var post =	"idCourse=" + idCourse
						+"&col=" + col
						+"&new_value=" + new_value
						+"&old_value=" + old_value;

			var url = "ajax.adm_server.php?plf=lms&file=coursetableview&sf=table_view&command=updateField&";

			YAHOO.util.Connect.asyncRequest("POST", url, myCallback, post);
			}
		</script>');
    // Js needed for this page in order to work
    cout("\n" . '<script type="text/javascript">
	//<!--
	course_tree_options = ' . $print_tree['options'] . ';
	-->
	</script>', 'scripts');
    cout("\n" . '<script type="text/javascript">
	//<!--
	course_table_options = ' . $print_table['options'] . ';
	--></script>', 'scripts');
    cout("\n" . '<script type="text/javascript" src="' . Get::rel_path('lms') . '/admin/modules/course/course.js"></script>', 'scripts');
    cout(getTitleArea($lang->def('_COURSES'), 'course') . '<div class="std_block">' . (isset($_GET['result']) ? guiResultStatus($lang, $_GET['result']) : ''), 'content');
    // Show tree
    cout('<h2>' . $lang->def('_CATEGORY') . '</h2>' . $print_tree['html'] . '<div class="folder_action_space">' . '<a id="add_folder_button" class="ico-wt-sprite subs_add" href="#"><span>' . $lang->def('_NEW_CATEGORY') . '</span></a>' . '</div>', 'content');
    // Show filter
    cout('<div class="quick_search_form">' . '<div class="common_options">' . Form::getInputCheckbox('c_flatview', 'c_flatview', '1', $filter_status['c_flatview'] ? true : false, '') . ' <label class="label_normal" for="c_flatview">' . Lang::t('_DIRECTORY_FILTER_FLATMODE', 'admin_directory') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getInputCheckbox('c_waiting', 'c_waiting', '1', $filter_status['c_waiting'] ? true : false, '') . ' <label class="label_normal" for="c_waiting">' . Lang::t('_WAITING_USERS', 'organization_chart') . '</label>' . '</div>' . '<br />' . '<div>' . Form::openForm('course_filters', 'index.php?modname=course&amp;op=course_list') . Form::getInputTextfield("search_t", "c_filter", "c_filter", $filter_status['c_filter'], '', 255, '') . Form::getButton("c_filter_set", "c_filter_set", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("c_filter_reset", "c_filter_reset", Lang::t('_RESET', 'standard'), "reset_b") . Form::closeForm() . '</div>' . '</div>', 'content');
    // show course table
    cout('' . '<div class="table-container-over">' . (checkPerm('add', true, 'course', 'lms') ? '<a class="ico-wt-sprite subs_add" href="index.php?modname=course&amp;op=new_course"><span>' . $lang->def('_NEW_COURSE') . '</span></a>' : '') . (checkPerm('subscribe', true, 'course', 'lms') ? '&nbsp;&nbsp;<a class="ico-wt-sprite subs_users" href="index.php?r=alms/subscription/multiplesubscription&amp;load=1"><span>' . Lang::t('_MULTIPLE_SUBSCRIPTION', 'course') . '</span></a>' : '') . '</div>' . $print_table['html'] . '<div class="table-container-below">' . (checkPerm('add', true, 'course', 'lms') ? '<a class="ico-wt-sprite subs_add" href="index.php?modname=course&amp;op=new_course"><span>' . $lang->def('_NEW_COURSE') . '</span></a>' : '') . (checkPerm('subscribe', true, 'course', 'lms') ? '&nbsp;&nbsp;<a class="ico-wt-sprite subs_users" href="index.php?r=alms/subscription/multiplesubscription&amp;load=1"><span>' . Lang::t('_MULTIPLE_SUBSCRIPTION', 'course') . '</span></a>' : '') . '</div>', 'content');
    //set event listeners to filter elements
    cout('<script type="text/javascript">$E=YAHOO.util.Event; $E.onDOMReady( function(e) {
			$E.addListener("c_filter_set", "click", filterEvent);
			$E.addListener("c_filter_reset", "click", function() { YAHOO.util.Dom.get("c_filter").value=""; filterEvent; });
			$E.addListener("c_flatview", "click", filterEvent);
			$E.addListener("c_waiting", "click", filterEvent);
			$E.addListener("course_filters", "submit", function(ev) { filterEvent(ev); YAHOO.util.Event.preventDefault(ev); });
		});</script>', 'scripts');
    cout('</div>', 'content');
}
Example #20
0
 public static function getInputDatefield($css_field, $id, $name, $value = '', $date_format = FALSE, $sel_time = FALSE, $alt_name = '', $other_param = '')
 {
     $value = $value == '00-00-0000' ? '' : $value;
     if ($date_format == false) {
         $regset = Format::instance();
         $date_format = $regset->date_token;
     }
     if ($css_field == false) {
         $css_field = 'textfield';
     }
     Form::loadDatefieldScript($date_format);
     $date = "";
     $iso = Format::dateDb($value, 'date');
     if ($value != '' && $value != '0000-00-00 00:00:00') {
         $timestamp = mktime(0, 0, 0, (int) substr($iso, 5, 2), (int) substr($iso, 8, 2), (int) substr($iso, 0, 4));
         $date = date("m/d/Y", $timestamp);
     }
     $other_after_b = '<span id="calendar_button_' . $id . '" class="yui-button"><span class="first-child docebo_calendar">' . '<button type="button"></button></span></span>' . '<div id="calendar_menu_' . $id . '"><div id="calendar_container_' . $id . '"></div></div>';
     if (defined("IS_AJAX")) {
         if (!isset($GLOBALS['date_inputs'])) {
             $GLOBALS['date_inputs'] = array();
         }
         $GLOBALS['date_inputs'][] = array($id, $date, $date_format);
     } else {
         $script = '<script type="text/javascript">' . 'YAHOO.util.Event.onDOMReady(function() {' . '	YAHOO.dateInput.setCalendar("' . $id . '", "' . $date . '", "' . $date_format . '");' . '});</script>';
         cout($script, 'scripts');
         //script in the scripts page section, this ensure to have it after the YAHOO.dateInput declaration
     }
     return Form::getInputTextfield($css_field, $id, $name, Format::date($iso, 'date'), $alt_name, '30', '');
 }
Example #21
0
function modactivityscore()
{
    checkPerm('mod');
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    // XXX: Initializaing
    $id_report = importVar('id_report', true, 0);
    $lang =& DoceboLanguage::createInstance('coursereport', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    // XXX: Instance management
    $acl_man = Docebo::user()->getAclManager();
    $report_man = new CourseReportManager();
    // XXX: Find users
    $type_filter = false;
    if (isset($_GET['type_filter']) && $_GET['type_filter'] != null) {
        $type_filter = $_GET['type_filter'];
    }
    $lev = $type_filter;
    $students = getSubscribed((int) $_SESSION['idCourse'], FALSE, $lev, TRUE, false, false, true);
    $id_students = array_keys($students);
    $students_info =& $acl_man->getUsers($id_students);
    if (isset($_POST['save'])) {
        // retirive activity info
        $info_report = array('id_report' => importVar('id_report', true, 0), 'title' => importVar('title'), 'max_score' => importVar('max_score', true), 'required_score' => importVar('required_score', true), 'source_of' => importVar('source_of'), 'weight' => importVar('weight', true), 'show_to_user' => importVar('show_to_user', false, 'true'), 'use_for_final' => importVar('use_for_final', false, 'true'));
        // XXX: retrive scores
    } else {
        // retirive activity info
        $query_report = "\r\n\t\tSELECT id_report, title, max_score, required_score, weight, show_to_user, use_for_final, id_source, source_of\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_coursereport\r\n\t\tWHERE id_course = '" . $_SESSION['idCourse'] . "' AND id_report = '" . $id_report . "'\r\n\t\t\t\tAND (source_of = 'scoitem' OR source_of = 'activity')";
        // TBD AND id_source = '0'";
        $info_report = sql_fetch_assoc(sql_query($query_report));
        // XXX: retrive scores
        $report_score =& $report_man->getReportsScores(array($id_report));
    }
    // XXX: Write in output
    $page_title = array('index.php?modname=coursereport&amp;op=coursereport' => $lang->def('_COURSEREPORT', 'menu_course'), strip_tags($info_report['title']));
    $out->add(getTitleArea($page_title, 'coursereport') . '<div class="std_block">' . Form::openForm('activity', 'index.php?modname=coursereport&amp;op=modactivityscore'));
    // XXX: Save input if needed
    if (isset($_POST['save'])) {
        if ($_POST['title'] == '') {
            $_POST['title'] = $lang->def('_NOTITLE');
        }
        $re_check = $report_man->checkActivityData($_POST);
        if (!$re_check['error']) {
            if (!$report_man->updateActivity($id_report, $_SESSION['idCourse'], $info_report)) {
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
            } else {
                // save user score modification
                $query_upd_report = "\r\n\t\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_coursereport\r\n\t\t\t\tSET weight = '" . $info_report['weight'] . "',\r\n\t\t\t\t\tuse_for_final = '" . $info_report['use_for_final'] . "',\r\n\t\t\t\t\tshow_to_user = '******'show_to_user'] . "'\r\n\t\t\t\tWHERE id_course = '" . $_SESSION['idCourse'] . "' AND id_report = '" . $id_report . "'";
                $re = sql_query($query_upd_report);
                $re = $report_man->saveReportScore($id_report, $_POST['user_score'], $_POST['date_attempt'], $_POST['comment']);
                Util::jump_to('index.php?modname=coursereport&amp;op=coursereport&result=' . ($re ? 'ok' : 'err'));
            }
        } else {
            $out->add(getErrorUi($re_check['message']));
        }
    }
    // main form
    $out->add(Form::openElementSpace() . Form::getOpenFieldSet($lang->def('_ACTIVITY_INFO')) . Form::getHidden('id_report', 'id_report', $id_report) . Form::getHidden('id_source', 'id_source', $info_report['id_source']) . Form::getHidden('source_of', 'source_of', $info_report['source_of']));
    // for scorm object changing title, maxScore and requiredScore is not allowed
    switch ($info_report['source_of']) {
        case 'scoitem':
            $out->add(Form::getLinebox($lang->def('_TITLE_ACT'), strip_tags($info_report['title'])) . Form::getLinebox($lang->def('_MAX_SCORE'), strip_tags($info_report['max_score'])) . Form::getLinebox($lang->def('_REQUIRED_SCORE'), strip_tags($info_report['required_score'])));
            break;
        case 'activity':
            $out->add(Form::getTextfield($lang->def('_TITLE_ACT'), 'title', 'title', '255', $info_report['title']) . Form::getTextfield($lang->def('_MAX_SCORE'), 'max_score', 'max_score', '11', $info_report['max_score']) . Form::getTextfield($lang->def('_REQUIRED_SCORE'), 'required_score', 'required_score', '11', $info_report['required_score']));
            break;
    }
    $out->add(Form::getTextfield($lang->def('_WEIGHT'), 'weight', 'weight', '11', $info_report['weight']) . Form::getDropdown($lang->def('_SHOW_TO_USER'), 'show_to_user', 'show_to_user', array('true' => $lang->def('_YES'), 'false' => $lang->def('_NO')), $info_report['show_to_user']) . Form::getDropdown($lang->def('_USE_FOR_FINAL'), 'use_for_final', 'use_for_final', array('true' => $lang->def('_YES'), 'false' => $lang->def('_NO')), $info_report['use_for_final']) . Form::getCloseFieldSet() . Form::closeElementSpace());
    if ($info_report['source_of'] != 'scoitem') {
        /* XXX: scores */
        $tb = new Table(0, $lang->def('_STUDENTS_VOTE'), $lang->def('_STUDENTS_VOTE'));
        $type_h = array('', 'align-center', 'align-center', '');
        $tb->setColsStyle($type_h);
        $cont_h = array($lang->def('_STUDENTS'), $lang->def('_SCORE'), $lang->def('_DATE'), $lang->def('_COMMENTS'));
        $tb->addHead($cont_h);
        // XXX: Display user scores
        $i = 0;
        while (list($idst_user, $user_info) = each($students_info)) {
            $user_name = $user_info[ACL_INFO_LASTNAME] . $user_info[ACL_INFO_FIRSTNAME] ? $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME] : $acl_man->relativeId($user_info[ACL_INFO_USERID]);
            $cont = array(Form::getLabel('user_score_' . $idst_user, $user_name));
            $cont[] = Form::getInputTextfield('textfield_nowh', 'user_score_' . $idst_user, 'user_score[' . $idst_user . ']', isset($report_score[$id_report][$idst_user]['score']) ? $report_score[$id_report][$idst_user]['score'] : (isset($_POST['user_score'][$idst_user]) ? $_POST['user_score'][$idst_user] : ''), strip_tags($lang->def('_SCORE')), '8', ' tabindex="' . $i++ . '" ');
            $cont[] = Form::getInputDatefield('textfield_nowh', 'date_attempt_' . $idst_user, 'date_attempt[' . $idst_user . ']', Format::date(isset($report_score[$id_report][$idst_user]['date_attempt']) ? $report_score[$id_report][$idst_user]['date_attempt'] : (isset($_POST['date_attempt'][$idst_user]) ? $_POST['date_attempt'][$idst_user] : ''), 'date'));
            $cont[] = Form::getInputTextarea('comment_' . $idst_user, 'comment[' . $idst_user . ']', isset($report_score[$id_report][$idst_user]['comment']) ? $report_score[$id_report][$idst_user]['comment'] : (isset($_POST['comment'][$idst_user]) ? stripslashes($_POST['comment'][$idst_user]) : ''), 'textarea_wh_full', 2);
            $tb->addBody($cont);
        }
    }
    $out->add(Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace());
    if ($info_report['source_of'] != 'scoitem') {
        $out->add($tb->getTable() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace());
    }
    $out->add(Form::closeForm() . '</div>');
}
Example #22
0
 function getWikiSearchBox()
 {
     $res = "";
     require_once _base_ . "/lib/lib.form.php";
     $form = new Form();
     $um =& UrlManager::getInstance();
     $page_code = $this->getPageCode();
     $res .= '<div class="wiki_search_box">';
     $search_txt = isset($_POST["search_txt"]) ? $_POST["search_txt"] : "";
     $url = $um->getUrl("op=search&page=" . $page_code);
     $res .= $form->openForm('wiki_search', $url);
     $res .= '<div class="wiki_search_line form_line_l">';
     $res .= '<label for="search_txt">' . $this->lang->def('_SEARCH') . ':</label> ';
     $res .= $form->getInputTextfield('textfield_nowh', 'search_txt', 'search_txt', $search_txt, $this->lang->def('_SEARCH'), 255, '');
     $res .= '<input class="button_nowh" type="submit" id="search_button" name="search_button" value="' . $this->lang->def('_SEARCH') . '" />';
     $res .= '</div>';
     $res .= $form->closeForm();
     $res .= "</div>\n";
     return $res;
 }
Example #23
0
<?php

switch ($step) {
    //step 1 : choose file and reading options
    case 1:
        echo getTitleArea(Lang::t('_ORG_CHART_IMPORT_USERS', 'organization_chart'), 'directory_group');
        echo '<div class="std_block">';
        echo Form::getFormHeader(Lang::t('_ASSIGN_USERS', 'admin_directory'));
        echo Form::openForm('directory_importgroupuser', 'index.php?r=' . $this->link . '/importusers', false, false, 'multipart/form-data');
        //echo Form::getHidden('id', 'id', $id_org);
        echo Form::getHidden('step', 'step', 2);
        echo Form::openElementSpace();
        echo Form::getFilefield(Lang::t('_GROUP_USER_IMPORT_FILE', 'admin_directory'), 'file_import', 'file_import');
        //echo Form::getTextfield(Lang::t('_GROUP_USER_IMPORT_SEPARATOR', 'admin_directory'), 'import_separator', 'import_separator', 1, ',');
        echo Form::getRadioSet(Lang::t('_GROUP_USER_IMPORT_SEPARATOR', 'admin_directory'), 'import_separator', 'import_separator', array(Lang::t('_AUTODETECT', 'standard') => 'auto', '<b>,</b>' => 'comma', '<b>;</b>' => 'dotcomma', Lang::t('_MANUAL', 'standard') . ':&nbsp;' . Form::getInputTextfield('', 'import_separator_manual', 'import_separator_manual', "", "", 255) => 'manual'), 'auto');
        echo Form::getCheckbox(Lang::t('_GROUP_USER_IMPORT_HEADER', 'admin_directory'), 'import_first_row_header', 'import_first_row_header', 'true', true);
        echo Form::getTextfield(Lang::t('_GROUP_USER_IMPORT_CHARSET', 'admin_directory'), 'import_charset', 'import_charset', 20, 'UTF-8');
        echo Form::getDropdown(Lang::t('_DIRECTORY_MEMBERTYPETREE', 'admin_directory'), 'id', 'id', $orgchart_list, $id_org);
        echo Form::getRadioSet(Lang::t('_FORCE_PASSWORD_CHANGE', 'admin_directory'), 'pwd_force_change_policy', 'pwd_force_change_policy', array(Lang::t('_NO', 'standard') => 'false', Lang::t('_YES', 'standard') => 'true', Lang::t('_SERVERINFO', 'configuration') => 'by_setting', Lang::t('_DO_NOTHING', 'preassessment') => 'do_nothing'), 'do_nothing');
        echo Form::closeElementSpace();
        echo Form::openButtonSpace();
        echo Form::getButton('import_groupuser_2', 'import_groupuser_2', Lang::t('_NEXT', 'standard'));
        echo Form::getButton('import_groupcancel', 'import_groupcancel', Lang::t('_UNDO', 'standard'));
        echo Form::closeButtonSpace();
        echo Form::closeForm();
        echo '</div>';
        break;
        //step 2 : set columns
    //step 2 : set columns
    case 2:
        echo getTitleArea(Lang::t('_ORG_CHART_IMPORT_USERS', 'organization_chart'), 'directory_group');
Example #24
0
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 = $GLOBALS['framework']['visuItem'];
    $tb = new Table($numtablerows, $lang->def('_CERTIFICATE_VIEW_CAPTION'), $lang->def('_CERTIFICATE_VIEW_CAPTION'));
    $tb->initNavBar('ini', 'button');
    $ini = $tb->getSelectedElement();
    $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;
    $res = sql_query($query);
    $from = Get::req('from', DOTY_MIXED, '');
    $back_ui = getBackUi('index.php?r=lms/pcourse/certificate&amp;id_course=' . (int) $id_course, $lang->def('_BACK'));
    $out->add(getTitleArea(array('index.php?r=lms/pcourse/certificate&amp;id_course=' . (int) $id_course => $lang->def('_CERTIFICATE_ASSIGN_STATUS', 'course'), $lang->def('_CERTIFICATE_REPORT_COURSE_CERT')), 'certificate'));
    $out->add('<div class="std_block">' . $back_ui);
    $numrows = sql_num_rows($res);
    $downloadables = array();
    if ($numrows > 0) {
        $clang =& DoceboLanguage::CreateInstance('course', 'lms');
        $type_h = array('image', '', '', '', '', '', '', 'image', 'image');
        $cont_h = array('', $lang->def('_USERNAME'), $lang->def('_LASTNAME'), $lang->def('_FIRSTNAME'), $clang->def('_STATUS'), $lang->def('_DATE'), $lang->def('_RELASE_DATE'), Get::img('course/certificate.png', Lang::t('_TITLE_VIEW_CERT', 'certificate')), Get::img('standard/delete.png', Lang::t('_DEL', 'certificate')));
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $acl_man =& $GLOBALS['current_user']->getAclManager();
        $arr_status = array(_CUS_CONFIRMED => $clang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $clang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $clang->def('_USER_STATUS_BEGIN'), _CUS_END => $clang->def('_USER_STATUS_END'), _CUS_SUSPEND => $clang->def('_USER_STATUS_SUSPEND'));
        //foreach($report_info as $info_report)
        while ($info = sql_fetch_assoc($res)) {
            $cont = array();
            $can_assign = (bool) ($info['on_date'] == '');
            $input_id = $info['id_user'];
            $sel_cell_content = '';
            $label_open = '';
            $label_close = '';
            if ($can_assign) {
                $input = '<input type="hidden" id="selection_' . $input_id . '" name="selection[' . $input_id . ']" value="' . $input_id . '"/> ';
                if (in_array($input_id, $total_selection)) {
                    $checked = ' checked="checked"';
                } else {
                    $checked = '';
                }
                $sel_cell_content .= $input . '<input type="checkbox" id="selected_' . $input_id . '" name="selected[' . $input_id . ']" value="' . $input_id . '"' . $checked . '/>';
                $label_open = '<label for="selected_' . $input_id . '">';
                $label_close = '</label>';
            }
            $userid = $acl_man->relativeId($info['userid']);
            $cont[] = $sel_cell_content;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($userid, $search_filter) : $userid) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['lastname'], $search_filter) : $info['lastname']) . $label_close;
            $cont[] = $label_open . ($search_filter != '' ? highlightText($info['firstname'], $search_filter) : $info['firstname']) . $label_close;
            $cont[] = $arr_status[$info['status']];
            $cont[] = $info['date_complete'];
            $cont[] = $info['on_date'];
            $url = 'index.php?modname=pcertificate&amp;certificate_id=' . $id_certificate . '&amp;course_id=' . $id_course . '&amp;user_id=' . $info['id_user'];
            $dl_url = $url . "&amp;op=send_certificate";
            if ($can_assign) {
                $downloadables[] = 'dl_single_' . $input_id;
            }
            $cont[] = '<a href="' . ($can_assign ? "javascript:;" : $dl_url) . '" id="dl_single_' . $input_id . '">' . Get::img('course/certificate.png', Lang::t('_TITLE_VIEW_CERT', 'certificate')) . ($can_assign ? $lang->def('_GENERATE') : $lang->def('_DOWNLOAD')) . '</a>';
            $cont[] = $can_assign ? "" : '<a href="' . $url . '&amp;op=del_report_certificate">' . Get::img('standard/delete.png', Lang::t('_DEL', 'certificate')) . '</a>';
            $tb->addBody($cont);
        }
        require_once _base_ . '/lib/lib.dialog.php';
        setupHrefDialogBox('a[href*=del_report_certificate]');
        $form = new Form();
        $form_url = "index.php?modname=pcertificate&amp;op=view_report_certificate&amp;id_certificate=" . (int) $id_certificate . "&amp;id_course=" . (int) $id_course;
        $out->add($form->openForm("certificates_emission", $form_url));
        $out->add($form->getHidden('old_selection', 'old_selection', implode(',', $total_selection)));
        //search filter ...
        $release_options = array($lang->def('_ALL') => 0, $lang->def('_ONLY_RELEASED') => 1, $lang->def('_ONLY_TO_RELEASE') => 2);
        /*
        		$out->add($form->getOpenFieldset($lang->def('_SEARCH_FILTER')));
        		$out->add($form->getTextfield($lang->def('_FILTER'), "filter", "filter", 255, $search_filter));
        		$out->add($form->getRadioSet($lang->def('_RELEASE_OPTIONS'), 'only_released', 'only_released', $release_options, $only_released).'<div class="no_float"></div>');
        		$out->add($form->openButtonSpace());
        		$out->add($form->getButton("search_button", "search_button", $lang->def('_SEARCH')));
        		$out->add($form->getButton("reset_button", "reset_button", $lang->def('_UNDO')));
        		$out->add($form->closeButtonSpace());
        		$out->add($form->getCloseFieldset());
        */
        $print_button_1 = '<div><a id="print_selected_button_1" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a></div>';
        $print_button_2 = '<div><a id="print_selected_button_2" href="javascript:;">' . Get::img('course/certificate.png', Lang::t('_GENERATE_ALL_SELECTED', 'certificate')) . Lang::t('_GENERATE_ALL_SELECTED', 'certificate') . '</a></div>';
        cout('<div class="quick_search_form">' . Form::getInputTextfield("_FILTER", "filter", "filter", $search_filter, '', 255, '') . Form::getButton("search_button", "search_button", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("reset_button", "reset_button", Lang::t('_RESET', 'standard'), "reset_b") . '<br />' . '<br />' . $lang->def('_RELEASE_OPTIONS') . ': ' . Form::getInputRadio('only_released_0', 'only_released', '0', $only_released == 0, '') . ' <label class="label_normal" for="only_released_0">' . Lang::t('_ALL', 'certificate') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getInputRadio('only_released_1', 'only_released', '1', $only_released == 1, '') . ' <label class="label_normal" for="only_released_1">' . Lang::t('_ONLY_RELEASED', 'certificate') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getInputRadio('only_released_2', 'only_released', '2', $only_released == 2, '') . ' <label class="label_normal" for="only_released_2">' . Lang::t('_ONLY_TO_RELEASE', 'certificate') . '</label>' . Form::closeForm() . '</div>', 'content');
        $navbar = $tb->getNavBar($ini, $totalrows);
        $out->add($print_button_1 . '<br />' . $navbar . $tb->getTable() . $navbar . '<br />' . $print_button_2);
        $out->add($form->closeForm());
    } else {
        $out->add($lang->def('_NO_USER_FOR_CERTIFICATE'));
    }
    $out->add($back_ui . '</div>');
    addCss('style_menu', 'lms');
    Util::get_js(Get::rel_path('lms') . '/modules/pcertificate/pcertificate.js', true, true);
    $script = 'var ajax_url="ajax.server.php?plf=lms&mn=pcertificate"; var _STOP="' . $lang->def('_STOP') . '"; ' . 'var glob_id_certificate = ' . (int) $id_certificate . ', glob_id_course = ' . (int) $id_course . ';' . 'var single_list = [' . (count($downloadables) ? '"' . implode('","', $downloadables) . '"' : '') . ']; ' . 'var reload_url = "' . str_replace('&amp;', '&', isset($form_url) ? $form_url : '') . '", _ERROR_PARSE = "' . $lang->def('_OPERATION_FAILURE') . '", _SUCCESS = "' . $lang->def('_OPERATION_SUCCESSFUL') . '";';
    $out->add('<script type="text/javascript">' . $script . '</script>', 'page_head');
}
Example #25
0
 function loadCoursepathSelector($noprint = false)
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('coursepath', 'lms');
     $output = '';
     // Filter
     $this->filter['coursepath_name'] = isset($_POST['coursepath_filter_name']) ? $_POST['coursepath_filter_name'] : '';
     if ($this->show_filter === true) {
         /*
         			$form = new Form();
         			$output .= $form->getOpenFieldset($lang->def('_COURSEPATH_FILTER'))
         				.Form::getTextfield($lang->def('_NAME'), 'coursepath_filter_name', 'coursepath_filter_name', '255',
         					( isset($_POST['coursepath_filter_name']) ? $_POST['coursepath_filter_name'] : '' ))
         				.$form->openButtonSpace()
         				.$form->getButton('coursepath_filter', 'coursepath_filter', $lang->def('_SEARCH'))
         				.$form->closeButtonSpace()
         				.$form->getCloseFieldset();*/
         $output .= '<div class="quick_search_form">' . '<div>' . Form::getInputTextfield("search_t", "coursepath_filter_name", "coursepath_filter_name", Get::req('coursepath_filter_name', DOTY_MIXED, ''), '', 255, '') . Form::getButton("coursepath_filter", "coursepath_filter", Lang::t('_SEARCH', 'standard'), "search_b") . '</div>' . '</div>';
     }
     // End Filter
     $tb = new Table(Get::sett('visuItem'), $lang->def('_COURSE_PATH_CAPTION'), $lang->def('_COURSE_PATH_SUMMARY'));
     $tb->initNavBar('ini_cpath', 'button');
     $ini = $tb->getSelectedElement();
     $select = "\r\n\t\tSELECT id_path, path_name, path_descr ";
     $query_coursepath = "\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_coursepath\r\n\t\tWHERE 1 ";
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         $all_courses = false;
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         }
         if (isset($admin_courses['course'][-1])) {
             $query = "SELECT id_path" . " FROM %lms_coursepath_user" . " WHERE idUser = '******'";
             $result = sql_query($query);
             $admin_courses['coursepath'] = array();
             while (list($id_path) = sql_fetch_row($result)) {
                 $admin_courses['coursepath'][$id_path] = $id_path;
             }
             if (!empty($admin_courses['coursepath']) && Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         }
         if (!$all_courses) {
             if (empty($admin_courses['coursepath'])) {
                 $query_coursepath .= " AND 0 ";
             } else {
                 $query_coursepath .= " AND id_path IN (" . implode(',', $admin_courses['coursepath']) . ") ";
             }
         }
     }
     if ($this->filter['coursepath_name'] != '') {
         $query_coursepath .= " AND path_name LIKE '%" . $this->filter['coursepath_name'] . "%'";
     }
     list($tot_coursepath) = sql_fetch_row(sql_query("SELECT COUNT(*) " . $query_coursepath));
     $query_coursepath .= "\r\n\t\tORDER BY path_name\r\n\t\tLIMIT " . $ini . "," . (int) Get::sett('visuItem');
     $re_coursepath = sql_query($select . $query_coursepath);
     $type_h = array('image', '', '', '');
     $cont_h = array('<span class="access-only">' . $lang->def('_SELECT') . '</span>', $lang->def('_NAME'), $lang->def('_DESCRIPTION'));
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     while (list($id_path, $name, $descr) = sql_fetch_row($re_coursepath)) {
         $tb_content = array(Form::getInputCheckbox('new_coursepath_selected_' . $id_path, 'new_coursepath_selected[' . $id_path . ']', $id_path, isset($this->current_selection[$id_path]), ''), '<label for="new_coursepath_selected_' . $id_path . '">' . $name . '</label>', '<label for="new_coursepath_selected_' . $id_path . '">' . $descr . '</label>');
         $tb->addBody($tb_content);
         if (isset($this->current_selection[$id_path])) {
             unset($this->current_selection[$id_path]);
         }
     }
     $output .= $tb->getTable() . $tb->getNavBar($ini, $tot_coursepath) . $this->stateSelection();
     if ($noprint) {
         return $output;
     } else {
         cout($output, 'content');
     }
 }
Example #26
0
function codeList()
{
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    $lang =& DoceboLanguage::createInstance('code');
    $id_code_group = Get::req('id_code_group', DOTY_INT, '0');
    $code_manager = new CodeManager();
    $acl_man = Docebo::user()->getAclManager();
    cout(getTitleArea(array('index.php?modname=code&amp;op=list' => $lang->def('_CODE'), $lang->def('_CODE_LIST'))) . '<div class="std_block">');
    if (isset($_POST['undo_filter'])) {
        unset($_POST['code_filter']);
    }
    cout('<div class="quick_search_form">' . Form::openForm('code_list_filter', 'index.php?modname=code&amp;op=code_list&amp;id_code_group=' . $id_code_group) . Form::getInputTextfield("search_t", "code_filter", "code_filter", isset($_POST['code_filter']) ? $_POST['code_filter'] : '', '', 255, '') . Form::getButton("filter", "filter", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("undo_filter", "undo_filter", Lang::t('_RESET', 'standard'), "reset_b") . Form::closeForm() . '</div>');
    $result = Get::req('result', DOTY_STRING, '');
    switch ($result) {
        case 'ok':
            UIFeedback::info($lang->def('_OPERATION_SUCCESSFUL'));
            break;
        case 'err':
            UIFeedback::error($lang->def('_OPERATION_FAILURE'));
            break;
        case 'err_dup':
            UIFeedback::error($lang->def('_DUPLICATED_CODE'));
            break;
    }
    $tot_code = $code_manager->getCodeNumber($id_code_group, isset($_POST['undo_filter']) ? $_POST['undo_filter'] : false);
    if ($tot_code) {
        $tb = new Table('20');
        $tb->initNavBar('ini', 'link');
        $tb->setLink('index.php?modname=code&amp;op=code_list&amp;id_code_group=' . $id_code_group);
        $ini = $tb->getSelectedElement();
        $cont_h = array($lang->def('_CODE'), $lang->def('_USED'), $lang->def('_USERNAME'), $lang->def('_UNLIMITED_USE'), '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />', '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />');
        $type_h = array('', 'image', '', 'image', 'image', 'image');
        $tb->setColsStyle($type_h);
        $tb->addHead($cont_h);
        $array_code = $code_manager->getCodeList($id_code_group, $ini);
        foreach ($array_code as $code_info) {
            $cont = array();
            $cont[] = $code_info['code'];
            if ($code_info['used']) {
                $cont[] = '<img src="' . getPathImage() . 'standard/status_active.png" alt="' . $lang->def('_USED') . '" />';
                $user_info = $acl_man->getUser($code_info['id_user'], false);
                if ($user_info) {
                    $cont[] = $acl_man->relativeId($user_info[ACL_INFO_USERID]);
                } else {
                    $user_info = $acl_man->getTempUserInfo($code_info['id_user'], false);
                    $cont[] = $acl_man->relativeId($user_info['userid']);
                }
                if ($code_info['unlimited_use'] == '1') {
                    $cont[] = '<img src="' . getPathImage() . 'standard/status_active.png" alt="' . $lang->def('_UNLIMITED_USE') . '" />';
                } else {
                    $cont[] = '-';
                }
                $cont[] = '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />';
            } else {
                $cont[] = '-';
                $cont[] = $lang->def('_NONE');
                if ($code_info['unlimited_use'] == '1') {
                    $cont[] = '<img src="' . getPathImage() . 'standard/status_active.png" alt="' . $lang->def('_UNLIMITED_USE') . '" />';
                } else {
                    $cont[] = '-';
                }
                $cont[] = '<a href="index.php?modname=code&amp;op=mod_code&amp;id_code_group=' . $id_code_group . '&amp;code=' . $code_info['code'] . '">' . '<img src="' . getPathImage() . 'standard/edit.png" alt="' . $lang->def('_MOD') . '" />';
            }
            $cont[] = '<a href="index.php?modname=code&amp;op=del_code&amp;id_code_group=' . $id_code_group . '&amp;code=' . $code_info['code'] . '">' . '<img src="' . getPathImage() . 'standard/delete.png" alt="' . $lang->def('_DEL') . '" />';
            $tb->addBody($cont);
        }
        $tb->addActionAdd('<a href="index.php?modname=code&amp;op=add_code&amp;id_code_group=' . $id_code_group . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_ADD') . '</a>');
        $tb->addActionAdd('<a class="ico-wt-sprite subs_xls" title="' . Lang::t('_EXPORT_XLS', 'report') . '" ' . 'href="index.php?modname=code&amp;op=export&amp;id_code_group=' . $id_code_group . '&amp;format=xls">' . '<span>' . Lang::t('_EXPORT_XLS', 'report') . '</span></a>');
        $tb->addActionAdd('<a class="ico-wt-sprite subs_csv" title="' . Lang::t('_EXPORT_CSV', 'report') . '" ' . 'href="index.php?modname=code&amp;op=export&amp;id_code_group=' . $id_code_group . '&amp;format=csv">' . '<span>' . Lang::t('_EXPORT_CSV', 'report') . '</span></a>');
        cout($tb->getTable() . $tb->getNavBar($ini, $tot_code));
        setupHrefDialogBox('a[href*=del_code]');
    } else {
        cout($lang->def('_NO_CODE_FOUND') . '<br/>' . '<a href="index.php?modname=code&amp;op=add_code&amp;id_code_group=' . $id_code_group . '">' . '<img src="' . getPathImage() . 'standard/add.png" alt="' . $lang->def('_ADD') . '" />' . $lang->def('_ADD') . '</a>');
    }
    cout('<br/><br/>' . getBackUi('index.php?modname=code&amp;op=list', $lang->def('_BACK')) . '</div>');
}
Example #27
0
</script>
<?php 
echo getTitleArea(array(Lang::t('_CONTENT_LIBRARY', 'kb')));
?>
<div class="std_block">
	<?php 
echo $result_message;
?>
	<div class="quick_search_form">
		<div>
			<div class="simple_search_box" id="kb_simple_filter_options" style="display: block;">
				<?php 
echo Form::openForm('quick_search', 'javascript:;');
echo Form::getInputDropdown('dropdown', 'res_type_dd', 'res_type_dd', $res_type_dd_arr, false, '') . "&nbsp;\n";
echo Form::getInputDropdown('dropdown', 'categorized_filter', 'categorized_filter', $categorized_filter_arr, false, '') . "&nbsp;\n";
echo Form::getInputTextfield("search_t", "filter_text", "filter_text", $filter_text, '', 255, '');
echo Form::getButton("filter_set", "filter_set", Lang::t('_SEARCH', 'standard'), "search_b");
echo Form::getButton("filter_reset", "filter_reset", Lang::t('_RESET', 'standard'), "reset_b");
echo Form::closeForm();
?>
			</div>
		</div>
	</div>
	<div class="panel_left_small">
		<span class="title"><?php 
echo Lang::t('_ALL_CATEGORIES', 'kb');
?>
</span>
		<?php 
/**
 * Tree
Example #28
0
function defmodality()
{
    checkPerm('view', false, 'storage');
    $lang =& DoceboLanguage::createInstance('test');
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.json.php';
    $idTest = importVar('idTest', true, 0);
    $back_url = urldecode(importVar('back_url'));
    $url_coded = htmlentities(urlencode($back_url));
    list($title, $description, $display_type, $order_type, $shuffle_answer, $question_random_number, $save_keep, $mod_doanswer, $can_travel, $show_score, $show_score_cat, $show_doanswer, $show_solution, $max_attempt, $hide_info, $order_info, $use_suspension, $suspension_num_attempts, $suspension_num_hours, $suspension_prerequisites, $mandatory_answer) = sql_fetch_row(sql_query("\r\n\tSELECT title, description, display_type, order_type, shuffle_answer, question_random_number, \r\n\t\tsave_keep, mod_doanswer, can_travel, \r\n\t\tshow_score, show_score_cat, show_doanswer, show_solution, \r\n\t\tmax_attempt, hide_info,\r\n\t\torder_info, use_suspension, suspension_num_attempts, suspension_num_hours, suspension_prerequisites, mandatory_answer\r\n\tFROM %lms_test\r\n\tWHERE idTest = '" . $idTest . "'"));
    list($tot_quest) = sql_fetch_row(sql_query("\r\n\tSELECT COUNT(*) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\tWHERE idTest = '" . (int) $idTest . "' AND type_quest <> 'title' AND type_quest <> 'break_page'"));
    $GLOBALS['page']->add(getTitleArea($lang->def('_TEST_SECTION'), 'test') . '<div class="std_block">' . '<div class="title_big">' . $lang->def('_TEST_MODALITY') . '</div>' . getBackUi('index.php?modname=test&amp;op=modtestgui&amp;idTest=' . $idTest . '&amp;back_url=' . $url_coded, $lang->def('_BACK')) . Form::openForm('defmodality', 'index.php?modname=test&amp;op=updatemodality') . Form::getOpenFieldset($lang->def('_TEST_MM_ONE')) . Form::getHidden('idTest', 'idTest', $idTest) . Form::getHidden('back_url', 'back_url', $url_coded) . Form::getRadio($lang->def('_TEST_MM1_GROUPING'), 'display_type_page', 'display_type', 0, !$display_type) . Form::getRadio($lang->def('_TEST_MM1_ONEFORPAGE'), 'display_type_one', 'display_type', 1, $display_type) . '<br />', 'content');
    //-order-----------------------------------------------------
    $cat_info = array();
    if ($order_info != '') {
        require_once _base_ . '/lib/lib.json.php';
        $json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
        $arr = $json->decode($order_info);
        if (is_array($arr)) {
            foreach ($arr as $value) {
                $cat_info[$value['id_category']] = $value['selected'];
            }
        }
    }
    $has_categories = false;
    $categories = array();
    $query = "SELECT tq.idCategory, qc.name, COUNT(tq.idcategory) FROM " . $GLOBALS['prefix_lms'] . "_testquest as tq LEFT JOIN " . $GLOBALS['prefix_lms'] . "_quest_category as qc " . " ON (tq.idCategory = qc.idCategory) WHERE idTest='" . (int) $idTest . "' GROUP BY tq.idCategory";
    $res = mysql_query($query);
    if (mysql_num_rows($res) > 0) {
        $has_categories = true;
        while (list($id_cat, $name_cat, $num_quest) = sql_fetch_row($res)) {
            if ($id_cat == 0) {
                $name_cat = $lang->def('_NO_CATEGORY');
            }
            if (isset($cat_info[$id_cat])) {
                $selected = $cat_info[$id_cat];
            } else {
                $selected = '0';
            }
            $categories[$id_cat] = array('name' => $name_cat, 'total' => $num_quest, 'selected' => (int) $selected);
        }
    }
    $script = "";
    if ($has_categories) {
        $GLOBALS['page']->add('<script type="text/javascript">
				function toggleCategoryList(o) {
					var ul = document.getElementById(\'category_list\'), radio = document.getElementById(\'order_type_random_category\');
					if (ul && radio) {
						if (radio.checked) ul.style.display = "block"; else ul.style.display = "none";
					}
				}
			</script>', 'page_head');
        $script = 'onclick="toggleCategoryList();"';
    }
    $GLOBALS['page']->add('<div class="text_bold">' . $lang->def('_ORDER_BY') . '</div>' . Form::getRadio($lang->def('_TEST_MM1_SEQUENCE'), 'order_type_seq', 'order_type', 0, $order_type == 0) . Form::getRadio($lang->def('_TEST_MM1_RANDOM'), 'order_type_random', 'order_type', 1, $order_type == 1), 'content');
    //-random question
    $input_field = Form::getInputTextfield('textfield_nowh', 'question_random_number', 'question_random_number', $question_random_number, 4, '', '');
    $label = str_replace('[random_quest]', '</label>' . $input_field . '<label for="question_random_number">', $lang->def('_TEST_MM1_QUESTION_RANDOM_NUMBER'));
    $GLOBALS['page']->add(Form::openFormLine() . Form::getInputRadio('order_type_random_quest', 'order_type', 2, $order_type == 2, '') . '<label for="order_type_random_quest">' . $lang->def('_ORDER_TYPE_RANDOM') . '</label> - ' . '<label for="question_random_number">' . str_replace('[tot_quest]', $tot_quest, $label) . '</label>' . Form::closeFormLine(), 'content');
    //------------------------------------------------------------------------------
    $label = '';
    if ($has_categories) {
        $category_selector = '<ul id="category_list" style="display:' . ($order_type == 3 ? "block" : "none") . '">';
        foreach ($categories as $key => $value) {
            $input_field = Form::getInputTextfield('textfield_nowh', 'question_random_category_' . $key, 'question_random_category[' . $key . ']', $value['selected'], 4, '', '');
            $category_selector .= '<li><label for="question_random_category_' . $key . '">' . $value['name'] . ':</label> ' . str_replace(array('[random_quest]', '[tot_quest]'), array($input_field, $value['total']), $lang->def('_TEST_MM1_QUESTION_RANDOM_NUMBER')) . '</li>';
        }
        $category_selector .= '</ul>';
        $GLOBALS['page']->add(Form::openFormLine() . Form::getInputRadio('order_type_random_category', 'order_type', 3, $order_type == 3, $script) . '<label for="order_type_random_category">' . $lang->def('_ORDER_TYPE_CATEGORY') . '</label>' . $category_selector . Form::closeFormLine() . '<br />', 'content');
    }
    //------------------------------------------------------------------------------
    /*
    $chart_options_decoded = new stdClass();
    if ($chart_options!="") {
    	$json = new Services_JSON(SERVICES_JSON_LOOSE_TYPE);
    	$decoded = $json->decode($chart_options);
    }
    $chart_options_decoded->use_charts = (isset($decoded['use_charts']) ? (bool)$decoded['use_charts'] : false);
    $chart_options_decoded->selected_chart = (isset($decoded['selected_chart']) ? (string)$decoded['selected_chart'] : 'column');
    $chart_options_decoded->show_mode = (isset($decoded['show_mode']) ? $decoded['show_mode'] : 'teacher');
    
    $chart_list = array(
    		'stacked' => $lang->def('_STACKED_CHART'),
    		'bar' => $lang->def('_BAR_CHART'),
    		//'radar' => $lang->def('_RADAR_CHART'),
    		'column' => $lang->def('_COLUMN_CHART')
    	);
    
    $chart_show = array(
    		'teacher' => $lang->def('_SHOWMODE_TEACHER'),
    		'course' => $lang->def('_SHOWMODE_COURSE')
    	);
    
    $chart_list = array_flip($chart_list);
    $chart_show = array_flip($chart_show);
    */
    //-order-answer----------------------------------------------
    $GLOBALS['page']->add('<div class="text_bold">' . $lang->def('_TEST_MM1_ANSWER_ORDER') . '</div>' . Form::getRadio($lang->def('_TEST_MM1_ANSWER_SEQUENCE'), 'shuffle_answer_seq', 'shuffle_answer', 0, !$shuffle_answer) . Form::getRadio($lang->def('_TEST_MM1_ANSWER_RANDOM'), 'shuffle_answer_random', 'shuffle_answer', 1, $shuffle_answer) . Form::getCloseFieldset() . Form::getOpenFieldset($lang->def('_TEST_MM_TWO')) . Form::getCheckBox($lang->def('_MANDATORY_ANSWER'), 'mandatory_answer', 'mandatory_answer', 1, $mandatory_answer) . $lang->def('_TEST_MM2_HIDE_INFO') . '<br />' . '<input class="valign_middle" type="radio" id="mod_hide_info_no" name="mod_hide_info" value="0"' . (!$hide_info ? '  checked="checked"' : '') . ' /> ' . '<label for="mod_doanswer_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="mod_hide_info_yes" name="mod_hide_info" value="1"' . ($hide_info ? '  checked="checked"' : '') . ' /> ' . '<label for="mod_doanswer_yes">' . $lang->def('_YES') . '</label>' . '<br /><br />' . $lang->def('_TEST_MM2_MODANSWER') . '<br />' . '<input class="valign_middle" type="radio" id="mod_doanswer_no" name="mod_doanswer" value="0"' . (!$mod_doanswer ? '  checked="checked"' : '') . ' /> ' . '<label for="mod_doanswer_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="mod_doanswer_yes" name="mod_doanswer" value="1"' . ($mod_doanswer ? '  checked="checked"' : '') . ' /> ' . '<label for="mod_doanswer_yes">' . $lang->def('_YES') . '</label>' . '<br /><br />' . $lang->def('_TEST_MM2_CANTRAVEL') . '<br />' . '<input class="valign_middle" type="radio" id="can_travel_no" name="can_travel" value="0"' . (!$can_travel ? '  checked="checked"' : '') . ' /> ' . '<label for="can_travel_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="can_travel_yes" name="can_travel" value="1"' . ($can_travel ? '  checked="checked"' : '') . ' /> ' . '<label for="can_travel_yes">' . $lang->def('_YES') . '</label>' . '<br /><br />' . $lang->def('_TEST_MM2_SAVEKEEP') . '<br />' . '<input class="valign_middle" type="radio" id="save_keep_no" name="save_keep" value="0"' . ($save_keep == 0 ? '  checked="checked"' : '') . ' /> ' . '<label for="save_keep_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="save_keep_yes" name="save_keep" value="1"' . ($save_keep == 1 ? '  checked="checked"' : '') . ' /> ' . '<label for="save_keep_yes">' . $lang->def('_YES') . '</label>' . '<br /><br />' . Form::getTextfield($lang->def('_MAX_ATTEMPT'), 'max_attempt', 'max_attempt', 3, $max_attempt) . '<br />' . Form::getCheckbox($lang->def('_USE_SUSPENSION'), 'use_suspension', 'use_suspension', 1, $use_suspension, 'onclick="setSuspension();"') . Form::getTextfield($lang->def('_SUSPENSION_NUM_ATTEMPTS'), 'suspension_num_attempts', 'suspension_num_attempts', 5, $suspension_num_attempts) . Form::getTextfield($lang->def('_SUSPENSION_NUM_HOURS'), 'suspension_num_hours', 'suspension_num_hours', 5, $suspension_num_hours) . Form::getCheckBox($lang->def('_SUSPENSION_PREREQUISITES'), 'suspension_prerequisites', 'suspension_prerequisites', 1, $suspension_prerequisites) . '<br /><br />' . Form::getCloseFieldset() . Form::getOpenFieldset($lang->def('_TEST_MM_FOUR')) . $lang->def('_TEST_MM4_SHOWTOT') . '<br />' . '<input class="valign_middle" type="radio" id="show_tot_no" name="show_tot" value="0"' . (!$show_score ? '  checked="checked"' : '') . ' /> ' . '<label for="show_tot_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="show_tot_yes" name="show_tot" value="1"' . ($show_score ? '  checked="checked"' : '') . ' /> ' . '<label for="show_tot_yes">' . $lang->def('_YES') . '</label>' . '<br /><br />' . $lang->def('_TEST_MM4_SHOWCAT') . '<br />' . '<input class="valign_middle" type="radio" id="show_cat_no" name="show_cat" value="0"' . (!$show_score_cat ? '  checked="checked"' : '') . ' /> ' . '<label for="show_cat_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="show_cat_yes" name="show_cat" value="1"' . ($show_score_cat ? '  checked="checked"' : '') . ' /> ' . '<label for="show_cat_yes">' . $lang->def('_YES') . '</label>' . '<br /><br />' . $lang->def('_TEST_MM4_SHOWDOANSWER') . '<br />' . '<input class="valign_middle" type="radio" id="show_doanswer_no" name="show_doanswer" value="0"' . ($show_doanswer == 0 ? '  checked="checked"' : '') . ' /> ' . '<label for="show_doanswer_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="show_doanswer_yes" name="show_doanswer" value="1"' . ($show_doanswer == 1 ? '  checked="checked"' : '') . ' /> ' . '<label for="show_doanswer_yes">' . $lang->def('_YES') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="show_doanswer_yes_if_passed" name="show_doanswer" value="2"' . ($show_doanswer == 2 ? '  checked="checked"' : '') . ' /> ' . '<label for="show_doanswer_yes_if_passed">' . $lang->def('_YES_IF_PASSED') . '</label>' . '<br /><br />' . $lang->def('_TEST_MM4_SHOWSOL') . '<br />' . '<input class="valign_middle" type="radio" id="show_solution_no" name="show_solution" value="0"' . ($show_solution == 0 ? '  checked="checked"' : '') . ' /> ' . '<label for="show_solution_no">' . $lang->def('_NO') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="show_solution_yes" name="show_solution" value="1"' . ($show_solution == 1 ? '  checked="checked"' : '') . ' /> ' . '<label for="show_solution_yes">' . $lang->def('_YES') . '</label>&nbsp;&nbsp;' . '<input class="valign_middle" type="radio" id="show_solution_yes_if_passed" name="show_solution" value="2"' . ($show_solution == 2 ? '  checked="checked"' : '') . ' /> ' . '<label for="show_solution_yes_if_passed">' . $lang->def('_YES_IF_PASSED') . '</label>' . '<br /><br />' . Form::getCloseFieldset() . '<div class="align_right">' . '<input class="button" type="submit" value="' . $lang->def('_SAVE') . '" />' . '</div>' . Form::closeForm() . getBackUi('index.php?modname=test&amp;op=modtestgui&amp;idTest=' . $idTest . '&amp;back_url=' . $url_coded, $lang->def('_BACK')) . '</div>', 'content');
    //----------------------------------------------------------------------------
    $script = '<script type="text/javascript">
			function setSuspension() {/*
				if (document.getElementById("use_suspension").checked) {
					document.getElementById("suspension_num_attempts").disabled = false;
					document.getElementById("suspension_num_hours").disabled = false;
					document.getElementById("suspension_prerequisites").disabled = false;
				} else {
					document.getElementById("suspension_num_attempts").disabled = true;
					document.getElementById("suspension_num_hours").disabled = true;
					document.getElementById("suspension_prerequisites").disabled = true;
				}
			*/}
		</script>';
    cout($script, 'content');
}
echo $id;
?>
").value = <?php 
echo $_varname;
?>
.filterText;
}
</script>
<?php 
if ($use_form_input && $separate_input) {
    echo '<input type="hidden" id="userselector_input_' . $id . '_fncrole" name="userselector_input[' . $id . '][fncrole]" value="" />';
}
?>
<div class="quick_search_form">
	<div>
		<div class="simple_search_box" id="fncroleselector_simple_filter_options">
			<?php 
echo Form::getInputTextfield("search_t", "fncrole_filter_text_" . $id, "filter_text", $filter_text, '', 255, '');
echo Form::getButton("fncrole_filter_set_" . $id, "filter_set", Lang::t('_SEARCH', 'standard'), "search_b");
echo Form::getButton("fncrole_filter_reset_" . $id, "filter_reset", Lang::t('_RESET', 'standard'), "reset_b");
echo '<div id="fncrole_filter_text_' . $id . '_container"></div>';
?>
		</div>
	</div>
</div>
<?php 
$rel_action_over = '<span>' . '<b id="num_fncroles_selected_top_' . $id . '">' . (int) (isset($num_fncroles_selected) ? $num_fncroles_selected : '0') . '</b> ' . Lang::t('_SELECTED', 'fncroles') . '</span>';
$rel_action_bottom = '<span>' . '<b id="num_fncroles_selected_bottom_' . $id . '">' . (int) (isset($num_fncroles_selected) ? $num_fncroles_selected : '0') . '</b> ' . Lang::t('_SELECTED', 'fncroles') . '</span>';
$columns = array(array('key' => 'name', 'label' => Lang::t('_NAME', 'fncroles'), 'sortable' => true, 'formatter' => $_varname . '.labelFormatter'), array('key' => 'group', 'label' => Lang::t('_GROUPS', 'standard'), 'sortable' => true, 'formatter' => $_varname . '.labelFormatter'), array('key' => 'description', 'label' => Lang::t('_DESCRIPTION', 'standard'), 'sortable' => true, 'formatter' => $_varname . '.labelFormatter'), array('key' => 'users', 'label' => Lang::t('_USERS', 'standard'), 'className' => 'img-cell'));
$params = array('id' => 'fncrole_selector_table_' . $id, 'ajaxUrl' => 'ajax.adm_server.php?r=widget/userselector/getfncroletabledata', 'rowsPerPage' => Get::sett('visuItem', 25), 'startIndex' => 0, 'results' => Get::sett('visuItem', 25), 'sort' => 'name', 'dir' => 'asc', 'columns' => $columns, 'fields' => array('id', 'name', 'description', 'group', 'users'), 'generateRequest' => $_varname . '.requestBuilder', 'stdSelection' => true, 'stdSelectionField' => '_checked', 'selectAllAdditionalFilter' => $_varname . '.selectAllAdditionalFilter', 'rel_actions' => array($rel_action_over, $rel_action_bottom), 'events' => array('initEvent' => '_fncroleSelectorInitEvent'), 'initialSelection' => isset($initial_selection) && is_array($initial_selection) ? $initial_selection : array());
$this->widget('table', $params);
Example #30
0
echo getTitleArea(Lang::t('_COURSE', 'course'));
?>
<div class="std_block">
<?php 
//Categories tree
$languages = array('_ROOT' => $root_name, '_NEW_FOLDER_NAME' => Lang::t('_NEW_CATEGORY', 'course'), '_MOD' => Lang::t('_MOD', 'course'), '_AREYOUSURE' => Lang::t('_AREYOUSURE', 'standard'), '_NAME' => Lang::t('_NAME', 'standardt'), '_MOD' => Lang::t('_MOD', 'standard'), '_DEL' => Lang::t('_DEL', 'standard'), '_MOVE' => Lang::t('_MOVE', 'standard'), '_SAVE' => Lang::t('_SAVE', 'standard'), '_CONFIRM' => Lang::t('_CONFIRM', 'standard'), '_UNDO' => Lang::t('_UNDO', 'standard'), '_ADD' => Lang::t('_ADD', 'standard'), '_YES' => Lang::t('_YES', 'standard'), '_NO' => Lang::t('_NO', 'standard'), '_INHERIT' => Lang::t('_ORG_CHART_INHERIT', 'organization_chart'), '_NEW_FOLDER' => Lang::t('_NEW_FOLDER', 'organization_chart'), '_DEL' => Lang::t('_DEL', 'standard'), '_AJAX_FAILURE' => Lang::t('_CONNECTION_ERROR', 'standard'));
$_tree_params = array('id' => 'category_tree', 'ajaxUrl' => 'ajax.adm_server.php?r=' . $base_link_course . '/gettreedata', 'treeClass' => 'CourseFolderTree', 'treeFile' => Get::rel_path('lms') . '/admin/views/course/coursefoldertree.js', 'languages' => $languages, 'initialSelectedNode' => $initial_selected_node, 'dragDrop' => true);
if ($permissions['add_category']) {
    $rel_title = Lang::t('_NEW_CATEGORY', 'course');
    $rel_action = '<a class="ico-wt-sprite subs_add" id="category_tree_add_folder_button" href="ajax.adm_server.php?r=adm/course/addfolder&id=' . $initial_selected_node . '" ' . ' title="' . $rel_title . '"><span>' . $rel_title . '</span></a>';
    $_tree_params['rel_action'] = $rel_action;
    $_tree_params['addFolderButton'] = 'add_folder_button';
}
$this->widget('tree', $_tree_params);
echo '<div class="quick_search_form">' . '<div class="common_options">' . Form::getInputCheckbox('classroom', 'classroom', '1', $filter['classroom'] ? true : false, '') . ' <label class="label_normal" for="classroom">' . Lang::t('_CLASSROOM', 'admin_directory') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getInputCheckbox('descendants', 'descendants', '1', $filter['descendants'] ? true : false, '') . ' <label class="label_normal" for="descendants">' . Lang::t('_DIRECTORY_FILTER_FLATMODE', 'admin_directory') . '</label>' . '&nbsp;&nbsp;&nbsp;&nbsp;' . Form::getInputCheckbox('waiting', 'waiting', '1', $filter['waiting'] ? true : false, '') . ' <label class="label_normal" for="waiting">' . Lang::t('_WAITING_USERS', 'organization_chart') . '</label>' . '</div>' . '<div>' . Form::openForm('course_filters', 'index.php?r=' . $base_link_course . '/show') . Form::getInputTextfield("search_t", "text", "text", $filter['text'], '', 255, '') . Form::getButton("c_filter_set", "c_filter_set", Lang::t('_SEARCH', 'standard'), "search_b") . Form::getButton("c_filter_reset", "c_filter_reset", Lang::t('_RESET', 'standard'), "reset_b") . Form::closeForm() . '</div>' . '</div>';
$columns_arr = array(array('key' => 'code', 'label' => Lang::t('_CODE', 'course'), 'sortable' => true), array('key' => 'name', 'label' => Lang::t('_NAME', 'course'), 'sortable' => true), array('key' => 'type', 'label' => Lang::t('_TYPE', 'course'), 'className' => 'min-cell'), array('key' => 'students', 'label' => Lang::t('_STUDENTS', 'coursereport'), 'className' => 'img-cell'));
if ($permissions['moderate']) {
    //if(checkPerm('moderate', true, 'course', 'lms'))
    $columns_arr[] = array('key' => 'wait', 'label' => Lang::t('_WAITING', 'course'), 'className' => 'img-cell');
}
if ($permissions['subscribe']) {
    //if(checkPerm('subscribe', true, 'course', 'lms'))
    $columns_arr[] = array('key' => 'user', 'label' => Get::sprite('subs_users', Lang::t('_USER_STATUS_SUBS', 'course')), 'className' => 'img-cell');
}
if ($permissions['view']) {
    $columns_arr[] = array('key' => 'edition', 'label' => Get::sprite('subs_date', Lang::t('_CLASSROOM_EDITION', 'course')), 'className' => 'img-cell');
}
if ($permissions['mod']) {
    $columns_arr[] = array('key' => 'certificate', 'label' => Get::sprite('subs_pdf', Lang::t('_CERTIFICATE_ASSIGN_STATUS', 'course')), 'className' => 'img-cell');
    $columns_arr[] = array('key' => 'competences', 'label' => Get::sprite('subs_competence', Lang::t('_COMPETENCES', 'course')), 'className' => 'img-cell');