Example #1
0
function getprofile($id_user)
{
    require_once _base_ . '/lib/lib.form.php';
    require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
    $acl_man =& Docebo::user()->getAClManager();
    $lang =& DoceboLanguage::createInstance('profile', 'framework');
    $user_info = $acl_man->getUser($id_user, false);
    $txt = '<div>';
    $txt .= '<div class="boxinfo_title">' . $lang->def('_USERPARAM') . '</div>' . Form::getLineBox($lang->def('_USERNAME'), $acl_man->relativeId($user_info[ACL_INFO_USERID])) . Form::getLineBox($lang->def('_LASTNAME'), $user_info[ACL_INFO_LASTNAME]) . Form::getLineBox($lang->def('_NAME'), $user_info[ACL_INFO_FIRSTNAME]) . Form::getLineBox($lang->def('_EMAIL'), $user_info[ACL_INFO_EMAIL]) . Form::getBreakRow() . '<div class="boxinfo_title">' . $lang->def('_USERFORUMPARAM') . '</div>' . '<table class="profile_images">' . '<tr><td>';
    // NOTE: avatar
    if ($user_info[ACL_INFO_AVATAR] != "") {
        $img_size = getimagesize($path . $user_info[ACL_INFO_AVATAR]);
        $txt .= '<img class="profile_image' . ($img_size[0] > 150 || $img_size[1] > 150 ? ' image_limit' : '') . '" src="' . $path . $user_info[ACL_INFO_AVATAR] . '" alt="' . $lang->def('_AVATAR') . '" /><br />';
    } else {
        $txt .= '<div class="text_italic">' . $lang->def('_NOAVATAR', 'profile') . '</div>';
    }
    // NOTE: signature
    $txt .= '</td></tr></table>' . '<div class="title">' . $lang->def('_SIGNATURE') . '</div>' . '<div class="profile_signature">' . $user_info[ACL_INFO_SIGNATURE] . '</div><br />' . "\n";
    $txt .= '</div>';
    return $txt;
}
Example #2
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');
}
Example #3
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');
 }
Example #4
0
 /**
  * @param string	$base_path 		if specified load only preference form this base_path
  * @param bool		$only_visible 	if true only the visible
  *
  * @return string	the code for show the actual preference of the user
  */
 function getFreezeMask($base_path = false, $only_visible = true)
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('preferences', 'framework');
     $preferences = $this->_up_db->getFullPreferences($this->id_user, $only_visible, false, $base_path);
     $html = '';
     while (list(, $pref) = each($preferences)) {
         // Navigation trought the preferences
         // array( 'path_name', 'label', 'default_value', 'type', 'visible', 'load_at_startup', 'user_value' )
         switch ($pref['type']) {
             case "language":
                 //drop down language
                 $lang_sel = $this->getLanguage();
                 $html .= Form::getLineBox($lang->def($pref['label']), $lang_sel);
                 break;
             case "template":
                 //drop down template
                 $templ_sel = getTemplate();
                 $html .= Form::getLineBox($lang->def($pref['label']), $templ_sel);
                 break;
             case "hteditor":
                 //drop down hteditor
                 $ht_edit = getHTMLEditorList();
                 $value = $pref['user_value'] ? $pref['user_value'] : $pref['default_value'];
                 $html .= Form::getLineBox($lang->def($pref['label']), $ht_edit[$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'));
                 $value = $pref['user_value'] ? $pref['user_value'] : $pref['default_value'];
                 $html .= Form::getLineBox($lang->def($pref['label']), $layout[$value]);
                 break;
             case "enum":
                 //on off
                 $value = $pref['user_value'] ? $pref['user_value'] : $pref['default_value'];
                 $html .= Form::getLineBox($lang->def($pref['label']), $value == 'on' ? $lang->def('_ACTIVE') : $lang->def('_OFF'));
                 break;
                 //string or int
             //string or int
             default:
                 $html .= Form::getLineBox($lang->def($pref['label']), $pref['user_value'] ? $pref['user_value'] : $pref['default_value']);
         }
     }
     return $html . '<div class="nofloat"></div>';
 }
Example #5
0
 public function printPageWithElement($id, $canonical_name)
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('configuration', 'framework');
     $reSetting = sql_query("\r\n\t\t\tSELECT *\r\n\t\t\tFROM " . $this->table . "\r\n\t\t\tWHERE name like '" . $canonical_name . "'");
     list($plugin_id, $name, $title, $code, $category, $version, $author, $link, $priority, $description, $active) = sql_fetch_row($reSetting);
     $active_option = array('1' => $lang->def('_ACTIVE_PLUGIN'), '0' => $lang->def('_NOT_ACTIVE_PLUGIN'));
     $priority_option = array_keys($this->plugins);
     $active = empty($active) ? 0 : 1;
     echo '<h2>' . $title . '</h2>' . Form::openElementSpace() . Form::getHidden('active_tab_' . $plugin_id, 'active_tab', $plugin_id);
     echo Form::getLineBox($lang->def('_PLUGIN_AUTHOR'), $author);
     echo Form::getLineBox($lang->def('_PLUGIN_LINK'), $link);
     echo Form::getLineBox($lang->def('_PLUGIN_DESCR'), $description);
     echo Form::getLineBox($lang->def('_PLUGIN_CATEGORY'), $category);
     echo Form::getLineBox($lang->def('_PLUGIN_VERSION'), $version);
     echo Form::getDropdown($lang->def('_PLUGIN_PRIORITY'), strtolower("priority_" . $canonical_name), 'priority[' . $plugin_id . ']', $priority_option, $id);
     echo Form::getDropdown($lang->def('_ACTIVE_STATUS'), strtolower($canonical_name), 'active[' . $plugin_id . ']', $active_option, $active);
 }
 function assignfields()
 {
     //check permissions
     if (!$this->permissions['mod_org']) {
         Util::jump_to('index.php?r=' . $this->link . '/show');
     }
     require_once _base_ . '/lib/lib.table.php';
     require_once _adm_ . '/lib/lib.field.php';
     $id_org = Get::req('id_node', DOTY_INT, 0);
     $table = new Table();
     $type_h = array('', 'image', 'image', 'image', 'image', 'image');
     $cont_h = array(Lang::t('_FIELD_NAME', 'organization_chart'), Lang::t('_DIRECTORY_ASSIGNFIELDGROUP', 'admin_directory'), Lang::t('_ORG_CHART_INHERIT', 'organization_chart'), Lang::t('_MANDATORY', 'organization_chart'), Lang::t('_ORG_CHART_FIELD_WRITE', 'organization_chart'), Lang::t('_USER_INHERIT', 'organization_chart'));
     $table->addHead($cont_h, $type_h);
     $fl = new FieldList();
     $acl = Docebo::user()->getACL();
     $acl_man = Docebo::user()->getAclManager();
     $body = "";
     $body .= Form::openForm('assignfieldgroup', 'ajax.adm_server.php?r=' . $this->link . '/assignfields_action');
     $body .= Form::getLineBox(Lang::t('_ORG_CHART_LIST_FIELDS', 'organization_chart') . ':&nbsp;', $this->model->getOrgPath($id_org));
     $body .= Form::getHidden('idst_group', 'idst_group', $id_org);
     $arr_all_fields = $fl->getAllFields();
     $arr_fields_normal = $fl->getFieldsFromIdst(array($acl_man->getGroupST('oc_' . $id_org)));
     $arr_fields_inherit = $fl->getFieldsFromIdst(array($acl_man->getGroupST('ocd_' . $id_org)));
     //$body .= '<pre>'.print_r($arr_fields_normal, true).print_r($arr_fields_inherit, true).'</pre>';
     foreach ($arr_all_fields as $field) {
         $id_field = $field[FIELD_INFO_ID];
         $def_value = GROUP_FIELD_NO;
         if (isset($arr_fields_normal[$id_field])) {
             $def_value = GROUP_FIELD_NORMAL;
         }
         if (isset($arr_fields_inherit[$id_field])) {
             $def_value = GROUP_FIELD_INHERIT;
         }
         switch ($def_value) {
             case GROUP_FIELD_NORMAL:
                 $is_mandatory = isset($arr_fields_normal[$id_field]) && $arr_fields_normal[$id_field][FIELD_INFO_MANDATORY] == 'true';
                 $is_invisible = isset($arr_fields_normal[$id_field]) && $arr_fields_normal[$id_field][FIELD_INFO_USERACCESS] == 'readwrite';
                 $is_userinherit = isset($arr_fields_normal[$id_field]) && $arr_fields_normal[$id_field][FIELD_INFO_USERINHERIT] == '1';
                 break;
             case GROUP_FIELD_INHERIT:
                 $is_mandatory = isset($arr_fields_inherit[$id_field]) && $arr_fields_inherit[$id_field][FIELD_INFO_MANDATORY] == 'true';
                 $is_invisible = isset($arr_fields_inherit[$id_field]) && $arr_fields_inherit[$id_field][FIELD_INFO_USERACCESS] == 'readwrite';
                 $is_userinherit = isset($arr_fields_inherit[$id_field]) && $arr_fields_inherit[$id_field][FIELD_INFO_USERINHERIT] == '1';
                 break;
             default:
                 $is_mandatory = false;
                 $is_invisible = false;
                 $is_userinherit = false;
         }
         $selected = $def_value != GROUP_FIELD_NO;
         $disabled = 'disabled="disabled"';
         $line = array();
         $line[] = $field[FIELD_INFO_TRANSLATION];
         $line[] = Form::getInputCheckbox('fields_use_' . $id_field, 'fields_use[' . $id_field . ']', 1, $selected, '');
         $line[] = Form::getInputCheckbox('fields_inherit_' . $id_field, 'fields_inherit[' . $id_field . ']', 1, $def_value == GROUP_FIELD_INHERIT, $selected ? '' : $disabled);
         $line[] = Form::getInputCheckbox('fields_mandatory_' . $id_field, 'fields_mandatory[' . $id_field . ']', 1, $is_mandatory, $selected ? '' : $disabled);
         $line[] = Form::getInputCheckbox('fields_invisible_' . $id_field, 'fields_invisible[' . $id_field . ']', 1, $is_invisible, $selected ? '' : $disabled);
         $line[] = Form::getInputCheckbox('fields_userinherit_' . $id_field, 'fields_userinherit[' . $id_field . ']', 1, $is_userinherit, $selected ? '' : $disabled);
         $table->addBody($line);
     }
     $body .= $table->getTable();
     $body .= Form::closeForm();
     $output = array('success' => true, 'header' => Lang::t('_ORGCHART_FOLDER_FIELD_ALT', 'organization_chart'), 'body' => $body);
     //$this->render('assign_fields', $params);
     echo $this->json->encode($output);
 }
Example #7
0
	<li><?php 
echo Lang::t('_USER_STATUS_SUBS', 'subscribe') . ': <b>' . (int) $num_subscribed . '</b>';
?>
</li>
</ul>
<?php 
$array_style = array('userid' => '', 'fullname' => '', 'administrator' => 'image', 'instructor' => 'image', 'mentor' => 'image', 'tutor' => 'image', 'student' => 'image', 'ghost' => 'image', 'guest' => 'image', 'undo' => 'image');
$array_header = array('userid' => Lang::t('_USERNAME', 'subscribe'), 'fullname' => Lang::t('_FULLNAME', 'subscribe'), 'administrator' => '<a href="javascript:SelAll(\'7\');">' . $model->level[7] . '</a>', 'instructor' => '<a href="javascript:SelAll(\'6\');">' . $model->level[6] . '</a>', 'mentor' => '<a href="javascript:SelAll(\'5\');">' . $model->level[5] . '</a>', 'tutor' => '<a href="javascript:SelAll(\'4\');">' . $model->level[4] . '</a>', 'student' => '<a href="javascript:SelAll(\'3\');">' . $model->level[3] . '</a>', 'ghost' => '<a href="javascript:SelAll(\'2\');">' . $model->level[2] . '</a>', 'guest' => '<a href="javascript:SelAll(\'1\');">' . $model->level[1] . '</a>', 'undo' => '<a href="javascript:SelAll(\'0\');">' . Lang::t('_UNDO', 'subscribe') . '</a>');
$array_content = array();
echo Form::openForm('choose_level', 'index.php?r=' . $this->link . '/ins&amp;id_course=' . $model->getIdCourse() . '&amp;id_edition=' . $model->getIdEdition() . '&amp;id_date=' . $model->getIdDate()) . Form::getHidden('send_alert', 'send_alert', $send_alert);
if ($date_begin_validity) {
    echo Form::getLineBox(Lang::t('_DATE_BEGIN_VALIDITY', 'subscribe'), Format::date(substr($date_begin_validity, 0, 10), 'date'));
    echo Form::getHidden('set_date_begin_validity', 'set_date_begin_validity', $date_begin_validity);
}
if ($date_expire_validity) {
    echo Form::getLineBox(Lang::t('_DATE_EXPIRE_VALIDITY', 'subscribe'), Format::date(substr($date_expire_validity, 0, 10), 'date'));
    echo Form::getHidden('set_date_expire_validity', 'set_date_expire_validity', $date_expire_validity);
}
if (is_array($model->data)) {
    foreach ($model->data as $id_user => $user_info) {
        $array_content[] = array('userid' => substr($user_info[ACL_INFO_USERID], 1), 'fullname' => $user_info[ACL_INFO_FIRSTNAME] . ' ' . $user_info[ACL_INFO_LASTNAME], 'administrator' => Form::getInputRadio('user_level_sel_' . $id_user . '_7', 'user_level_sel[' . $id_user . ']', 7, false, ''), 'instructor' => Form::getInputRadio('user_level_sel_' . $id_user . '_6', 'user_level_sel[' . $id_user . ']', 6, false, ''), 'mentor' => Form::getInputRadio('user_level_sel_' . $id_user . '_5', 'user_level_sel[' . $id_user . ']', 5, false, ''), 'tutor' => Form::getInputRadio('user_level_sel_' . $id_user . '_4', 'user_level_sel[' . $id_user . ']', 4, false, ''), 'student' => Form::getInputRadio('user_level_sel_' . $id_user . '_3', 'user_level_sel[' . $id_user . ']', 3, true, ''), 'ghost' => Form::getInputRadio('user_level_sel_' . $id_user . '_2', 'user_level_sel[' . $id_user . ']', 2, false, ''), 'guest' => Form::getInputRadio('user_level_sel_' . $id_user . '_1', 'user_level_sel[' . $id_user . ']', 1, false, ''), 'undo' => Form::getInputRadio('user_level_sel_' . $id_user . '_0', 'user_level_sel[' . $id_user . ']', 0, false, ''));
    }
}
$this->widget('table', array('id' => 'subscribed_table', 'styles' => $array_style, 'header' => $array_header, 'data' => $array_content, 'summary' => Lang::t('_LEVELS', '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();
echo '<script>' . $model->js_user . ');
		function SelAll (lvl)
Example #8
0
function ioTask_UITaskRun(&$module, $action)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    $connMgr =& $module->get_connMgr();
    $lang =& $module->get_lang();
    $out =& $module->get_out();
    $form = new Form();
    $dimport = new DoceboImport();
    $params = $connMgr->get_task_byname(key($action));
    $task_name = $params[CONNMGR_TASK_NAME];
    $out->setWorkingZone('content');
    $out->add(getTitleArea($lang->def('_TASKS'), 'iotask'));
    $out->add('<div class="std_block">');
    $out->add($form->getFormHeader($lang->def('_TASK_RUNNED')));
    $out->add($form->openForm('task_delete', 'index.php?modname=iotask&op=display&gotab=tasks'));
    $out->add($form->openElementSpace());
    $out->add($form->getHidden('task_name', 'task_name', $task_name));
    $report = $dimport->execute_task($task_name);
    if (!is_array($report)) {
        $out->add($report);
    } else {
        $out->add($form->getLineBox($lang->def('_TASK_INSERTED'), $report[0]['inserted']));
        $out->add($form->getLineBox($lang->def('_OPERATION_SUCCESSFUL'), $report[0]['removed']));
        $out->add($form->getLineBox($lang->def('_OPERATION_FAILURE'), count($report) - 1));
        foreach ($report as $index => $elem_report) {
            if ($index !== 0) {
                $out->add($index . ' - ' . '(' . implode(', ', $report[$index][0]) . ')' . ' - ' . $report[$index][1]);
            }
        }
    }
    $out->add($form->closeElementSpace());
    $out->add($form->openButtonSpace());
    $out->add($form->getButton('close', 'close', $lang->def('_CLOSE')));
    $out->add($form->closeButtonSpace());
    $out->add($form->closeForm());
    $out->add('</div>');
}
Example #9
0
 /**
  * display the field for interaction
  *
  * @param 	int		$id_user			if alredy exists a entry for the user load as default value
  * @param 	bool	$freeze				if true, disable the user interaction
  * @param 	bool	$mandatory			if true, the field is considered mandatory
  * @param 	bool	$do_not_show_label	if true, do not show the label in freeze mode
  *
  * @return string 	of field xhtml code
  *
  * @access public
  */
 function play($id_user, $freeze, $mandatory = false, $do_not_show_label = false, $value = NULL)
 {
     require_once _base_ . '/lib/lib.form.php';
     if (isset($_POST['field_' . $this->getFieldType()]) && isset($_POST['field_' . $this->getFieldType()][$this->id_common])) {
         $user_entry = $_POST['field_' . $this->getFieldType()][$this->id_common];
     } else {
         list($user_entry) = sql_fetch_row(sql_query("\r\n\t\t\tSELECT user_entry\r\n\t\t\tFROM " . $this->_getUserEntryTable() . "\r\n\t\t\tWHERE id_user = '******' AND\r\n\t\t\t\tid_common = '" . (int) $this->id_common . "' AND\r\n\t\t\t\tid_common_son = '0'"));
     }
     $user_entry = (int) $user_entry;
     $re_field = sql_query("\r\n\t\tSELECT translation\r\n\t\tFROM " . $this->_getMainTable() . "\r\n\t\tWHERE id_common = '" . (int) $this->id_common . "' AND\r\n\t\t\ttype_field = '" . $this->getFieldType() . "' AND\r\n\t\t\tlang_code = '" . getLanguage() . "'");
     list($translation) = sql_fetch_row($re_field);
     $re_field_element = sql_query("\r\n\t\tSELECT id_common_son, translation\r\n\t\tFROM " . $this->_getElementTable() . "\r\n\t\tWHERE idField = '" . (int) $this->id_common . "' AND lang_code = '" . getLanguage() . "'\r\n\t\tORDER BY sequence");
     $option = array();
     $option[0] = Lang::t('_DROPDOWN_NOVALUE', 'field', 'framework');
     while (list($id_common_son, $element) = sql_fetch_row($re_field_element)) {
         $option[$id_common_son] = $element;
     }
     if ($value !== NULL) {
         $user_entry = (int) $value;
     }
     if ($freeze) {
         return Form::getLineBox($translation . ' : ', $option[$user_entry]);
     }
     return Form::getDropdown($translation . ($mandatory ? ' <span class="mandatory">*</span>' : ''), 'field_' . $this->getFieldType() . '_' . $this->id_common, 'field_' . $this->getFieldType() . '[' . $this->id_common . ']', $option, (int) $user_entry, '', '');
 }
Example #10
0
 /**
  * display the field for interaction
  *
  * @param 	int		$id_user	if alredy exists a entry for the user load as default value
  * @param 	bool	$freeze		if true, disable the user interaction
  *
  * @return string 	of field xhtml code
  *
  * @access public
  */
 function play($id_user, $freeze, $mandatory = false, $do_not_show_label = false, $value = NULL)
 {
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.mimetype.php';
     list($user_entry) = sql_fetch_row(sql_query("\r\n\t\tSELECT user_entry\r\n\t\tFROM " . $this->_getUserEntryTable() . "\r\n\t\tWHERE id_user = '******' AND\r\n\t\t\tid_common = '" . (int) $this->id_common . "' AND\r\n\t\t\tid_common_son = '0'"));
     $re_field = sql_query("\r\n\t\tSELECT translation\r\n\t\tFROM " . $this->_getMainTable() . "\r\n\t\tWHERE lang_code = '" . getLanguage() . "' AND id_common = '" . (int) $this->id_common . "' AND type_field = '" . $this->getFieldType() . "'");
     list($translation) = sql_fetch_row($re_field);
     if ($user_entry != '') {
         $entry_link = '<a href="' . Get::rel_path('adm') . '/index.php?modname=field&amp;op=manage&amp;fo=special&amp;type_field=' . $this->getFieldType() . '&amp;id_user='******'&amp;id_common=' . $this->id_common . '">' . '<img src="' . getPathImage() . mimeDetect($user_entry) . '" alt="' . Lang::t('_MIME_TYPE') . '" />' . '&nbsp;' . Lang::t('_DOWNLOAD') . '</a> <a id="4upLLoad" href="javascript:void();" onclick="document.getElementById(\'upLLoad\').style.display = \'inline\';document.getElementById(\'4upLLoad\').style.display=\'none\'">' . Lang::t('_MOD', 'standard', 'framework') . '</a>';
     } else {
         $entry_link = Lang::t('_NO_FILE_UPLOADED', 'field', 'framework') . ' <a id="4upLLoad" href="javascript:void();" onclick="document.getElementById(\'upLLoad\').style.display = \'inline\';document.getElementById(\'4upLLoad\').style.display=\'none\'">' . Lang::t('_MODIFY', 'field', 'framework') . '</a>';
     }
     if ($value !== NULL) {
         $user_entry = $value;
     }
     if ($freeze) {
         return Form::getLineBox($translation . ' : ', $entry_link);
     }
     return Form::getFilefield($translation . ($mandatory ? ' <span class="mandatory">*</span>' : ''), 'field_' . $this->getFieldType() . '_' . $this->id_common, 'field_' . $this->getFieldType() . '[' . $this->id_common . ']', '', $translation, '', '', $entry_link);
 }
Example #11
0
$sel_lang = $all_languages_id[$data["r_lang"]];
if ($data['r_type'] == 'scorm') {
    echo '<div class="align-right">';
    echo '<a href="#" id="subcategorize_switch" class="ico-wt-sprite subs_del"><span>' . Lang::t('_CATEGORIZE_OBJECT_ITEMS', 'kb') . '</span></a>';
    echo "</div>\n";
    $body = Form::openForm('add_res', $form_url) . Form::getHidden('subcategorize_switch', 'subcategorize_switch', '1') . Form::getHidden('org_categorize_switch_subcat', 'org_categorize_switch_subcat', '1');
    if (!empty($form_extra_hidden)) {
        foreach ($form_extra_hidden as $field_id => $val) {
            $body .= Form::getHidden($field_id, $field_id, $val);
        }
    }
    $body .= Form::closeForm();
    $body .= Lang::t('_YOU_WILL_LOSE_PREVIOUS_CATEGORIZATION', 'kb');
    $this->widget('dialog', array('id' => 'subcategorize_switch_dialog', 'dynamicContent' => false, 'dynamicAjaxUrl' => false, 'directSubmit' => true, 'header' => Lang::t('_AREYOUSURE', 'kb'), 'body' => $body, 'callback' => 'function() { this.destroy(); }', 'callEvents' => array(array('caller' => 'subcategorize_switch', 'event' => 'click'))));
}
echo Form::openElementSpace() . Form::getLineBox(Lang::t('_RESOURCE_ORIGINAL_NAME', 'kb'), $data['original_name']) . Form::getTextfield(Lang::t('_NAME', 'kb'), 'r_name', 'r_name', 255, Get::req('r_name', DOTY_MIXED, $data['r_name'])) . Form::getDropDown(Lang::t('_LANGUAGE', 'kb'), 'r_lang', 'r_lang', $all_languages, $sel_lang) . Form::getLineBox(Lang::t('_TYPE', 'kb'), $data['r_type']) . Form::getLineBox(Lang::t('_ENVIRONMENT', 'kb'), $data['r_env']) . Form::getCheckbox(Lang::t('_VISIBLE_BY_EVERYONE', 'kb'), 'force_visible', 'force_visible', 1, $data['force_visible']) . Form::getCheckbox(Lang::t('_IS_MOBILE', 'kb'), 'is_mobile', 'is_mobile', 1, $data['is_mobile']) . Form::getTextarea(Lang::t('_DESCRIPTION', 'kb'), 'r_desc', 'r_desc', Get::req('r_desc', DOTY_MIXED, $data['r_desc']));
?>

<div class="form_line_l">
	<p><label for="input_add_tag" class="floating"><?php 
echo Lang::t('_ADD_TAGS', 'kb');
?>
</label></p>
	<div class="form_autocomplete_container">
	<input type="text" alt="<?php 
echo Lang::t('_ADD_TAGS', 'kb');
?>
" maxlength="255" value="" name="input_add_tag" id="input_add_tag" class="textfield">
	<a href="" id="link_add_tag"><img alt="Add" src="<?php 
echo getPathImage();
?>
Example #12
0
 function getRenderedProfile($user_info)
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('profile', 'framework');
     $path = Get::sett('url') . $GLOBALS['where_files_relative'] . '/appCore/' . Get::sett('pathphoto');
     $txt = '<div>' . '<div class="boxinfo_title">' . $lang->def('_USERPARAM') . '</div>' . Form::getLineBox($lang->def('_USERNAME'), $user_info[ACL_INFO_USERID]) . Form::getLineBox($lang->def('_LASTNAME'), $user_info[ACL_INFO_LASTNAME]) . Form::getLineBox($lang->def('_NAME'), $user_info[ACL_INFO_FIRSTNAME]) . Form::getLineBox($lang->def('_EMAIL'), $user_info[ACL_INFO_EMAIL]) . Form::getBreakRow() . '<div class="boxinfo_title">' . $lang->def('_USERFORUMPARAM') . '</div>' . '<table class="profile_images">' . '<tr><td>';
     // NOTE: avatar
     if ($user_info[ACL_INFO_AVATAR] != "") {
         $txt .= '<img class="profile_image" src="' . $path . $user_info[ACL_INFO_AVATAR] . '" alt="' . $lang->def('_AVATAR') . '" /><br />';
     } else {
         $txt .= '<div class="text_italic">' . $lang->def('_NOAVATAR') . '</div>';
     }
     // NOTE: signature
     $txt .= '</td></tr></table>' . '<div class="title">' . $lang->def('_SIGNATURE') . '</div>' . '<div class="profile_signature">' . $user_info[ACL_INFO_SIGNATURE] . '</div><br />' . "\n" . '</div>';
     return $txt;
 }
Example #13
0
 function addeditWiki($id = 0)
 {
     $res = "";
     require_once _base_ . "/lib/lib.form.php";
     $form = new Form();
     $form_code = "";
     $um =& UrlManager::getInstance();
     $url = $um->getUrl("op=savewiki");
     $lang_arr = $this->wikiManager->getLanguageArr();
     if ($id == 0) {
         $todo = "add";
         $form_code = $form->openForm("main_form", $url);
         $submit_lbl = $this->lang->def("_INSERT");
         $public = FALSE;
         $title = "";
         $description = "";
         $sel_lang = getLanguage();
         $other_lang = array();
     } else {
         if ($id > 0) {
             $todo = "edit";
             $form_code = $form->openForm("main_form", $url);
             $submit_lbl = $this->lang->def("_SAVE");
             $info = $this->wikiManager->getWikiInfo($id);
             $public = $info["public"] == 1 ? TRUE : FALSE;
             $title = $info["title"];
             $description = $info["description"];
             if (!empty($info["language"])) {
                 $sel_lang = $info["language"];
             } else {
                 $sel_lang = FALSE;
             }
             if (!empty($info["other_lang"])) {
                 $other_lang = explode(",", $info["other_lang"]);
             } else {
                 $other_lang = array();
             }
         }
     }
     $res .= $form_code;
     $res .= $form->openElementSpace();
     $res .= $form->getTextfield($this->lang->def("_TITLE"), "title", "title", 255, $title);
     $res .= $form->getSimpleTextarea($this->lang->def("_DESCRIPTION"), "description", "description", $description);
     if (Get::cur_plat() !== 'framework') {
         $res .= $form->getHidden("public", "public", 1);
     }
     $res .= $form->getHidden("id", "id", $id);
     if ($todo == "add") {
         $res .= $form->getDropdown($this->lang->def("_WIKI_LANGUAGE"), "language", "language", $lang_arr, $sel_lang);
     } else {
         if ($todo == "edit") {
             $res .= $form->getLineBox($this->lang->def("_WIKI_LANGUAGE") . ":", ucfirst($sel_lang));
             $res .= $form->getHidden("language", "language", $sel_lang);
             //$form->getDropdown($this->lang->def("_WIKI_LANGUAGE"), "language", "language", $lang_arr, $sel_lang);
         }
     }
     $res .= $form->getOpenCombo($this->lang->def('_WIKI_OTHER_LANGUAGES'));
     foreach ($lang_arr as $lang_code => $label) {
         $to_show = TRUE;
         $name = "other_lang[" . $lang_code . "]";
         $id = "other_lang_" . $lang_code;
         if ($todo == "edit" && $lang_code == $sel_lang) {
             $to_show = FALSE;
         }
         $checked = in_array($lang_code, $other_lang) ? TRUE : FALSE;
         if ($to_show) {
             $res .= $form->getCheckBox($label, $id, $name, $lang_code, $checked);
         }
     }
     $res .= $form->getCloseCombo();
     $res .= $form->closeElementSpace();
     $res .= $form->openButtonSpace();
     $res .= $form->getButton('save', 'save', $submit_lbl);
     $res .= $form->getButton('undo', 'undo', $this->lang->def('_UNDO'));
     $res .= $form->closeButtonSpace();
     $res .= $form->closeForm();
     return $res;
 }
Example #14
0
 /**
  * gui for user info management
  */
 function getUserInfoModUi()
 {
     require_once _base_ . '/lib/lib.form.php';
     require_once _base_ . '/lib/lib.preference.php';
     $this->loadUserData($this->_user_profile->getIdUser());
     $preference = new UserPreferences($this->_user_profile->getIdUser());
     $html = '<div class="up_user_info">' . '<div class="up_name">' . $this->resolveUsername(false, $this->_user_profile->getIdUser()) . '</div>';
     // user standard info -----------------------------------------------------------------
     $html .= Form::openForm('mod_up', $this->_url_man->getUrl($this->_varname_action . '=saveinfo'), false, false, 'multipart/form-data');
     if ($this->_user_profile->godMode()) {
         $html .= Form::getTextfield($this->_lang->def('_USERNAME'), 'up_userid', 'up_userid', '255', Get::req('up_userid', DOTY_MIXED, $this->acl_man->relativeId($this->user_info[ACL_INFO_USERID]), true));
     } else {
         $html .= Form::getLineBox($this->_lang->def('_USERNAME'), $this->acl_man->relativeId($this->user_info[ACL_INFO_USERID]));
     }
     $html .= Form::getTextfield($this->_lang->def('_LASTNAME'), 'up_lastname', 'up_lastname', '255', Get::req('up_lastname', DOTY_MIXED, $this->user_info[ACL_INFO_LASTNAME], true)) . Form::getTextfield($this->_lang->def('_FIRSTNAME'), 'up_firstname', 'up_firstname', '255', Get::req('up_firstname', DOTY_MIXED, $this->user_info[ACL_INFO_FIRSTNAME], true)) . Form::getTextfield($this->_lang->def('_EMAIL'), 'up_email', 'up_email', '255', Get::req('up_email', DOTY_MIXED, $this->user_info[ACL_INFO_EMAIL], true));
     // user extra field ------------------------------------------------------------------
     $html .= $this->getPlayField();
     $html .= $preference->getModifyMask('ui.');
     if ($this->_user_profile->godMode()) {
         $acl_man =& Docebo::user()->getAclManager();
         $html .= Form::getPassword(Lang::t('_NEW_PASSWORD', 'register'), 'up_new_pwd', 'up_new_pwd', '255');
         $html .= Form::getPassword(Lang::t('_RETYPE_PASSWORD', 'register'), 'up_repeat_pwd', 'up_repeat_pwd', '255');
         if (Docebo::user()->getUserLevelId() == ADMIN_GROUP_GODADMIN && Get::cur_plat() === 'framework') {
             $html .= Form::getCheckBox(Lang::t('_FORCE_PASSWORD_CHANGE', 'admin_directory'), 'force_changepwd', 'force_changepwd', 1, $this->user_info[ACL_INFO_FORCE_CHANGE]);
         }
         $lv_lang =& DoceboLanguage::createInstance('admin_directory', 'framework');
         if (Docebo::user()->getUserLevelId() == ADMIN_GROUP_GODADMIN) {
             $level_list = array(ADMIN_GROUP_GODADMIN => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_GODADMIN), ADMIN_GROUP_ADMIN => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_ADMIN), ADMIN_GROUP_PUBLICADMIN => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_PUBLICADMIN), ADMIN_GROUP_USER => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_USER));
         } else {
             $level_list = array(ADMIN_GROUP_USER => $lv_lang->def('_DIRECTORY_' . ADMIN_GROUP_USER));
         }
         $html .= Form::getDropdown($this->_lang->def('_LEVEL'), 'up_level', 'up_level', $level_list, $acl_man->getUserLevelId($this->_user_profile->getIdUser()));
     }
     // Social ------------------------------------------------------------------
     /* $html.=Form::getTextfield(	$this->_lang->def('_FACEBOOK_ID'),
     										'facebook_id',
     										'facebook_id',
     										'255',
     										Get::req('facebook_id', DOTY_MIXED, $this->user_info[ACL_INFO_FACEBOOK_ID], true ) );
     
     		$html.=Form::getTextfield(	$this->_lang->def('_TWITTER_ID'),
     										'twitter_id',
     										'twitter_id',
     										'255',
     										Get::req('twitter_id', DOTY_MIXED, $this->user_info[ACL_INFO_TWITTER_ID], true ) );
     
     		$html.=Form::getTextfield(	$this->_lang->def('_LINKEDIN_ID'),
     										'linkedin_id',
     										'linkedin_id',
     										'255',
     										Get::req('linkedin_id', DOTY_MIXED, $this->user_info[ACL_INFO_LINKEDIN_ID], true ) );
     
     		$html.=Form::getTextfield(	$this->_lang->def('_GOOGLE_ID'),
     										'google_id',
     										'google_id',
     										'255',
     										Get::req('google_id', DOTY_MIXED, $this->user_info[ACL_INFO_GOOGLE_ID], true ) ); */
     //signature --------------------------------------------------------------------------
     $html .= Form::getTextarea($this->_lang->def('_SIGNATURE'), 'up_signature', 'up_signature', Get::req('up_signature', DOTY_MIXED, $this->user_info[ACL_INFO_SIGNATURE], true));
     if (isset($_GET['modname']) && $_GET['modname'] == 'reservation') {
         $html .= Form::openButtonSpace() . Form::getButton('save', 'save', $this->_lang->def('_SAVE')) . Form::getButton('undo_profile', 'undo_profile', $this->_lang->def('_UNDO')) . Form::closeButtonSpace();
         $html .= Form::closeForm() . '</div>';
     } else {
         $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;
 }
Example #15
0
function deftime()
{
    checkPerm('view', false, 'storage');
    $lang =& DoceboLanguage::createInstance('test');
    require_once _base_ . '/lib/lib.form.php';
    $idTest = importVar('idTest', true, 0);
    $back_url = urldecode(importVar('back_url'));
    $url_coded = htmlentities(urlencode($back_url));
    list($time_dependent, $time_assigned, $penality_test, $penality_time_test, $penality_quest, $penality_time_quest) = sql_fetch_row(sql_query("\r\n\tSELECT time_dependent, time_assigned, \r\n\t\tpenality_test, penality_time_test, penality_quest, penality_time_quest \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_test \r\n\tWHERE idTest = '{$idTest}'"));
    if (isset($_POST['undo'])) {
        Util::jump_to('index.php?modname=test&op=modtestgui&idTest=' . $idTest . '&back_url=' . $url_coded);
    }
    if (isset($_POST['settime_button'])) {
        // second step, ask for time
        switch ($_POST['time_limit']) {
            case 0:
                $update_query = "\r\n\t\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_test \r\n\t\t\t\tSET time_dependent = 0, \r\n\t\t\t\t\ttime_assigned = '" . $_POST['time_assigned'] . "' \r\n\t\t\t\tWHERE idTest = '{$idTest}'";
                if (!sql_query($update_query)) {
                    errorCommunication($lang->def('_OPERATION_FAILURE') . getBackUi('index.php?modname=test&amp;op=deftime&amp;idTest=' . $idTest . '&amp;back_url=' . $url_coded, $lang->def('_BACK')));
                    return;
                }
                Util::jump_to('index.php?modname=test&op=modtestgui&idTest=' . $idTest . '&back_url=' . $url_coded . '&mod_operation=1');
                break;
            case 1:
                $GLOBALS['page']->add(getTitleArea($lang->def('_TEST_SECTION'), 'test') . '<div class="std_block">' . '<div class="title_big">' . $lang->def('_TEST_TIME_MANAGEMENT') . '</div>' . getBackUi('index.php?modname=test&amp;op=modtestgui&amp;idTest=' . $idTest . '&amp;back_url=' . $url_coded, $lang->def('_BACK')) . Form::openForm('deftime', 'index.php?modname=test&amp;op=updatetime') . Form::getHidden('idTest', 'idTest', $idTest) . Form::getHidden('back_url', 'back_url', $url_coded) . Form::getHidden('time_limit', 'time_limit', $_POST['time_limit']) . Form::getOpenFieldset($lang->def('_TEST_TM_TWO')) . Form::getLineBox($lang->def('_TOTAL_TIME'), $time_assigned . ' ' . $lang->def('_SECONDS')) . Form::getTextfield($lang->def('_TEST_TM2_NEWTIMETOTAL'), 'time_assigned', 'time_assigned', 5, $time_assigned, $lang->def('_TEST_TM2_NEWTIMETOTAL'), $lang->def('_SECONDS')) . Form::getCloseFieldset() . Form::openButtonSpace() . Form::getButton('settime_button', 'settime_button', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
                break;
            case 2:
                list($actual_tot_time) = sql_fetch_row(sql_query("\r\n\t\t\t\tSELECT SUM(time_assigned) \r\n\t\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_testquest \r\n\t\t\t\tWHERE idTest = '{$idTest}'"));
                $GLOBALS['page']->add(getTitleArea($lang->def('_TEST_SECTION'), 'test') . '<div class="std_block">' . '<div class="title_big">' . $lang->def('_TEST_TIME_MANAGEMENT') . '</div>' . getBackUi('index.php?modname=test&amp;op=modtestgui&amp;idTest=' . $idTest . '&amp;back_url=' . $url_coded, $lang->def('_BACK')) . Form::openForm('deftime', 'index.php?modname=test&amp;op=updatetime') . Form::getHidden('idTest', 'idTest', $idTest) . Form::getHidden('back_url', 'back_url', $url_coded) . Form::getHidden('time_limit', 'time_limit', $_POST['time_limit']) . Form::getOpenFieldset($lang->def('_TEST_TM_THREE')) . Form::getLineBox($lang->def('_TOTAL_TIME'), $actual_tot_time . ' ' . $lang->def('_SECONDS')) . Form::getTextfield($lang->def('_TEST_TM2_NEWTIME'), 'new_time', 'new_time', 10, $actual_tot_time, $lang->def('_TEST_TM2_NEWTIME'), $lang->def('_SECONDS')) . Form::getOpenCombo($lang->def('_TEST_TM2_SUBD_BY')) . Form::getRadio($lang->def('_TEST_PM_DIFFICULT'), 'point_diffcult', 'point_assignement', 0) . Form::getRadio($lang->def('_TEST_TM2_EQUALTOALL'), 'point_equaltoall', 'point_assignement', 1) . Form::getRadio($lang->def('_TEST_TM2_MANUAL'), 'point_manual', 'point_assignement', 2, true) . Form::getCloseCombo() . Form::getCloseFieldset() . Form::openButtonSpace() . Form::getButton('settime_button', 'settime_button', $lang->def('_TEST_TM2_SETTIME')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . '</div>', 'content');
                break;
        }
    } else {
        $GLOBALS['page']->add(getTitleArea($lang->def('_TEST_SECTION'), 'test') . '<div class="std_block">' . '<div class="title_big">' . $lang->def('_TEST_TIME_MANAGEMENT') . '</div>' . getBackUi('index.php?modname=test&amp;op=modtestgui&amp;idTest=' . $idTest . '&amp;back_url=' . $url_coded, $lang->def('_BACK')) . Form::openForm('deftime', 'index.php?modname=test&amp;op=deftime') . Form::getHidden('idTest', 'idTest', $idTest) . Form::getHidden('back_url', 'back_url', $url_coded) . Form::getOpenFieldset($lang->def('_TEST_TM_ONE')) . Form::getRadio($lang->def('_TEST_TIME_NO'), 'time_limit_no', 'time_limit', 0, $time_dependent == 0) . Form::getRadio($lang->def('_TEST_TIME_YES'), 'time_limit_yes', 'time_limit', 1, $time_dependent == 1) . Form::getRadio($lang->def('_TEST_TIME_YES_QUEST'), 'time_limit_yes_quest', 'time_limit', 2, $time_dependent == 2) . Form::getCloseFieldset() . Form::openButtonSpace() . Form::getButton('settime_button', 'settime_button', $lang->def('_TEST_TM2_SETTIME')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm() . getBackUi('index.php?modname=test&amp;op=modtestgui&amp;idTest=' . $idTest . '&amp;back_url=' . $url_coded, $lang->def('_BACK')) . '</div>', 'content');
    }
}
Example #16
0
 /**
  * display the field for interaction
  *
  * @param 	int		$id_user	if alredy exists a entry for the user load as default value
  * @param 	bool	$freeze	if true, disable the user interaction
  *
  * @return string 	of field xhtml code
  *
  * @access public
  */
 function play($id_user, $freeze, $mandatory = false, $do_not_show_label = false, $value = NULL)
 {
     require_once _base_ . '/lib/lib.form.php';
     if (isset($_POST['field_' . $this->getFieldType()]) && isset($_POST['field_' . $this->getFieldType()][$this->id_common])) {
         $user_entry = $_POST['field_' . $this->getFieldType()][$this->id_common];
     } else {
         list($user_entry) = sql_fetch_row(sql_query("\r\n\t\t\tSELECT user_entry\r\n\t\t\tFROM " . $this->_getUserEntryTable() . "\r\n\t\t\tWHERE id_user = '******' AND\r\n\t\t\t\tid_common = '" . (int) $this->id_common . "' AND\r\n\t\t\t\tid_common_son = '0'"));
     }
     $re_field = sql_query("\r\n\t\tSELECT translation\r\n\t\tFROM " . $this->_getMainTable() . "\r\n\t\tWHERE lang_code = '" . getLanguage() . "' AND id_common = '" . (int) $this->id_common . "' AND type_field = '" . $this->getFieldType() . "'");
     list($translation) = sql_fetch_row($re_field);
     if ($value !== NULL) {
         $user_entry = "" . $value;
     }
     if ($freeze) {
         return Form::getLineBox($translation . ' : ', $user_entry);
     }
     return Form::getSimpleTextarea($translation . ($mandatory ? ' <span class="mandatory">*</span>' : ''), 'field_' . $this->getFieldType() . '_' . $this->id_common, 'field_' . $this->getFieldType() . '[' . $this->id_common . ']', $user_entry);
 }
 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());
 }
Example #18
0
 /**
  * @param string $label_name
  * @param string $id
  * @param string $name
  * @param string $value
  * @param string $filename
  * @param string $show_current
  * @param string $show_del_checkbox
  * @param string $add_old_info
  * @param string $old_prefix
  * @param string $del_arr_name
  * @param string $alt_name
  * @param string $other_after
  * @param string $other_before
  */
 public static function getExtendedFileField($label_name, $id, $name, $value = FALSE, $filename = FALSE, $show_current = TRUE, $show_del_checkbox = TRUE, $add_old_info = TRUE, $old_prefix = FALSE, $del_arr_name = FALSE, $alt_name = '', $other_after = '', $other_before = '')
 {
     $res = "";
     $res .= '<div class="form_extended_file_field">';
     $res .= Form::getFilefield($label_name, $id, $name, $value, $alt_name, $other_after, $other_before);
     if ($show_current) {
         if ($value !== FALSE && !empty($value)) {
             if ($filename === FALSE) {
                 if (substr_count($value, "_") >= 3) {
                     $break_apart = explode('_', $value);
                     $break_apart[0] = $break_apart[1] = $break_apart[2] = '';
                     $filename = substr(implode('_', $break_apart), 3);
                 } else {
                     $filename = $value;
                 }
             }
             require_once _base_ . '/lib/lib.mimetype.php';
             $ext = strtolower(end(explode(".", $filename)));
             $img = "<img src=\"" . getPathImage('fw') . mimeDetect($filename) . "\" ";
             $img .= "alt=\"" . $ext . "\" title=\"" . $ext . "\" />";
             if ($show_del_checkbox) {
                 $del_arr_name = $del_arr_name !== FALSE ? $del_arr_name : "file_to_del";
                 $check_id = $del_arr_name . "_" . $id;
                 $check_name = $del_arr_name . "[" . $id . "]";
                 $checkbox = Form::getInputCheckbox($check_id, $check_name, $value, FALSE, "") . " ";
                 $checkbox .= Form::getLabel($check_id, Lang::t("_DELETE_FILE", "standard", "framework"), "nofloat");
                 $res .= Form::getLineBox($img . " " . $filename, $checkbox);
             } else {
                 $res .= Form::openFormLine();
                 $res .= Lang::t("_CURRENT_FILE", "standard", "framework") . ": " . $img . " " . $filename;
                 $res .= Form::closeFormLine();
             }
         } else {
             $res .= Form::openFormLine();
             $res .= Lang::t("_CURRENT_FILE", "standard", "framework") . ": " . Lang::t("_NONE", "standard", "framework");
             $res .= Form::closeFormLine();
         }
     }
     if ($add_old_info) {
         $old_prefix = $old_prefix !== FALSE ? $old_prefix : "old";
         $res .= "\n";
         $res .= Form::getHidden($old_prefix . "_" . $id, $old_prefix . "_" . $name, $value);
     }
     $res .= "</div>\n";
     return $res;
 }
Example #19
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>');
}
Example #20
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;
Example #21
0
 /**
  * display the field for interaction
  *
  * @param 	int		$id_user	if alredy exists a entry for the user load as default value
  * @param 	bool	$freeze		if true, disable the user interaction
  * @param 	bool	$mandatory			if true, the field is considered mandatory
  *
  * @return string 	of field xhtml code
  *
  * @access public
  */
 function play($id_user, $freeze, $mandatory = false, $do_not_show_label = false, $value = NULL)
 {
     $lang =& DoceboLanguage::createInstance('field', 'framework');
     require_once _base_ . '/lib/lib.form.php';
     if (isset($_POST['field_' . $this->getFieldType()]) && isset($_POST['field_' . $this->getFieldType()][$this->id_common])) {
         $user_entry = $_POST['field_' . $this->getFieldType()][$this->id_common];
     } else {
         list($user_entry) = sql_fetch_row(sql_query("\r\n\t\t\tSELECT user_entry\r\n\t\t\tFROM " . $this->_getUserEntryTable() . "\r\n\t\t\tWHERE id_user = '******' AND\r\n\t\t\t\tid_common = '" . (int) $this->id_common . "' AND\r\n\t\t\t\tid_common_son = '0'"));
     }
     $re_field = sql_query("\r\n\t\tSELECT translation\r\n\t\tFROM " . $this->_getMainTable() . "\r\n\t\tWHERE lang_code = '" . getLanguage() . "' AND id_common = '" . (int) $this->id_common . "' AND type_field = '" . $this->getFieldType() . "'");
     list($translation) = sql_fetch_row($re_field);
     switch ((int) $user_entry) {
         case 1:
             $field_value = $lang->def('_YES');
             break;
         case 2:
             $field_value = $lang->def('_NO');
             break;
         default:
             $field_value = $lang->def('_NOT_ASSIGNED');
             break;
     }
     if ($value !== NULL) {
         switch ((int) $value) {
             case 1:
                 $field_value = $lang->def('_YES');
                 break;
             case 2:
                 $field_value = $lang->def('_NO');
                 break;
             default:
                 $field_value = $lang->def('_NOT_ASSIGNED');
                 break;
         }
     }
     if ($freeze) {
         return Form::getLineBox($translation . ' : ', $field_value);
     }
     return Form::getRadioSet($translation . ($mandatory ? ' <span class="mandatory">*</span>' : ''), 'field_' . $this->getFieldType() . '_' . $this->id_common, 'field_' . $this->getFieldType() . '[' . $this->id_common . ']', array($lang->def('_YES') => 1, $lang->def('_NO') => 2, $lang->def('_NOT_ASSIGNED') => 0), (int) $user_entry, '', '');
 }