Ejemplo n.º 1
0
 public function load()
 {
     $jjj = new MysqlJiaguwen();
     $sql = "SELECT * FROM `Jiaguwen`";
     $this->jgw = $jjj->query($sql);
     return $this;
 }
Ejemplo n.º 2
0
 public function GenXmlDataForTree()
 {
     $againstDir = "../uti/jgw/mer/compound/p/";
     $againstDir = "../../odb/tbi/img/jgif/";
     if (!file_exists($againstDir)) {
         echo "<font color='red'>no file exist:</font>";
     }
     $sql = "SELECT * FROM Jiaguwen ORDER BY jid";
     $sql = "SELECT * FROM Jiaguwen";
     $sql = "SELECT * FROM Jiaguwen WHERE jtoh LIKE '%,%' LIMIT 0,10";
     $sql = "SELECT jnm, jid FROM Jiaguwen  WHERE jnm<>'0' AND jnm <>'-' AND jnm<>'' ORDER BY jnm  LIMIT 0,10000";
     if (isset($_REQUEST["sql"]) && strlen($_REQUEST["sql"]) > 0) {
         $sql = $_REQUEST["sql"];
     } else {
         $_REQUEST["sql"] = "";
     }
     if (preg_match("/Hieroglyphics/i", $sql) == 1) {
         //$db = new MysqlHieroglyphics();
     }
     $db = new MysqlJiaguwen();
     $ret = $db->query($sql);
     $this->info = "count=" . count($ret) . ", " . $sql . "<br>";
     $attrName = "jnm";
     $newsXML = new SimpleXMLElement("<li>0</li>");
     $newsXML->addAttribute('id', "treview");
     self::AddChildNode($newsXML, $attrName, "1", null, "");
     self::AddChildNode($newsXML, $attrName, "2", null, "");
     self::AddChildNode($newsXML, $attrName, "3", null, "");
     self::AddChildNode($newsXML, $attrName, "4", null, "");
     self::AddChildNode($newsXML, $attrName, "5", null, "-");
     self::AddChildNode($newsXML, $attrName, "6", null, "-");
     //////////////////////////////////////
     //add list table
     //$newTable = $newsXML->addChild('table');
     foreach ($ret as $row) {
         $jnm = $row['jnm'];
         $jid = $row['jid'];
         if (!isset($jnm) || !isset($jid)) {
         }
         $imgSrc = $againstDir . $jid . ".gif";
         $arrJnm = explode(".", $jnm);
         $count = count($arrJnm);
         $arrId = array();
         $arrId[] = "{$jnm}";
         for ($i = $count - 1; $i >= 0; $i -= 1) {
             unset($arrJnm[$i]);
             $arrId[] = implode(".", $arrJnm);
         }
         $FindNode = null;
         $FindJNM = "{$jnm}";
         foreach ($arrId as $idx => $ID) {
             $result = $newsXML->xpath("//*[@" . $attrName . "='" . $ID . "']");
             //get all nod with attr is valold.
             while (list(, $node) = each($result)) {
                 //$node[$attrName]=$attrValNew;
                 $FindNode = $node;
                 $FindJNM = $ID;
             }
             if ($FindNode) {
                 break;
             }
         }
         if ($FindNode != null) {
             if ($FindJNM != $jnm) {
                 $lis = $FindNode->xpath("..");
                 $li = null;
                 while (list(, $node) = each($lis)) {
                     //$node[$attrName]=$attrValNew;
                     $li = $node;
                     break;
                 }
                 if ($li != null) {
                     $uls = $li->xpath("./ul");
                     $ul = null;
                     while (list(, $node) = each($uls)) {
                         //$node[$attrName]=$attrValNew;
                         $ul = $node;
                         break;
                     }
                     $FindNode = self::AddChildNode($li, $attrName, $jnm, $ul, null);
                 } else {
                 }
             }
         } else {
             if (null === $FindNode) {
                 $FindNode = self::AddChildNode($newsXML, $attrName, $jnm, $FindNode, null, null);
             }
         }
         $img = $FindNode->addChild('img');
         $img->addAttribute("src", $imgSrc);
         $img->addAttribute("class", "ooimg");
         //class="ooimg"
         $img->addAttribute("title", "{$jnm}::{$jid}");
         //class="ooimg"
     }
     $xstr = $newsXML->asXML();
     echo "\n\n" . $xstr . "\n\n";
 }
Ejemplo n.º 3
0
$(document).ready(function(){     
});//$(document).ready(function(){                                            
</script>
 


<body>



<?php 
require_once "../uti/Ureaddir.php";
require_once "../uti/MysqlJiaguwen.php";
$againstDir = "../uti/jgw/mer/compound/p/";
$againstDir = "../../odb/tbi/img/jgif/";
$jdb = new MysqlJiaguwen();
$sql = "Select zid1, jid from Jiaguwen";
$rows = $jdb->query($sql);
$arr = array();
foreach ($rows as $row) {
    $zid1 = $row["zid1"];
    $jid = $row["jid"];
    if (!isset($arr[$zid1])) {
        $arr[$zid1] = array();
    }
    $arr[$zid1][] = $jid;
}
echo "var ZJ=new Array(); //zid1 to jid associated list. Tot=" . count($arr) . "<br><br>";
$idx = 0;
foreach ($arr as $zid1 => $ar) {
    if ($zid1 == 0) {
Ejemplo n.º 4
0
<?php 
require_once "../uti/Ureaddir.php";
require_once "../uti/MysqlHieroglyphics.php";
require_once "../uti/MysqlJiaguwen.php";
require_once "../uti/DbRow2Htm.php";
$againstDir = "../uti/jgw/mer/compound/p/";
$againstDir = "../../odb/tbi/img/jgif/";
if (!file_exists($againstDir)) {
    echo "<font color='red'>no file exist:</font>";
}
echo "<br><br>";
//echo "<a>$sql <br><br><br>";
if (preg_match("/Hieroglyphics/i", $sql) == 1) {
    //$db = new MysqlHieroglyphics();
}
$db = new MysqlJiaguwen();
$ret = $db->query($sql);
echo "count=" . count($ret) . ", " . $sql . "<br>";
$r2htm = new DbRow2Htm();
echo "<table border='1'>\r\n";
$r2htm->htm_tr_title($ret[0]);
foreach ($ret as $row) {
    $r2htm->htm_tr_dat_rd($sql, $row);
    if (isset($row['jtoh'])) {
        $r2htm->push2TmpArr($row['jtoh']);
    }
}
echo "</table>\r\n";
echo "<br>total hieros=" . count($r2htm->TmpArr);
echo "<br>";
if (isset($r2htm->TmpArr)) {
Ejemplo n.º 5
0
<option>SELECT * FROM Jiaguwen WHERE  xa='x'</option>
<option>SELECT * FROM Jiaguwen WHERE jink='' AND L!='1' AND L!='5' AND xa!='x' </option>
<option>SELECT * FROM Jiaguwen WHERE L IS NOT NULL ORDER BY L</option>
<option>SELECT jid,zid, freq  FROM Jiaguwen GROUP BY zid ORDER BY freq</option>
</select>
<button type="submit">OK</button>
</form>

<?php 
require_once "../uti/Ureaddir.php";
require_once "../uti/MysqlJiaguwen.php";
require_once "../uti/DbRow2Htm.php";
$againstDir = "../uti/jgw/mer/compound/p/";
$againstDir = "../../odb/tbi/img/jgif/";
//$ut = new MysqlUti();
$jia = new MysqlJiaguwen();
$sql = "SELECT * FROM Jiaguwen ORDER BY jid";
$sql = "SELECT * FROM Jiaguwen";
$sql = "SELECT * FROM Jiaguwen WHERE jtoh LIKE '%,%' LIMIT 0,10";
if (isset($_REQUEST["sql"]) && strlen($_REQUEST["sql"]) > 0) {
    $sql = $_REQUEST["sql"];
}
//echo $sql . "";
$ret = $jia->query($sql);
echo "count=" . count($ret) . ",sql={$sql}";
$r2htm = new DbRow2Htm();
echo "<table border='1'>\r\n";
$r2htm->htm_tr_title($ret[0]);
foreach ($ret as $row) {
    $r2htm->htm_tr_dat_rd($row);
    $r2htm->push2TmpArr($row['jtoh']);
Ejemplo n.º 6
0
$ccs->run();
//$ccs->display();
print $ccs->get_view_content($BOOKDIR);
//reload if already exist to save time.
print "<br>Uniq Chinese from book:<br>";
$chinesezid = array();
foreach ($ccs->WordFreqArr as $key => $arr) {
    $chinesezid[] = substr($key, 2, 5);
}
sort($chinesezid);
print "<br>Tot simplified words in book=" . count($chinesezid);
foreach ($chinesezid as $zid) {
    //print "&#".$zid. ";" . $zid;
}
print "<br>Available simplified Chinese from Jiaguwen zid1:<br>";
$jdb = new MysqlJiaguwen();
$sql = "SELECT zid1 FROM Jiaguwen GROUP BY zid1";
$ret = $jdb->query($sql);
$jcarr = array();
foreach ($ret as $row) {
    //echo "&#".$row[0] . ";" .$row[0];
    $jcarr[] = $row[0];
}
sort($jcarr);
print "<br>Tot Jgw=" . count($jcarr);
print "<br>";
foreach ($jcarr as $zid) {
    print "&#" . $zid . ";" . $zid;
}
//find chinese not in jiaguwen
$in = array();
Ejemplo n.º 7
0
<?php

@session_start();
require_once "../MysqlJiaguwen.php";
if (!isset($_REQUEST["pars"])) {
    echo "die:";
    die("no pars");
}
$pars = $_REQUEST["pars"];
//////////////////////////////////////////////
print_r($_REQUEST);
$jgw = new MysqlJiaguwen();
$jgw->delete_img($pars);
Ejemplo n.º 8
0
<?php

@session_start();
require_once "../MysqlJiaguwen.php";
if (!isset($_REQUEST["pars"])) {
    echo "die:";
    die("no pars");
}
$pars = $_REQUEST["pars"];
//////////////////////////////////////////////
print_r($_REQUEST);
$jgw = new MysqlJiaguwen();
$jgw->append_img($pars);
Ejemplo n.º 9
0
 public function gen_RootsDangled()
 {
     $jia = new MysqlJiaguwen();
     $sql = "SELECT * FROM Jiaguwen";
     $ret = $jia->query($sql);
     foreach ($ret as $row) {
         $lnk = $row['jink'];
         $lnk = trim($lnk);
         if (strlen($lnk) >= 5) {
             continue;
         }
         if (strlen($lnk) > 0) {
             die("error jink data={$lnk}");
         }
         $jid = $row['jid'];
         if (isset($this->RootsFreq[$jid])) {
             continue;
         }
         $this->RootsDangledFreq[$jid] = $row['freq'];
     }
 }
Ejemplo n.º 10
0
 private function loadDB()
 {
     $jjj = new MysqlJiaguwen();
     $this->jgw = $jjj->getAssocList(1);
     return $this;
 }
Ejemplo n.º 11
0
<select size="3"><option>Add</option><option>Delete</option></select>
<select size="3"><option>var</option>a<option>fixed</option></select>
WHERE <font color="blue">jid</font>=
<a>?????</a>
<br>
<button type="submit">OK</button>
</form>
</div>


<div class="cfg">
<form action="" method="GET">
UPDATE <font color="blue">Jiaguwen</font> SET
<select size='13'>
<?php 
$d = new MysqlJiaguwen();
$arr = $d->get_colnames();
foreach ($arr as $colname) {
    print "<option>{$colname}</option>";
}
?>
</select>
=
<select size="3"><option>Add</option><option>Delete</option></select>
<select size="3"><option>var</option><option>fixed</option></select>
WHERE <font color="blue">jid</font>=
<select size="3"><option>var</option><option>fixed</option></select>
<br>
<button type="submit">OK</button>
</form>
</div>
$ret = $db->query($sql);
echo "count=" . count($ret) . ", " . $sql . "<br>\n";
$jid2jroot = [];
echo "<table border='1'>";
foreach ($ret as $row) {
    $jid = $row['jid'];
    $jid2jroot["{$jid}"] = $row['jink'];
    $tr = "<tr><td>" . $jid . "</td><td>" . $jid2jroot["{$jid}"] . "</td><td>" . "-" . "</td></tr>\n";
    echo $tr;
}
echo "</table>";
$db2 = new MysqlJiaguwen();
$sql2 = "SELECT idx, jink, jgroots FROM bronze0000shang";
$ret2 = $db2->query($sql2);
echo "count2=" . count($ret2) . ", " . $sql2 . "<br>\n";
$db3up = new MysqlJiaguwen();
$r2htm = new DbRow2Htm();
echo "<table border='1'>\r\n";
$r2htm->htm_tr_title($ret2[0]);
foreach ($ret2 as $row) {
    $jinkarr = explode(",", $row['jink']);
    $c = count($jinkarr);
    $jk = $row['jink'] . $c;
    $roots = "";
    foreach ($jinkarr as $i => $val) {
        if (strlen($val) > 0) {
            $rt = $jid2jroot["{$val}"];
            if (strlen($rt) < 1) {
                $roots .= $val . ",";
            } else {
                $roots .= $rt;
Ejemplo n.º 13
0
$sc = $_REQUEST["sc"];
//selected col name
$db = $_REQUEST["db"];
//database name
$ff = $_REQUEST["ff"];
$vi = $_REQUEST["vi"];
$fi = $_REQUEST["fi"];
$uval = $_REQUEST["setid"];
$keyId = $_REQUEST["where"];
$sql = "";
if ("Jiaguwen" == $db) {
    $sql = "SELECT * FROM Jiaguwen WHERE jid='{$keyId}'";
    //0:idx,1:hid,2:zid,3:freq
    syslog(0, "sql=" . $sql);
    //die("err test");
    $odb = new MysqlJiaguwen();
    $ret = $odb->query($sql);
    if (count($ret) != 1) {
        die("err query:" . $sql);
    }
    $row = $ret[0];
    $dbstr = "row | ";
    foreach ($row as $key => $val) {
        if (is_numeric($key)) {
            continue;
        }
        $dbstr .= $key . "=" . $val . " | ";
    }
    syslog(0, $dbstr);
    if (!isset($row[$sc])) {
        $row[$sc] = "";
Ejemplo n.º 14
0
 public function udpate_item($params)
 {
     //////////////////////////////////////////////
     print_r($_REQUEST);
     syslog(0, "params=" . $params);
     echo "\n";
     $tok = explode(",", $params);
     //tabname, primarykey, primaryval, appendkey
     $tabname = $tok[0];
     $primary_key = $tok[1];
     $primary_val = $tok[2];
     $append_key = $tok[3];
     $append_val = $tok[4];
     syslog(0, "tabname=" . tabname);
     syslog(0, "primary_key=" . $primary_key);
     syslog(0, "primary_val=" . $primary_val);
     syslog(0, "append_key=" . $append_key);
     syslog(0, "append_val=" . $append_val);
     /////////////////////////////////////
     $jgw = new MysqlJiaguwen();
     /////////////////
     $mysql = "UPDATE {$tabname} SET {$append_key}='{$append_val}' WHERE {$primary_key}='{$primary_val}'";
     syslog(0, "mysql=" . $mysql);
     $ret = $jgw->execute($mysql);
     echo "\n{$ret} : {$mysql}";
 }
Ejemplo n.º 15
0
if (!isset($_REQUEST["keyval"])) {
    die("err: no keyval");
}
//$db=$_REQUEST["db"];
$keyval = $_REQUEST["keyval"];
$db = "Hieroglyphics";
if (strlen($keyval) == 5 && is_numeric($keyval)) {
    $db = "Jiaguwen";
}
$row = array();
$sql = "";
if ("Jiaguwen" == $db) {
    $sql = "SELECT * FROM Jiaguwen WHERE jid='{$keyval}'";
    syslog(0, "in sql=" . $sql);
    //die("err test");
    $odb = new MysqlJiaguwen();
    $ret = $odb->query($sql);
    if (count($ret) != 1) {
        die("err query:" . $sql);
    }
    $row = $ret[0];
} else {
    if ("Hieroglyphics" == $db) {
        $sql = "SELECT * FROM Hieroglyphics WHERE hid='{$keyval}'";
        //0:idx,1:hid,2:zid,3:freq
        syslog(0, "q sql=" . $sql);
        $jia = new MysqlHieroglyphics();
        $ret = $jia->query($sql);
        if (count($ret) != 1) {
            die("err query:" . $sql);
        }
Ejemplo n.º 16
0
<?php

require_once "../MysqlJiaguwen.php";
//print_r($_REQUEST);
$jid = $_REQUEST["jid"];
$jgw = new MysqlJiaguwen();
$sql = "SELECT * FROM `Jiaguwen` WHERE jid={$jid}";
//0:idx,1:jid,2:zid,3:freq
$ret = $jgw->query($sql);
//print_r( $result );
printf("%s,  &#%s;%s, (id=%d, frq=%d)", $ret[0][1], $ret[0][2], $ret[0][2], $ret[0][0], $ret[0][3]);
<?php

require_once "../MysqlJiaguwen.php";
//mysql_query("UPDATE Persons SET Age = '36'
//WHERE FirstName = 'Peter' AND LastName = 'Griffin'");
//"UPDATE animals SET animal_name='bruce' WHERE animal_name='troy'"
//print_r($_REQUEST);
function errdie($msg)
{
    die("err : {$msg}");
}
if (!isset($_REQUEST["jid"])) {
    die("err : no jid");
}
$jid = $_REQUEST["jid"];
if (!isset($_REQUEST["jtoh"])) {
    die("err : no jtoh");
}
$jtoh = $_REQUEST["jtoh"];
$linkjidcodes = uti_db::merge_str_links($jtoh, "");
$jgw = new MysqlJiaguwen();
$sql = "UPDATE Jiaguwen SET jtoh='{$linkjidcodes}' WHERE jid='{$jid}'";
//0:idx,1:jid,2:zid,3:freq
$ret = $jgw->execute($sql);
if (0 == $ret) {
    print "err ";
}
//print_r( $result );
printf("update ret=%d;  jid=%s; hinks=%s", $ret, $jid, $linkjidcodes);
print_r($_REQUEST);
Ejemplo n.º 18
0
 public function echo_count_of_layer5()
 {
     $sql = "SELECT COUNT(*) FROM Jiaguwen WHERE L='5'";
     $db = new MysqlJiaguwen();
     $ret = $db->query($sql);
     print $ret[0][0];
 }
Ejemplo n.º 19
0
<?php

@session_start();
require_once "../MysqlJiaguwen.php";
if (!isset($_REQUEST["pars"])) {
    echo "die:";
    die("no pars");
}
$pars = $_REQUEST["pars"];
//////////////////////////////////////////////
print_r($_REQUEST);
$jgw = new MysqlJiaguwen();
$jgw->udpate_item($pars);
Ejemplo n.º 20
0
$T2S[33900] = "33900";
// ? 33900 ~~ ? 33900
$T2S[33331] = "33331";
// ? 33331 ~~ ? 33331
$T2S[36646] = "36743";
// ? 36646 ~~ ? 36743
$T2S[28668] = "27898";
// ? 28668 ~~ ? 27898
$T2S[27359] = "26638";
// ? 27359 ~~ ? 26638
$T2S[21533] = "21533";
// ? 21533 ~~ ? 21533
$T2S[29742] = "29742";
// ? 29742 ~~ ? 29742
require_once "../../uti/MysqlJiaguwen.php";
$jia = new MysqlJiaguwen();
$sql = " SELECT zid FROM Jiaguwen ";
$ret = $jia->query($sql);
foreach ($ret as $row) {
    $zid = $row[0];
    $zid1 = 0;
    if (isset($T2S[$zid])) {
        $zid1 = $T2S[$zid];
    }
    echo $zid . "=" . $zid1 . "<br>";
    $sql = "UPDATE Jiaguwen SET zid1={$zid1} WHERE zid={$zid}";
    $jia->execute($sql);
}
?>
</body>
</html>