Example #1
0
 /**
  * this function returns the information about a widget in an array
  * @return array(stuffid=>"id", stufftype=>"type", stufftitle=>"title")
  */
 function getHomePageFrame()
 {
     global $adb;
     global $current_user;
     $querystuff = "select vtiger_homestuff.stuffid,stufftype,stufftitle,setype from vtiger_homestuff\n\t\t\t\t\t\tleft join vtiger_homedefault on vtiger_homedefault.stuffid=vtiger_homestuff.stuffid\n\t\t\t\t\t\twhere visible=0 and userid=? order by stuffsequence desc";
     $resultstuff = $adb->pquery($querystuff, array($current_user->id));
     for ($i = 0; $i < $adb->num_rows($resultstuff); $i++) {
         $modulename = $adb->query_result($resultstuff, $i, 'setype');
         $stuffid = $adb->query_result($resultstuff, $i, 'stuffid');
         $stufftype = $adb->query_result($resultstuff, $i, 'stufftype');
         if (!empty($modulename) && $modulename != 'NULL') {
             if (!vtlib_isModuleActive($modulename)) {
                 continue;
             }
         } elseif ($stufftype == 'Module') {
             //check for setype in vtiger_homemodule table and hide if module is de-activated
             $sql = "select setype from vtiger_homemodule where stuffid=?";
             $result_setype = $adb->pquery($sql, array($stuffid));
             if ($adb->num_rows($result_setype) > 0) {
                 $module_name = $adb->query_result($result_setype, 0, "setype");
             }
             if (!empty($module_name) && $module_name != 'NULL') {
                 if (!vtlib_isModuleActive($module_name)) {
                     continue;
                 }
             }
         } elseif ($stufftype == 'DashBoard') {
             if (!vtlib_isModuleActive('Dashboard')) {
                 continue;
             }
         } elseif (!empty($stufftype) && $stufftype == 'RSS') {
             if (!vtlib_isModuleActive('Rss')) {
                 continue;
             }
         } elseif ($stufftype == 'ReportCharts') {
             if (vtlib_isModuleActive('Reports') === false) {
                 continue;
             } else {
                 require_once 'modules/Reports/CustomReportUtils.php';
                 $query = "SELECT * FROM vtiger_homereportchart WHERE stuffid=?";
                 $result = $adb->pquery($query, array($stuffid));
                 $reportId = $adb->query_result($result, 0, 'reportid');
                 $reportQuery = CustomReportUtils::getCustomReportsQuery($reportId);
                 $reportResult = $adb->query($reportQuery);
                 $num_rows = $adb->num_rows($reportResult);
                 if ($num_rows <= 0) {
                     continue;
                 }
             }
         }
         $nontrans_stufftitle = $adb->query_result($resultstuff, $i, 'stufftitle');
         $trans_stufftitle = getTranslatedString($nontrans_stufftitle);
         $stufftitle = decode_html($trans_stufftitle);
         if (strlen($stufftitle) > 100) {
             $stuff_title = substr($stufftitle, 0, 97) . "...";
         } else {
             $stuff_title = $stufftitle;
         }
         if ($stufftype == 'Default' && $nontrans_stufftitle != 'Home Page Dashboard' && $nontrans_stufftitle != 'Tag Cloud') {
             if ($modulename != 'NULL') {
                 if (isPermitted($modulename, 'index') == "yes") {
                     $homeval[] = array('Stuffid' => $stuffid, 'Stufftype' => $stufftype, 'Stufftitle' => $stuff_title);
                 }
             } else {
                 $homeval[] = array('Stuffid' => $stuffid, 'Stufftype' => $stufftype, 'Stufftitle' => $stuff_title);
             }
         } else {
             if ($stufftype == 'Tag Cloud') {
                 $homeval[] = array('Stuffid' => $stuffid, 'Stufftype' => $stufftype, 'Stufftitle' => $stuff_title);
             } else {
                 if ($modulename != 'NULL') {
                     if (isPermitted($modulename, 'index') == "yes") {
                         $homeval[] = array('Stuffid' => $stuffid, 'Stufftype' => $stufftype, 'Stufftitle' => $stuff_title);
                     }
                 } else {
                     $homeval[] = array('Stuffid' => $stuffid, 'Stufftype' => $stufftype, 'Stufftitle' => $stuff_title);
                 }
             }
         }
     }
     $homeframe = $homeval;
     return $homeframe;
 }
Example #2
0
 if ($showCharts == true) {
     $list_report_form->assign("SHOWCHARTS", $showCharts);
     require_once 'modules/Reports/CustomReportUtils.php';
     require_once 'include/ChartUtils.php';
     $groupBy = $oReportRun->getGroupingList($reportid);
     if (!empty($groupBy)) {
         foreach ($groupBy as $key => $value) {
             //$groupByConditon = explode(" ",$value);
             //$groupByNew = explode("'",$groupByConditon[0]);
             list($tablename, $colname, $module_field, $fieldname, $single) = explode(":", $key);
             list($module, $field) = explode("_", $module_field);
             $fieldDetails = $key;
             break;
         }
         //$groupByField = $oReportRun->GetFirstSortByField($reportid);
         $queryReports = CustomReportUtils::getCustomReportsQuery($Report_ID, $filtersql);
         $queryResult = $adb->pquery($queryReports, array());
         //ChartUtils::generateChartDataFromReports($queryResult, strtolower($groupByNew[1]));
         if ($adb->num_rows($queryResult)) {
             $pieChart = ChartUtils::getReportPieChart($queryResult, strtolower($module_field), $fieldDetails, $reportid);
             $barChart = ChartUtils::getReportBarChart($queryResult, strtolower($module_field), $fieldDetails, $reportid);
             $list_report_form->assign("PIECHART", $pieChart);
             $list_report_form->assign("BARCHART", $barChart);
         } else {
             $showCharts = false;
         }
     } else {
         $showCharts = false;
     }
     $list_report_form->assign("SHOWCHARTS", $showCharts);
 }