Jump to content

network issues in client area home


Dimofinf

Recommended Posts

Hi,

 

I made this for WHMCS users as a thanks to Matt.

 

Note : Forgive me if already programmed.

 

WHAT DOES IT DO ?

 

It displays in the client area home:

1- open issues (num) , scheduled issues (num) , resolved issues (num) if any.

2- latest 3 open issues if any.

3- check if the user is affected by any of those issues.

4- fixes ( {if $issue.type eq $LANG.networkissuestypeserver}{$issue.server}{else}{$issue.affecting}{/if}) for another languages

 

this was made for portal template so you may have to copy some parts from your selected networkissues.tpl template.

 

INSTRUCTIONS:

 

1- OPEN "clientareahome.tpl" FROM YOUR DEFAULT WHMCS TEMPLATE.

2- FIND :

<p>{$LANG.clientareaheader}</p>

 

3-INSERT AFTER IT :

{php}
$data = mysql_fetch_array (mysql_query ('SELECT COUNT(*) AS total FROM tblnetworkissues WHERE status!=\'Scheduled\' AND status!=\'Resolved\''));
$this->_tpl_vars[opencount] = $data[total];
if($data[total]){
	if($this->_tpl_vars[clientsstats][productsnumactive]>0)
	{
		$and=",tblhosting.server AS clientaffected";
		$join="LEFT JOIN tblhosting ON(tblhosting.userid=".$this->_tpl_vars[clientsdetails][id]." AND tblhosting.server=tblnetworkissues.server)";
	}	
$query = 'SELECT tblnetworkissues.title,
tblnetworkissues.priority AS priority,
tblnetworkissues.status AS status,
tblnetworkissues.startdate,
tblnetworkissues.enddate,
tblnetworkissues.type,
tblnetworkissues.affecting,
tblnetworkissues.lastupdate,
tblnetworkissues.description,
tblservers.name AS server'.$and.' 
FROM tblnetworkissues 
LEFT JOIN tblservers ON(tblservers.id=tblnetworkissues.server) 
'.$join.' 
WHERE tblnetworkissues.status!=\'Scheduled\' AND tblnetworkissues.status!=\'Resolved\' 
GROUP BY tblnetworkissues.id 
ORDER BY  tblnetworkissues.lastupdate DESC 
LIMIT 3';
$result = mysql_query ($query);
while($data = mysql_fetch_array ($result)){
	$status[status]="networkissuesstatus".strtolower(str_replace(' ','',$data[status])); 
	$data[status]=$this->_tpl_vars[LANG][$status[status]];
	$priority[priority]="networkissuespriority".strtolower(str_replace(' ','',$data[priority])); 
	$data[priority]=$this->_tpl_vars[LANG][$priority[priority]];
	$type[type]="networkissuestype".strtolower(str_replace(' ','',$data[type])); 
	$data[type]=$this->_tpl_vars[LANG][$type[type]];		
	$this->_tpl_vars[issues][]=$data;
}
}
$query = 'SELECT COUNT(*) FROM tblnetworkissues WHERE status=\'Scheduled\'';
$result = mysql_query ($query);
$data = mysql_fetch_array ($result);
$this->_tpl_vars[scheduledcount] = $data[0];
$query = 'SELECT COUNT(*) FROM tblnetworkissues WHERE status=\'Resolved\'';
$result = mysql_query ($query);
$data = mysql_fetch_array ($result);
$this->_tpl_vars[resolvedcount] = $data[0];
{/php}	
{if $opencount || $scheduledcount || $resolvedcount}
<div class="contentbox"> <a href="{$smarty.server.PHP_SELF}?view=open" class="networkissuesopen">{$opencount} {$LANG.networkissuesstatusopen}</a> | <a href="{$smarty.server.PHP_SELF}?view=scheduled" class="networkissuesscheduled">{$scheduledcount} {$LANG.networkissuesstatusscheduled}</a> | <a href="{$smarty.server.PHP_SELF}?view=resolved" class="networkissuesclosed">{$resolvedcount} {$LANG.networkissuesstatusresolved}</a> </div>
{/if}

{php}
if($this->_tpl_vars[opencount]){
{/php}	
{foreach from=$issues item=issue}
{if $issue.clientaffected}
<div class="networkissueaffected">{/if}
<h2>{$issue.title} ({$issue.status})</h2>
 <h3>{$LANG.networkissuesaffecting} {$issue.type} - {if $issue.type eq $LANG.networkissuestypeserver}{$issue.server}{else}{$issue.affecting}{/if} | {$LANG.networkissuespriority} - {$issue.priority}</h3>
 <p>{$issue.description} <strong>{$LANG.networkissuesdate}</strong> - {$issue.startdate}{if $issue.enddate} - {$issue.enddate}{/if}<br />
   <strong>{$LANG.networkissueslastupdated}</strong> - {$issue.lastupdate}</p>
 {if $issue.clientaffected}</div>
{/if}<br />
{/foreach} <br />
 {if $loggedin}
<p>{$LANG.networkissuesaffectingyourservers}</p>
{/if}<br />
{php}   
}
{/php}	

 

THATS ALL.

 

IF YOU WANT TO SHOW MORE THAN 3 OPEN ISSUES, THEN YOU HAVE TO EDIT THE NUMBER IN THE ABOVE CODE :

 

LIMIT [color="RED"]3[/color]

 

I hope it is useful to you

 

Best Regards,

Link to comment
Share on other sites

  • 2 months later...
  • 2 months later...

A quick n dirty fix if someone tries that,

 

<div class="contentbox"> 
<a href="{$smarty.server.PHP_SELF}?view=open" class="networkissuesopen">{$opencount} {$LANG.networkissuesstatusopen}</a> | 
<a href="{$smarty.server.PHP_SELF}?view=scheduled" class="networkissuesscheduled">{$scheduledcount} {$LANG.networkissuesstatusscheduled}</a> | 
<a href="{$smarty.server.PHP_SELF}?view=resolved" class="networkissuesclosed">{$resolvedcount} {$LANG.networkissuesstatusresolved}</a> </div>

change:

 

{$smarty.server.PHP_SELF}

with

 

networkissues.php

Works like a charm by the way, thanks Dimofinf

 

 

edit*** By the way this should be on the customization & integration category. :-)

Link to comment
Share on other sites

  • 10 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated