Added templates
[bibliodb.git] / CiteProc2.php
blob9db7b2a30643dd1df0dc7f8936784f90b3af6f4e
1 <pre>
2 <?php
3 require_once("profiller.php");
4 Profiller::speed("Začínáme");
5 require_once("CiteConfig.php");
6 require_once("CiteOutput.php");
7 require_once("CiteData.php");
8 require_once("CiteFields.php");
9 require_once('Text/LanguageDetect.php');
10 require_once("database.php");
11 require_once("model/Models.php");
12 Profiller::speed("Načtení vkládaných souborů");
13 //echo CiteConfig::getValue("pokus");
14 CiteConfig::setValue("output_filter","html");
15 //echo CiteConfig::getValue("output");
16 //CiteOutput::factory()->template("@font-style/italic","Italickej")->template("@font-weight/bold","tlustej")->lineBreak()->out();
17 //CiteOutput::factory("Nazdar ")->lineBreak()->bold("světe")->textFunction("lowercase","Velká Písmenka")->text("normálka")->out();
18 //CiteOutput::factory()->lineBreak()->startBlock("citation")->text("Nazdar")->bold("světe")->closeBlock("citation")->out();
20 CiteConfig::setValue("output_filter","latex");
21 //CiteOutput::factory()->lineBreak()->startBlock("citation")->text("Nazdar")->bold("světe")->closeBlock("citation")->out();
23 /*CiteFields::field("base")->variable("title")->fontStyle("italic")->fontWeight("bold")->textCase("title");
24 CiteFields::field("base")->variable("publisher");
25 CiteFields::field("base")->variable("date");
27 CSL::style("iso-690")
28 ->citation()
29 ->end()
30 ->field("base")
31 ->variable("title")
32 ->fontStyle("italic")
33 ->fontWeight("bold")
34 ->textCase("title")
35 ->end()
36 ->field("base")
37 ->variable("publisher")
38 ->end()
39 ->field("base")
40 ->variable("date")
41 ->end();
42 Profiller::speed("Styl");
43 $data= array(
44 array(
45 "author"=>array(
46 array("given"=>"Jan","family"=>"Krka"),
47 array("given"=>"Martin","family"=>"Blažek"),
48 array("given"=>"Pepa","family"=>"Nosek"),
49 array("given"=>"Jirka","family"=>"Cicek"),
50 array("given"=>"Martin","family"=>"Blažek")),
51 "title"=>"Titulek knihy",
52 "date"=>"2009",
53 "publisher"=>"Academia"
55 array(
56 "author"=>array(
57 array("given"=>"Jan","family"=>"Krka"),
58 array("given"=>"Martin","family"=>"Blažek"),
59 array("given"=>"Pepa","family"=>"Nosek"),
60 array("given"=>"Jirka","family"=>"Cicek"),
61 array("given"=>"Martin","family"=>"Blažek")),
62 "title"=>"Tohle je úplně jiná knihA",
63 "date"=>"2009",
64 "publisher"=>"od úplně jinýho s nebez<pečím> nakladatelství"
67 CiteData::loadData($data);
68 Profiller::speed("Nahrání datového pole do CiteData");
69 CSL::printBibliography();
70 Profiller::speed("Tisk bibliografie");
72 $l = new Text_LanguageDetect();
73 Profiller::speed("Nahrání třídy LanguageDetect");
74 $res=$l->detect("Takže to češtinou nemá zas tak hrozný problémy Zdá se, že ne. A co řikáš, ty?");
75 Profiller::speed("Zjištění jazyka");
76 $l->detect("A další jazyk");
77 Profiller::speed("Zjištění dalšího jazyka");
78 //print_r($res);
79 DatabaseConnector::database("krokobib")
80 ->user("root")
81 ->password("root")
82 ->connect();
83 Profiller::speed("Připojení k databázi");
84 DatabaseConnector::query("publikace")
85 ->table("publication")
86 ->column("publication_type")
87 ->foreign("publication_type","publication_types")
88 ->primary("publication_id")
89 ->table("publication_types")
90 ->column("type")
91 ->primary("publication_type_id")
92 //->link("publication","author")
93 ->link("publication_types","publication")
94 ->where("publication_id=1")
95 ->end()
96 ->query("author")
97 ->table("publication")
98 ->column("publication_type")
99 ->foreign("publication_type","publication_types")
100 ->primary("publication_id")
101 ->table("name")
102 ->column("family")
103 ->column("given")
104 ->primary("name_id")
105 ->table("author_role")
106 ->column("role")
107 ->primary("id")
108 ->table("author")
109 ->primary("author_id")
110 ->foreign("author_name","name")
111 ->foreign("publication","publication")
112 ->foreign("author_role","author_role")
113 ->link("name","author")
114 ->link("publication","author")
115 ->link("author_role","author")
116 ->where("publication_id=5")
117 ->end()
118 ->run();
119 Profiller::speed("Databázový dotaz");
120 echo CiteView::get();
121 Profiller::show();
122 //CiteOutput::factory()->noSpaces()->template("@font-style/italic","Italickej")->template("@font-weight/bold","tlustej")->template("@bibliography/entry")->template("bibstart")->template("bibend")->out();
125 /*SELECT t3.publication_type, t1.family, t1.given, t4.role
126 FROM publication AS t3
127 INNER JOIN author AS t2 ON t3.publication_id = t2.publication
128 INNER JOIN name AS t1 ON t1.name_id = t2.author_name
129 INNER JOIN author_role AS t4 ON t4.id = t2.author_role*/