本文整理汇总了PHP中xpath_new_context函数的典型用法代码示例。如果您正苦于以下问题:PHP xpath_new_context函数的具体用法?PHP xpath_new_context怎么用?PHP xpath_new_context使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了xpath_new_context函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getCategories
function getCategories($root)
{
$xpath = xpath_new_context($root);
$listNode = xpath_eval($xpath, "UL");
if (sizeof($listNode->nodeset) == 0) {
$xpath = xpath_new_context($root);
$nodes = xpath_eval($xpath, "LI");
} else {
$xpath = xpath_new_context($listNode->nodeset[0]);
$nodes = xpath_eval($xpath, "LI");
}
return $nodes->nodeset;
}
开发者ID:rivetweb,项目名称:old-hta-virtual-catalog,代码行数:13,代码来源:_optimize.php
示例2: exportRekursiv
/**
* export lm_data-table to xml-structure
*
* @param integer obj_id
* @param integer depth
* @param integer left left border of nested-set-structure
* @param integer right right border of nested-set-structure
* @access public
* @return string xml
*/
function exportRekursiv($obj_id, $depth, $left, $right)
{
global $ilDB;
// Jetzt alle lm_data anhand der obj_id auslesen.
$query = "SELECT *\n FROM lm_tree, lm_data\n WHERE lm_tree.lm_id = " . $ilDB->quote($obj_id, "integer") . " \n AND lm_tree.child = lm_data.obj_id \n AND ( lm_data.type = 'st' OR lm_data.type = 'pg' )\n AND lm_tree.depth = " . $ilDB->quote($depth, "integer") . "\n AND lm_tree.lft > " . $ilDB->quote($left, "integer") . " and lm_tree.rgt < " . $ilDB->quote($right, "integer") . "\n ORDER BY lm_tree.lft";
$result = $ilDB->query($query);
while (is_array($row = $ilDB->fetchAssoc($result))) {
if ($row["type"] == "st") {
$xml .= "<StructureObject>";
$nested = new ilNestedSetXML();
$xml .= $nested->export($row["obj_id"], "st");
$xml .= "\n";
$xml .= $this->exportRekursiv($obj_id, $depth + 1, $row["lft"], $row["rgt"]);
$xml .= "</StructureObject>";
}
if ($row["type"] == "pg") {
$query = "SELECT * FROM page_object WHERE page_id= " . $ilDB->quote($row["obj_id"], "integer");
$result2 = $this->ilias->db->query($query);
$row2 = $result2->fetchRow(DB_FETCHMODE_ASSOC);
$PO = $row2["content"] . "\n";
if (stristr($PO, "MediaObject")) {
$dom = domxml_open_mem($PO);
$xpc = xpath_new_context($dom);
$path = "//MediaObject/MediaAlias";
$res =& xpath_eval($xpc, $path);
for ($i = 0; $i < count($res->nodeset); $i++) {
$id_arr = explode("_", $res->nodeset[$i]->get_attribute("OriginId"));
$mob_id = $id_arr[count($id_arr) - 1];
$this->mob_ids[$mob_id] = true;
}
}
$nested = new ilNestedSetXML();
$mdxml = $nested->export($row["obj_id"], "pg");
$PO = str_replace("<PageObject>", "<PageObject>\n{$mdxml}\n", $PO);
$xml .= $PO;
}
}
return $xml;
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:49,代码来源:class.ilObjDlBook.php
示例3: importHtml
function importHtml($lng, $htmlTable)
{
$dummy = ilUtil::stripSlashes($htmlTable, false);
//echo htmlentities($dummy);
$dom = @domxml_open_mem($dummy, DOMXML_LOAD_PARSING, $error);
if ($dom) {
$xpc = @xpath_new_context($dom);
// extract first table object
$path = "//table[1] | //Table[1]";
$res = @xpath_eval($xpc, $path);
if (count($res->nodeset) == 0) {
$error = "Could not find a table root node";
}
if (empty($error)) {
for ($i = 0; $i < count($res->nodeset); $i++) {
$node = $res->nodeset[$i];
$this->importTableAttributes($node);
if ($node->has_child_nodes()) {
foreach ($node->child_nodes() as $n) {
if ($n->node_type() == XML_ELEMENT_NODE && strcasecmp($n->node_name(), "tr") == 0) {
$this->importRow($lng, $n);
}
}
}
}
}
$dom->free();
}
if (is_array($error)) {
$errmsg = "";
foreach ($error as $errorline) {
# Loop through all errors
$errmsg .= "[" . $errorline['line'] . ", " . $errorline['col'] . "]: " . $errorline['errormessage'] . " at Node '" . $errorline['nodename'] . "'<br />";
}
} else {
$errmsg = $error;
}
if (empty($errmsg)) {
return true;
}
$_SESSION["message"] = $errmsg;
return false;
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:43,代码来源:class.ilPCTable.php
示例4: xpath_new_context
function xpath_new_context()
{
return xpath_new_context($this);
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:4,代码来源:inc.xml5compliance.php
示例5: wms_layer4html
function wms_layer4html($layer)
{
$estilos = wms_estilos($layer);
if (count($estilos) > 0) {
$ctxl = xpath_new_context($layer);
$xp_namel = xpath_eval($ctxl, "/Name");
if (wms_xpnode2content($xp_namel) == "") {
$xp_namel = xpath_eval($ctxl, "/name");
}
$txt_namel = wms_xpnode2content($xp_namel);
$html .= wms_layer3html($layer);
foreach ($estilos as $estilo) {
$html .= wms_layer2html($estilo, "estilo", $txt_namel);
}
} else {
$html .= wms_layer2html($layer, "tema", "");
}
return $html;
}
开发者ID:edmarmoretti,项目名称:i3geo,代码行数:19,代码来源:wms_functions.php
示例6: getElevation
function getElevation($lat, $lng, $source)
{
$msg = "";
switch ($source) {
case "gmaps":
$url = "http://maps.google.com/maps/api/elevation/xml?locations=" . $lat . "," . $lng . "&sensor=false";
if (!($dom = @domxml_open_file($url))) {
die("Error opening xml file");
}
$xpath = @xpath_new_context($dom);
if ($_lat = @xpath_eval_expression($xpath, '//location/lat/text()')) {
$_lat = $_lat->nodeset[0]->node_value();
}
if ($_lng = @xpath_eval_expression($xpath, '//location/lng/text()')) {
$_lng = $_lng->nodeset[0]->node_value();
}
if ($alt = @xpath_eval_expression($xpath, '//elevation/text()')) {
$alt = $alt->nodeset[0]->node_value();
$msg = "";
} else {
if ($msg = @xpath_eval_expression($xpath, '//status/text()')) {
$msg = $msg->nodeset[0]->node_value();
}
}
$ds = '';
break;
case "usgs":
$url = "http://gisdata.usgs.gov/xmlwebservices2/elevation_service.asmx/getElevation?X_Value=" . $lng . "&Y_Value=" . $lat . "&Elevation_Units=METERS&Source_Layer=-1&Elevation_Only=-1";
//$dom = @domxml_open_file($url);
if (!($dom = @domxml_open_file($url))) {
die("Error opening xml file");
}
$xpath = @xpath_new_context($dom);
if ($_lat = @xpath_eval_expression($xpath, '//Y_Value/text()')) {
$_lat = $_lat->nodeset[0]->node_value();
}
if ($_lng = @xpath_eval_expression($xpath, '//X_Value/text()')) {
$_lng = $_lng->nodeset[0]->node_value();
}
//if ($alt = @xpath_eval_expression($xpath, '//Elevation/text()')) {
if ($alt = @xpath_eval_expression($xpath, '//Elevation_Only/text()')) {
$alt = $alt->nodeset[0]->node_value();
$msg = "";
} else {
if ($msg = @xpath_eval_expression($xpath, '//Elevation_Query/text()')) {
$msg = $msg->nodeset[0]->node_value();
}
}
//if ($ds = @xpath_eval($xpath, '//Data_Source/text()')) {
if ($ds = @xpath_eval_expression($xpath, '//Source_Layer/text()')) {
$ds = $ds->nodeset[0]->node_value();
}
break;
case "geonames":
$url = "http://ws.geonames.org/srtm3?lat=" . $lat . "&lng=" . $lng . "&style=full&type=XML";
//$dom = @domxml_open_file($url);
if (!($dom = @domxml_open_file($url))) {
die("Error opening xml file");
}
$xpath = @xpath_new_context($dom);
if ($_lat = @xpath_eval_expression($xpath, '//lat/text()')) {
$_lat = $_lat->nodeset[0]->node_value();
}
if ($_lng = @xpath_eval_expression($xpath, '//lng/text()')) {
$_lng = $_lng->nodeset[0]->node_value();
}
if ($alt = @xpath_eval_expression($xpath, '//srtm3/text()')) {
$alt = $alt->nodeset[0]->node_value();
$alt = $alt == '-32768' ? 0 : $alt;
$msg = "";
}
/* else {
if ($msg = @xpath_eval_expression($xpath, '//Elevation_Query/text()')) {
$msg = $msg->nodeset[0]->node_value();
}
}*/
$ds = 'SRTM3';
break;
default:
exit;
}
return array("lat" => $_lat, "lng" => $_lng, "alt" => $alt, "src" => $ds, "msg" => $msg, "url" => $url);
}
开发者ID:GrottoCenter,项目名称:GrottoCenter,代码行数:83,代码来源:altitude.php
示例7: generatePreview
private function generatePreview()
{
$xml = $this->getXMLContent();
$dom = @domxml_open_mem($xml, DOMXML_LOAD_PARSING, $error);
$xpc = xpath_new_context($dom);
$path = "////PlaceHolder";
$res =& xpath_eval($xpc, $path);
foreach ($res->nodeset as $item) {
$height = $item->get_attribute("Height");
$height = eregi_replace("px", "", $height);
$height = $height / 10;
$item->set_attribute("Height", $height . "px");
}
$xsl = file_get_contents($this->getXSLPath());
$xml = $dom->dump_mem(0, "UTF-8");
$args = array('/_xml' => $xml, '/_xsl' => $xsl);
$xh = xslt_create();
$output = xslt_process($xh, "arg:/_xml", "arg:/_xsl", NULL, $args, NULL);
xslt_error($xh);
xslt_free($xh);
return $output;
}
开发者ID:khanhnnvn,项目名称:ilias_E-learning,代码行数:22,代码来源:class.ilPageLayout.php
示例8: _makeXSLTInclude
function _makeXSLTInclude(&$main_xsl)
{
$xpath = xpath_new_context($main_xsl);
$res = xpath_eval($xpath, "//include");
$num = sizeof($res->nodeset);
$needReCall = false;
for ($i = 0; $i < $num; $i++) {
$type = $res->nodeset[$i]->get_attribute("type");
if ($type != 'subtemplate') {
/*
$dom = new DomDocument("1.0");
$node = $dom->createElement("xsl:call-template", "");
/*
= new DomElement( "xsl:call-template", "",
"http://www.w3.org/1999/XSL/Transform");
// $dom->appendChild($node);
$node->setAttribute( "name", "InsertBlock" );
$param = $dom->createElement("xsl:with-param");
$node->appendChild($param);
*/
// ñîçäàåì ýëåìåíò
// $dom = domxml_new_doc("1.0");
$dom = $this->_xslt;
$node = $this->_xslt->create_element("xsl:call-template", "");
$node->set_attribute("name", "InsertBlock");
//
// $param = $dom->createElement("xsl:with-param", "");
// $param = $node->appendChild($param);
$param = $node->new_child("xsl:with-param");
if (empty($type) || $type == 'default') {
$param->set_content($res->nodeset[$i]->get_attribute("object"));
} else {
if ($type == 'condition') {
$childs = $res->nodeset[$i]->child_nodes();
//print_r( $childs );
if (is_array($childs)) {
$cnum = sizeof($childs);
for ($j = 0; $j < $cnum; $j++) {
$clone = $childs[$j]->clone_node(true);
//$clone->set_namespace( $childs[$j]prefix();
$param->append_child($clone);
}
//foreach ( $childs as $child ) {
//}
}
}
}
$param->set_attribute("name", "id");
$res->nodeset[$i]->replace_node($node);
} else {
$name = $res->nodeset[$i]->get_attribute("name");
if (isset($this->_templates['sub']) && array_key_exists($name, $this->_templates['sub'])) {
$nodes = $this->_templates['sub'][$name]->getText();
if (is_array($nodes)) {
$nnum = sizeof($nodes);
for ($j = 0; $j < $nnum; $j++) {
//print_r( $nodes[$j] );
// TODO: analyze it nafig
// echo $res->nodeset[$i]->get_content();
//print_r($res->nodeset[$i]);
/*
echo $j."of $nnum vs $i<hr/>";
print_r($nodes[$j]);
echo "<hr/>";
print_r($res->nodeset[$i]);
echo "<hr/>";
print_r($res->nodeset[$i]);
echo "<hr/>";
*/
// echo $res->nodeset[$i]->get_content();
// $res->nodeset[$i]->insert_before( $nodes[$j], $res->nodeset[$i]);
$res->nodeset[$i]->append_sibling($nodes[$j]);
// if (in_array($))
/*
if ($res->nodeset[$i]->get_content() != "")
$res->nodeset[$i]->insert_before( $nodes[$i], $res->nodeset[$i] );
else
$res->nodeset[$i]->append_child( $nodes[$j], $res->nodeset[$i] );
*/
/*
if ( $nodes[$j]->type == 1 ) {
$this->_makeXSLTInclude( $nodes[$j] );
}*/
}
}
}
$p = $res->nodeset[$i]->parent_node();
//print_r( $p );
$p->remove_child($res->nodeset[$i]);
$needReCall = true;
}
}
/**/
if ($needReCall) {
$this->_makeXSLTInclude($main_xsl);
}
/**/
}
开发者ID:parxomchik,项目名称:Agro,代码行数:100,代码来源:XPageInfo.class.php
示例9: getInitialOpenedContent
/**
* Get initial opened content
*
* @param
*/
function getInitialOpenedContent()
{
$this->buildDom();
$xpc = xpath_new_context($this->dom);
$path = "//PageObject/InitOpenedContent";
$res = xpath_eval($xpc, $path);
$il_node = null;
if (count($res->nodeset) > 0) {
$init_node = $res->nodeset[0];
$childs = $init_node->child_nodes();
for ($i = 0; $i < count($childs); $i++) {
if ($childs[$i]->node_name() == "IntLink") {
$il_node = $childs[$i];
}
}
}
if (!is_null($il_node)) {
$id = $il_node->get_attribute("Target");
$link_type = $il_node->get_attribute("Type");
$target = $il_node->get_attribute("TargetFrame");
switch ($link_type) {
case "MediaObject":
$type = "media";
break;
case "PageObject":
$type = "page";
break;
case "GlossaryItem":
$type = "term";
break;
}
include_once "./Services/Link/classes/class.ilInternalLink.php";
$id = ilInternalLink::_extractObjIdOfTarget($id);
return array("id" => $id, "type" => $type, "target" => $target);
}
return array();
}
开发者ID:bheyser,项目名称:qplskl,代码行数:42,代码来源:class.ilPageObject.php
示例10: getTriggerNodes
/**
* Get trigger nodes
*/
function getTriggerNodes($a_hier_id, $a_pc_id = "")
{
if ($a_pc_id != "") {
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@PCID = '" . $a_pc_id . "']/InteractiveImage/Trigger";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) > 0) {
return $res->nodeset;
}
return array();
}
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@HierId = '" . $a_hier_id . "']/InteractiveImage/Trigger";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) > 0) {
return $res->nodeset;
}
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:21,代码来源:class.ilPCInteractiveImage.php
示例11: setData
/**
* Set data of cells
*/
function setData($a_data)
{
$ok = true;
//var_dump($a_data);
if (is_array($a_data)) {
foreach ($a_data as $i => $row) {
if (is_array($row)) {
foreach ($row as $j => $cell) {
//echo "<br><br>=".$cell."=";
$temp_dom = @domxml_open_mem('<?xml version="1.0" encoding="UTF-8"?><Paragraph>' . $cell . '</Paragraph>', DOMXML_LOAD_PARSING, $error);
$par_node = $this->getCellNode($i, $j);
//echo "<br>=".htmlentities($this->dom->dump_node($par_node))."=";
//echo "<br>-$i-$j-$cell-";
// remove all childs
if (empty($error) && is_object($par_node)) {
// delete children of paragraph node
$children = $par_node->child_nodes();
for ($k = 0; $k < count($children); $k++) {
$par_node->remove_child($children[$k]);
}
// copy new content children in paragraph node
$xpc = xpath_new_context($temp_dom);
$path = "//Paragraph";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) == 1) {
$new_par_node =& $res->nodeset[0];
$new_childs = $new_par_node->child_nodes();
for ($l = 0; $l < count($new_childs); $l++) {
$cloned_child = $new_childs[$l]->clone_node(true);
$par_node->append_child($cloned_child);
//echo "<br>=".htmlentities($this->dom->dump_node($cloned_child))."=";
}
}
} else {
if (!empty($error)) {
return $error;
}
}
}
}
}
}
//exit;
return true;
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:48,代码来源:class.ilPCDataTable.php
示例12: deleteAllMapAreas
/**
* Delete all map areas
*/
function deleteAllMapAreas()
{
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@HierId = '" . $this->hier_id . "']/" . $this->parent_node_name . "/MediaAliasItem[@Purpose='" . $this->purpose . "']/MapArea";
$res =& xpath_eval($xpc, $path);
for ($i = 0; $i < count($res->nodeset); $i++) {
$res->nodeset[$i]->unlink_node($res->nodeset[$i]);
}
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:12,代码来源:class.ilMediaAliasItem.php
示例13: modifyPageContentPostXsl
/**
* Modify page content after xsl
*
* @param string $a_output
* @return string
*/
function modifyPageContentPostXsl($a_output, $outputmode = "presentation")
{
$dom = $this->getPage()->getDom();
$xpc = xpath_new_context($dom);
$path = "//Paragraph";
//"[@Characteristic = 'Code']";
$res =& xpath_eval($xpc, $path);
for ($i = 0; $i < count($res->nodeset); $i++) {
$context_node = $res->nodeset[$i];
$char = $context_node->get_attribute('Characteristic');
if ($char != "Code") {
continue;
}
$n = $context_node->parent_node();
$char = $context_node->get_attribute('Characteristic');
$subchar = $context_node->get_attribute('SubCharacteristic');
$showlinenumbers = $context_node->get_attribute('ShowLineNumbers');
$downloadtitle = $context_node->get_attribute('DownloadTitle');
$autoindent = $context_node->get_attribute('AutoIndent');
$content = "";
// get XML Content
$childs = $context_node->child_nodes();
for ($j = 0; $j < count($childs); $j++) {
$content .= $dom->dump_node($childs[$j]);
}
while ($context_node->has_child_nodes()) {
$node_del = $context_node->first_child();
$context_node->remove_child($node_del);
}
$content = str_replace("<br />", "<br/>", utf8_decode($content));
$content = str_replace("<br/>", "\n", $content);
$rownums = count(split("\n", $content));
$plain_content = html_entity_decode($content);
$plain_content = preg_replace("/\\&#x([1-9a-f]{2});?/ise", "chr (base_convert (\\1, 16, 10))", $plain_content);
$plain_content = preg_replace("/\\&#(\\d+);?/ise", "chr (\\1)", $plain_content);
$content = utf8_encode($this->highlightText($plain_content, $subchar, $autoindent));
$content = str_replace("&lt;", "<", $content);
$content = str_replace("&gt;", ">", $content);
// $content = str_replace("&", "&", $content);
//var_dump($content);
$rows = "<tr valign=\"top\">";
$rownumbers = "";
$linenumbers = "";
//if we have to show line numbers
if (strcmp($showlinenumbers, "y") == 0) {
$linenumbers = "<td nowrap=\"nowrap\" class=\"ilc_LineNumbers\" >";
$linenumbers .= "<pre class=\"ilc_Code\">";
for ($j = 0; $j < $rownums; $j++) {
$indentno = strlen($rownums) - strlen($j + 1) + 2;
$rownumeration = $j + 1;
$linenumbers .= "<span class=\"ilc_LineNumber\">{$rownumeration}</span>";
if ($j < $rownums - 1) {
$linenumbers .= "\n";
}
}
$linenumbers .= "</pre>";
$linenumbers .= "</td>";
}
$rows .= $linenumbers . "<td class=\"ilc_Sourcecode\"><pre class=\"ilc_Code\">" . $content . "</pre></td>";
$rows .= "</tr>";
// fix for ie explorer which is not able to produce empty line feeds with <br /><br />;
// workaround: add a space after each br.
$newcontent = str_replace("\n", "<br/>", $rows);
// fix for IE
$newcontent = str_replace("<br/><br/>", "<br/> <br/>", $newcontent);
// falls drei hintereinander...
$newcontent = str_replace("<br/><br/>", "<br/> <br/>", $newcontent);
// workaround for preventing template engine
// from hiding paragraph text that is enclosed
// in curly brackets (e.g. "{a}", see ilLMEditorGUI::executeCommand())
$newcontent = str_replace("{", "{", $newcontent);
$newcontent = str_replace("}", "}", $newcontent);
//echo htmlentities($newcontent);
$a_output = str_replace("[[[[[Code;" . ($i + 1) . "]]]]]", $newcontent, $a_output);
if ($outputmode != "presentation" && is_object($this->getPage()->getOfflineHandler()) && trim($downloadtitle) != "") {
// call code handler for offline versions
$this->getPage()->getOfflineHandler()->handleCodeParagraph($this->getPage()->getId(), $i + 1, $downloadtitle, $plain_content);
}
}
return $a_output;
}
开发者ID:arlendotcn,项目名称:ilias,代码行数:87,代码来源:class.ilPCSourceCode.php
示例14: performAutomaticModifications
/**
* Perform automatic modifications (may be overwritten by sub classes)
*/
function performAutomaticModifications()
{
if ($this->getGlossaryId() > 0) {
// we fix glossary links here
$this->buildDom();
$xpc = xpath_new_context($this->dom);
$path = "//IntLink[@Type='GlossaryItem']";
$res =& xpath_eval($xpc, $path);
for ($i = 0; $i < count($res->nodeset); $i++) {
$target = $res->nodeset[$i]->get_attribute("Target");
//echo "<br>".$target;
$tarr = explode("_", $target);
$term_id = $tarr[count($tarr) - 1];
if (is_int(strpos($target, "__")) && $term_id > 0) {
include_once "./Modules/Glossary/classes/class.ilGlossaryTerm.php";
//echo "<br>-".ilGlossaryTerm::_lookGlossaryID($term_id)."-".$this->getGlossaryId()."-";
if (ilGlossaryTerm::_lookGlossaryID($term_id) != $this->getGlossaryId()) {
// copy the glossary term from glossary a to b
$new_id = ilGlossaryTerm::_copyTerm($term_id, $this->getGlossaryId());
$res->nodeset[$i]->set_attribute("Target", "il__git_" . $new_id);
}
}
}
}
//exit;
}
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:29,代码来源:class.ilSCORM2004Page.php
示例15: editData
/**
* Edit data of table
*/
function editData()
{
global $lng, $ilCtrl;
if (!ilPageEditorGUI::_doJSEditing()) {
return $this->editDataCl();
}
//var_dump($_GET);
//var_dump($_POST);
$this->setTabs();
$this->displayValidationError();
include_once "./Services/COPage/classes/class.ilPCParagraph.php";
$this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.tabledata2.html", "Services/COPage");
$dtpl = $this->tpl;
//$dtpl = new ilTemplate("tpl.tabledata.html", true, true, "Services/COPage");
$dtpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this, "tableAction"));
// $dtpl->setVariable("BB_MENU", $this->getBBMenu("cell_0_0"));
// $this->tpl->addJavascript("./Services/COPage/phpBB/3_0_5/editor.js");
// $this->tpl->addJavascript("./Services/COPage/js/page_editing.js");
$this->tpl->setVariable("WYSIWYG_ACTION", $ilCtrl->getFormAction($this, "updateJS"));
// get all rows
$xpc = xpath_new_context($this->dom);
$path = "//PageContent[@HierId='" . $this->getHierId() . "']" . "/Table/TableRow";
$res =& xpath_eval($xpc, $path);
for ($i = 0; $i < count($res->nodeset); $i++) {
$xpc2 = xpath_new_context($this->dom);
$path2 = "//PageContent[@HierId='" . $this->getHierId() . "']" . "/Table/TableRow[{$i}+1]/TableData";
$res2 =& xpath_eval($xpc2, $path2);
// if this is the first row -> col icons
if ($i == 0) {
for ($j = 0; $j < count($res2->nodeset); $j++) {
if ($j == 0) {
$dtpl->touchBlock("empty_td");
}
if ($j == 0) {
if (count($res2->nodeset) == 1) {
$move_type = "none";
} else {
$move_type = "forward";
}
} else {
if ($j == count($res2->nodeset) - 1) {
$move_type = "backward";
} else {
$move_type = "both";
}
}
$dtpl->setCurrentBlock("col_icon");
$dtpl->setVariable("COL_ICON_ALT", $lng->txt("content_column"));
$dtpl->setVariable("COL_ICON", ilUtil::getImagePath("col.png"));
$dtpl->setVariable("COL_ONCLICK", "COL_" . $move_type);
$dtpl->setVariable("NR", $j);
$dtpl->parseCurrentBlock();
}
$dtpl->setCurrentBlock("row");
$dtpl->parseCurrentBlock();
}
for ($j = 0; $j < count($res2->nodeset); $j++) {
// first col: row icons
if ($j == 0) {
if ($i == 0) {
if (count($res->nodeset) == 1) {
$move_type = "none";
} else {
$move_type = "forward";
}
} else {
if ($i == count($res->nodeset) - 1) {
$move_type = "backward";
} else {
$move_type = "both";
}
}
$dtpl->setCurrentBlock("row_icon");
$dtpl->setVariable("ROW_ICON_ALT", $lng->txt("content_row"));
$dtpl->setVariable("ROW_ICON", ilUtil::getImagePath("row.png"));
$dtpl->setVariable("ROW_ONCLICK", "ROW_" . $move_type);
$dtpl->setVariable("NR", $i);
$dtpl->parseCurrentBlock();
}
// cell
if ($res2->nodeset[$j]->get_attribute("Hidden") != "Y") {
$dtpl->setCurrentBlock("cell");
if (is_array($_POST["cmd"]) && key($_POST["cmd"]) == "update") {
$s_text = ilUtil::stripSlashes("cell_" . $i . "_" . $j, false);
} else {
$s_text = ilPCParagraph::xml2output($this->content_obj->getCellText($i, $j), true, false);
include_once "./Services/COPage/classes/class.ilPCParagraphGUI.php";
$s_text = ilPCParagraphGUI::xml2outputJS($s_text, "TableContent", $this->content_obj->readPCId() . "_" . $i . "_" . $j);
}
$dtpl->setVariable("PAR_TA_NAME", "cell[" . $i . "][" . $j . "]");
$dtpl->setVariable("PAR_TA_ID", "cell_" . $i . "_" . $j);
$dtpl->setVariable("PAR_TA_CONTENT", $s_text);
$cs = $res2->nodeset[$j]->get_attribute("ColSpan");
$rs = $res2->nodeset[$j]->get_attribute("RowSpan");
$dtpl->setVariable("WIDTH", "140");
$dtpl->setVariable("HEIGHT", "80");
if ($cs > 1) {
//.........这里部分代码省略.........
开发者ID:Walid-Synakene,项目名称:ilias,代码行数:101,代码来源:class.ilPCDataTableGUI.php
示例16: getLayoutLinkTargets
function getLayoutLinkTargets()
{
if (!is_object($this->layout_doc)) {
return array();
}
$xpc = xpath_new_context($this->layout_doc);
$path = "/ilLayout/ilLinkTargets/LinkTarget";
$res = xpath_eval($xpc, $path);
$targets = array();
for ($i = 0; $i < count($res->nodeset); $i++) {
$type = $res->nodeset[$i]->get_attribute("Type");
$frame = $res->nodeset[$i]->get_attribute("Frame");
$onclick = $res->nodeset[$i]->get_attribute("OnClick");
$targets[$type] = array("Type" => $type, "Frame" => $frame, "OnClick" => $onclick);
}
return $targets;
}
开发者ID:bheyser,项目名称:qplskl,代码行数:17,代码来源:class.ilLMPresentationGUI.php
示例17: exploreFile
/**
* Returns additional menu informations decoded in the file that appears in the menu.
*
* You should subclass this method to make it work with your own
* file formats. I used a simple XML format to store the content.
*
* @param string filename
*/
function exploreFile($file)
{
$xml = join('', @file($file));
if (!$xml) {
return array();
}
$doc = xmldoc($xml);
$xpc = xpath_new_context($doc);
$menu = xpath_eval($xpc, '//menu');
$node =& $menu->nodeset[0];
return array('title' => $node->content);
}
开发者ID:GeekyNinja,项目名称:LifesavingCAD,代码行数:20,代码来源:MenuBrowser.php
示例18: SelectNodes
function SelectNodes($query)
{
if (EWRPT_IS_PHP5) {
$xpath = new DOMXPath($this->XmlDoc);
return $xpath->query($query);
} else {
$xpath = xpath_new_context($this->XmlDoc);
$xpathobj = xpath_eval_expression($xpath, $query);
return $xpathobj->nodeset;
}
}
开发者ID:asmirasurianie,项目名称:xaminer-v10,代码行数:11,代码来源:ewrfn4.php
示例19: setText
/**
* Set (xml) content of text paragraph.
*
* @param string $a_text text content
* @param boolean $a_auto_split auto split paragraph at headlines true/false
*/
function setText($a_text, $a_auto_split = false)
{
//var_dump($a_text);
if (!is_array($a_text)) {
$text = array(array("level" => 0, "text" => $a_text));
} else {
$text = $a_text;
}
if ($a_auto_split) {
$text = $this->autoSplit($a_text);
}
// DOMXML_LOAD_PARSING, DOMXML_LOAD_VALIDATING, DOMXML_LOAD_RECOVERING
$check = "";
foreach ($text as $t) {
$check .= "<Paragraph>" . $t["text"] . "</Paragraph>";
}
/*$temp_dom = domxml_open_mem('<?xml version="1.0" encoding="UTF-8"?><Paragraph>'.$text[0]["text"].'</Paragraph>',
DOMXML_LOAD_PARSING, $error);*/
$temp_dom = domxml_open_mem('<?xml version="1.0" encoding="UTF-8"?><Paragraph>' . $check . '</Paragraph>', DOMXML_LOAD_PARSING, $error);
//$this->text = $a_text;
// remove all childs
if (empty($error)) {
$temp_dom = domxml_open_mem('<?xml version="1.0" encoding="UTF-8"?><Paragraph>' . $text[0]["text"] . '</Paragraph>', DOMXML_LOAD_PARSING, $error);
// delete children of paragraph node
$children = $this->par_node->child_nodes();
for ($i = 0; $i < count($children); $i++) {
$this->par_node->remove_child($children[$i]);
}
// copy new content children in paragraph node
$xpc = xpath_new_context($temp_dom);
$path = "//Paragraph";
$res =& xpath_eval($xpc, $path);
if (count($res->nodeset) == 1) {
$new_par_node =& $res->nodeset[0];
$new_childs = $new_par_node->child_nodes();
for ($i = 0; $i < count($new_childs); $i++) {
$cloned_child =& $new_childs[$i]->clone_node(true);
$this->par_node->append_child($cloned_child);
}
$orig_characteristic = $this->getCharacteristic();
// if headlines are entered and current characteristic is a headline
// use no characteristic as standard
if (count($text) > 1 && substr($orig_characteristic, 0, 8) == "Headline") {
$orig_characteristic = "";
}
if ($text[0]["level"] > 0) {
$this->par_node->set_attribute("Characteristic", 'Headline' . $text[0]["level"]);
}
}
$ok = true;
$c_node = $this->node;
// add other chunks afterwards
for ($i = 1; $i < count($text
|
请发表评论