getId(); $ret = $kdb->query("SELECT * FROM psyhvel_gamepacks WHERE userID=".$userID." AND folderID=".$_SESSION['gamepackid']); $finfo = mysql_fetch_array($ret); $this->packinfo = $finfo; } } function getFID() { return $this->packinfo['folderID']; } function getTitle() { return $this->packinfo['title']; } function getDescription() { return $this->packinfo['description']; } function getGamesheets() { global $psyhvel, $kdb, $user; $fi = isset($_SESSION['gamepackid']) ? "=".$_SESSION['gamepackid'] : " IS NULL"; $userID = $user->getId(); $reso = $kdb->getResourcesByType("gamesheet", array('userID'=>$userID." AND folderid".$fi)); return $reso; } /** * @Secured('roles' = {'member'}, 'valid' = {}) * */ public function actionGamepackHandler() { global $kdb, $user; if ( strlen(trim($_POST['extgpid'])) > 0 ) { // modify existing $_SESSION['gamepackid'] = $_POST['extgpid']; $q = "UPDATE psyhvel_gamepacks set title='%s', description='%s' WHERE folderId=%s"; $q = sprintf($q, $_POST['gptitle'], $_POST['gpdesc'], $_POST['extgpid']); $kdb->query($q); } else { // create new if ( $_SESSION['folderid'] != NULL ) { $q = "INSERT INTO psyhvel_gamepacks (parentFolder, userId, title, description) values (%s, %s, '%s', '%s')"; $q = sprintf($q, $_SESSION['folderid'], $user->getId(), $_POST['gptitle'], $_POST['gpdesc']); } else { $q = "INSERT INTO psyhvel_gamepacks (userId, title, description) values (%s, '%s', '%s')"; $q = sprintf($q, $user->getId(), $_POST['gptitle'], $_POST['gpdesc']); } $kdb->query($q); $autoid = mysql_insert_id(); $_SESSION['gamepackid'] = $autoid; } return array('pid' => 'Gamepack'); } /** * @Secured('roles' = {'authenticated'}, 'valid' = {}) * */ public function actionCancel() { return array('pid' => 'MyFolder'); } } ?>