コード例 #1
0
ファイル: index.php プロジェクト: secuencia24/chamilo-lms
?>
" />
    <input type="hidden" name="campusForm"         value="<?php 
echo api_htmlentities($campusForm, ENT_QUOTES);
?>
" />
    <input type="hidden" name="educationForm"      value="<?php 
echo api_htmlentities($educationForm, ENT_QUOTES);
?>
" />
    <input type="hidden" name="institutionForm"    value="<?php 
echo api_htmlentities($institutionForm, ENT_QUOTES);
?>
" />
    <input type="hidden" name="institutionUrlForm" value="<?php 
echo api_stristr($institutionUrlForm, 'http://', false) ? api_htmlentities($institutionUrlForm, ENT_QUOTES) : api_stristr($institutionUrlForm, 'https://', false) ? api_htmlentities($institutionUrlForm, ENT_QUOTES) : 'http://' . api_htmlentities($institutionUrlForm, ENT_QUOTES);
?>
" />
    <input type="hidden" name="checkEmailByHashSent" value="<?php 
echo api_htmlentities($checkEmailByHashSent, ENT_QUOTES);
?>
" />
    <input type="hidden" name="ShowEmailNotCheckedToStudent" value="<?php 
echo api_htmlentities($ShowEmailNotCheckedToStudent, ENT_QUOTES);
?>
" />
    <input type="hidden" name="userMailCanBeEmpty" value="<?php 
echo api_htmlentities($userMailCanBeEmpty, ENT_QUOTES);
?>
" />
    <input type="hidden" name="encryptPassForm"    value="<?php 
コード例 #2
0
ファイル: index.php プロジェクト: annickvdp/Chamilo1.9.10
	}
?>
	<input type="hidden" name="enableTrackingForm"   value="<?php echo api_htmlentities($enableTrackingForm, ENT_QUOTES); ?>" />
	<input type="hidden" name="allowSelfReg"         value="<?php echo api_htmlentities($allowSelfReg, ENT_QUOTES); ?>" />
	<input type="hidden" name="allowSelfRegProf"     value="<?php echo api_htmlentities($allowSelfRegProf, ENT_QUOTES); ?>" />
	<input type="hidden" name="emailForm"            value="<?php echo api_htmlentities($emailForm, ENT_QUOTES); ?>" />
	<input type="hidden" name="adminLastName"        value="<?php echo api_htmlentities($adminLastName, ENT_QUOTES); ?>" />
	<input type="hidden" name="adminFirstName"       value="<?php echo api_htmlentities($adminFirstName, ENT_QUOTES); ?>" />
	<input type="hidden" name="adminPhoneForm"       value="<?php echo api_htmlentities($adminPhoneForm, ENT_QUOTES); ?>" />
	<input type="hidden" name="loginForm"            value="<?php echo api_htmlentities($loginForm, ENT_QUOTES); ?>" />
	<input type="hidden" name="passForm"             value="<?php echo api_htmlentities($passForm, ENT_QUOTES); ?>" />
	<input type="hidden" name="languageForm"         value="<?php echo api_htmlentities($languageForm, ENT_QUOTES); ?>" />
	<input type="hidden" name="campusForm"           value="<?php echo api_htmlentities($campusForm, ENT_QUOTES); ?>" />
	<input type="hidden" name="educationForm"        value="<?php echo api_htmlentities($educationForm, ENT_QUOTES); ?>" />
	<input type="hidden" name="institutionForm"      value="<?php echo api_htmlentities($institutionForm, ENT_QUOTES); ?>" />
	<input type="hidden" name="institutionUrlForm"   value="<?php echo api_stristr($institutionUrlForm, 'http://', false) ? api_htmlentities($institutionUrlForm, ENT_QUOTES) : api_stristr($institutionUrlForm, 'https://', false) ? api_htmlentities($institutionUrlForm, ENT_QUOTES) : 'http://'.api_htmlentities($institutionUrlForm, ENT_QUOTES); ?>" />
	<input type="hidden" name="checkEmailByHashSent" value="<?php echo api_htmlentities($checkEmailByHashSent, ENT_QUOTES); ?>" />
	<input type="hidden" name="ShowEmailnotcheckedToStudent" value="<?php echo api_htmlentities($ShowEmailnotcheckedToStudent, ENT_QUOTES); ?>" />
	<input type="hidden" name="userMailCanBeEmpty"   value="<?php echo api_htmlentities($userMailCanBeEmpty, ENT_QUOTES); ?>" />
	<input type="hidden" name="encryptPassForm"      value="<?php echo api_htmlentities($encryptPassForm, ENT_QUOTES); ?>" />
	<input type="hidden" name="session_lifetime"     value="<?php echo api_htmlentities($session_lifetime, ENT_QUOTES); ?>" />
	<input type="hidden" name="old_version"          value="<?php echo api_htmlentities($my_old_version, ENT_QUOTES); ?>" />
	<input type="hidden" name="new_version"          value="<?php echo api_htmlentities($new_version, ENT_QUOTES); ?>" />
<?php
if (@$_POST['step2']) {
	//STEP 3 : LICENSE
	display_license_agreement();
} elseif (@$_POST['step3']) {
	//STEP 4 : MYSQL DATABASE SETTINGS
	display_database_settings_form($installType, $dbHostForm, $dbUsernameForm, $dbPassForm, $dbPrefixForm, $enableTrackingForm, $singleDbForm, $dbNameForm, $dbStatsForm, $dbScormForm, $dbUserForm);
} elseif (@$_POST['step4']) {
コード例 #3
0
function get_suggestions_from_search_engine($q)
{
    if (strlen($q) < 2) {
        return null;
    }
    global $charset;
    $table_sfv = Database::get_main_table(TABLE_MAIN_SPECIFIC_FIELD_VALUES);
    $q = Database::escape_string($q);
    $cid = api_get_course_id();
    $sql_add = '';
    if ($cid != -1) {
        $sql_add = " AND course_code = '" . $cid . "' ";
    }
    $sql = "SELECT * FROM {$table_sfv} where value LIKE '%{$q}%'" . $sql_add . " ORDER BY course_code, tool_id, ref_id, field_id";
    $sql_result = Database::query($sql);
    $data = array();
    $i = 0;
    while ($row = Database::fetch_array($sql_result)) {
        echo api_convert_encoding($row['value'], 'UTF-8', $charset) . "| value\n";
        if ($i < 20) {
            $data[$row['course_code']][$row['tool_id']][$row['ref_id']] = 1;
        }
        $i++;
    }
    // now that we have all the values corresponding to this search, we want to
    // make sure we get all the associated values that could match this one
    // initial value...
    $more_sugg = array();
    foreach ($data as $cc => $course_id) {
        foreach ($course_id as $ti => $item_tool_id) {
            foreach ($item_tool_id as $ri => $item_ref_id) {
                //natsort($item_ref_id);
                $output = array();
                $field_val = array();
                $sql2 = "SELECT * FROM {$table_sfv} where course_code = '{$cc}' AND tool_id = '{$ti}' AND ref_id = '{$ri}' ORDER BY field_id";
                $res2 = Database::query($sql2);
                // TODO this code doesn't manage multiple terms in one same field just yet (should duplicate results in this case)
                $field_id = 0;
                while ($row2 = Database::fetch_array($res2)) {
                    //TODO : this code is not perfect yet. It overrides the
                    // first match set, so having 1:Yannick,Julio;2:Rectum;3:LASER
                    // will actually never return: Yannick - Rectum - LASER
                    // because it is overwriteen by Julio - Rectum - LASER
                    // We should have recursivity here to avoid this problem!
                    //Store the new set of results (only one per combination
                    // of all fields)
                    $field_val[$row2['field_id']] = $row2['value'];
                    $current_field_val = '';
                    foreach ($field_val as $id => $val) {
                        $current_field_val .= $val . ' - ';
                    }
                    //Check whether we have a field repetition or not. Results
                    // have been ordered by field_id, so we should catch them
                    // all here
                    if ($field_id == $row2['field_id']) {
                        //We found the same field id twice, split the output
                        // array to allow for two sets of results (copy all
                        // existing array elements into copies and update the
                        // copies) eg. Yannick - Car - Driving in $output[1]
                        // will create a copy as Yannick - Car - Speed
                        // in $output[3]
                        $c = count($output);
                        for ($i = 0; $i < $c; $i++) {
                            $output[$c + $i] = $current_field_val;
                        }
                    } else {
                        //no identical field id, continue as usual
                        $c = count($output);
                        if ($c == 0) {
                            $output[] = $row2['value'] . ' - ';
                        } else {
                            foreach ($output as $i => $out) {
                                //use the latest combination of fields
                                $output[$i] .= $row2['value'] . ' - ';
                            }
                        }
                        $field_id = $row2['field_id'];
                    }
                }
                foreach ($output as $i => $out) {
                    if (api_stristr($out, $q) === false) {
                        continue;
                    }
                    $s = api_convert_encoding(substr($out, 0, -3), 'UTF-8', $charset) . "| value\n";
                    if (!in_array($s, $more_sugg)) {
                        $more_sugg[] = $s;
                    }
                }
            }
        }
    }
    foreach ($more_sugg as $sugg) {
        echo $sugg;
    }
}
コード例 #4
0
function get_suggestions_from_search_engine($q)
{
    //    if (strlen($q)<2) { return null;}
    global $charset;
    $em = Database::getManager();
    $queryParams = [];
    $json = [];
    $q = Database::escape_string($q);
    $course = $em->find('ChamiloCoreBundle:Course', api_get_course_int_id());
    $sql_add = '';
    if ($course) {
        $sql_add = "AND sfv.course = :course ";
        $queryParams['course'] = $course;
    }
    $dql = "\n        SELECT sfv FROM ChamiloCoreBundle:SpecificFieldValues sfv\n        WHERE sfv.value LIKE :q {$sql_add}\n        ORDER BY sfv.course, sfv.toolId, sfv.refId, sfv.fieldId\n    ";
    $queryParams['q'] = "%{$q}%";
    $sql_result = $em->createQuery($dql)->setParameters($queryParams)->getResult();
    $data = array();
    $i = 0;
    foreach ($sql_result as $row) {
        $value = api_convert_encoding($row->getValue(), 'UTF-8', $charset);
        $json[] = ['id' => $value, 'value' => $value, 'label' => $value];
        if ($i < 20) {
            $data[$row->getCourse()->getCode()][$row->getToolId()][$row->getRefId()] = 1;
        }
        $i++;
    }
    // now that we have all the values corresponding to this search, we want to
    // make sure we get all the associated values that could match this one
    // initial value...
    $more_sugg = array();
    foreach ($data as $cc => $course_id) {
        foreach ($course_id as $ti => $item_tool_id) {
            foreach ($item_tool_id as $ri => $item_ref_id) {
                //natsort($item_ref_id);
                $output = array();
                $field_val = array();
                $res2 = $em->createQuery('
                        SELECT sfv FROM ChamiloCoreBundle:SpecificFieldValues sfv
                        WHERE sfv.courseCode = :course AND sfv.toolId = :tool AND sfv.refId = :ref
                        ORDER BY sfv.fieldId
                    ')->execute(['course' => $cc, 'tool' => $ti, 'ref' => $ri]);
                // TODO this code doesn't manage multiple terms in one same field just yet (should duplicate results in this case)
                $field_id = 0;
                foreach ($res2 as $row2) {
                    //TODO : this code is not perfect yet. It overrides the
                    // first match set, so having 1:Yannick,Julio;2:Rectum;3:LASER
                    // will actually never return: Yannick - Rectum - LASER
                    // because it is overwriteen by Julio - Rectum - LASER
                    // We should have recursivity here to avoid this problem!
                    //Store the new set of results (only one per combination
                    // of all fields)
                    $field_val[$row2->getFieldId()] = $row2->getValue();
                    $current_field_val = '';
                    foreach ($field_val as $id => $val) {
                        $current_field_val .= $val . ' - ';
                    }
                    //Check whether we have a field repetition or not. Results
                    // have been ordered by field_id, so we should catch them
                    // all here
                    if ($field_id == $row2->getFieldId()) {
                        //We found the same field id twice, split the output
                        // array to allow for two sets of results (copy all
                        // existing array elements into copies and update the
                        // copies) eg. Yannick - Car - Driving in $output[1]
                        // will create a copy as Yannick - Car - Speed
                        // in $output[3]
                        $c = count($output);
                        for ($i = 0; $i < $c; $i++) {
                            $output[$c + $i] = $current_field_val;
                        }
                    } else {
                        //no identical field id, continue as usual
                        $c = count($output);
                        if ($c == 0) {
                            $output[] = $row2->getValue() . ' - ';
                        } else {
                            foreach ($output as $i => $out) {
                                //use the latest combination of fields
                                $output[$i] .= $row2->getValue() . ' - ';
                            }
                        }
                        $field_id = $row2->getFieldId();
                    }
                }
                foreach ($output as $i => $out) {
                    if (api_stristr($out, $q) === false) {
                        continue;
                    }
                    $s = api_convert_encoding(substr($out, 0, -3), 'UTF-8', $charset);
                    if (!in_array($s, $more_sugg)) {
                        $more_sugg[] = $s;
                        $json[] = ['id' => $s, 'value' => $s, 'label' => $s];
                    }
                }
            }
        }
    }
    echo json_encode($json);
}