* Fix doc getlibs method.
This commit is contained in:
+1
-17
@@ -387,22 +387,6 @@ class doc extends control
|
||||
$this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'locate' => $this->createLink('doc', 'view', "docID=$docID")));
|
||||
}
|
||||
|
||||
$libs = $this->doc->getLibs();
|
||||
foreach($libs as $id => $libName)
|
||||
{
|
||||
$lib = $this->doc->getLibById($id);
|
||||
if($lib->project != 0)
|
||||
{
|
||||
$project = $this->loadModel('project')->getByID($lib->project);
|
||||
$libs[$id] = $project->name . '/' . $libName;
|
||||
}
|
||||
if($lib->product != 0)
|
||||
{
|
||||
$product = $this->loadModel('product')->getByID($lib->product);
|
||||
$libs[$id] = $product->name . '/' . $libName;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get doc and set menu. */
|
||||
$doc = $this->doc->getById($docID);
|
||||
$libID = $doc->lib;
|
||||
@@ -420,7 +404,7 @@ class doc extends control
|
||||
$this->view->doc = $doc;
|
||||
$this->view->moduleOptionMenu = $this->tree->getOptionMenu($libID, 'doc', $startModuleID = 0);
|
||||
$this->view->type = $type;
|
||||
$this->view->libs = $libs;
|
||||
$this->view->libs = $this->doc->getCompleteLibName();
|
||||
$this->view->groups = $this->loadModel('group')->getPairs();
|
||||
$this->view->users = $this->user->getPairs('noletter', $doc->users);
|
||||
$this->display();
|
||||
|
||||
@@ -1523,4 +1523,24 @@ class docModel extends model
|
||||
|
||||
return $actions;
|
||||
}
|
||||
|
||||
public function getCompleteLibName()
|
||||
{
|
||||
$libPairs = array();
|
||||
$products = $this->loadModel('product')->getPairs();
|
||||
$projects = $this->loadModel('project')->getPairs();
|
||||
$stmt = $this->dao->select('id,project,product,name')->from(TABLE_DOCLIB)->where('deleted')->eq(0)->query();
|
||||
|
||||
while($lib = $stmt->fetch())
|
||||
{
|
||||
if($this->checkPrivLib($lib))
|
||||
{
|
||||
if($lib->product != 0) $lib->name = zget($products, $lib->product) . '/' . $lib->name;
|
||||
if($lib->project != 0) $lib->name = zget($projects, $lib->project) . '/' . $lib->name;
|
||||
$libPairs[$lib->id] = $lib->name;
|
||||
}
|
||||
}
|
||||
|
||||
return $libPairs;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user