0.90 hack mod: twice the date What did I do wrong

User avatar
cbs48
.
Posts: 249
Joined: Mon Apr 23, 2007 9:26 am
Location: Almere, the Netherlands
Contact:

0.90 hack mod: twice the date What did I do wrong

Postby cbs48 » Wed Aug 08, 2007 8:22 am

Hi, I tried to change the mod_joomleague_results.php so it show also the date of the current round and the gametimes.

I did this with the following changes:

Code: Select all

defined( '_VALID_MOS' ) or die( 'Direct Access to this location is not allowed.' );

if (file_exists($mosConfig_absolute_path.'/components/com_joomleague/language/'.$mosConfig_lang.'.php')) {
  include_once($mosConfig_absolute_path.'/components/com_joomleague/language/'.$mosConfig_lang.'.php');
}
else{
  include_once($mosConfig_absolute_path.'/components/com_joomleague/language/english.php');
}

require_once 'administrator/components/com_joomleague/joomleague.class.php';

#comment this line for mambo version < 4.5.1
$params = mosParseParams( $module->params );

$p = $params->project; //default 0
$last_round = $params->last_round; //default 0
$show = $params->show; //default 1
$show_shortnames = $params->show_shortnames; //default 0
$show_link = $params->show_link; //default 1

if($p > 0){
  $project = new JoomLeague( $database );
  $project->load($p);

  if ($last_round == 1)
  $matches = $project->getResults($project->current_round-1);
  else $matches = $project->getResults($project->current_round);

if($show > 0){?><div align="center"><b><?php echo $project->name;?></b></div><?php }?>
 
<table width="100%" align="center" border="0" cellpadding="2" cellspacing="1">
 
<?php
              
  $k = 0;
  foreach($matches as $match){
   
    $class = ($k == 0)? 'sectiontableentry1' : 'sectiontableentry2';
   
    if($match->team_id1 == $project->fav_team && $show_shortnames == 1){
   
?>
<?php   
     
      }
      if($round_date != $match->round_date){
       
        $round_date = $match->round_date;
?>
<p>
<div align="center"><?php echo mosFormatDate($round_date, _JL_DATE_MOD);?></div>
</p>
    <tr class="<?php print $class;?>">
         <td align="left" nowrap="nowrap"><b><?php echo mosFormatDate($match->round_date, "%H:%M");?></b></td>
         <td align="left" nowrap="nowrap"><b><?php echo $match->home_short;?></b></td>
      <td align="left">-</td>
      <td align="left" nowrap="nowrap"><?php echo $match->away_short;?></td>
      <td align="center" nowrap="nowrap"><?php printf("%s:%s",$match->e1,$match->e2);?></td>
    </tr>
<?php
    }
   
    else if($match->team_id2 == $project->fav_team && $show_shortnames == 1){
?>
    <tr class="<?php print $class;?>">
         <td align="left" nowrap="nowrap"><b><?php echo mosFormatDate($match->round_date, "%H:%M");?></b></td>         <td align="left" nowrap="nowrap"><b><?php echo $match->home_short;?></b></td>
      <td align="left">-</td>
      <td align="left" nowrap="nowrap"><?php echo $match->away_short;?></td>
      <td align="center" nowrap="nowrap"><?php printf("%s:%s",$match->e1,$match->e2);?></td>
    </tr>
<?php
    }
    else if($show_shortnames == 1){
?>
    <tr class="<?php print $class;?>">
<td align="left" nowrap="nowrap"><b><?php echo mosFormatDate($match->round_date, "%H:%M");?></b></td>
      <td align="left" nowrap="nowrap"><b><?php echo $match->home_short;?></b></td>
      <td align="left">-</td>
      <td align="left" nowrap="nowrap"><?php echo $match->away_short;?></td>
      <td align="center" nowrap="nowrap"><?php printf("%s:%s",$match->e1,$match->e2);?></td>
    </tr>

....


Now it shows the date twice, What could I have done wrong?



[gelöscht durch Administrator]
http://www.afbnscore.nl
Using Joomla 1.0.14 and Joomleague 0.92 svn 926
http://www.coachbart.nl
Using Joomla 1.0.13 and Joomleague 0.92 (test purpose only with data of afbnscore)

User avatar
julienV
Joomleague Core Developer
Joomleague Core Developer
Posts: 2016
Joined: Tue Jun 19, 2007 9:27 am
Location: France
Contact:

Re: 0.90 hack mod: twice the date What did I do wrong

Postby julienV » Wed Aug 08, 2007 1:33 pm

it is strange, are you sure this is the right file ?

you can try to comment the "echo xxxxx", with "//echo xxxx" see where it comes from
You can hire me, I'm a Joomla professional freelance developer.
Please contact me at jlv@jlv-solutions.com
NO PM, please use email !

User avatar
cbs48
.
Posts: 249
Joined: Mon Apr 23, 2007 9:26 am
Location: Almere, the Netherlands
Contact:

Re: 0.90 hack mod: twice the date What did I do wrong

Postby cbs48 » Wed Aug 08, 2007 2:01 pm

It is the right file.

I tried this :

Code: Select all

<div align="center"><?php echo mosFormatDate($round_date, "test");?></div>


and it show this also twice



[gelöscht durch Administrator]
http://www.afbnscore.nl
Using Joomla 1.0.14 and Joomleague 0.92 svn 926
http://www.coachbart.nl
Using Joomla 1.0.13 and Joomleague 0.92 (test purpose only with data of afbnscore)

User avatar
julienV
Joomleague Core Developer
Joomleague Core Developer
Posts: 2016
Joined: Tue Jun 19, 2007 9:27 am
Location: France
Contact:

Re: 0.90 hack mod: twice the date What did I do wrong

Postby julienV » Wed Aug 08, 2007 2:47 pm

that is because you compare the date for each game:

Code: Select all

if($round_date != $match->round_date){

and if different, you echo the date again. a "date", includes the date+time...

Here, you have to game with the exact same date (the one starting at 14:00), and one starting at 11:00, hence, you display the date twice

here is a solution if you want (beginning is the same)

Code: Select all

<?php
              
  $k = 0;
  foreach($matches as $match){
   
    $class = ($k == 0)? 'sectiontableentry1' : 'sectiontableentry2';
   
    // display the date if it doesn't match the current
    if(mosFormatDate($round_date, _JL_DATE_MOD) != mosFormatDate($match->round_date, _JL_DATE_MOD)){
      $round_date = $match->round_date;
      ?>
      <tr>
       <td colspan="5" align="center"><?php echo mosFormatDate($round_date, _JL_DATE_MOD);?></td>
      </tr>
      <?php
    }

    if($match->team_id1 == $project->fav_team && $show_shortnames == 1){
      ?>
      <tr class="<?php print $class;?>">
           <td align="left" nowrap="nowrap"><b><?php echo mosFormatDate($match->round_date, "%H:%M");?></b></td>
           <td align="left" nowrap="nowrap"><b><?php echo $match->home_short;?></b></td>
        <td align="left">-</td>
        <td align="left" nowrap="nowrap"><?php echo $match->away_short;?></td>
        <td align="center" nowrap="nowrap"><?php printf("%s:%s",$match->e1,$match->e2);?></td>
      </tr>
      <?php
    }
   
    else if($match->team_id2 == $project->fav_team && $show_shortnames == 1){
      ?>
      <tr class="<?php print $class;?>">
           <td align="left" nowrap="nowrap"><b><?php echo mosFormatDate($match->round_date, "%H:%M");?></b></td>
           <td align="left" nowrap="nowrap"><b><?php echo $match->home_short;?></b></td>
        <td align="left">-</td>
        <td align="left" nowrap="nowrap"><?php echo $match->away_short;?></td>
        <td align="center" nowrap="nowrap"><?php printf("%s:%s",$match->e1,$match->e2);?></td>
      </tr>
      <?php
    }
    else if($show_shortnames == 1){
      ?>
      <tr class="<?php print $class;?>">
           <td align="left" nowrap="nowrap"><b><?php echo mosFormatDate($match->round_date, "%H:%M");?></b></td>
           <td align="left" nowrap="nowrap"><b><?php echo $match->home_short;?></b></td>
        <td align="left">-</td>
        <td align="left" nowrap="nowrap"><?php echo $match->away_short;?></td>
        <td align="center" nowrap="nowrap"><?php printf("%s:%s",$match->e1,$match->e2);?></td>
      </tr>
      <?php   
    }
   
    if($match->team_id1 == $project->fav_team && $show_shortnames == 0){
      ?>
      <tr class="<?php print $class;?>">
           <td align="left" nowrap="nowrap"><b><?php echo mosFormatDate($match->round_date, "%H:%M");?></b></td>
           <td align="left" nowrap="nowrap"><b><?php echo $match->home_short;?></b></td>
        <td align="left">-</td>
        <td align="left" nowrap="nowrap"><?php echo $match->away_short;?></td>
        <td align="center" nowrap="nowrap"><?php printf("%s:%s",$match->e1,$match->e2);?></td>
      </tr>
      <?php
    }
   
    else if($match->team_id2 == $project->fav_team && $show_shortnames == 0){
      ?>
      <tr class="<?php print $class;?>">
           <td align="left" nowrap="nowrap"><b><?php echo mosFormatDate($match->round_date, "%H:%M");?></b></td>
           <td align="left" nowrap="nowrap"><b><?php echo $match->home_short;?></b></td>
        <td align="left">-</td>
        <td align="left" nowrap="nowrap"><?php echo $match->away_short;?></td>
        <td align="center" nowrap="nowrap"><?php printf("%s:%s",$match->e1,$match->e2);?></td>
      </tr>
      <?php
    }
    else if($show_shortnames == 0){
      ?>
      <tr class="<?php print $class;?>">
           <td align="left" nowrap="nowrap"><b><?php echo mosFormatDate($match->round_date, "%H:%M");?></b></td>
           <td align="left" nowrap="nowrap"><b><?php echo $match->home_short;?></b></td>
        <td align="left">-</td>
        <td align="left" nowrap="nowrap"><?php echo $match->away_short;?></td>
        <td align="center" nowrap="nowrap"><?php printf("%s:%s",$match->e1,$match->e2);?></td>
      </tr>
      <?php   
    }   
   
    $k = 1 - $k;
  }
?>

</table>
<?php if($show_link == 1){?>
<table width="100%">
      <tr>
        <td align="center">
          <?php
            if ($last_round == 1)
                $round = $project->current_round-1;
            else $round = $project->current_round;
            printf('<a href="index.php?option=com_joomleague&func=showResults&p=%s&r=%s&Itemid=%s">'._JL_MODULE_RESULTS_DETAILS.'</a>', $project->id,$round, $Itemid);?>
        </td>
      </tr>
</table>
<?php };?>     

<?php

}
else{
  echo "missing parameter project";
}

?>
You can hire me, I'm a Joomla professional freelance developer.
Please contact me at jlv@jlv-solutions.com
NO PM, please use email !

User avatar
cbs48
.
Posts: 249
Joined: Mon Apr 23, 2007 9:26 am
Location: Almere, the Netherlands
Contact:

Re: 0.90 hack mod: twice the date What did I do wrong

Postby cbs48 » Mon Sep 17, 2007 8:07 pm

OKe new version (0.91) and new modules. So I tried to get the date and time back in the module but it won't work again. So I need help again the get the results as shown in the image in the begin of this post.

Couldn't it be standard to put the matchdate and time in the module
http://www.afbnscore.nl
Using Joomla 1.0.14 and Joomleague 0.92 svn 926
http://www.coachbart.nl
Using Joomla 1.0.13 and Joomleague 0.92 (test purpose only with data of afbnscore)

User avatar
julienV
Joomleague Core Developer
Joomleague Core Developer
Posts: 2016
Joined: Tue Jun 19, 2007 9:27 am
Location: France
Contact:

Re: 0.90 hack mod: twice the date What did I do wrong

Postby julienV » Tue Sep 18, 2007 7:49 am

can you try this ?

[gelöscht durch Administrator]
Last edited by julienV on Tue Sep 18, 2007 8:04 am, edited 1 time in total.
You can hire me, I'm a Joomla professional freelance developer.
Please contact me at jlv@jlv-solutions.com
NO PM, please use email !

User avatar
cbs48
.
Posts: 249
Joined: Mon Apr 23, 2007 9:26 am
Location: Almere, the Netherlands
Contact:

Re: 0.90 hack mod: twice the date What did I do wrong

Postby cbs48 » Tue Sep 18, 2007 8:25 am

Thanxs, It's right again.

Add an new line in your language file:

Code: Select all

DEFINE('_JL_DATE_MOD','%A, %d %B %Y');


and it looks like:



[gelöscht durch Administrator]
http://www.afbnscore.nl
Using Joomla 1.0.14 and Joomleague 0.92 svn 926
http://www.coachbart.nl
Using Joomla 1.0.13 and Joomleague 0.92 (test purpose only with data of afbnscore)

User avatar
cbs48
.
Posts: 249
Joined: Mon Apr 23, 2007 9:26 am
Location: Almere, the Netherlands
Contact:

Re: 0.90 hack mod: twice the date What did I do wrong

Postby cbs48 » Tue Sep 18, 2007 8:35 am

I use this module instead of the next match module because I have no favorite team. I want to show the next matches of the league.

I am very happy with this small modification.
http://www.afbnscore.nl
Using Joomla 1.0.14 and Joomleague 0.92 svn 926
http://www.coachbart.nl
Using Joomla 1.0.13 and Joomleague 0.92 (test purpose only with data of afbnscore)

User avatar
julienV
Joomleague Core Developer
Joomleague Core Developer
Posts: 2016
Joined: Tue Jun 19, 2007 9:27 am
Location: France
Contact:

Re: 0.90 hack mod: twice the date What did I do wrong

Postby julienV » Tue Sep 18, 2007 9:19 am

here is a cleaner module, with settings in backend (integrated to mainstream version)

[gelöscht durch Administrator]
You can hire me, I'm a Joomla professional freelance developer.
Please contact me at jlv@jlv-solutions.com
NO PM, please use email !

User avatar
cbs48
.
Posts: 249
Joined: Mon Apr 23, 2007 9:26 am
Location: Almere, the Netherlands
Contact:

Re: 0.90 hack mod: twice the date What did I do wrong

Postby cbs48 » Tue Sep 18, 2007 10:32 am

Great work.

I changed the next line:

Code: Select all

        <td align="left" nowrap="nowrap"><b><?php echo mosFormatDate($match->match_date, "%H:%M",0);?> <?php echo _JL_CLOCK;?></b></td>


As you can see I added

Code: Select all

<?php echo _JL_CLOCK;?>
http://www.afbnscore.nl
Using Joomla 1.0.14 and Joomleague 0.92 svn 926
http://www.coachbart.nl
Using Joomla 1.0.13 and Joomleague 0.92 (test purpose only with data of afbnscore)

User avatar
julienV
Joomleague Core Developer
Joomleague Core Developer
Posts: 2016
Joined: Tue Jun 19, 2007 9:27 am
Location: France
Contact:

Re: 0.90 hack mod: twice the date What did I do wrong

Postby julienV » Tue Sep 18, 2007 1:10 pm

ok, added it too.
You can hire me, I'm a Joomla professional freelance developer.
Please contact me at jlv@jlv-solutions.com
NO PM, please use email !


Return to “mod_joomleague_results”

Who is online

Users browsing this forum: No registered users and 2 guests

cron