Changeset 74
- Timestamp:
- 10/23/06 12:56:55 (2 years ago)
- Files:
-
- trunk/com_mls_teams/admin.mls_teams.php (modified) (1 diff)
- trunk/com_mls_teams/install.mls_teams.php (modified) (1 diff)
- trunk/com_mls_teams/mls_teams.php (modified) (2 diffs)
- trunk/com_mls_teams/mls_teams.xml (modified) (1 diff)
- trunk/com_mls_teams/version (modified) (1 diff)
- trunk/com_mls_teams/versions.php (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/com_mls_teams/admin.mls_teams.php
r72 r74 17 17 $cid = array(0); 18 18 } 19 if(file_exists($mosConfig_absolute_path."/administrator/components/".$option."/version")) { 20 $act = update; 21 } 19 22 20 23 switch($act) { 24 case "update": 25 include($mosConfig_absolute_path."/administrator/components/".$option."/install.".substr($option,4).".php"); 26 update(); 27 break; 21 28 case "teams": 22 29 switch($task) { trunk/com_mls_teams/install.mls_teams.php
r72 r74 45 45 <?php 46 46 }; 47 48 function update() { 49 global $option, $database, $mosConfig_absolute_path; 50 51 //get versions array 52 $file = $mosConfig_absolute_path."/administrator/components/".$option."/versions.php"; 53 if(file_exists($file)) { 54 include($file); 55 } 56 57 $old_ver = file_get_contents($mosConfig_absolute_path."/administrator/components/".$option."/curr_version"); 58 $new_ver = file_get_contents($mosConfig_absolute_path."/administrator/components/".$option."/version"); 59 60 //get array keys 61 $old_key = array_search($old_ver,$versions); 62 $next_version = $old_key + 1; 63 $new_key = array_search($new_ver,$versions); 64 65 if($new_key > $old_key) { 66 //we have a new version installed, perform update 67 updateSoftware($versions[$next_version],$versions[$new_key],$versions[$old_key]); 68 } 69 70 //now, rename the version file 71 $src = $mosConfig_absolute_path."/administrator/components/com_mls_teams/version"; 72 $dst = $mosConfig_absolute_path."/administrator/components/com_mls_teams/curr_version"; 73 @rename($src,$dst); 74 }; 75 76 function updateSoftware($new_version,$final_version,$old_version) { 77 echo "<h3>Performing update from <b>'".$old_version."'</b> to <b>".$new_version."'</b></h3>\n"; 78 global $versions; 79 performUpdate($new_version); 80 ?> 81 <span style="font-weight: bold; color: #00FF00">Complete!</span> 82 <hr> 83 <?php 84 if($new_version != $final_version AND $final_version != "") { 85 $old_key = array_search($new_version,$versions); 86 $next_version = $old_key + 1; 87 updateSoftware($versions[$next_version],$final_version,$versions[$old_key]); 88 } 89 }; 90 91 function performUpdate($v) { 92 switch($v) { 93 case "0.0.2": 94 echo "nothing to be done for 0.0.2<br />"; 95 break; 96 } 97 }; 47 98 ?> trunk/com_mls_teams/mls_teams.php
r72 r74 61 61 //we are on the 'my teams' page, list only teams of which I am member 62 62 //had to use little workaround (I _love_ MySQL functions...) 63 64 // get the total number of records 63 65 $database->setQuery( "SELECT c.*, COUNT(m.id) AS `members`,COUNT(IF(m.userid=".$userid.",1,NULL)) AS `my_check`" 64 66 ."\n FROM `#__mls_teams` AS `c`" 65 ."\n INNERJOIN `#__mls_teams_members` AS `m` ON m.teamid=c.id"67 ."\n LEFT JOIN `#__mls_teams_members` AS `m` ON m.teamid=c.id" 66 68 ."\n GROUP BY c.id" 69 ."\n HAVING `my_check` > 0" 67 70 ."\n ORDER BY c.name ASC"); 68 $tmp = $database->loadObjectList(); 69 $rows = array(); 70 foreach($tmp as $row) { 71 if($row->my_check > 0) { 72 $rows[] = $row; 73 } 74 } 71 $rows = $database->loadObjectList(); 75 72 $total = count($rows); 76 73 … … 80 77 $pageNav = new mosPageNav( $total, $limitstart, $limit ); 81 78 79 //Select records 82 80 $database->setQuery( "SELECT c.*, COUNT(m.id) AS `members`,COUNT(IF(m.userid=".$userid.",1,NULL)) AS `my_check`" 83 81 ."\n FROM `#__mls_teams` AS `c`" 84 ."\n INNERJOIN `#__mls_teams_members` AS `m` ON m.teamid=c.id"82 ."\n LEFT JOIN `#__mls_teams_members` AS `m` ON m.teamid=c.id" 85 83 ."\n GROUP BY c.id" 84 ."\n HAVING `my_check` > 0" 86 85 ."\n ORDER BY c.name ASC" 87 86 ."\n LIMIT $pageNav->limitstart, $pageNav->limit"); 88 87 $tmp = $database->loadObjectList(); 88 89 89 $rows = array(); 90 90 foreach($tmp as $row) { 91 if($row->my_check > 0) { 92 $row->ngl_id = $row->ngl_id ? $row->ngl_id : ""; 93 $rows[] = $row; 94 } 91 $row->ngl_id = $row->ngl_id ? $row->ngl_id : ""; 92 $rows[] = $row; 95 93 } 96 94 } else { trunk/com_mls_teams/mls_teams.xml
r72 r74 3 3 <name>mls_teams</name> 4 4 <package time_limit="150">myLANsite</package> 5 <creationDate> 13/02/2005</creationDate>5 <creationDate>01/10/2005</creationDate> 6 6 <author>Samuel Suter</author> 7 7 <copyright>This component is Free Software released under the GNU/GPL License. (c) 2005 Samuel Suter</copyright> 8 8 <authorEmail>samuel.suter@gmx.ch</authorEmail> 9 <authorUrl>http://www.mylansite.org /</authorUrl>10 <version>0.0. 1</version>9 <authorUrl>http://www.mylansite.org</authorUrl> 10 <version>0.0.2</version> 11 11 <description>myLANsite Teams</description> 12 12 <files> trunk/com_mls_teams/version
r72 r74 1 0.0. 11 0.0.2