public function actionList() { $page = intval(Yii::app()->request->getParam('page', 1)) - 1; $gameId = trim(Yii::app()->request->getParam('game_id')); $cond = new EMongoCriteria(); $cond->sort = array('game_id' => 1); if ($gameId != '') { $cond->compare('game_id', $gameId); } $count = SelfGameAlert::model()->count($cond); $pages = new EMongoPagination($count); $pages->pageSize = self::PAGE_SIZE; $pages->currentPage = $page; $pages->applyLimit($cond); $data = SelfGameAlert::model()->find($cond); $rows = array(); $games = CHtml::listData(BasicGame::model()->getGames(), 'game_code', 'game_name'); $tableRs = QuestTable::model()->find(); $tables = array(); foreach ($tableRs as $value) { $tables[(string) $value->getPrimaryKey()] = $value->name; } foreach ($data as $value) { $tmp = $value->getAttributes(); $tmp['game'] = @isset($games[$tmp['game_id']]) ? $games[$tmp['game_id']] : ''; $tmp['table'] = @isset($tables[$tmp['table_id']]) ? $tables[$tmp['table_id']] : ''; $tmp['alert'] = mb_substr($tmp['alert'], 0, 100, 'UTF8'); $tmp['id'] = (string) $value->getPrimaryKey(); unset($tmp['_id']); $rows[] = $tmp; } echo json_encode(array('count' => $count, 'rows' => $rows)); }
public function actionGettable() { $id = trim(Yii::app()->request->getParam('id')); $rs = QuestTable::model()->findBy_id($id); if ($rs != null) { $data = array('name' => $rs['name'], 'consume_point' => intval($rs['consume_point']), 'consume_time_limit' => intval($rs['consume_time_limit'])); echo json_encode($data); } else { echo ''; } }
<?php $games = CHtml::listData(BasicGame::model()->getGames(), 'game_code', 'game_name'); $types = QuestTable::model()->getTypes(); ?> <style> .ui-timepicker-div .ui-widget-header { margin-bottom: 8px; } .ui-timepicker-div dl { text-align: left; } .ui-timepicker-div dl dt { height: 25px; margin-bottom: -25px; } .ui-timepicker-div dl dd { margin: 0 10px 10px 65px; } .ui-timepicker-div td { font-size: 90%; } .ui-tpicker-grid-label { background: none; border: none; margin: 0; padding: 0; } #ui_tpicker_hour_time,#ui_tpicker_minute_time{ border:1px solid #C5DBEC; } .ui-datepicker { border:1px solid #c5dbec; } .ui-datepicker td a { text-align: center; } .inputDateTime { width:150px; } .error { border:1px solid #EE3C3C; } </style> <div class="content-box"><!-- Start Content Box --> <div class="content-box-header" style="height:10px;">
public function actionAll() { $data = QuestTable::model()->find(); $rows = array(); foreach ($data as $value) { $rows[] = array('id' => (string) $value->getPrimaryKey(), 'name' => $value->name); } echo json_encode(array('rows' => $rows)); }
public function getTable($data, $row) { $tableName = ''; $tables = CHtml::listData(QuestTable::model()->getTables(), 'id', 'name'); if (isset($tables[$data->table_id])) { $tableName = $tables[$data->table_id]; } return $tableName; }
<?php $games = CHtml::listData(BasicGame::model()->getGames(), 'game_code', 'game_name'); $quests = CHtml::listData(QuestTable::model()->getTables(), 'id', 'name'); ?> <style type="text/css"> .row { margin-top:20px; } .row_label{ line-height:22px; padding-right:10px; } form label { font-weight: normal; } .error { background: #ffcece url(''); border-color: #df8f8f; color: #665252; } .errorMessage { padding-left:50px; color:red; } .success { background: #d5ffce url(''); border-color: #9adf8f; color: #556652; }