Exemplo n.º 1
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'))));
Exemplo n.º 2
0
 /**
  * public static function getLineDropdown( $css_line, $css_label, $label_name, $css_dropdown, $id, $name, $all_value, $selected, $other_param, $other_after, $other_before )
  *
  * @param string $css_line 		css for the line
  * @param string $css_label 	css for the label
  * @param string $label_name 	text contained into the label
  * @param string $css_dropdown 	the css class for the select element
  * @param string $id 			the id of the element
  * @param string $name 			the name of the element
  * @param string $all_value 	all the possible value of the select element
  * @param string $selected 		the element selected
  * @param string $other_param 	other element for the tag
  * @param string $other_after 	html code added after the select element
  * @param string $other_before 	html code added before the label element
  *
  * @return string with the html code for a line with the select element
  */
 public static function getLineDropdown($css_line, $css_label, $label_name, $css_dropdown, $id, $name, $all_value, $selected, $other_param, $other_after, $other_before)
 {
     return '<div class="' . $css_line . '">' . $other_before . '<p><label class="' . $css_label . '" for="' . $id . '">' . $label_name . '</label></p>' . Form::getInputDropdown($css_dropdown, $id, $name, $all_value, $selected, $other_param) . $other_after . '</div>';
 }
Exemplo n.º 3
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 
/**
Exemplo n.º 4
0
function conference_startnewconf($url)
{
    checkPerm('view');
    $mod_perm = checkPerm('mod');
    require_once _base_ . '/lib/lib.form.php';
    $lang =& DoceboLanguage::createInstance('conference', 'lms');
    if (isset($_POST['create_conf'])) {
        $conference = new Conference_Manager();
        $start_date = Format::dateDb($_POST['start_date'], 'date');
        $start_date = substr($start_date, 0, 10);
        $start_time = (strlen($_POST['start_time']['hour']) == 1 ? '0' : '') . $_POST['start_time']['hour'] . ':' . (strlen($_POST['start_time']['minute']) == 1 ? '0' : '') . $_POST['start_time']['minute'] . ':00';
        $start_timestamp = fromDatetimeToTimestamp($start_date . ' ' . $start_time);
        $conference_name = trim($_POST["conference_name"]) ? trim($_POST["conference_name"]) : $lang->def('_VIDEOCONFERENCE');
        $meetinghours = (int) $_POST["meetinghours"];
        $end_timestamp = $start_timestamp + $meetinghours * 3600;
        $maxparticipants = (int) $_POST["maxparticipants"];
        $idCourse = $_SESSION['idCourse'];
        $room_type = $_POST["room_type"];
        if ($conference->can_create_room_limit(getLogUserId(), $idCourse, $room_type, $start_timestamp, $end_timestamp) && $conference->can_create_user_limit(getLogUserId(), $idCourse, $start_timestamp)) {
            $conference->insert_room($idCourse, getLogUserId(), $conference_name, $room_type, $start_timestamp, $end_timestamp, $meetinghours, $maxparticipants, isset($_POST['bookable']) ? 1 : 0, $start_date, (int) $_POST['start_time']['hour'], (int) $_POST['start_time']['minute']);
            Util::jump_to('index.php?modname=conference&amp;op=list');
        } else {
            $title_page = array('index.php?modname=conference&amp;op=list' => $lang->def('_VIDEOCONFERENCE'), $lang->def('_CREATE'));
            $GLOBALS['page']->add(getTitleArea($title_page, 'conference', $lang->def('_VIDEOCONFERENCE')) . '<div class="std_block">' . '<span><strong>' . $lang->def('_NO_MORE_ROOM') . '</strong></span>' . '</div>', 'content');
            return false;
        }
    }
    $start_time['hour'] = date('H');
    $start_time['minute'] = date('i');
    $start_date = importVar('start_date', false, date("Y-m-d H:i:s"));
    $conf_system = array();
    //$conf_system[""]="";
    $default = "";
    $default_maxp = 30;
    if (Get::sett('code_teleskill')) {
        $conf_system["teleskill"] = "teleskill";
    }
    if (Get::sett('dimdim_server') and Get::sett('dimdim_user') and Get::sett('dimdim_password')) {
        $conf_system["dimdim"] = "dimdim";
    }
    if (Get::sett('bbb_server') and Get::sett('bbb_user') and Get::sett('bbb_salt') and Get::sett('bbb_password_moderator') and Get::sett('bbb_password_viewer')) {
        $conf_system["bbb"] = "Big Blue Button";
        $default = "bbb";
        $default_maxp = Get::sett('bbb_max_participant');
    }
    YuiLib::load();
    //addJs($GLOBALS['where_lms_relative'].'/modules/conference/', 'ajax_conference.js');
    $GLOBALS['page']->add(getTitleArea($lang->def('_VIDEOCONFERENCE'), 'conference') . '<div class="std_block">', 'content');
    $GLOBALS['page']->add(Form::openForm('create_conference', $url->getUrl('op=startnewconf')) . Form::openElementSpace() . Form::getTextfield($lang->def('_VIDEOCONFERENCE'), 'conference_name', 'conference_name', 255, importVar('conference_name')) . Form::getLineBox($lang->def('_CONFERENCE_SYSTEM'), Form::getInputDropdown('', 'room_type', 'room_type', $conf_system, $default, '')) . Form::getDatefield($lang->def('_START_DATE'), 'start_date', 'start_date', Format::date($start_date, 'date')) . Form::getLineBox($lang->def('_AT_HOUR'), Form::getInputDropdown('', 'start_time_hour', 'start_time[hour]', range(0, 23), importVar('start_time_hour', false, date("H")), '') . ' : ' . Form::getInputDropdown('', 'start_time_minute', 'start_time[minute]', range(0, 59), importVar('start_time_hour', false, date("i")), '')) . Form::getLineBox($lang->def('_MEETING_HOURS'), Form::getInputDropdown('', 'meetinghours', 'meetinghours', range(0, 5), importVar('meetinghours', false, 2), '')) . Form::getTextfield($lang->def('_MAX_PARTICIPANTS'), 'maxparticipants', 'maxparticipants', 6, importVar('maxparticipants', true, $default_maxp)), 'content');
    if (Get::sett('use_dimdim_api') === 'on') {
        $GLOBALS['page']->add('<div id="dimdim_conf" style="' . ($default === 'dimdim' ? 'display:block;' : 'display:none;') . '">' . Form::getOpenFieldset(Lang::t('_DIMDIM_FEATURES', 'conference'), 'dimdim_features') . Form::getCheckbox(Lang::t('_SHOW_WAITING_AREA', 'conference'), 'lobbyEnabled', 'lobbyEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_PRIVATE_CHAT', 'conference'), 'privateChatEnabled', 'privateChatEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_PUBLIC_CHAT', 'conference'), 'publicChatEnabled', 'publicChatEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_DESKTOP_SHARING', 'conference'), 'screenShareEnabled', 'screenShareEnabled', '1') . Form::getCheckbox(Lang::t('_ASSIGN_MIC_TO_ATTENDEES', 'conference'), 'autoAssignMikeOnJoin', 'autoAssignMikeOnJoin', '1') . Form::getCheckbox(Lang::t('_ENABLE_WHITEBOARD', 'conference'), 'whiteboardEnabled', 'whiteboardEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_DOCUMENTS_SHARING', 'conference'), 'documentSharingEnabled', 'documentSharingEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_RECORDING', 'conference'), 'recordingEnabled', 'recordingEnabled', '1') . Form::getCheckbox(Lang::t('_ENABLE_HANDS_FREE', 'conference'), 'autoHandsFreeOnAVLoad', 'autoHandsFreeOnAVLoad', '1') . Form::getCheckbox(Lang::t('_START_MAIL', 'conference'), 'joinEmailRequired', 'joinEmailRequired', '1') . '<script type="text/javascript">' . ' var room_type = YAHOO.util.Dom.get(\'room_type\');' . ' YAHOO.util.Event.addListener(room_type, \'change\', dimdimEvent);' . ' function dimdimEvent(e)' . ' {' . ' var room_type = YAHOO.util.Dom.get(\'room_type\');' . ' var dimdim_conf = YAHOO.util.Dom.get(\'dimdim_conf\');' . ' if(room_type.value == "dimdim")' . ' dimdim_conf.style.display = "block";' . ' else' . ' dimdim_conf.style.display = "none";' . ' }' . '</script>' . Form::getCloseFieldset() . '</div>', 'content');
    }
    $GLOBALS['page']->add(Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('create_conf', 'create_conf', $lang->def('_CREATE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
}
Exemplo n.º 5
0
<?php

echo getTitleArea(Lang::t('_COURSESTATS', 'menu_course'));
?>
<div class="std_block">

<div class="quick_search_form">
	<div>
		<div class="simple_search_box" id="usermanagement_simple_filter_options" style="display: block;">
			<?php 
echo '<label for="">' . Lang::t('_FILTER', 'standard') . '</label>' . Form::getInputDropdown('dropdown', 'filter_selection', 'filter_selection', array(0 => Lang::t('_ALL', 'standard'), 1 => Lang::t('_USER_STATUS_SUBS', 'standard'), 2 => Lang::t('_USER_STATUS_BEGIN', 'standard'), 3 => Lang::t('_USER_STATUS_END', 'standard')), (int) $filter_selection, '');
echo '&nbsp;&nbsp;';
//some space between status filter and text filter
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");
?>
		</div>
		<a id="advanced_search" class="advanced_search" href="javascript:;"><?php 
echo Lang::t("_ADVANCED_SEARCH", 'standard');
?>
</a>
		<div id="advanced_search_options" class="advanced_search_options" style="display: <?php 
echo $is_active_advanced_filter ? 'block' : 'none';
?>
">
			<?php 
//filter inputs
$orgchart_after = '<br />' . Form::getInputCheckbox('filter_descendants', 'filter_descendants', 1, $filter_descendants ? true : false, "") . '&nbsp;<label for="filter_descendants">' . Lang::t('_ORG_CHART_INHERIT', 'organization_chart') . '</label>';
echo Form::getDropdown(Lang::t('_DIRECTORY_MEMBERTYPETREE', 'admin_directory'), 'filter_orgchart', 'filter_orgchart', $orgchart_list, (int) $filter_orgchart, $orgchart_after);
echo Form::getDropdown(Lang::t('_GROUPS', 'standard'), 'filter_groups', 'filter_groups', $groups_list, (int) $filter_groups);
Exemplo n.º 6
0
 function modEvent()
 {
     checkPerm('view');
     require_once _base_ . '/lib/lib.form.php';
     $id_event = importVar('id_event', true, 0);
     $lang =& DoceboLanguage::createInstance('reservation');
     $out = $GLOBALS['page'];
     $out->setWorkingZone('content');
     $man_res = new Man_Reservation();
     if (isset($_GET['confirm'])) {
         $confirm = importVar('confirm', true, 0);
         $id_course = importVar('id_course', true, 0);
         $id_laboratory = importVar('id_laboratory', true, 0);
         $id_category = importVar('id_category', true, 0);
         $title = importVar('title', false, '');
         $description = importVar('description', false, '');
         $date = importVar('date', false, '');
         $max_user = importVar('max_user', true, 0);
         $deadline = importVar('deadline', false, '');
         $from_time_h = importVar('from_time_h', false, '');
         $from_time_m = importVar('from_time_m', false, '');
         $to_time_h = importVar('to_time_h', false, '');
         $to_time_m = importVar('to_time_m', false, '');
         $date = Format::dateDb($date, 'date');
         $deadline = Format::dateDb($deadline, 'date');
         $from_time = $from_time_h . ':' . $from_time_m . ':00';
         $to_time = $to_time_h . ':' . $to_time_m . ':00';
         if ($date < date('Y-m-d') || $date < $deadline || $deadline < date('Y-m-d')) {
             Util::jump_to('index.php?modname=reservation&op=mod_event&amp;id_event=' . $id_event . '&amp;error=date');
         }
         if ($from_time >= $to_time) {
             Util::jump_to('index.php?modname=reservation&op=mod_event&amp;id_event=' . $id_event . '&amp;error=time');
         }
         if ($confirm) {
             $result = $man_res->modEvent($id_event, $id_course, $id_laboratory, $id_category, $title, $description, $date, $max_user, $deadline, $from_time, $to_time);
         }
         if ($result) {
             Util::jump_to('index.php?modname=reservation&op=reservation&active_tab=subscribed_user');
         }
         Util::jump_to('index.php?modname=reservation&op=mod_event&amp;id_event=' . $id_event . '&amp;error=laboratory');
     }
     $out->add(getTitleArea($lang->def('_SAVE'), '', $lang->def('_EVENT')) . '<div class="std_block">');
     $error = importVar('error', false, '');
     if ($error !== '') {
         switch ($error) {
             case 'date':
                 $out->add(getErrorUi($lang->def('_WRONG_DATE')));
                 break;
             case 'time':
                 $out->add(getErrorUi($lang->def('_WRONG_TIME')));
                 break;
             case 'laboratory':
                 $out->add(getErrorUi($lang->def('_LOCATION_BUSY')));
                 break;
         }
     }
     $event = array();
     $event = $man_res->getEventInfo($id_event);
     $date = Format::date($event[EVENT_DATE], 'date');
     $deadline = Format::date($event[EVENT_DEADLINE], 'date');
     $from_time_h = $event[EVENT_FROM_TIME][0] . $event[EVENT_FROM_TIME][1];
     $from_time_m = $event[EVENT_FROM_TIME][3] . $event[EVENT_FROM_TIME][4];
     $to_time_h = $event[EVENT_TO_TIME][0] . $event[EVENT_TO_TIME][1];
     $to_time_m = $event[EVENT_TO_TIME][3] . $event[EVENT_TO_TIME][4];
     $out->add(Form::openForm('form_event', 'index.php?modname=reservation&amp;op=mod_event&amp;confirm=1') . Form::openElementSpace() . Form::getHidden('id_event', 'id_event', $event[EVENT_ID]) . Form::getHidden('id_course', 'id_course', $event[EVENT_ID_COURSE]) . Form::getTextfield($lang->def('_TITLE'), 'title', 'title', 255, $event[EVENT_TITLE]) . Form::getTextarea($lang->def('_DESCRIPTION'), 'description', 'description', $event[EVENT_DESCRIPTION]) . Form::getDropdown($lang->def('_LOCATION'), 'id_laboratory', 'id_laboratory', $man_res->getLaboratories(), $event[EVENT_ID_LABORATORY]) . Form::getDropdown($lang->def('_CATEGORY'), 'id_category', 'id_category', $man_res->getCategory(), $event[EVENT_ID_CATEGORY]) . Form::getDateField($lang->def('_DATE'), 'date', 'date', $date) . Form::getDateField($lang->def('_DEADLINE'), 'deadline', 'deadline', $deadline) . Form::getTextfield($lang->def('_MAX_USER'), 'max_user', 'max_user', 255, $event[EVENT_MAX_USER]) . Form::getLineBox($lang->def('_FROM_TIME'), Form::getInputDropdown('', 'from_time_h', 'from_time_h', $man_res->getHours(), $from_time_h, false) . ' : ' . Form::getInputDropdown('', 'from_time_m', 'from_time_m', $man_res->getMinutes(), $from_time_m, false)) . Form::getLineBox($lang->def('_TO_TIME'), Form::getInputDropdown('', 'to_time_h', 'to_time_h', $man_res->getHours(), $to_time_h, false) . ' : ' . Form::getInputDropdown('', 'to_time_m', 'to_time_m', $man_res->getMinutes(), $to_time_m, false)) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('mod_event', 'mod_event', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm());
     $out->add('</div>', 'content');
 }
Exemplo n.º 7
0
 /**
  * @return 	string 	contains the displayable information for a selected group
  *
  * @access 	public
  */
 function getPageWithElement($regroup)
 {
     require_once _base_ . '/lib/lib.form.php';
     if ($regroup == 'templ_man') {
         return $this->_maskTemplateManager();
     } elseif ($regroup == 'suiteman') {
         return $this->_maskSuiteManager();
     }
     $lang =& DoceboLanguage::createInstance('configuration', 'framework');
     $reSetting = sql_query("\r\n\t\tSELECT param_name, param_value, value_type, max_size\r\n\t\tFROM " . $this->table . "\r\n\t\tWHERE regroup = '" . $regroup . "' AND\r\n\t\t\thide_in_modify = '0'\r\n\t\tORDER BY regroup, pack, sequence");
     $html = '';
     while (list($var_name, $var_value, $value_type, $max_size) = sql_fetch_row($reSetting)) {
         $i_after = ' <span class="ico-tooltip" id="tt_target_' . $var_name . '" title="' . $lang->def('_CONF_DESCR_' . strtoupper($var_name)) . '">info</span>';
         switch ($value_type) {
             case "register_type":
                 //on off
                 $html .= Form::getOpenCombo($lang->def('_' . strtoupper($var_name))) . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_SELF'), $var_name . '_self', 'option[' . $var_name . ']', 'self', $var_value == 'self') . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_SELF_OPTIN'), $var_name . '_self_optin', 'option[' . $var_name . ']', 'self_optin', $var_value == 'self_optin') . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_MODERATE'), $var_name . '_moderate', 'option[' . $var_name . ']', 'moderate', $var_value == 'moderate') . Form::getLineRadio('', 'label_bold', $lang->def('_REGISTER_TYPE_ADMIN'), $var_name . '_admin', 'option[' . $var_name . ']', 'admin', $var_value == 'admin') . Form::getCloseCombo($i_after);
                 break;
             case "register_tree":
                 $register_possible_option = array('off' => $lang->def('_DONT_USE_TREE_REGISTRATION'), 'manual_insert' => $lang->def('_USE_WITH_MANUALEINSERT'), 'selection' => $lang->def('_USE_WITH_SELECTION'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $register_possible_option, $var_value, $i_after);
                 break;
             case "field_tree":
                 require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
                 $fl = new FieldList();
                 $all_fields = $fl->getAllFields(false);
                 $fields[0] = $lang->def('_NO_VALUE');
                 foreach ($all_fields as $key => $val) {
                     $fields[$val[FIELD_INFO_ID]] = $val[FIELD_INFO_TRANSLATION];
                 }
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $fields, $var_value, $i_after);
                 break;
             case "save_log_attempt":
                 //on off
                 $html .= Form::getOpenCombo($lang->def('_' . strtoupper($var_name))) . Form::getLineRadio('', 'label_bold', $lang->def('_SAVE_LA_ALL'), $var_name . '_all', 'option[' . $var_name . ']', 'all', $var_value == 'all') . Form::getLineRadio('', 'label_bold', $lang->def('_SAVE_LA_AFTER_MAX'), $var_name . '_after_max', 'option[' . $var_name . ']', 'after_max', $var_value == 'after_max') . Form::getLineRadio('', 'label_bold', $lang->def('_NO'), $var_name . '_no', 'option[' . $var_name . ']', 'no', $var_value == 'no') . Form::getCloseCombo($i_after);
                 break;
             case "language":
                 //drop down language
                 $langs = Docebo::langManager()->getAllLangCode();
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $langs, array_search($var_value, $langs), $i_after);
                 break;
             case "template":
                 //drop down template
                 $templ = getTemplateList();
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $templ, array_search($var_value, $templ), $i_after);
                 break;
             case "hteditor":
                 //drop down hteditor
                 $ht_edit = getHTMLEditorList();
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $ht_edit, $var_value, $i_after);
                 break;
             case "layout_chooser":
                 //drop down hteditor
                 $layout = array('left' => Lang::t('_LAYOUT_LEFT'), 'over' => Lang::t('_LAYOUT_OVER'), 'right' => Lang::t('_LAYOUT_RIGHT'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $layout, $var_value, $i_after);
                 break;
             case "pubflow_method_chooser":
                 //drop down hteditor
                 $options = array('onestate' => Lang::t('_PUBFLOW_ONESTATE'), 'twostate' => Lang::t('_PUBFLOW_TWOSTATE'), 'advanced' => Lang::t('_PUBFLOW_ADVANCED'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $options, $var_value, $i_after);
                 break;
             case "field_select":
                 require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
                 $fl = new FieldList();
                 $all_fields = $fl->getAllFields();
                 $fields = array();
                 foreach ($all_fields as $key => $val) {
                     $fields[$val[FIELD_INFO_ID]] = $val[FIELD_INFO_TRANSLATION];
                 }
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $fields, $var_value, $i_after);
                 break;
             case "sel_sms_gateway":
                 $options = array('0' => Lang::t('_SMS_GATEWAY_AUTO'), '1' => Lang::t('_SMS_GATEWAY_1'), '2' => Lang::t('_SMS_GATEWAY_2'), '3' => Lang::t('_SMS_GATEWAY_3'), '4' => Lang::t('_SMS_GATEWAY_4'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $options, $var_value, $i_after);
                 break;
             case "menuvoice":
             case "menuvoice_course_public":
             case "layout_chooser":
                 //drop down hteditor
                 $layout = array('left' => Lang::t('_LAYOUT_LEFT'), 'over' => Lang::t('_LAYOUT_OVER'), 'right' => Lang::t('_LAYOUT_RIGHT'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $layout, $var_value, $i_after);
                 break;
             case "grpsel_chooser":
                 $layout = array('group' => $lang->def('_GROUPS'), 'orgchart' => $lang->def('_ORGCHART'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $layout, $var_value, $i_after);
                 break;
             case "tablist_coursecatalogue":
                 $lang_c =& DoceboLanguage::createInstance('catalogue', 'lms');
                 $tab_selected = unserialize(urldecode($var_value));
                 $tab_list = array('time' => $lang_c->def('_TAB_VIEW_TIME'), 'category' => $lang_c->def('_TAB_VIEW_CATEGORY'), 'all' => $lang_c->def('_ALL'));
                 if (Get::sett('use_coursepath') == '1') {
                     $tab_list['pathcourse'] = $lang_c->def('_COURSEPATH');
                 }
                 if (Get::sett('use_social_courselist') == 'on') {
                     $tab_list['mostscore'] = $lang_c->def('_TAB_VIEW_MOSTSCORE');
                     $tab_list['popular'] = $lang_c->def('_TAB_VIEW_MOSTPOPULAR');
                     $tab_list['recent'] = $lang_c->def('_TAB_VIEW_RECENT');
                 }
                 foreach ($tab_list as $tab_code => $name) {
                     $html .= Form::getCheckbox($name, 'tablist_' . $tab_code, 'tablist[' . $tab_code . ']', 1, isset($tab_selected[$tab_code]), '', $i_after);
                 }
                 break;
             case "first_coursecatalogue_tab":
                 $lang_c =& DoceboLanguage::createInstance('catalogue', 'lms');
                 $tab_list = array('time' => $lang_c->def('_TAB_VIEW_TIME'), 'category' => $lang_c->def('_TAB_VIEW_CATEGORY'), 'all' => $lang_c->def('_ALL'));
                 if (Get::sett('use_coursepath') == '1') {
                     $tab_list['pathcourse'] = $lang_c->def('_COURSEPATH');
                 }
                 if (Get::sett('use_social_courselist') == 'on') {
                     $tab_list['mostscore'] = $lang_c->def('_TAB_VIEW_MOSTSCORE');
                     $tab_list['popular'] = $lang_c->def('_TAB_VIEW_MOSTPOPULAR');
                     $tab_list['recent'] = $lang_c->def('_TAB_VIEW_RECENT');
                 }
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $tab_list, $var_value, $i_after);
                 break;
             case "tablist_mycourses":
                 //$var_value=deformat($var_value);
                 $arr_value = explode(',', $var_value);
                 //$arr_value=array();
                 $tab_list = array();
                 $tab_list[''] = $lang->def('_MYCOURSES_NOTUSED');
                 $tab_list['status'] = $lang->def('_STATUS');
                 $tab_list['name'] = $lang->def('_NAME');
                 $tab_list['code'] = $lang->def('_CODE');
                 $html .= '<div class="form_line_l"><p>' . '<label class="floating">' . $lang->def('_' . strtoupper($var_name)) . '</label></p>';
                 for ($i = 0; $i < 3; $i++) {
                     $html .= Form::getInputDropdown('dropdown', $var_name . '_' . $i, "mycourses[{$i}]", $tab_list, isset($arr_value[$i]) ? $arr_value[$i] : '', '');
                 }
                 $html .= $i_after . '</div>';
                 break;
             case "point_field":
                 require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
                 $fl = new FieldList();
                 $all_fields = $fl->getAllFields();
                 $fields[0] = $lang->def('_NO_VALUE');
                 foreach ($all_fields as $key => $val) {
                     $fields[$val[FIELD_INFO_ID]] = $val[FIELD_INFO_TRANSLATION];
                 }
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $fields, $var_value, $i_after);
                 break;
             case "rest_auth_sel_method":
                 $value_set = array($lang->def('_REST_AUTH_UCODE') => 0, $lang->def('_REST_AUTH_TOKEN') => 1);
                 $html .= Form::getRadioSet($lang->def('_REST_AUTH_SEL_METHOD'), $var_name, 'option[' . $var_name . ']', $value_set, $var_value, $i_after);
                 break;
                 // Common types
             // Common types
             case "password":
                 $html .= Form::getPassword($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $max_size, $var_value, $i_after);
                 break;
             case "textarea":
                 $html .= Form::getSimpletextarea($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $var_value, $i_after);
                 break;
             case "check":
                 $html .= Form::getCheckbox($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', 1, $var_value == 1, '', '', $i_after . ' ');
                 break;
             case "enum":
                 $html .= Form::getCheckbox($lang->def('_' . strtoupper($var_name)), $var_name . '_on', 'option[' . $var_name . ']', 'on', $var_value == 'on', '', '', $i_after . ' ');
                 break;
             default:
                 //string or int
                 $html .= Form::getTextfield($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $max_size, $var_value, false, $i_after);
         }
     }
     return $html;
 }
Exemplo n.º 8
0
 public function getEditionTableContent($courses)
 {
     $res = array();
     foreach ($courses as $id_course) {
         if ($this->controlCoursesWithEdition(array($id_course))) {
             $query = "SELECT code, name, course_type" . " FROM %lms_course" . " WHERE idCourse = " . (int) $id_course;
             list($code, $name, $course_type) = sql_fetch_row(sql_query($query));
             if ($course_type !== 'classroom') {
                 require_once _lms_ . '/admin/models/EditionAlms.php';
                 $edition_model = new EditionAlms($id_course);
                 $edition = $edition_model->loadEdition(false, false, 'date_begin', 'desc');
             } else {
                 require_once _lms_ . '/admin/models/ClassroomAlms.php';
                 $classroom_model = new ClassroomAlms($id_course);
                 $edition = $classroom_model->loadCourseEdition(false, false, 'date_begin', 'desc');
             }
             $all_value = array();
             foreach ($edition as $edition_info) {
                 $all_value[isset($edition_info['id_date']) ? $edition_info['id_date'] : $edition_info['id_edition']] = $edition_info['code'] . ' - ' . $edition_info['name'] . ' (' . (isset($edition_info['id_date']) ? $edition_info['date_begin'] : Format::date($edition_info['date_begin'], 'date')) . ' - ' . (isset($edition_info['id_date']) ? $edition_info['date_end'] : Format::date($edition_info['date_end'], 'date')) . ')';
             }
             $res[] = array($code, $name, Form::getInputDropdown('dropdown', 'edition_' . $id_course, 'edition_' . $id_course, $all_value, false, ''));
         }
     }
     return $res;
 }
echo Form::getHidden('courses_list', 'courses_list', implode(",", $courses_list));
echo Form::getHidden('users_to_add', 'users_to_add', implode(",", $users_to_add));
echo Form::getHidden('users_to_del', 'users_to_del', implode(",", $users_to_del));
echo Form::getHidden('id_path', 'id_path', $id_path);
//header css
$_array_style = array('course_name' => '', 'dropdown' => 'image');
//editions table
if (!empty($editions_list)) {
    $_array_header = array('course_name' => Lang::t('_COURSE', 'course'), 'dropdown' => Lang::t('_EDITIONS', 'subscribe'));
    $_array_content = array();
    foreach ($editions_list as $_info) {
        $_array_content[] = array('course_name' => $_info['label'], 'dropdown' => Form::getInputDropdown('dropdown', 'editions_' . $_info['id_course'], 'editions[' . $_info['id_course'] . ']', $_info['list'], false, ''));
    }
    $this->widget('table', array('id' => 'editions_table', 'styles' => $_array_style, 'header' => $_array_header, 'data' => $_array_content, 'summary' => Lang::t('_CHOOSE_EDITIONS', 'subscribe'), 'caption' => false));
}
//classrooms table
if (!empty($classrooms_list)) {
    $_array_header = array('course_name' => Lang::t('_COURSE', 'course'), 'dropdown' => Lang::t('_CLASSROOMS', 'subscribe'));
    $_array_content = array();
    foreach ($classrooms_list as $_info) {
        $_array_content[] = array('course_name' => $_info['label'], 'dropdown' => Form::getInputDropdown('dropdown', 'classrooms_' . $_info['id_course'], 'classrooms[' . $_info['id_course'] . ']', $_info['list'], false, ''));
    }
    $this->widget('table', array('id' => 'classrooms_table', 'styles' => $_array_style, 'header' => $_array_header, 'data' => $_array_content, 'summary' => Lang::t('_CHOOSE_CLASSROOMS', 'subscribe'), 'caption' => false));
}
echo Form::openButtonSpace();
echo Form::getButton('subscribe', 'subscribe', Lang::t('_SUBSCRIBE', 'subscribe'));
echo Form::getButton('undo', 'undo', Lang::t('_UNDO', 'subscribe'));
echo Form::closeElementSpace();
echo Form::closeForm();
?>
</div>
Exemplo n.º 10
0
        $rule_man = new AssessmentRule();
        $use_default = importVar('usedef', false, 1);
        $id_rule = importVar('id_rule', true, 0);
        if ($id_rule != 0) {
            // load old data ------------------------------------
            $rule = $rule_man->getRule($id_rule);
            $rule_type = $rule[RULE_TYPE];
            $setting = $rule_man->parseRuleSetting($rule[RULE_TYPE], $rule[RULE_SETTING]);
            $score_type_one = isset($setting[0]) ? $setting[0] : '';
            $score_type_two = isset($setting[1]) ? $setting[1] : '';
        } else {
            $rule_type = $use_default ? RULE_DEFAULT : RULE_GREATER;
            $score_type_one = '';
            $score_type_two = '';
        }
        $arr_question = array();
        $arr_question[RULE_GREATER] = strip_tags(str_replace('[score]', $lang->def('_SCORE'), $lang->def('_RULE_GREATER')));
        $arr_question[RULE_LESSER] = strip_tags(str_replace('[score]', $lang->def('_SCORE'), $lang->def('_RULE_LESSER')));
        $arr_question[RULE_BETWEEN] = strip_tags(str_replace(array('[score_1]', '[score_2]'), array($lang->def('_SCORE'), $lang->def('_SCORE_2')), $lang->def('_RULE_BETWEEN')));
        if ($use_default || $id_rule != 0) {
            $arr_question[RULE_DEFAULT] = $lang->def('_RULE_DEFAULT');
        }
        aout(Form::getHidden('id_assessment', 'id_assessment', importVar('id_assessment', true, 0)));
        aout(Form::getHidden('id_rule', 'id_rule', $id_rule));
        aout('<b><label for="rule_type">' . $lang->def('_RULE_TEXT') . '</label>:&nbsp;</b>' . Form::getInputDropdown('dropdown_nowh', 'rule_type', 'rule_type', $arr_question, $rule_type, ' onChange="rule_type_change(\'rule_type\', \'score_type_one\', \'score_type_two\');"') . '<br />' . '<br />');
        aout(Form::getTextfield($lang->def('_SCORE') . ':&nbsp;', 'score_type_one', 'score_type_one', 255, $score_type_one));
        aout(Form::getTextfield($lang->def('_SCORE_2') . ':&nbsp;', 'score_type_two', 'score_type_two', 255, $score_type_two));
        aout(Form::getBreakRow());
        aout('<script type="text/javascript">' . 'rule_type_change(\'rule_type\', \'score_type_one\', \'score_type_two\');' . '</script>');
        break;
}
Exemplo n.º 11
0
 /**
  * @return 	string 	contains the displayable information for a selected group
  *
  * @access 	public
  */
 function getPageWithElement($regroup)
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('configuration', 'lms');
     $reSetting = sql_query("\r\n\t\tSELECT param_name, param_value, value_type, max_size \r\n\t\tFROM " . $this->table . " \r\n\t\tWHERE regroup = '" . $regroup . "' AND \r\n\t\t\thide_in_modify = '0'\r\n\t\tORDER BY sequence");
     $html = '';
     while (list($var_name, $var_value, $value_type, $max_size) = sql_fetch_row($reSetting)) {
         switch ($value_type) {
             case "point_field":
                 require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
                 $fl = new FieldList();
                 $all_fields = $fl->getAllFields();
                 $fields[0] = $lang->def('_NO_VALUE');
                 foreach ($all_fields as $key => $val) {
                     $fields[$val[FIELD_INFO_ID]] = $val[FIELD_INFO_TRANSLATION];
                 }
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $fields, $var_value);
                 break;
             case "language":
                 //drop down language
                 $langs = Docebo::langManager()->getAllLangCode();
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $langs, array_search($var_value, $langs));
                 break;
             case "template":
                 //drop down template
                 $templ = getTemplateList();
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $templ, array_search($var_value, $templ));
                 break;
             case "hteditor":
                 //drop down hteditor
                 $ht_edit = getHTMLEditorList();
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $ht_edit, $var_value);
                 break;
             case "layout_chooser":
                 //drop down hteditor
                 $layout = array('left' => Lang::t('_LAYOUT_LEFT'), 'over' => Lang::t('_LAYOUT_OVER'), 'right' => Lang::t('_LAYOUT_RIGHT'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $layout, $var_value);
                 break;
             case "sel_news":
                 $mode = array('off' => Lang::t('_DONT_SHOW'), 'link' => Lang::t('_SHOW_AS_LINK'), 'block' => Lang::t('_SHOW_AS_BLOCK'));
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $mode, $var_value);
                 break;
             case "enum":
                 //on off
                 $html .= Form::openFormLine() . Form::getInputCheckbox($var_name . '_on', 'option[' . $var_name . ']', 'on', $var_value == 'on', '') . ' ' . Form::getLabel($var_name . '_on', $lang->def('_' . strtoupper($var_name))) . Form::closeFormLine();
                 break;
             case "menuvoice":
             case "menuvoice_course_public":
             case "check":
                 //on off
                 $html .= Form::getCheckbox($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', 1, $var_value == 1);
                 break;
             case "tablist_coursecatalogue":
                 $lang_c =& DoceboLanguage::createInstance('catalogue', 'lms');
                 $tab_selected = unserialize(urldecode($var_value));
                 $tab_list = array('time' => $lang_c->def('_TAB_VIEW_TIME'), 'category' => $lang_c->def('_TAB_VIEW_CATEGORY'), 'all' => $lang_c->def('_ALL'));
                 if (Get::sett('use_coursepath') == '1') {
                     $tab_list['pathcourse'] = $lang_c->def('_COURSEPATH');
                 }
                 if (Get::sett('use_social_courselist') == 'on') {
                     $tab_list['mostscore'] = $lang_c->def('_TAB_VIEW_MOSTSCORE');
                     $tab_list['popular'] = $lang_c->def('_TAB_VIEW_MOSTPOPULAR');
                     $tab_list['recent'] = $lang_c->def('_TAB_VIEW_RECENT');
                 }
                 foreach ($tab_list as $tab_code => $name) {
                     $html .= Form::getCheckbox($name, 'tablist_' . $tab_code, 'tablist[' . $tab_code . ']', 1, isset($tab_selected[$tab_code]));
                 }
                 break;
             case "first_coursecatalogue_tab":
                 $lang_c =& DoceboLanguage::createInstance('catalogue', 'lms');
                 $tab_list = array('time' => $lang_c->def('_TAB_VIEW_TIME'), 'category' => $lang_c->def('_TAB_VIEW_CATEGORY'), 'all' => $lang_c->def('_ALL'));
                 if (Get::sett('use_coursepath') == '1') {
                     $tab_list['pathcourse'] = $lang_c->def('_COURSEPATH');
                 }
                 if (Get::sett('use_social_courselist') == 'on') {
                     $tab_list['mostscore'] = $lang_c->def('_TAB_VIEW_MOSTSCORE');
                     $tab_list['popular'] = $lang_c->def('_TAB_VIEW_MOSTPOPULAR');
                     $tab_list['recent'] = $lang_c->def('_TAB_VIEW_RECENT');
                 }
                 $html .= Form::getDropdown($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $tab_list, $var_value);
                 break;
             case "tablist_mycourses":
                 //$var_value=deformat($var_value);
                 $arr_value = explode(',', $var_value);
                 //$arr_value=array();
                 $tab_list = array();
                 $tab_list[''] = $lang->def('_MYCOURSES_NOTUSED');
                 $tab_list['status'] = $lang->def('_STATUS');
                 $tab_list['name'] = $lang->def('_NAME');
                 $tab_list['code'] = $lang->def('_CODE');
                 $html .= '<div class="form_line_l"><p>' . '<label class="floating">' . $lang->def('_' . strtoupper($var_name)) . '</label></p>';
                 for ($i = 0; $i < 3; $i++) {
                     $html .= Form::getInputDropdown('dropdown', $var_name . '_' . $i, "mycourses[{$i}]", $tab_list, isset($arr_value[$i]) ? $arr_value[$i] : '', '');
                 }
                 $html .= '</div>';
                 break;
                 //string or int
             //string or int
             default:
                 $html .= Form::getTextfield($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $max_size, $var_value);
         }
     }
     return $html;
 }
Exemplo n.º 12
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;
}
Exemplo n.º 13
0
 public function certificate()
 {
     if (!$this->permissions['mod']) {
         $this->render('invalid', array('message' => $this->_getErrorMessage('no permission'), 'back_url' => 'index.php?r=' . $this->base_link_course . '/show'));
         return;
     }
     if (isset($_POST['undo'])) {
         Util::jump_to('index.php?r=' . $this->base_link_course . '/show');
     }
     require_once _lms_ . '/lib/lib.certificate.php';
     $cert = new Certificate();
     $id_course = Get::req('id_course', DOTY_INT, 0);
     if (isset($_POST['assign'])) {
         $point_required = Get::req('point_required', DOTY_INT, 0);
         // , $list_of_assign_obj, $list_of_who
         if (!$cert->updateCertificateCourseAssign($id_course, $_POST['certificate_assign'], $_POST['certificate_ex_assign'], $point_required)) {
             Util::jump_to('index.php?r=' . $this->base_link_course . '/show&err=_up_cert_err');
         }
         Util::jump_to('index.php?r=' . $this->base_link_course . '/show&res=_up_cert_ok');
     } else {
         require_once _base_ . '/lib/lib.table.php';
         $all_languages = Docebo::langManager()->getAllLanguages(true);
         $languages = array();
         foreach ($all_languages as $k => $v) {
             $languages[$v['code']] = $v['description'];
         }
         $query = "SELECT code, name, course_type" . " FROM %lms_course WHERE idCourse = '" . $id_course . "'";
         $course = sql_fetch_array(sql_query($query));
         $tb = new Table(false, Lang::t('_TITLE_CERTIFICATE_TO_COURSE', 'course'), Lang::t('_TITLE_CERTIFICATE_TO_COURSE', 'course'));
         $certificate_list = $cert->getCertificateList();
         $course_cert = $cert->getCourseCertificate($id_course);
         $course_ex_cert = $cert->getCourseExCertificate($id_course);
         $released = $cert->numOfcertificateReleasedForCourse($id_course);
         $point_required = $cert->getPointRequiredForCourse($id_course);
         $possible_status = array(AVS_NOT_ASSIGNED => Lang::t('_NOT_ASSIGNED', 'course'), AVS_ASSIGN_FOR_ALL_STATUS => Lang::t('_ASSIGN_FOR_ALL_STATUS', 'course'), AVS_ASSIGN_FOR_STATUS_INCOURSE => Lang::t('_ASSIGN_FOR_STATUS_INCOURSE', 'course'), AVS_ASSIGN_FOR_STATUS_COMPLETED => Lang::t('_ASSIGN_FOR_STATUS_COMPLETED', 'course'));
         $type_h = array('nowrap', 'nowrap', '', '', 'image');
         $cont_h = array(Lang::t('_TITLE', 'course'), Lang::t('_CERTIFICATE_LANGUAGE', 'course'), Lang::t('_CERTIFICATE_ASSIGN_STATUS', 'course'), Lang::t('_CERTIFICATE_EX_ASSIGN_STATUS', 'course'), Lang::t('_CERTIFICATE_RELEASED', 'course'));
         $tb->setColsStyle($type_h);
         $tb->addHead($cont_h);
         $view_cert = false;
         if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
             if (checkPerm('view', true, 'certificate', 'lms') || checkPerm('view', true, 'pcertificate', 'lms')) {
                 $view_cert = true;
             }
         } else {
             $view_cert = true;
         }
         while (list($id_cert, $cert) = each($certificate_list)) {
             $cont = array();
             $cont[] = '<label for="certificate_assign_' . $id_cert . '">' . $cert[CERT_NAME] . '</label>';
             $cont[] = isset($languages[$cert[CERT_LANG]]) ? $languages[$cert[CERT_LANG]] : $cert[CERT_LANG];
             //lang description?
             $cont[] = Form::getInputDropdown('dropdown_nowh', 'certificate_assign_' . $id_cert, 'certificate_assign[' . $id_cert . ']', $possible_status, isset($course_cert[$id_cert]) ? $course_cert[$id_cert] : 0, '');
             $cont[] = Form::getInputDropdown('dropdown_nowh', 'certificate_ex_assign_' . $id_cert, 'certificate_ex_assign[' . $id_cert . ']', $possible_status, isset($course_ex_cert[$id_cert]) ? $course_ex_cert[$id_cert] : 0, '');
             $cont[] = (isset($course_cert[$id_cert]) && $course_cert[$id_cert] != 0 && $view_cert ? '<a href="index.php?modname=' . (Docebo::user()->getUserLevelId() == ADMIN_GROUP_PUBLICADMIN ? 'p' : '') . 'certificate&amp;op=view_report_certificate&amp;id_certificate=' . $id_cert . '&amp;id_course=' . $id_course . '&amp;from=course&amp;of_platform=lms">' : '') . (isset($released[$id_cert]) ? $released[$id_cert] : '0') . (isset($course_cert[$id_cert]) && $course_cert[$id_cert] != 0 ? '</a>' : '');
             $tb->addBody($cont);
         }
         $course_info = $this->model->getInfo($id_course);
         $course_name = ($course_info['code'] !== '' ? '[' . $course_info['code'] . '] ' : '') . $course_info['name'];
         $this->render('certificate', array('id_course' => $id_course, 'tb' => $tb, 'point_required' => $point_required, 'base_link_course' => $this->base_link_course, 'course_name' => $course_name));
     }
 }
 public function cataloguesubscribeusersTask()
 {
     require_once _adm_ . '/lib/lib.directory.php';
     require_once _adm_ . '/class.module/class.directory.php';
     require_once _lms_ . '/lib/lib.course.php';
     require_once _lms_ . '/lib/lib.edition.php';
     require_once _lms_ . '/lib/lib.date.php';
     $acl_man =& Docebo::user()->getAclManager();
     $edition_man = new EditionManager();
     $date_man = new DateManager();
     $id_catalogue = Get::req('id_catalogue', DOTY_INT, 0);
     $back_url = 'index.php?modname=catalogue&op=catlist&of_platform=lms';
     $jump_url = 'index.php?r=' . $this->link . '/cataloguesubscribeusers';
     //if we are a subadmin, check which courses/catalogues we can see
     $can_see_catalogue = true;
     if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
         require_once _base_ . '/lib/lib.preference.php';
         $adminManager = new AdminPreference();
         $admin_courses = $adminManager->getAdminCourse(Docebo::user()->getIdST());
         $all_courses = false;
         if (isset($admin_courses['course'][0])) {
             $all_courses = true;
         }
         if (isset($admin_courses['course'][-1])) {
             require_once _lms_ . '/lib/lib.catalogue.php';
             $cat_man = new Catalogue_Manager();
             $admin_courses['catalogue'] = $cat_man->getUserAllCatalogueId(Docebo::user()->getIdSt());
             if (count($admin_courses['catalogue']) == 0 && Get::sett('on_catalogue_empty', 'off') == 'on') {
                 $all_courses = true;
             }
         }
         if (!isset($admin_courses['catalogue'][$id_catalogue])) {
             $can_see_catalogue = false;
         }
     }
     //invalid specified catalogue
     if ($id_catalogue <= 0 || !$can_see_catalogue) {
         $this->render('invalid', array('message' => Lang::t('_INVALID_CATALOGUE', 'subscribe'), 'back_url' => $back_url));
         return;
     }
     //check if the selected catalogue has any courses
     $courses_list = $this->_getCatalogueCourses($id_catalogue, isset($admin_courses['course']) ? $admin_courses['course'] : false);
     if (count($courses_list) <= 0) {
         $this->render('invalid', array('message' => Lang::t('_NO_COURSES_IN_THE_CATALOGUE', 'subscribe'), 'back_url' => $back_url));
         return;
     }
     $name = $this->_getCatalogueName($id_catalogue);
     if (isset($_POST['cancelselector'])) {
         //--- UNDO: return to catalogue list -------------------------------------
         Util::jump_to($back_url);
     } elseif (isset($_POST['okselector'])) {
         //--- USERS SELECTION IS CONFIRMED: now select editions (if any) ---------
         //check user selection
         $_selector = new UserSelector();
         $json = new Services_JSON();
         $_entity_selected = $_selector->getSelection($_POST);
         $user_selected =& $acl_man->getAllUsersFromSelection($_entity_selected);
         //free some memory from garbage variables
         unset($_selector);
         unset($_entity_selected);
         //if no user selected, than give invalid screen
         if (!is_array($user_selected) || count($user_selected) <= 0) {
             $this->render('invalid', array('message' => Lang::t('_EMPTY_SELECTION', 'subscribe'), 'back_url' => $back_url));
             return;
         }
         //extract editions info data by courses
         $editions_list = $edition_man->getEditionsInfoByCourses(array_keys($courses_list), true);
         //extract editions info data by courses
         $classrooms_list = $date_man->getDatesInfoByCourses(array_keys($courses_list), true);
         $tables = array('editions' => false, 'classrooms' => false);
         //check if the catalogue has editions; if any, than set the editions selector
         if (count($editions_list) > 0 || count($classrooms_list) > 0) {
             //set title
             $page_title_arr = array($back_url => Lang::t('_SUBSCRIBE', 'subscribe'), $name, Lang::t('_SUBSCRIBE', 'subscribe'));
             if (count($editions_list) > 0) {
                 //instantiate a new table for editions selection
                 require_once _base_ . '/lib/lib.table.php';
                 $tb = new Table(0, Lang::t('_CATALOGUE_SUBSCRIBE_CHOOSE_EDITIONS', 'subscribe'), Lang::t('_CATALOGUE_SUBSCRIBE_CHOOSE_EDITIONS', 'subscribe'));
                 $head_style = array('align_center', '', 'align_center');
                 $head_label = array(Lang::t('_COURSE_CODE', 'course'), Lang::t('_COURSE_NAME', 'course'), Lang::t('_CLASSROOM_EDITION', 'course'));
                 $tb->addHead($head_label, $head_style);
                 //set table rows
                 foreach ($editions_list as $id_course => $editions) {
                     $line = array();
                     $cinfo = $courses_list[$id_course];
                     $line[] = $cinfo->code;
                     $line[] = $cinfo->name;
                     //create the dropdown with the editions for every course
                     $_dropdown = array();
                     foreach ($editions as $id_edition => $ed_info) {
                         $_line_content = '';
                         //print begin and end date
                         if ($ed_info->date_begin != '') {
                             $_line_content .= '[' . $ed_info->code . '] ' . $ed_info->name . ' ' . '(' . Format::date($ed_info->date_begin, 'date') . ' - ' . Format::date($ed_info->date_end, 'date') . ')';
                         }
                         //check if the string is valid
                         if ($_line_content == '') {
                             //...
                         }
                         //add to dropdown list and sort the list alphabetically
                         $_dropdown[$id_edition] = $_line_content;
                         asort($_dropdown);
                     }
                     $line[] = Form::getInputDropdown('dropdown', 'sel_editions_' . $id_course, 'sel_editions[' . $id_course . ']', $_dropdown, false, '');
                     $tb->addBody($line);
                 }
                 $tables['editions'] = $tb;
             }
             if (count($classrooms_list) > 0) {
                 //instantiate a new table for editions selection
                 require_once _base_ . '/lib/lib.table.php';
                 $tb = new Table(0, Lang::t('_COURSE_TYPE_EDITION', 'course'), Lang::t('_CLASSROOM', 'standard'));
                 $head_style = array('align_center', '', 'align_center');
                 $head_label = array(Lang::t('_COURSE_CODE', 'course'), Lang::t('_COURSE_NAME', 'course'), Lang::t('_CLASSROOM_EDITION', 'course'));
                 $tb->addHead($head_label, $head_style);
                 //set table rows
                 foreach ($classrooms_list as $id_course => $classrooms) {
                     $line = array();
                     $cinfo = $courses_list[$id_course];
                     $line[] = $cinfo->code;
                     $line[] = $cinfo->name;
                     //create the dropdown with the editions for every course
                     $_dropdown = array();
                     foreach ($classrooms as $id_date => $cl_info) {
                         $_line_content = '';
                         //print begin and end date
                         if ($cl_info->date_begin != '') {
                             $_line_content .= '[' . $cl_info->code . '] ' . $cl_info->name . ' ' . '(' . Format::date($cl_info->date_begin, 'date') . ' - ' . Format::date($cl_info->date_end, 'date') . ')';
                         }
                         //check if the string is valid
                         if ($_line_content == '') {
                             //...
                         }
                         //add to dropdown list and sort the list alphabetically
                         $_dropdown[$id_date] = $_line_content;
                         asort($_dropdown);
                     }
                     $line[] = Form::getInputDropdown('dropdown', 'sel_classrooms_' . $id_course, 'sel_classrooms[' . $id_course . ']', $_dropdown, false, '');
                     $tb->addBody($line);
                 }
                 $tables['classrooms'] = $tb;
             }
             $this->render('catalogue_editions', array('id_catalogue' => $id_catalogue, 'page_title_arr' => $page_title_arr, 'num_users_selected' => count($user_selected), '_sel_users' => $json->encode($user_selected), 'tables' => $tables));
         } else {
             //no editions in the catalogue's courses, call the save operation directly
             $data = array();
             foreach ($user_selected as $user) {
                 foreach ($courses_list as $idCourse => $course) {
                     $data[] = array($user, $idCourse, false, false);
                 }
             }
             $num_subscribed = $this->_subscribeUsersToCatalogue($data);
             Util::jump_to($back_url . '&res=' . $num_subscribed);
             //_operation_successful
         }
     } else {
         //--- USER SELECTION IS IN PROGRESS: show selector -----------------------
         $user_select = new UserSelector();
         $user_select->show_user_selector = TRUE;
         $user_select->show_group_selector = TRUE;
         $user_select->show_orgchart_selector = TRUE;
         //$user_select->show_orgchart_simple_selector = TRUE;
         //filter selectable user by sub-admin permission
         $user_select->setUserFilter('exclude', array($this->acl_man->getAnonymousId()));
         if (Docebo::user()->getUserLevelId() != ADMIN_GROUP_GODADMIN) {
             require_once _base_ . '/lib/lib.preference.php';
             $adminManager = new AdminPreference();
             $admin_tree = $adminManager->getAdminTree(Docebo::user()->getIdST());
             $admin_users = $this->acl_man->getAllUsersFromIdst($admin_tree);
             $user_select->setUserFilter('user', $admin_users);
             $user_select->setUserFilter('group', $admin_tree);
         }
         if (Get::req('is_updating', DOTY_INT, false)) {
             //...
         } else {
             $user_select->requested_tab = PEOPLEVIEW_TAB;
             $user_select->resetSelection();
         }
         $page_title_arr = array($back_url => Lang::t('_SUBSCRIBE', 'subscribe'), $name, Lang::t('_SUBSCRIBE', 'subscribe'));
         $user_select->addFormInfo(Form::getHidden('is_updating', 'is_updating', 1) . Form::getHidden('id_catalogue', 'id_catalogue', $id_catalogue));
         //$user_select->setPageTitle($page_title_arr);
         //$user_select->resetSelection($_SESSION['report_tempdata']['rows_filter']['users']);
         $user_select->loadSelector(Util::str_replace_once('&', '&amp;', $jump_url), $page_title_arr, false, true);
     }
 }
Exemplo n.º 15
0
 public function getDayTable($array_day, $id_date = 0)
 {
     require_once _base_ . '/lib/lib.table.php';
     $tb = new Table(0, Lang::t('_DETAILS', 'course'), Lang::t('_DETAILS', 'course'));
     $cont_h = array(Lang::t('_DAY', 'course'), Lang::t('_HOUR_BEGIN', 'course'), Lang::t('_PAUSE_BEGIN', 'course'), Lang::t('_PAUSE_END', 'course'), Lang::t('_HOUR_END', 'course'), Lang::t('_CLASSROOM', 'course'));
     $type_h = array('align_center', 'align_center', 'align_center', 'align_center');
     $classroom_array = $this->classroom_man->getClassroomForDropdown();
     $tb->setColsStyle($type_h);
     $tb->addHead($cont_h);
     $days = array();
     if ($id_date != 0) {
         $days = $this->classroom_man->getDateDayForControl($id_date);
     }
     for ($i = 0; $i < count($array_day); $i++) {
         if (isset($days[$array_day[$i]])) {
             $b_hours = $days[$array_day[$i]]['b_hours'];
             $b_minutes = $days[$array_day[$i]]['b_minutes'];
             $pb_hours = $days[$array_day[$i]]['pb_hours'];
             $pb_minutes = $days[$array_day[$i]]['pb_minutes'];
             $pe_hours = $days[$array_day[$i]]['pe_hours'];
             $pe_minutes = $days[$array_day[$i]]['pe_minutes'];
             $e_hours = $days[$array_day[$i]]['e_hours'];
             $e_minutes = $days[$array_day[$i]]['e_minutes'];
             $classroom = $days[$array_day[$i]]['classroom'];
         } else {
             $b_hours = false;
             $b_minutes = false;
             $pb_hours = false;
             $pb_minutes = false;
             $pe_hours = false;
             $pe_minutes = false;
             $e_hours = false;
             $e_minutes = false;
             $classroom = 0;
         }
         $classroom_array_checked = array();
         $occupied = $this->getOccupiedClassrooms($array_day[$i]);
         foreach ($classroom_array as $key => $value) {
             $classroom_array_checked[$key] = (in_array($key, $occupied) && $key != 0 ? '* ' : '') . $value;
         }
         $tb->addBody(array(Format::date($array_day[$i], 'date'), Form::getInputDropdown('', 'b_hours_' . $i, 'b_hours_' . $i, $this->classroom_man->getHours(), $b_hours, false) . ' : ' . Form::getInputDropdown('', 'b_minutes_' . $i, 'b_minutes_' . $i, $this->classroom_man->getMinutes(), $b_minutes, false), Form::getInputDropdown('', 'pb_hours_' . $i, 'pb_hours_' . $i, $this->classroom_man->getHours(), $pb_hours, false) . ' : ' . Form::getInputDropdown('', 'pb_minutes_' . $i, 'pb_minutes_' . $i, $this->classroom_man->getMinutes(), $pb_minutes, false), Form::getInputDropdown('', 'pe_hours_' . $i, 'pe_hours_' . $i, $this->classroom_man->getHours(), $pe_hours, false) . ' : ' . Form::getInputDropdown('', 'pe_minutes_' . $i, 'pe_minutes_' . $i, $this->classroom_man->getMinutes(), $pe_minutes, false), Form::getInputDropdown('', 'e_hours_' . $i, 'e_hours_' . $i, $this->classroom_man->getHours(), $e_hours, false) . ' : ' . Form::getInputDropdown('', 'e_minutes_' . $i, 'e_minutes_' . $i, $this->classroom_man->getMinutes(), $e_minutes, false), Form::getInputDropdown('', 'classroom_' . $i, 'classroom_' . $i, $classroom_array_checked, $classroom, false)));
     }
     if (count($array_day) > 1) {
         $tb->addBody(array(Lang::t('_SET', 'course'), Form::getInputDropdown('', 'b_hours', 'b_hours', $this->classroom_man->getHours(), '00', false) . ' : ' . Form::getInputDropdown('', 'b_minutes', 'b_minutes', $this->classroom_man->getMinutes(), '00', false), Form::getInputDropdown('', 'pb_hours', 'pb_hours', $this->classroom_man->getHours(), '00', false) . ' : ' . Form::getInputDropdown('', 'pb_minutes', 'pb_minutes', $this->classroom_man->getMinutes(), '00', false), Form::getInputDropdown('', 'pe_hours', 'pe_hours', $this->classroom_man->getHours(), '00', false) . ' : ' . Form::getInputDropdown('', 'pe_minutes', 'pe_minutes', $this->classroom_man->getMinutes(), '00', false), Form::getInputDropdown('', 'e_hours', 'e_hours', $this->classroom_man->getHours(), '00', false) . ' : ' . Form::getInputDropdown('', 'e_minutes', 'e_minutes', $this->classroom_man->getMinutes(), '00', false), Form::getInputDropdown('', 'classroom', 'classroom', $classroom_array, 0, false)));
     }
     $table = '<script type="text/javascript">' . 'var num_day = ' . count($array_day) . ';' . 'YAHOO.util.Event.on("b_hours", "change", changeBeginHours);' . 'YAHOO.util.Event.on("b_minutes", "change", changeBeginMinutes);' . 'YAHOO.util.Event.on("pb_hours", "change", changePBeginHours);' . 'YAHOO.util.Event.on("pb_minutes", "change", changePBeginMinutes);' . 'YAHOO.util.Event.on("pe_hours", "change", changePEndHours);' . 'YAHOO.util.Event.on("pe_minutes", "change", changePEndMinutes);' . 'YAHOO.util.Event.on("e_hours", "change", changeEndHours);' . 'YAHOO.util.Event.on("e_minutes", "change", changeEndMinutes);' . 'YAHOO.util.Event.on("classroom", "change", changeClassroom);' . '</script>' . $tb->getTable();
     return $table;
 }
Exemplo n.º 16
0
function subscribemod()
{
    checkPerm('subscribe', false, 'course');
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
    require_once _base_ . '/lib/lib.table.php';
    $id_course = importVar('id_course', true, 0);
    $course_info = Man_Course::getCourseInfo($id_course);
    $edition_id = getCourseEditionId();
    $fman = new FieldList();
    //addScriptaculousJs();
    YuiLib::load(array('json' => 'json-min.js'));
    $GLOBALS['page']->add('<script type="text/javascript">' . ' function reloadInfo() {
		  var $ = YAHOO.util.Dom.get;
			var selection = $("extra_info").value;
			var id_course = $("id_course").value;
		
			var data = "op=get_info&id_course="+id_course+"&id_field=" + selection;
			
			var objAjax = YAHOO.util.Connect.asyncRequest("POST",
		        "' . $GLOBALS['where_lms_relative'] . '/ajax.adm_server.php?mn=subscribe",
		        {onSuccess: callback_change}, data
		    );
			$("extra_info").disabled = true;
		} ' . ' function callback_change(o) {
			
			var result = YAHOO.lang.JSON.parse(o.responseText);
			var table = $("subscribed_list");
			for(var i= 0;i < table.rows.length;i++) {
				var ind = table.rows[i].id.indexOf("user_");
				if(ind >= 0) {
					var id_user = table.rows[i].id.substr(5);
					table.rows[i].cells[1].innerHTML = result[id_user];
				}
			}
			$("extra_info").disabled = false;
		}' . '</script>', 'page_head');
    $out =& $GLOBALS['page'];
    $lang =& DoceboLanguage::CreateInstance('subscribe', 'lms');
    $acl_man =& Docebo::user()->getAclManager();
    $levels = CourseLevel::getLevels();
    $arr_absent = array(0 => $lang->def('_NO'), 1 => $lang->def('_JUSTIFIED'), 2 => $lang->def('_NOT_JUSTIFIED'));
    $arr_status = array(_CUS_CONFIRMED => $lang->def('_USER_STATUS_CONFIRMED'), _CUS_SUBSCRIBED => $lang->def('_USER_STATUS_SUBS'), _CUS_BEGIN => $lang->def('_USER_STATUS_BEGIN'), _CUS_END => $lang->def('_USER_STATUS_END'), _CUS_SUSPEND => $lang->def('_USER_STATUS_SUSPEND'), _CUS_CANCELLED => $lang->def('_USER_STATUS_CANCELLED'));
    $field = $fman->getFlatAllFields();
    $field = array('name' => $lang->def('_FULLNAME'), 'email' => $lang->def('_EMAIL')) + $field;
    // Retrive info about the selected user
    $user_alredy_subscribed = getSubscribed($id_course, false, false, true, $edition_id);
    $user_levels = getSubscribedInfo($id_course, false, false, false, false, $edition_id);
    require_once $GLOBALS['where_framework'] . '/lib/lib.adminmanager.php';
    $adminManager = new AdminManager();
    $acl_manager = new DoceboACLManager();
    $idst_associated = $adminManager->getAdminTree(getLogUserId());
    $array_user_associated =& $acl_manager->getAllUsersFromIdst($idst_associated);
    $user_level = Docebo::user()->getUserLevelId();
    if ($user_level != ADMIN_GROUP_GODADMIN) {
        $user_alredy_subscribed = array_intersect($user_alredy_subscribed, $array_user_associated);
    }
    $user_selected_info =& $acl_man->getUsers($user_alredy_subscribed);
    $page_title = array('index.php?modname=course&op=course_list' => $lang->def('_COURSES'), $course_info['name'], $lang->def('_SUBSCRIBE'));
    $GLOBALS['page']->add(getTitleArea($page_title, 'subscribe') . '<div class="std_block">' . Form::openForm('levelselection', 'index.php?modname=subscribe&amp;op=subscribeupdate') . Form::getHidden('id_course', 'id_course', $id_course) . Form::getHidden('edition_id', 'edition_id', $edition_id), 'content');
    $tb = new Table(0, $lang->def('_CAPTION_SELECT_LEVELS'), $lang->def('_SUMMARY_SELECT_LEVEL'));
    $tb->setTableId('subscribed_list');
    $type_h = array('', '');
    $content_h = array($lang->def('_USERNAME'), Form::getInputDropdown('dropdown_nowh', 'extra_info', 'extra_info', $field, 0, ' onchange="reloadInfo();"'));
    foreach ($levels as $lv => $lv_name) {
        $type_h[] = 'image';
        $content_h[] = '<a href="javascript:SelAll(\'' . $lv . '\');">' . $lv_name . '</a>';
    }
    $type_h[] = 'image';
    $content_h[] = $lang->def('_STATUS');
    if ($course_info['course_type'] != 'elearning') {
        $type_h[] = 'image';
        $content_h[] = $lang->def('_ABSENT');
    }
    $tb->addHead($content_h, $type_h);
    $num_user_sel = 0;
    if (is_array($user_selected_info)) {
        reset($user_selected_info);
        $jsArr = "var elementi = new Array(";
        $i = 0;
        while (list($id_user, $user_info) = each($user_selected_info)) {
            if ($i != 0) {
                $jsArr .= ",";
            }
            $i++;
            $jsArr .= "'" . $id_user . "'";
            // if the user isn't alredy subscribed to the course
            $content = array(substr($user_info[ACL_INFO_USERID], 1), $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME]);
            foreach ($levels as $lv => $lv_name) {
                $content[] = Form::getInputRadio('user_level_sel_' . $id_user . '_' . $lv, 'user_level_sel[' . $id_user . ']', $lv, $lv == $user_levels[$id_user]['level'], '') . '<label class="access-only" for="user_level_sel_' . $id_user . '_' . $lv . '">' . $lv_name . '</label>';
            }
            $content[] = Form::getInputDropdown('dropdown', 'user_status_sel_' . $id_user . '', 'user_status_sel[' . $id_user . ']', $arr_status, $user_levels[$id_user]['status'], '') . '<label class="access-only" for="user_status_sel_' . $id_user . '">' . $lang->def('_STATUS') . '</label>';
            if ($course_info['course_type'] != 'elearning') {
                $content[] = Form::getInputDropdown('dropdown_nowh', 'user_absent' . $id_user . '', 'user_absent[' . $id_user . ']', $arr_absent, $user_levels[$id_user]['absent'], '') . '<label class="access-only" for="user_absent_' . $id_user . '">' . $lang->def('_ABSENT') . '</label>';
            }
            $tb->addBody($content, false, false, 'user_' . $id_user);
        }
        $GLOBALS['page']->add($tb->getTable(), 'content');
    }
    $GLOBALS['page']->add(Form::openButtonSpace() . '<br />' . Form::getButton('subscribe', 'subscribe', $lang->def('_MOD')) . Form::getButton('cancelselector', 'cancelselector', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm(), 'content');
    $GLOBALS['page']->add('</div>', 'content');
    $GLOBALS['page']->add('                                 
<script>                
' . $jsArr . ');
function SelAll (lvl)           
{                                                                                                       
        var nb;                                                                                         
        ne = elementi.length;
        mod = document.getElementById(\'levelselection\');
        for (var i=0;i<ne;i++)                                                                          
        {                                               
                elem = \'user_level_sel_\'+elementi[i]+\'_\'+lvl;
                var e = document.getElementById(elem);
                e.checked = 1;                                                                          
        }                                                                                               
}
</script>');
}
Exemplo n.º 17
0
<div class="list_block">
	<h3 class="heading"><?php 
echo $title;
?>
</h3>
	<p class="content">
		<?php 
echo Get::img('standard/report32.png', '', '', 'style="float:left; padding:0 4px 0 0"');
?>
		<?php 
echo $description;
?>
	</p>
	<div class="actions">
	<?php 
echo Form::openForm('form_' . $id, $url);
echo Form::openButtonSpace();
if (isset($users)) {
    echo Form::getInputDropdown(Lang::t('_USERS', 'standard'), 'dropdown_' . $id, 'id_user', $users['list'], $users['selected'], '');
}
echo Form::getButton('button_' . $id, 'button_' . $id, Lang::t('_SHOW', 'standard'));
echo Form::closeButtonSpace();
echo Form::closeForm();
?>
	</div>
	<div class="nofloat"></div>
</div>
Exemplo n.º 18
0
 /**
  * This method create an HTML UI for create the map of fields from
  * source to destination
  **/
 function getUIMap()
 {
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('organization_chart', 'framework');
     $form = new Form();
     $table = new Table(Get::sett('visuItem'), $lang->def('_IMPORT_MAP'), $lang->def('_IMPORT_MAP'));
     $src_cols = $this->source->get_cols_descripor();
     $dst_cols = $this->destination->get_cols_descripor();
     $combo_elements = array();
     foreach ($dst_cols as $col) {
         if (isset($col[DOCEBOIMPORT_COLID])) {
             $combo_elements[$col[DOCEBOIMPORT_COLID]] = $col[DOCEBOIMPORT_COLNAME];
         } else {
             $combo_elements[$col[DOCEBOIMPORT_COLNAME]] = $col[DOCEBOIMPORT_COLNAME];
         }
     }
     $combo_elements[DOCEBOIMPORT_IGNORE] = $lang->def('_IMPORT_IGNORE');
     $table_dst_labels = array();
     $table_src_labels = array();
     $table_src_labels_type = array();
     $count = 0;
     foreach ($src_cols as $col) {
         $pk = '0';
         $map = '';
         if (isset($this->import_map[$count])) {
             $pk = isset($this->import_map[$count]['pk']) ? $this->import_map[$count]['pk'] : "0";
             $map = isset($this->import_map[$count]['map']) ? $this->import_map[$count]['map'] : "";
         }
         $table_src_labels[] = $col[DOCEBOIMPORT_COLNAME] . $form->getInputCheckbox("import_map_" . $count . "_pk", "import_map[" . $count . "][pk]", "1", $pk == '1', '');
         $table_src_labels_type[] = '';
         $table_dst_labels[] = $form->getInputDropdown("dropdown_nowh", "import_map_" . $count . "_map", "import_map[" . $count . "][map]", $combo_elements, $map, "");
         $count++;
     }
     $table->setColsStyle($table_src_labels_type);
     $table->addHead($table_dst_labels);
     $table->addHead($table_src_labels);
     $count = 0;
     $row = $this->source->get_first_row();
     while ($row !== FALSE && $count < 10) {
         $table->addBody($row);
         $row = $this->source->get_next_row();
         $count++;
     }
     return $table->getTable();
 }
Exemplo n.º 19
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');
    }
}
Exemplo n.º 20
0
function modassignpoint()
{
    checkPerm('view', false, 'storage');
    $lang =& DoceboLanguage::createInstance('test');
    require_once _base_ . '/lib/lib.table.php';
    require_once _base_ . '/lib/lib.form.php';
    $idTest = importVar('idTest', true, 0);
    $back_url = urldecode(importVar('back_url'));
    $url_coded = htmlentities(urlencode($back_url));
    //jump back
    if (isset($_POST['back_to_home'])) {
        Util::jump_to('index.php?modname=test&op=modtestgui&idTest=' . $idTest . '&back_url=' . $url_coded);
    }
    //save new score ------------------------------------------------
    if (isset($_POST['saveandexit'])) {
        $query_question = "\r\n\t\tSELECT q.idQuest, q.type_quest, t.type_file, t.type_class \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest AS q JOIN " . $GLOBALS['prefix_lms'] . "_quest_type AS t \r\n\t\tWHERE q.idTest = '" . (int) $idTest . "' AND q.type_quest = t.type_quest";
        $query_question .= " ORDER BY q.sequence";
        $re_quest = sql_query($query_question);
        $score_assign = array();
        while (list($idQuest, $type_quest, $type_file, $type_class) = sql_fetch_row($re_quest)) {
            sql_query("\r\n\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\t\tSET difficult = '" . (int) $_POST['new_difficult_quest'][$idQuest] . "' \r\n\t\t\tWHERE idTest = '" . $idTest . "' AND idQuest = '" . (int) $idQuest . "'");
            require_once dirname(__FILE__) . '/../question/' . $type_file;
            $quest_obj = eval("return new {$type_class}( {$idQuest} );");
            $score_assign[$idQuest] = $quest_obj->setMaxScore($_POST['new_score_quest'][$idQuest]);
        }
    }
    list($test_title) = sql_fetch_row(sql_query("\r\n\tSELECT title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_test \r\n\tWHERE idTest = '" . $idTest . "'"));
    list($tot_quest, $tot_difficult) = sql_fetch_row(sql_query("\r\n\tSELECT COUNT(*), SUM(difficult) \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\tWHERE idTest = '{$idTest}' AND type_quest <> 'break_page' AND type_quest <> 'title'"));
    $query_question = "\r\n\tSELECT q.idQuest, q.type_quest, t.type_file, t.type_class, q.title_quest, q.difficult \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_testquest AS q JOIN " . $GLOBALS['prefix_lms'] . "_quest_type AS t \r\n\tWHERE q.idTest = '" . (int) $idTest . "' AND q.type_quest = t.type_quest";
    $query_question .= " ORDER BY q.sequence";
    $re_quest = sql_query($query_question);
    $GLOBALS['page']->add(getTitleArea($lang->def('_TEST_SECTION'), 'test') . '<div class="std_block">' . getBackUi('index.php?modname=test&amp;op=defpoint&amp;idTest=' . $idTest . '&amp;back_url=' . $url_coded, $lang->def('_BACK')) . '<form method="post" action="index.php?modname=test&amp;op=modassignpoint">' . '<input type="hidden" id="authentic_request_test" name="authentic_request" value="' . Util::getSignature() . '" />' . '<fieldset class="fieldset_std">' . '<legend>' . $lang->def('_TEST_TM2_CAPTIONSETTIME') . '</legend>' . '<input type="hidden" name="idTest" value="' . $idTest . '" />' . '<input type="hidden" name="back_url" value="' . $url_coded . '" />', 'content');
    //table header---------------------------------------------------
    $tab_quest = new Table(0, $lang->def('_TEST_SUMMARY'), $lang->def('_TEST_SUMMARY'));
    $tab_quest->setColsStyle(array('image', 'image', '', 'image', 'image'));
    $tab_quest->addHead(array($lang->def('_TEST_QUEST_ORDER'), $lang->def('_TYPE'), $lang->def('_QUESTION'), $lang->def('_DIFFICULTY'), $lang->def('_SCORE')));
    $i = 1;
    $effective_tot_score = $effective_difficult = 0;
    //table body--------------------------------------------------------
    while (list($idQuest, $type_quest, $type_file, $type_class, $title_quest, $difficult) = sql_fetch_row($re_quest)) {
        require_once dirname(__FILE__) . '/../question/' . $type_file;
        $quest_obj = eval("return new {$type_class}( {$idQuest} );");
        if (isset($_POST['new_score_quest'][$idQuest])) {
            //loading new time form previous page
            $difficult = $_POST['new_difficult_quest'][$idQuest];
            $quest_score = $quest_obj->getRealMaxScore($_POST['new_score_quest'][$idQuest], true);
        } elseif (isset($_POST['point_assignement'])) {
            //calculate new time from deftime page
            switch ($_POST['point_assignement']) {
                case "0":
                    $quest_score = $quest_obj->getRealMaxScore(round(round($_POST['new_assigned_score'] / $tot_difficult, 2) * $difficult), 2);
                    //$quest_score = (( $_POST['new_assigned_score'] / $tot_difficult ) * $difficult ), 2;
                    break;
                case "1":
                    $quest_score = $quest_obj->getRealMaxScore(round($_POST['new_assigned_score'] / $tot_quest, 2));
                    //$quest_score = round(( $_POST['new_assigned_score'] / $tot_quest ), 2);
                    break;
                case "2":
                    $quest_score = $quest_obj->getMaxScore();
                    break;
            }
        }
        $content = array($i++, $lang->def('_QUEST_ACRN_' . strtoupper($type_quest)), $title_quest);
        if (isset($score_assign)) {
            $content[] = $difficult ? $difficult : '&nbsp;';
            if ($difficult) {
                $content[] = $score_assign[$idQuest] != $_POST['new_score_quest'][$idQuest] ? $score_assign[$idQuest] . '&nbsp;<span class="font_red">*</span>' : $score_assign[$idQuest];
            } else {
                $content[] = '&nbsp;';
            }
        } else {
            $content[] = $difficult ? '<label for="new_difficult_quest_' . $idQuest . '">' . $lang->def('_QUEST_TM2_SETDIFFICULT') . '</label>' . Form::getInputDropdown('', 'new_difficult_quest_' . $idQuest, 'new_difficult_quest[' . $idQuest . ']', array(1 => 1, 2, 3, 4, 5), $difficult, '') : '&nbsp;';
            $content[] = $difficult ? '<label for="new_difficult_quest_' . $idQuest . '">' . $lang->def('_QUEST_TM2_SETSCORE') . '</label>' . '<input type="text" id="new_score_quest_' . $idQuest . '" name="new_score_quest[' . $idQuest . ']" value="' . $quest_score . '" size="5" maxlength="200" alt="' . $lang->def('_QUEST_TM2_SETSCORE') . '" />' : '&nbsp;';
        }
        if ($difficult != 0) {
            $effective_difficult += $difficult;
            if (isset($score_assign)) {
                $effective_tot_score = round($effective_tot_score + $score_assign[$idQuest], 2);
            } else {
                $effective_tot_score = round($effective_tot_score + $quest_score, 2);
            }
        }
        $tab_quest->addBody($content);
    }
    $tab_quest->addBodyCustom('<tr class="line-top-bordered">' . '<td colspan="3" class="align_right">' . $lang->def('TOTAL') . '</td>' . '<td class="align_center">' . $effective_difficult . '</td>' . '<td class="align_center">' . $effective_tot_score . '</td>' . '</tr>');
    $GLOBALS['page']->add($tab_quest->getTable(), 'content');
    //command for this page---------------------------------------------
    if (isset($_POST['new_assigned_score'])) {
        $previous_score = $_POST['new_assigned_score'];
    } else {
        $previous_score = $_POST['previous_score'];
    }
    $score_difference = round($effective_tot_score - $previous_score, 2);
    if ($score_difference < 0) {
        $score_difference = '<strong class="font_red">' . $score_difference . '<strong>';
    } else {
        $score_difference = '<strong>' . $score_difference . '<strong>';
    }
    $GLOBALS['page']->add('</fieldset>', 'content');
    if (!isset($score_assign)) {
        $GLOBALS['page']->add('<div class="set_time_row">' . Form::getHidden('previous_score', 'previous_score', $effective_tot_score) . str_replace('[score_difference]', $score_difference, $lang->def('_QUEST_TM2_SCORE_DIFFERENCE_FROM_PREVIOUS')) . Form::getButton('setpoint', 'setpoint', $lang->def('_PREVIEW'), 'button_nowh') . '</div>' . Form::openButtonSpace() . Form::getButton('saveandexit', 'saveandexit', $lang->def('_SAVE'), 'button') . Form::getButton('back_to_home', 'back_to_home', $lang->def('_UNDO'), 'button') . Form::closeButtonSpace() . '</form>', 'content');
    } else {
        $GLOBALS['page']->add('<div class="set_time_row">' . Form::getHidden('previous_score', 'previous_score', $effective_tot_score) . str_replace('[score_difference]', $score_difference, $lang->def('_QUEST_TM2_SCORE_DIFFERENCE_FROM_PREVIOUS')) . '</div>' . Form::openButtonSpace() . Form::getHidden('point_manual', 'point_assignement', 2) . Form::getButton('setpoint', 'setpoint', $lang->def('_TEST_BACK_TO_SETTIME'), 'button') . Form::getButton('back_to_home', 'back_to_home', $lang->def('_SAVE'), 'button') . Form::closeButtonSpace(), 'content');
    }
    $GLOBALS['page']->add('</div>', 'content');
}
Exemplo n.º 21
0
 function get_LO_filter()
 {
     //addCss('style_filterbox');
     $back_url = $this->back_url;
     $jump_url = $this->jump_url;
     $next_url = $this->next_url;
     require_once _base_ . '/lib/lib.form.php';
     require_once _lms_ . '/lib/lib.course.php';
     $ref =& $_SESSION['report_tempdata']['columns_filter'];
     YuiLib::load();
     Util::get_js(Get::rel_path('lms') . '/admin/modules/report/courses_filter.js', true, true);
     //back to columns category selection
     if (isset($_POST['undo_filter'])) {
         //go back at the previous step
         Util::jump_to($back_url);
     }
     //set $_POST data in $_SESSION['report_tempdata']
     $selector = new Selector_Course();
     if (isset($_POST['update_tempdata'])) {
         $selector->parseForState($_POST);
         $temp = array('all_courses' => $_POST['all_courses'] == 1 ? true : false, 'selected_courses' => $selector->getSelection(), 'lo_types' => isset($_POST['lo_types']) ? $_POST['lo_types'] : array(), 'lo_milestones' => isset($_POST['lo_milestones']) ? $_POST['lo_milestones'] : array(), 'showed_columns' => isset($_POST['cols']) ? $_POST['cols'] : array(), 'custom_fields' => array(), 'order_by' => Get::req('order_by', DOTY_STRING, 'userid'), 'order_dir' => Get::req('order_dir', DOTY_STRING, 'asc'), 'show_suspended' => Get::req('show_suspended', DOTY_INT, 0) > 0);
         foreach ($ref['custom_fields'] as $val) {
             $temp['custom_fields'][] = array('id' => $val['id'], 'label' => $val['label'], 'selected' => isset($_POST['custom'][$val['id']]) ? true : false);
         }
         $_SESSION['report_tempdata']['columns_filter'] = $temp;
     } else {
         //first loading of this page -> prepare $_SESSION data structure
         //if (isset($_SESSION['report_update']) /* && is equal to id_report */) break;
         //get users' custom fields
         require_once _adm_ . '/lib/lib.field.php';
         $fman = new FieldList();
         $fields = $fman->getFlatAllFields();
         $custom = array();
         foreach ($fields as $key => $val) {
             $custom[] = array('id' => $key, 'label' => $val, 'selected' => false);
         }
         if (!isset($_SESSION['report_tempdata']['columns_filter'])) {
             $_SESSION['report_tempdata']['columns_filter'] = array('all_courses' => false, 'selected_courses' => $selector->getSelection(), 'lo_types' => array(), 'lo_milestones' => array(), 'showed_columns' => array(), 'custom_fields' => $custom, 'order_by' => 'userid', 'order_dir' => 'asc', 'show_suspended' => 'show_suspended');
         }
     }
     //filter setting done, go to next step
     if (isset($_POST['import_filter']) || isset($_POST['show_filter']) || isset($_POST['pre_filter'])) {
         $temp_url = $next_url;
         if (isset($_POST['pre_filter'])) {
             $temp_url .= '&show=1&nosave=1';
         }
         if (isset($_POST['show_filter'])) {
             $temp_url .= '&show=1';
         }
         Util::jump_to($temp_url);
     }
     cout(Form::getHidden('update_tempdata', 'update_tempdata', 1), 'content');
     $lang = $this->lang;
     //box for direct course selection
     $selection =& $ref['selected_courses'];
     $selector->parseForState($_POST);
     $selector->resetSelection($selection);
     $temp = count($selection);
     $box = new ReportBox('course_selector');
     $box->title = Lang::t('_REPORT_COURSE_SELECTION', 'report');
     $box->description = false;
     $box->body .= '<div class="fc_filter_line filter_corr">';
     $box->body .= '<input id="all_courses" name="all_courses" type="radio" value="1" ' . ($ref['all_courses'] ? 'checked="checked"' : '') . ' />';
     $box->body .= ' <label for="all_courses">' . $lang->def('_ALL_COURSES') . '</label>';
     $box->body .= ' <input id="sel_courses" name="all_courses" type="radio" value="0" ' . ($ref['all_courses'] ? '' : 'checked="checked"') . ' />';
     $box->body .= ' <label for="sel_courses">' . $lang->def('_SEL_COURSES') . '</label>';
     $box->body .= '</div>';
     $box->body .= '<div id="selector_container"' . ($ref['all_courses'] ? ' style="display:none"' : '') . '>';
     //$box->body .= Form::openElementSpace();
     $box->body .= $selector->loadCourseSelector(true);
     //$box->body .= Form::closeElementSpace();
     $box->body .= '<br /></div>';
     $box->footer = $lang->def('_CURRENT_SELECTION') . ':&nbsp;<span id="csel_foot">' . ($ref['all_courses'] ? Lang::t('_ALL', 'standard') : ($temp != '' ? $temp : '0')) . '</span>';
     //.'</div>';
     cout($box->get(), 'content');
     cout('<script type="text/javascript">courses_count=' . ($temp == '' ? '0' : $temp) . ';' . 'courses_all="' . Lang::t('_ALL', 'standard') . '";' . "\n" . 'YAHOO.util.Event.addListener(window, "load", courses_selector_init);</script>', 'page_head');
     $box = new ReportBox('lo_selection');
     $box->title = $lang->def('_SELECT_LO_OPTIONS');
     //LO columns selection
     $lo_trans = $this->getLOTypesTranslations();
     $box->body .= Form::getOpenFieldset(Lang::t('_RU_LO_TYPES', 'report'), 'lotypes_fieldset');
     $res = sql_query("SELECT * FROM %lms_lo_types");
     while ($row = mysql_fetch_assoc($res)) {
         $trans = isset($lo_trans[$row['objectType']]) ? $lo_trans[$row['objectType']] : "";
         $box->body .= Form::getCheckBox($trans, 'lo_type_' . $row['objectType'], 'lo_types[' . $row['objectType'] . ']', $row['objectType'], in_array($row['objectType'], $ref['lo_types']) ? true : false);
     }
     $box->body .= Form::getCloseFieldset();
     $box->body .= Form::getOpenFieldset($lang->def('_RU_LO_MILESTONES'), 'lomilestones_fieldset');
     $box->body .= Form::getCheckBox($lang->def('_NONE'), 'lo_milestone_0', 'lo_milestones[]', _MILESTONE_NONE, in_array(_MILESTONE_NONE, $ref['lo_milestones']) ? true : false);
     $box->body .= Form::getCheckBox($lang->def('_START'), 'lo_milestone_1', 'lo_milestones[]', _MILESTONE_START, in_array(_MILESTONE_START, $ref['lo_milestones']) ? true : false);
     $box->body .= Form::getCheckBox($lang->def('_END'), 'lo_milestone_2', 'lo_milestones[]', _MILESTONE_END, in_array(_MILESTONE_END, $ref['lo_milestones']) ? true : false);
     $box->body .= Form::getCloseFieldset();
     cout($box->get(), 'content');
     function is_showed($which)
     {
         if (isset($_SESSION['report_tempdata']['columns_filter'])) {
             return in_array($which, $_SESSION['report_tempdata']['columns_filter']['showed_columns']);
         } else {
             return false;
         }
     }
     //box for columns selection
     $arr_fieldset = array('user' => '', 'course' => '', 'lo' => '');
     $box = new ReportBox('columns_selection');
     $box->title = $lang->def('_SELECT_THE_DATA_COL_NEEDED');
     $box->description = false;
     //prepare fieldsets
     foreach ($this->LO_columns as $val) {
         if ($val['select']) {
             $line = Form::getCheckBox($val['label'], 'col_sel_' . $val['key'], 'cols[]', $val['key'], is_showed($val['key']));
             switch ($val['group']) {
                 case 'user':
                     $arr_fieldset['user'] .= $line;
                     break;
                 case 'course':
                     $arr_fieldset['course'] .= $line;
                     break;
                 case 'lo':
                     $arr_fieldset['lo'] .= $line;
                     break;
             }
         } else {
             if ($val['key'] == '_CUSTOM_FIELDS_') {
                 //custom fields
                 if (count($ref['custom_fields']) > 0) {
                     foreach ($ref['custom_fields'] as $key => $val) {
                         $arr_fieldset['user'] .= Form::getCheckBox($val['label'], 'col_custom_' . $val['id'], 'custom[' . $val['id'] . ']', $val['id'], $val['selected']);
                     }
                 }
             }
         }
     }
     //print fieldsets
     foreach ($arr_fieldset as $fid => $fieldset) {
         $ftitle = '';
         switch ($fid) {
             case 'user':
                 $ftitle = Lang::t('_USER_CUSTOM_FIELDS', 'report');
                 break;
             case 'course':
                 $ftitle = Lang::t('_COURSE_FIELDS', 'report');
                 break;
             case 'lo':
                 $ftitle = Lang::t('_LEARNING_OBJECTS', 'standard');
                 break;
         }
         $box->body .= Form::getOpenFieldset($ftitle, 'fieldset_' . $fid . '_fields');
         $box->body .= $fieldset;
         $box->body .= Form::getCloseFieldset();
     }
     cout($box->get(), 'content');
     //other options
     $box = new ReportBox('other_options');
     $box->title = Lang::t('_OTHER_OPTION', 'course');
     $box->description = false;
     $sort_list = array('userid' => Lang::t('_USERID', 'standard'), 'firstname' => Lang::t('_FIRSTNAME', 'standard'), 'lastname' => Lang::t('_LASTNAME', 'standard'), 'email' => Lang::t('_EMAIL', 'standard'), 'course_code' => Lang::t('_COURSE_CODE', 'standard'), 'course_name' => Lang::t('_COURSE_NAME', 'standard'), 'object_title' => Lang::t('_LEARNING_OBJECTS', 'standard'), 'object_type' => Lang::t('_RU_LO_TYPES', 'report'), 'first_attempt' => Lang::t('_LO_COL_FIRSTATT', 'report'), 'last_attempt' => Lang::t('_LO_COL_LASTATT', 'report'));
     $dir_list = array('asc' => Lang::t('_ORD_ASC_TITLE', 'standard'), 'desc' => Lang::t('_ORD_DESC_TITLE', 'standard'));
     $sort_selected = array_key_exists($ref['order_by'], $sort_list) ? $ref['order_by'] : 'userid';
     $dir_selected = array_key_exists($ref['order_dir'], $dir_list) ? $ref['order_dir'] : 'asc';
     $sort_dir_dropdown = Form::getInputDropdown('', 'order_dir', 'order_dir', $dir_list, $dir_selected, '');
     $box->body .= Form::getDropdown(Lang::t('_ORDER_BY', 'standard'), 'order_by', 'order_by', $sort_list, $sort_selected, $sort_dir_dropdown);
     $box->body .= Form::getCheckbox(Lang::t('_SHOW_SUSPENDED', 'organization_chart'), 'show_suspended', 'show_suspended', 1, (bool) $ref['show_suspended']);
     cout($box->get(), 'content');
 }
 function getModUi($room_info)
 {
     require_once _base_ . '/lib/lib.form.php';
     addJs($GLOBALS['where_lms_relative'] . '/modules/conference/', 'ajax_conference.js');
     $lang =& DoceboLanguage::createInstance('conference', 'lms');
     cout(Form::openForm('create_conference', 'index.php?modname=conference&amp;op=modconf&id=' . $room_info['id']) . Form::openElementSpace() . Form::getTextfield($lang->def('_VIDEOCONFERENCE'), 'conference_name', 'conference_name', 255, $room_info['name']) . Form::getDatefield($lang->def('_START_DATE'), 'start_date', 'start_date', Format::date(date('Y-m-d', $room_info['starttime']), 'date')) . Form::getLineBox($lang->def('_AT_HOUR'), Form::getInputDropdown('', 'start_time_hour', 'start_time[hour]', range(0, 23), importVar('start_time_hour', false, date("H", $room_info['starttime'])), '') . ' : ' . Form::getInputDropdown('', 'start_time_minute', 'start_time[minute]', range(0, 59), importVar('start_time_hour', false, date("i", $room_info['starttime'])), '')) . Form::getLineBox($lang->def('_MEETING_HOURS'), Form::getInputDropdown('', 'meetinghours', 'meetinghours', range(0, 5), $room_info['meetinghours'], '')) . Form::getTextfield($lang->def('_MAX_PARTICIPANTS'), 'maxparticipants', 'maxparticipants', 6, $room_info['maxparticipants']) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('update_conf', 'update_conf', $lang->def('_UPDATE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm());
 }
Exemplo n.º 23
0
 function modUserPolicyGui()
 {
     require_once _base_ . '/lib/lib.form.php';
     $this->loadUserData($this->_id_user);
     $policy_arr = array(PFL_POLICY_FREE => $this->_lang->def('_ALL'), PFL_POLICY_TEACHER => $this->_lang->def('_PFL_POLICY_TEACHER'), PFL_POLICY_NOONE => $this->_lang->def('_PFL_POLICY_NOONE'));
     $reduced_policy_arr = array(PFL_POLICY_FREE => $this->_lang->def('_ALL'));
     $field_policy = $this->_up_data_man->getFieldAccessList($this->_id_user);
     $user_field = $this->loadUserField($this->_id_user);
     $user_contacts = $this->loadUserContact($this->_id_user);
     $html = '<div class="up_user_info">';
     // user standard info -----------------------------------------------------------------
     $html .= Form::openForm('mod_policy', $this->_url_man->getUrl($this->_varname_action . '=save_policy'));
     $html .= '<table class="mod_policy_table" summary="' . $this->_lang->def('_USERPROFILE_SUMMARY') . '">' . '<caption class="up_name">' . $this->resolveUsername(false, $this->_id_user) . '</caption>';
     $html .= '<thead><tr>' . '<th scope="col">' . $this->_lang->def('_FIELD_NAME') . '</th>' . '<th scope="col">' . $this->_lang->def('_FIELD_VALUE') . '</th>' . '<th scope="col">' . $this->_lang->def('_POLICY_ASSIGNED') . '</th>' . '</tr></thead>';
     $html .= '<tbody>';
     // user extra field ------------------------------------------------------------------
     if (!empty($user_field)) {
         while (list($id, $value) = each($user_field)) {
             $html .= $this->getUIPolicyCode($value['name'], $value['value'], Form::getInputDropdown('dropdown_wh', 'policy_selected_' . $id, 'policy_selected[' . $id . ']', $policy_arr, isset($field_policy[$id]) ? $field_policy[$id] : PFL_POLICY_NOONE, ''));
         }
     }
     $html .= '<tr><th scope="col" colspan="3" id="up_type2">' . $this->_lang->def('_CONTACTS') . '</th></tr>';
     // end extra field -------------------------------------------------------------------
     $html .= $this->getUIPolicyCode($this->_lang->def('_EMAIL'), $this->user_info[ACL_INFO_EMAIL], Form::getInputDropdown('dropdown_wh', 'policy_selected_email', 'policy_selected[email]', $policy_arr, isset($field_policy['email']) ? $field_policy['email'] : PFL_POLICY_NOONE, ''));
     if (!empty($user_contacts)) {
         while (list($id, $value) = each($user_contacts)) {
             $html .= $this->getUIPolicyCode($value['name'], $value['value'], Form::getInputDropdown('dropdown_wh', 'policy_selected_' . $id, 'policy_selected[' . $id . ']', $policy_arr, isset($field_policy[$id]) ? $field_policy[$id] : PFL_POLICY_NOONE, ''));
         }
     }
     // end print contacts ----------------------------------------------------------------
     $html .= '<tr><th scope="col" colspan="3" id="up_type2">' . $this->_lang->def('_OTHER_POLICY') . '</th></tr>';
     $html .= $this->getUIPolicyCode($this->_lang->def('_PRIVATE_MESSAGE_FROM'), false, Form::getInputDropdown('dropdown_wh', 'policy_selected_message_recipients', 'policy_selected[message_recipients]', $reduced_policy_arr, isset($field_policy['message_recipients']) ? $field_policy['message_recipients'] : PFL_POLICY_FREE, ''));
     $html .= $this->getUIPolicyCode($this->_lang->def('_SHOWME_ONLINE'), false, Form::getInputDropdown('dropdown_wh', 'policy_selected_online_satus', 'policy_selected[online_satus]', $reduced_policy_arr, isset($field_policy['online_satus']) ? $field_policy['online_satus'] : PFL_POLICY_FREE, ''));
     $html .= '</tbody></table>';
     $html .= Form::openButtonSpace() . Form::getButton('save', 'save', $this->_lang->def('_SAVE')) . Form::getButton('undo', 'undo', $this->_lang->def('_UNDO')) . Form::closeButtonSpace();
     $html .= Form::closeForm() . '</div>';
     return $html;
 }
Exemplo n.º 24
0
 function printOut()
 {
     //		addScriptaculousJs();
     addJs($GLOBALS['where_lms_relative'] . '/modules/public_user_admin/', 'ajax.public_user_admin.js');
     require_once _base_ . '/lib/lib.user_profile.php';
     $profile = new UserProfile(getLogUserId());
     $profile->init('profile', 'framework', 'modname=public_user_admin&op=org_chart', 'ap');
     $profile->addStyleSheet('lms');
     $GLOBALS['page']->add('<script type="text/javascript">' . ' setup_directory(\'' . $GLOBALS['where_lms_relative'] . '/modules/directory/ajax.public_user_admin.php\'); ' . '</script>', 'page_head');
     $out = '';
     if ($this->select_all) {
         // This is not a beautiful position for this operation but at this point
         // I'm sure that all filter was applied
         $rs_all = $this->data->getAllRowsIdst();
         if ($rs_all !== FALSE) {
             $this->itemSelectedMulti = array();
             while (list($all_idst) = sql_fetch_row($rs_all)) {
                 $this->itemSelectedMulti[] = $all_idst;
             }
         }
         $this->itemSelected = $this->itemSelectedMulti;
     }
     require_once _base_ . '/lib/lib.form.php';
     $ord = importVar('ord', false, 'trans');
     $flip = importVar('flip', true, 0);
     $filter = new Form();
     $out .= $filter->getOpenFieldset($this->lang->def('_SEARCH'));
     $out .= $filter->getHidden('ord', 'ord', $ord);
     $out .= $filter->getHidden('flip', 'flip', $flip);
     if ($this->lms_editions_filter === true) {
         if (isset($GLOBALS['course_descriptor']) && $GLOBALS['course_descriptor']->hasEdition()) {
             // add editions filter ============================================================
             $ed_list = array();
             if ($this->editions == false) {
                 $this->editions = $GLOBALS['course_descriptor']->getEditionsSimpleList(getLogUserId(), true);
             }
             $sel = isset($_POST[$this->id]['edition_filter']) ? (int) $_POST[$this->id]['edition_filter'] : $GLOBALS['course_descriptor']->getActualEditionsForUser(getLogUserId());
             if (!empty($this->editions)) {
                 $out .= $filter->getDropdown($this->lang->def('_FILTER_BY_EDITION'), $this->id . '_edition_filter', $this->id . '[edition_filter]', $this->editions, $sel);
             }
         }
     }
     // end lms editions filter
     if ($this->show_simple_filter === TRUE) {
         // show simple filter ============================================================
         $out .= $filter->getTextfield($this->lang->def('_SIMPLE_FILTER'), $this->id . '_simple_fulltext_search', $this->id . '[simple_fulltext_search]', 255, isset($_POST[$this->id]['simple_fulltext_search']) ? strip_tags(html_entity_decode($_POST[$this->id]['simple_fulltext_search'])) : '', strip_tags($this->lang->def('_SIMPLE_FILTER')));
         $out .= '<div class="align_right">' . $filter->getButton($this->id . '_search', $this->id . '[search]', $this->lang->def('_SEARCH'), 'button_nowh') . '</div>';
     } else {
         // show complex filter ===========================================================
         $out .= '<h2 id="customize_filter">' . $this->lang->def('_CUSTOMIZE_FILTERS') . '</h2>';
         // --- print check box for flat mode
         if ($this->show_flat_mode_flag) {
             $out .= $filter->getCheckbox($this->lang->def('_DIRECTORY_FILTER_FLATMODE'), $this->id . '_flat_mode', $this->id . '[flat_mode]', 'flat_mode', $this->flat_mode, "onclick=\"window.document.forms['directory_org_chart'].submit();\"");
         } else {
             $out .= $filter->getHidden($this->id . '_flat_mode', $this->id . '[flat_mode]', $this->flat_mode ? 'flat_mode' : '');
         }
         // line for add a field filter
         $out .= $filter->openFormLine();
         foreach ($this->add_nat_fields as $nat_id => $nat_info) {
             $local_arr_fields_translation[$nat_id] = $this->lang->def('_DIRECTORY_FILTER_' . $nat_id);
         }
         $filter_to_show = $this->arr_fields_translation;
         if (is_array($this->arr_fields_filter)) {
             foreach ($this->arr_fields_filter as $filter_info) {
                 if (isset($filter_info['fieldname'])) {
                     unset($filter_to_show[$filter_info['fieldname']]);
                 } else {
                     unset($filter_to_show[$filter_info[0]]);
                 }
             }
         }
         if (is_array($filter_to_show) && !empty($filter_to_show)) {
             $out .= $filter->getInputDropdown('new_filter', $this->id . '_add_field_filter', $this->id . '[add_field_filter]', $filter_to_show, '', '');
             $out .= $filter->getButton($this->id . '_add_filter', $this->id . '[add_filter]', $this->lang->def('_NEW_FILTER'), 'button_nowh');
         }
         $out .= $filter->getButton($this->id . '_del_filter', $this->id . '[del_filter]', $this->lang->def('_RESET'), 'button_nowh');
         $out .= $filter->closeFormLine();
         if (is_array($this->arr_fields_filter)) {
             foreach ($this->arr_fields_filter as $field_id => $field_prop) {
                 if (!isset($field_prop['fieldname'])) {
                     // custom field
                     $arr_field_info = $this->field_list->getBaseFieldInfo($field_prop[FIELD_INFO_TYPE]);
                     require_once $GLOBALS['where_framework'] . '/modules/field/' . $arr_field_info[FIELD_BASEINFO_FILE];
                     $field_obj = new $arr_field_info[FIELD_BASEINFO_CLASS]($field_id);
                     $del_spot = '<input type="image" class="cancel_filter" ' . ' src="' . getPathImage('framework') . 'standard/cancel.png"' . ' id="' . $this->id . '_del_filter_' . $field_id . '"' . ' name="' . $this->id . '[del_filter][' . $field_id . ']"' . ' title="' . $this->lang->def('_DEL') . '"' . ' alt="' . $this->lang->def('_DEL') . '" />';
                     $out .= $field_obj->play_filter($field_id, isset($field_prop['value']) ? $field_prop['value'] : false, $field_prop[FIELD_INFO_TRANSLATION], $this->id, $del_spot, '', $field_prop[FIELD_INFO_ID]);
                     //play_filter( $id_field, $value = FALSE, $label = FALSE, $field_prefix = FALSE, $other_after = '', $other_before = '', $field_special = FALSE )
                 } else {
                     // base field
                     $arr_field_info = $this->field_list->getBaseFieldInfo($field_prop['field_type']);
                     require_once $GLOBALS['where_framework'] . '/modules/field/' . $arr_field_info[FIELD_BASEINFO_FILE];
                     $field_obj = new $arr_field_info[FIELD_BASEINFO_CLASS](0);
                     $del_spot = '<input type="image" class="cancel_filter" ' . ' src="' . getPathImage('framework') . 'standard/cancel.png"' . ' id="' . $this->id . '_del_filter_' . $field_id . '"' . ' name="' . $this->id . '[del_filter][' . $field_id . ']"' . ' title="' . $this->lang->def('_DEL') . '"' . ' alt="' . $this->lang->def('_DEL') . '" />';
                     $out .= $field_obj->play_filter($field_id, isset($field_prop['value']) ? $field_prop['value'] : false, $this->lang->def('_DIRECTORY_FILTER_' . $field_prop['fieldname']), $this->id, $del_spot, '', '');
                 }
             }
         }
         $out .= $filter->openButtonSpace();
         $out .= $filter->getButton('search', 'search', $this->lang->def('_SEARCH'));
         $out .= $filter->closeButtonSpace();
     }
     // end else for filter
     $out .= $filter->getCloseFieldset();
     // ---------------------------------------------------------------------------------------
     // set order rows
     if (is_array($this->arr_fields_order)) {
         foreach ($this->arr_fields_order as $ordFieldName => $isDesc) {
             $this->data->setOrderCol($ordFieldName, $isDesc);
         }
     }
     $this->getRows($this->_getStartRow(), $this->_getRowsPage());
     $totRow = $this->getTotalRows();
     if ($totRow == -1) {
         $totRow = $this->getLoadedRows();
     }
     $colInfo = $this->_getCols();
     $colData = $colInfo;
     $this->rend->setCaption($this->_getTitle());
     $type_h = array();
     $cont_h = array();
     while (list($key, $contentCell) = each($colInfo)) {
         if ($contentCell['toDisplay']) {
             $type_h[] = $contentCell['hClass'];
             $cont_h[] = $contentCell['hLabel'];
         }
     }
     reset($colInfo);
     $this->rend->addHead($cont_h, $type_h);
     while ($values = $this->fetchRecord()) {
         $colData = array();
         foreach ($colInfo as $key => $fieldInfo) {
             $colData[] = $values[$colInfo[$key]['data']];
         }
         $this->rend->addBody($colData, false, false, 'user_row_' . $values['idst']);
         if ($this->_expand_user == $values['idst']) {
             // extra user info if requested
             $this->rend->addBodyExpanded($this->userExtraData($this->_expand_user), 'user_more_info');
         }
     }
     if ($this->insNew) {
         $this->rend->addActionAdd('<input type="submit" class="transparent_add_button"' . ' id="' . $this->id . '_' . $this->_getOpCreateItemId() . '" ' . ' name="' . $this->id . '[' . $this->_getOpCreateItemId() . '][0]" ' . ' value="' . $this->lang->def('_ADD') . '"' . ' title="' . $this->_getCreateLabel() . '" ' . ' alt="' . $this->_getCreateAlt() . '" />');
     }
     $this->rend->initNavBar($this->_getIdInitRowId(), 'button');
     $out .= $this->rend->getTable() . $this->rend->getNavBar($this->_getStartRow(), $totRow) . $this->printState();
     // ---------------------------------------------------------------------------------------
     if ($this->select_all) {
         $arr_notPrint = array_diff($this->itemSelectedMulti, $this->printedItems);
         foreach ($arr_notPrint as $id_notPrint) {
             $out .= '<input type="checkbox" ' . ' id="' . DIRECTORY_ID . DIRECTORY_OP_SELECTITEM . '_' . $id_notPrint . '" ' . 'name="' . DIRECTORY_ID . '[' . DIRECTORY_OP_SELECTITEM . '][' . $id_notPrint . ']" ' . 'value="" checked="checked" style="display:none;" />';
         }
     }
     return $out;
 }
Exemplo n.º 25
0
						<?php 
$this->widget('dialog', array('id' => 'certificate_dialog', 'width' => "700px", 'dynamicContent' => true, 'ajaxUrl' => 'this.href', 'dynamicAjaxUrl' => true, 'fixedCenter' => false, 'constrainToViewport' => true, 'callback' => 'Dashboard.certificateCallback', 'renderEvent' => 'Dashboard.certificateRenderEvent', 'callEvents' => array(array('caller' => 'find_certificate', 'event' => 'click'))));
?>
					</div>
					<?php 
if (count($reports) > 0) {
    ?>
					<div class="block_spacer">
						<h3><?php 
    echo Lang::t('_REPORT', 'report');
    ?>
</h3>
						<?php 
    echo Form::openForm('show_report_created_form', 'index.php?modname=report&amp;op=show_results&amp;of_platform=lms');
    echo '<p><label for="report_created_sel">' . Lang::t('_SELECT', 'report') . '</label></p>';
    echo Form::getInputDropdown('dropdown', 'report_created_sel', 'idrep', $reports, false, '') . '<br />';
    echo Form::getButton('show_report_created', 'show_report_created', Lang::t('_VIEW', 'standard'), true, '', false);
    echo Form::getButton('export_report_created', 'export_report_created', Lang::t('_EXPORT', 'standard'), true, '', false);
    echo Form::closeform();
    $this->widget('dialog', array('id' => 'export_report_dialog', 'dynamicContent' => true, 'ajaxUrl' => 'function() { return "ajax.adm_server.php?r=adm/dashboard/exportformat&id_report="+YAHOO.util.Dom.get("report_created_sel").value; }', 'dynamicAjaxUrl' => true, 'fixedCenter' => false, 'directSubmit' => true, 'hideAfterSubmit' => true, 'callback' => 'Dashboard.exportCallback', 'callEvents' => array(array('caller' => 'export_report_created', 'event' => 'click'))));
    ?>
					</div>
					<?php 
}
?>
				</div>
				<div class="yui-u">
					<?php 
$_can_view_block = (bool) ($permissions['view_course'] && ($permissions['add_course'] || $permissions['subscribe']));
if ($_can_view_block) {
    ?>
Exemplo n.º 26
0
function schedule_set($idrep)
{
    checkPerm('mod');
    $lang =& DoceboLanguage::createInstance('report', 'framework');
    //initialize session data for schedulation, if not updating
    if (!isset($_SESSION['schedule_tempdata'])) {
        $_SESSION['schedule_tempdata'] = array('name' => '', 'period' => 'day', 'period_info' => '', 'time' => '', 'recipients' => array());
    }
    $ref =& $_SESSION['schedule_tempdata'];
    require_once _base_ . '/lib/lib.form.php';
    $jump_url = 'index.php?modname=report&op=report_schedule&idrep=' . $idrep;
    $back_url = 'index.php?modname=report&op=schedulelist&idrep=' . $idrep;
    $body = Form::openForm('report_schedule_time', $jump_url);
    $body .= Form::getTextfield($lang->def('_SAVE_SCHED_NAME'), 'sched_name', 'sched_name', '200', $ref['name']) . Form::getHidden('next_step', 'next_step', 'sched_setrecipients');
    //create selections for crontab specification
    $month_days = array();
    for ($i = 1; $i <= 31; $i++) {
        $month_days[$i] = $i;
        //TO DO : format with 2 digits filling with 0
    }
    $year_months = array();
    for ($i = 1; $i <= 12; $i++) {
        $year_months[$i] = $i;
        //TO DO : format with 2 digits filling with 0
    }
    $lang_days =& DoceboLanguage::createInstance('calendar', 'lms');
    $week_days = array('0' => $lang_days->def('_MONDAY'), '1' => $lang_days->def('_TUESDAY'), '2' => $lang_days->def('_WEDNESDAY'), '3' => $lang_days->def('_THURSDAY'), '4' => $lang_days->def('_FRIDAY'), '5' => $lang_days->def('_SATURDAY'), '6' => $lang_days->def('_SUNDAY'));
    $body .= Form::getRadio($lang->def('_REPORT_DAILY'), 'cron_radio_1', 'cron_radio', 'day', $ref['period'] == 'day' ? true : false) . '<div class="form_line_l">' . Form::getInputRadio('cron_radio_2', 'cron_radio', 'week', $ref['period'] == 'week' ? true : false, '') . ' <label class="label_normal" for="cron_radio_2">' . $lang->def('_REPORT_WEEKLY') . '</label> ' . Form::getInputDropdown('', 'cron_weekly', 'cron_weekly', $week_days, $ref['period'] == 'week' ? $ref['period_info'] : '', '') . '</div>' . '<div class="form_line_l">' . Form::getInputRadio('cron_radio_3', 'cron_radio', 'month', $ref['period'] == 'month' ? true : false, '') . ' <label class="label_normal" for="cron_radio_3">' . $lang->def('_REPORT_MONTHLY') . '</label> ' . Form::getInputDropdown('', 'cron_monthly', 'cron_monthly', $month_days, $ref['period'] == 'month' ? $ref['period_info'] : '', '') . '</div>' . Form::getHidden('idrep', 'idrep', $idrep);
    $body .= Form::openButtonSpace() . Form::getButton('', 'schedule_confirm', $lang->def('_NEXT')) . Form::getButton('', 'schedule_undo', $lang->def('_UNDO')) . form::closeButtonSpace();
    $body .= Form::closeForm();
    //output content
    cout(getTitleArea($lang->def('_SCHEDULE')));
    cout('<div class="std_block">');
    cout($body);
    cout('</div>');
    //close std_block div
}
Exemplo n.º 27
0
<div style="margin:1em;">
	<?php 
$w = $this->widget('lms_tab', array('active' => 'elearning', 'close' => false));
// draw search
$_model = new ElearningLms();
$_auxiliary = Form::getInputDropdown('', 'course_search_filter_year', 'filter_year', $_model->getFilterYears(Docebo::user()->getIdst()), 0, '');
$this->widget('tablefilter', array('id' => 'course_search', 'filter_text' => "", 'auxiliary_filter' => Lang::t('_SEARCH', 'standard') . ":&nbsp;&nbsp;&nbsp;" . $_auxiliary, 'js_callback_set' => 'course_search_callback_set', 'js_callback_reset' => 'course_search_callback_reset', 'css_class' => 'tabs_filter'));
$w->endWidget();
?>
</div>

<?php 
$prop = array('id' => 'self_unsubscribe_dialog', 'dynamicContent' => true, 'ajaxUrl' => 'this.href', 'dynamicAjaxUrl' => true, 'callEvents' => array());
$this->widget('dialog', $prop);
?>

<script type="text/javascript">
	var tabView = new YAHOO.widget.TabView();

	function unsubscribeClick() {
		var nodes = YAHOO.util.Selector.query('a[id^=self_unsubscribe_link_]');
		YAHOO.util.Event.on(nodes, 'click', function (e) {
			YAHOO.util.Event.preventDefault(e);
			CreateDialog("self_unsubscribe_dialog", {
				width: "700px",
				modal: true,
				close: true,
				visible: false,
				fixedcenter: false,
				constraintoviewport: false,
				draggable: true,
Exemplo n.º 28
0
function modCourseEdition()
{
    checkPerm('mod');
    require_once $GLOBALS['where_lms'] . '/lib/lib.course.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.tab.php';
    require_once $GLOBALS['where_lms'] . '/lib/lib.manmenu.php';
    $lang =& DoceboLanguage::createInstance('course', 'lms');
    $form = new Form();
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    $course_status = array(CST_PREPARATION => $lang->def('_CST_PREPARATION'), CST_AVAILABLE => $lang->def('_CST_AVAILABLE'), CST_EFFECTIVE => $lang->def('_CST_CONFIRMED'), CST_CONCLUDED => $lang->def('_CST_CONCLUDED'), CST_CANCELLED => $lang->def('_CST_CANCELLED'));
    //type of edition
    $edition_type = array('elearning' => $lang->def('_COURSE_TYPE_ELEARNING'), 'blended' => $lang->def('_COURSE_TYPE_BLENDED'), 'classroom' => $lang->def('_CLASSROOM'));
    list($id_course_edition) = each($_POST['mod_course_edition']);
    $query_course_edition = "\r\n\tSELECT *\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_course_edition\r\n\tWHERE idCourseEdition = '" . $id_course_edition . "'";
    $course_edition = mysql_fetch_assoc(sql_query($query_course_edition));
    // set page title
    $title_area = array('index.php?modname=course&amp;op=course_list' => $lang->def('_COURSE'), $lang->def('_MOD') . ' : ' . $course_edition['name']);
    $date_begin = Format::date($course_edition['date_begin'], 'date');
    $date_end = Format::date($course_edition['date_end'], 'date');
    $out->add(getTitleArea($title_area, 'configuration') . '<div class="std_block">' . $form->openForm('upd_course', 'index.php?modname=course&amp;op=upd_course', false, false, 'multipart/form-data') . $form->getHidden('mod_course_edition' . $id_course_edition, 'mod_course_edition[' . $id_course_edition . ']', $id_course_edition) . $form->getHidden("course_id", "course_id", $course_edition["idCourse"]) . $form->getHidden("old_date_begin", "old_date_begin", $course_edition['date_begin']) . $form->getHidden("old_date_end", "old_date_end", $course_edition['date_end']));
    $out->add($form->openElementSpace() . $form->getTextfield($lang->def('_CODE'), 'course_edition_code', 'course_edition_code', '50', $course_edition['code']) . $form->getTextfield($lang->def('_COURSE_NAME'), 'course_edition_name', 'course_edition_name', '255', $course_edition['name']) . $form->getDropdown($lang->def('_STATUS'), 'course_edition_status', 'course_edition_status', $course_status, $course_edition['status']) . $form->getDropdown($lang->def('_COURSE_TYPE'), 'edition_type', 'edition_type', $edition_type, $course_edition['edition_type']) . $form->getTextarea($lang->def('_DESCRIPTION'), 'course_edition_descr', 'course_edition_descr', $course_edition['description']));
    $out->add($form->getOpenFieldset($lang->def('_COURSE_SUBSCRIPTION')) . $form->getOpenCombo($lang->def('_USER_CAN_SUBSCRIBE')) . $form->getRadio($lang->def('_SUBSCRIPTION_CLOSED'), 'subscription_closed', 'can_subscribe', '0', $course_edition['can_subscribe'] == 0) . $form->getRadio($lang->def('_SUBSCRIPTION_OPEN'), 'subscription_open', 'can_subscribe', '1', $course_edition['can_subscribe'] == 1) . $form->getRadio($lang->def('_SUBSCRIPTION_IN_PERIOD') . ":", 'subscription_period', 'can_subscribe', '2', $course_edition['can_subscribe'] == 2) . $form->getCloseCombo() . $form->getDatefield($lang->def('_SUBSCRIPTION_DATE_BEGIN') . ":", 'sub_start_date', 'sub_start_date', Format::date($course_edition['sub_start_date'], "date")) . $form->getDatefield($lang->def('_SUBSCRIPTION_DATE_END') . ":", 'sub_end_date', 'sub_end_date', Format::date($course_edition['sub_end_date'], "date")) . $form->getCloseFieldset());
    $out->add($form->getOpenFieldset($lang->def('_COURSE_SPECIAL_OPTION')) . $form->getTextfield($lang->def('_COURSE_PRIZE'), 'edition_price', 'edition_price', 11, $course_edition["price"]) . $form->getTextfield($lang->def('_COURSE_ADVANCE'), 'edition_advance', 'edition_advance', 11, $course_edition['advance']) . $form->getTextfield($lang->def('_MIN_NUM_SUBSCRIBE'), 'min_num_subscribe', 'min_num_subscribe', 11, $course_edition["min_num_subscribe"]) . $form->getTextfield($lang->def('_MAX_NUM_SUBSCRIBE'), 'max_num_subscribe', 'max_num_subscribe', 11, $course_edition["max_num_subscribe"]) . $form->getCheckbox($lang->def('_ALLOW_OVERBOOKING'), 'allow_overbooking', 'allow_overbooking', 1, $course_edition["allow_overbooking"]) . $form->getCloseFieldset());
    $hours = array('-1' => '- -', '0' => '00', '01', '02', '03', '04', '05', '06', '07', '08', '09', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20', '21', '22', '23');
    $quarter = array('-1' => '- -', '00' => '00', '15' => '15', '30' => '30', '45' => '45');
    if ($course_edition['hour_begin'] != '-1') {
        $hb_sel = (int) substr($course_edition['hour_begin'], 0, 2);
        $qb_sel = substr($course_edition['hour_begin'], 3, 2);
    } else {
        $hb_sel = $qb_sel = '-1';
    }
    if ($course_edition['hour_end'] != '-1') {
        $he_sel = (int) substr($course_edition['hour_end'], 0, 2);
        $qe_sel = substr($course_edition['hour_end'], 3, 2);
    } else {
        $he_sel = $qe_sel = '-1';
    }
    $out->add($form->getOpenFieldset($lang->def('_COURSE_TIME_OPTION')) . $form->getDatefield($lang->def('_DATE_BEGIN'), 'course_edition_date_begin', 'course_edition_date_begin', $date_begin) . $form->getDatefield($lang->def('_DATE_END'), 'course_edition_date_end', 'course_edition_date_end', $date_end) . $form->getLineBox('<label for="hour_begin_hour">' . $lang->def('_HOUR_BEGIN') . '</label>', $form->getInputDropdown('dropdown_nw', 'hour_begin_hour', 'hour_begin[hour]', $hours, $hb_sel, '') . ' : ' . $form->getInputDropdown('dropdown_nw', 'hour_begin_quarter', 'hour_begin[quarter]', $quarter, $qb_sel, '')) . $form->getLineBox('<label for="hour_end_hour">' . $lang->def('_HOUR_END') . '</label>', $form->getInputDropdown('dropdown_nw', 'hour_end_hour', 'hour_end[hour]', $hours, $he_sel, '') . ' : ' . $form->getInputDropdown('dropdown_nw', 'hour_end_quarter', 'hour_end[quarter]', $quarter, $qe_sel, '')) . $form->getCloseFieldset());
    $out->add($form->getOpenFieldset($lang->def('_DOCUMENT_UPLOAD')) . $form->getExtendedFilefield($lang->def('_USER_MATERIAL'), 'course_edition_material', 'course_edition_material', $course_edition["img_material"]) . $form->getExtendedFilefield($lang->def('_OTHER_USER_MATERIAL'), 'course_edition_othermaterial', 'course_edition_othermaterial', $course_edition["img_othermaterial"]) . $form->getCloseFieldset() . $form->closeElementSpace());
    $out->add($form->openButtonSpace() . $form->getButton('course_edition_modify', 'course_edition_modify', $lang->def('_SAVE')) . $form->getButton('course_undo', 'course_undo', $lang->def('_UNDO')) . $form->closeButtonSpace() . $form->closeForm() . '</div>');
}
Exemplo n.º 29
0
echo Form::openForm('maskcourse_form', 'index.php?r=' . $base_link_course . '/' . ($id_course === false ? 'newcourse' : 'modcourse'), false, 'post', 'multipart/form-data') . Form::getHidden('id_course', 'id_course', $id_course) . Form::openElementSpace() . ($id_course === false ? Form::getLineBox(Lang::t('_CATEGORY_SELECTED', 'course'), $name_category) . Form::getHidden('idCategory', 'idCategory', $_SESSION['course_category']['filter_status']['id_category']) : Form::getDropdown(Lang::t('_CATEGORY_SELECTED', 'course'), 'idCategory', 'idCategory', $model->getCategoryForDropdown(), $course['idCategory'])) . Form::getTextfield(Lang::t('_CODE', 'course'), 'course_code', 'course_code', '50', $course['code']) . Form::getTextfield(Lang::t('_COURSE_NAME', 'course'), 'course_name', 'course_name', '255', $course['name']);
if ($course['course_type'] == 'classroom' && $has_editions_or_classrooms) {
    //this is a classroom course with editions
    echo Form::getLineBox(Lang::t('_COURSE_TYPE', 'course'), $course_type['classroom']) . Form::getHidden('course_type', 'course_type', 'classroom');
} elseif ($course['course_edition'] > 0 && $has_editions_or_classrooms) {
    //this is a classroom course with editions
    echo Form::getLineBox(Lang::t('_COURSE_TYPE', 'course'), $course_type['edition']) . Form::getHidden('course_type', 'course_type', 'edition');
} else {
    //echo Form::getDropdown(Lang::t('_COURSE_TYPE', 'course'), 'course_type', 'course_type', $course_type, $course['course_type']);
    echo Form::getDropdown(Lang::t('_COURSE_TYPE', 'course'), 'course_type', 'course_type', $course_type, $id_course === false ? 'elearning' : $course['course_type']);
}
echo Form::getDropdown(Lang::t('_STATUS', 'course'), 'course_status', 'course_status', $status, $course['status']) . Form::getCheckbox(Lang::t('_DIRECT_PLAY', 'course'), 'direct_play', 'direct_play', '1', $course['direct_play'] == 1) . Form::getTextarea(Lang::t('_DESCRIPTION', 'course'), 'course_descr', 'course_descr', $course['description']) . ($id_course !== false && $course['course_type'] != 'elearning' ? Form::getCheckbox(Lang::t('_CASCADE_MOD_ON_EDITION', 'course'), 'cascade_on_ed', 'cascade_on_ed', 1) : '') . Form::closeElementSpace() . Form::openElementSpace() . Form::openCollasableFieldset(Lang::t('_DETAILS', 'course')) . ($id_course === false ? Form::getDropdown(Lang::t('_COURSE_MENU_TO_ASSIGN', 'course'), 'selected_menu', 'selected_menu', $menu_custom, $sel_custom) : '') . Form::getDropdown(Lang::t('_COURSE_LANG_METHOD', 'course'), 'course_lang', 'course_lang', $array_lang, array_search($course['lang_code'], $array_lang)) . Form::getDropdown(Lang::t('_DIFFICULTY', 'course'), 'course_difficult', 'course_difficult', $difficult_lang, $course['difficult']) . Form::getTextfield(Lang::t('_CREDITS', 'course'), 'credits', 'credits', '50', $course['credits']) . Form::getDropdown(Lang::t('_LABELS', 'label'), 'label', 'label', $label_model->getLabelFromDropdown(true), $id_course === false ? false : $label_model->getCourseLabel($course['idCourse'])) . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_SUBSCRIPTION', 'course')) . Form::getOpenCombo(Lang::t('_COURSE_SUBSRIBE', 'course')) . Form::getRadio(Lang::t('_COURSE_S_GODADMIN', 'course'), 'course_subs_godadmin', 'course_subs', '0', $course['subscribe_method'] == 0) . Form::getRadio(Lang::t('_COURSE_S_MODERATE', 'course'), 'course_subs_moderate', 'course_subs', '1', $course['subscribe_method'] == 1) . Form::getRadio(Lang::t('_COURSE_S_FREE', 'course'), 'course_subs_free', 'course_subs', '2', $course['subscribe_method'] == 2) . Form::getCloseCombo() . Form::getOpenCombo(Lang::t('_USER_CAN_SUBSCRIBE', 'course')) . Form::getRadio(Lang::t('_SUBSCRIPTION_CLOSED', 'course'), 'subscription_closed', 'can_subscribe', '0', $course['can_subscribe'] == 0) . Form::getRadio(Lang::t('_SUBSCRIPTION_OPEN', 'course'), 'subscription_open', 'can_subscribe', '1', $course['can_subscribe'] == 1) . Form::getRadio(Lang::t('_SUBSCRIPTION_IN_PERIOD', 'course') . ":", 'subscription_period', 'can_subscribe', '2', $course['can_subscribe'] == 2) . Form::getCloseCombo() . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_BEGIN', 'course') . ":", 'sub_start_date', 'sub_start_date', $course['sub_start_date']) . Form::getDatefield(Lang::t('_SUBSCRIPTION_DATE_END', 'course') . ":", 'sub_end_date', 'sub_end_date', $course['sub_end_date']) . Form::getBreakRow() . Form::getOpenCombo(Lang::t('_USER_CAN_UNSUBSCRIBE', 'course')) . Form::getRadio(Lang::t('_COURSE_S_GODADMIN', 'course'), 'no_user_unsubscription', 'auto_unsubscribe', '0', $course['auto_unsubscribe'] == 0) . Form::getRadio(Lang::t('_COURSE_S_MODERATE', 'course'), 'moderated_user_unsubscription', 'auto_unsubscribe', '1', $course['auto_unsubscribe'] == 1) . Form::getRadio(Lang::t('_COURSE_S_FREE', 'course'), 'yes_user_unsubscription', 'auto_unsubscribe', '2', $course['auto_unsubscribe'] == 2) . Form::getCloseCombo() . Form::getDatefield(Lang::t('_UNSUBSCRIBE_DATE_LIMIT', 'course'), 'unsubscribe_date_limit', 'unsubscribe_date_limit', $unsubscribe_date_limit, FALSE, FALSE, '', '', Form::getInputCheckbox('use_unsubscribe_date_limit', 'use_unsubscribe_date_limit', 1, $use_unsubscribe_date_limit, '') . ' ') . Form::getBreakRow() . Form::getTextfield(Lang::t('_COURSE_AUTOREGISTRATION_CODE', 'course'), 'course_autoregistration_code', 'course_autoregistration_code', '255', $course['autoregistration_code']) . Form::getCheckbox(Lang::t('_RANDOM_COURSE_AUTOREGISTRATION_CODE', 'course'), 'random_course_autoregistration_code', 'random_course_autoregistration_code', 0) . Form::getBreakRow() . Form::getCheckbox(Lang::t('_COURSE_SELL', 'course'), 'course_sell', 'course_sell', '1', $course['selling'] == 1) . Form::getTextfield(Lang::t('_COURSE_PRIZE', 'course'), 'course_prize', 'course_prize', '11', $course['prize']) . Form::getTextfield(Lang::t('_COURSE_ADVANCE', 'course'), 'advance', 'advance', '11', $course['advance']) . Form::getHidden('course_em', 'course_em', '0') . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_DISPLAY_MODE', 'course')) . Form::getOpenCombo(Lang::t('_WHERE_SHOW_COURSE', 'course')) . Form::getRadio(Lang::t('_SC_EVERYWHERE', 'course'), 'course_show_rules_every', 'course_show_rules', '0', $course['show_rules'] == 0) . Form::getRadio(Lang::t('_SC_ONLY_IN', 'course'), 'course_show_rules_only_in', 'course_show_rules', '1', $course['show_rules'] == 1) . Form::getRadio(Lang::t('_SC_ONLYINSC_USER', 'course'), 'course_show_rules_onlyinsc_user', 'course_show_rules', '2', $course['show_rules'] == 2) . Form::getCloseCombo() . Form::getOpenCombo(Lang::t('_WHAT_SHOW', 'course')) . Form::getCheckbox(Lang::t('_SHOW_PROGRESS', 'course'), 'course_progress', 'course_progress', '1', $course['show_progress'] == 1) . Form::getCheckbox(Lang::t('_SHOW_TIME', 'course'), 'course_time', 'course_time', '1', $course['show_time'] == 1) . Form::getCheckbox(Lang::t('_SHOW_ADVANCED_INFO', 'course'), 'course_advanced', 'course_advanced', '1', $course['show_extra_info'] == 1) . Form::getCloseCombo() . Form::getDropdown(Lang::t('_SHOW_WHOISONLINE', 'course'), 'show_who_online', 'show_who_online', $show_who_online, $course['show_who_online']) . Form::getOpenCombo(Lang::t('_SHOW_USER_OF_LEVEL', 'course'));
while (list($level, $level_name) = each($levels)) {
    echo Form::getCheckbox($level_name, 'course_show_level_' . $level, 'course_show_level[' . $level . ']', $level, $course['level_show_user'] & 1 << $level);
}
echo Form::getCloseCombo() . Form::getOpenCombo(Lang::t('_COURSE_STATUS_CANNOT_ENTER', 'course')) . Form::getCheckbox(Lang::t('_USER_STATUS_SUBS', 'course'), 'user_status_' . _CUS_SUBSCRIBED, 'user_status[' . _CUS_SUBSCRIBED . ']', _CUS_SUBSCRIBED, $course['userStatusOp'] & 1 << _CUS_SUBSCRIBED) . Form::getCheckbox(Lang::t('_USER_STATUS_BEGIN', 'course'), 'user_status_' . _CUS_BEGIN, 'user_status[' . _CUS_BEGIN . ']', _CUS_BEGIN, $course['userStatusOp'] & 1 << _CUS_BEGIN) . Form::getCheckbox(Lang::t('_USER_STATUS_END', 'course'), 'user_status_' . _CUS_END, 'user_status[' . _CUS_END . ']', _CUS_END, $course['userStatusOp'] & 1 << _CUS_END) . Form::getCheckbox(Lang::t('_USER_STATUS_SUSPEND', 'course'), 'user_status_' . _CUS_SUSPEND, 'user_status[' . _CUS_SUSPEND . ']', _CUS_SUSPEND, $course['userStatusOp'] & 1 << _CUS_SUSPEND) . Form::getCloseCombo() . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_TIME_OPTION', 'course')) . Form::getDatefield(Lang::t('_DATE_BEGIN', 'course'), 'course_date_begin', 'course_date_begin', $course['date_begin']) . Form::getDatefield(Lang::t('_DATE_END', 'course'), 'course_date_end', 'course_date_end', $course['date_end']) . Form::getLineBox('<label for="hour_begin_hour">' . Lang::t('_HOUR_BEGIN', 'course') . '</label>', Form::getInputDropdown('dropdown_nw', 'hour_begin_hour', 'hour_begin[hour]', $hours, $hb_sel, '') . ' : ' . Form::getInputDropdown('dropdown_nw', 'hour_begin_quarter', 'hour_begin[quarter]', $quarter, $qe_sel, '')) . Form::getLineBox('<label for="hour_end_hour">' . Lang::t('_HOUR_END', 'course') . '</label>', Form::getInputDropdown('dropdown_nw', 'hour_end_hour', 'hour_end[hour]', $hours, $he_sel, '') . ' : ' . Form::getInputDropdown('dropdown_nw', 'hour_end_quarter', 'hour_end[quarter]', $quarter, $qe_sel, '')) . Form::getTextfield(Lang::t('_DAY_OF_VALIDITY', 'course'), 'course_day_of', 'course_day_of', '10', $course['valid_time']) . Form::getTextfield(Lang::t('_MEDIUM_TIME', 'course'), 'course_medium_time', 'course_medium_time', '10', $course['mediumTime']) . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_COURSE_SPECIAL_OPTION', 'course')) . Form::getTextfield(Lang::t('_MIN_NUM_SUBSCRIBE', 'course'), 'min_num_subscribe', 'min_num_subscribe', '11', $course['min_num_subscribe']) . Form::getTextfield(Lang::t('_MAX_NUM_SUBSCRIBE', 'course'), 'max_num_subscribe', 'max_num_subscribe', '11', $course['max_num_subscribe']) . Form::getCheckbox(Lang::t('_ALLOW_OVERBOOKING', 'course'), 'allow_overbooking', 'allow_overbooking', '1', $course['allow_overbooking'] == 1) . Form::getTextfield(Lang::t('_COURSE_QUOTA', 'course'), 'course_quota', 'course_quota', '11', $course['course_quota'] != COURSE_QUOTA_INHERIT ? $course['course_quota'] : 0) . Form::getCheckbox(Lang::t('_INHERIT_QUOTA', 'course'), 'inherit_quota', 'inherit_quota', '1', $course['course_quota'] == COURSE_QUOTA_INHERIT) . Form::getCloseFieldset() . Form::openCollasableFieldset(Lang::t('_DOCUMENT_UPLOAD', 'course')) . Form::getTextfield(Lang::t('_SPONSOR_LINK', 'course'), 'course_sponsor_link', 'course_sponsor_link', '255', $course['linkSponsor']) . Form::getExtendedFilefield(Lang::t('_PATHSPONSOR', 'configuration'), 'course_sponsor_logo', 'course_sponsor_logo', $course["imgSponsor"]) . Form::getExtendedFilefield(Lang::t('_COURSE_LOGO', 'course'), 'course_logo', 'course_logo', $course["img_course"]) . Form::getExtendedFilefield(Lang::t('_COURSE_DEMO', 'course'), 'course_demo', 'course_demo', $course["course_demo"]) . Form::getCheckbox(Lang::t('_USE_LOGO_IN_COURSELIST', 'course'), 'use_logo_in_courselist', 'use_logo_in_courselist', 1, $course["use_logo_in_courselist"]) . Form::getCloseFieldset() . Form::closeElementSpace() . Form::openButtonSpace() . ($_REQUEST['r'] == 'alms/course/newcourse' || $_REQUEST['r'] == 'alms/course/modcourse' && $row[0] == 0 ? Form::getCheckbox(Lang::t('_AUTO_SUBSCRIPTION'), 'auto_subscription', 'auto_subscription', '1', true) : '') . Form::getButton('save', 'save', Lang::t('_SAVE')) . Form::getButton('undo', 'undo', Lang::t('_UNDO')) . Form::closeButtonSpace() . Form::closeForm();
?>
</div>
<script type="text/javascript">
var D = YAHOO.util.Dom, E = YAHOO.util.Event;
E.onDOMReady(function() {
	var c = D.get("use_unsubscribe_date_limit"), d = D.get("unsubscribe_date_limit");
	E.addListener("no_user_unsubscription", "click", function(e) {
		var checked = this.checked;
		c.disabled = checked;
		d.disabled = checked;
	});
	E.addListener("moderated_user_unsubscription", "click", function(e) {
		var checked = this.checked;
		c.disabled = !checked;
		d.disabled = !checked;
Exemplo n.º 30
0
<div class="middlearea_container">
	<?php 
$lmstab = $this->widget('lms_tab', array('active' => 'kb', 'close' => false));
?>
	<div class="yui-t1">
		<div id="yui-main">
			<div class="yui-b">
				<div class="yui-ge">
					<div class="yui-u first"><!--- page content --->
						<div class="middle_colum">
							<!-- search form -->
							<div class="quick_search_form">
								<div class="simple_search_box" id="usermanagement_simple_filter_options" style="display: block;">
									<?php 
echo Form::openForm('quick_search', '');
echo Form::getInputDropdown('dropdown', 'course_filter', 'course_filter', $course_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>
							<!-- categories navigation -->
							<!-- Hiding Horizontal Cat navigation
							<ul id="kb_folder_nav" class="navigation"></ul>
							<div class="kb_folder_box"  id="folder_box">
								<ul id="kb_folder_box_ul" class="style_none"></ul>
								<div class="nofloat"></div>
							</div>
							-->