Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions LangCodes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<?php
/**
* @author: Cesar Hernandez
* getLanguage: This method return the language code
* getNameLang: This method return the name of the language
*/
class LangCodes{
public function getLanguage($code){
$all_lang=array(
'fr'=>'fr_FR',
'en'=>'en_US'
);
return $all_lang[$code];
}
public function getNameLang($code_lang){
$name_lang=array(
'fr'=>_('French'),
'en'=>_('English')
);
return $name_lang[$code_lang];
}
}
?>
14 changes: 7 additions & 7 deletions admin/classes/common/DBService.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,22 +21,22 @@ class DBService {
public function __construct($dbname = null){
Config::init();
if (!($this->db = new mysqli(Config::$database->host, Config::$database->username, Config::$database->password))){
throw new Exception("There was a problem with the database: " . $this->db->error);
throw new Exception(_("There was a problem with the database: ") . $this->db->error);
}else if ($dbname){
if (!$this->db->select_db($dbname)){
throw new Exception("There was a problem with the database: " . $this->db->error);
throw new Exception(_("There was a problem with the database: ") . $this->db->error);
}
}else if (!($this->db->select_db(Config::$database->name))){
throw new Exception("There was a problem with the database: " . $this->db->error);
throw new Exception(_("There was a problem with the database: ") . $this->db->error);
}

if ($dbname)
$this->changeDB($dbname);
}
public function changeDB($databaseName){
// $databaseName='coral_reporting_pprd';
public function changeDB($databaseName) {
//$databaseName='coral_reporting_pprd';
if (!$this->db->select_db($databaseName)){
throw new Exception("There was a problem with the database: " . $this->db->error);
throw new Exception(_("There was a problem with the database: ") . $this->db->error);
}
return $this;
}
Expand All @@ -45,7 +45,7 @@ public function getSQLdb(){
}
public function query($sql){
if (!($result = $this->db->query($sql)))
throw new Exception("There was a problem with the database: " . $this->db->error);
throw new Exception(_("There was a problem with the database: ") . $this->db->error);
else if ($result instanceof mysqli_result){
return new DBResult($result);
}else if ($result){
Expand Down
16 changes: 8 additions & 8 deletions admin/classes/domain/Report.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,30 +136,30 @@ public function printPlatformInfo(&$platforms){
foreach ( $platforms as $platform ){
echo "<tr valign='top'><td align='right'><b>{$platform['reportDisplayName']}</b></td><td>Year";
if ($platform['startYear'] != '' && ($platform['endYear'] == '' || $platform['endYear'] == '0')){
echo ": {$platform['startYear']} to present";
echo ": {$platform['startYear']} "._("to present");
}else{
echo "s: {$platform['startYear']} to {$platform['endYear']}";
echo "s: {$platform['startYear']} "._("to")." {$platform['endYear']}";
}
echo '</td><td>This Interface ';
echo "</td><td>"._("This Interface ");
if ($platform['counterCompliantInd'] == '1'){
echo 'provides COUNTER compliant stats.<br>';
echo _("provides COUNTER compliant stats.").'<br>';
}else{
echo 'does not provide COUNTER compliant stats.<br>';
echo _("does not provide COUNTER compliant stats.").'<br>';
}
if ($platform['noteText']){
echo "<br><i>Interface Notes</i>: {$platform['noteText']}<br>";
echo "<br><i>"._("Interface Notes")."</i>: {$platform['noteText']}<br>";
}
echo '</td></tr>';
}
}

public function printPublisherInfo(&$publishers){
foreach ( $publishers as $publisher ){
echo "<tr valign='top'><td align='right'><b>{$publisher['reportDisplayName']}</b></td><td>Year";
echo "<tr valign='top'><td align='right'><b>{$publisher['reportDisplayName']}</b></td><td>"._("Year");
if (($publisher['startYear'] != '') && ($publisher['endYear'] == '')){
echo ": {$publisher['startYear']}";
}else{
echo "s: {$publisher['startYear']} to {$publisher['endYear']}";
echo "s: {$publisher['startYear']} "._("to")." {$publisher['endYear']}";
}
echo '</td><td>';
if (isset($publisher['notes'])){
Expand Down
24 changes: 12 additions & 12 deletions admin/classes/domain/ReportHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ public function process(DBResult &$reportArray, ReportNotes &$notes){
if ($this->outputType === 'web'
&& ($print_data !== '&nbsp;') && $field === 'TITLE'){
if ($this->report->getID() != '1'){
$print_data .= '<br><font size="-4"><a target="_BLANK" href="report.php?reportID=1&prm_4=' . ($this->showUnadjusted ? 'Y' : 'N') . "&titleID={$currentRow['titleID']}&outputType=web'>view related titles</a></font>";
$print_data .= '<br><font size="-4"><a target="_BLANK" href="report.php?reportID=1&prm_4=' . ($this->showUnadjusted ? 'Y' : 'N') . "&titleID={$currentRow['titleID']}&outputType=web'>"._("view related titles")."</a></font>";
}
// echo link resolver link
if ((($currentRow['PRINT_ISSN']) || ($currentRow['ONLINE_ISSN'])) && isset($this->baseURL)){
$print_data .= '<br><font size="-4"><a target="_BLANK" href="' . $this->getLinkResolverLink($currentRow) . '">view in link resolver</a></font>';
$print_data .= "<br><font size='-4'><a target='_BLANK' href='" . $this->getLinkResolverLink($currentRow) . "'>"._("view in link resolver")."</a></font>";
}
}

Expand Down Expand Up @@ -195,7 +195,7 @@ public function process(DBResult &$reportArray, ReportNotes &$notes){
if ($this->outputType != 'xls' && !($performCheck && in_array(false, $this->groupColsArray, true) !== false) && $print_subtotal_flag && $this->report->hasGroupTotalInd()){
$rowoutput .= "</tr>";
if ($countForGrouping > 1){
$rowoutput .= "<tr class='data'><td class='sum'>Total for $hold_rprt_grpng_data</td>";
$rowoutput .= "<tr class='data'><td class='sum'>"._("Total for ").$hold_rprt_grpng_data."</td>";
foreach ( $fields as $field ){
$rowoutput .= '<td class="sum">' . $this->sumField($this->sumColsArray[$field], $sumArray[$field]) . '</td>';
}
Expand All @@ -218,15 +218,15 @@ public function process(DBResult &$reportArray, ReportNotes &$notes){
if ($this->report->hasGroupTotalInd() && $hold_rprt_grpng_data){
// one last grouping summary
if ($countForGrouping > 1){
$grp .= "<tr class='data'><td class='sum'>Total for $hold_rprt_grpng_data</td>";
$grp .= "<tr class='data'><td class='sum'>"._("Total for ").$hold_rprt_grpng_data."</td>";
foreach ( $fields as $field ){
$grp .= "<td class='sum'>" . $this->sumField($this->sumColsArray[$field], $sumArray[$field]) . "</td>";
}
echo "$grp</tr>";
}
echo "<tr class='data'><td colspan=$numFields>&nbsp;</td></tr>";
}
echo '<tr class="data"><td class="sum">Total for Report</td>';
echo '<tr class="data"><td class="sum">'._("Total for Report").'</td>';
$total = '';
for($colNum = 1; $colNum < $numFields; ++$colNum){
if (isset($this->sumColsArray[$fields[$colNum]])){
Expand All @@ -241,13 +241,13 @@ public function process(DBResult &$reportArray, ReportNotes &$notes){
}

if ($rowNum === 0){
echo "<tr class='data'><td colspan=$numFields><i>Sorry, no rows were returned.";
echo "<tr class='data'><td colspan=$numFields><i>"._("Sorry, no rows were returned.");
}else{
echo "<tr><td colspan=$numFields align='right'><i>Showing rows {$this->startPage} to ";
echo "<tr><td colspan=$numFields align='right'><i>"._("Showing rows ").$this->startPage._(" to ");
if (($this->maxRows > 0) && ($rowNum > $this->maxRows)){
echo "$this->maxRows of $this->maxRows";
echo $this->maxRows._(" of ").$this->maxRows;
}else{
echo "$rowNum of $rowNum";
echo $rowNum._(" of ").$rowNum;
}
}
echo '</i></td></tr></tbody>';
Expand Down Expand Up @@ -297,7 +297,7 @@ private function loopThroughParams(){
$this->paramDisplay = '';
$this->rprt_prm_add = '';
}else{
$this->paramDisplay = '<b>Title:</b> ' . $this->report->getUsageTitle($this->titleID) . '<br>';
$this->paramDisplay = '<b>'._("Title:").'</b> ' . $this->report->getUsageTitle($this->titleID) . '<br>';
$this->rprt_prm_add = "&titleID={$this->titleID}";
$this->hidden_inputs->addReportID($this->report->getID())
->addTitleID($this->titleID);
Expand All @@ -311,13 +311,13 @@ private function loopThroughParams(){
if (($prm_value === 'on') || ($prm_value === 'Y')){
$this->showUnadjusted = true;
$this->hidden_inputs->addParam($parm->ID, 'Y');
$this->paramDisplay .= '<b>Numbers are not adjusted for use violations</b><br>';
$this->paramDisplay .= '<b>'._("Numbers are not adjusted for use violations").'</b><br>';
}
}else if ($parm->addWhereClause === 'limit'){
// decide what to do
$this->addWhere[0] = ''; // changed from $add_where. Assumed mistake.
$this->maxRows = $prm_value;
$this->paramDisplay .= "<b>Limit:</b> Top $prm_value<br>";
$this->paramDisplay .= "<b>"._("Limit:")."</b> "._("Top ").$prm_value."<br>";
}else{
// if the parm comes through as an id (for publisher / platform or title), display actual value for user friendliness
if (($parm->displayPrompt === 'Provider / Publisher') || ($parm->displayPrompt === 'Provider') || ($parm->displayPrompt === 'Publisher')){
Expand Down
19 changes: 9 additions & 10 deletions ajax_htmldata.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
echo ">";

if ($parm->requiredInd != '1'){
echo "<option value='' selected>all</option>";
echo "<option value='' selected>"._("all")."</option>";
}
$rownumber = 1;

Expand All @@ -55,10 +55,10 @@
unset($p);
echo '</select>';
}else if ($parm->typeCode === "ms"){
echo "<span style='margin-left:-90px'><div id='div_show_" . $parm->ID . "' style='float:left;margin-bottom: 5px'><a href=\"javascript:toggleLayer('div_" . $parm->ID . "','block');toggleLayer('div_show_" . $parm->ID . "','none');\">-Click to choose " . $parm->displayPrompt . "-</a></div><div id='div_" . $parm->ID . "' style='display:none;float:left;margin-bottom: 5px;'><table class='noborder'><tr><td class='noborder'><select name='prm_left_" . $parm->ID . "' id='prm_left_" . $parm->ID . "' class='opt' size='10' multiple='multiple' style='width:175px'>";
echo "<span style='margin-left:-90px'><div id='div_show_" . $parm->ID . "' style='float:left;margin-bottom: 5px'><a href=\"javascript:toggleLayer('div_" . $parm->ID . "','block');toggleLayer('div_show_" . $parm->ID . "','none');\">-"._("Click to choose ") . $parm->displayPrompt . "-</a></div><div id='div_" . $parm->ID . "' style='display:none;float:left;margin-bottom: 5px;'><table class='noborder'><tr><td class='noborder'><select name='prm_left_" . $parm->ID . "' id='prm_left_" . $parm->ID . "' class='opt' size='10' multiple='multiple' style='width:175px'>";

if ($parm->requiredInd != '1'){
echo "<option value='' selected>All</option>";
echo "<option value='' selected>"._("All")."</option>";
}

if (isset($parmValue[$parm->parentReportParameterID])){
Expand All @@ -68,7 +68,7 @@
}

// echo javascript left/right buttons
echo "</select></td><td align='center' valign='middle' style='border:0px;'><input type='button' value='--&gt;' style='width:35px' onclick='moveOptions(this.form.prm_left_" . $parm->ID . ", this.form.prm_right_" . $parm->ID . ");placeInHidden(\",\",\"prm_right_" . $parm->ID . "\", \"prm_" . $parm->ID . "\");' /><br> <input type='button' value='&lt;--' style='width:35px' onclick='moveOptions(this.form.prm_right_" . $parm->ID . ", this.form.prm_left_" . $parm->ID . ");placeInHidden(\",\",\"prm_right_" . $parm->ID . "\", \"prm_" . $parm->ID . "\");' /></td><td style='border:0px;'><select name='prm_right_" . $parm->ID . "' id='prm_right_" . $parm->ID . "' class='opt' size='10' multiple='multiple' style='width:175px'></select></td></tr><tr><td style='border:0px;' colspan='3' align='left'><input type='hidden' name='prm_" . $parm->ID . "' id='prm_" . $parm->ID . "' value=\"\"><a href=\"javascript:toggleLayer('div_" . $parm->ID . "','none');toggleLayer('div_show_" . $parm->ID . "','block');\">-Hide " . $parm->displayPrompt . "-</a></td></tr></table></div></span>";
echo "</select></td><td align='center' valign='middle' style='border:0px;'><input type='button' value='--&gt;' style='width:35px' onclick='moveOptions(this.form.prm_left_" . $parm->ID . ", this.form.prm_right_" . $parm->ID . ");placeInHidden(\",\",\"prm_right_" . $parm->ID . "\", \"prm_" . $parm->ID . "\");' /><br> <input type='button' value='&lt;--' style='width:35px' onclick='moveOptions(this.form.prm_right_" . $parm->ID . ", this.form.prm_left_" . $parm->ID . ");placeInHidden(\",\",\"prm_right_" . $parm->ID . "\", \"prm_" . $parm->ID . "\");' /></td><td style='border:0px;'><select name='prm_right_" . $parm->ID . "' id='prm_right_" . $parm->ID . "' class='opt' size='10' multiple='multiple' style='width:175px'></select></td></tr><tr><td style='border:0px;' colspan='3' align='left'><input type='hidden' name='prm_" . $parm->ID . "' id='prm_" . $parm->ID . "' value=\"\"><a href=\"javascript:toggleLayer('div_" . $parm->ID . "','none');toggleLayer('div_show_" . $parm->ID . "','block');\">-"._("Hide ") . $parm->displayPrompt . "-</a></td></tr></table></div></span>";
}else if ($parm->typeCode === "chk"){
echo "<input type='checkbox' name='prm_" . $parm->ID . "' class='opt' style='text-align:left;width:13px;'>";
}else{
Expand All @@ -94,7 +94,7 @@
echo ">";
}
if ($parm->requiredInd != '1'){
echo "<option value='' selected>All</option>";
echo "<option value='' selected>"._("All")."</option>";
}

$rownumber = 1;
Expand All @@ -107,23 +107,22 @@

echo "</select>";
}else if ($parm->typeCode === "ms"){
echo "<br><label for='prm_" . $parm->ID . "'>" . $parm->displayPrompt . "</label><span style='margin-left:-90px'><div id='div_show_" . $parm->ID . "' style='float:left;margin-bottom: 5px'><a href=\"javascript:toggleLayer('div_" . $parm->ID . "','block');toggleLayer('div_show_" . $parm->ID . "','none');\">-Click to choose " . $parm->displayPrompt . "-</a></div><div id='div_" . $parm->ID . "' style='display:none;float:left;margin-bottom: 5px;'><table class='noborder'><tr><td class='noborder'><select name='prm_left_" . $parm->ID . "' id='prm_left_" . $parm->ID . "' class='opt' size='10' multiple='multiple' style='width:175px'>";
echo "<br><label for='prm_" . $parm->ID . "'>" . $parm->displayPrompt . "</label><span style='margin-left:-90px'><div id='div_show_" . $parm->ID . "' style='float:left;margin-bottom: 5px'><a href=\"javascript:toggleLayer('div_" . $parm->ID . "','block');toggleLayer('div_show_" . $parm->ID . "','none');\">-"._("Click to choose ") . $parm->displayPrompt . "-</a></div><div id='div_" . $parm->ID . "' style='display:none;float:left;margin-bottom: 5px;'><table class='noborder'><tr><td class='noborder'><select name='prm_left_" . $parm->ID . "' id='prm_left_" . $parm->ID . "' class='opt' size='10' multiple='multiple' style='width:175px'>";

if ($parm->requiredInd != '1'){
echo "<option value='' selected>All</option>";
echo "<option value='' selected>"._("All")."</option>";
}

foreach ( $parm->getSelectValues($reportParameterVal) as $value ){
echo "<option value='" . strtr(str_replace("'", "\\'", $value['cde']), ',', "\\") . "'>" . $value['val'] . "</option>";
}

// echo javascript left/right buttons
echo "</select></td><td align='center' valign='middle' style='border:0px;'><input type='button' value='--&gt;' style='width:35px' onclick='moveOptions(this.form.prm_left_" . $parm->ID . ", this.form.prm_right_" . $parm->ID . ");placeInHidden(\",\",\"prm_right_" . $parm->ID . "\", \"prm_" . $parm->ID . "\");' /><br> <input type='button' value='&lt;--' style='width:35px' onclick='moveOptions(this.form.prm_right_" . $parm->ID . ", this.form.prm_left_" . $parm->ID . ");placeInHidden(\",\",\"prm_right_" . $parm->ID . "\", \"prm_" . $parm->ID . "\");' /></td><td style='border:0px;'><select name='prm_right_" . $parm->ID . "' id='prm_right_" . $parm->ID . "' class='opt' size='10' multiple='multiple' style='width:175px'></select></td></tr><tr><td style='border:0px;' colspan='3' align='left'><input type='hidden' name='prm_" . $parm->ID . "' id='prm_" . $parm->ID . "' value=\"\"><a href=\"javascript:toggleLayer('div_" . $parm->ID . "','none');toggleLayer('div_show_" . $parm->ID . "','block');\">-Hide " . $parm->displayPrompt . "-</a></td></tr></table></div></span>";
echo "</select></td><td align='center' valign='middle' style='border:0px;'><input type='button' value='--&gt;' style='width:35px' onclick='moveOptions(this.form.prm_left_" . $parm->ID . ", this.form.prm_right_" . $parm->ID . ");placeInHidden(\",\",\"prm_right_" . $parm->ID . "\", \"prm_" . $parm->ID . "\");' /><br> <input type='button' value='&lt;--' style='width:35px' onclick='moveOptions(this.form.prm_right_" . $parm->ID . ", this.form.prm_left_" . $parm->ID . ");placeInHidden(\",\",\"prm_right_" . $parm->ID . "\", \"prm_" . $parm->ID . "\");' /></td><td style='border:0px;'><select name='prm_right_" . $parm->ID . "' id='prm_right_" . $parm->ID . "' class='opt' size='10' multiple='multiple' style='width:175px'></select></td></tr><tr><td style='border:0px;' colspan='3' align='left'><input type='hidden' name='prm_" . $parm->ID . "' id='prm_" . $parm->ID . "' value=\"\"><a href=\"javascript:toggleLayer('div_" . $parm->ID . "','none');toggleLayer('div_show_" . $parm->ID . "','block');\">-"._("Hide ") . $parm->displayPrompt . "-</a></td></tr></table></div></span>";
}
}else{
echo "Action " . $action . " not set up!";
echo _("Action ") . $action . _(" not set up!");
}

ob_end_flush();
?>

1 change: 0 additions & 1 deletion css/print.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ font-weight: bold;
th {
border-width: 1px;
color: black;
font-weight: heavy;
}

html, body {
Expand Down
32 changes: 24 additions & 8 deletions css/style.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
html {
height: 100%;
margin: 0;
padding: 0
padding: 0;
}

body {
Expand All @@ -10,9 +10,8 @@ body {
color: #3D545D;
font-family: "arial";
font-size: 8pt;
font-weight: heavy;
margin: 5px;
padding: 0
padding: 0;
}

label{
Expand Down Expand Up @@ -131,10 +130,9 @@ border-right: 1px solid #C1DAD7;
border-bottom: 1px solid #C1DAD7;
background: #f5f8fb;
padding: 1px;
font-weight: heavy;
color: #3D545D;
text-align:center;
align:center;
/*align:center;*/
}

td.head {
Expand Down Expand Up @@ -168,7 +166,25 @@ a.headLink{
color: white;
}

select option { color: #3D545D; font-family: "arial"; font-size: 8pt; font-weight: medium; }
.opt { color: #3D545D; font-family: "arial"; font-size: 8pt; font-weight: medium; }

select option { color: #3D545D; font-family: "arial"; font-size: 8pt; }
.opt { color: #3D545D; font-family: "arial"; font-size: 8pt; }

/* Change language */
.dropDownLang{
color: #3D545D;
background: #e4f5fc; /* Old browsers */
background: linear-gradient(to bottom, #c8d8e9 3%,#e2f0ff 52%,#c7cefc 100%); /* W3C */
border: none;
border-radius: 5px;
font-weight: bolder;
width: auto;
height:20px;
cursor: pointer;
}
.fontText{
font-size: 11pt;
}
.boxRight{
position:absolute;
margin-left:67%;
}
17 changes: 17 additions & 0 deletions directory.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,21 @@ function lcfirst($string) {
}
}

// Include file of language codes
include_once 'LangCodes.php';
$lang_name = new LangCodes();

// Verify the language of the browser
global $http_lang;
if(isset($_COOKIE["lang"])){
$http_lang = $_COOKIE["lang"];
}else{
$codeL = substr($_SERVER["HTTP_ACCEPT_LANGUAGE"],0,2);
$http_lang = $lang_name->getLanguage($codeL);
}
putenv("LC_ALL=$http_lang");
setlocale(LC_ALL, $http_lang.".utf8");
bindtextdomain("messages", "./locale");
textdomain("messages");

?>
Loading