-
Notifications
You must be signed in to change notification settings - Fork 86
/
set_word_status.php
64 lines (52 loc) · 2.3 KB
/
set_word_status.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
/**************************************************************
"Learning with Texts" (LWT) is released into the Public Domain.
This applies worldwide.
In case this is not legally possible, any entity is granted the
right to use this work for any purpose, without any conditions,
unless such conditions are required by law.
Developed by J. Pierre in 2011.
***************************************************************/
/**************************************************************
Call: set_word_status.php?...
... tid=[textid]&wid=[wordid]&status=1..5/98/99
Change status of term while reading
***************************************************************/
include "connect.inc.php";
include "settings.inc.php";
include "utilities.inc.php";
$tid = $_REQUEST['tid'];
$wid = $_REQUEST['wid'];
$status = $_REQUEST['status'];
$sql = 'SELECT WoText, WoTranslation, WoRomanization FROM words where WoID = ' . $wid;
$res = mysql_query($sql);
if ($res == FALSE) die("Invalid Query: $sql");
$record = mysql_fetch_assoc($res);
if ($record) {
$word = $record['WoText'];
$trans = repl_tab_nl($record['WoTranslation']) . getWordTagList($wid,' ',1,0);
$roman = $record['WoRomanization'];
} else {
die("Error: No results");
}
mysql_free_result($res);
pagestart("Term: " . $word, false);
$m1 = runsql('update words set WoStatus = ' .
$_REQUEST['status'] . ', WoStatusChanged = NOW(),' . make_score_random_insert_update('u') . ' where WoID = ' . $wid, 'Status changed');
echo '<p>OK, this term has status ' . get_colored_status_msg($status) . ' from now!</p>';
?>
<script type="text/javascript">
//<![CDATA[
var context = window.parent.frames['l'].document;
var contexth = window.parent.frames['h'].document;
var status = '<?php echo $status; ?>';
var title = make_tooltip(<?php echo prepare_textdata_js($word); ?>, <?php echo prepare_textdata_js($trans); ?>, <?php echo prepare_textdata_js($roman); ?>, status);
$('.word<?php echo $wid; ?>', context).removeClass('status98 status99 status1 status2 status3 status4 status5').addClass('status<?php echo $status; ?>').attr('data_status','<?php echo $status; ?>').attr('title',title);
$('#learnstatus', contexth).html('<?php echo texttodocount2($tid); ?>');
window.parent.frames['l'].focus();
window.parent.frames['l'].setTimeout('cClick()', 100);
//]]>
</script>
<?php
pageend();
?>