0byt3m1n1
Path:
/
data
/
applications
/
aps.bak
/
vtiger
/
5.0.4
/
custom
/
12030000
/
files
/
modules
/
SimpleNSUI
/
[
Home
]
File: ListViewTop.php
<?PHP /**mcg: Function to create NetSol links on the homepage of vtiger *return array $values - array with the title, header and entries like Array('Title'=>$title,'Header'=>$listview_header,'Entries'=>$listview_entries) where as listview_header and listview_entries are arrays of header and entity values which are returned from function getListViewHeader and getListViewEntries */ function getSimpleNSUI() { // mcg: I don't know why any of these includes are here, but I think they're important...maybe require_once("data/Tracker.php"); require_once('include/logging.php'); // sbb: needed to determine whether any campaigns are in this account require_once('modules/Campaigns/Campaigns.php'); require_once('modules/Leads/Leads.php'); require_once('include/database/PearDatabase.php'); require_once('include/database/Postgres8.php'); require_once('include/DatabaseUtil.php'); global $app_strings; global $adb; global $current_language; global $current_user; require('user_privileges/user_privileges_'.$current_user->id.'.php'); require('user_privileges/sharing_privileges_'.$current_user->id.'.php'); // mcg: This creates the title array for the component $title=array(); $title[]=''; // background image for the widget, didn't work last time I tried it $title[]='My Tasks'; // label for the widget, seen at top of widget/component $title[]='home_simplensui'; // id of the div in the html // mcg: supposed to be the header for the list of items that is in the component/widge. // didn't seem to do anything when I tried it. I think you need to alter // Homepage.tpl to make it show only for certain modules/situations. $header=array(); $header[]='Tasks'; // sbb: determining whether there are any leads // sbb: I hope this check for permissions is right if(isPermitted('Leads','EditView','') == 'yes') { $listquery = getListQuery("Leads"); $count_result = $adb->query( mkCountQuery( $listquery)); $noofrows = $adb->query_result($count_result,0,"count"); //echo 'rows=['.$noofrows.']<br>'; // sbb: There are existing campaigns, so view the list if ($noofrows > 0) { $leadsExist = true; } else { $leadsExist = false; } } // mcg: Creates the list of entries that are going to be displayed on the component/widget. // This can include HTML for things like links, images, and text. Only one item deep. // If this needs to be two item deep, then changes have to be made in Homepage.tpl // sbb: Modified such that the first element is the image icon to display and the second // element is the text or link to display. // We could add a third element to show descriptive text, if we like. $entries=array(); // sbb: shouldn't be presented with a link to view contacts if there are no contacts entered if ($leadsExist) { $entries[] = array('icon-viewcontacts.jpg','<a href="index.php?module=Leads&action=index&parenttab=Marketing">View Contacts</a>'); } $entries[] = array('icon-addcontacts.jpg','<a href="index.php?module=Leads&action=EditView&return_action=DetailView&parenttab=Marketing">Add Contacts</a>'); // sbb: I hope this check for permissions is right if(isPermitted('Campaigns','EditView','') == 'yes') { $listquery = getListQuery("Campaigns"); $count_result = $adb->query( mkCountQuery( $listquery)); $noofrows = $adb->query_result($count_result,0,"count"); // sbb: There are existing campaigns, so view the list if ($noofrows > 0) { $entries[] = array('icon-viewcampaign.jpg','<a href="index.php?module=Campaigns&action=index&parenttab=Marketing">View Campaigns</a>'); $entries[] = array('icon-sendemail.jpg','<a href="index.php?module=Campaigns&action=index&parenttab=Marketing&Sendmail=true">Send an Email to a Campaign</a>'); } else // sbb: Else, go right to creating a new campaign { $entries[] = array('icon-viewcampaign.jpg','<a href="index.php?module=Campaigns&action=EditView&return_action=DetailView&parenttab=Marketing">Create Campaign</a>'); } } // sbb: shouldn't be presented with a link to send email to contacts if there are no contacts entered if ($leadsExist) { $entries[] = array('icon-sendemail.jpg','<a href="index.php?module=Leads&action=index&parenttab=Marketing&Sendmail=true">Send an Email to a Contact</a>'); } $entries[] = array('icon-viewreports.jpg','<a href="index.php?module=Reports&action=index">View Reports</a>'); $entries[] = array('icon-viewcalendar.jpg','<a href="index.php?action=index&module=Calendar&view=week">View Calendar</a>'); // mcg: Load the title, header, and entries into the values array before it gets passed back. // This is standard for all modules/components/widgets $values=Array('Title'=>$title,'Header'=>$header,'Entries'=>$entries); // mcg: Commenting this out because I want this component to show up on the homepage all the time. //if (($display_empty_home_blocks && count($entries) == 0 ) || (count($entries)>0)) return $values; } ?>