[LON-CAPA-cvs] cvs: loncom /homework default_homework.lcpm /html/adm/help/tex Problem_LON-CAPA_Functions.tex Script_Functions.tex all_functions_table.tex

www lon-capa-cvs-allow@mail.lon-capa.org
Thu, 12 Jun 2008 00:47:17 -0000


www		Wed Jun 11 20:47:17 2008 EDT

  Modified files:              
    /loncom/homework	default_homework.lcpm 
    /loncom/html/adm/help/tex	Problem_LON-CAPA_Functions.tex 
                             	Script_Functions.tex 
                             	all_functions_table.tex 
  Log:
  Accessor functions for more stuff
  
  
Index: loncom/homework/default_homework.lcpm
diff -u loncom/homework/default_homework.lcpm:1.135 loncom/homework/default_homework.lcpm:1.136
--- loncom/homework/default_homework.lcpm:1.135	Tue Jun 10 12:20:29 2008
+++ loncom/homework/default_homework.lcpm	Wed Jun 11 20:46:52 2008
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA 
 # used by lonxml::xmlparse() as input variable $safeinit to Apache::run::run()
 #
-# $Id: default_homework.lcpm,v 1.135 2008/06/10 16:20:29 www Exp $
+# $Id: default_homework.lcpm,v 1.136 2008/06/12 00:46:52 www Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1024,6 +1024,17 @@
     return $sec;
 }
 
+sub submission {
+   my ($partid,$responseid,$subnumber)=@_;
+   my $sub='';
+   if ($subnumber) { $sub=$subnumber.':'; }
+   return &EXT('user.resource.'.$sub.'resource.'.$partid.'.'.$responseid.'.submission');
+}
+
+sub currentpart {
+   return $external::part;
+}
+
 sub eval_time {
    my ($timestamp)=@_;
    unless ($timestamp) { return ''; }
@@ -1048,6 +1059,24 @@
     return &eval_time(&EXT('resource.'.$partid.'.answerdate'));
 }
 
+sub open_date_epoch {
+    my ($partid)=@_;
+    unless ($partid) { $partid=0; }
+    return &EXT('resource.'.$partid.'.opendate');
+}
+
+sub due_date_epoch {
+    my ($partid)=@_;
+    unless ($partid) { $partid=0; }
+    return &EXT('resource.'.$partid.'.duedate');
+}
+
+sub answer_date_epoch {
+    my ($partid)=@_;
+    unless ($partid) { $partid=0; }
+    return &EXT('resource.'.$partid.'.answerdate');
+}
+
 sub array_moments {
     my @input=@_;
     my (@output,$N);
Index: loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex
diff -u loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex:1.16 loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex:1.17
--- loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex:1.16	Tue Jun 10 11:49:51 2008
+++ loncom/html/adm/help/tex/Problem_LON-CAPA_Functions.tex	Wed Jun 11 20:47:08 2008
@@ -134,8 +134,19 @@
 \hline
 \&check\_status(\$partid) &Returns a number identifing the current status of a part. True values mean that a part is ``done'' (either unanswerable because of tries exhaustion, or correct) or a false value if a part can still be attempted. If \$part is unspecfied, it will check either the current $<$part$>$'s status or if outside of a $<$part$>$, check the status of previous $<$part$>$. The full set of return codes are: 'undef' means it is unattempted, 0 means it is attmpted and wrong but still has tries, 1 means it is marked correct, 2 means they have exceed maximum number of tries, 3 means it after the answer date\\
 \hline
-\&open\_date(\$partid), \&due\_date(\$partid), \&answer\_date(\$partid)  & Problem open date, due date and answer date. The time is also included in 24-hr format. \\
+\&open\_date(\$partid), \&due\_date(\$partid), \&answer\_date(\$partid)  & Problem open date, due date and answer date in local human-readable format.  Part 0 is chosen if \$partid is omitted.\\
 \hline
+\&open\_date\_epoch(\$partid), \&due\_date\_epoch((\$partid), \&answer\_date\_epoch((\$partid)  & Problem open date, due date and answer date in seconds after the 
+epoch (UTC), which can be used in calculations.\\
+\hline
+
+\&submission(\$partid,\$responseid,\$version) & Returns what the student submitted for response \$responseid in part \$partid. You can get these IDs from the XML-code of the problem. \$version is optional and returns the \$version-th submission of the student that was graded.\\
+\hline
+
+\&currentpart() & 
+Returns the ID of the current part.\\
+\hline
+
  
 Not implemented  & Get and set the random seed. \\
 \hline
Index: loncom/html/adm/help/tex/Script_Functions.tex
diff -u loncom/html/adm/help/tex/Script_Functions.tex:1.8 loncom/html/adm/help/tex/Script_Functions.tex:1.9
--- loncom/html/adm/help/tex/Script_Functions.tex:1.8	Tue Jun 10 11:49:51 2008
+++ loncom/html/adm/help/tex/Script_Functions.tex	Wed Jun 11 20:47:10 2008
@@ -32,6 +32,9 @@
 \item name(), firstname(), lastname(), student\_number()
 \item check\_status(partid)
 \item open\_date(partid), due\_date(partid), answer\_date(partid) 
+\item open\_date\_epoch(partid), due\_date\_epoch(partid), answer\_date\_epoch(partid)
+\item submission(partid,responseid,version)
+\item currentpart()
 \item sub\_string() 
 \item array\_moments(array) 
 \item format(x,y),prettyprint(x,y,target),dollarformat(x,target) 
Index: loncom/html/adm/help/tex/all_functions_table.tex
diff -u loncom/html/adm/help/tex/all_functions_table.tex:1.10 loncom/html/adm/help/tex/all_functions_table.tex:1.11
--- loncom/html/adm/help/tex/all_functions_table.tex:1.10	Thu Mar 20 20:10:34 2008
+++ loncom/html/adm/help/tex/all_functions_table.tex	Wed Jun 11 20:47:10 2008
@@ -102,8 +102,15 @@
  \hline 
 NOT IMPLEMENTED IN CAPA &\&check\_status(\$partid) &Returns a number identifying the current status of a part. True values mean that a part is ``done'' (either unanswerable because of tries exhaustion, or correct) or a false value if a part can still be attempted. If \$part is unspecified, it will check either the current $<$part$>$'s status or if outside of a $<$part$>$, check the status of previous $<$part$>$. The full set of return codes are: 'undef' means it is unattempted, 0 means it is attempted and wrong but still has tries, 1 means it is marked correct, 2 means the user has exceeded the maximum number of tries, and 3 means it is after the answer date &  \\
  \hline 
-open\_date(), due\_date(), answer\_date() &\&open\_date(), \&due\_date(), \&answer\_date() &Problem open date, due date and answer date. The time is also included in 24-hr format. &Output format for time is changed slightly. If pass noon, it displays ..pm else it displays ..am. So 23:59 is displayed as 11:59 pm. \\
- \hline 
+open\_date(), due\_date(), answer\_date() &\&open\_date(\$partid), \&due\_date(\$partid), \&answer\_date(\$partid) &Problem open date, due date and answer date. The time is also included in 24-hr format. &Output format for time is changed slightly. If pass noon, it displays ..pm else it displays ..am. So 23:59 is displayed as 11:59 pm. \\
+ \hline
+&\&open\_date\_epoch(\$partid), \&due\_date\_epoch(\$partid), \&answer\_date\_epoch(\$partid) &Problem open date, due date and answer date in seconds after the epoch. These numbers can be used in calculations.&\\
+\hline
+&\&submission(\$partid,\$responseid,\$version) & Returns what the student submitted for response \$responseid in part \$part. You can get these IDs from the XML-code of the problem. \$version is optional and returns the \$version-th submission of the student that was graded.&\\
+\hline
+
+&\&currentpart() & Returns the ID of the current part.&\\ \hline
+ 
 get\_seed(), set\_seed() &Not implemented &Get and set the random seed. &  \\
  \hline 
 sub\_string(a,b,c) &\&sub\_string(\$a,\$b,\$c)