* Refactor doc::mySpace method.
This commit is contained in:
@@ -1082,73 +1082,6 @@ class docModel extends model
|
||||
$this->dao->update(TABLE_DOC)->data($doc)->where('id')->eq($docID)->exec();
|
||||
}
|
||||
|
||||
/**
|
||||
* Build search form.
|
||||
*
|
||||
* @param string $libID
|
||||
* @param array $libs
|
||||
* @param int $queryID
|
||||
* @param string $actionURL
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function buildSearchForm($libID, $libs, $queryID, $actionURL, $type)
|
||||
{
|
||||
$this->loadModel('product');
|
||||
|
||||
if($this->app->rawMethod == 'contribute')
|
||||
{
|
||||
$this->config->doc->search['module'] = 'contributeDoc';
|
||||
$products = $this->product->getPairs();
|
||||
|
||||
$this->config->doc->search['params']['project']['values'] = $this->loadModel('project')->getPairsByProgram(0, 'all', false, 'order_asc', $this->config->vision == 'rnd' ? 'kanban' : '') + array('all' => $this->lang->doc->allProjects);
|
||||
$this->config->doc->search['params']['execution']['values'] = $this->loadModel('execution')->getPairs(0, 'sprint,stage', 'multiple,leaf,noprefix,withobject') + array('all' => $this->lang->doc->allExecutions);
|
||||
$this->config->doc->search['params']['lib']['values'] = $this->loadModel('doc')->getLibs('all', 'withObject') + array('all' => $this->lang->doclib->all);
|
||||
$this->config->doc->search['params']['product']['values'] = $products + array('all' => $this->lang->doc->allProduct);
|
||||
|
||||
unset($this->config->doc->search['fields']['module']);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!isset($libs[$libID])) $libs[$libID] = $this->getLibById($libID);
|
||||
|
||||
$libPairs = array();
|
||||
$queryName = $type . 'libDoc';
|
||||
foreach($libs as $lib)
|
||||
{
|
||||
if(empty($lib)) continue;
|
||||
if($lib->type == 'api') continue;
|
||||
$libPairs[$lib->id] = $lib->name;
|
||||
}
|
||||
|
||||
if($type == 'project')
|
||||
{
|
||||
$this->config->doc->search['params']['execution']['values'] = $this->loadModel('execution')->getPairs($this->session->project, 'sprint,stage', 'multiple,leaf,noprefix') + array('all' => $this->lang->doc->allExecutions);
|
||||
}
|
||||
else
|
||||
{
|
||||
if($type == 'mine' or $type == 'createdby')
|
||||
{
|
||||
unset($this->config->doc->search['fields']['addedBy']);
|
||||
if($type == 'mine') unset($this->config->doc->search['fields']['editedBy']);
|
||||
}
|
||||
unset($this->config->doc->search['fields']['execution']);
|
||||
}
|
||||
|
||||
if(in_array($type, array('view', 'collect', 'createdby', 'editedby'))) $libPairs = $this->getLibs('all', 'withObject');
|
||||
|
||||
$this->config->doc->search['module'] = $queryName;
|
||||
$this->config->doc->search['params']['lib']['values'] = $libPairs + array('all' => $this->lang->doclib->all);
|
||||
unset($this->config->doc->search['fields']['product']);
|
||||
unset($this->config->doc->search['fields']['module']);
|
||||
}
|
||||
|
||||
$this->config->doc->search['actionURL'] = $actionURL;
|
||||
$this->config->doc->search['queryID'] = $queryID;
|
||||
|
||||
$this->loadModel('search')->setSearchParams($this->config->doc->search);
|
||||
}
|
||||
|
||||
/**
|
||||
* Build search query.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user