Example #1
0
 function _setValues($pid)
 {
     $log = new LogDatabaseQueryArticleLanguageYear(LOGDEF);
     $log->SetPid($pid);
     if (!($result = $log->executeQuery())) {
         echo "Error: " . $log->getMySQLError();
         $log->destroy();
         exit;
     }
     $date = $log->getInitDate();
     if ($date) {
         $iniYear = substr($date, 0, 4);
     }
     $date = $log->getLastDate();
     if ($date) {
         $finYear = substr($date, 0, 4);
     }
     $count = 0;
     for ($year = $iniYear; $year <= $finYear; $year++) {
         $this->_years[$count] = $year;
         $this->_data[$count++] = array(0, 0, 0, 0);
     }
     for ($i = 0; $i < mysql_num_rows($result); $i++) {
         $row = mysql_fetch_array($result);
         $iyear = $row["year"] - $iniYear;
         switch ($row["lang"]) {
             case 'es':
                 $ilang = 1;
                 break;
             case 'pt':
                 $ilang = 2;
                 break;
             case 'fr':
                 $ilang = 3;
                 break;
             default:
                 $ilang = 0;
         }
         $this->_data[$ilang][$iyear] += $row["total"];
     }
     $log->destroy();
 }
<?php

include_once "classLogDatabaseQueryArticleLanguageYearNew.php";
define("LOGDEF", "../scielo.def");
$log = new LogDatabaseQueryArticleLanguageYear(LOGDEF);
if (isset($dti)) {
    $log->SetInitialDate($dti);
}
if (isset($dtf)) {
    $log->SetFinalDate($dtf);
}
if (isset($pid)) {
    $log->SetPid($pid);
}
if (isset($script)) {
    $log->SetScriptName($script);
}
if (isset($lng)) {
    $log->SetInterfaceLanguage($lng);
}
if (isset($nrm)) {
    $log->SetStandard($nrm);
}
$response = $log->getResultXML();
$log->destroy();
echo $response;