ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilTestExpressPage.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
5 
6  public static function getNodeId($cls) {
7  global $ilDB;
8  $query = 'SELECT cid FROM ctrl_classfile WHERE class = %s';
9  $types = array('text');
10  $values = array($cls);
11  $res = $ilDB->queryF($query, $types, $values);
12 
13  if ($res && $row = $ilDB->fetchAssoc($res)) {
14  return $row['cid'];
15  } else {
16  throw new Exception('unknown ctrl class "' . $cls . '"');
17  }
18  }
19 
20  public static function getReturnToPageLink($q_id = null) {
21  $params = array();
22  $q_id = $q_id ? $q_id : $_REQUEST['q_id'];
23  $params['baseClass'] = 'ilObjTestGUI';
24 
25  if ($_REQUEST['calling_test']) {
26  $params['ref_id'] = $_REQUEST['calling_test'];
27  }
28  else if ($_REQUEST['test_ref_id']) {
29  $params['ref_id'] = $_REQUEST['test_ref_id'];
30  }
31  else {
32  $params['ref_id'] = $_REQUEST['ref_id'];
33  }
34  $params['test_express_mode'] = 1;
35  #$nodeParts = explode(':', $_REQUEST['cmdNode']);
36 
37  if ($_REQUEST['q_id']) {
38  $params['cmd'] = 'edit';
39  $params['q_id'] = $q_id ? $q_id : (isset($_REQUEST['prev_qid']) ? $_REQUEST['prev_qid'] : $_REQUEST['q_id']);
40  $params['cmdClass'] = 'iltestexpresspageobjectgui';
41  $params['cmdNode'] = ilTestExpressPage::getNodeId('ilobjtestgui') . ':' . ilTestExpressPage::getNodeId('iltestexpresspageobjectgui');
42  #ref_id=44&cmd=post&cmdClass=iltestexpresspageobjectgui&cmdNode=6o:61&baseClass=ilObjTestGUI
43  } else {
44  $params['cmd'] = 'showQuestionsPerPage';
45  $params['cmdNode'] = ilTestExpressPage::getNodeId('ilobjtestgui');
46  }
47 
48  return 'ilias.php?' . http_build_query($params);
49  }
50 
51 }