当前位置: 首页>>代码示例>>PHP>>正文


PHP getChildren函数代码示例

本文整理汇总了PHP中getChildren函数的典型用法代码示例。如果您正苦于以下问题:PHP getChildren函数的具体用法?PHP getChildren怎么用?PHP getChildren使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getChildren函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的getChildren函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。