ILIAS  Release_3_10_x_branch Revision 61812
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.assImagemapQuestion.php
Go to the documentation of this file.
1 <?php
2  /*
3  +----------------------------------------------------------------------------+
4  | ILIAS open source |
5  +----------------------------------------------------------------------------+
6  | Copyright (c) 1998-2001 ILIAS open source, University of Cologne |
7  | |
8  | This program is free software; you can redistribute it and/or |
9  | modify it under the terms of the GNU General Public License |
10  | as published by the Free Software Foundation; either version 2 |
11  | of the License, or (at your option) any later version. |
12  | |
13  | This program is distributed in the hope that it will be useful, |
14  | but WITHOUT ANY WARRANTY; without even the implied warranty of |
15  | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16  | GNU General Public License for more details. |
17  | |
18  | You should have received a copy of the GNU General Public License |
19  | along with this program; if not, write to the Free Software |
20  | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
21  +----------------------------------------------------------------------------+
22 */
23 
24 include_once "./Modules/TestQuestionPool/classes/class.assQuestion.php";
25 include_once "./Modules/Test/classes/inc.AssessmentConstants.php";
26 
37 {
38 
46  var $answers;
47 
56 
65 
74  var $coords;
75 
91  $title = "",
92  $comment = "",
93  $author = "",
94  $owner = -1,
95  $question = "",
96  $imagemap_filename = "",
97  $image_filename = ""
98 
99  )
100  {
102  $this->imagemap_filename = $imagemap_filename;
103  $this->image_filename = $image_filename;
104  $this->answers = array();
105  $this->coords = array();
106  }
107 
116  function isComplete()
117  {
118  if (($this->title) and ($this->author) and ($this->question) and ($this->image_filename) and (count($this->answers)) and ($this->getMaximumPoints() > 0))
119  {
120  return true;
121  }
122  else
123  {
124  return false;
125  }
126  }
127 
136  function saveToDb($original_id = "")
137  {
138  global $ilDB;
139 
140  $complete = 0;
141  if ($this->isComplete())
142  {
143  $complete = 1;
144  }
145 
146  $estw_time = $this->getEstimatedWorkingTime();
147  $estw_time = sprintf("%02d:%02d:%02d", $estw_time['h'], $estw_time['m'], $estw_time['s']);
148  if ($original_id)
149  {
150  $original_id = $ilDB->quote($original_id);
151  }
152  else
153  {
154  $original_id = "NULL";
155  }
156 
157  // cleanup RTE images which are not inserted into the question text
158  include_once("./Services/RTE/classes/class.ilRTE.php");
159  if ($this->id == -1)
160  {
161  // Neuen Datensatz schreiben
162  $now = getdate();
163  $question_type = $this->getQuestionTypeID();
164  $created = sprintf("%04d%02d%02d%02d%02d%02d", $now['year'], $now['mon'], $now['mday'], $now['hours'], $now['minutes'], $now['seconds']);
165  $query = sprintf("INSERT INTO qpl_questions (question_id, question_type_fi, obj_fi, title, comment, author, owner, question_text, working_time, points, complete, created, original_id, TIMESTAMP) VALUES (NULL, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, NULL)",
166  $ilDB->quote($question_type),
167  $ilDB->quote($this->obj_id),
168  $ilDB->quote($this->title),
169  $ilDB->quote($this->comment),
170  $ilDB->quote($this->author),
171  $ilDB->quote($this->owner),
172  $ilDB->quote(ilRTE::_replaceMediaObjectImageSrc($this->question, 0)),
173  $ilDB->quote($estw_time),
174  $ilDB->quote($this->getMaximumPoints() . ""),
175  $ilDB->quote("$complete"),
176  $ilDB->quote($created),
178  );
179  $result = $ilDB->query($query);
180  if (PEAR::isError($result))
181  {
182  global $ilias;
183  $ilias->raiseError($result->getMessage());
184  }
185  else
186  {
187  $this->id = $ilDB->getLastInsertId();
188  $insertquery = sprintf("INSERT INTO qpl_question_imagemap (question_fi, image_file) VALUES (%s, %s)",
189  $ilDB->quote($this->id . ""),
190  $ilDB->quote($this->image_filename)
191  );
192  $ilDB->query($insertquery);
193  // create page object of question
194  $this->createPageObject();
195 
196  if ($this->getTestId() > 0)
197  {
198  $this->insertIntoTest($this->getTestId());
199  }
200  }
201  }
202  else
203  {
204  // Vorhandenen Datensatz aktualisieren
205  $query = sprintf("UPDATE qpl_questions SET obj_fi = %s, title = %s, comment = %s, author = %s, question_text = %s, working_time = %s, points = %s, complete = %s WHERE question_id = %s",
206  $ilDB->quote($this->obj_id. ""),
207  $ilDB->quote($this->title),
208  $ilDB->quote($this->comment),
209  $ilDB->quote($this->author),
210  $ilDB->quote(ilRTE::_replaceMediaObjectImageSrc($this->question, 0)),
211  $ilDB->quote($estw_time),
212  $ilDB->quote($this->getMaximumPoints() . ""),
213  $ilDB->quote("$complete"),
214  $ilDB->quote($this->id)
215  );
216  $result = $ilDB->query($query);
217  $query = sprintf("UPDATE qpl_question_imagemap SET image_file = %s WHERE question_fi = %s",
218  $ilDB->quote($this->image_filename),
219  $ilDB->quote($this->id)
220  );
221  $result = $ilDB->query($query);
222 
223  }
224 
225  if (PEAR::isError($result))
226  {
227  global $ilias;
228  $ilias->raiseError($result->getMessage());
229  }
230  else
231  {
232  $query = sprintf("DELETE FROM qpl_answer_imagemap WHERE question_fi = %s",
233  $ilDB->quote($this->id)
234  );
235  $result = $ilDB->query($query);
236  // Anworten wegschreiben
237  foreach ($this->answers as $key => $value)
238  {
239  $answer_obj = $this->answers[$key];
240  //print "id:".$this->id." answer tex:".$answer_obj->getAnswertext()." answer_obj->getOrder():".$answer_obj->getOrder()." answer_obj->getCoords():".$answer_obj->getCoords()." answer_obj->getArea():".$answer_obj->getArea();
241  $query = sprintf("INSERT INTO qpl_answer_imagemap (answer_id, question_fi, answertext, points, aorder, coords, area) VALUES (NULL, %s, %s, %s, %s, %s, %s)",
242  $ilDB->quote($this->id),
243  $ilDB->quote($answer_obj->getAnswertext() . ""),
244  $ilDB->quote($answer_obj->getPoints() . ""),
245  $ilDB->quote($answer_obj->getOrder() . ""),
246  $ilDB->quote($answer_obj->getCoords() . ""),
247  $ilDB->quote($answer_obj->getArea() . "")
248  );
249  $answer_result = $ilDB->query($query);
250  }
251  }
253  }
254 
262  function duplicate($for_test = true, $title = "", $author = "", $owner = "")
263  {
264  if ($this->id <= 0)
265  {
266  // The question has not been saved. It cannot be duplicated
267  return;
268  }
269  // duplicate the question in database
270  $this_id = $this->getId();
271  $clone = $this;
272  include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
274  $clone->id = -1;
275  if ($title)
276  {
277  $clone->setTitle($title);
278  }
279  if ($author)
280  {
281  $clone->setAuthor($author);
282  }
283  if ($owner)
284  {
285  $clone->setOwner($owner);
286  }
287  if ($for_test)
288  {
289  $clone->saveToDb($original_id);
290  }
291  else
292  {
293  $clone->saveToDb();
294  }
295 
296  // copy question page content
297  $clone->copyPageOfQuestion($this_id);
298  // copy XHTML media objects
299  $clone->copyXHTMLMediaObjectsOfQuestion($this_id);
300  // duplicate the generic feedback
301  $clone->duplicateFeedbackGeneric($this_id);
302  // duplicate the answer specific feedback
303  $clone->duplicateFeedbackAnswer($this_id);
304 
305  // duplicate the image
306  $clone->duplicateImage($this_id);
307  return $clone->id;
308  }
309 
317  function copyObject($target_questionpool, $title = "")
318  {
319  if ($this->id <= 0)
320  {
321  // The question has not been saved. It cannot be duplicated
322  return;
323  }
324  // duplicate the question in database
325  $clone = $this;
326  include_once ("./Modules/TestQuestionPool/classes/class.assQuestion.php");
328  $clone->id = -1;
329  $source_questionpool = $this->getObjId();
330  $clone->setObjId($target_questionpool);
331  if ($title)
332  {
333  $clone->setTitle($title);
334  }
335  $clone->saveToDb();
336 
337  // copy question page content
338  $clone->copyPageOfQuestion($original_id);
339  // copy XHTML media objects
340  $clone->copyXHTMLMediaObjectsOfQuestion($original_id);
341  // duplicate the generic feedback
342  $clone->duplicateFeedbackGeneric($original_id);
343  // duplicate the answer specific feedback
344  $clone->duplicateFeedbackAnswer($original_id);
345 
346  // duplicate the image
347  $clone->copyImage($original_id, $source_questionpool);
348  return $clone->id;
349  }
350 
351  function duplicateImage($question_id)
352  {
353  $imagepath = $this->getImagePath();
354  $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
355  if (!file_exists($imagepath)) {
356  ilUtil::makeDirParents($imagepath);
357  }
358  $filename = $this->get_image_filename();
359  if (!copy($imagepath_original . $filename, $imagepath . $filename)) {
360  print "image could not be duplicated!!!! ";
361  }
362  }
363 
364  function copyImage($question_id, $source_questionpool)
365  {
366  $imagepath = $this->getImagePath();
367  $imagepath_original = str_replace("/$this->id/images", "/$question_id/images", $imagepath);
368  $imagepath_original = str_replace("/$this->obj_id/", "/$source_questionpool/", $imagepath_original);
369  if (!file_exists($imagepath))
370  {
371  ilUtil::makeDirParents($imagepath);
372  }
373  $filename = $this->get_image_filename();
374  if (!copy($imagepath_original . $filename, $imagepath . $filename))
375  {
376  print "image could not be copied!!!! ";
377  }
378  }
379 
389  function loadFromDb($question_id)
390  {
391  global $ilDB;
392 
393  $query = sprintf("SELECT qpl_questions.*, qpl_question_imagemap.* FROM qpl_questions, qpl_question_imagemap WHERE question_id = %s AND qpl_questions.question_id = qpl_question_imagemap.question_fi",
394  $ilDB->quote($question_id)
395  );
396  $result = $ilDB->query($query);
397  if ($result->numRows() == 1)
398  {
399  $data = $result->fetchRow(MDB2_FETCHMODE_OBJECT);
400  $this->id = $question_id;
401  $this->obj_id = $data->obj_fi;
402  $this->title = $data->title;
403  $this->comment = $data->comment;
404  $this->author = $data->author;
405  $this->original_id = $data->original_id;
406  $this->solution_hint = $data->solution_hint;
407  $this->owner = $data->owner;
408  include_once("./Services/RTE/classes/class.ilRTE.php");
409  $this->question = ilRTE::_replaceMediaObjectImageSrc($data->question_text, 1);
410  $this->image_filename = $data->image_file;
411  $this->points = $data->points;
412  $this->setEstimatedWorkingTime(substr($data->working_time, 0, 2), substr($data->working_time, 3, 2), substr($data->working_time, 6, 2));
413 
414  $query = sprintf("SELECT * FROM qpl_answer_imagemap WHERE question_fi = %s ORDER BY aorder ASC",
415  $ilDB->quote($question_id)
416  );
417  $result = $ilDB->query($query);
418  include_once "./Modules/TestQuestionPool/classes/class.assAnswerImagemap.php";
419  if ($result->numRows() > 0)
420  {
421  while ($data = $result->fetchRow(MDB2_FETCHMODE_OBJECT))
422  {
423  array_push($this->answers, new ASS_AnswerImagemap($data->answertext, $data->points, $data->aorder, $data->coords, $data->area));
424  }
425  }
426  }
427  parent::loadFromDb($question_id);
428  }
429 
441  }
442 
452  function setImagemapFilename($imagemap_filename, $imagemap_tempfilename = "") {
453  if (!empty($imagemap_filename)) {
454  $this->imagemap_filename = $imagemap_filename;
455  }
456  if (!empty($imagemap_tempfilename)) {
457  $fp = fopen($imagemap_tempfilename, "r");
458  $contents = fread($fp, filesize($imagemap_tempfilename));
459  fclose($fp);
460  if (preg_match_all("/<area(.+)>/siU", $contents, $matches)) {
461  for ($i=0; $i< count($matches[1]); $i++) {
462  preg_match("/alt\s*=\s*\"(.+)\"\s*/siU", $matches[1][$i], $alt);
463  preg_match("/coords\s*=\s*\"(.+)\"\s*/siU", $matches[1][$i], $coords);
464  preg_match("/shape\s*=\s*\"(.+)\"\s*/siU", $matches[1][$i], $shape);
465  $this->addAnswer($alt[1], 0.0, count($this->answers), $coords[1], $shape[1]);
466  }
467  }
468  }
469  }
470 
480  function get_image_filename() {
481  return $this->image_filename;
482  }
483 
484  function getImageFilename()
485  {
486  return $this->image_filename;
487  }
488 
498  function setImageFilename($image_filename, $image_tempfilename = "")
499  {
500  if (!empty($image_filename))
501  {
502  $image_filename = str_replace(" ", "_", $image_filename);
503  $this->image_filename = $image_filename;
504  }
505  if (!empty($image_tempfilename))
506  {
507  $imagepath = $this->getImagePath();
508  if (!file_exists($imagepath))
509  {
510  ilUtil::makeDirParents($imagepath);
511  }
512  if (!ilUtil::moveUploadedFile($image_tempfilename, $image_filename, $imagepath.$image_filename))
513  {
514  $this->ilias->raiseError("The image could not be uploaded!", $this->ilias->error_obj->MESSAGE);
515  }
516  global $ilLog; $ilLog->write("gespeichert: " . $imagepath.$image_filename);
517  }
518  }
519 
529  function get_imagemap_contents($href = "#") {
530  $imagemap_contents = "<map name=\"".$this->title."\"> ";
531  for ($i = 0; $i < count($this->answers); $i++) {
532  $imagemap_contents .= "<area alt=\"".$this->answers[$i]->getAnswertext()."\" ";
533  $imagemap_contents .= "shape=\"".$this->answers[$i]->getArea()."\" ";
534  $imagemap_contents .= "coords=\"".$this->answers[$i]->getCoords()."\" ";
535  $imagemap_contents .= "href=\"$href&selimage=" . $this->answers[$i]->getOrder() . "\" /> ";
536  }
537  $imagemap_contents .= "</map>";
538  return $imagemap_contents;
539  }
540 
555  function addAnswer(
556  $answertext = "",
557  $points = 0.0,
558  $order = 0,
559  $coords="",
560  $area=""
561  )
562  {
563  include_once "./Modules/TestQuestionPool/classes/class.assAnswerImagemap.php";
564  if (array_key_exists($order, $this->answers))
565  {
566  // Insert answer
567  $answer = new ASS_AnswerImagemap($answertext, $points, $order, $coords, $area);
568  for ($i = count($this->answers) - 1; $i >= $order; $i--)
569  {
570  $this->answers[$i+1] = $this->answers[$i];
571  $this->answers[$i+1]->setOrder($i+1);
572  }
573  $this->answers[$order] = $answer;
574  }
575  else
576  {
577  // Append answer
578  $answer = new ASS_AnswerImagemap($answertext, $points, count($this->answers), $coords, $area);
579  array_push($this->answers, $answer);
580  }
581  }
582 
592  function getAnswerCount() {
593  return count($this->answers);
594  }
595 
607  function getAnswer($index = 0) {
608  if ($index < 0) return NULL;
609  if (count($this->answers) < 1) return NULL;
610  if ($index >= count($this->answers)) return NULL;
611  return $this->answers[$index];
612  }
613 
623  function &getAnswers()
624  {
625  return $this->answers;
626  }
627 
638  function deleteArea($index = 0) {
639  if ($index < 0) return;
640  if (count($this->answers) < 1) return;
641  if ($index >= count($this->answers)) return;
642  unset($this->answers[$index]);
643  $this->answers = array_values($this->answers);
644  for ($i = 0; $i < count($this->answers); $i++) {
645  if ($this->answers[$i]->getOrder() > $index) {
646  $this->answers[$i]->setOrder($i);
647  }
648  }
649  }
650 
659  function flushAnswers() {
660  $this->answers = array();
661  }
662 
671  function getMaximumPoints() {
672  $points = 0;
673  foreach ($this->answers as $key => $value) {
674  if ($value->getPoints() > $points)
675  {
676  $points = $value->getPoints();
677  }
678  }
679  return $points;
680  }
681 
693  function calculateReachedPoints($active_id, $pass = NULL)
694  {
695  global $ilDB;
696 
697  $found_values = array();
698  if (is_null($pass))
699  {
700  $pass = $this->getSolutionMaxPass($active_id);
701  }
702  $query = sprintf("SELECT * FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
703  $ilDB->quote($active_id . ""),
704  $ilDB->quote($this->getId() . ""),
705  $ilDB->quote($pass . "")
706  );
707  $result = $ilDB->query($query);
708  while ($data = $result->fetchRow(MDB2_FETCHMODE_OBJECT))
709  {
710  if (strcmp($data->value1, "") != 0)
711  {
712  array_push($found_values, $data->value1);
713  }
714  }
715  $points = 0;
716  if (count($found_values) > 0)
717  {
718  foreach ($this->answers as $key => $answer)
719  {
720  if (in_array($key, $found_values))
721  {
722  $points += $answer->getPoints();
723  }
724  }
725  }
726 
727  $points = parent::calculateReachedPoints($active_id, $pass = NULL, $points);
728  return $points;
729  }
730 
741  function saveWorkingData($active_id, $pass = NULL)
742  {
743  global $ilDB;
744  global $ilUser;
745 
746  if (is_null($pass))
747  {
748  include_once "./Modules/Test/classes/class.ilObjTest.php";
749  $pass = ilObjTest::_getPass($active_id);
750  }
751 
752  $query = sprintf("DELETE FROM tst_solutions WHERE active_fi = %s AND question_fi = %s AND pass = %s",
753  $ilDB->quote($active_id . ""),
754  $ilDB->quote($this->getId() . ""),
755  $ilDB->quote($pass . "")
756  );
757  $result = $ilDB->query($query);
758 
759  if (strlen($_GET["selImage"]))
760  {
761  $query = sprintf("INSERT INTO tst_solutions (solution_id, active_fi, question_fi, value1, value2, pass, TIMESTAMP) VALUES (NULL, %s, %s, %s, NULL, %s, NULL)",
762  $ilDB->quote($active_id),
763  $ilDB->quote($this->getId()),
764  $ilDB->quote($_GET["selImage"]),
765  $ilDB->quote($pass . "")
766  );
767 
768  $result = $ilDB->query($query);
769  include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
771  {
772  $this->logAction($this->lng->txtlng("assessment", "log_user_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
773  }
774  }
775  else
776  {
777  include_once ("./Modules/Test/classes/class.ilObjAssessmentFolder.php");
779  {
780  $this->logAction($this->lng->txtlng("assessment", "log_user_not_entered_values", ilObjAssessmentFolder::_getLogLanguage()), $active_id, $this->getId());
781  }
782  }
783 
784  parent::saveWorkingData($active_id, $pass);
785  return true;
786  }
787 
788  function syncWithOriginal()
789  {
790  if ($this->getOriginalId())
791  {
793  $this->syncFeedbackSingleAnswers();
794  }
795  }
796 
805  function getQuestionType()
806  {
807  return "assImagemapQuestion";
808  }
809 
819  {
820  return "qpl_question_imagemap";
821  }
822 
832  {
833  return "qpl_answer_imagemap";
834  }
835 
845  function saveFeedbackSingleAnswer($answer_index, $feedback)
846  {
847  global $ilDB;
848 
849  $query = sprintf("DELETE FROM qpl_feedback_imagemap WHERE question_fi = %s AND answer = %s",
850  $ilDB->quote($this->getId() . ""),
851  $ilDB->quote($answer_index . "")
852  );
853  $result = $ilDB->query($query);
854  if (strlen($feedback))
855  {
856  include_once("./Services/RTE/classes/class.ilRTE.php");
857  $query = sprintf("INSERT INTO qpl_feedback_imagemap VALUES (NULL, %s, %s, %s, NULL)",
858  $ilDB->quote($this->getId() . ""),
859  $ilDB->quote($answer_index . ""),
860  $ilDB->quote(ilRTE::_replaceMediaObjectImageSrc($feedback, 0))
861  );
862  $result = $ilDB->query($query);
863  }
864  }
865 
874  {
875  global $ilDB;
876 
877  $feedback = "";
878 
879  // delete generic feedback of the original
880  $deletequery = sprintf("DELETE FROM qpl_feedback_imagemap WHERE question_fi = %s",
881  $ilDB->quote($this->original_id . "")
882  );
883  $result = $ilDB->query($deletequery);
884 
885  // get generic feedback of the actual question
886  $query = sprintf("SELECT * FROM qpl_feedback_imagemap WHERE question_fi = %s",
887  $ilDB->quote($this->getId() . "")
888  );
889  $result = $ilDB->query($query);
890 
891  // save generic feedback to the original
892  if ($result->numRows())
893  {
894  while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))
895  {
896  $duplicatequery = sprintf("INSERT INTO qpl_feedback_imagemap VALUES (NULL, %s, %s, %s, NULL)",
897  $ilDB->quote($this->original_id . ""),
898  $ilDB->quote($row["answer"] . ""),
899  $ilDB->quote($row["feedback"] . "")
900  );
901  $duplicateresult = $ilDB->query($duplicatequery);
902  }
903  }
904  }
905 
915  function getFeedbackSingleAnswer($answer_index)
916  {
917  global $ilDB;
918 
919  $feedback = "";
920  $query = sprintf("SELECT * FROM qpl_feedback_imagemap WHERE question_fi = %s AND answer = %s",
921  $ilDB->quote($this->getId() . ""),
922  $ilDB->quote($answer_index . "")
923  );
924  $result = $ilDB->query($query);
925  if ($result->numRows())
926  {
927  $row = $result->fetchRow(MDB2_FETCHMODE_ASSOC);
928  include_once("./Services/RTE/classes/class.ilRTE.php");
929  $feedback = ilRTE::_replaceMediaObjectImageSrc($row["feedback"], 1);
930  }
931  return $feedback;
932  }
933 
943  {
944  global $ilDB;
945 
946  $feedback = "";
947  $query = sprintf("SELECT * FROM qpl_feedback_imagemap WHERE question_fi = %s",
948  $ilDB->quote($original_id . "")
949  );
950  $result = $ilDB->query($query);
951  if ($result->numRows())
952  {
953  while ($row = $result->fetchRow(MDB2_FETCHMODE_ASSOC))
954  {
955  $duplicatequery = sprintf("INSERT INTO qpl_feedback_imagemap VALUES (NULL, %s, %s, %s, NULL)",
956  $ilDB->quote($this->getId() . ""),
957  $ilDB->quote($row["answer"] . ""),
958  $ilDB->quote($row["feedback"] . "")
959  );
960  $duplicateresult = $ilDB->query($duplicatequery);
961  }
962  }
963  }
964 
970  {
972  foreach ($this->answers as $index => $answer)
973  {
974  $text .= $this->getFeedbackSingleAnswer($index);
975  }
976  return $text;
977  }
978 
991  public function setExportDetailsXLS(&$worksheet, $startrow, $active_id, $pass, &$format_title, &$format_bold)
992  {
993  include_once ("./classes/class.ilExcelUtils.php");
994  $solution = $this->getSolutionValues($active_id, $pass);
995  $worksheet->writeString($startrow, 0, ilExcelUtils::_convert_text($this->lng->txt($this->getQuestionType())), $format_title);
996  $worksheet->writeString($startrow, 1, ilExcelUtils::_convert_text($this->getTitle()), $format_title);
997  $i = 1;
998  foreach ($this->getAnswers() as $id => $answer)
999  {
1000  $worksheet->writeString($startrow + $i, 0, ilExcelUtils::_convert_text($answer->getArea() . ": " . $answer->getCoords()), $format_bold);
1001  if ($id == $solution[0]["value1"])
1002  {
1003  $worksheet->write($startrow + $i, 1, 1);
1004  }
1005  else
1006  {
1007  $worksheet->write($startrow + $i, 1, 0);
1008  }
1009  $i++;
1010  }
1011  return $startrow + $i + 1;
1012  }
1013 }
1014 
1015 ?>