getId(); $ret = $kdb->query("SELECT * FROM psyhvel_tests WHERE userID=".$userID." AND testID=".$id); $tinfo = mysql_fetch_array($ret); $this->setTestID($id); $this->setTitle($tinfo['title']); $this->setActive($tinfo['active']); $this->setCreator($tinfo['userID']); $this->setCreated($tinfo['created']); $this->setDescription($tinfo['description']); $this->setSecurity($tinfo['security']); $ret = $kdb->query("SELECT * FROM psyhvel_testrelations WHERE testID=".$id); $ttargets = array(); while ($ttarget = mysql_fetch_array($ret)) { $ttargets []= $ttarget['groupID']; } $this->setTargets($ttargets); } else { $this->setTestID("new"); $this->setTitle(""); $this->setCreator(-1); $this->setDescription(""); $this->setSecurity("private"); $this->setActive(0); } } function getTestID() { return $this->tid; } function setTestID($d) { $this->tid = $d; } function getTitle() { return $this->title; } function setTitle($d) { $this->title = $d; } function getCreator() { return $this->creator; } function setCreator($d) { $this->creator = $d; } function getCreated() { return $this->created; } function setCreated($d) { $this->created = $d; } function getActive() { return $this->active; } function setActive($d) { $this->active = $d; } function getDescription() { return $this->description; } function setDescription($d) { $this->description = $d; } function getSecurity() { return $this->security; } function setSecurity($d) { if (in_array($d, array("private", "public"))) { $this->security = $d; } } function getTargets() { return $this->groups; } function setTargets($d) { $this->groups = $d; } function getGroups() { return array(array('id'=>1, 'title'=>'KEF09'),array('id'=>2, 'title'=>'KEF10')); //return $this->groups; } function getTargetsList() { global $kdb; $list = array(); foreach ( $this->groups as $gid) { $ret = $kdb->query("SELECT groupName FROM psyhvel_groups WHERE groupID=".$gid); $res = mysql_fetch_array($ret); $list []= $res['groupName']; } return join(", ", $list); } function getMyGamepacks() { global $kdb, $user; $ret = $kdb->query("SELECT * FROM psyhvel_gamepacks WHERE userID=".$user->getID()); $gps = array(); while ($gp = mysql_fetch_array($ret)) { $gps []= $gp; } return $gps; } function renderTestTable($width=600, $owidth=200) { global $user; $objects = array(); $table = array(); $counter = 0; $testObjects = array(); $nrOfObjs = count($testObjects); $notActive = true; $table []= '
'.gettext('Test').' '.($counter+1).' | '; } else { $objects []= ''.gettext('Test').' '.($counter+1).' | '; } } else if ($notActive) { if (!$isEditor) { $objects []= ''.gettext('Test').' '.(counter+1).' | '; } else { $objects []= ''.gettext('Test').' '.($counter+1).' | '; } } else { $objects []= ''.gettext('Test').' '.($counter+1).' | '; } if (1==1) { //getCurrentPage()==0: $notActive = true; } $counter++; } if ($isEditor) { $url = '?pid=Test&mode=select&tid='.$this->getTestID(); $objects []= ''.gettext('Add Test').' | '; } $nrOfObjs = count($objects); $rows = ($nrOfObjs*$owidth/$width)+1; $max_objs = $width/$owidth; if ($nrOfObjs < $max_objs) { $max_objs = $nrOfObjs; } foreach (range(0,$rows) as $line) { $table []= '||
![]() | ';
} else {
$spacer []= ''; } } else if (count($objects) > 0 && $i%2 != 0 && $line%2 == 0) { $lines []= ' | ![]() | ';
$spacer []= ''; } else if (count($objects) > 0 && $i%2 != 0 && $line%2 != 0) { $lines []= ' | ![]() | ';
$spacer []= ''; } else { $lines []= ' | '; $spacer []= ' | '; } } if ($line%2 != 0 ) { array_reverse($lines); array_reverse($spacer); } foreach ($lines as $li) { $table []= $li; } $table []= ' |