* [bug#60364] Add the module for parent dropdown.
This commit is contained in:
@@ -1955,8 +1955,9 @@ class doc extends control
|
||||
if($parentID || (isset($doc) && $doc->parent))
|
||||
{
|
||||
$chapterAndDocs = $this->doc->getDocsOfLibs(array($libID), $objectType, $docID);
|
||||
$modulePairs = empty($libID) || $modalType == 'chapter' ? array() : $this->loadModel('tree')->getOptionMenu($libID, 'doc', 0);
|
||||
if(!isset($chapterAndDocs[$doc->parent])) $chapterAndDocs[$doc->parent] = $this->doc->fetchByID($doc->parent);
|
||||
$chapterAndDocs = $this->doc->buildNestedDocs($chapterAndDocs);
|
||||
$chapterAndDocs = $this->doc->buildNestedDocs($chapterAndDocs, $modulePairs);
|
||||
$this->view->chapterAndDocs = $chapterAndDocs;
|
||||
}
|
||||
|
||||
|
||||
+26
-5
@@ -3986,11 +3986,32 @@ class docModel extends model
|
||||
* 构建文档层级。
|
||||
*
|
||||
* @param array $docs
|
||||
* @param array $modules
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function buildNestedDocs(array $docs): array
|
||||
public function buildNestedDocs(array $docs, array $modules = array()): array
|
||||
{
|
||||
if(!empty($modules))
|
||||
{
|
||||
$moduleList = array();
|
||||
$modules = $this->dao->select('*')->from(TABLE_MODULE)->where('id')->in(array_keys($modules))->fetchAll('id');
|
||||
foreach($modules as $moduleID => $module)
|
||||
{
|
||||
$module->id = 'm_' . $module->id;
|
||||
$module->title = $module->name;
|
||||
$module->parent = empty($module->parent) ? 0 : 'm_' . $module->parent;
|
||||
$moduleList['m_' . $moduleID] = $module;
|
||||
}
|
||||
|
||||
foreach($docs as $doc)
|
||||
{
|
||||
if(empty($doc->parent) && !empty($doc->module)) $doc->parent = 'm_' . $doc->module;
|
||||
}
|
||||
|
||||
$docs = $docs + $moduleList;
|
||||
}
|
||||
|
||||
$children = array();
|
||||
foreach($docs as $doc) $children[$doc->parent][] = $doc;
|
||||
|
||||
@@ -4013,13 +4034,13 @@ class docModel extends model
|
||||
/**
|
||||
* 构建文档items。
|
||||
*
|
||||
* @param int $docID
|
||||
* @param string $docTitle
|
||||
* @param array $children
|
||||
* @param int|string $docID
|
||||
* @param string $docTitle
|
||||
* @param array $children
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function buildDocItems(int $docID, string $docTitle, array $children): array
|
||||
public function buildDocItems(int|string $docID, string $docTitle, array $children): array
|
||||
{
|
||||
$items = array('value' => $docID, 'text' => $docTitle);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user