當前位置: 首頁>>代碼示例>>PHP>>正文


PHP tree::change_order_bulk方法代碼示例

本文整理匯總了PHP中tree::change_order_bulk方法的典型用法代碼示例。如果您正苦於以下問題:PHP tree::change_order_bulk方法的具體用法?PHP tree::change_order_bulk怎麽用?PHP tree::change_order_bulk使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在tree的用法示例。


在下文中一共展示了tree::change_order_bulk方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: migrate_cc_specs

function migrate_cc_specs(&$source_db, &$target_db, &$items, &$old_new)
{
    $mgtcom_keys = array('intro' => 'introduction', 'scope' => 'scope', 'ref' => 'references', 'method' => 'methodology', 'lim' => 'limitations');
    $mgtcat_keys = array('objective' => 'objective', 'config' => 'configuration', 'data' => 'data', 'tools' => 'tools');
    $tproject_mgr = new testproject($target_db);
    $ts_mgr = new testsuite($target_db);
    $tree_mgr = new tree($target_db);
    foreach ($items as $prod_id => $pd) {
        $old_new['product'][$prod_id] = @$tproject_mgr->create($pd['name'], $pd['color'], $pd['option_reqs'], EMPTY_NOTES, $pd['active']);
        echo "<pre><font color='blue'>Product {$pd['name']} has became a test project!</font></pre>";
        flush();
        $tproject_id = $old_new['product'][$prod_id];
        $sql = "SELECT * FROM mgtcomponent WHERE prodid={$prod_id}";
        $comp = $source_db->fetchRowsIntoMap($sql, 'id');
        // for change_order_bulk($hash_node_id, $hash_node_order)
        // $hash_node_id=array(10=>10, 23=>23, 30=>30);
        // $hash_node_order=array(10=>3, 23=>1, 30=>2);
        // $hash_node_id=array();
        // $hash_node_order=array();
        // 20071021 - francisco.mancardi@gruppotesi.com
        //
        // $hash_order_node_order=array(3=>10, 1=>23, 2=>30);
        // means:  node_id: 10 order:3
        //         node_id: 23 order:1
        //         node_id: 30 order:2
        $hash_order_node_id = array();
        if (count($comp) > 0) {
            foreach ($comp as $coid => $cod) {
                $details = '';
                foreach ($mgtcom_keys as $key => $val) {
                    $details .= $val . ": <br>" . $cod[$key] . "<p>";
                }
                $ret = $ts_mgr->create($tproject_id, $cod['name'], $details);
                if ($ret['status_ok']) {
                    echo "<pre>Component " . htmlentities($cod['name']) . " Migrated<br></pre>";
                    flush();
                    $mgtcomp_id = $ret['id'];
                    $old_new['mgtcomp'][$coid] = $mgtcomp_id;
                }
                // ----------------------------------------------------------------------------------
                $sql = "SELECT * FROM mgtcategory WHERE compid={$coid}";
                $cat = $source_db->fetchRowsIntoMap($sql, 'id');
                if (count($cat) > 0) {
                    foreach ($cat as $caid => $cad) {
                        // ----------------------------------------------------------------------------------
                        $details = '';
                        foreach ($mgtcat_keys as $key => $val) {
                            $details .= $val . ": <br>" . $cad[$key] . "<p>";
                        }
                        // ----------------------------------------------------------------------------------
                        $ret = $ts_mgr->create($mgtcomp_id, $cad['name'], $details);
                        if ($ret['status_ok']) {
                            echo "<pre>    Category " . htmlentities($cad['name']) . " Migrated<br></pre>";
                            flush();
                            $mgtcat_id = $ret['id'];
                            $old_new['mgtcat'][$caid] = $mgtcat_id;
                            if ($cad['CATorder'] != 0) {
                                // 20071021 - franciscom
                                // $hash_node_id[$mgtcat_id]=$mgtcat_id;
                                // $hash_node_order[$mgtcat_id]=$cad['CATorder'];
                                $node_id = $mgtcat_id;
                                $node_order = $cad['CATorder'];
                                $hash_order_node_id[$node_order] = $node_id;
                            }
                        }
                        // ----------------------------------------------------------------------------------
                    }
                }
            }
            // 20060725 - franciscom
            // $tree_mgr->change_order_bulk($hash_node_id, $hash_node_order) ;
            $tree_mgr->change_order_bulk($hash_order_node_id);
        }
    }
}
開發者ID:moraesmv,項目名稱:testlink-code,代碼行數:75,代碼來源:migrate_16_to_17_functions.php

示例2: init_args

*   rev: 20080605 - franciscom
*        
*/
require_once '../../config.inc.php';
require_once 'common.php';
testlinkInitPage($db);
// check if this is really needed
$exclude_node_types = array('testplan' => 1, 'requirement' => 1, 'requirement_spec' => 1);
$args = init_args();
$treeMgr = new tree($db);
switch ($args->doAction) {
    case 'changeParent':
        $treeMgr->change_parent($args->nodeid, $args->newparentid);
        break;
    case 'doReorder':
        $dummy = explode(',', $args->nodelist);
        $treeMgr->change_order_bulk($dummy);
        break;
}
function init_args()
{
    $args = new stdClass();
    $key2loop = array('nodeid', 'newparentid', 'doAction', 'top_or_bottom', 'nodeorder', 'nodelist');
    foreach ($key2loop as $key) {
        $args->{$key} = isset($_REQUEST[$key]) ? $_REQUEST[$key] : null;
    }
    return $args;
}
?>

                                                                                              
開發者ID:tamtrong,項目名稱:testlink,代碼行數:29,代碼來源:dragdroptprojectnodes.php


注:本文中的tree::change_order_bulk方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。