Go to the source code of this file.
Functions | |
| show_features_boxes () | |
| show_sitestats () | |
| show_newest_projects ($group_type, $limit) | |
| show_votes ($limit=10) | |
|
|
Definition at line 28 of file features_boxes.php. References $count, $HTML, $j, $result, $return, db_fetch_array(), db_numrows(), db_query(), people_show_category_list(), show_newest_projects(), show_sitestats(), show_votes(), type_id, and utils_link(). 00029 { 00030 GLOBAL $HTML; 00031 00032 #### General Stats 00033 00034 $return .= $HTML->box_top(utils_link($GLOBALS['sys_home']."stats/", sprintf(_("%s Statistics"),$GLOBALS['sys_name']),"sortbutton")); 00035 00036 $return .= show_sitestats(); 00037 $return .= $HTML->box_bottom(); 00038 00039 00040 #### Job offers Stats 00041 $jobs = people_show_category_list(); 00042 00043 if ($jobs) 00044 { 00045 $return .= "<br />\n"; 00046 $return .= $HTML->box_top(_("Help Wanted"),'',1); 00047 $return .= $jobs; 00048 $return .= $HTML->box_bottom(1); 00049 } 00050 00051 00052 ### Popular items 00053 $votes = show_votes(); 00054 00055 if ($votes) 00056 { 00057 $return .= "<br />\n"; 00058 $return .= $HTML->box_top(_("Most Popular Items"),'',1); 00059 $return .= $votes; 00060 $return .= $HTML->box_bottom(1); 00061 } 00062 00063 00064 #### Group Type Stats 00065 00066 $result = db_query("SELECT type_id,name FROM group_type ORDER BY type_id"); 00067 # try to find out how many latest registered groups per group type 00068 # we should print, depending on how many groups we have. 00069 $limit = 10; 00070 $count = db_numrows($result); 00071 # If count of group types > 25, print 2 latest groups per type 00072 # If count of group types < 2, print 25 latest groups per type 00073 # Else, print (35/count of groups) latest groups per type 00074 if ($count > 25) 00075 { $limit = 2; } 00076 elseif ($count < 2) 00077 { $limit = 25; } 00078 else 00079 { 00080 $limit = round(35 / $count); 00081 } 00082 00083 while ($eachtype = db_fetch_array($result)) 00084 { 00085 $return .= "<br />\n"; 00086 $return .= $HTML->box_top(sprintf(_("Newest %s Projects"),$eachtype['name']),'',1); 00087 $return .= show_newest_projects($group_type=$eachtype['type_id'], $limit); 00088 global $j; 00089 $return .= '<div class="'.utils_get_alt_row_color($j).'"><span class="smaller"><a href="'.$GLOBALS['sys_home'].'search/?type_of_search=soft&words=%%%&type='.$eachtype['type_id'].'">['; 00090 $return .= sprintf( _("all %s projects"),$eachtype['name'] ) ; 00091 $return .= ']</a></span></div>'; 00092 $return .= $HTML->box_bottom(1); 00093 } 00094 return $return; 00095 }
|
|
||||||||||||
|
Definition at line 124 of file features_boxes.php. References $j, $return, $sql, db_error(), db_fetch_array(), db_numrows(), db_query(), and nbsp. Referenced by show_features_boxes(). 00125 { 00126 global $j; 00127 00128 $sql = "SELECT group_id,unix_group_name,group_name,register_time FROM groups " . 00129 "WHERE is_public=1 AND status='A' AND type=$group_type " . 00130 "ORDER BY register_time DESC LIMIT $limit"; 00131 $res_newproj = db_query( $sql ); 00132 $sql_type = "SELECT type_id,base_host FROM group_type WHERE type_id=$group_type"; 00133 $res_newproj_type = db_query($sql_type); 00134 $row_newproj_type = db_fetch_array($res_newproj_type); 00135 if ($row_newproj_type['base_host']) 00136 { 00137 $base_url = 'http'.(session_issecure()?'s':'').'://'.$row_newproj_type['base_host']; 00138 } 00139 00140 if (!$res_newproj || db_numrows($res_newproj) < 1) 00141 { 00142 return db_error(); 00143 } 00144 else 00145 { 00146 while ( $row_newproj = db_fetch_array($res_newproj) ) 00147 { 00148 if ( $row_newproj['register_time'] ) 00149 { 00150 # It would be best to have only Month + Day, but php locale 00151 # implementations cant do that, apparently. Feel free to 00152 # improve. 00153 $return .= '<div class="'.utils_get_alt_row_color($j).'"><span class="smaller"> - <a href="'.$base_url.$GLOBALS['sys_home']."projects/$row_newproj[unix_group_name]/\">" 00154 . $row_newproj[group_name].'</a>, '.format_date('minimal',$row_newproj['register_time']).'</span></div>'; 00155 $j++; 00156 } 00157 } 00158 } 00159 return $return; 00160 }
|
|
|
Definition at line 98 of file features_boxes.php. References $i, $result, $return, db_fetch_array(), db_query(), nbsp, stats_getprojects_active(), stats_getprojects_bytype_active(), stats_getprojects_pending(), stats_getusers(), and type_id. Referenced by show_features_boxes(). 00099 { 00100 $return .= '<span class="smaller">'; 00101 $users = stats_getusers(); 00102 $return .= sprintf(ngettext("%s registered user", "%s registered users", $users), "<strong>$users</strong>"); 00103 $return .= '</span></div>'; 00104 $return .= '<div class="'.utils_get_alt_row_color(0).'"><span class="smaller">'; 00105 $projects = stats_getprojects_active(); 00106 $return .= sprintf(ngettext("%s hosted project", "%s hosted projects", $projects), "<strong>$projects</strong>").'</span></div>'; 00107 $result = db_query("SELECT type_id,name FROM group_type ORDER BY type_id"); 00108 while ($eachtype = db_fetch_array($result)) 00109 { 00110 $i++; 00111 $return .= '<div class="'.utils_get_alt_row_color($i).'"><span class="smaller">'; 00112 $return .= ' - <a href="'.$GLOBALS['sys_home'].'search/?type_of_search=soft&words=%%%&type='.$eachtype['type_id'].'" class="center">'; 00113 $return .= stats_getprojects_bytype_active($eachtype['type_id']); 00114 $return .= ' '.$eachtype['name'].'</a>'; 00115 $return .= '</span></div>'; 00116 } 00117 $pending = stats_getprojects_pending(); 00118 $return .= '<div class="'.utils_get_alt_row_color(($i+1)).'"><span class="smaller"> '; 00119 $return .= sprintf(ngettext("+ %s registration pending", "+ %s registrations pending", $pending), $pending).'</span>'; 00120 00121 return $return; 00122 }
|
|
|
Definition at line 162 of file features_boxes.php. References $count, $prefix, $result, $return, $rows, $sql, db_numrows(), db_query(), db_result, nbsp, and summary. Referenced by show_features_boxes(). 00163 { 00164 # Find out interesting bugs and store them in a hash 00165 # Closed and private items are ignored. 00166 $trackers = array("bugs", "task", "support", "patch"); 00167 00168 $item_vote = array(); 00169 $item_summary = array(); 00170 # not enough space! 00171 #$item_group_id = array(); 00172 00173 while (list(,$tracker) = each($trackers)) 00174 { 00175 $sql = "SELECT bug_id,group_id,summary,vote FROM $tracker WHERE vote >=35 AND privacy=1 AND status_id=1 ORDER BY vote DESC LIMIT $limit"; 00176 00177 $result=db_query($sql); 00178 $rows=db_numrows($result); 00179 if ($result && $rows > 0) 00180 { 00181 $results = 1; 00182 for ($j=0; $j<$rows; $j++) 00183 { 00184 00185 # Create item unique name 00186 $thisitem = $tracker.'#'.db_result($result,$j,'bug_id'); 00187 00188 # Store data 00189 $item_vote[$thisitem] = db_result($result,$j,'vote'); 00190 $item_summary[$thisitem] = db_result($result,$j,'summary'); 00191 # not enough space! 00192 #$item_group_id[$thisitem] = db_result($result,$j,'group_id'); 00193 00194 } 00195 } 00196 } 00197 00198 # Break here if we have no results 00199 if (!$results) 00200 { return false; } 00201 00202 # Otherwise, sort items in rank and print the first 10 ones 00203 unset($return, $count); 00204 arsort($item_vote); 00205 foreach ($item_vote as $thisitem => $vote) 00206 { 00207 $count++; 00208 if ($count > $limit) 00209 { break; } 00210 00211 list($tracker, $item_id) = explode("#", $thisitem); 00212 $prefix = utils_get_tracker_prefix($tracker); 00213 00214 00215 # if the summar item is large (>30), only show the first 00216 # 30 characters of the story 00217 if (strlen($item_summary[$thisitem]) > 30) 00218 { 00219 $item_summary[$thisitem] = substr($item_summary[$thisitem], 0, 30); 00220 $item_summary[$thisitem] = substr($item_summary[$thisitem], 0, strrpos($item_summary[$thisitem], ' ')); 00221 $item_summary[$thisitem] .= "..."; 00222 } 00223 00224 $return .= '<div class="'.utils_get_alt_row_color($count).'">'. 00225 '<span class="smaller"> - '. 00226 '<a href="'.$GLOBALS['sys_home'].$tracker.'/?func=detailitem&item_id='.$item_id.'">'. 00227 $prefix .' #'.$item_id.'</a>'. 00228 _(": ").' '. 00229 '<a href="'.$GLOBALS['sys_home'].$tracker.'/?func=detailitem&item_id='.$item_id.'">'.stripslashes($item_summary[$thisitem]).'</a>,'. 00230 ' '.sprintf(ngettext("%s vote", "%s votes", $vote), $vote). 00231 # not enough space! 00232 #', '.group_getname($item_group_id[$thisitem]). 00233 '</span></div>'; 00234 00235 } 00236 00237 return $return; 00238 }
|
1.4.4