本文整理汇总了PHP中addNode函数的典型用法代码示例。如果您正苦于以下问题:PHP addNode函数的具体用法?PHP addNode怎么用?PHP addNode使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了addNode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: allSites
function allSites()
{
global $pdo;
// Select all the rows in the markers table
$result = $pdo->query("SELECT id, sitename, city, country, ST_X(ST_CENTROID(geometry)) AS lon, ST_Y(ST_CENTROID(geometry)) AS lat FROM sites;");
if (!$result) {
die('Invalid query: ' . error_database());
}
// Iterate through the rows, adding XML nodes for each
while ($row = @$result->fetch(PDO::FETCH_ASSOC)) {
addNode($row);
}
}
示例2: addNode
$amount = 0;
}
// AMOUNT - Out of money
if ($amount < 50) {
$amount = 0;
}
// build navigation
$navigation = $doc->createElement('navigation');
// <navigation>
$navigation = $root->appendChild($navigation);
addNode($doc, $navigation, 'tab', $_GET[t]);
addNode($doc, $navigation, 'menu', 'none');
addNode($doc, $navigation, 'pagedescr', $company . ' (' . $symbol . ')');
addNode($doc, $navigation, 'title', 'Bully Bully - Signal');
addNode($doc, $navigation, 'pagename', $fundname . ' - Signal Detail');
// build content - signal detail
$occ = $doc->createElement('content');
// <content>
$occ = $root->appendChild($occ);
addNode($doc, $occ, 'symbol', $symbol);
addNode($doc, $occ, 'company', $company);
addNode($doc, $occ, 'low120', $low120);
addNode($doc, $occ, 'high120', $high120);
addNode($doc, $occ, 'price', $price);
addNode($doc, $occ, 'process', $process);
addNode($doc, $occ, 's1date', $s1date);
addNode($doc, $occ, 's1price', $s1price);
addNode($doc, $occ, 's2date', $s2date);
addNode($doc, $occ, 's2price', $s2price);
addNode($doc, $occ, 'amount', $amount);
echo $doc->saveXML();
示例3: addNodesAndConnectionsFromJsonld
/**
* Import nodes and connections from the given CIF url for the selected nodeids into the given map.
* The node import limit is set by '$CFG->ImportLimit'.
* @param url the url for the CIF data to load
* @param mapid the id of the map to get alerts for
* @param selectedids an array of the CIF node ides to import
* @param poses an array of the positions of the nodes in the map each array item is in
* the format 'x:y' and the position in the array should correspond ot the position of
* its node in the selectednodeids array.
* before it is considered out of date and should be refetched and recalculated.
* Defaults to 60 seconds.
* @param private true if the data should be created as private, else false.
* @return View object of the map or Error.
*
*/
function addNodesAndConnectionsFromJsonld($url, $mapid, $selectedids, $poses, $private)
{
global $USER, $HUB_FLM, $CFG, $ERROR;
require_once $HUB_FLM->getCodeDirPath("core/io/catalyst/catalyst_jsonld_reader.class.php");
require_once $HUB_FLM->getCodeDirPath("core/lib/url-validation.class.php");
//error_log(print_r($selectedids, true));
if (count($selectedids) > $CFG->ImportLimit) {
$ERROR = new error();
$ERROR->createAccessDeniedError();
return $ERROR;
}
//error_log(print_r($poses, true));
// Check if the map is in a group and if so get the group id.
$groupid = "";
$v = new View($mapid);
$view = $v->load();
if (!$view instanceof Error) {
if (isset($view->viewnode->groups)) {
$groups = $view->viewnode->groups;
if (count($groups) > 0) {
$groupid = $groups[0]->groupid;
}
}
} else {
return $view;
}
// make sure current user in group, if group set.
if ($groupid != "") {
$group = new Group($groupid);
if (!$group instanceof Error) {
if (!$group->ismember($USER->userid)) {
$error = new Error();
return $error->createNotInGroup($group->name);
}
}
}
$withhistory = false;
$withvotes = false;
$reader = new catalyst_jsonld_reader();
$reader = $reader->load($url, $withhistory, $withvotes);
if (!$reader instanceof Error) {
$nodeset = $reader->nodeSet;
$nodes = $nodeset->nodes;
$count = count($nodes);
$newnodeSet = new NodeSet();
$newNodeCheck = array();
for ($i = 0; $i < $count; $i++) {
$node = $nodes[$i];
$position = array_search($node->nodeid, $selectedids);
//error_log("position:".$position);
if ($position !== FALSE) {
$position = intval($position);
$positem = $poses[$position];
$positemArray = explode(":", $positem);
$xpos = "";
$ypos = "";
if (count($positemArray) == 2) {
$xpos = $positemArray[0];
$ypos = $positemArray[1];
}
//error_log("xpos:".$xpos.":ypos:".$ypos);
$role = getRoleByName($node->rolename);
$description = "";
if (isset($node->description)) {
$description = $node->description;
}
$newnode = addNode($node->name, $description, $private, $role->roleid);
//error_log(print_r($newnode, true));
if (!$newnode instanceof Error) {
$newNodeCheck[$node->nodeid] = $newnode;
//error_log($node->nodeid);
// if we have positioning information add the node to the map.
if ($xpos != "" && $ypos != "") {
$viewnode = $view->addNode($newnode->nodeid, $xpos, $ypos);
//if (!$viewnode instanceof Error) {
}
if (isset($node->homepage) && $node->homepage != "") {
$URLValidator = new mrsnk_URL_validation($node->homepage, MRSNK_URL_DO_NOT_PRINT_ERRORS, MRSNK_URL_DO_NOT_CONNECT_2_URL);
if ($URLValidator->isValid()) {
$urlObj = addURL($node->homepage, $node->homepage, "", $private, "", "", "", "cohere", "");
$newnode->addURL($urlObj->urlid, "");
// Add url to group? - not done on forms at present
} else {
error_log('Invalid node homepage: ' . $node->homepage . ': for ' . $node->nodeid);
}
//.........这里部分代码省略.........
示例4: header
header('Content-type: text/xml');
include '../bully.inc';
$db = new Database();
$doc = new DomDocument('1.0');
// create a new XML document
$root = $doc->createElement('root');
// <root>
$root = $doc->appendChild($root);
// build fund list
$sql = "select id, name from funds order by id desc";
$rows = mysql_query($sql) or die('select error: ' . mysql_error());
while ($cols = mysql_fetch_array($rows)) {
$occ = $doc->createElement('funds');
// <funds>
$occ = $root->appendChild($occ);
addNode($doc, $occ, 'id', $cols['id']);
// <funds><id>
addNode($doc, $occ, 'name', $cols['name']);
// <funds><name>
}
// build navigation
$navigation = $doc->createElement('navigation');
// <navigation>
$navigation = $root->appendChild($navigation);
addNode($doc, $navigation, 'tab', '0');
addNode($doc, $navigation, 'menu', 'none');
addNode($doc, $navigation, 'pagedescr', 'Signin for Administrative Privliages');
addNode($doc, $navigation, 'title', 'Bully Bully - Signin');
addNode($doc, $navigation, 'pagename', 'Administration - Signin');
addNode($doc, $navigation, 'signedin', 'yes');
echo $doc->saveXML();
示例5: addNode
addNode($doc, $occ, 'symbol', $cols['symbol']);
addNode($doc, $occ, 'company', $cols['company']);
addNode($doc, $occ, 'enabled', $cols['enabled']);
addNode($doc, $occ, 'price', $cols['price']);
addNode($doc, $occ, 'day10', $cols['day10']);
addNode($doc, $occ, 'low120', $cols['low120']);
addNode($doc, $occ, 'high120', $cols['high120']);
addNode($doc, $occ, 'process', $cols['process']);
addNode($doc, $occ, 's1date', $s1date);
addNode($doc, $occ, 's1price', $s1price);
addNode($doc, $occ, 's2date', $s2date);
addNode($doc, $occ, 's2price', $s2price);
addNode($doc, $occ, 'buydate', $buydate);
addNode($doc, $occ, 'buyprice', $buyprice);
addNode($doc, $occ, 'amount', $amount);
addNode($doc, $occ, 'days', $days);
addNode($doc, $occ, 'selldate', $selldate);
addNode($doc, $occ, 'sellprice', $sellprice);
if (floatval($stop) > floatval($cols['low120'])) {
addNode($doc, $occ, 'stop', $stop);
} else {
addNode($doc, $occ, 'stop', $cols['low120']);
}
// Javascript
if ($_GET[s] == 'y') {
$js = $doc->createElement('javascript');
// <javascript>
$js = $root->appendChild($js);
addNode($doc, $js, 'script', 'js/viewtrade.js');
}
echo $doc->saveXML();
示例6: clearSession
clearSession();
$response = new Result("logout", "logged out");
break;
/** NODES **/
/** NODES **/
case "getnode":
$nodeid = required_param('nodeid', PARAM_ALPHANUMEXT);
$response = getNode($nodeid, $style);
break;
case "addnode":
$name = required_param('name', PARAM_TEXT);
$desc = required_param('desc', PARAM_HTML);
$nodetypeid = optional_param('nodetypeid', "", PARAM_ALPHANUMEXT);
$imageurlid = optional_param('imageurlid', "", PARAM_TEXT);
$imagethumbnail = optional_param('imagethumbnail', "", PARAM_TEXT);
$response = addNode($name, $desc, $private, $nodetypeid, $imageurlid, $imagethumbnail);
break;
case "addnodeandconnect":
$name = required_param('name', PARAM_TEXT);
$desc = required_param('desc', PARAM_HTML);
$nodetypename = required_param('nodetypename', PARAM_TEXT);
$focalnodeid = required_param('focalnodeid', PARAM_ALPHANUMEXT);
$linktypename = required_param('linktypename', PARAM_TEXT);
$direction = optional_param('direction', 'from', PARAM_ALPHA);
$groupid = optional_param('groupid', "", PARAM_ALPHANUMEXT);
$imageurlid = optional_param('imageurlid', "", PARAM_TEXT);
$imagethumbnail = optional_param('imagethumbnail', "", PARAM_TEXT);
$resources = optional_param('resources', "", PARAM_TEXT);
$response = addNodeAndConnect($name, $desc, $nodetypename, $focalnodeid, $linktypename, $direction, $groupid, $private, $imageurlid, $imagethumbnail, $resources);
break;
case "editnode":
示例7: addNode
}
}
// build navigation
$navigation = $doc->createElement('navigation');
// <navigation>
$navigation = $root->appendChild($navigation);
addNode($doc, $navigation, 'tab', $_GET[t]);
addNode($doc, $navigation, 'menu', $_GET[m]);
addNode($doc, $navigation, 'pagedescr', "Review the Fund's Operational Settings");
addNode($doc, $navigation, 'title', 'Bully Bully - Settings');
addNode($doc, $navigation, 'pagename', $fundname . ' - Settings');
if ($_GET[s] == 'y') {
addNode($doc, $navigation, 'signedin', 'yes');
} else {
addNode($doc, $navigation, 'signedin', 'no');
}
// build content
$ss = $doc->createElement('settings');
// <settings>
$ss = $root->appendChild($ss);
addNode($doc, $ss, 'risk', getorset($_GET[t], 'Percentage of Equity Risked Per Trade', '2'));
addNode($doc, $ss, 'positions', getorset($_GET[t], 'Number of Concurrent Open Positions', '15'));
addNode($doc, $ss, 'maxprice', getorset($_GET[t], 'Maximum Price Per Share', '30'));
// Javascript
if ($_GET[s] == 'y') {
$js = $doc->createElement('javascript');
// <javascript>
$js = $root->appendChild($js);
addNode($doc, $js, 'script', 'js/fundsettings.js');
}
echo $doc->saveXML();
示例8: optional_param
$clonenodeid = optional_param("clonenodeid", "", PARAM_HTML);
if (isset($_POST["addissue"])) {
$private = optional_param("private", "Y", PARAM_ALPHA);
} else {
$private = optional_param("private", $USER->privatedata, PARAM_ALPHA);
}
if (isset($_POST["addissue"])) {
if ($issue == "") {
array_push($errors, $LNG->FORM_ISSUE_ENTER_SUMMARY_ERROR);
}
if (empty($errors)) {
// GET ROLES AND LINKS AS USER
$r = getRoleByName("Issue");
$roleIssue = $r->roleid;
// CREATE THE ISSUE NODE
$issuenode = addNode($issue, $desc, $private, $roleIssue);
if (!$issuenode instanceof Error) {
// Add a see also to the chat comment node this was cread from if chatnodeid exists
if ($clonenodeid != "") {
$clonenode = getNode($clonenodeid);
$clonerolename = $clonenode->role->name;
$r = getRoleByName($clonerolename);
$roleClone = $r->roleid;
$lt = getLinkTypeByLabel($CFG->LINK_COMMENT_BUILT_FROM);
$linkComment = $lt->linktypeid;
$connection = addConnection($issuenode->nodeid, $roleIssue, $linkComment, $clonenodeid, $roleClone, "N");
}
/*if ($_FILES['image']['error'] == 0) {
$imagedir = $HUB_FLM->getUploadsNodeDir($issuenode->nodeid);
$photofilename = uploadImageToFit('image',$errors,$imagedir);
示例9: header
<?php
header('Content-type: text/xml');
include '../bully.inc';
$rc = '0';
$message = 'Setting Successfuly Changed.';
$db = new Database();
$sql = '';
if ($_GET[c] == '1') {
$sql = 'insert into fundstocks (fund, stock) values ( ' . $_GET[f] . ', ' . $_GET[s] . ' )';
} else {
$sql = 'delete from fundstocks where fund = ' . $_GET[f] . ' and stock = ' . $_GET[s];
}
if (!mysql_query($sql)) {
$rc = '4';
$message = mysql_error();
}
$doc = new DomDocument('1.0');
$root = $doc->createElement('root');
$root = $doc->appendChild($root);
$result = $doc->createElement('result');
$result = $root->appendChild($result);
addNode($doc, $result, 'code', $rc);
addNode($doc, $result, 'message', $message);
echo $doc->saveXML();
示例10: set_time_limit
<?php
set_time_limit(0);
function addNode($title, $content, $date)
{
$node = new stdClass();
$node->type = 'test_perf_1';
node_object_prepare($node);
$node->language = LANGUAGE_NONE;
$node->uid = 1;
$node->changed_by = 1;
$node->status = 1;
$node->created = time() - mt_rand(1000, 1451610061);
$node->title = $title;
$node->body[LANGUAGE_NONE][0] = array('value' => $content, 'format' => 'full_html');
$node->field_test_date[LANGUAGE_NONE][0] = array('value' => $date, 'timezone' => 'UTC', 'timezone_db' => 'UTC');
node_save($node);
}
for ($i = 0; $i < 20000; $i++) {
addNode('dummy node ' . $i, '<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Morbi convallis mi quis finibus vulputate. Etiam auctor eros sed posuere viverra. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Donec quis risus vulputate, tempor augue non, molestie arcu. Nulla a lectus lorem. Donec pretium magna eget efficitur tempus. Ut vel risus cursus, rhoncus nunc eu, vulputate ex. Sed placerat euismod augue in venenatis. Suspendisse condimentum, odio eget vehicula imperdiet, eros eros vulputate nunc, aliquam tincidunt erat ipsum in lacus.</p>', date("Y-m-d H:i:s", mt_rand(1000, 1451610061)));
}
示例11: array_push
array_push($errors, $LNG->ADMIN_NEWS_MISSING_NAME_ERROR);
}
} else {
array_push($errors, $LNG->ADMIN_NEWS_ID_ERROR);
}
} else {
if (isset($_POST["addnews"])) {
if ($name != "") {
//become the news admin user
$currentuser = $USER;
$admin = new User($CFG->adminUserID);
$admin = $admin->load();
$USER = $admin;
$r = getRoleByName('News');
$roleType = $r->roleid;
$node = addNode($name, $desc, 'N', $roleType);
$USER = $currentuser;
} else {
array_push($errors, $LNG->ADMIN_NEWS_MISSING_NAME_ERROR);
}
} else {
if (isset($_POST["deletenews"])) {
if ($nodeid != "") {
if (!adminDeleteNews($nodeid)) {
array_push($errors, $LNG->ADMIN_MANAGE_NEWS_DELETE_ERROR . ' ' . $nodeid);
}
} else {
array_push($errors, $LNG->ADMIN_NEWS_ID_ERROR);
}
}
}
示例12: addNode
} else {
addNode($doc, $navigation, 'signedin', 'no');
}
// build content
$fund = $_GET[t];
$date = getorset('0', 'Last Process Date', '2007-06-13');
// Get Deposits
$sql = "select ifnull(sum(amount),0) deposits from deposits where fund = " . $fund;
$rows = mysql_query($sql);
$cols = mysql_fetch_array($rows);
$deposits = $cols['deposits'];
// Get Profits
$sql = "select ifnull(sum((amount / buyprice) * (sellprice - buyprice)),0) profit from trades where fund = " . $fund . " and selldate < '" . $date . "'";
$rows = mysql_query($sql);
$cols = mysql_fetch_array($rows);
$profit = $cols['profit'];
// Get Gain & Holdings
$sql = "select ifnull(sum(t.amount),0) holdings, ifnull(sum((t.amount / t.buyprice) * (ifnull(t.sellprice,p.price) - t.buyprice) ),0) gain from trades t, prices p where t.stock = p.stock and p.thedate = '" . $date . "' and t.fund = " . $fund . " and ifnull(t.selldate,'" . $date . "') >= '" . $date . "'";
$rows = mysql_query($sql);
$cols = mysql_fetch_array($rows);
$holdings = $cols['holdings'];
$gain = $cols['gain'];
// Calculate Cash & Equity
$cash = $deposits + $profit - $holdings;
$equity = $deposits + $profit + $gain;
$portfolio = $equity - $cash;
$content = $doc->createElement('content');
$content = $root->appendChild($content);
addNode($doc, $content, 'cash', $cash);
addNode($doc, $content, 'stocks', $portfolio);
echo $doc->saveXML();
示例13: header
header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
exit;
} else {
$delError = 1;
}
} else {
deleteNode($_GET['id']);
header('Location: ' . api_get_self() . '?category=' . Security::remove_XSS($category));
exit;
}
} elseif (($action == 'add' || $action == 'edit') && $_POST['formSent']) {
$_POST['categoryCode'] = trim($_POST['categoryCode']);
$_POST['categoryName'] = trim($_POST['categoryName']);
if (!empty($_POST['categoryCode']) && !empty($_POST['categoryName'])) {
if ($action == 'add') {
$ret = addNode($_POST['categoryCode'], $_POST['categoryName'], $_POST['canHaveCourses'], $category);
} else {
$ret = editNode($_POST['categoryCode'], $_POST['categoryName'], $_POST['canHaveCourses'], $id);
}
if ($ret) {
$action = '';
} else {
$errorMsg = get_lang('CatCodeAlreadyUsed');
}
} else {
$errorMsg = get_lang('PleaseEnterCategoryInfo');
}
} elseif ($action == 'edit') {
if (!empty($id)) {
$categoryCode = $id;
$sql = "SELECT name, auth_course_child FROM {$tbl_category} WHERE code='{$id}'";
示例14: optional_param
$identifierarray = optional_param("identifierarray", "", PARAM_TEXT);
$resourcenodeidsarray = optional_param("resourcenodeidsarray", "", PARAM_TEXT);
$resourcecliparray = optional_param("resourcecliparray", "", PARAM_TEXT);
$resourceclippatharray = optional_param("resourceclippatharray", "", PARAM_TEXT);
$clonenodeid = optional_param("clonenodeid", "", PARAM_HTML);
if (isset($_POST["addsolution"])) {
if ($solution == "") {
array_push($errors, $LNG->FORM_SOLUTION_ENTER_SUMMARY_ERROR);
}
if (empty($errors)) {
$currentUser = $USER;
// GET ROLE FOR USER
$r = getRoleByName("Solution");
$roleSolution = $r->roleid;
// CREATE THE solution NODE
$solutionnode = addNode($solution, $desc, $private, $roleSolution);
if (!$solutionnode instanceof Error) {
// Add a see also to the chat comment node this was cread from if chatnodeid exists
if ($clonenodeid != "") {
$clonenode = getNode($clonenodeid);
$clonerolename = $clonenode->role->name;
$r = getRoleByName($clonerolename);
$roleClone = $r->roleid;
$lt = getLinkTypeByLabel($CFG->LINK_COMMENT_BUILT_FROM);
$linkComment = $lt->linktypeid;
$connection = addConnection($solutionnode->nodeid, $roleSolution, $linkComment, $clonenodeid, $roleClone, "N");
}
/** ADD RESOURCES **/
if (empty($errors)) {
$lt = getLinkTypeByLabel('is related to');
$linkRelated = $lt->linktypeid;
示例15: optional_param
$resourceurlarray = optional_param("resourceurlarray", "", PARAM_URL);
$identifierarray = optional_param("identifierarray", "", PARAM_TEXT);
$resourcenodeidsarray = optional_param("resourcenodeidsarray", "", PARAM_TEXT);
$resourcecliparray = optional_param("resourcecliparray", "", PARAM_TEXT);
$resourceclippatharray = optional_param("resourceclippatharray", "", PARAM_TEXT);
if (isset($_POST["addcomment"])) {
$label = $summary;
trim($label);
if ($label == "") {
array_push($errors, $LNG->FORM_COMMENT_ENTER_SUMMARY_ERROR);
}
if (empty($errors)) {
$r = getRoleByName("Idea");
$roleComment = $r->roleid;
// CREATE THE NODE
$commentnode = addNode($label, $desc, $private, $roleComment);
if (empty($errors) && isset($commentnode) && !$commentnode instanceof Error) {
if ($_FILES['image']['error'] == 0) {
$imagedir = $HUB_FLM->getUploadsNodeDir($commentnode->nodeid);
$photofilename = uploadImageToFitComments('image', $errors, $imagedir, 155, 45);
if ($photofilename == "") {
$photofilename = $CFG->DEFAULT_ISSUE_PHOTO;
}
$commentnode->updateImage($photofilename);
}
/** ADD RESOURCES **/
$lt = getLinkTypeByLabel('is related to');
$linkRelated = $lt->linktypeid;
$i = 0;
foreach ($resourceurlarray as $resourceurl) {
$resourcetitle = trim($resourcetitlearray[$i]);