Tuesday, February 24, 2015

Localisation full example

CREATE TABLE `tablename`
(
`id` int  NOT NULL AUTO_INCREMENT,
`fieldname` varchar(300) CHARACTER SET utf8 collate utf8_general_ci ,
`fieldname` varchar(300)   CHARACTER SET utf8 collate utf8_general_ci,
PRIMARY KEY (`id`)
)
delete user

<?php include("french.php"); ?>
<?php

$LANG ='fr';

$connect  =mysql_connect('192.168.1.170', 'user','aipl2014') or die(mysql_error());
mysql_select_db(test,$connect)or die("cannot select DB");

if(isset($_POST["submit"]) && $_POST["submit"]!="") {
$usersCount = count($_POST["userName"]);
for($i=0;$i<$usersCount;$i++) {
mysql_query("UPDATE packageimages set status='" . $_POST["firstName"][$i] . "' WHERE pimageid='" . $_POST["userId"][$i] . "'");
}
header("Location:need_Approval_list.php");
}
?>
<html>
<head>
<title><?php echo msg('UnApproved Packages'); ?></title>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<form name="frmUser" method="post" action="">
<div style="width:500px;">
<table border="0" cellpadding="10" cellspacing="0" width="500" align="center">
<tr class="tableheader">
<td><?php echo msg('UnApproved Packages'); ?></td>
</tr>
<?php
$rowCount = count($_POST["users"]);
for($i=0;$i<$rowCount;$i++) {
$result = mysql_query("SELECT * FROM  ads WHERE adId='" . $_POST["users"][$i] . "'");
$row[$i]= mysql_fetch_array($result);
?>
<tr>
<td>
<table border="0" cellpadding="10" cellspacing="0" width="500" align="center" class="tblSaveForm">
<tr>
<td><label><?php echo msg('path'); ?></label></td>
<td><input type="hidden" name="userId[]" class="txtField" value="<?php echo $row[$i]['adid']; ?>"><input type="text" name="userName[]" class="txtField" value="<?php echo $row[$i]['path']; ?>"></td>
</tr>
<tr>
<td><label><?php echo msg('status'); ?></label></td>
<td><input type="text" name="firstName[]" class="txtField" value="<?php echo $row[$i]['path']; ?>"></td>
</tr>
</tr>
</table>
</td>
</tr>
<?php
}
?>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Submit" class="btnSubmit"></td>
</tr>
</table>
</div>
</form>
/body></html>


edit user


<?php include("french.php"); ?>
<?php

$LANG ='fr';

$connect  =mysql_connect('192.168.1.170', 'user','aipl2014') or die(mysql_error());
mysql_select_db(test,$connect)or die("cannot select DB");

if(isset($_POST["submit"]) && $_POST["submit"]!="") {
$usersCount = count($_POST["userName"]);
for($i=0;$i<$usersCount;$i++) {
mysql_query("UPDATE packageimages set status='" . $_POST["firstName"][$i] . "' WHERE pimageid='" . $_POST["userId"][$i] . "'");
}
header("Location:need_Approval_list.php");
}
?>
<html>
<head>
<title><?php echo msg('Approved Packages'); ?></title>
<link rel="stylesheet" type="text/css" href="styles.css" />
</head>
<body>
<form name="frmUser" method="post" action="">
<div style="width:500px;">
<table border="0" cellpadding="10" cellspacing="0" width="500" align="center">
<tr class="tableheader">
<td><?php echo msg('Approved Packages'); ?></td>
</tr>
<?php
$rowCount = count($_POST["users"]);
for($i=0;$i<$rowCount;$i++) {
$result = mysql_query("SELECT * FROM  ads WHERE adId='" . $_POST["users"][$i] . "'");
$row[$i]= mysql_fetch_array($result);
?>
<tr>
<td>
<table border="0" cellpadding="10" cellspacing="0" width="500" align="center" class="tblSaveForm">
<tr>
<td><label><?php echo msg('path'); ?></label></td>
<td><input type="hidden" name="userId[]" class="txtField" value="<?php echo $row[$i]['adid']; ?>"><input type="text" name="userName[]" class="txtField" value="<?php echo $row[$i]['path']; ?>"></td>
</tr>
<tr>
<td><label><?php echo msg('status'); ?></label></td>
<td><input type="text" name="firstName[]" class="txtField" value="<?php echo $row[$i]['path']; ?>"></td>
</tr>
</tr>
</table>
</td>
</tr>
<?php
}
?>
<tr>
<td colspan="2"><input type="submit" name="submit" value="Submit" class="btnSubmit"></td>
</tr>
</table>
</div>
</form>
</body></html>



Details

<?php include("french.php"); ?>

<?php

$LANG ='fr';

$connect  =mysql_connect('192.168.1.170', 'user','aipl2014') or die(mysql_error());
mysql_select_db(test,$connect)or die("cannot select DB");
?>
<html>
<head>
<title><?php echo msg('List for Approval'); ?></title>
<link rel="stylesheet" type="text/css" href="styles.css" />
<script language="javascript" src="ok.js" type="text/javascript"></script>
</head>
<body>
<form name="frmUser" method="post" action="">
<div style="width:500px;">
<table border="0" cellpadding="10" cellspacing="0" width="500" align="center">
<?php
$name = $_GET['image'];



$result = mysql_query("
select * from ads
");


$row[$i]= mysql_fetch_array($result);

?>
<tr>
<td>
<table border="0" cellpadding="10" cellspacing="0" width="500" align="center" class="tblSaveForm">


<tr >

</td>
</tr>


<tr class="evenRow">
<td colspan=2><?php echo msg('List for Approval'); ?></td>
</tr>

<?php


$day = $_GET['image'];

$numCols = 2;

$result1 = mysql_query("

select * from ads ");

while($row2[$j] = mysql_fetch_assoc($result1))
{



?>





<?php
};

?>

<tr class="tableheader">
<td></td>
<td ><?php echo msg('path'); ?></td>



</tr>

<?php
$i=0;
while($row = mysql_fetch_array($result)) {
if($i%2==0)
$classname="evenRow";
else
$classname="oddRow";
?>
<tr class="<?php if(isset($classname)) echo $classname;?>">
<td><input type="checkbox" name="users[]" value="<?php echo $row["adid"]; ?>" ></td>
<td><?php echo $row["path"]; ?></td>

</tr>
<?php
$i++;
}
?>





</table>
</td>
</tr>
<?php

?>
<tr>
<td colspan="4"><input type="button" name="update" value="Approve" onClick="setUpdateAction();" /> <input type="button" name="delete" value="UnApprove"  onClick="setDeleteAction();" /></td>
</td>
</tr>
</table>
</div>
</form>
</body></html>

french.php


<?php
$messages = array (
    'fr'=> array('List for Approval' =>
           'Liste pour approbation ',
        'Approved Packages' =>
           'Emballages agréés ',
       'UnApproved Packages' =>
           'Packages unapproved ',
       'path' => 'Chemin',
       'status' => 'État'),

    'en_GB'=> array(
        'My favorite foods are' =>
            'My favourite foods are',
        'french fries' => 'chips',
        'biscuit' => 'scone',
        'candy' => 'sweets',
        'potato chips' => 'crisps',
        'cookie' => 'biscuit',
        'corn' => 'maize',
        'eggplant' => 'aubergine'
    )
   
);

function msg($s) {
    global $LANG;
    global $messages;
   
    if (isset($messages[$LANG][$s])) {
        return $messages[$LANG][$s];
    } else {
        error_log("l10n error:LANG:" .
            "$lang,message:'$s'");
    }
}
?>

 ok.js

function setUpdateAction() {
document.frmUser.action = "edit_user.php";
document.frmUser.submit();
}
function setDeleteAction() {
if(confirm("Are you sure want to unnaprove the following images?")) {
document.frmUser.action = "delete_user.php";
document.frmUser.submit();
}
}

No comments:

Post a Comment