mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
issue 70 site map admin developement.
but not yet completed. should be javascript drwaing menu git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@9027 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
0c48f083d2
commit
3a7b0a4b64
3 changed files with 69 additions and 54 deletions
|
|
@ -6,6 +6,10 @@
|
|||
**/
|
||||
|
||||
class menuAdminController extends menu {
|
||||
var $menuSrl = null;
|
||||
var $itemKeyList = array();
|
||||
var $map = array();
|
||||
var $checked = array();
|
||||
|
||||
/**
|
||||
* @brief Initialization
|
||||
|
|
@ -247,70 +251,47 @@
|
|||
**/
|
||||
function procMenuAdminArrangeItem()
|
||||
{
|
||||
$menuSrl = Context::get('menu_srl');
|
||||
$this->menuSrl = Context::get('menu_srl');
|
||||
$args->title = Context::get('title');
|
||||
$parentKeyList = Context::get('parent_key');
|
||||
$itemKeyList = Context::get('item_key');
|
||||
debugPrint($parentKeyList);
|
||||
debugPrint($itemKeyList);
|
||||
$this->itemKeyList = Context::get('item_key');
|
||||
|
||||
// menu name update
|
||||
/*$args->menu_srl = $menuSrl;
|
||||
/*$args->menu_srl = $this->menuSrl;
|
||||
$output = executeQuery('menu.updateMenu', $args);
|
||||
if(!$output->toBool()) return $output;*/
|
||||
|
||||
if(is_array($parentKeyList))
|
||||
$this->map = array();
|
||||
foreach($parentKeyList as $no=>$srl)
|
||||
{
|
||||
$menuList = array();
|
||||
foreach($parentKeyList AS $key=>$value)
|
||||
{
|
||||
if($value == 0) $menuList[$itemKeyList[$key]] = array();
|
||||
if ($srl === 0) continue;
|
||||
if (!is_array($this->map[$srl]))$this->map[$srl] = array();
|
||||
$this->map[$srl][] = $no;
|
||||
}
|
||||
|
||||
$result = array();
|
||||
foreach($this->itemKeyList as $srl)
|
||||
{
|
||||
if (!$this->checked[$srl]){
|
||||
unset($target);
|
||||
$this->checked[$srl] = 1;
|
||||
$target->node = $srl;
|
||||
$target->child= array();
|
||||
|
||||
while(count($this->map[$srl])){
|
||||
$this->_setParent($srl, array_shift($this->map[$srl]), $target);
|
||||
}
|
||||
$result[] = $target;
|
||||
}
|
||||
}
|
||||
debugPrint($menuList);
|
||||
exit;
|
||||
|
||||
if(is_array($itemKeyList))
|
||||
if(is_array($result))
|
||||
{
|
||||
foreach($itemKeyList AS $key=>$value)
|
||||
foreach($result AS $key=>$node)
|
||||
{
|
||||
if($parentKeyList[$key] != 0)
|
||||
{
|
||||
$menuList[$parentKeyList[$key]][$value] = true;
|
||||
}
|
||||
$this->_recursiveMoveMenuItem($node);
|
||||
}
|
||||
}
|
||||
debugPrint($menuList);
|
||||
exit;
|
||||
|
||||
// menu item sorting
|
||||
if(is_array($childKeyList))
|
||||
{
|
||||
$menuList = array();
|
||||
foreach($childKeyList AS $key=>$value)
|
||||
{
|
||||
preg_match('/BEGIN_([0-9]*.)/is', $value, $m);
|
||||
if($m)
|
||||
{
|
||||
$menuList[$m[1]] = array();
|
||||
$parentSrl = $m[1];
|
||||
}
|
||||
else $menuList[$parentSrl][$value] = true;
|
||||
}
|
||||
|
||||
/*foreach($menuList AS $key=>$value)
|
||||
{
|
||||
if(count($value) > 0)
|
||||
{
|
||||
$sourceSrl = 0;
|
||||
foreach($value AS $key2=>$value2)
|
||||
{
|
||||
$this->moveMenuItem($menuSrl, $key, $sourceSrl, $key2, 'move');
|
||||
$sourceSrl = $key2;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
$this->setMessage('success_updated', 'info');
|
||||
if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) {
|
||||
|
|
@ -320,6 +301,34 @@
|
|||
}
|
||||
}
|
||||
|
||||
function _setParent($parent_srl, $child_index, &$target)
|
||||
{
|
||||
$child_srl = $this->itemKeyList[$child_index];
|
||||
$this->checked[$child_srl] = 1;
|
||||
|
||||
$child_node->node = $child_srl;
|
||||
$child_node->parent_node = $parent_srl;
|
||||
$child_node->child = array();
|
||||
$target->child[] = $child_node;
|
||||
|
||||
while(count($this->map[$child_srl])){
|
||||
$this->_setParent($child_srl, array_shift($this->map[$child_srl]), $child_node);
|
||||
}
|
||||
//return $target;
|
||||
}
|
||||
|
||||
function _recursiveMoveMenuItem($result)
|
||||
{
|
||||
while(count($result->child))
|
||||
{
|
||||
unset($node);
|
||||
$node = array_shift($result->child);
|
||||
|
||||
$this->moveMenuItem($this->menuSrl, $node->parent_node, 0, $node->node, 'move');
|
||||
$this->_recursiveMoveMenuItem($node);
|
||||
}
|
||||
}
|
||||
|
||||
function moveMenuItem($menu_srl,$parent_srl,$source_srl,$target_srl,$mode){
|
||||
// Get the original menus
|
||||
$oMenuAdminModel = &getAdminModel('menu');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue