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