function adminConf()
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('admin_config', 'scs');
     $out =& $GLOBALS['page'];
     $out->setWorkingZone('content');
     $out->add(getTitleArea($lang->def('_ADMIN_CONF'), 'admin_conf') . '<div class="std_block">');
     if (isset($_POST['save'])) {
         $query_update = "UPDATE " . $GLOBALS['prefix_scs'] . "_rules_admin SET ";
         if (isset($_POST['rules'])) {
             while (list($var_name, $new_value) = each($_POST['rules'])) {
                 $query_update .= " {$var_name} = '" . $new_value . "',";
             }
             $re = sql_query(substr($query_update, 0, -1));
         }
         if ($re) {
             $out->add(getResultUi($lang->def('_MOD_OK')));
         } else {
             $out->add(getErrorUi($lang->def('_MOD_ERR')));
         }
     }
     $query_rules_admin = "\r\n\tSELECT server_status, \r\n\t\tenable_recording_function, enable_advice_insert, enable_write, enable_chat_recording, \r\n\t\tenable_private_subroom, enable_public_subroom, \r\n\t\tenable_drawboard_watch, enable_drawboard_write, \r\n\t\tenable_audio, enable_webcam, enable_stream_watch, enable_strem_write, enable_remote_desktop \r\n\tFROM " . $GLOBALS['prefix_scs'] . "_rules_admin";
     $re_rules_admin = sql_query($query_rules_admin);
     $rules = mysql_fetch_array($re_rules_admin);
     $out->add(Form::openForm('rules_admin', 'index.php?modname=admin_configuration&amp;op=conf') . Form::openElementSpace() . Form::getOpenCombo($lang->def('_SERVER_STATUS')) . Form::getInputRadio('rules_server_status_yes', 'rules[server_status]', 'yes', $rules['server_status'] == 'yes', '') . '&nbsp;' . Form::getLabel('', $lang->def('_YES'), 'label_padded') . '&nbsp;' . Form::getInputRadio('rules_server_status_no', 'rules[server_status]', 'no', $rules['server_status'] == 'no', '') . '&nbsp;' . Form::getLabel('', $lang->def('_NO'), 'label_padded') . '&nbsp;' . Form::getCloseCombo() . maskMultiple('enable_recording_function', $rules['enable_recording_function']) . maskMultiple('enable_advice_insert', $rules['enable_advice_insert']) . maskMultiple('enable_write', $rules['enable_write']) . maskMultiple('enable_chat_recording', $rules['enable_chat_recording']) . maskMultiple('enable_private_subroom', $rules['enable_private_subroom']) . maskMultiple('enable_public_subroom', $rules['enable_public_subroom']) . maskMultiple('enable_drawboard_watch', $rules['enable_drawboard_watch']) . maskMultiple('enable_drawboard_write', $rules['enable_drawboard_write']) . maskMultiple('enable_audio', $rules['enable_audio']) . maskMultiple('enable_webcam', $rules['enable_webcam']) . maskMultiple('enable_stream_watch', $rules['enable_stream_watch']) . maskMultiple('enable_strem_write', $rules['enable_strem_write']) . maskMultiple('enable_remote_desktop', $rules['enable_remote_desktop']) . Form::closeElementSpace() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace() . Form::closeForm());
     $out->add('</div>');
 }
Example #2
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 #3
0
/**
 * The UI for create (insert) a new connector
 * @param Module $module the caller module
 **/
function ioTask_UIConnectorNew(&$module)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.form.php';
    $connMgr =& $module->get_connMgr();
    $lang =& $module->get_lang();
    $out =& $module->get_out();
    $form = new Form();
    $count = 0;
    $out->setWorkingZone('content');
    $out->add(getTitleArea($lang->def('_CONNECTOR'), 'iotask'));
    $out->add('<div class="std_block">');
    $out->add($form->getFormHeader($lang->def('_ADD_NEW_CONNECTOR')));
    $out->add($form->openForm('connector_new', 'index.php?modname=iotask&op=display&addconnector&gotab=connectors'));
    $out->add($form->openElementSpace());
    // list all files in connectos directory
    $dir = dir($GLOBALS['where_framework'] . '/lib/connectors');
    while (FALSE !== ($entry = $dir->read())) {
        if (substr($entry, 0, 10) == 'connector.') {
            if ($connMgr->get_connector_byfile($entry) == FALSE) {
                $count++;
                $out->add($form->getLabel('file_' . $entry, $entry) . $form->getButton('file_' . $entry, 'file[' . $entry . ']', $lang->def('_ADD')) . '<br/>');
            }
        }
    }
    if ($count == 0) {
        $out->add($lang->def('_NO_NEW_CONNECTORS'));
    }
    $out->add($form->closeElementSpace());
    $out->add($form->openButtonSpace());
    $out->add($form->getButton('cancel', 'cancel', $lang->def('_CANCEL')));
    $out->add($form->closeButtonSpace());
    $out->add($form->closeForm());
    $out->add('</div>');
}
Example #4
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('admin_config', 'scs');
     if ($regroup == 'root') {
         return $this->_getRoot();
     }
     $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 "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 "enum":
                 //on off
                 $html .= Form::openFormLine() . Form::getLabel($var_name . '_on', $lang->def('_' . strtoupper($var_name))) . Form::getInputCheckbox($var_name . '_on', 'option[' . $var_name . ']', 'on', $var_value == 'on', '') . Form::closeFormLine();
                 break;
             case "check":
                 //on off
                 $html .= Form::getCheckbox($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', 1, $var_value == 1);
                 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;
 }
Example #5
0
function mycourses(&$url)
{
    checkPerm('view');
    require_once _base_ . '/lib/lib.user_profile.php';
    $lang =& DoceboLanguage::createInstance('catalogue');
    require_once $GLOBALS['where_lms'] . '/lib/lib.middlearea.php';
    $ma = new Man_MiddleArea();
    $course_stats = userCourseList($url, $ma->currentCanAccessObj('lo_tab'));
    $access_career = $ma->currentCanAccessObj('career');
    $access_news = $ma->currentCanAccessObj('news');
    $access_search_form = $ma->currentCanAccessObj('search_form');
    $access_user_details_full = $ma->currentCanAccessObj('user_details_full');
    $access_user_details_short = $ma->currentCanAccessObj('user_details_short');
    $onecol = !$access_career && !$access_news && !$access_user_details_full && !$access_user_details_short;
    require_once $GLOBALS['where_framework'] . '/lib/lib.myfriends.php';
    $friends = new MyFriends(getLogUserId());
    $pendent = count($friends->getPendentRequest());
    $GLOBALS['page']->addStart('' . '<div id="mycourse_top">' . ($onecol ? '' : '<div class="mycourse_left">'), 'content');
    // user_details_short ------------------------------------------------------------------------
    if ($access_user_details_short) {
        $profile = new UserProfile(getLogUserId());
        $profile->init('profile', 'framework', 'index.php?r=' . _after_login_, 'ap');
        $GLOBALS['page']->addStart($profile->userIdMailProfile('normal', false, false), 'content');
    }
    // user_details_full ------------------------------------------------------------------------
    if ($access_user_details_full) {
        $profile = new UserProfile(getLogUserId());
        $profile->init('profile', 'framework', 'index.php?r=' . _after_login_, 'ap');
        $GLOBALS['page']->addStart($profile->homeUserProfile('normal', false, false), 'content');
    }
    // career ------------------------------------------------------------------------
    if ($access_career) {
        $base_url = 'index.php?r=' . _after_login_ . '&amp;filter=';
        $end = 0;
        if (isset($course_stats['with_ustatus'][_CUS_END]) && $course_stats['with_ustatus'][_CUS_END] != 0) {
            $end = $course_stats['with_ustatus'][_CUS_END];
        }
        $GLOBALS['page']->addStart('' . '<div class="course_stat">' . '<table summary="">' . '<caption>' . $lang->def('_CAREER') . '</caption>' . '<tr><th scope="row">' . $lang->def('_TOTAL_COURSE') . ' :</th><td><a href="' . $base_url . 'nothing">' . ($course_stats['total'] - $end) . '</a></td></tr>' . (isset($course_stats['with_ustatus'][_CUS_END]) && $course_stats['with_ustatus'][_CUS_END] != 0 ? '<tr><th scope="row">' . $lang->def('_COURSE_END') . ' :</th><td><a href="' . $base_url . 'end">' . $course_stats['with_ustatus'][_CUS_END] . '</a></td></tr>' : '') . (isset($course_stats['expiring']) && $course_stats['expiring'] != 0 ? '<tr><th scope="row">' . $lang->def('_COURSE_EXPIRING') . ' :</th><td><a href="' . $base_url . 'expiring">' . $course_stats['expiring'] . '</a></td></tr>' : ''), 'content');
        if (count($course_stats['with_ulevel']) > 1) {
            require_once $GLOBALS['where_lms'] . '/lib/lib.levels.php';
            $lvl = CourseLevel::getLevels();
            foreach ($course_stats['with_ulevel'] as $lvl_num => $quantity) {
                $GLOBALS['page']->addStart('' . '<tr><th scope="row">' . str_replace('[level]', $lvl[$lvl_num], $lang->def('_COURSE_AS')) . ' :</th><td><a href="' . $base_url . 'level&amp;filter_on=' . $lvl_num . '">' . $quantity . '</a></td></tr>', 'content');
            }
            //end foreach
        }
        $query = "SELECT c.idMetaCertificate, m.idCertificate" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course as c" . " JOIN " . $GLOBALS['prefix_lms'] . "_certificate_meta as m ON c.idMetaCertificate = m.idMetaCertificate" . " WHERE c.idUser = '******'" . " GROUP BY c.idMetaCertificate" . " ORDER BY m.title, m.description";
        $result = sql_query($query);
        $num_meta_cert = mysql_num_rows($result);
        while (list($id_meta, $id_certificate) = sql_fetch_row($result)) {
            $query_released = "SELECT on_date" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_assign" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'";
            $result_released = sql_query($query_released);
            $query = "SELECT user_release" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate" . " WHERE id_certificate = '" . $id_certificate . "'";
            list($user_release) = sql_fetch_row(sql_query($query));
            if (mysql_num_rows($result_released)) {
            } elseif ($user_release == 0) {
                $num_meta_cert--;
            } else {
                $query = "SELECT idCourse" . " FROM " . $GLOBALS['prefix_lms'] . "_certificate_meta_course" . " WHERE idUser = '******'" . " AND idMetaCertificate = '" . $id_meta . "'";
                $result_int = sql_query($query);
                $control = true;
                while (list($id_course) = sql_fetch_row($result_int)) {
                    $query = "SELECT COUNT(*)" . " FROM " . $GLOBALS['prefix_lms'] . "_courseuser" . " WHERE idCourse = '" . $id_course . "'" . " AND idUser = '******'" . " AND status = '" . _CUS_END . "'";
                    list($number) = sql_fetch_row(sql_query($query));
                    if (!$number) {
                        $control = false;
                    }
                }
                if (!$control) {
                    $num_meta_cert--;
                }
            }
        }
        $tot_cert = $num_meta_cert + $course_stats['cert_relesable'];
        $GLOBALS['page']->addStart('' . (isset($course_stats['cert_relesable']) && $tot_cert != 0 ? '<tr><th scope="row">' . $lang->def('_CERT_RELESABLE') . ' :</th><td><a href="index.php?modname=mycertificate&amp;op=mycertificate">' . $tot_cert . '</a></td></tr>' : '') . ($pendent != 0 ? '<tr><th scope="row">' . $lang->def('_FRIEND_PENDENT') . ' :</th><td><a href="index.php?modname=myfriends&amp;op=myfriends">' . $pendent . '</a></td></tr>' : '') . '</table>' . '</div>', 'content');
    }
    // career ------------------------------------------------------------------------
    if ($access_search_form) {
        $year_array = array(0 => $lang->def('_ALL_YEAR'));
        $query_year = "SELECT DISTINCT create_date" . " FROM " . $GLOBALS['prefix_lms'] . "_course";
        $result = sql_query($query_year);
        while (list($year) = sql_fetch_row($result)) {
            $year_array[$year[0] . $year[1] . $year[2] . $year[3]] = $year[0] . $year[1] . $year[2] . $year[3];
        }
        if (isset($year_array['0000'])) {
            unset($year_array['0000']);
        }
        $GLOBALS['page']->addStart('' . '<div class="course_search">' . '<h2>' . $lang->def('_SEARCH') . '</h2>' . Form::openForm('course_filter', 'index.php?modname=course&amp;op=mycourses') . '<p>' . Form::getLabel('search', $lang->def('_WORD')) . '</p>' . Form::getInputTextfield('textfield_nowh', 'search', 'search', importVar('search'), $lang->def('_WORD'), '255', '') . '<br/>' . '<p>' . Form::getLabel('year', $lang->def('_YEAR')) . '</p>' . Form::getInputDropdown('dropdown_nowh', 'year', 'year', $year_array, importVar('year'), '') . Form::getButton('apply_filter', 'apply_filter', $lang->def('_SEARCH')) . Form::closeForm() . '</div>', 'content');
    }
    // news ------------------------------------------------------------------------
    if ($access_news) {
        $GLOBALS['page']->addStart('' . '<div class="course_news">' . '<h2>' . $lang->def('_NEWS') . '</h2>', 'content');
        $user_level = Docebo::user()->getUserLevelId();
        $user_assigned = Docebo::user()->getArrSt();
        $query_news = "\r\n\t\tSELECT idNews, publish_date, title, short_desc, important, viewer\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_news_internal\r\n\t\tWHERE language = '" . getLanguage() . "'\r\n\t\tORDER BY important DESC, publish_date DESC ";
        $re_news = sql_query($query_news);
        $displayed = 0;
        while (list($id_news, $publish_date, $title, $short_desc, $impo, $viewer) = sql_fetch_row($re_news)) {
            $viewer = is_string($viewer) && $viewer != false ? unserialize($viewer) : array();
            $intersect = array_intersect($user_assigned, $viewer);
            if (!empty($intersect) || empty($viewer)) {
                $GLOBALS['page']->addStart('<h3>' . $title . '</h3>' . '<div class="news_textof">' . '<span class="news_data">' . Format::date($publish_date, 'date') . ' - </span>' . $short_desc . '</div>', 'content');
                $displayed++;
            }
        }
        // end news display
        if (!$displayed) {
            $GLOBALS['page']->addStart($lang->def('_NO_CONTENT'), 'content');
        }
        $GLOBALS['page']->addStart('' . '</div>', 'content');
    }
    if (!$onecol) {
        $GLOBALS['page']->addStart('' . '</div>', 'content');
        $GLOBALS['page']->addStart('' . '<div id="mycourse_right">', 'content');
    }
    // ------------------------------------------------------------------------
    if (!$onecol) {
        $GLOBALS['page']->addEnd('' . '</div>' . '<div class="nofloat"></div>', 'content');
    }
    $GLOBALS['page']->addEnd('' . '</div>', 'content');
    if ($ma->currentCanAccessObj('lo_tab')) {
        $current_tab = importVar('current_tab', false, 'lo_plan');
        $GLOBALS['page']->addStart('<div class="lo_tab">' . '<h1>' . $lang->def('_WELCOME') . ': ' . '<span>' . Docebo::user()->getUserName() . '</span>' . '</h1>' . '<ul class="flat_tab">' . ($course_stats['with_ustatus'][_CUS_END] != $course_stats['total'] ? '<li ' . ($current_tab == 'lo_plan' ? 'class="now_selected"' : '') . '>' . '<a href="index.php?modname=course&amp;op=mycourses&amp;current_tab=lo_plan"><span>' . $lang->def('_COURSE') . '</span></a></li>' : '') . ($course_stats['with_ustatus'][_CUS_END] != 0 ? '<li ' . ($current_tab == 'lo_history' ? 'class="now_selected"' : '') . '>' . '<a href="index.php?modname=course&amp;op=mycourses&amp;current_tab=lo_history"><span>' . $lang->def('_COMPLETED') . '</span></a></li>' : '') . ($course_stats['with_wstatus'][_CUS_RESERVED] != 0 || $course_stats['with_wstatus'][_CUS_WAITING_LIST] != 0 ? '<li ' . ($current_tab == 'lo_waiting' ? 'class="now_selected"' : '') . '>' . '<a href="index.php?modname=course&amp;op=mycourses&amp;current_tab=lo_waiting"><span>' . $lang->def('_LO_WAITING') . '</span></a></li>' : '') . '</ul>' . '</div>', 'content');
    } else {
        $GLOBALS['page']->addStart('<div class="lo_tab">' . '<h1 class="no_tab">' . $lang->def('_WELCOME') . ': ' . '<span>' . Docebo::user()->getUserName() . '</span>' . '</h1>' . '</div>', 'content');
    }
}
Example #6
0
function modactivityscore()
{
    checkPerm('mod');
    require_once $GLOBALS['where_lms'] . '/lib/lib.coursereport.php';
    require_once _base_ . '/lib/lib.form.php';
    require_once _base_ . '/lib/lib.table.php';
    // XXX: Initializaing
    $id_report = importVar('id_report', true, 0);
    $lang =& DoceboLanguage::createInstance('coursereport', 'lms');
    $out =& $GLOBALS['page'];
    $out->setWorkingZone('content');
    // XXX: Instance management
    $acl_man = Docebo::user()->getAclManager();
    $report_man = new CourseReportManager();
    // XXX: Find users
    $type_filter = false;
    if (isset($_GET['type_filter']) && $_GET['type_filter'] != null) {
        $type_filter = $_GET['type_filter'];
    }
    $lev = $type_filter;
    $students = getSubscribed((int) $_SESSION['idCourse'], FALSE, $lev, TRUE, false, false, true);
    $id_students = array_keys($students);
    $students_info =& $acl_man->getUsers($id_students);
    if (isset($_POST['save'])) {
        // retirive activity info
        $info_report = array('id_report' => importVar('id_report', true, 0), 'title' => importVar('title'), 'max_score' => importVar('max_score', true), 'required_score' => importVar('required_score', true), 'source_of' => importVar('source_of'), 'weight' => importVar('weight', true), 'show_to_user' => importVar('show_to_user', false, 'true'), 'use_for_final' => importVar('use_for_final', false, 'true'));
        // XXX: retrive scores
    } else {
        // retirive activity info
        $query_report = "\r\n\t\tSELECT id_report, title, max_score, required_score, weight, show_to_user, use_for_final, id_source, source_of\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_coursereport\r\n\t\tWHERE id_course = '" . $_SESSION['idCourse'] . "' AND id_report = '" . $id_report . "'\r\n\t\t\t\tAND (source_of = 'scoitem' OR source_of = 'activity')";
        // TBD AND id_source = '0'";
        $info_report = sql_fetch_assoc(sql_query($query_report));
        // XXX: retrive scores
        $report_score =& $report_man->getReportsScores(array($id_report));
    }
    // XXX: Write in output
    $page_title = array('index.php?modname=coursereport&amp;op=coursereport' => $lang->def('_COURSEREPORT', 'menu_course'), strip_tags($info_report['title']));
    $out->add(getTitleArea($page_title, 'coursereport') . '<div class="std_block">' . Form::openForm('activity', 'index.php?modname=coursereport&amp;op=modactivityscore'));
    // XXX: Save input if needed
    if (isset($_POST['save'])) {
        if ($_POST['title'] == '') {
            $_POST['title'] = $lang->def('_NOTITLE');
        }
        $re_check = $report_man->checkActivityData($_POST);
        if (!$re_check['error']) {
            if (!$report_man->updateActivity($id_report, $_SESSION['idCourse'], $info_report)) {
                $out->add(getErrorUi($lang->def('_OPERATION_FAILURE')));
            } else {
                // save user score modification
                $query_upd_report = "\r\n\t\t\t\tUPDATE " . $GLOBALS['prefix_lms'] . "_coursereport\r\n\t\t\t\tSET weight = '" . $info_report['weight'] . "',\r\n\t\t\t\t\tuse_for_final = '" . $info_report['use_for_final'] . "',\r\n\t\t\t\t\tshow_to_user = '******'show_to_user'] . "'\r\n\t\t\t\tWHERE id_course = '" . $_SESSION['idCourse'] . "' AND id_report = '" . $id_report . "'";
                $re = sql_query($query_upd_report);
                $re = $report_man->saveReportScore($id_report, $_POST['user_score'], $_POST['date_attempt'], $_POST['comment']);
                Util::jump_to('index.php?modname=coursereport&amp;op=coursereport&result=' . ($re ? 'ok' : 'err'));
            }
        } else {
            $out->add(getErrorUi($re_check['message']));
        }
    }
    // main form
    $out->add(Form::openElementSpace() . Form::getOpenFieldSet($lang->def('_ACTIVITY_INFO')) . Form::getHidden('id_report', 'id_report', $id_report) . Form::getHidden('id_source', 'id_source', $info_report['id_source']) . Form::getHidden('source_of', 'source_of', $info_report['source_of']));
    // for scorm object changing title, maxScore and requiredScore is not allowed
    switch ($info_report['source_of']) {
        case 'scoitem':
            $out->add(Form::getLinebox($lang->def('_TITLE_ACT'), strip_tags($info_report['title'])) . Form::getLinebox($lang->def('_MAX_SCORE'), strip_tags($info_report['max_score'])) . Form::getLinebox($lang->def('_REQUIRED_SCORE'), strip_tags($info_report['required_score'])));
            break;
        case 'activity':
            $out->add(Form::getTextfield($lang->def('_TITLE_ACT'), 'title', 'title', '255', $info_report['title']) . Form::getTextfield($lang->def('_MAX_SCORE'), 'max_score', 'max_score', '11', $info_report['max_score']) . Form::getTextfield($lang->def('_REQUIRED_SCORE'), 'required_score', 'required_score', '11', $info_report['required_score']));
            break;
    }
    $out->add(Form::getTextfield($lang->def('_WEIGHT'), 'weight', 'weight', '11', $info_report['weight']) . Form::getDropdown($lang->def('_SHOW_TO_USER'), 'show_to_user', 'show_to_user', array('true' => $lang->def('_YES'), 'false' => $lang->def('_NO')), $info_report['show_to_user']) . Form::getDropdown($lang->def('_USE_FOR_FINAL'), 'use_for_final', 'use_for_final', array('true' => $lang->def('_YES'), 'false' => $lang->def('_NO')), $info_report['use_for_final']) . Form::getCloseFieldSet() . Form::closeElementSpace());
    if ($info_report['source_of'] != 'scoitem') {
        /* XXX: scores */
        $tb = new Table(0, $lang->def('_STUDENTS_VOTE'), $lang->def('_STUDENTS_VOTE'));
        $type_h = array('', 'align-center', 'align-center', '');
        $tb->setColsStyle($type_h);
        $cont_h = array($lang->def('_STUDENTS'), $lang->def('_SCORE'), $lang->def('_DATE'), $lang->def('_COMMENTS'));
        $tb->addHead($cont_h);
        // XXX: Display user scores
        $i = 0;
        while (list($idst_user, $user_info) = each($students_info)) {
            $user_name = $user_info[ACL_INFO_LASTNAME] . $user_info[ACL_INFO_FIRSTNAME] ? $user_info[ACL_INFO_LASTNAME] . ' ' . $user_info[ACL_INFO_FIRSTNAME] : $acl_man->relativeId($user_info[ACL_INFO_USERID]);
            $cont = array(Form::getLabel('user_score_' . $idst_user, $user_name));
            $cont[] = Form::getInputTextfield('textfield_nowh', 'user_score_' . $idst_user, 'user_score[' . $idst_user . ']', isset($report_score[$id_report][$idst_user]['score']) ? $report_score[$id_report][$idst_user]['score'] : (isset($_POST['user_score'][$idst_user]) ? $_POST['user_score'][$idst_user] : ''), strip_tags($lang->def('_SCORE')), '8', ' tabindex="' . $i++ . '" ');
            $cont[] = Form::getInputDatefield('textfield_nowh', 'date_attempt_' . $idst_user, 'date_attempt[' . $idst_user . ']', Format::date(isset($report_score[$id_report][$idst_user]['date_attempt']) ? $report_score[$id_report][$idst_user]['date_attempt'] : (isset($_POST['date_attempt'][$idst_user]) ? $_POST['date_attempt'][$idst_user] : ''), 'date'));
            $cont[] = Form::getInputTextarea('comment_' . $idst_user, 'comment[' . $idst_user . ']', isset($report_score[$id_report][$idst_user]['comment']) ? $report_score[$id_report][$idst_user]['comment'] : (isset($_POST['comment'][$idst_user]) ? stripslashes($_POST['comment'][$idst_user]) : ''), 'textarea_wh_full', 2);
            $tb->addBody($cont);
        }
    }
    $out->add(Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace());
    if ($info_report['source_of'] != 'scoitem') {
        $out->add($tb->getTable() . Form::openButtonSpace() . Form::getButton('save', 'save', $lang->def('_SAVE')) . Form::getButton('undo', 'undo', $lang->def('_UNDO')) . Form::closeButtonSpace());
    }
    $out->add(Form::closeForm() . '</div>');
}
Example #7
0
 function maskMultiple($name, $value)
 {
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('admin_config', 'scs');
     return Form::getOpenCombo($lang->def('_' . strtoupper($name))) . Form::getInputRadio('rules_' . $name . '_admin', 'rules[' . $name . ']', 'admin', $value == 'admin', '') . '&nbsp' . Form::getLabel('rules_' . $name . '_admin', $lang->def('_ADMIN'), 'label_padded') . '&nbsp' . Form::getInputRadio('rules_' . $name . '_alluser', 'rules[' . $name . ']', 'alluser', $value == 'alluser', '') . '&nbsp' . Form::getLabel('rules_' . $name . '_alluser', $lang->def('_ALLUSER'), 'label_padded') . '&nbsp' . Form::getInputRadio('rules_' . $name . '_noone', 'rules[' . $name . ']', 'noone', $value == 'noone', '') . '&nbsp' . Form::getLabel('rules_' . $name . '_noone', $lang->def('_NOONE'), 'label_padded') . '&nbsp' . Form::getCloseCombo();
 }
Example #8
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 the mod mask
  */
 function getModifyMask($base_path = false, $only_visible = true, $separate_output = false)
 {
     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 = array();
     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();
                 $langs_var = Docebo::langManager()->getAllLangCode();
                 $langs = array();
                 foreach ($langs_var as $k => $v) {
                     $langs[$k] = $v;
                 }
                 /* XXX: remove when alll lang ready*/
                 $html[$pref['path_name']] = Form::getDropdown($lang->def($pref['label']), $this->base_name . '_' . $pref['path_name'], $this->base_name . '[' . $pref['path_name'] . ']', $langs, array_search($lang_sel, $langs));
                 break;
             case "template":
                 //drop down template
                 $templ_sel = $this->getTemplate();
                 $templ = getTemplateList();
                 $html[$pref['path_name']] = Form::getDropdown($lang->def($pref['label']), $this->base_name . '_' . $pref['path_name'], $this->base_name . '[' . $pref['path_name'] . ']', $templ, array_search($templ_sel, $templ));
                 break;
             case "hteditor":
                 //drop down hteditor
                 $ht_edit = getHTMLEditorList();
                 $html[$pref['path_name']] = Form::getDropdown($lang->def($pref['label']), $this->base_name . '_' . $pref['path_name'], $this->base_name . '[' . $pref['path_name'] . ']', $ht_edit, $pref['user_value'] ? $pref['user_value'] : $pref['default_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[$pref['path_name']] = Form::getDropdown($lang->def($pref['label']), $this->base_name . '_' . $pref['path_name'], $this->base_name . '[' . $pref['path_name'] . ']', $layout, $pref['user_value'] ? $pref['user_value'] : $pref['default_value']);
                 break;
             case "enum":
                 //on off
                 $value = $pref['user_value'] ? $pref['user_value'] : $pref['default_value'];
                 $html[$pref['path_name']] = Form::openFormLine() . Form::getInputCheckbox($this->base_name . '_' . $pref['path_name'] . '_on', $this->base_name . '[' . $pref['path_name'] . ']', 'on', $value == 'on', '') . ' ' . Form::getLabel($this->base_name . '_' . $pref['path_name'] . '_on', $lang->def($pref['label'])) . Form::closeFormLine();
                 break;
                 //string or int
             //string or int
             default:
                 $html[$pref['path_name']] = Form::getTextfield($lang->def($pref['label']), $this->base_name . '_' . $pref['path_name'], $this->base_name . '[' . $pref['path_name'] . ']', '65535', $pref['user_value'] ? $pref['user_value'] : $pref['default_value']);
         }
     }
     return $separate_output ? $html : implode("", $html) . '<div class="nofloat"></div>';
 }
Example #9
0
 /**
  * Assign fields mandatory and user for group
  **/
 function loadAssignField2($groupid)
 {
     $arr_fields = $_POST[DIRECTORY_ID][DIRECTORY_OP_ADDFIELD];
     $idst_group = $_POST[DIRECTORY_ID]['idst_group'];
     require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
     if (isset($_POST[DIRECTORY_ID]['save_assignfield2'])) {
         $fl = new FieldList();
         $arr_fields_mandatory = $_POST[DIRECTORY_ID]['field_mandatory'];
         $arr_fields_useraccess = $_POST[DIRECTORY_ID]['field_useraccess'];
         foreach ($arr_fields as $id_filed => $status) {
             switch ($status) {
                 case GROUP_FIELD_NO:
                     $fl->removeFieldFromGroup($id_filed, $idst_group);
                     break;
                 case GROUP_FIELD_NORMAL:
                     $fl->addFieldToGroup($id_filed, $idst_group, isset($arr_fields_mandatory[$id_filed]) ? $arr_fields_mandatory[$id_filed] : 'false', isset($arr_fields_useraccess[$id_filed]) ? $arr_fields_useraccess[$id_filed] : 'readonly');
                     break;
             }
         }
         Util::jump_to('index.php?modname=directory&op=listgroup');
     } elseif (isset($_POST[DIRECTORY_ID]['cancel_assignfield'])) {
         Util::jump_to('index.php?modname=directory&op=listgroup');
     }
     $fl = new FieldList();
     $arr_all_fields = $fl->getAllFields();
     require_once _base_ . '/lib/lib.form.php';
     $form = new Form();
     $GLOBALS['page']->setWorkingZone('content');
     $GLOBALS['page']->add(getTitleArea($this->lang->def('_GROUPS') . ': ' . $groupid, 'directory_group'));
     $GLOBALS['page']->add('<div class="std_block">');
     $GLOBALS['page']->add($form->openForm('directoryassignfieldgroupmandatory', 'index.php?modname=directory&amp;op=assignfieldmandatory'));
     $GLOBALS['page']->add($form->openElementSpace());
     // print custom fields status
     $arr_fields_normal = $fl->getFieldsFromIdst(array($idst_group));
     $GLOBALS['page']->add($form->getHidden(DIRECTORY_ID . '_idst_group', DIRECTORY_ID . '[idst_group]', $idst_group));
     foreach ($arr_fields as $id_filed => $status) {
         $GLOBALS['page']->add($form->getHidden(DIRECTORY_ID . '_' . $id_filed, DIRECTORY_ID . '[' . DIRECTORY_OP_ADDFIELD . '][' . $id_filed . ']', $status));
     }
     $GLOBALS['page']->add($form->openFormLine() . '<div class="label_effect">&nbsp;</div>' . '<div class="label_head">' . $this->lang->def('_MANDATORY') . '</div>' . '<div class="label_head">' . $this->lang->def('_DIRECTORY_GROUP_FIELD_WRITE') . '</div>' . $form->closeFormLine());
     // checkbox for mandatory and useraccess
     foreach ($arr_fields as $id_filed => $status) {
         if ($status == GROUP_FIELD_NORMAL) {
             $GLOBALS['page']->add($form->openFormLine() . '<div class="label_effect">' . $arr_all_fields[$id_filed][FIELD_INFO_TRANSLATION] . '</div>' . '<input class="label_head" type="checkbox"' . ' id="' . DIRECTORY_ID . '_' . $id_filed . '_mandatory"' . ' name="' . DIRECTORY_ID . '[field_mandatory][' . $id_filed . ']"' . ' value="true"');
             if (isset($arr_fields_normal[$id_filed]) && $arr_fields_normal[$id_filed][FIELD_INFO_MANDATORY] == 'true') {
                 $GLOBALS['page']->add(' checked="checked"');
             }
             $GLOBALS['page']->add(' />');
             $GLOBALS['page']->add($form->getLabel(DIRECTORY_ID . '_' . $id_filed . '_mandatory', $this->lang->def('_MANDATORY'), 'label_bold access-only'));
             // checkbox for useraccess
             $GLOBALS['page']->add('<input class="label_head" type="checkbox"' . ' id="' . DIRECTORY_ID . '_' . $id_filed . '_useraccess"' . ' name="' . DIRECTORY_ID . '[field_useraccess][' . $id_filed . ']"' . ' value="readwrite"');
             if (isset($arr_fields_normal[$id_filed]) && $arr_fields_normal[$id_filed][FIELD_INFO_USERACCESS] == 'readwrite') {
                 $GLOBALS['page']->add(' checked="checked"');
             }
             $GLOBALS['page']->add(' />');
             $GLOBALS['page']->add($form->getLabel(DIRECTORY_ID . '_' . $id_filed . '_useraccess', $this->lang->def('_DIRECTORY_GROUP_FIELD_WRITE'), 'label_bold access-only'));
             $GLOBALS['page']->add($form->closeFormLine());
         }
     }
     $GLOBALS['page']->add($form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('save_assignfield2' . DIRECTORY_ID, DIRECTORY_ID . '[save_assignfield2]', $this->lang->def('_SAVE')) . $form->getButton('cancel_assignfield' . DIRECTORY_ID, DIRECTORY_ID . '[cancel_assignfield]', $this->lang->def('_UNDO')) . $form->closeButtonSpace());
 }
Example #10
0
 /**
  * this function manage a field
  *
  * @param  string	$back	indicates the return url
  * @return nothing
  *
  * @access public
  */
 function edit($back)
 {
     $back_coded = htmlentities(urlencode($back));
     $array_lang = array();
     $std_lang =& DoceboLanguage::createInstance('standard');
     $lang =& DoceboLanguage::createInstance('field');
     $array_lang = Docebo::langManager()->getAllLangCode();
     $out =& $GLOBALS['page'];
     if (isset($_POST['undo'])) {
         //undo action
         Util::jump_to($back . '&result=undo');
     }
     if (isset($_POST['save_field_' . $this->getFieldType()])) {
         //insert mandatory translation
         $mand_lang = getLanguage();
         //control if all is ok
         /*if(!isset($_POST['new_textlabel'][$mand_lang])) {
                   $out->add(
                           getErrorUi($lang->def('_ERR_MUST_DEF_MANADATORY_TRANSLATION'))
                           .getBackUi($this->getUrl().'&amp;type_field='
                                   .$this->getFieldType().'&amp;back='.$back_coded, $std_lang->def('_BACK')),
                           'content'
                   );
                   return;
           }
           if($_POST['new_textlabel'][$mand_lang] == $lang->def('_FIELD_NAME') || trim($_POST['new_textlabel'][$mand_lang]) == '') {
                   $out->add(
                           getErrorUi($lang->def('_ERR_MUST_DEF_MANADATORY_TRANSLATION'))
                           .getBackUi($this->getUrl().'&amp;type_field='
                                   .$this->getFieldType().'&amp;back='.$back_coded, $std_lang->def('_BACK')),
                           'content'
                   );
                   return;
           }*/
         $existsing_translation = array();
         $re_trans = sql_query("\n                    SELECT lang_code\n                    FROM " . $this->_getMainTable() . "\n                    WHERE id_common = '" . $this->id_common . "'");
         while (list($l_code) = sql_fetch_row($re_trans)) {
             $existsing_translation[$l_code] = 1;
         }
         $use_multilang = isset($_POST['use_multi_lang']) ? 1 : 0;
         $re = true;
         //insert other field
         if (isset($_POST['show_on_platform'])) {
             while (list($code, ) = each($_POST['show_on_platform'])) {
                 $show_on .= $code . ',';
             }
         }
         //insert other field
         foreach ($_POST['new_textlabel'] as $lang_code => $translation) {
             if (isset($existsing_translation[$lang_code])) {
                 if (!sql_query("\n                                    UPDATE " . $this->_getMainTable() . "\n                                    SET translation = '" . $translation . "',\n                                            show_on_platform = '" . $show_on . "',\n                                            use_multilang = '" . $use_multilang . "'\n                                    WHERE id_common = '" . (int) $this->id_common . "' AND lang_code = '" . $lang_code . "'")) {
                     $re = false;
                 }
             } else {
                 if (!sql_query("\n                                    INSERT INTO " . $this->_getMainTable() . "\n                                    (type_field, id_common, lang_code, translation, show_on_platform, use_multilang ) VALUES\n                                    ('" . $this->getFieldType() . "', '" . (int) $this->id_common . "', '" . $lang_code . "', '" . $translation . "', '" . $show_on . "', '" . $use_multilang . "') ")) {
                     $re = false;
                 }
             }
         }
         Util::jump_to($back . '&result=' . ($re ? 'success' : 'fail'));
     }
     //load value form database
     $re_trans = sql_query("\n            SELECT lang_code, translation, show_on_platform, use_multilang\n            FROM " . $this->_getMainTable() . "\n            WHERE id_common = '" . $this->id_common . "'");
     while (list($l_code, $trans, $show_on, $db_use_multilang) = sql_fetch_row($re_trans)) {
         $translation[$l_code] = $trans;
         if (!isset($show_on_platform)) {
             $show_on_platform = array_flip(explode(',', $show_on));
         }
         if (!isset($use_multilang)) {
             $use_multilang = $db_use_multilang;
         }
     }
     require_once _base_ . '/lib/lib.form.php';
     $form = new Form();
     $out->setWorkingZone('content');
     $out->add('<div class="std_block">');
     $out->add('<div class="label_block"><p><b>' . $form->getLabel($for, Lang::t('_LABEL_ALERT', 'field')) . '</b> ' . $form->getLabel($for, Lang::t('_LABEL_ALERT_MESSAGE', 'field')) . '</p></div>');
     $out->add($form->openForm('create_' . $this->getFieldType(), $this->getUrl()) . $form->openElementSpace() . $form->getHidden('type_field', 'type_field', $this->getFieldType()) . $form->getHidden('id_common', 'id_common', $this->id_common) . $form->getHidden('back', 'back', $back_coded));
     $mand_lang = getLanguage();
     foreach ($array_lang as $k => $lang_code) {
         $out->add($form->getTextfield(($mand_lang == $lang_code ? '<span class="mandatory">*</span>' : '') . $lang_code, 'new_textlabel_' . $lang_code, 'new_textlabel[' . $lang_code . ']', 255, isset($translation[$lang_code]) ? $translation[$lang_code] : '', $lang_code . ' ' . $lang->def('_FIELD_NAME')));
     }
     $GLOBALS['page']->add($this->getMultiLangCheck($use_multilang), 'content');
     $GLOBALS['page']->add($this->getShowOnPlatformFieldset($show_on_platform), 'content');
     $out->add($form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('save_field', 'save_field_' . $this->getFieldType(), $std_lang->def('_SAVE', 'standard')) . $form->getButton('undo', 'undo', $std_lang->def('_UNDO', 'standard')) . $form->closeButtonSpace() . $form->closeForm());
     $out->add('</div>');
 }
Example #11
0
 function loadSimpleSelector($anonymous = true, $orgchart_button = false)
 {
     $res = "";
     require_once _base_ . '/lib/lib.table.php';
     require_once _base_ . "/lib/lib.form.php";
     $lang =& DoceboLanguage::createInstance('simplesel', 'framework');
     $form = new Form();
     $acl_manger = Docebo::user()->getAclManager();
     $anonymous_idst = $acl_manger->getAnonymousId();
     $res .= getBackUi($this->getLink("back"), $lang->def("_BACK"));
     if ($this->hasManualSelection()) {
         $msg = $lang->def('_MSG_HASMANUAL_1') . " \"" . $lang->def('_MANUAL_SEL') . "\" " . $lang->def('_MSG_HASMANUAL_2');
         $res .= getInfoUi($msg);
     }
     $url = $this->getLink("main");
     $res .= $form->openForm("simple_selector", $url);
     $vis_item = $GLOBALS["framework"]["visuItem"];
     $tab = new Table(2, $lang->def("_SIMPLESEL_TITLE"), $lang->def("_SIMPLESEL_TITLE"));
     $head_type = array('');
     $head = array($lang->def("_USERS"));
     foreach ($this->getPermList() as $key => $val) {
         $head_type[] = "image";
         $img = "<img src=\"" . $val["img"] . "\" alt=\"" . $val["alt"] . "\" ";
         $img .= "title=\"" . $val["alt"] . "\" />";
         $head[] = $img;
     }
     $tab->setColsStyle($head_type);
     $tab->addHead($head);
     $users_list = $this->getSimpleUserList();
     $saved_data = $this->getSavedData();
     if (!$anonymous) {
         unset($users_list[$anonymous_idst]);
     }
     foreach ($users_list as $idst => $label) {
         $rowcnt = array($label);
         foreach ($this->getPermList() as $key => $val) {
             $chk = false;
             if (isset($saved_data[$key]) && is_array($saved_data[$key])) {
                 if (in_array($idst, array_keys($saved_data[$key]))) {
                     $chk = true;
                 }
             }
             $check_box = $form->getLabel($key . "_" . $idst . "_", $lang->def("_VIEW") . " " . $label, "access-only");
             $check_box .= $form->getInputCheckbox($key . "_" . $idst . "_", $key . "[" . $idst . "]", 1, $chk, NULL);
             $rowcnt[] = $check_box;
         }
         $tab->addBody($rowcnt);
     }
     $res .= $tab->getTable();
     $res .= $form->getHidden("saved_data", "saved_data", urlencode(serialize($saved_data)));
     $res .= $form->openButtonSpace();
     if ($orgchart_button) {
         $res .= $form->getButton('orgchartselector', 'orgchartselector', $lang->def('_ORGCHART_SEL'), "transparent_aslink_button") . ' ';
     }
     $res .= $form->getButton('manualselector', 'manualselector', $lang->def('_MANUAL_SEL'), "transparent_aslink_button");
     $res .= $form->closeButtonSpace();
     $res .= $form->openButtonSpace();
     $res .= $form->getButton('okselector', 'okselector', $lang->def('_CONFIRM'));
     $res .= $form->getButton('cancelselector', 'cancelselector', $lang->def('_UNDO'));
     $res .= $form->closeButtonSpace();
     $res .= $form->closeForm();
     return $res;
 }
Example #12
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;
 }
Example #13
0
 /**
  * @param 	string	contains the group selected
  *
  * @return 	string 	contains the displayable information for a selected group
  */
 function getPageWithElement($group_selected)
 {
     if ($group_selected != 'user_manager') {
         return '';
     }
     require_once _base_ . '/lib/lib.form.php';
     $lang =& DoceboLanguage::createInstance('user_managment', '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 pack = 'log_option' 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 "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();
                 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);
                 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);
                 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();
                 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)), 'label_bold') . Form::closeFormLine();
                 break;
                 //uncrypted password
             //uncrypted password
             case "password":
                 $html .= Form::getPassword($lang->def('_' . strtoupper($var_name)), $var_name, 'option[' . $var_name . ']', $max_size, $var_value);
                 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;
 }
 public function multimod_dialog()
 {
     if (!$this->permissions['subscribe_course']) {
         $output = array('success' => false, 'message' => $this->_getMessage("no permission"));
         echo $this->json->encode($output);
         return;
     }
     $output = array();
     if (Get::req('count_sel', DOTY_INT, 0) <= 0) {
         $output['success'] = true;
         $output['header'] = Lang::t('_MOD', 'subscribe') . '&nbsp;';
         $output['body'] = '<p>' . Lang::t('_EMPTY_SELECTION', 'admin_directory') . '</p>';
         echo $this->json->encode($output);
         return;
     }
     $sel_level = Form::getInputCheckbox('multimod_level_set', 'multimod_level_set', 1, false, '') . ' ';
     $sel_status = Form::getInputCheckbox('multimod_status_set', 'multimod_status_set', 1, false, '') . ' ';
     $sel_date_begin = Form::getInputCheckbox('multimod_date_begin_set', 'multimod_date_begin_set', 1, false, '') . ' ';
     $sel_date_expire = Form::getInputCheckbox('multimod_date_expire_set', 'multimod_date_expire_set', 1, false, '') . ' ';
     $sel_date_begin_reset = Form::getInputCheckbox('multimod_date_begin_reset', 'multimod_date_begin_reset', 1, false, '') . ' ';
     $sel_date_expire_reset = Form::getInputCheckbox('multimod_date_expire_reset', 'multimod_date_expire_reset', 1, false, '') . ' ';
     $body = Form::openForm('multimod_dialog', 'ajax.adm_server.php?r=' . $this->link . '/multimod') . Form::getDropdown(Lang::t('_LEVEL', 'subscribe'), 'multimod_level', 'multimod_level', $this->model->getUserLevelList(), '', '', $sel_level) . Form::getDropdown(Lang::t('_STATUS', 'subscribe'), 'multimod_status', 'multimod_status', $this->model->getUserStatusList(), '', '', $sel_status) . Form::getDatefield(Lang::t('_DATE_BEGIN_VALIDITY', 'subscribe'), 'multimod_date_begin', 'multimod_date_begin', '', false, false, '', '', $sel_date_begin) . Form::getDateField(Lang::t('_DATE_EXPIRE_VALIDITY', 'subscribe'), 'multimod_date_expire', 'multimod_date_expire', '', false, false, '', '', $sel_date_expire) . Form::openFormLine() . $sel_date_begin_reset . '<p>' . Form::getLabel('multimod_date_begin_reset', Lang::t('_RESET', 'subscribe') . ': ' . Lang::t('_DATE_BEGIN_VALIDITY', 'subscribe')) . '</p>' . Form::closeFormLine() . Form::openFormLine() . $sel_date_expire_reset . '<p>' . Form::getLabel('multimod_date_expire_reset', Lang::t('_RESET', 'subscribe') . ': ' . Lang::t('_DATE_EXPIRE_VALIDITY', 'subscribe')) . '</p>' . Form::closeFormLine() . Form::getHidden('mod_dialog_users', 'users', '') . Form::getHidden('id_course', 'id_course', $this->id_course) . Form::getHidden('id_edition', 'id_edition', $this->id_edition) . Form::getHidden('id_date', 'id_date', $this->id_date) . Form::closeForm();
     $output['success'] = true;
     $output['header'] = Lang::t('_MOD', 'subscribe') . '&nbsp;';
     $output['body'] = $body;
     //$output['script'] = 'YAHOO.util.Dom.get("mod_dialog_users").value = DataTableSelector_subscribed_table.toString();';
     $output['__date_inputs'] = $GLOBALS['date_inputs'];
     echo $this->json->encode($output);
 }
Example #15
0
 function getAddCommentMask($ext_key)
 {
     require_once _base_ . '/lib/lib.form.php';
     $html = '' . Form::openForm('ajax_comment_add', '', false, false, '', ' onSubmit="addajaxcomment(); return false;"') . Form::getHidden('ajaxcomment_ext_key', 'ajaxcomment_ext_key', $ext_key) . Form::getHidden('ajaxcomment_reply_to', 'ajaxcomment_reply_to', '0') . '<p>' . Form::getLabel('ajaxcomment_textof', Lang::t('_COMMENTS', $this->_module, $this->_platform), 'label_bold') . '</p>' . '<p>' . Form::getInputTextarea('ajaxcomment_textof', 'ajaxcomment_textof', '') . '</p>' . '<p>' . Form::getButton('ajaxcomment_send', 'ajaxcomment_send', Lang::t('_SEND', $this->_module, $this->_platform), '') . '</p>' . Form::closeForm();
     return $html;
 }
Example #16
0
 function loadAssignField2()
 {
     require_once _base_ . '/lib/lib.table.php';
     $arr_fields = $_POST[$this->id]['field_set'];
     $idst_group = $_POST[$this->id]['idst_group'];
     $idst_desc = $_POST[$this->id]['idst_desc'];
     require_once $GLOBALS['where_framework'] . '/lib/lib.field.php';
     $fl = new FieldList();
     $arr_all_fields = $fl->getAllFields();
     require_once _base_ . '/lib/lib.form.php';
     $form = new Form();
     $tree .= $form->openElementSpace();
     $tree .= $this->printState();
     // print custom fields status
     $arr_fields_normal = $fl->getFieldsFromIdst(array($idst_group));
     $arr_fields_descend = $fl->getFieldsFromIdst(array($idst_desc));
     foreach ($arr_fields_descend as $id_field => $field) {
         $arr_fields_normal[$id_field] = $field;
     }
     $tree .= $form->getHidden($this->id . '_idst_group', $this->id . '[idst_group]', $idst_group);
     $tree .= $form->getHidden($this->id . '_idst_desc', $this->id . '[idst_desc]', $idst_desc);
     foreach ($arr_fields as $id_filed => $status) {
         $tree .= $form->getHidden($this->id . '_' . $id_filed, $this->id . '[field_set][' . $id_filed . ']', $status);
     }
     /*
     $tree .= $form->openFormLine();
     $tree .= '<div class="label_effect">&nbsp;</div>';
     $tree .= '<div class="label_head">'.$this->lang->def('_MANDATORY').'</div>';
     $tree .= '<div class="label_head">'.$this->lang->def('_ORG_CHART_FIELD_WRITE').'</div>';
     $tree .= $form->closeFormLine();
     */
     $tb = new Table(0, $this->lang->def('_TITLE'), $this->lang->def('_TITLE'));
     $tb->setTableStyle('tree_org_table_field');
     $tb->addHeadCustom('<tr class="first_intest">' . '<th scope="col" abbr="' . $this->lang->def('_NAME') . '">' . $this->lang->def('_FIELD_NAME') . '</th>' . '<th scope="col" abbr="' . $this->lang->def('_MANDATORY') . '">' . $this->lang->def('_MANDATORY') . '</th>' . '<th scope="col" abbr="' . $this->lang->def('_ORG_CHART_FIELD_WRITE_ABBR') . '">' . $this->lang->def('_ORG_CHART_FIELD_WRITE') . '</th>' . '</tr>');
     // checkbox for mandatory and useraccess
     foreach ($arr_fields as $id_filed => $status) {
         if ($status == ORG_CHART_FIELD_NORMAL || $status == ORG_CHART_FIELD_DESCEND) {
             /*$tree .= $form->openFormLine();
             		// field title
             		$tree .= '<div class="label_effect">'.$arr_all_fields[$id_filed][FIELD_INFO_TRANSLATION].'</div>';
             		// checkbox for mandatory
             		$tree .= '<input class="checkbox" type="checkbox"'
             					.' id="'.$this->id.'_'.$id_filed.'_mandatory"'
             					.' name="'.$this->id.'[field_mandatory]['.$id_filed.']"'
             					.' value="true"';
             		if( isset( $arr_fields_normal[$id_filed] ) && $arr_fields_normal[$id_filed][FIELD_INFO_MANDATORY] == 'true' )
             			$tree .= ' checked="checked"';
             		$tree .= ' />';
             		$tree .= $form->getLabel( $this->id.'_'.$id_filed.'_mandatory', $this->lang->def('_MANDATORY'), 'label_bold access-only' );
             		// checkbox for useraccess
             		$tree .= '<input class="checkbox" type="checkbox"'
             					.' id="'.$this->id.'_'.$id_filed.'_useraccess"'
             					.' name="'.$this->id.'[field_useraccess]['.$id_filed.']"'
             					.' value="readwrite"';
             		if( isset( $arr_fields_normal[$id_filed] ) && $arr_fields_normal[$id_filed][FIELD_INFO_USERACCESS] == 'readwrite' )
             			$tree .= ' checked="checked"';
             		$tree .= ' />';
             		$tree .= $form->getLabel( $this->id.'_'.$id_filed.'_useraccess', $this->lang->def('_ORG_CHART_FIELD_WRITE'), 'label_bold access-only' );
             		$tree .= $form->closeFormLine();*/
             $input_manadatory = '<input class="checkbox" type="checkbox"' . ' id="' . $this->id . '_' . $id_filed . '_mandatory"' . ' name="' . $this->id . '[field_mandatory][' . $id_filed . ']"' . ' value="true"';
             if (isset($arr_fields_normal[$id_filed]) && $arr_fields_normal[$id_filed][FIELD_INFO_MANDATORY] == 'true') {
                 $input_manadatory .= ' checked="checked"';
             }
             $input_manadatory .= ' />' . $form->getLabel($this->id . '_' . $id_filed . '_mandatory', $this->lang->def('_MANDATORY'), 'label_bold access-only');
             $input_useraccess = '<input class="checkbox" type="checkbox"' . ' id="' . $this->id . '_' . $id_filed . '_useraccess"' . ' name="' . $this->id . '[field_useraccess][' . $id_filed . ']"' . ' value="readwrite"';
             if (isset($arr_fields_normal[$id_filed]) && $arr_fields_normal[$id_filed][FIELD_INFO_USERACCESS] == 'readwrite') {
                 $input_useraccess .= ' checked="checked"';
             }
             $input_useraccess .= ' />' . $form->getLabel($this->id . '_' . $id_filed . '_useraccess', $this->lang->def('_ORG_CHART_FIELD_WRITE'), 'label_bold access-only');
             $tb->addHeadCustom('<tr>' . '<th scope="row">' . $arr_all_fields[$id_filed][FIELD_INFO_TRANSLATION] . '</th>' . '<td>' . $input_manadatory . '</td>' . '<td>' . $input_useraccess . '</td>' . '</tr>');
         }
     }
     $tree .= $tb->getTable();
     $tree .= $form->closeElementSpace() . $form->openButtonSpace() . $form->getButton('save_assignfield' . $this->id, $this->id . '[save_assignfield]', $this->lang->def('_SAVE')) . $form->getButton($this->_getCancelId(), $this->_getCancelId(), $this->lang->def('_UNDO')) . $form->closeButtonSpace();
     return $tree;
 }