Пример #1
0
 /**
  * print in standard output
  **/
 function loadReport($idUser = FALSE, $mvc = false)
 {
     require_once _track_scorm_basepath . 'scorm_stats.php';
     require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
     if ($idUser !== false) {
         $this->idReference = getLOParam($this->idParams, 'idReference');
         return scorm_userstat($this->idResource, $idUser, $this->idReference, $mvc);
     }
 }
Пример #2
0
    function play($object_link, $id_param)
    {
        //-kb-play-// if(!checkPerm('view', true, 'organization') && !checkPerm('view', true, 'storage')) die("You can't access");
        $lang =& DoceboLanguage::createInstance('link');
        $idCategory = $object_link->getId();
        $mode = importVar('mode', false, 'link');
        $back_coded = htmlentities(urlencode($object_link->back_url));
        require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
        $idReference = getLOParam($id_param, 'idReference');
        // NOTE: Track only if $idReference is present
        if ($idReference !== FALSE) {
            require_once $GLOBALS['where_lms'] . '/class.module/track.link.php';
            list($exist, $idTrack) = Track_Link::getIdTrack($idReference, getLogUserId(), $idCategory, TRUE);
            if ($exist) {
                $ti = new Track_Link($idTrack);
                $ti->setDate(date('Y-m-d H:i:s'));
                $ti->status = 'completed';
                $ti->update();
            } else {
                $ti = new Track_Link(false);
                $ti->createTrack($idReference, $idTrack, getLogUserId(), date('Y-m-d H:i:s'), 'completed', 'link');
            }
        }
        list($title) = sql_fetch_row(sql_query("\r\n\tSELECT title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_link_cat \r\n\tWHERE idCategory = '" . (int) $idCategory . "'"));
        $link = 'index.php?modname=link&op=play&idCategory=' . $idCategory . '&id_param=' . $id_param . '&back_url=' . $back_coded;
        /*$GLOBALS['page']->add('<div id="top" class="std_block">'
        		.'<div class="colum_container">' */
        cout('<div id="top" class="yui-navset yui-navset-top tab_block">
		<ul class="yui-nav">
			<li class="first' . ($mode != 'keyw' ? ' selected' : '') . '">
				<a href="' . $link . '&amp;mode=list">
					<em>' . Lang::t('_SWITCH_TO_LIST', 'link') . '</em>
				</a>
			</li>
			<li' . ($mode == 'keyw' ? ' class="selected"' : '') . '>
				<a href="' . $link . '&amp;mode=keyw">
					<em>' . Lang::t('_SWITCH_TO_KEYWORD', 'link') . '</em>
				</a>
			</li>
		</ul>
		<div class="yui-content">', 'content');
        cout(getBackUi(Util::str_replace_once('&', '&amp;', $object_link->back_url), $lang->def('_BACK')), 'content');
        $GLOBALS['page']->add('<b>' . $lang->def('_TITLE') . ' : ' . $title . '</b><br /><br />' . $lang->def('_LINKIUNNEWWINDOW') . '<br /><br />', 'content');
        if ($mode == 'keyw') {
            displayAsKey($idCategory, $link . '&amp;mode=keyw');
        } else {
            displayAsList($idCategory);
        }
        $GLOBALS['page']->add('<div class="align_center">' . '<a href="#top"><img src="' . getPathImage() . 'standard/up.png" title="' . $lang->def('_BACKTOTOP') . '" />' . $lang->def('_BACKTOTOP') . '</a>' . getBackUi(Util::str_replace_once('&', '&amp;', $object_link->back_url), $lang->def('_BACK')) . '</div>', 'content');
        cout('</div></div>', 'content');
    }
Пример #3
0
function play($idResource, $idParams, $back_url)
{
    //if(!checkPerm('view', true, 'organization') && !checkPerm('view', true, 'storage')) die("You can't access");
    //echo ("idResource = ".$idResource."; idParams = ".$idParams."; back_url = ".$back_url);
    list($file) = sql_fetch_row(sql_query("SELECT path" . " FROM " . $GLOBALS['prefix_lms'] . "_materials_lesson" . " WHERE idLesson = '" . $idResource . "'"));
    //recognize mime type
    $expFileName = explode('.', $file);
    $totPart = count($expFileName) - 1;
    require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
    $idReference = getLOParam($idParams, 'idReference');
    // NOTE: Track only if $idReference is present
    if ($idReference !== FALSE) {
        require_once $GLOBALS['where_lms'] . '/class.module/track.item.php';
        list($exist, $idTrack) = Track_Item::getIdTrack($idReference, getLogUserId(), $idResource, TRUE);
        if ($exist) {
            $ti = new Track_Item($idTrack);
            $ti->setDate(date('Y-m-d H:i:s'));
            $ti->status = 'completed';
            $ti->update();
        } else {
            $ti = new Track_Item(false);
            $ti->createTrack($idReference, $idTrack, getLogUserId(), date('Y-m-d H:i:s'), 'completed', 'item');
        }
    }
    if ($_SESSION['direct_play'] == 1) {
        if (isset($_SESSION['idCourse'])) {
            TrackUser::closeSessionCourseTrack();
            unset($_SESSION['idCourse']);
            unset($_SESSION['idEdition']);
        }
        if (isset($_SESSION['test_assessment'])) {
            unset($_SESSION['test_assessment']);
        }
        if (isset($_SESSION['cp_assessment_effect'])) {
            unset($_SESSION['cp_assessment_effect']);
        }
        $_SESSION['current_main_menu'] = '1';
        $_SESSION['sel_module_id'] = '1';
        $_SESSION['is_ghost'] = false;
    }
    //send file
    sendFile('/appLms/' . Get::sett('pathlesson'), $file, $expFileName[$totPart]);
}
Пример #4
0
/**
 * @return idParam if $idParam == NULL
 * else bool
 **/
function setLOParam($idParam, $param_name, $param_value)
{
    if ($idParam === NULL) {
        $query = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_lo_param " . "( idParam, param_name, param_value )" . " VALUES " . "( '0', '" . $param_name . "', '" . $param_value . "' )";
        if (sql_query($query)) {
            $idParam = mysql_insert_id();
            $query = "UPDATE " . $GLOBALS['prefix_lms'] . "_lo_param SET " . " idParam='" . (int) $idParam . "'" . "WHERE id = '" . (int) $idParam . "'";
        } else {
            errorCommunication('setLOParam');
        }
    } else {
        $val = getLOParam($idParam, $param_name);
        if ($val === FALSE) {
            $query = "INSERT INTO " . $GLOBALS['prefix_lms'] . "_lo_param " . "( idParam, param_name, param_value )" . " VALUES " . "( '" . (int) $idParam . "', '" . $param_name . "', '" . $param_value . "' )";
        } else {
            $query = "UPDATE " . $GLOBALS['prefix_lms'] . "_lo_param SET " . " param_value='" . $param_value . "'" . "WHERE idParam = '" . (int) $idParam . "'" . "  AND param_name = '" . $param_name . "'";
        }
    }
    sql_query($query) or errorCommunication('setLOParam');
    return $idParam;
}
Пример #5
0
 /**
  * function play( $id, $id_param, $back_url )
  * @param int $id contains the resource id
  * @param int $id_param contains the id needed for params retriving
  * @param string $back_url contain the back url
  * @return nothing return
  **/
 function play($id, $id_param, $back_url)
 {
     require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
     require_once Docebo::inc(_lms_ . '/modules/scorm/scorm.php');
     $idReference = getLOParam($id_param, 'idReference');
     $autoplay = getLOParam($id_param, 'autoplay');
     $playertemplate = getLOParam($id_param, 'playertemplate');
     play($id, $idReference, $back_url, $autoplay, $playertemplate);
     //Util::jump_to( 'index.php?modname=scorm&op=play&idscorm_organization='.$this->idResource
     //		.'&idReference='.$idReference);
 }
Пример #6
0
function user_report($idUser, $idTest, $id_param = false, $id_track = false, $mvc = false)
{
    if (!checkPerm('view', true, 'organization') && !checkPerm('view', true, 'storage')) {
        die("You can't access");
    }
    $lang =& DoceboLanguage::createInstance('test');
    if ($id_param !== false) {
        require_once _lms_ . '/lib/lib.param.php';
        $idReference = getLOParam($id_param, 'idReference');
        if (!Track_Test::isTrack($idUser, $idTest, $idReference)) {
            return;
        }
        //load existing info track
        $track_info = Track_Test::getTrackInfo($idUser, $idTest, $idReference);
        $idTrack = $track_info['idTrack'];
    } else {
        $idTrack = $id_track;
    }
    //test info---------------------------------------------------------
    list($title, $mod_doanswer, $point_type, $point_required, $question_random_number, $show_score, $show_score_cat, $show_doanswer, $show_solution, $order_type) = sql_fetch_row(sql_query("\r\n\tSELECT  title, mod_doanswer, point_type, point_required, question_random_number, \r\n\t\t\tshow_score, show_score_cat, show_doanswer, \r\n\t\t\tshow_solution, order_type\r\n\tFROM %lms_test\r\n\tWHERE idTest = '" . (int) $idTest . "'"));
    list($score, $bonus_score, $date_attempt, $date_attempt_mod) = sql_fetch_row(sql_query("\r\n\tSELECT score, bonus_score, date_attempt, date_attempt_mod \r\n\tFROM %lms_testtrack\r\n\tWHERE idTrack = '" . (int) $idTrack . "'"));
    $point_do = $bonus_score;
    $max_score = 0;
    $num_manual = 0;
    $manual_score = 0;
    $quest_sequence_number = 1;
    $report_test = '';
    $point_do_cat = array();
    /*
    	$reQuest = sql_query("
    	SELECT q.idQuest, q.type_quest, t.type_file, t.type_class, q.idCategory 
    	FROM ".$GLOBALS['prefix_lms']."_testquest AS q JOIN ".$GLOBALS['prefix_lms']."_quest_type AS t 
    	WHERE q.idTest = '".$idTest."' AND q.type_quest = t.type_quest 
    	ORDER BY q.sequence");*/
    if ($order_type >= 2) {
        $re_visu_quest = sql_query("SELECT idQuest \r\n\t\tFROM %lms_testtrack_quest\r\n\t\tWHERE idTrack = '" . (int) $idTrack . "' ");
        while (list($id_q) = sql_fetch_row($re_visu_quest)) {
            $quest_see[] = $id_q;
        }
        $query_question = "\r\n\t\tSELECT q.idQuest, q.type_quest, t.type_file, t.type_class, q.idCategory \r\n\t\tFROM %lms_testquest AS q JOIN %lms_quest_type AS t\r\n\t\tWHERE q.idTest = '" . $idTest . "' AND q.type_quest = t.type_quest AND  q.idQuest IN (" . implode($quest_see, ',') . ") \r\n\t\tORDER BY q.sequence";
    } else {
        $query_question = "\r\n\t\tSELECT q.idQuest, q.type_quest, t.type_file, t.type_class, q.idCategory \r\n\t\tFROM %lms_testquest AS q JOIN %lms_quest_type AS t\r\n\t\tWHERE q.idTest = '" . $idTest . "' AND q.type_quest = t.type_quest \r\n\t\tORDER BY q.sequence";
    }
    $reQuest = sql_query($query_question);
    while (list($id_quest, $type_quest, $type_file, $type_class, $id_cat) = sql_fetch_row($reQuest)) {
        require_once _lms_ . '/modules/question/' . $type_file;
        $quest_point_do = 0;
        $quest_obj = eval("return new {$type_class}( {$id_quest} );");
        $quest_point_do = $quest_obj->userScore($idTrack);
        $quest_max_score = $quest_obj->getMaxScore();
        if ($type_quest != 'title' && $type_quest != 'break_page') {
            $review = $quest_obj->displayUserResult($idTrack, $type_quest != 'title' ? $quest_sequence_number++ : $quest_sequence_number, $show_solution);
            $report_test .= '<div class="test_quest_review_container">' . $review['quest'];
            if ($review['score'] !== false) {
                $report_test .= '<div class="test_answer_comment">' . '<div class="test_score_note">' . $lang->def('_SCORE') . ' : ';
                if ($quest_obj->getScoreSetType() == 'manual' && !$review['manual_assigned']) {
                    $report_test .= $lang->def('_NOT_ASSIGNED');
                } else {
                    if ($review['score'] > 0) {
                        $report_test .= '<span class="test_score_positive">' . $review['score'] . '</span>';
                    } else {
                        $report_test .= '<span class="test_score_negative">' . $review['score'] . '</span>';
                    }
                }
                $report_test .= '</div>' . '</div>';
            }
            $report_test .= '</div>' . "\n";
        }
        if ($quest_obj->getScoreSetType() == 'manual') {
            ++$num_manual;
            $manual_score = round($manual_score + $quest_max_score, 2);
        }
        $point_do = round($point_do + $quest_point_do, 2);
        $max_score = round($max_score + $quest_max_score, 2);
        if (isset($point_do_cat[$id_cat])) {
            $point_do_cat[$id_cat] = round($point_do + $point_do_cat[$id_cat], 2);
        } else {
            $point_do_cat[$id_cat] = $point_do;
        }
    }
    //output variable, used in mvc mode
    $output = "";
    $str = "";
    if (!$mvc) {
        $str .= '<div class="std_block">';
    }
    $str .= '<div class="title">' . $lang->def('_TITLE') . ' : ' . $title . '</div><br />';
    if ($mvc) {
        $output .= $str;
    } else {
        $GLOBALS['page']->add($str, 'content');
    }
    if ($point_type != '1') {
        $save_score = $point_do;
    } else {
        $save_score = round(round($point_do / $max_score, 2) * 100, 2);
    }
    if ($show_score && $point_type != '1') {
        $str = '<span class="test_score_note">' . $lang->def('_TEST_TOTAL_SCORE') . '</span> ' . $point_do . ' / ' . $max_score . '<br />';
        if ($mvc) {
            $output .= $str;
        } else {
            $GLOBALS['page']->add($str, 'content');
        }
        if ($num_manual != 0) {
            $str = '<br /><span class="test_score_note">' . $lang->def('_TEST_MANUAL_SCORE') . '</span> ' . $manual_score . ' ' . $lang->def('_TEST_SCORES') . '<br />';
            if ($mvc) {
                $output .= $str;
            } else {
                $GLOBALS['page']->add($str, 'content');
            }
        }
    }
    if ($show_score && $point_type == '1') {
        $str = '<span class="test_score_note">' . $lang->def('_TEST_TOTAL_SCORE') . '</span> ' . $save_score . ' %' . '<br />';
        if ($mvc) {
            $output .= $str;
        } else {
            $GLOBALS['page']->add($str, 'content');
        }
        if ($num_manual != 0) {
            $str = '<br /><span class="test_score_note">' . $lang->def('_TEST_MANUAL_SCORE') . '</span> ' . $manual_score . ' ' . $lang->def('_TEST_SCORES') . '<br />';
            if ($mvc) {
                $output .= $str;
            } else {
                $GLOBALS['page']->add($str, 'content');
            }
        }
    }
    if ($show_score_cat) {
        $category = array();
        $reQuestCat = sql_query("\r\n\t\tSELECT idCategory \r\n\t\tFROM %lms_testquest\r\n\t\tWHERE idTest = '" . $idTest . "' AND idCategory != 0");
        while (list($id_cat) = sql_fetch_row($reQuestCat)) {
            $category[] = $id_cat;
        }
        if (!empty($category)) {
            require_once _lms_ . '/lib/lib.questcategory.php';
            $categories = Questcategory::getInfoAboutCategory($category);
            $str = '<br /><span class="test_score_note">' . $lang->def('_TEST_CATEGORY_SCORE') . '</span><br />';
            if ($mvc) {
                $output .= $str;
            } else {
                $GLOBALS['page']->add($str, 'content');
            }
            while (list($id_cat, $name_cat) = each($categories)) {
                $str = $name_cat . ', ' . $lang->def('_TEST_SCORES') . ': ' . (isset($point_do_cat[$id_cat]) ? $point_do_cat[$id_cat] : 0) . '<br />';
                if ($mvc) {
                    $output .= $str;
                } else {
                    $GLOBALS['page']->add($str, 'content');
                }
            }
        }
    }
    $str = '<br /><br /><div class="test_answer_space">' . $report_test . '</div>';
    if (!$mvc) {
        $str .= '</div>';
    }
    //end stdblock div
    if ($mvc) {
        return $output;
    } else {
        $GLOBALS['page']->add($str, 'content');
    }
}
Пример #7
0
 /**
  * function play( $id, $id_param, $back_url )
  * @param int $id contains the resource id
  * @param int $id_param contains the id needed for params retriving
  * @param string $back_url contain the back url
  * @return nothing return
  **/
 function play($id, $id_param, $back_url)
 {
     //-kb-play-// if(!checkPerm('view', true, 'organization') && !checkPerm('view', true, 'storage')) die("You can't access");
     $this->id = $id;
     $this->back_url = $back_url;
     $this->checkObjPerm();
     list($title, $textof) = sql_fetch_row(sql_query("\r\n\t\tSELECT title, textof \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_htmlpage \r\n\t\tWHERE idPage = '" . (int) $id . "'"));
     // recuper gli allegati
     $path = '/appLms/htmlpages/';
     $query = "SELECT * FROM " . $GLOBALS['prefix_lms'] . "_htmlpage_attachment WHERE idpage = " . $id;
     $res = mysql_query($query);
     $attachments = array();
     if ($res) {
         while ($row = mysql_fetch_assoc($res)) {
             $attachments[] = array('id' => $row['id'], 'title' => $row['title'], 'file' => $GLOBALS['where_files_relative'] . $path . $row['file']);
         }
     }
     require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
     $idReference = getLOParam($id_param, 'idReference');
     // NOTE: Track only if $idReference is present
     if ($idReference !== FALSE) {
         require_once $GLOBALS['where_lms'] . '/class.module/track.htmlpage.php';
         list($exist, $idTrack) = Track_Htmlpage::getIdTrack($idReference, getLogUserId(), $this->id, TRUE);
         if ($exist) {
             $ti = new Track_Htmlpage($idTrack);
             $ti->setDate(date('Y-m-d H:i:s'));
             $ti->status = 'completed';
             $ti->update();
         } else {
             $ti = new Track_Htmlpage(false);
             $ti->createTrack($idReference, $idTrack, getLogUserId(), date('Y-m-d H:i:s'), 'completed', 'htmlpage');
         }
     }
     $atts = '';
     foreach ($attachments as $attachment) {
         $atts .= "<a id=\"" . $attachment['id'] . "\" href=\"" . $attachment['file'] . "\" target=\"_blank\">" . $attachment['title'] . "</a><br/>";
     }
     $GLOBALS['page']->add('<div id="top" class="std_block">' . getBackUi(str_replace('&', '&amp;', $this->back_url), Lang::t('_BACK')) . '<div class="title">' . $title . '</div>' . '<div class="textof">' . $textof, 'content');
     if ($atts != '') {
         $GLOBALS['page']->add('<br/><br/></div><div class="attach">' . Lang::t('_ATTACH_TITLE', 'htmlpage', 'lms') . '<br/>' . $atts . '</div>', 'content');
     } else {
         $GLOBALS['page']->add('</div>', 'content');
     }
     $GLOBALS['page']->add('<br /><br />' . getBackUi(str_replace('&', '&amp;', $this->back_url), Lang::t('_BACK')) . '</div>', 'content');
 }
Пример #8
0
    function play($object_faq, $id_param)
    {
        !checkPerm('view', true, 'organization') && !checkPerm('view', true, 'storage');
        require_once _base_ . '/lib/lib.form.php';
        require_once $GLOBALS['where_lms'] . '/lib/lib.param.php';
        $lang =& DoceboLanguage::createInstance('faq');
        $idCategory = $object_faq->getId();
        $mode = importVar('mode', false, 'faq');
        $back_coded = htmlentities(urlencode($object_faq->back_url));
        $search = importVar('search');
        if (isset($_POST['empty'])) {
            $search = '';
        }
        $idReference = getLOParam($id_param, 'idReference');
        $link = 'index.php?modname=faq&amp;op=play&amp;idCategory=' . $idCategory . '&amp;id_param=' . $id_param . '&amp;back_url=' . $back_coded;
        // NOTE: Track only if $idReference is present
        if ($idReference !== FALSE) {
            require_once $GLOBALS['where_lms'] . '/class.module/track.faq.php';
            list($exist, $idTrack) = Track_Faq::getIdTrack($idReference, getLogUserId(), $idCategory, TRUE);
            if ($exist) {
                $ti = new Track_Faq($idTrack);
                $ti->setDate(date('Y-m-d H:i:s'));
                $ti->status = 'completed';
                $ti->update();
            } else {
                $ti = new Track_Faq(false);
                $ti->createTrack($idReference, $idTrack, getLogUserId(), date('Y-m-d H:i:s'), 'completed', 'faq');
            }
        }
        list($title) = sql_fetch_row(sql_query("\r\n\tSELECT title \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_faq_cat \r\n\tWHERE idCategory = '" . (int) $idCategory . "'"));
        //$GLOBALS['page']->add('<div id="top" class="std_block">', 'content');
        cout('<div class="yui-navset yui-navset-top tab_block">
			<ul class="yui-nav">
				<li class="first' . ($mode == 'faq' ? ' selected' : '') . '">
					<a href="' . $link . '&amp;mode=faq">
						<em>' . Lang::t('_SWITCH_TO_FAQ', 'faq') . '</em>
					</a>
				</li>
				<li' . ($mode == 'help' ? ' class="selected"' : '') . '>
					<a href="' . $link . '&amp;mode=help">
						<em>' . Lang::t('_SWITCH_TO_HELP', 'faq') . '</em>
					</a>
				</li>
			</ul>
			<div class="yui-content">', 'content');
        $GLOBALS['page']->add(getBackUi(Util::str_replace_once('&', '&amp;', $object_faq->back_url), $lang->def('_BACK')));
        $GLOBALS['page']->add('<b>' . $lang->def('_TITLE') . ' : ' . $title . '</b><br />' . '<br />', 'content');
        if ($mode == 'help') {
            $link .= '&amp;mode=help';
            $letter = importVar('letter', true, '');
            $search = urldecode(importVar('search'));
            // Display as help
            $textQuery = "\r\n\t\tSELECT keyword \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_faq \r\n\t\tWHERE idCategory = '" . importVar('idCategory', true) . "'";
            if ($search != '' && !isset($_POST['empty'])) {
                $textQuery .= " AND ( question LIKE '%" . $search . "%' OR answer LIKE '%" . $search . "%' ) ";
            }
            $result = sql_query($textQuery);
            $GLOBALS['page']->add(Form::openForm('glossary_play', 'index.php?modname=faq&amp;op=play') . Form::getOpenFieldset($lang->def('_FILTER')) . Form::getHidden('idCategory', 'idCategory', $idCategory) . Form::getHidden('id_param', 'id_param', $id_param) . Form::getHidden('back_url', 'back_url', $back_coded) . Form::getHidden('mode', 'mode', $mode) . Form::getTextfield($lang->def('_SEARCH'), 'search', 'search', 255, $search != '' && !isset($_POST['empty']) ? $search : ''), 'content');
            $GLOBALS['page']->add('[ ', 'content');
            //letter selection
            for ($i = 97; $i < 123; $i++) {
                if ($letter == $i) {
                    $GLOBALS['page']->add('<span class="text_bold">(', 'content');
                }
                $GLOBALS['page']->add('<a href="' . $link . '&amp;letter=' . $i . '">' . chr($i) . '</a>', 'content');
                if ($letter == $i) {
                    $GLOBALS['page']->add(')</span>', 'content');
                }
                if ($i < 122) {
                    $GLOBALS['page']->add('-', 'content');
                }
            }
            $GLOBALS['page']->add('&nbsp;]&nbsp;[&nbsp;', 'content');
            for ($i = 48; $i < 58; $i++) {
                if ($letter == $i) {
                    $GLOBALS['page']->add('<span class="text_bold">(', 'content');
                }
                $GLOBALS['page']->add('<a href="' . $link . '&amp;letter=' . $i . '">' . chr($i) . '</a>', 'content');
                if ($letter == $i) {
                    $GLOBALS['page']->add(')</span>', 'content');
                }
                if ($i < 57) {
                    $GLOBALS['page']->add('-', 'content');
                }
            }
            $GLOBALS['page']->add(' ] ', 'content');
            $GLOBALS['page']->add(Form::getBreakRow() . Form::openButtonSpace() . Form::getButton('do_search', 'do_search', $lang->def('_SEARCH')) . Form::getButton('empty', 'empty', $lang->def('_RESET')) . Form::closeButtonSpace() . Form::getCloseFieldset() . Form::closeForm(), 'content');
            //analyze keyword
            $keyword_help = array();
            while (list($keyword) = sql_fetch_row($result)) {
                $keyword_split = explode(',', $keyword);
                if (is_array($keyword_split)) {
                    while (list(, $value) = each($keyword_split)) {
                        $value = trim($value);
                        if ($value != '') {
                            if ($letter == 0) {
                                if (isset($keyword_help[$value])) {
                                    ++$keyword_help[$value];
                                } else {
                                    $keyword_help[$value] = 1;
                                }
                            } elseif (substr($value, 0, 1) == chr($letter)) {
                                if (isset($keyword_help[$value])) {
                                    ++$keyword_help[$value];
                                } else {
                                    $keyword_help[$value] = 1;
                                }
                            }
                        }
                    }
                }
            }
            ksort($keyword_help);
            reset($keyword_help);
            $GLOBALS['page']->add('<div class="yui-gf">' . '<div class="yui-u first" >' . '<div class="boxinfo_title">' . $lang->def('_TERM') . '</div>' . '<div class="boxinfo_container">' . '<ul class="link_list">', 'content');
            while (list($key, $value) = each($keyword_help)) {
                $GLOBALS['page']->add('<li><a class="href_block" href="' . $link . '&amp;letter=' . $letter . '&amp;search=' . urlencode($search) . '&amp;word=' . $key . '">' . $key . ' (' . $value . ')</a></li>', 'content');
            }
            $GLOBALS['page']->add('</ul>' . '</div></div>' . '<div class="yui-u">', 'content');
            if (isset($_GET['word'])) {
                $reDef = sql_query("\r\n\t\t\tSELECT title, answer \r\n\t\t\tFROM " . $GLOBALS['prefix_lms'] . "_faq \r\n\t\t\tWHERE keyword LIKE '%" . $_GET['word'] . "%' AND idCategory = '" . (int) $_GET['idCategory'] . "'\r\n\t\t\tORDER BY title");
                while (list($title, $answer) = sql_fetch_row($reDef)) {
                    $GLOBALS['page']->add('<div class="boxinfo_title">' . $title . '</div>' . '<div class="boxinfo_container">' . ($search == '' ? $answer : eregi_replace($search, '<span class="highlight">' . $search . '</span>', $answer)) . '</div><br />', 'content');
                }
            }
            $GLOBALS['page']->add('</div>' . '<div class="nofloat"></div>' . '</div>', 'content');
        } else {
            // Display as faq
            $textQuery = "\r\n\t\tSELECT question, answer \r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_faq \r\n\t\tWHERE idCategory = '" . (int) $idCategory . "' " . (isset($_POST['search']) && !isset($_POST['empty']) ? " AND ( question LIKE '%" . $search . "%' OR answer LIKE '%" . $search . "%' ) " : '') . "ORDER BY sequence";
            $result = sql_query($textQuery);
            $GLOBALS['page']->add(Form::openForm('glossary_play', 'index.php?modname=faq&amp;op=play') . Form::getOpenFieldset($lang->def('_FILTER')) . Form::getHidden('idCategory', 'idCategory', $idCategory) . Form::getHidden('id_param', 'id_param', $id_param) . Form::getHidden('back_url', 'back_url', $back_coded) . Form::getTextfield($lang->def('_SEARCH'), 'search', 'search', 255, $search != '' && !isset($_POST['empty']) ? $search : '') . Form::getBreakRow() . Form::openButtonSpace() . Form::getButton('do_search', 'do_search', $lang->def('_SEARCH')) . Form::getButton('empty', 'empty', $lang->def('_RESET')) . Form::closeButtonSpace() . Form::getCloseFieldset() . Form::closeForm(), 'content');
            while (list($question, $answer) = sql_fetch_row($result)) {
                $GLOBALS['page']->add('<div class="boxinfo_title">' . ($search == '' ? $question : eregi_replace($search, '<span class="highlight">' . $search . '</span>', $question)) . '</div>' . '<div class="boxinfo_container">' . ($search == '' ? $answer : eregi_replace($search, '<span class="highlight">' . $search . '</span>', $answer)) . '</div><br />', 'content');
            }
        }
        $GLOBALS['page']->add('<div class="align_center">' . '<a href="#top">' . '<img src="' . getPathImage() . 'standard/upcheck.gif" title="' . $lang->def('_BACKTOTOP') . '" />' . $lang->def('_BACKTOTOP') . '</a>' . getBackUi(Util::str_replace_once('&', '&amp;', $object_faq->back_url), $lang->def('_BACK')), 'content');
        cout('<div class="nofloat"></div>
		</div><!-- yui content -->
		</div></div>', 'content');
    }