*/
class Widget_MyAdmin extends Widget {
- function __construct() {
- $this->Widget('myadmin');
- }
- function getTitle() {
- return _("Pending administrative tasks");
- }
- function getContent() {
- $i = 0;
- $html_my_admin = '<table width="100%">';
+ function __construct() {
+ $this->Widget('myadmin');
+ }
+ function getTitle() {
+ return _("Pending administrative tasks");
+ }
+ function getContent() {
+ $i = 0;
+ $html_my_admin = '<table width="100%">';
- if (forge_check_global_perm ('forge_admin')) {
- $res = db_query_params("SELECT count(*) AS count FROM users WHERE status='P' OR status='V' OR status='W'",array());
- $row = db_fetch_array($res);
- $pending_users = $row['count'];
- $res = db_query_params("SELECT count(*) AS count FROM users WHERE status='V' OR status='W'",array());
- $row = db_fetch_array($res);
- $validated_users = $row['count'];
+ if (forge_check_global_perm ('forge_admin')) {
+ $res = db_query_params("SELECT count(*) AS count FROM users WHERE status='P' OR status='V' OR status='W'",array());
+ $row = db_fetch_array($res);
+ $pending_users = $row['count'];
+ $res = db_query_params("SELECT count(*) AS count FROM users WHERE status='V' OR status='W'",array());
+ $row = db_fetch_array($res);
+ $validated_users = $row['count'];
- $html_my_admin .= $this->_get_admin_row(
- $i++,
- vsprintf(_('Users in <a href="%s"><strong>P</strong> (pending) Status</a>'), array("/admin/userlist.php?status=P")),
- $pending_users,
- $this->_get_color($pending_users)
+ $html_my_admin .= $this->_get_admin_row(
+ $i++,
+ vsprintf(_('Users in <a href="%s"><strong>P</strong> (pending) Status</a>'), array("/admin/userlist.php?status=P")),
+ $pending_users,
+ $this->_get_color($pending_users)
);
- }
+ }
- if (forge_check_global_perm ('approve_projects')) {
- $res = db_query_params('SELECT count(*) AS count FROM groups
+ if (forge_check_global_perm ('approve_projects')) {
+ $res = db_query_params('SELECT count(*) AS count FROM groups
WHERE group_id > 4
AND status = $1
AND register_time > 0
AND is_template = 0',
- array('P'));
- $row = db_fetch_array($res);
- $pending_projects = $row['count'];
+ array('P'));
+ $row = db_fetch_array($res);
+ $pending_projects = $row['count'];
- $html_my_admin .= $this->_get_admin_row(
- $i++,
- vsprintf(_('Groups in <a href="%s"><strong>P</strong> (pending) Status</A>'), array("/admin/approve-pending.php")),
- $pending_projects,
- $this->_get_color($pending_projects)
+ $html_my_admin .= $this->_get_admin_row(
+ $i++,
+ vsprintf(_('Groups in <a href="%s"><strong>P</strong> (pending) Status</A>'), array("/admin/approve-pending.php")),
+ $pending_projects,
+ $this->_get_color($pending_projects)
);
- }
+ }
- if (forge_check_global_perm ('approve_news')) {
- $old_date = time()-60*60*24*30;
- $res = db_query_params('SELECT groups.group_id,id,post_date,summary,
+ if (forge_check_global_perm ('approve_news')) {
+ $old_date = time()-60*60*24*30;
+ $res = db_query_params('SELECT groups.group_id,id,post_date,summary,
group_name,unix_group_name
FROM news_bytes,groups
WHERE is_approved=0
AND post_date > $1
AND groups.status=$2
ORDER BY post_date',
- array ($old_date, 'A')) ;
- $pending_news = db_numrows($res);
+ array ($old_date, 'A')) ;
+ $pending_news = db_numrows($res);
- $html_my_admin .= $this->_get_admin_row(
- $i++,
- '<a href="/news/admin">'. _("Site News Approval") .'</a>',
- $pending_news,
- $this->_get_color($pending_news)
+ $html_my_admin .= $this->_get_admin_row(
+ $i++,
+ '<a href="/news/admin">'. _("Site News Approval") .'</a>',
+ $pending_news,
+ $this->_get_color($pending_news)
);
- }
- $html_my_admin .= '</table>';
+ }
+ $html_my_admin .= '</table>';
- return $html_my_admin;
- }
- function _get_color($nb) {
- return $nb == 0 ? 'green' : 'orange';
- }
- function _get_admin_row($i, $text, $value, $bgcolor, $textcolor = 'white') {
- $i=$i++;
- return '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'. $text .'</td><td nowrap="nowrap" style="width:20%; background:'. $bgcolor .'; color:'. $textcolor .'; padding: 2px 8px; font-weight:bold; text-align:center;">'. $value .'</td></tr>';
- }
+ return $html_my_admin;
+ }
+ function _get_color($nb) {
+ return $nb == 0 ? 'green' : 'orange';
+ }
+ function _get_admin_row($i, $text, $value, $bgcolor, $textcolor = 'white') {
+ $i=$i++;
+ return '<tr '. $GLOBALS['HTML']->boxGetAltRowStyle($i) .'><td>'. $text .'</td><td nowrap="nowrap" style="width:20%; background:'. $bgcolor .'; color:'. $textcolor .'; padding: 2px 8px; font-weight:bold; text-align:center;">'. $value .'</td></tr>';
+ }
}