Get Minutes for Match Event Back!!!
2012-08-01 20:59
169 查看
For the new pop-up window functionality, we need this field back.
And how does the field look in real world?
So this is the time when the backups come to be useful. I have backed up my whole Joomla! site before I started to develop on the project. So, now, go to the original copy of this two files:
\administrator\components\com_joomsport\admin.joomsport.php
\administrator\components\com_joomsport\admin.joomsport.html.php
Get it From Database:
Let's open admin.joomsport.php, locate function BL_MatchEdit($is_id, $option), on the bottom of its body, we find:
These two blocks did the similar jobs, they both get the data from events,teams andmatch_events
table, but with field player_event of different value.
Actually in my implementation, I removed the query for the case that player_event is 0, which for match events, because we don't need that.
Since the query gets all the fields of table
match_events, we don't need change anything here.
Now open admin.joomsport.html.php, find function
bl_editMatch($row, $lists, $option), here will be complex:
It seems that I've removed the th for minutes and its td. Not finished yet, there is a button, which will trigger a js function: bl_add_event(), it has been changed before, when I cut off the field for minutes. And we get back
all the lines for creating the table cell of minutes.
Save the Data:
As to this problem, we open admin.joomsport.php again, and find function
BL_MatchSave($option), the queries are already there, with the minutes updated into database:
And how does the field look in real world?
So this is the time when the backups come to be useful. I have backed up my whole Joomla! site before I started to develop on the project. So, now, go to the original copy of this two files:
\administrator\components\com_joomsport\admin.joomsport.php
\administrator\components\com_joomsport\admin.joomsport.html.php
Get it From Database:
Let's open admin.joomsport.php, locate function BL_MatchEdit($is_id, $option), on the bottom of its body, we find:
$query = "SELECT me.*,ev.e_name,CONCAT(p.first_name,' ',p.last_name) as p_name FROM #__bl_events as ev , #__bl_players as p, #__bl_match_events as me WHERE me.player_id = p.id AND ev.player_event = '1' AND me.e_id = ev.id AND me.match_id = ".$row->id." ORDER BY CAST(me.minutes AS UNSIGNED),p.first_name,p.last_name"; $db->setQuery($query); //echo mysql_error();die(); $lists['m_events'] = $db->loadObjectList(); $query = "SELECT me.*,ev.e_name,p.t_name as p_name,p.id as pid FROM #__bl_events as ev, #__bl_teams as p , #__bl_match_events as me WHERE me.t_id = p.id AND ev.player_event = '0' AND me.e_id = ev.id AND me.match_id = ".$row->id." ORDER BY p.t_name"; $db->setQuery($query); //echo mysql_error();die(); $lists['t_events'] = $db->loadObjectList();
These two blocks did the similar jobs, they both get the data from events,teams andmatch_events
table, but with field player_event of different value.
Actually in my implementation, I removed the query for the case that player_event is 0, which for match events, because we don't need that.
Since the query gets all the fields of table
match_events, we don't need change anything here.
Now open admin.joomsport.html.php, find function
bl_editMatch($row, $lists, $option), here will be complex:
<table class="adminlist" id="new_events"> <tr> <th align="center" colspan="5" class="title"> <?php echo JText::_( 'BLBE_PLAYEREVENTS' ); ?> </th> </tr> <tr> <th class="title" width="2%"> <?php echo JText::_( 'Num' ); ?> </th> <th class="title" width="170"> <?php echo JText::_( 'BLBE_PLAYEREVENT' ); ?> </th> <th> <?php echo JText::_( 'BLBE_PLAYER' ); ?> </th> <th class="title" width="60"> <?php echo JText::_( 'BLBE_MINUTES' ); ?> </th> <th class="title" width="60"> <?php echo JText::_( 'BLBE_COUNT' ); ?> </th> </tr> <?php if(count($lists['m_events'])){ foreach($lists['m_events'] as $m_events){ echo "<tr>"; echo '<td><input type="hidden" name="em_id[]" value="'.$m_events->id.'" /><a href="javascript: void(0);" onClick="javascript:Delete_tbl_row(this); return false;" title="Delete"><img src="components/com_joomsport/img/publish_x.png" border="0" alt="Delete"></a></td>'; echo '<td><input type="hidden" name="new_eventid[]" value="'.$m_events->e_id.'" />'.$m_events->e_name.'</td>'; echo '<td><input type="hidden" name="new_player[]" value="'.$m_events->player_id.'" />'.$m_events->p_name.'</td>'; echo '<td><input type="text" size="5" maxlength="5" name="e_minuteval[]" value="'.$m_events->minutes.'" /></td>'; echo '<td><input type="text" size="5" maxlength="5" name="e_countval[]" value="'.$m_events->ecount.'" /></td>'; echo "</tr>"; } } ?> </table>
It seems that I've removed the th for minutes and its td. Not finished yet, there is a button, which will trigger a js function: bl_add_event(), it has been changed before, when I cut off the field for minutes. And we get back
all the lines for creating the table cell of minutes.
Save the Data:
As to this problem, we open admin.joomsport.php again, and find function
BL_MatchSave($option), the queries are already there, with the minutes updated into database:
for ($i=0; $i< count($_POST['new_eventid']); $i++) { if(!intval($_POST['em_id'][$i])) { $new_event = $_POST['new_eventid'][$i]; $query = "SELECT team_id FROM #__bl_players WHERE id=".intval($_POST['new_player'][$i]); $db->setQuery($query); $teamid = $db->loadResult(); $query = "INSERT INTO #__bl_match_events(e_id,player_id,match_id,ecount,minutes,t_id) VALUES(".$new_event.",".$_POST['new_player'][$i].",".$row->id.",".intval($_POST['e_countval'][$i]).",".intval($_POST['e_minuteval'][$i]).",".intval($teamid).")"; $db->setQuery($query); $db->query(); $me_arr[] = $db->insertid(); }else{ $query = "SELECT * FROM #__bl_match_events WHERE id=".intval($_POST['em_id'][$i]); $db->setQuery($query); $event_bl = $db->loadObjectList(); if(count($event_bl)){ $query = "UPDATE #__bl_match_events SET minutes=".intval($_POST['e_minuteval'][$i]).",ecount=".intval($_POST['e_countval'][$i])." WHERE id=".intval($_POST['em_id'][$i]); $db->setQuery($query); $db->query(); $me_arr[] = intval($_POST['em_id'][$i]); } } }
相关文章推荐
- Get control name in Page_Load event which make the post back
- Get control name in Page_Load event which make the post back
- AttributeError: 'DisabledBackend' object has no attribute '_get_task_meta_for'
- How to get the MouseEvent coordinates for an element that has CSS3 Transform?
- %matplotlib inline UnknownBackend: No event loop integration for 'inline'.
- Change Log for Joomsport: Get Extra Field back for Player & Team
- How to get the MouseEvent coordinates for an element that has CSS3 Transform?
- How to get the MouseEvent coordinates for an element that has CSS3 Transform?
- java.lang.IllegalStateException: getOutputStream() has already been called for this response
- WordPress出现Briefly unavailable for scheduled maintenance. Check back in a minute. 的解决方法
- jax-rs(Java API for RESTful Web Services)实践教程 之二 —— get/post/put/delete/head
- JDBC在getConnection之前为什么要调用Class.forName
- 无效的列类型: getTimestamp not implemented for class ora
- R12 How to Match a Credit Memo to an Invoice for Correction?
- android KeyEvent for dot "."
- SQL Server 数据库备份9001错误:The log for database 'xxx' is not available. Check the event log for related error messages.
- java.lang.IllegalStateException: getWriter() has already been called for this response
- 服务器死机连不上,zabbix报Trigger: Zabbix agent on Hostname is unreachable for 5 minutes
- 服务器死机连不上,zabbix报Trigger: Zabbix agent on Hostname is unreachable for 5 minutes
- 错误信息:getOutputStream() has already been called for this response