public static function makeList() { global $lng, $coach, $settings; HTMLOUT::frame_begin(); # Make page frame, banner and menu. title($lng->getTrn('name', __CLASS__)); echo $lng->getTrn('desc', __CLASS__) . "<br><br>\n"; list($sel_node, $sel_node_id) = HTMLOUT::nodeSelector(array()); $ALLOW_EDIT = is_object($coach) && $coach->isNodeCommish($sel_node, $sel_node_id); /* A new entry was sent. Add it to system */ if ($ALLOW_EDIT && isset($_POST['tid']) && isset($_POST['trid'])) { if (get_magic_quotes_gpc()) { $_POST['title'] = stripslashes($_POST['title']); $_POST['txt'] = stripslashes($_POST['txt']); } switch ($_GET['action']) { case 'new': status(self::create($_POST['ptype'], $_POST['tid'], $_POST['trid'], $_POST['title'], $_POST['txt'])); break; } } /* Was a request for a new entry made? */ if (isset($_GET['action']) && $ALLOW_EDIT) { switch ($_GET['action']) { case 'delete': if (isset($_GET['prid']) && is_numeric($_GET['prid'])) { $pr = new Prize($_GET['prid']); status($pr->delete()); unset($pr); } else { fatal('Sorry. You did not specify which prize ID you wish to delete.'); } break; case 'new': echo "<a href='handler.php?type=prize'><-- " . $lng->getTrn('common/back') . "</a><br><br>"; $_DISABLED = !isset($_POST['trid']) ? 'DISABLED' : ''; ?> <form name="STS" method="POST" enctype="multipart/form-data"> <b><?php echo $lng->getTrn('common/tournament'); ?> </b><br> <?php echo HTMLOUT::nodeList(T_NODE_TOURNAMENT, 'trid'); ?> <input type='submit' value='<?php echo $lng->getTrn('common/select'); ?> '> </form> <br> <form method="POST" enctype="multipart/form-data"> <b><?php echo $lng->getTrn('team', __CLASS__); ?> </b><br> <select name="tid" <?php echo $_DISABLED; ?> > <?php $teams = isset($_POST['trid']) ? Team::getTeams(false, array(get_parent_id(T_NODE_TOURNAMENT, (int) $_POST['trid'], T_NODE_LEAGUE)), true) : array(); foreach ($teams as $tid => $name) { echo "<option value='{$tid}'>{$name}</option>\n"; } ?> </select> <br><br> <b><?php echo $lng->getTrn('kind', __CLASS__); ?> </b><br> <select name="ptype" <?php echo $_DISABLED; ?> > <?php foreach (self::getTypes() as $ptype => $desc) { echo "<option value='{$ptype}'>{$desc}</option>\n"; } ?> </select> <br><br> <?php echo '<b>' . $lng->getTrn('g_title', __CLASS__) . '</b> — ' . $lng->getTrn('title', __CLASS__); ?> <br> <input type="text" name="title" size="60" maxlength="100" value="" <?php echo $_DISABLED; ?> > <br><br> <?php echo '<b>' . $lng->getTrn('g_about', __CLASS__) . '</b> — ' . $lng->getTrn('about', __CLASS__); ?> <br> <textarea name="txt" rows="15" cols="100" <?php echo $_DISABLED; ?> ></textarea> <br><br><br> <input type='hidden' name='trid' value='<?php echo $_DISABLED ? 0 : $_POST['trid']; ?> '> <input type="submit" value="<?php echo $lng->getTrn('submit', __CLASS__); ?> " name="Submit" <?php echo $_DISABLED; ?> > </form> <br> <?php return; break; } } if ($ALLOW_EDIT) { echo "<br><a href='handler.php?type=prize&action=new'>" . $lng->getTrn('new', __CLASS__) . "</a><br>\n"; } /* Print the prizes */ self::printList($sel_node, $sel_node_id, $ALLOW_EDIT); HTMLOUT::frame_end(); }
public function doWebPrizes() { global $_GPC, $_W, $ptr_title; checklogin(); load()->func('tpl'); $op = $_GPC['op']; $group_id = intval($_GPC['group_id']); $settings = getModulesSettings($this->modulename); if ($group_id <= 0) { $group_id = $settings['prize_group']; } $_GPC['group_id'] = $group_id; $ops = array('display', 'edit', 'delete', 'test', 'record'); $op = in_array($op, $ops) ? $op : 'display'; $cls = new Prize(); $ptr_title = '奖品例表'; //ajax 按钮 if ($_W['ispost'] && $_W['isajax']) { if (!empty($_GPC['fieldmap']) && $_GPC['fieldmap'] == 'status' && $cls->change()) { exit('success'); } elseif (!empty($_GPC['fieldmap']) && $_GPC['fieldmap'] == 'release' && $cls->release()) { exit('success'); } exit('操作失败'); } if ($op == 'delete') { if ($cls->delete()) { message('删除成功!', $this->createWebUrl('Prizes')); } } elseif ($op == 'edit') { list($code, $groups) = $cls->groups(); $id = $_GPC['id']; $_W['page']['title'] = intval($id) > 0 ? '奖品编辑 - 主要业务模块 - 签到' : '奖品添加 - 主要业务模块 - 签到'; $ptr_title = intval($id) > 0 ? '奖品编辑' : '奖品添加'; list($code, $message, $prize) = $cls->edit(); if (!$code) { message($message); } if (intval($id) > 0 && empty($prize)) { message('奖品不存在.', $this->createWebUrl('Prizes', array('group_id' => $group_id))); } if ($code && !empty($message)) { message($message, $this->createWebUrl('Prizes', array('group_id' => $group_id))); } } elseif ($op == 'test') { $cls->test_lottery(1, $settings['prize_group']); } elseif ($op == 'record') { $prize = $cls->findPrize(); } if (checksubmit('import')) { $cls->import(); } //导入奖品 list($list, $total, $pager) = $cls->_list(); //未领 include $this->template('prizes'); }