Exemplo n.º 1
0
 public function load()
 {
     $jjj = new MysqlJiaguwen();
     $sql = "SELECT * FROM `Jiaguwen`";
     $this->jgw = $jjj->query($sql);
     return $this;
 }
Exemplo n.º 2
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]);
Exemplo n.º 3
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";
 }
Exemplo n.º 4
0
</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) {
        continue;
    }
Exemplo n.º 5
0
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)) {
    sort($r2htm->TmpArr);
Exemplo n.º 6
0
<?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']);
}
echo "</table>\r\n";
echo "<br>total hieros=" . count($r2htm->TmpArr);
echo "<br>";
sort($r2htm->TmpArr);
foreach ($r2htm->TmpArr as $hid) {
    $fname = MysqlUti::src_of($hid);
    //"../../odb/hiero/ccer-h/$bname.gif";
Exemplo n.º 7
0
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();
$no = array();
foreach ($chinesezid as $zid) {
Exemplo n.º 8
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];
 }
 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'];
     }
 }
            $rt = $jid2jroot["{$val}"];
            if (strlen($rt) < 1) {
                $roots .= $val . ",";
            } else {
                $roots .= $rt;
            }
        }
    }
    $rootarr = explode(",", $roots);
    $rootarr2 = array_unique($rootarr);
    asort($rootarr2);
    $rt2 = implode(",", $rootarr2);
    $rt2 = trim($rt2, ",");
    $rt2 .= ",";
    $sql3 = "UPDATE bronze0000shang SET jgroots='{$rt2}' WHERE idx=" . $row['idx'] . ";";
    $ret = $db3up->query($sql3);
    $tr = "<tr><td>" . $row['idx'] . "</td><td>" . $jk . "</td><td>" . $rt2 . " (" . count($rootarr2) . ")<br>{$sql3}<br>{$ret}</td></tr>\n";
    echo $tr;
    //$r2htm->htm_tr_dat_rd($sql2,$row);
}
echo "</table>\r\n";
echo "<br>total hieros=" . count($r2htm->TmpArr);
echo "<br>";
if (isset($r2htm->TmpArr)) {
    sort($r2htm->TmpArr);
    foreach ($r2htm->TmpArr as $hid) {
        $fname = $r2htm->img_src_of($hid, $hid);
        print "<img src='{$fname}' /img>{$hid}";
    }
}
?>
Exemplo n.º 11
0
//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] = "";
    }
Exemplo n.º 12
0
 public function delete_img($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 = "SELECT * FROM {$tabname} WHERE {$primary_key}='{$primary_val}'";
     syslog(0, "mysql=" . $mysql);
     $ret = $jgw->query($mysql);
     print_r($ret);
     $append_orig = "";
     foreach ($ret as $row) {
         $append_orig = $row[$append_key];
         break;
     }
     syslog(0, "append_orig  =" . $append_orig);
     ////////////////
     $append_newval = preg_replace("/{$append_val}\\,/", "", "{$append_orig}");
     //
     syslog(0, "append_newval=" . $append_newval);
     if (substr($append_newval, 0, 1) == ",") {
         $append_newval = substr($append_newval, 1);
     }
     //////////
     $mysql = "UPDATE   {$tabname} SET  {$append_key}='{$append_newval}' WHERE {$primary_key}='{$primary_val}'";
     syslog(0, "mysql=" . $mysql);
     $jgw->execute($mysql);
 }