Inheritance: extends BaseController
 /**
  * Tests the diseases CRUD
  *
  * @return void
  */
 public function testifDiseaseCrudWorks()
 {
     // add, edit and delete disease entry
     Input::replace($this->inputDisease);
     $config = new ReportController();
     $config->disease();
     $diseaseModel = Disease::all();
     //Check if entry was added
     $this->assertEquals($diseaseModel[3]->name, $this->inputDisease['new-diseases']['1']['disease']);
     //Check if entry was edited
     $this->assertEquals($diseaseModel[0]->name, $this->inputDisease['diseases']['1']['disease']);
     //Check if entry was deleted - the only available are the three above => one deleted
     $this->assertEquals(count($diseaseModel), 4);
 }
 /**
  * Loads an XML file and set's up the class to generate reports based on
  * the description of the class.
  * @param string $report A path to the xml file which contains the
  *                       description of this report
  */
 public function __construct($report, $redirected = false)
 {
     parent::__construct();
     $this->xml = simplexml_load_file(($redirected ? "" : "app/modules") . $report);
     $path = $this->xml["name"] . "/generate/pdf";
     $this->name = (string) $this->xml["name"];
     $this->label = $this->xml["label"];
     Application::setTitle($this->label);
     $baseModel = $this->xml["baseModel"];
     $this->basePackage = isset($this->xml["basePackage"]) ? (string) $this->xml["basePackage"] : reset(explode(".", (string) $this->xml["baseModel"]));
     try {
         $baseModel = Model::load((string) $baseModel);
     } catch (Exception $e) {
         throw new Exception("Base model (" . (string) $baseModel . ") could not be loaded ({$e->getMessage()})");
     }
     $this->referencedFields = array();
     foreach ($baseModel->referencedFields as $field) {
         $this->referencedFields[] = $field["referencing_field"];
     }
 }
Example #3
0
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
include_once "includes/sp-load.php";
checkLoggedIn();
include_once SP_CTRLPATH . "/keyword.ctrl.php";
include_once SP_CTRLPATH . "/website.ctrl.php";
include_once SP_CTRLPATH . "/searchengine.ctrl.php";
include_once SP_CTRLPATH . "/report.ctrl.php";
$controller = new ReportController();
$controller->view->menu = 'seotools';
$controller->layout = 'ajax';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    switch ($_POST['sec']) {
        case "kwchecker":
            $controller->showQuickRankChecker($_POST);
            break;
        case "reportsum":
            $controller->showKeywordReportSummary($_POST);
            break;
        default:
            $controller->showReports($_POST);
            break;
    }
} else {
Example #4
0
 function keywordPositionCheckerCron($websiteId)
 {
     include_once SP_CTRLPATH . "/searchengine.ctrl.php";
     include_once SP_CTRLPATH . "/report.ctrl.php";
     $reportController = new ReportController();
     $seController = new SearchEngineController();
     $reportController->seList = $seController->__getAllCrawlFormatedSearchEngines();
     // get keywords not to be checked
     $time = mktime(0, 0, 0, date('m'), date('d'), date('Y'));
     $sql = "select distinct(keyword_id) from keywordcrontracker kc, keywords k where k.id=kc.keyword_id and k.website_id={$websiteId} and time={$time}";
     $keyList = $this->db->select($sql);
     $excludeKeyList = array(0);
     foreach ($keyList as $info) {
         $excludeKeyList[] = $info['keyword_id'];
     }
     // get keywords needs to be checked
     $sql = "select k.*,w.url from keywords k,websites w where k.website_id=w.id and w.id={$websiteId} and k.status=1";
     $sql .= " and k.id not in(" . implode(",", $excludeKeyList) . ") order by k.name";
     $keywordList = $reportController->db->select($sql);
     $this->debugMsg("Starting keyword position checker cron for website: {$this->websiteInfo['name']}....<br>\n");
     // loop through each keyword
     foreach ($keywordList as $keywordInfo) {
         $reportController->seFound = 0;
         $crawlResult = $reportController->crawlKeyword($keywordInfo, '', true);
         foreach ($crawlResult as $sengineId => $matchList) {
             if ($matchList['status']) {
                 foreach ($matchList['matched'] as $i => $matchInfo) {
                     $remove = $i == 0 ? true : false;
                     $matchInfo['se_id'] = $sengineId;
                     $matchInfo['keyword_id'] = $keywordInfo['id'];
                     $repCtrler = new ReportController();
                     $repCtrler->saveMatchedKeywordInfo($matchInfo, $remove);
                 }
                 $this->debugMsg("Successfully crawled keyword <b>{$keywordInfo['name']}</b> results from " . $reportController->seList[$sengineId]['domain'] . ".....<br>\n");
             } else {
                 $this->debugMsg("Crawling keyword </b>{$keywordInfo['name']}</b> results from " . $reportController->seList[$sengineId]['domain'] . " failed......<br>\n");
             }
         }
         // to implement split cron execution feature
         if (SP_NUMBER_KEYWORDS_CRON > 0 && !empty($crawlResult)) {
             $this->checkedKeywords++;
             if ($this->checkedKeywords == SP_NUMBER_KEYWORDS_CRON) {
                 die("Reached total number of allowed keywords(" . SP_NUMBER_KEYWORDS_CRON . ") in each cron job");
             }
         }
         if (empty($reportController->seFound)) {
             $this->debugMsg("Keyword <b>{$keywordInfo['name']}</b> not assigned to required search engines........\n");
         }
         sleep(SP_CRAWL_DELAY);
     }
 }
Example #5
0
<?php

/**
 * Created by PhpStorm.
 * User: Olaniyi
 * Date: 6/4/15
 * Time: 3:37 PM
 */
require_once 'includes/iframe-header.php';
require_once '../../_core/global/_require.php';
Crave::requireAll(GLOBAL_VAR);
Crave::requireAll(UTIL);
Crave::requireFiles(MODEL, array('BaseModel', 'ReportModel'));
Crave::requireFiles(CONTROLLER, array('ReportController'));
$patient_with_age = ReportController::patientsAge();
?>

    <table class="table table-responsive dataTable">
        <thead>
        <tr>
            <th>S/N</th>
            <th>Name</th>
            <th>Registration Number</th>
            <th>Age</th>
        </tr>
        </thead>
        <tbody id="new_patient">
        <?php 
if (count($patient_with_age) == 0) {
    ?>
            <tr>
<?php

require_once dirname(__FILE__) . '/../bootstrap.php';
$date = date('Y-m-d');
$is_successfull = false;
$isDone = false;
$whilecount = 0;
$queue = false;
$reportController = new ReportController();
$params = array('reportDescription' => array('reportSuiteID' => 'souqaeprod', 'date' => $date, 'dateFrom' => date('Y-m-d', strtotime($date . ' -3 day')), 'dateTo' => date('Y-m-d', strtotime($date . ' -1 day')), 'metrics' => array(array('id' => 'event1'), array('id' => 'orders'), array('id' => 'visits'), array('id' => 'event3'), array('id' => 'carts')), 'elements' => array(array('id' => 'evar33', 'classification' => '', 'top' => '20', 'startingWith' => 20 * $argv[1] + 1), array('id' => 'product', 'classification' => 'product subcategory', 'top' => '6')), 'sortBy' => 'event1', 'validate' => true));
while ($queue === false) {
    $queue = $reportController->runOmnitureReport($params, 'Report.QueueRanked');
    if ($queue !== false) {
        while (!($isDone || $whilecount == 10)) {
            $isDone = $reportController->checkStatus($queue);
            if ($isDone) {
                $report = $reportController->runReport($queue);
                if ($report !== false) {
                    while (!$is_successfull) {
                        $is_successfull = $reportController->saveToDb($report, "sub_category");
                    }
                }
            } else {
                $isDone = false;
            }
            $whilecount++;
        }
    }
}
Example #7
0
<?php

/**
 * Created by PhpStorm.
 * User: Olaniyi
 * Date: 6/4/15
 * Time: 3:37 PM
 */
require_once 'includes/iframe-header.php';
require_once '../../_core/global/_require.php';
Crave::requireAll(GLOBAL_VAR);
Crave::requireAll(UTIL);
Crave::requireFiles(MODEL, array('BaseModel', 'ReportModel'));
Crave::requireFiles(CONTROLLER, array('ReportController'));
$current_patient = ReportController::currentPatients();
?>

    <table class="table table-responsive dataTable">
        <thead>
        <tr>
            <th>S/N</th>
            <th>Name</th>
            <th>Registration Number</th>
            <th>Gender</th>
        </tr>
        </thead>
        <tbody id="new_patient">
        <?php 
if (count($current_patient) == 0) {
    ?>
            <tr>
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
include_once "includes/sp-load.php";
checkLoggedIn();
include_once SP_CTRLPATH . "/keyword.ctrl.php";
include_once SP_CTRLPATH . "/website.ctrl.php";
include_once SP_CTRLPATH . "/language.ctrl.php";
include_once SP_CTRLPATH . "/searchengine.ctrl.php";
include_once SP_CTRLPATH . "/report.ctrl.php";
$controller = new ReportController();
$controller->view->menu = 'seotools';
$controller->layout = 'ajax';
$controller->set('spTextTools', $controller->getLanguageTexts('seotools', $_SESSION['lang_code']));
$controller->spTextKeyword = $controller->getLanguageTexts('keyword', $_SESSION['lang_code']);
$controller->set('spTextKeyword', $controller->spTextKeyword);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    switch ($_POST['sec']) {
        default:
            $controller->generateReports($_POST);
            break;
    }
} else {
    switch ($_GET['sec']) {
        default:
            $controller->showGenerateReports($_GET);
 /**
  * Import a report
  * 
  */
 public static function importFile($filename, $showMessage = true, $removeExistingReport = false)
 {
     $localErrors = array();
     $allAccounts = array();
     $dom = new domDocument();
     if (!$dom->load($filename)) {
         if ($showMessage) {
             throw new CException(Yii::t('lazy8', 'input file could not be xml parsed'));
         } else {
             throw new CException('input file could not be xml parsed');
         }
     }
     $root = $dom->documentElement;
     if ($root->nodeName != "lazy8webportreport") {
         if ($showMessage) {
             $localErrors = array(array(Yii::t('lazy8', 'Upload failed.  This is not a valid file.'), Yii::t('lazy8', 'Select a file and try again')));
         }
         return $localErrors;
     }
     if ($root->getAttribute('version') > 1.0) {
         if ($showMessage) {
             $localErrors = array(array(Yii::t('lazy8', 'There maybe problems because this is a file version greater then this programs version'), Yii::t('lazy8', 'Select a file and try again')));
         }
     }
     $nodeReports = $root->getElementsByTagName('report');
     unset($root);
     unset($dom);
     foreach ($nodeReports as $nodeReport) {
         if ($removeExistingReport) {
             $deleteReports = Report::model()->findAll(array('condition' => 'name=\'' . $nodeReport->getAttribute('name') . '\''));
             if ($deleteReports != null) {
                 foreach ($deleteReports as $deleteReport) {
                     $deleteReport->delete();
                 }
             }
         }
         $report = new Report();
         $report->name = $nodeReport->getAttribute('name');
         $report->desc = ReportController::getNodeText($nodeReport, "desc");
         $report->selectSql = ReportController::getNodeText($nodeReport, "selectsql");
         $report->sortOrder = ReportController::getNodeText($nodeReport, "sortOrder");
         $report->cssColorFileName = ReportController::getNodeText($nodeReport, "csscolorfilename");
         $report->cssBwFileName = ReportController::getNodeText($nodeReport, "cssbwfilename");
         $nodeParams = $nodeReport->getElementsByTagName('parameter');
         if (!$report->save()) {
             if ($showMessage) {
                 $localErrors = $report->getErrors();
             }
             return $localErrors;
         }
         foreach ($nodeParams as $nodeParam) {
             $reportParam = new ReportParameters();
             $reportParam->reportId = $report->id;
             $reportParam->sortOrder = $nodeParam->getAttribute('sortorder');
             $reportParam->name = $nodeParam->getAttribute('name');
             $reportParam->alias = $nodeParam->getAttribute('alias');
             $reportParam->dataType = $nodeParam->getAttribute('datatype');
             $reportParam->isDefaultPhp = $nodeParam->getAttribute('isdefaultphp') == 'true' ? 1 : 0;
             $reportParam->isDate = $nodeParam->getAttribute('isdate') == 'true' ? 1 : 0;
             $reportParam->isDecimal = $nodeParam->getAttribute('isdecimal') == 'true' ? 1 : 0;
             $reportParam->desc = ReportController::getNodeText($nodeParam, "desc");
             $reportParam->phpSecondaryInfo = ReportController::getNodeText($nodeParam, "phpsecondaryinfo");
             $reportParam->defaultValue = ReportController::getNodeText($nodeParam, "defaultvalue");
             if (!$reportParam->save()) {
                 if ($showMessage) {
                     $localErrors = $reportParam->getErrors();
                 }
             }
         }
         unset($nodeParams);
         $nodeGroups = $nodeReport->getElementsByTagName('group');
         foreach ($nodeGroups as $nodeGroup) {
             $reportGroup = new ReportGroups();
             $reportGroup->reportId = $report->id;
             $reportGroup->sortOrder = $nodeGroup->getAttribute('sortorder');
             $reportGroup->breakingField = $nodeGroup->getAttribute('breakingfield');
             $reportGroup->pageBreak = $nodeGroup->getAttribute('pagebreak') == 'true' ? 1 : 0;
             $reportGroup->showGrid = $nodeGroup->getAttribute('showgrid') == 'true' ? 1 : 0;
             $reportGroup->showHeader = $nodeGroup->getAttribute('showheader') == 'true' ? 1 : 0;
             $reportGroup->continueSumsOverGroup = $nodeGroup->getAttribute('continuesumsovergroup') == 'true' ? 1 : 0;
             if (!$reportGroup->save()) {
                 if ($showMessage) {
                     $localErrors = $reportGroup->getErrors();
                 }
             }
             $nodeGroupFields = $nodeGroup->getElementsByTagName('field');
             foreach ($nodeGroupFields as $nodeGroupField) {
                 $reportGroupField = new ReportGroupFields();
                 $reportGroupField->reportGroupId = $reportGroup->id;
                 $reportGroupField->sortOrder = $nodeGroupField->getAttribute('sortorder');
                 $reportGroupField->fieldName = $nodeGroupField->getAttribute('fieldname');
                 $reportGroupField->fieldWidth = $nodeGroupField->getAttribute('fieldwidth');
                 $reportGroupField->row = $nodeGroupField->getAttribute('row');
                 $reportGroupField->isDate = $nodeGroupField->getAttribute('isdate') == 'true' ? 1 : 0;
                 $reportGroupField->isDecimal = $nodeGroupField->getAttribute('isdecimal') == 'true' ? 1 : 0;
                 $reportGroupField->fieldCalc = ReportController::getNodeText($nodeGroupField, "fieldcalc");
                 if (!$reportGroupField->save()) {
                     if ($showMessage) {
                         $localErrors = $reportGroupField->getErrors();
                     }
                 }
             }
             unset($nodeGroupFields);
         }
         unset($nodeGroups);
         $nodeReportRows = $nodeReport->getElementsByTagName('rows');
         foreach ($nodeReportRows as $nodeReportRow) {
             $reportRow = new ReportRows();
             $reportRow->reportId = $report->id;
             $reportRow->sortOrder = $nodeReportRow->getAttribute('sortorder');
             $reportRow->fieldName = $nodeReportRow->getAttribute('fieldname');
             $reportRow->fieldWidth = $nodeReportRow->getAttribute('fieldwidth');
             $reportRow->row = $nodeReportRow->getAttribute('row');
             $reportRow->isSummed = $nodeReportRow->getAttribute('issummed') == 'true' ? 1 : 0;
             $reportRow->isAlignRight = $nodeReportRow->getAttribute('isalignright') == 'true' ? 1 : 0;
             $reportRow->isDate = $nodeReportRow->getAttribute('isdate') == 'true' ? 1 : 0;
             $reportRow->isDecimal = $nodeReportRow->getAttribute('isdecimal') == 'true' ? 1 : 0;
             $reportRow->fieldCalc = ReportController::getNodeText($nodeReportRow, "fieldcalc");
             if (!$reportRow->save()) {
                 if ($showMessage) {
                     $localErrors = $reportRow->getErrors();
                 }
             }
         }
     }
     return $localErrors;
 }
Example #10
0
    $controller->newRegistration($id);
});
$app->post('/contest/:id/question', function ($id) {
    fAuthorization::requireLoggedIn();
    User::requireEmailVerified();
    $controller = new ReportController();
    $controller->newQuestion($id);
});
$app->post('/question/:id/reply', function ($id) {
    fAuthorization::requireLoggedIn();
    $controller = new ReportController();
    $controller->replyQuestion($id);
});
$app->post('/question/:id/toggle', function ($id) {
    fAuthorization::requireLoggedIn();
    $controller = new ReportController();
    $controller->toggleQuestionVisibility($id);
});
$app->get('/polling/:secret', function ($secret) {
    if (JUDGER_SECRET != $secret) {
        exit;
    }
    $controller = new PollingController();
    $opcode = fRequest::get('opcode', 'string');
    if ($opcode == 'fetchRecord') {
        $controller->fetchRecord();
    } else {
        if ($opcode == 'fetchTimestamp') {
            $controller->fetchTimestamp();
        } else {
            echo -1;
Example #11
0
            </span>
            <span class="" style="margin-left:10px;">
                <?php 
echo CHtml::link(CHtml::button('Manage Template', array('class' => 'btn btn-info', 'disabled' => $mode, 'style' => 'margin-bottom:10px')), Yii::app()->createUrl('/reportTemplate/admin'));
?>
               
            </span>
        </div>
        <div class="row1" style="margin-bottom:10px;margin-top:20px;width:700px !important;">
            <div style="float:left;width:700px !important;height:auto;" >
                    <span>Avaiable Fields</span>
                    <span style="margin-left:285px">Report Fields</span>
                    <?php 
//echo $form->labelEx($model,'offence_ids');
//print_r(empty($name));exit;
$colArr = ReportController::getColumnNames('challan');
$name = array();
foreach ($colArr as $i => $v) {
    $name[$v] = $model->getAttributeLabel($v);
}
?>
    
                    <?php 
echo $form->dropDownList($model, 'fields[]', $name, array('options' => $options, 'multiple' => 'multiple'), array('style' => 'width:700px !important;height:auto'));
?>
 
                    <?php 
//echo "<pre>";print_r($model->user_challan_list());
//print_r(array('1'=>array('selected'=>true),'2'=>array('selected'=>true)));
?>
                <div style="clear:both;" >
Example #12
0
<?php

/**
 * Created by PhpStorm.
 * User: Olaniyi
 * Date: 6/4/15
 * Time: 3:37 PM
 */
require_once 'includes/iframe-header.php';
require_once '../../_core/global/_require.php';
Crave::requireAll(GLOBAL_VAR);
Crave::requireAll(UTIL);
Crave::requireFiles(MODEL, array('BaseModel', 'ReportModel'));
Crave::requireFiles(CONTROLLER, array('ReportController'));
$inpatients = ReportController::inPatients();
?>

    <table class="table table-responsive dataTable">
        <thead>
        <tr>
            <th>S/N</th>
            <th>Name</th>
            <th>Registration Number</th>
        </tr>
        </thead>
        <tbody id="new_patient">
        <?php 
if (count($inpatients) == 0) {
    ?>
            <tr>
                <td></td>
Example #13
0
     break;
 case 'app':
     switch ($action) {
         case 'changelang':
             $_SESSION['lang'] = $_GET['lang'];
             echo 'ok';
             break;
         case 'changecurrency':
             $_SESSION['currency_unit'] = $_GET['currency'];
             //var_dump( $_SESSION['currency_unit']);
             echo 'ok';
             break;
     }
     break;
 case 'report':
     $rptctrl = new ReportController();
     switch ($action) {
         case 'list':
             $rptctrl->_list();
             break;
         case 'more':
             $rptctrl->More($_POST['id']);
             break;
     }
     break;
 case 'bank':
     $bnkctrl = new BankController();
     switch ($action) {
         case 'callback':
             $pst = array();
             $get = array();
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
include_once "includes/sp-load.php";
checkLoggedIn();
include_once SP_CTRLPATH . "/keyword.ctrl.php";
include_once SP_CTRLPATH . "/website.ctrl.php";
include_once SP_CTRLPATH . "/language.ctrl.php";
include_once SP_CTRLPATH . "/searchengine.ctrl.php";
include_once SP_CTRLPATH . "/report.ctrl.php";
$controller = new ReportController();
$controller->view->menu = 'seotools';
$controller->layout = 'ajax';
$controller->set('sectionHead', 'Generate Reports');
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    switch ($_POST['sec']) {
        default:
            $controller->generateReports($_POST);
            break;
    }
} else {
    switch ($_GET['sec']) {
        default:
            $controller->showGenerateReports($_GET);
            break;
    }
function hc_export_report()
{
	$reports = new ReportController;
    $reports->export();
}
Example #16
0
 function keywordPositionCheckerCron($websiteId)
 {
     include_once SP_CTRLPATH . "/searchengine.ctrl.php";
     include_once SP_CTRLPATH . "/report.ctrl.php";
     $reportController = new ReportController();
     $seController = new SearchEngineController();
     $reportController->seList = $seController->__getAllCrawlFormatedSearchEngines();
     $sql = "select k.*,w.url from keywords k,websites w where k.website_id=w.id and w.id={$websiteId} and k.status=1";
     $sql .= " order by k.name";
     $keywordList = $reportController->db->select($sql);
     $this->debugMsg("Starting keyword position checker cron for website: {$this->websiteInfo['name']}....<br>\n");
     # loop through each keyword
     foreach ($keywordList as $keywordInfo) {
         $reportController->seFound = 0;
         $crawlResult = $reportController->crawlKeyword($keywordInfo);
         foreach ($crawlResult as $sengineId => $matchList) {
             if ($matchList['status']) {
                 foreach ($matchList['matched'] as $i => $matchInfo) {
                     $remove = $i == 0 ? true : false;
                     $matchInfo['se_id'] = $sengineId;
                     $matchInfo['keyword_id'] = $keywordInfo['id'];
                     $reportController->saveMatchedKeywordInfo($matchInfo, $remove);
                 }
                 $this->debugMsg("Successfully crawled keyword <b>{$keywordInfo['name']}</b> results from " . $reportController->seList[$sengineId]['domain'] . ".....<br>\n");
             } else {
                 $this->debugMsg("Crawling keyword </b>{$keywordInfo['name']}</b> results from " . $reportController->seList[$sengineId]['domain'] . " failed......<br>\n");
             }
         }
         if (empty($reportController->seFound)) {
             $this->debugMsg("Keyword <b>{$keywordInfo['name']}</b> not assigned to required search engines........\n");
         }
         sleep(SP_CRAWL_DELAY);
     }
 }
Example #17
0
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
include_once "includes/sp-load.php";
checkLoggedIn();
include_once SP_CTRLPATH . "/keyword.ctrl.php";
include_once SP_CTRLPATH . "/website.ctrl.php";
include_once SP_CTRLPATH . "/searchengine.ctrl.php";
include_once SP_CTRLPATH . "/report.ctrl.php";
$controller = new ReportController();
$controller->view->menu = 'seotools';
$controller->spTextTools = $controller->getLanguageTexts('seotools', $_SESSION['lang_code']);
$controller->set('spTextTools', $controller->spTextTools);
$controller->spTextKeyword = $controller->getLanguageTexts('keyword', $_SESSION['lang_code']);
$controller->set('spTextKeyword', $controller->spTextKeyword);
$controller->spTextPanel = $controller->getLanguageTexts('panel', $_SESSION['lang_code']);
$controller->set('spTextPanel', $controller->spTextPanel);
$controller->spTextReport = $controller->getLanguageTexts('report', $_SESSION['lang_code']);
$controller->set('spTextReport', $controller->spTextReport);
$controller->layout = 'ajax';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    switch ($_POST['sec']) {
        case "kwchecker":
            $controller->showQuickRankChecker($_POST);
            break;
Example #18
0
 public static function patientDiagnosis()
 {
     return ReportModel::patientDiagnosis(ReportController::getGender());
 }
 /**
  * Generates the report by processing the XML file.
  * @param array $params 
  */
 public function generate($params)
 {
     $report = $this->getReport();
     $reader = new XMLReader();
     $reader->XML($this->xml->asXML());
     while ($reader->read()) {
         if ($reader->nodeType !== XMLReader::ELEMENT) {
             continue;
         }
         switch ($reader->name) {
             case "rapi:logo":
                 if ($_POST["hide_logo"] == 1) {
                     $text = new TextContent();
                     $text->style["flow"] = true;
                     $text->setText("\n\n\n\n\n\n\n\n");
                     $report->add($text);
                 } else {
                     $reader->moveToAttribute("class");
                     $class = $reader->value;
                     $logo = $class == '' ? new LogoContent() : new $class();
                     $report->add($logo);
                     $report->logo = $logo;
                 }
                 break;
             case "rapi:text":
                 $text = new TextContent();
                 $reader->moveToAttribute("style");
                 switch ($reader->value) {
                     case "heading":
                         $text->style["size"] = 16;
                         $text->style["font"] = "Helvetica";
                         $text->style["bold"] = true;
                         $report->label = $text;
                         break;
                     default:
                         $text->style["size"] = $reader->moveToAttribute("size") ? $reader->value : 12;
                         $text->style["font"] = $reader->value ? $reader->moveToAttribute("font") : "Helvetica";
                         break;
                 }
                 $reader->read();
                 $text->setText($reader->value);
                 $report->add($text);
                 break;
             case "rapi:table":
                 $numConcatFields = 0;
                 $reader->moveToAttribute("name");
                 $name = $reader->value;
                 $tableConditionsArray = array();
                 if ($reader->moveToAttribute("conditions")) {
                     $tableConditionsArray[] = $reader->value;
                 }
                 if ($this->tableConditions != '') {
                     $tableConditionsArray[] = $this->tableConditions;
                 }
                 $tableConditions = implode(" AND ", $tableConditionsArray);
                 $fields = $this->xml->xpath("/rapi:report/rapi:table[@name='{$name}']/rapi:fields/rapi:field");
                 $headers = $this->xml->xpath("/rapi:report/rapi:table[@name='{$name}']/rapi:fields/rapi:field[@label!='']/@label");
                 $dontJoins = $this->xml->xpath("/rapi:report/rapi:table[@name='{$name}']/rapi:dont_join/rapi:pair");
                 $ignoredFields = array();
                 $dataParams["total"] = array();
                 $hardCodedSorting = array();
                 $reportGroupingFields = array();
                 $models = array();
                 $fieldInfos = array();
                 // Generate filter conditions
                 $filters = array();
                 $filterSummaries = array();
                 $keyOffset = 0;
                 foreach ($fields as $key => $field) {
                     // Load the model for this field if it hasn't been
                     // loaded already. I have a hunch that this check
                     // is really not necessary since the model loader
                     // sort of caches loaded models now.
                     $modelInfo = Model::resolvePath((string) $field);
                     if (array_search($modelInfo["model"], array_keys($models)) === false) {
                         $models[$modelInfo["model"]] = Model::load($modelInfo["model"]);
                     }
                     $model = $models[$modelInfo["model"]];
                     $fieldInfo = $model->getFields(array($modelInfo["field"]));
                     $fieldInfo = $fieldInfo[0];
                     $fieldInfos[(string) $field] = $fieldInfo;
                     //Ignore fields which are not needed.
                     if (isset($_POST[$name . "_" . $fieldInfo["name"] . "_ignore"])) {
                         $ignoredFields[] = $key;
                     }
                     if (isset($field["sort"])) {
                         $sortField = "{$model->database}.{$fieldInfo["name"]}";
                         $hardCodedSorting[] = array("field" => $sortField, "type" => $field["sort"]);
                     }
                     if (isset($field["labelsField"])) {
                         $dynamicFields[] = (string) $field;
                         $dynamicHeaders[] = (string) $field["labelsField"];
                         $labelModelInfo = Model::resolvePath($field["labelsField"]);
                         $headersModel = Model::load($labelModelInfo["model"]);
                         $dynamicHeaderValues = $headersModel->get(array("fields" => array($labelModelInfo["field"])), SQLDataBaseModel::MODE_ARRAY);
                         foreach ($dynamicHeaderValues as $headerValue) {
                             $tableHeaders[] = $headerValue[0];
                             if ($field["total"] == "true") {
                                 $dataParams["total"][] = true;
                                 //$key + $keyOffset;
                                 $dataParams["type"][] = "double";
                             }
                             $keyOffset++;
                         }
                         $keyOffset--;
                     } else {
                         $tableHeaders[] = (string) $field["label"];
                         switch ($fieldInfo["type"]) {
                             case "integer":
                                 $dataParams["type"][] = "number";
                                 break;
                             case "double":
                                 $dataParams["type"][] = "double";
                                 break;
                             default:
                                 $dataParams["type"][] = "";
                         }
                         $dataParams["total"][] = $field["total"] == "true" ? true : false;
                     }
                     $fields[$key] = (string) $field;
                     $value = $field["value"];
                     $field = (string) $field;
                     if (array_search($model->getKeyField(), $this->referencedFields) === false || $fieldInfo["type"] == "double" || $fieldInfo["type"] == "date") {
                         if ($value != null) {
                             $filters[] = "{$models[$modelInfo["model"]]->getDatabase()}.{$fieldInfo["name"]}='{$value}'";
                             continue;
                         }
                         switch ($fieldInfo["type"]) {
                             case "string":
                             case "text":
                                 if ($_POST[$name . "_" . $fieldInfo["name"] . "_value"] != "") {
                                     switch ($_POST[$name . "_" . $fieldInfo["name"] . "_option"]) {
                                         case "CONTAINS":
                                             $filterSummaries[] = "{$headers[$key]} containing {$_POST[$name . "_" . $fieldInfo["name"] . "_value"]}";
                                             $filters[] = $models[$modelInfo["model"]]->getSearch($models[$modelInfo["model"]]->escape($_POST[$name . "_" . $fieldInfo["name"] . "_value"]), "{$models[$modelInfo["model"]]->getDatabase()}.{$fieldInfo["name"]}");
                                             break;
                                         case "EXACTLY":
                                             $filterSummaries[] = "{$headers[$key]} being exactly {$_POST[$name . "_" . $fieldInfo["name"] . "_value"]}";
                                             $filters[] = "{$models[$modelInfo["model"]]->getDatabase()}.{$fieldInfo["name"]}='" . $models[$modelInfo["model"]]->escape($_POST[$name . "_" . $fieldInfo["name"] . "_value"]) . "'";
                                             break;
                                     }
                                 }
                                 break;
                             case "integer":
                             case "double":
                                 if ($_POST[$name . "_" . $fieldInfo["name"] . "_start_value"] != "") {
                                     switch ($_POST[$name . "_" . $fieldInfo["name"] . "_option"]) {
                                         case "EQUALS":
                                             $filterSummaries[] = "{$headers[$key]} equals {$_POST[$name . "_" . $fieldInfo["name"] . "_start_value"]}";
                                             $filters[] = "{$models[$modelInfo["model"]]->getDatabase()}.{$fieldInfo["name"]}='" . $models[$modelInfo["model"]]->escape($_POST[$name . "_" . $fieldInfo["name"] . "_start_value"]) . "'";
                                             break;
                                         case "GREATER":
                                             $filterSummaries[] = "{$headers[$key]} greater than {$_POST[$name . "_" . $fieldInfo["name"] . "_start_value"]}";
                                             $filters[] = "{$models[$modelInfo["model"]]->getDatabase()}.{$fieldInfo["name"]}>'" . $models[$modelInfo["model"]]->escape($_POST[$name . "_" . $fieldInfo["name"] . "_start_value"]) . "'";
                                             break;
                                         case "LESS":
                                             $filterSummaries[] = "{$headers[$key]} less than {$_POST[$name . "_" . $fieldInfo["name"] . "_start_value"]}";
                                             $filters[] = "{$models[$modelInfo["model"]]->getDatabase()}.{$fieldInfo["name"]}<'" . $models[$modelInfo["model"]]->escape($_POST[$name . "_" . $fieldInfo["name"] . "_start_value"]) . "'";
                                             break;
                                         case "BETWEEN":
                                             $filterSummaries[] = "{$headers[$key]} between {$_POST[$name . "_" . $fieldInfo["name"] . "_start_value"]} and {$_POST[$name . "_" . $fieldInfo["name"] . "_end_value"]}";
                                             $filters[] = "({$models[$modelInfo["model"]]->getDatabase()}.{$fieldInfo["name"]}>='" . $models[$modelInfo["model"]]->escape($_POST[$name . "_" . $fieldInfo["name"] . "_start_value"]) . "' AND {$models[$modelInfo["model"]]->getDatabase()}.{$fieldInfo["name"]}<='" . $models[$modelInfo["model"]]->escape($_POST[$name . "_" . $fieldInfo["name"] . "_end_value"]) . "')";
                                             break;
                                     }
                                 }
                                 break;
                             case "reference":
                                 break;
                             case "datetime":
                             case "date":
                                 if ($_POST[$name . "_" . $fieldInfo["name"] . "_start_date"] != "") {
                                     switch ($_POST[$name . "_" . $fieldInfo["name"] . "_option"]) {
                                         case "EQUALS":
                                             $filterSummaries[] = "{$headers[$key]} on {$_POST[$name . "_" . $fieldInfo["name"] . "_start_date"]}";
                                             $filters[] = "{$models[$modelInfo["model"]]->getDatabase()}.{$fieldInfo["name"]}='" . $models[$modelInfo["model"]]->escape(Common::stringToDatabaseDate($_POST[$name . "_" . $fieldInfo["name"] . "_start_date"])) . "'";
                                             break;
                                         case "GREATER":
                                             $filterSummaries[] = "{$headers[$key]} after {$_POST[$name . "_" . $fieldInfo["name"] . "_start_date"]}";
                                             $filters[] = "{$models[$modelInfo["model"]]->getDatabase()}.{$fieldInfo["name"]}>'" . $models[$modelInfo["model"]]->escape(Common::stringToDatabaseDate($_POST[$name . "_" . $fieldInfo["name"] . "_start_date"])) . "'";
                                             break;
                                         case "LESS":
                                             $filterSummaries[] = "{$headers[$key]} before {$_POST[$name . "_" . $fieldInfo["name"] . "_start_date"]}";
                                             $filters[] = "{$models[$modelInfo["model"]]->getDatabase()}.{$fieldInfo["name"]}<'" . $models[$modelInfo["model"]]->escape(Common::stringToDatabaseDate($_POST[$name . "_" . $fieldInfo["name"] . "_start_date"])) . "'";
                                             break;
                                         case "BETWEEN":
                                             $filterSummaries[] = "{$headers[$key]} from {$_POST[$name . "_" . $fieldInfo["name"] . "_start_date"]} to {$_POST[$name . "_" . $fieldInfo["name"] . "_end_date"]}";
                                             $filters[] = "({$models[$modelInfo["model"]]->getDatabase()}.{$fieldInfo["name"]}>='" . $models[$modelInfo["model"]]->escape(Common::stringToDatabaseDate($_POST[$name . "_" . $fieldInfo["name"] . "_start_date"])) . "' AND {$models[$modelInfo["model"]]->getDatabase()}.{$fieldInfo["name"]}<='" . $models[$modelInfo["model"]]->escape(Common::stringToDatabaseDate($_POST[$name . "_" . $fieldInfo["name"] . "_end_date"])) . "')";
                                             break;
                                     }
                                 }
                                 break;
                             case "enum":
                                 if (count($_POST[$name . "_" . $fieldInfo["name"] . "_value"]) >= 1 && $_POST[$name . "_" . $fieldInfo["name"] . "_value"][0] != "") {
                                     $m = $models[$modelInfo["model"]];
                                     if ($_POST[$name . "_" . $fieldInfo["name"] . "_option"] == "INCLUDE") {
                                         $summary = array();
                                         foreach ($_POST[$name . "_" . $fieldInfo["name"] . "_value"] as $value) {
                                             $summary[] = $fieldInfo["options"][$value];
                                         }
                                         $filterSummaries[] = "{$headers[$key]} being " . implode(", ", $summary);
                                         $condition = array();
                                         foreach ($_POST[$name . "_" . $fieldInfo["name"] . "_value"] as $value) {
                                             if ($value != "") {
                                                 $condition[] = "{$m->getDatabase()}.{$fieldInfo["name"]}='" . $m->escape($value) . "'";
                                             }
                                         }
                                     } else {
                                         if ($_POST[$name . "_" . $fieldInfo["name"] . "_option"] == "EXCLUDE") {
                                             $summary = array();
                                             foreach ($_POST[$name . "_" . $fieldInfo["name"] . "_value"] as $value) {
                                                 $summary[] = $fieldInfo["options"][$value];
                                             }
                                             $filterSummaries[] = "{$headers[$key]} excluding " . implode(", ", $summary);
                                             $condition = array();
                                             foreach ($_POST[$name . "_" . $fieldInfo["name"] . "_value"] as $value) {
                                                 if ($value != "") {
                                                     $condition[] = "{$m->getDatabase()}.{$fieldInfo["name"]}<>'" . $m->escape($value) . "'";
                                                 }
                                             }
                                         }
                                     }
                                     if (count($condition) > 0) {
                                         $filters[] = "(" . implode(" OR ", $condition) . ")";
                                     }
                                 }
                                 break;
                         }
                     } else {
                         if ($_POST[$name . "_" . $fieldInfo["name"] . "_value"] != "") {
                             if ($_POST[$name . "_" . $fieldInfo["name"] . "_option"] == "IS_ANY_OF") {
                                 foreach ($_POST[$name . "_" . $fieldInfo["name"] . "_value"] as $value) {
                                     if ($value != "") {
                                         $condition[] = "{$model->getDatabase()}.{$fieldInfo["name"]}='" . $model->escape($value) . "'";
                                     }
                                 }
                             } else {
                                 if ($_POST[$name . "_" . $fieldInfo["name"] . "_option"] == "IS_NONE_OF") {
                                     foreach ($_POST[$name . "_" . $fieldInfo["name"] . "_value"] as $value) {
                                         if ($value != "") {
                                             $condition[] = "{$model->getDatabase()}.{$fieldInfo["name"]}<>'" . $model->escape($value) . "'";
                                         }
                                     }
                                 }
                             }
                             if (count($condition) > 0) {
                                 $filters[] = "(" . implode(" OR ", $condition) . ")";
                             }
                         }
                     }
                 }
                 $this->updateFilterSummaries($filterSummaries);
                 // Generate the various tables taking into consideration grouping
                 if (count($filterSummaries) > 0) {
                     $report->filterSummary = new TextContent(str_replace("\\n", " ", implode("\n", $filterSummaries)), array("size" => 8, "bottom_margin" => 3));
                     $report->filterSummary->style["flow"] = true;
                     $report->add($report->filterSummary);
                 }
                 $params = array("fields" => $fields, "dynamicFields" => $dynamicFields, "dynamicHeaders" => $dynamicHeaders, "conditions" => implode(" AND ", $filters), "report" => $report, "headers" => $tableHeaders, "dont_join" => array());
                 foreach ($dontJoins as $pair) {
                     $params['dont_join'][] = (string) $pair;
                 }
                 if ($tableConditions != "") {
                     $params["conditions"] = $params['conditions'] . ($params['conditions'] != '' ? " AND " : '') . "({$tableConditions})";
                 }
                 if ($_POST[$name . "_sorting"] != "") {
                     array_unshift($hardCodedSorting, array("field" => $_POST[$name . "_sorting"], "type" => $_POST[$name . "_sorting_direction"]));
                 }
                 if (is_array($_POST[$name . "_grouping"])) {
                     foreach ($_POST[$name . "_grouping"] as $postGrouping) {
                         if ($postGrouping != "") {
                             $groupingFields = explode(",", $postGrouping);
                             foreach ($groupingFields as $key => $groupingField) {
                                 $modelInfo = Model::resolvePath($groupingField);
                                 $model = Model::load($modelInfo["model"]);
                                 $groupingFields[$key] = "{$model->database}.{$modelInfo["field"]}";
                             }
                             $reportGroupingFields[] = array("field" => $model->datastore->concatenate($groupingFields), "type" => "ASC");
                         }
                     }
                     //$reportGroupingFields = array_reverse($reportGroupingFields);
                     $hardCodedSorting = array_merge($reportGroupingFields, $hardCodedSorting);
                 }
                 $params["sort_field"] = $hardCodedSorting;
                 if ($_POST[$name . "_limit"] != '') {
                     $params['limit'] = $_POST[$name . "_limit"];
                 }
                 $params["no_num_formatting"] = true;
                 $params = $this->paramsCallback($params);
                 $this->reportData = ReportController::getReportData($params, SQLDatabaseModel::MODE_ARRAY);
                 unset($params["sort_field"]);
                 $wparams = $params;
                 $wparams["global_functions"] = array("LENGTH", "MAX");
                 $wparams["global_functions_set"] = true;
                 $this->widths = ReportController::getReportData($wparams, SQLDatabaseModel::MODE_ARRAY);
                 //SQLDBDataStore::getMulti($wparams,SQLDatabaseModel::MODE_ARRAY);
                 $this->widths = $this->widths[0];
                 foreach ($tableHeaders as $i => $header) {
                     foreach (explode("\\n", $header) as $line) {
                         if (strlen($line) / 2 > $this->widths[$i]) {
                             $this->widths[$i] = strlen($line) / 2;
                         }
                     }
                 }
                 $dataParams["widths"] = $this->widths;
                 $params["data_params"] = $dataParams;
                 if (count($ignoredFields) > 0) {
                     foreach ($this->reportData as $key => $row) {
                         foreach ($ignoredFields as $ignored) {
                             unset($this->reportData[$key][$ignored]);
                             unset($params["headers"][$ignored]);
                             unset($params["fields"][$ignored]);
                             unset($params["data_params"]["type"][$ignored]);
                             unset($params["data_params"]["total"][$ignored]);
                             unset($params["data_params"]["widths"][$ignored]);
                             unset($this->widths[$key]);
                         }
                         $this->reportData[$key] = array_values($this->reportData[$key]);
                     }
                     $params["headers"] = array_values($params["headers"]);
                     $params["fields"] = array_values($params["fields"]);
                     $params["data_params"]["type"] = array_values($params["data_params"]["type"]);
                     $params["data_params"]["total"] = array_values($params["data_params"]["total"]);
                     $params["data_params"]["widths"] = array_values($params["data_params"]["widths"]);
                     $this->widths = array_values($this->widths);
                 }
                 if ($_POST[$name . "_grouping"][0] == "") {
                     $total = $this->drawTable($this->reportData, $params, $params["data_params"], true, $heading);
                 } else {
                     if ($_POST[$name . "_grouping"][0] != "" && $_POST["grouping_1_summary"] == '1') {
                         $params["grouping_fields"] = $_POST[$name . "_grouping"];
                         $params["grouping_level"] = 0;
                         $params["previous_headings"] = array();
                         $params["ignored_fields"] = array();
                         $total = $this->generateSummaryTable($params);
                     } else {
                         $params["grouping_fields"] = $_POST[$name . "_grouping"];
                         $params["grouping_level"] = 0;
                         $params["previous_headings"] = array();
                         $params["ignored_fields"] = array();
                         $total = $this->generateTable($params);
                         if (is_array($total) && count($total) > 0) {
                             $total[0] = $total[0] == "" ? "Overall Total" : $total[0];
                             $dataParams["widths"] = $this->widths;
                             $totalTable = new TableContent($tableHeaders, null);
                             $totalTable->data_params = $dataParams;
                             $totalTable->style["totalsBox"] = true;
                             foreach ($total as $key => $value) {
                                 if (is_numeric($value)) {
                                     $total[$key] = $value;
                                 }
                             }
                             $totalTable->setData($total);
                             $report->add($totalTable);
                         }
                     }
                 }
                 break;
         }
     }
     $report->output();
     //die();
 }
Example #20
0
<?php

/**
 * Created by PhpStorm.
 * User: Olaniyi
 * Date: 6/4/15
 * Time: 3:37 PM
 */
require_once 'includes/iframe-header.php';
require_once '../../_core/global/_require.php';
Crave::requireAll(GLOBAL_VAR);
Crave::requireAll(UTIL);
Crave::requireFiles(MODEL, array('BaseModel', 'ReportModel'));
Crave::requireFiles(CONTROLLER, array('ReportController'));
$new_patient = ReportController::newPatients();
?>

<table class="table table-responsive dataTable">
    <thead>
    <tr>
        <th>S/N</th>
        <th>Name</th>
        <th>Registration Number</th>
        <th>Gender</th>
    </tr>
    </thead>
    <tbody id="new_patient">
    <?php 
if (count($new_patient) == 0) {
    ?>
        <tr>
Example #21
0
 /**
  * Constructor
  *
  * @param ReportController $reportCtrl
  */
 public function __construct(ReportController $reportCtrl)
 {
     $this->reportCtrl = $reportCtrl;
     $this->reportCtrl->loadLastExec();
     $this->report = $reportCtrl->getReport();
 }
Example #22
0
<?php

/**
 * Created by PhpStorm.
 * User: Olaniyi
 * Date: 6/4/15
 * Time: 3:37 PM
 */
require_once 'includes/iframe-header.php';
require_once '../../_core/global/_require.php';
Crave::requireAll(GLOBAL_VAR);
Crave::requireAll(UTIL);
Crave::requireFiles(MODEL, array('BaseModel', 'ReportModel'));
Crave::requireFiles(CONTROLLER, array('ReportController'));
$consultation = ReportController::consultationReport();
?>


    <table class="table table-responsive dataTable">
        <thead>
        <tr>
            <th>S/N</th>
            <th>Name</th>
            <th>Registration Number</th>
            <th>Consultation Date</th>
        </tr>
        </thead>
        <tbody id="new_patient">
        <?php 
if (count($consultation) == 0) {
    ?>
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
include_once "includes/sp-load.php";
checkLoggedIn();
include_once SP_CTRLPATH . "/keyword.ctrl.php";
include_once SP_CTRLPATH . "/website.ctrl.php";
include_once SP_CTRLPATH . "/language.ctrl.php";
include_once SP_CTRLPATH . "/searchengine.ctrl.php";
include_once SP_CTRLPATH . "/report.ctrl.php";
$controller = new ReportController();
$controller->view->menu = 'seotools';
$controller->layout = 'ajax';
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    switch ($_POST['sec']) {
        default:
            $controller->showGraphicalReports($_POST);
            break;
    }
} else {
    switch ($_GET['sec']) {
        case "graph":
            $controller->showGraph($_GET);
            break;
        default:
            $controller->showGraphicalReports($_GET);
Example #24
0
File: MyClass.php Project: srccn/hy
 function downloadreport()
 {
     $myReportController = new ReportController();
     $myReportController->generateDownload();
 }
Example #25
0
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
 *   GNU General Public License for more details.                          *
 *                                                                         *
 *   You should have received a copy of the GNU General Public License     *
 *   along with this program; if not, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
 ***************************************************************************/
include_once "includes/sp-load.php";
checkLoggedIn();
include_once SP_CTRLPATH . "/keyword.ctrl.php";
include_once SP_CTRLPATH . "/website.ctrl.php";
include_once SP_CTRLPATH . "/searchengine.ctrl.php";
include_once SP_CTRLPATH . "/report.ctrl.php";
$controller = new ReportController();
$controller->layout = 'ajax';
$controller->spTextTools = $controller->getLanguageTexts('seotools', $_SESSION['lang_code']);
$controller->set('spTextTools', $controller->spTextTools);
$controller->spTextKeyword = $controller->getLanguageTexts('keyword', $_SESSION['lang_code']);
$controller->set('spTextKeyword', $controller->spTextKeyword);
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    switch ($_POST['sec']) {
        default:
            $controller->showOverallReportSummary($_POST);
            break;
    }
} else {
    switch ($_GET['sec']) {
        default:
            $controller->showOverallReportSummary($_GET);
Example #26
0
    if (is_array($result)) {
        echo JsonResponse::success($result);
        exit;
    } else {
        echo JsonResponse::error("Unable to retrieve in-patient report for the specified dates!");
        exit;
    }
} elseif ($intent == 'consultationReport') {
    ReportController::datesIncluded();
    $result = ReportController::consultationReport();
    if (is_array($result)) {
        echo JsonResponse::success($result);
        exit;
    } else {
        echo JsonResponse::error("Unable to retrieve consultation report for the specified dates!");
        exit;
    }
} elseif ($intent == 'patientDiagnosis') {
    ReportController::datesIncluded();
    $result = ReportController::patientDiagnosis();
    if (is_array($result)) {
        echo JsonResponse::success($result);
        exit;
    } else {
        echo JsonResponse::error("Unable to retrieve patient diagnosis report for the specified dates!");
        exit;
    }
} else {
    echo JsonResponse::error("Invalid request intent!");
    exit;
}
Example #27
0
 public function getReportData()
 {
     $time = Carbon\Carbon::now();
     $prevTime = Carbon\Carbon::now()->subSeconds($this->_FREQUENCY);
     $data = ['subject' => 'CMS Regular Report @ ' . $time->toDateTimeString(), 'title' => 'CMS Report from ' . $prevTime->diffForHumans(), 'date' => $time->toFormattedDateString(), 'time' => $time->toTimeString()];
     $reportController = new ReportController();
     $reports = json_decode($reportController->listing());
     usort($reports, 'self::compareDate');
     $statusCount = array();
     $updateCount = array('new' => array(), 'updated' => array());
     foreach ($reports as $report) {
         $reportCreated = new Carbon\Carbon($report->created_at);
         $reportUpdated = new Carbon\Carbon($report->updated_at);
         // if ($prevTime->diffInSeconds($reportUpdated, true) > $this->_FREQUENCY) {
         //     continue;
         // }
         if (!isset($updateCount['new'][$report->reportTypeName])) {
             $updateCount['new'][$report->reportTypeName] = 0;
         }
         if (!isset($updateCount['updated'][$report->reportTypeName])) {
             $updateCount['updated'][$report->reportTypeName] = 0;
         }
         if ($reportCreated->eq($reportUpdated)) {
             $updateCount['new'][$report->reportTypeName]++;
         } else {
             $updateCount['updated'][$report->reportTypeName]++;
         }
         if (!isset($statusCount[$report->reportStatusTypeName])) {
             $statusCount[$report->reportStatusTypeName] = array();
         }
         if (!isset($statusCount[$report->reportStatusTypeName][$report->reportTypeName])) {
             $statusCount[$report->reportStatusTypeName][$report->reportTypeName] = 0;
         }
         $statusCount[$report->reportStatusTypeName][$report->reportTypeName]++;
     }
     foreach ($statusCount as $key => $value) {
         $statusCount[$key]['total'] = array_sum($value);
     }
     $statusCount['total'] = array();
     foreach ($statusCount as $key => $value) {
         foreach ($value as $subKey => $subValue) {
             $statusCount['total'][$subKey] = 0;
             foreach ($statusCount as $sKey => $sValue) {
                 if ($sKey == 'total') {
                     continue;
                 }
                 $statusCount['total'][$subKey] += $statusCount[$sKey][$subKey];
             }
         }
         break;
     }
     $updateCount['total'] = array();
     foreach ($updateCount as $key => $value) {
         foreach ($value as $subKey => $subValue) {
             $updateCount['total'][$subKey] = 0;
             foreach ($updateCount as $sKey => $sValue) {
                 if ($sKey == 'total') {
                     continue;
                 }
                 $updateCount['total'][$subKey] += $updateCount[$sKey][$subKey];
             }
         }
         break;
     }
     foreach ($updateCount as $key => $value) {
         $updateCount[$key]['total'] = array_sum($value);
     }
     $data['statusCounts'] = $statusCount;
     $data['updateCounts'] = $updateCount;
     $data['latestReports'] = array_slice($reports, 0, 5, true);
     return $data;
 }
    public function export()
    {
        $export = $_GET['export'];

        $self  = new ReportController;
        $self->export = $export;
        if($export === 'xls')
        {
            $self->generate_report(false);
            $self->generate_xls();
            exit;
        }
        else if($export === 'pdf')
        {
            include( plugin_dir_path ( __FILE__ ) . implode(DIRECTORY_SEPARATOR, array('..', 'lib', 'MPDF57', 'mpdf.php')) );
            ob_start();
            $self->generate_report();
            $html = ob_get_contents();
            ob_end_clean();

            $mpdf=new \mPDF();
            $mpdf->useOnlyCoreFonts = true;
            $mpdf->WriteHTML($html);
            $mpdf->Output();
            exit;
        }
        else if($export === 'print')
        {
            $self->generate_report();
            exit;
        }
        
    }
<?php

/**
 * Created by PhpStorm.
 * User: gpant
 * Date: 12/16/2015
 * Time: 4:46 PM
 */
require_once dirname(__FILE__) . '/../bootstrap.php';
$date = date('Y-m-d');
$is_successfull = false;
$isDone = false;
$whilecount = 0;
$queue = false;
$reportController = new ReportController($argv[2]);
if ($reportController->isValidReport == false) {
    echo "The table for correspoinding days number is not available\n";
    return;
}
$params = array('reportDescription' => array('reportSuiteID' => 'souqaeprod', 'date' => $date, 'dateFrom' => date('Y-m-d', strtotime($date . ' -' . $argv[2] . ' day')), 'dateTo' => date('Y-m-d', strtotime($date . ' -1 day')), 'metrics' => array(array('id' => 'event1'), array('id' => 'orders'), array('id' => 'visits'), array('id' => 'event3'), array('id' => 'carts')), 'elements' => array(array('id' => 'evar33', 'classification' => '', 'top' => '20', 'startingWith' => 20 * $argv[1] + 1), array('id' => 'product', 'classification' => 'product brand', 'top' => '6')), 'sortBy' => 'event1', 'validate' => true));
while ($queue === false) {
    $queue = $reportController->runOmnitureReport($params, 'Report.QueueRanked');
    if ($queue !== false) {
        while (!($isDone || $whilecount == 10)) {
            $isDone = $reportController->checkStatus($queue);
            if ($isDone) {
                $report = $reportController->runReport($queue);
                if ($report !== false) {
                    while (!$is_successfull) {
                        $is_successfull = $reportController->saveToDb($report, "brand", $argv[2]);
                    }
Example #30
0
<?php

/**
 * Created by PhpStorm.
 * User: Olaniyi
 * Date: 6/4/15
 * Time: 3:37 PM
 */
require_once 'includes/iframe-header.php';
require_once '../../_core/global/_require.php';
Crave::requireAll(GLOBAL_VAR);
Crave::requireAll(UTIL);
Crave::requireFiles(MODEL, array('BaseModel', 'ReportModel'));
Crave::requireFiles(CONTROLLER, array('ReportController'));
$patients_diagnosis = ReportController::patientDiagnosis();
?>

    <table class="table table-responsive dataTable">
        <thead>
        <tr>
            <th>S/N</th>
            <th>Name</th>
            <th>Registration Number</th>
            <th>Diagnosis</th>
            <th>Consultation Date</th>
        </tr>
        </thead>
        <tbody id="new_patient">
        <?php 
if (count($patients_diagnosis) == 0) {
    ?>