*[misc] add method.
This commit is contained in:
@@ -807,7 +807,7 @@ class doc extends control
|
||||
* 产品/项目/执行/团队空间。
|
||||
* ProductSpace/ProjectSpace/ExecutionSpace/TeamSpace.
|
||||
*
|
||||
* @param string $type custom|product|project|execution
|
||||
* @param string $type custom|product|project|execution|doctemplate
|
||||
* @param int $objectID
|
||||
* @param int $libID
|
||||
* @param int $moduleID
|
||||
|
||||
+21
-14
@@ -965,20 +965,25 @@ class docModel extends model
|
||||
{
|
||||
if(common::isTutorialMode()) return $this->loadModel('tutorial')->getSubSpaces('custom');
|
||||
|
||||
$objectLibs = $this->dao->select('*')->from(TABLE_DOCLIB)
|
||||
->where('type')->eq('custom')
|
||||
->andWhere('deleted')->eq(0)
|
||||
->andWhere('parent')->eq(0)
|
||||
->andWhere('vision')->eq($this->config->vision)
|
||||
->fetchAll();
|
||||
return $this->getSpacePairs('custom');
|
||||
}
|
||||
|
||||
$pairs = array();
|
||||
foreach($objectLibs as $lib)
|
||||
{
|
||||
if($this->checkPrivLib($lib)) $pairs[$lib->id] = $lib->name;
|
||||
}
|
||||
/**
|
||||
* 获取团队空间下的空间。
|
||||
* Get team spaces.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDocTemplateSpaces()
|
||||
{
|
||||
if(common::isTutorialMode()) return $this->loadModel('tutorial')->getTeamSpaces();
|
||||
|
||||
return $pairs;
|
||||
return $this->getSpacePairs('doctemplate');
|
||||
}
|
||||
|
||||
public function initDocTemplateSpaces()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2299,12 +2304,14 @@ class docModel extends model
|
||||
}
|
||||
else
|
||||
{
|
||||
if($type == 'custom')
|
||||
if($type == 'custom' || $type == 'doctemplate')
|
||||
{
|
||||
$spaces = $this->getTeamSpaces();
|
||||
$spaces = $type == 'custom' ? $this->getTeamSpaces() : $this->getDocTemplateSpaces();
|
||||
|
||||
if(empty($objectID)) $objectID = (int)key($spaces);
|
||||
if(!isset($spaces[$objectID])) $objectID = (int)key($spaces);
|
||||
}
|
||||
|
||||
$libs = $this->getLibsByObject($type, $objectID, $appendLib);
|
||||
if(($libID == 0 || !isset($libs[$libID])) && !empty($libs)) $libID = reset($libs)->id;
|
||||
if(isset($libs[$libID])) $objectDropdown['text'] = zget($libs[$libID], 'name', '');
|
||||
|
||||
@@ -220,6 +220,32 @@ class docTao extends docModel
|
||||
->fetchAll('id');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取空间。
|
||||
* Get space pairs.
|
||||
*
|
||||
* @param string $type
|
||||
* @access protected
|
||||
* @return array
|
||||
*/
|
||||
protected function getSpacePairs(string $type): array
|
||||
{
|
||||
$objectLibs = $this->dao->select('*')->from(TABLE_DOCLIB)
|
||||
->where('type')->eq($type)
|
||||
->andWhere('deleted')->eq(0)
|
||||
->andWhere('parent')->eq(0)
|
||||
->andWhere('vision')->eq($this->config->vision)
|
||||
->fetchAll();
|
||||
|
||||
$pairs = array();
|
||||
foreach($objectLibs as $lib)
|
||||
{
|
||||
if($this->checkPrivLib($lib)) $pairs[$lib->id] = $lib->name;
|
||||
}
|
||||
|
||||
return $pairs;
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新文档。
|
||||
* Update document.
|
||||
|
||||
@@ -2109,6 +2109,18 @@ class tutorialModel extends model
|
||||
if($type == 'mine') return array(1 => 'Test My Space');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取新手模式团队空间。
|
||||
* Get team spaces.
|
||||
*
|
||||
* @access public
|
||||
* @return array
|
||||
*/
|
||||
public function getDocTemplateSpaces(): array
|
||||
{
|
||||
return array(1 => 'Doc Template Space');
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取新手模式文档库。
|
||||
* Get doc lib.
|
||||
|
||||
Reference in New Issue
Block a user