本文整理汇总了PHP中getChildren函数的典型用法代码示例。如果您正苦于以下问题:PHP getChildren函数的具体用法?PHP getChildren怎么用?PHP getChildren使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getChildren函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: getChildren
function getChildren(&$modx, $parent, $deltime = 0)
{
if (empty($deltime)) {
$deltime = time();
}
$success = false;
$kids = $modx->getCollection('modResource', array('parent' => $parent, 'deleted' => true));
if (count($kids) > 0) {
/* the resource has children resources, we'll need to undelete those too */
foreach ($kids as $kid) {
$locked = $kid->addLock();
if ($locked !== true) {
$user = $modx->getObject('modUser', $locked);
if ($user) {
$modx->error->failure($modx->lexicon('resource_locked_by', array('id' => $kid->get('id'), 'user' => $user->get('username'))));
}
}
$kid->set('deleted', 0);
$kid->set('deletedby', 0);
$kid->set('deletedon', 0);
$success = $kid->save();
if ($success) {
$success = getChildren($modx, $kid->get('id'), $deltime);
}
}
}
return $success;
}
开发者ID:JoeBlow,项目名称:revolution,代码行数:28,代码来源:undelete.php
示例2: menuData
public function menuData()
{
//authcheck($url);
/* 列出所有节点 */
$ids = isset($_POST['id']) ? $this->_post('id') : $this->_get('id');
$id = isset($_POST['id']) || isset($_GET['id']) ? intval($ids) : 0;
$map['pid'] = array('eq', $id);
$map['tree'] = array('eq', 1);
$db = M('auth_rule');
/* 如果是超级用户,所有列表 */
if (session('id') == C('SUPER_ADMIN')) {
$result = $db->field('iconCls,id,level,name,action,pid,sort,tree,title text,whetherclick')->where($map)->order('sort asc')->select();
} else {
//否则通过权限查看
$accessList = getAccessNodeList(session('id'));
$map['id'] = array('in', $accessList);
$result = $db->field('iconCls,id,level,name,action,pid,sort,tree,title text,whetherclick')->where($map)->order('sort asc')->select();
//dump($result);die;
}
for ($i = 0; $i < count($result); $i++) {
/* 加入result[i][attributes][url] 节点 */
$result[$i]['attributes']['name'] = $result[$i]['name'];
$result[$i]['attributes']['whetherclick'] = $result[$i]['whetherclick'];
/* 加入state节点 */
if (getChildren($db, $result[$i]['id'])) {
$result[$i]['state'] = 'closed';
} else {
$result[$i]['state'] = 'open';
}
}
$this->ajaxReturn($result);
}
开发者ID:ahmatjan,项目名称:yaojike,代码行数:32,代码来源:MainAction.class.php
示例3: getChildren
function getChildren($parent)
{
global $dbase;
global $table_prefix;
global $children;
global $site_start;
global $site_unavailable_page;
$db->debug = true;
$sql = "SELECT id FROM {$dbase}.`" . $table_prefix . "site_content` WHERE {$dbase}.`" . $table_prefix . "site_content`.parent=" . $parent . " AND deleted=0;";
$rs = mysql_query($sql);
$limit = mysql_num_rows($rs);
if ($limit > 0) {
// the document has children documents, we'll need to delete those too
for ($i = 0; $i < $limit; $i++) {
$row = mysql_fetch_assoc($rs);
if ($row['id'] == $site_start) {
echo "The document you are trying to delete is a folder containing document " . $row['id'] . ". This document is registered as the 'Site start' document, and cannot be deleted. Please assign another document as your 'Site start' document and try again.";
exit;
}
if ($row['id'] == $site_unavailable_page) {
echo "The document you are trying to delete is a folder containing document " . $row['id'] . ". This document is registered as the 'Site unavailable page' document, and cannot be deleted. Please assign another document as your 'Site unavailable page' document and try again.";
exit;
}
$children[] = $row['id'];
getChildren($row['id']);
//echo "Found childNode of parentNode $parent: ".$row['id']."<br />";
}
}
}
开发者ID:rthrash,项目名称:evolution,代码行数:29,代码来源:delete_content.processor.php
示例4: getChildren
function getChildren($parent)
{
global $modx;
global $children;
global $site_start;
global $site_unavailable_page;
global $error_page;
global $unauthorized_page;
$rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent={$parent} AND deleted=0");
// the document has children documents, we'll need to delete those too
while ($childid = $modx->db->getValue($rs)) {
if ($childid == $site_start) {
$modx->webAlertAndQuit("The document you are trying to delete is a folder containing document {$childid}. This document is registered as the 'Site start' document, and cannot be deleted. Please assign another document as your 'Site start' document and try again.");
}
if ($childid == $site_unavailable_page) {
$modx->webAlertAndQuit("The document you are trying to delete is a folder containing document {$childid}. This document is registered as the 'Site unavailable page' document, and cannot be deleted. Please assign another document as your 'Site unavailable page' document and try again.");
}
if ($childid == $error_page) {
$modx->webAlertAndQuit("The document you are trying to delete is a folder containing document {$childid}. This document is registered as the 'Site error page' document, and cannot be deleted. Please assign another document as your 'Site error page' document and try again.");
}
if ($childid == $unauthorized_page) {
$modx->webAlertAndQuit("The document you are trying to delete is a folder containing document {$childid}. This document is registered as the 'Site unauthorized page' document, and cannot be deleted. Please assign another document as your 'Site unauthorized page' document and try again.");
}
$children[] = $childid;
getChildren($childid);
//echo "Found childNode of parentNode $parent: ".$childid."<br />";
}
}
开发者ID:radist,项目名称:modx.evo.custom,代码行数:28,代码来源:delete_content.processor.php
示例5: getChildren
function getChildren($rowAll, $visualAssessmentTermIDParent, $level = 0, $studentResults = null)
{
$childrenCount = 0;
$json = '';
$jsonInt = '';
$json = $json = ',"children": [';
foreach ($rowAll as $row) {
if ($row['visualAssessmentTermIDParent'] == $visualAssessmentTermIDParent) {
++$childrenCount;
$title = addslashes($row['term']);
if ($row['description'] != '') {
$title = addslashes($row['term']) . ' - ' . addslashes($row['description']);
}
$jsonInt .= '{"name": "' . $row['term'] . '", "class": "' . $row['visualAssessmentTermID'] . '", "level": "' . $level . '", "title": "' . $title . '"';
if ($studentResults != null) {
foreach ($studentResults as $studentResult) {
if ($studentResult['visualAssessmentTermID'] == $row['visualAssessmentTermID']) {
$jsonInt .= ', "attainment": "' . 'attainment' . $studentResult['attainment'] . '"';
exit;
}
}
}
$jsonInt .= getChildren($rowAll, $row['visualAssessmentTermID'], $level + 1, $studentResults);
$jsonInt .= '},';
}
}
if ($jsonInt != '') {
$jsonInt = substr($jsonInt, 0, -1);
}
$json .= $jsonInt;
$json .= ']';
return $json;
}
开发者ID:GibbonEdu,项目名称:module-visualAssessment,代码行数:33,代码来源:moduleFunctions.php
示例6: generateSubmenu
function generateSubmenu($pageId, $parentPath)
{
$ret = '<div class="cms-breadcrumbsubmenu"><ul>';
global $userId;
$children = getChildren($pageId, $userId);
foreach ($children as $child) {
$ret .= "<li><span><a href='{$parentPath}{$child[1]}'>{$child[2]}</a></span></li><br>";
}
$ret .= '</ul></div>';
return $ret;
}
开发者ID:ksb1712,项目名称:pragyan,代码行数:11,代码来源:breadcrumbs.lib.php
示例7: getNumberOfTrees
function getNumberOfTrees($tree)
{
$result = 0;
foreach ($tree as $value) {
if (getChildren($value) % 2 == 0) {
$result++;
}
$result = $result + getNumberOfTrees($value);
}
return $result;
}
开发者ID:eltonoliver,项目名称:Algorithms,代码行数:11,代码来源:even_tree.php
示例8: getXmlTree
function getXmlTree($file)
{
$data = implode("", file($file));
$xml = xml_parser_create();
xml_parser_set_option($xml, XML_OPTION_SKIP_WHITE, 1);
xml_parse_into_struct($xml, $data, $vals, $index);
xml_parser_free($xml);
$tree = array();
$i = 0;
array_push($tree, array('tag' => $vals[$i]['tag'], 'attributes' => $vals[$i]['attributes'], 'children' => getChildren($vals, $i)));
return $tree;
}
开发者ID:nomadcomanche,项目名称:zdorov_shop,代码行数:12,代码来源:block.translate.php
示例9: getChildren
function getChildren($children)
{
if (!$children) {
return '';
}
$childrenVal = '<ul class="list-unstyled">';
foreach ($children as $child) {
$childrenVal .= '<li><strong>' . $child->description . '</strong> (<a href="' . \yii\helpers\Url::to(['view', 'id' => $child->name]) . '">' . $child->name . '</a>)</li>';
$childrenVal .= getChildren($child->getChildren()->orderBy(['type' => SORT_ASC, 'name' => SORT_ASC])->all());
}
return $childrenVal . '</ul><br />';
}
开发者ID:maddoger,项目名称:yii2-user,代码行数:12,代码来源:view.php
示例10: getChildren
function getChildren($groupid)
{
global $metricid;
$haschildren = false;
$sql = "SELECT description,id,parent_id,1 as type,'' as full_name,'' as country FROM entity_groups where id=" . $groupid;
$result = mysql_query($sql);
$e = mysql_fetch_assoc($result);
$output[] = $e;
$sql = "SELECT description,id,parent_id,1 as type,'' as full_name,'' as country FROM entity_groups where parent_id=" . $groupid;
$sql .= " order by description ";
$result = mysql_query($sql);
while ($e = mysql_fetch_assoc($result)) {
$tmp = getChildren($e['id']);
if (!empty($tmp)) {
foreach ($tmp as $item) {
$output[] = $item;
$haschildren = true;
}
}
}
$sql = "select ticker as description,entities.id,entity_group_id as parent_id,2 as type,full_name,countries.name as country ";
$sql .= "from entities ";
$sql .= "JOIN entities_entity_groups on entities.id=entities_entity_groups.entity_id ";
//$sql.= "LEFT join countries on countries.id=entities.country_id ";
$sql .= " LEFT join countries_entities on countries_entities.entity_id=entities.id ";
$sql .= " LEFT join countries on countries_entities.country_id=countries.id ";
if (!empty($metricid)) {
$sql .= "JOIN entities_metrics on entities_metrics.entity_id = entities.id ";
}
$sql .= " where entities_entity_groups.entity_group_id=" . $groupid;
if (!empty($metricid)) {
$sql .= " and entities_metrics.metric_id =" . $metricid;
}
//OFP 2/12/2012 - Had to add the following for USDXCD which was an example of an entity associated
//with multiple countries and would result in invalid duplicate entires being returned in this query.
$sql .= " and (countries_entities.default_country=1 OR countries_entities.default_country is null)";
$sql .= " order by description ";
//echo $sql;
$result = mysql_query($sql);
if ($result != null) {
while ($e = mysql_fetch_assoc($result)) {
$output[] = $e;
$haschildren = true;
}
}
if ($haschildren == false) {
//if this node has no children, remove it.
array_pop($output);
}
return $output;
//echo "<BR> schedule id: ".$q."<BR>";
//echo "<table border='1'>";
}
开发者ID:hastapasta,项目名称:financereport,代码行数:53,代码来源:cakeajax4.php
示例11: getChildren
function getChildren($parent)
{
global $modx;
global $children;
global $deltime;
$rs = $modx->db->select('id', $modx->getFullTableName('site_content'), "parent='{$parent}' AND deleted=1 AND deletedon='{$deltime}'");
// the document has children documents, we'll need to delete those too
while ($row = $modx->db->getRow($rs)) {
$children[] = $row['id'];
getChildren($row['id']);
//echo "Found childNode of parentNode $parent: ".$row['id']."<br />";
}
}
开发者ID:radist,项目名称:modx.evo.custom,代码行数:13,代码来源:undelete_content.processor.php
示例12: getChildren
function getChildren($itemMenu)
{
$tmp = "";
$filhos = $itemMenu->getChildren();
if (!empty($filhos)) {
$tmp = "<ul>";
foreach ($filhos as $value) {
$tmp .= "<li style='display:block !important'>" . $value->get('title') . "</li>";
$tmp .= getChildren($value);
}
$tmp .= "</ul>";
}
return $tmp;
}
开发者ID:cosis-stn,项目名称:menusanfona,代码行数:14,代码来源:default.php
示例13: getChildren
function getChildren($parent)
{
global $children;
global $deltime, $modx;
//$db->debug = true;
$rs = $modx->db->select('id', '[+prefix+]site_content', "parent={$parent} AND deleted=1 AND deletedon='{$deltime}'");
if ($modx->db->getRecordCount($rs) > 0) {
// the document has children documents, we'll need to delete those too
while ($row = $modx->db->getRow($rs)) {
$children[] = $row['id'];
getChildren($row['id']);
}
}
}
开发者ID:Fiberalph,项目名称:evolution-jp,代码行数:14,代码来源:undelete_content.processor.php
示例14: __getChildrenCount
/**
* Retrives active categories count
* @param Varien_Object| $object
* @return integer
*/
public function __getChildrenCount($object)
{
if (Mage::getStoreConfig('catalog/frontend/flat_catalog_category')) {
if (!$object->getChildrenCount()) {
$count = 0;
if ($object->getChildrenNodes()) {
foreach ($object->getChildrenNodes() as $child) {
if ($child->getIsActive()) {
$count++;
}
}
return $count;
}
if ($object->getChildren()) {
foreach ($object->getChildren() as $child) {
if ($child->getIsActive()) {
$count++;
}
}
return $count;
}
}
return $object->getChildrenCount();
} else {
if ($object->getChildrenCount()) {
$count = 0;
foreach ($object->getChildren() as $child) {
if ($child->getIsActive()) {
$count++;
}
}
return $count;
}
}
return 0;
}
开发者ID:buttasg,项目名称:cowgirlk,代码行数:41,代码来源:Navigation.php
示例15: getCategories
function getCategories($d)
{
global $baseurl, $f, $p, $local, $cats;
$topcat = $d->find('#e1 > li');
foreach ($topcat as $top) {
//echo $top->innertext . "\n";
$catname = $top->find('a > div', 0)->innertext;
$caturl = $top->find('a', 0)->href;
$catpath = "|";
$cats[] = array($catname, $catpath, $caturl);
// echo "Saved category /" . $catname . "\n";
getProducts($caturl, $catpath . $catname);
getChildren($caturl, $catpath . $catname);
}
}
开发者ID:jbm160,项目名称:drfs,代码行数:15,代码来源:scraper.php
示例16: createTree
function createTree($branches)
{
$tree = array();
foreach ($branches as $slice_id => $slice) {
if ($slice['parent_id'] == "0") {
$tree[$slice_id] = $slice;
unset($branches[$slice_id]);
}
}
$tree = fix_keys(getChildren($branches, $tree));
echo '<hr>';
var_dump($branches);
echo '<hr>';
return $tree;
}
开发者ID:Code141,项目名称:marble,代码行数:15,代码来源:makeatree.php
示例17: getChildren
function getChildren($parent, &$modx, &$children)
{
if (!is_array($children)) {
$children = array();
}
$parent->children = $parent->getMany('Children');
if (count($parent->children) > 0) {
foreach ($parent->children as $child) {
if ($child->get('id') == $modx->getOption('site_start')) {
return $modx->error->failure($modx->lexicon('resource_err_delete_container_sitestart', array('id' => $child->get('id'))));
}
if ($child->get('id') == $modx->getOption('site_unavailable_page')) {
return $modx->error->failure($modx->lexicon('document_err_delete_container_siteunavailable', array('id' => $child->get('id'))));
}
$children[] = $child;
/* recursively loop through tree */
getChildren($child, $modx, $children);
}
}
}
开发者ID:JoeBlow,项目名称:revolution,代码行数:20,代码来源:delete.php
示例18: getChildren
function getChildren($parent)
{
global $dbase;
global $table_prefix;
global $children;
global $deltime;
$db->debug = true;
$sql = "SELECT id FROM {$dbase}.`" . $table_prefix . "site_content` WHERE {$dbase}.`" . $table_prefix . "site_content`.parent=" . $parent . " AND deleted=1 AND deletedon={$deltime};";
$rs = mysql_query($sql);
$limit = mysql_num_rows($rs);
if ($limit > 0) {
// the document has children documents, we'll need to delete those too
for ($i = 0; $i < $limit; $i++) {
$row = mysql_fetch_assoc($rs);
$children[] = $row['id'];
getChildren($row['id']);
//echo "Found childNode of parentNode $parent: ".$row['id']."<br />";
}
}
}
开发者ID:jgrau,项目名称:MODx-CMS,代码行数:20,代码来源:undelete_content.processor.php
示例19: renderObject
function renderObject($object_id)
{
global $nextorder, $virtual_obj_types;
$info = spotEntity('object', $object_id);
amplifyCell($info);
// Main layout starts.
echo "<table border=0 class=objectview cellspacing=0 cellpadding=0>";
echo "<tr><td colspan=2 align=center><h1>{$info['dname']}</h1></td></tr>\n";
// left column with uknown number of portlets
echo "<tr><td class=pcleft>";
// display summary portlet
$summary = array();
if (strlen($info['name'])) {
$summary['Common name'] = $info['name'];
} elseif (considerConfiguredConstraint($info, 'NAMEWARN_LISTSRC')) {
$summary[] = array('<tr><td colspan=2 class=msg_error>Common name is missing.</td></tr>');
}
$summary['Object type'] = '<a href="' . makeHref(array('page' => 'depot', 'tab' => 'default', 'cfe' => '{$typeid_' . $info['objtype_id'] . '}')) . '">' . decodeObjectType($info['objtype_id']) . '</a>';
if (strlen($info['label'])) {
$summary['Visible label'] = $info['label'];
}
if (strlen($info['asset_no'])) {
$summary['Asset tag'] = $info['asset_no'];
} elseif (considerConfiguredConstraint($info, 'ASSETWARN_LISTSRC')) {
$summary[] = array('<tr><td colspan=2 class=msg_error>Asset tag is missing.</td></tr>');
}
$parents = getParents($info, 'object');
// lookup the human-readable object type, sort by it
foreach ($parents as $parent_id => $parent) {
$parents[$parent_id]['object_type'] = decodeObjectType($parent['objtype_id']);
}
$grouped_parents = groupBy($parents, 'object_type');
ksort($grouped_parents);
foreach ($grouped_parents as $parents_group) {
uasort($parents_group, 'compare_name');
$label = $parents_group[key($parents_group)]['object_type'] . (count($parents_group) > 1 ? ' containers' : ' container');
$fmt_parents = array();
foreach ($parents_group as $parent) {
$fmt_parents[] = mkCellA($parent);
}
$summary[$label] = implode('<br>', $fmt_parents);
}
$children = getChildren($info, 'object');
foreach (groupBy($children, 'objtype_id') as $objtype_id => $children_group) {
uasort($children_group, 'compare_name');
$fmt_children = array();
foreach ($children_group as $child) {
$fmt_children[] = mkCellA($child);
}
$summary["Contains " . strtolower(decodeObjectType($objtype_id))] = implode('<br>', $fmt_children);
}
if ($info['has_problems'] == 'yes') {
$summary[] = array('<tr><td colspan=2 class=msg_error>Has problems</td></tr>');
}
foreach (getAttrValuesSorted($object_id) as $record) {
if (strlen($record['value']) and permitted(NULL, NULL, NULL, array(array('tag' => '$attr_' . $record['id'])))) {
$summary['{sticker}' . $record['name']] = formatAttributeValue($record);
}
}
$summary[] = array(getOutputOf('printTagTRs', $info, makeHref(array('page' => 'depot', 'tab' => 'default', 'andor' => 'and', 'cfe' => '{$typeid_' . $info['objtype_id'] . '}')) . "&"));
renderEntitySummary($info, 'summary', $summary);
if (strlen($info['comment'])) {
startPortlet('Comment');
echo '<div class=commentblock>' . string_insert_hrefs($info['comment']) . '</div>';
finishPortlet();
}
$logrecords = getLogRecordsForObject($_REQUEST['object_id']);
if (count($logrecords)) {
startPortlet('log records');
echo "<table cellspacing=0 cellpadding=5 align=center class=widetable width='100%'>";
$order = 'odd';
foreach ($logrecords as $row) {
echo "<tr class=row_{$order} valign=top>";
echo '<td class=tdleft>' . $row['date'] . '<br>' . $row['user'] . '</td>';
echo '<td class="logentry">' . string_insert_hrefs(htmlspecialchars($row['content'], ENT_NOQUOTES)) . '</td>';
echo '</tr>';
$order = $nextorder[$order];
}
echo '</table>';
finishPortlet();
}
switchportInfoJS($object_id);
// load JS code to make portnames interactive
renderFilesPortlet('object', $object_id);
if (count($info['ports'])) {
startPortlet('ports and links');
$hl_port_id = 0;
if (isset($_REQUEST['hl_port_id'])) {
assertUIntArg('hl_port_id');
$hl_port_id = $_REQUEST['hl_port_id'];
addAutoScrollScript("port-{$hl_port_id}");
}
echo "<table cellspacing=0 cellpadding='5' align='center' class='widetable'>";
echo '<tr><th class=tdleft>Local name</th><th class=tdleft>Visible label</th>';
echo '<th class=tdleft>Interface</th><th class=tdleft>L2 address</th>';
echo '<th class=tdcenter colspan=2>Remote object and port</th>';
echo '<th class=tdleft>Cable ID</th></tr>';
foreach ($info['ports'] as $port) {
callHook('renderObjectPortRow', $port, $hl_port_id == $port['id']);
}
//.........这里部分代码省略.........
开发者ID:spartak-radchenko,项目名称:racktables,代码行数:101,代码来源:interface.php
示例20: create
function create($entity)
{
$html = getHTML($entity['source_url']);
if (!$html) {
return error_log('Could not import ' + $entity['source_url']);
}
// Clean title
$entity['title'] = trim(html_entity_decode($entity['title'], ENT_COMPAT, 'UTF-8'));
// Generate key
$entity['key'] = 'ch/' . makeSlug($entity['title']);
// Extract email
$emailLink = $html->find('table.tabelleESK a[href^=mailto:]', 0);
if ($emailLink) {
$entity['email'] = str_replace('mailto:', '', trim($emailLink->href));
}
// Extract URL
foreach ($html->find('table.tabelleESK tr') as $row) {
$name = trim($row->children(0)->innertext);
if (stripos('homepage', $name) !== false) {
foreach ($row->children() as $i => $cell) {
$link = $cell->find('a[href]', 0);
if ($link) {
$entity['url'] = $link->href;
break;
}
// Ugly case: URL but no link
if ($i && !$cell->children()) {
$entity['url'] = $cell->innertext;
break;
}
}
}
}
// Find entity abbreviation
$orgTitle = $html->find('h2.titleOrg', 0);
if ($orgTitle) {
$orgTitleParts = explode('-', $orgTitle->innertext);
if (count($orgTitleParts) > 1) {
$entity['abbr'] = trim(array_pop($orgTitleParts));
$entity['abbr'] = html_entity_decode($entity['abbr'], ENT_COMPAT, 'UTF-8');
}
} else {
error_log('No title on ' + $entity['source_url']);
}
// Find entity address
$infoBlock = $html->find('div.infoblock', 0)->innertext;
if (preg_match('/<\\/h2>(.+?)<div class="titleContent">/s', $infoBlock, $matches)) {
$infoBlock = str_replace(array('<br>', '(neues Fenster)'), array(', ', ''), $matches[1]);
$infoBlock = preg_replace('/\\s\\s+/', ' ', $infoBlock);
$infoBlock = trim(html_entity_decode(strip_tags($infoBlock), ENT_COMPAT, 'UTF-8'));
$entity['address'] = $infoBlock;
}
save($entity);
getChildren($entity, $html);
}
开发者ID:flyeven,项目名称:scraperwiki-scraper-vault,代码行数:55,代码来源:public_bodies_of_the_swiss_federation.php
注:本文中的getChildren函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论