diff --git a/module/group/control.php b/module/group/control.php
index 64a41f23bb..48f0b25ced 100644
--- a/module/group/control.php
+++ b/module/group/control.php
@@ -561,14 +561,18 @@ class group extends control
* Add recommendation.
*
* @param string $privIdList
+ * @param string $type depend|recommend
* @access public
* @return void
*/
- public function addRecommendation($privIdList)
+ public function addRelation($privIdList, $type)
{
+ if(strpos("depend|recommend", $type) === false) return print('Error type');
+
if($_POST)
{
- $this->group->saveRelation($privIdList, 'recommend');
+ $this->group->saveRelation($privIdList, $type);
+ if(strpos($privIdList, ',') === false) print(js::execute("if(typeof(parent.parent.getSideRelation) == 'function') parent.parent.getSideRelation({$privIdList})"));
return print(js::reload('parent'));
}
@@ -579,34 +583,49 @@ class group extends control
$this->view->privs = $privs;
$this->view->modules = array('' => $this->lang->group->selectModule) + $this->group->getMenuModules(null, true);
$this->view->modulePrivs = $this->group->getPrivByModule($modules);
- $this->view->recommends = $this->group->getPrivRelation($privIdList, 'recommend');
+ $this->view->relations = $this->group->getPrivRelation($privIdList, $type);
+ $this->view->type = $type;
$this->display();
}
+ /**
+ * Delete relation.
+ *
+ * @param string $type
+ * @param int $privID
+ * @param int $relationPriv
+ * @access public
+ * @return void
+ */
+ public function deleteRelation($type, $privID, $relationPriv)
+ {
+ $this->dao->delete()->from(TABLE_PRIVRELATION)->where('type')->eq($type)->andWhere('priv')->eq($privID)->andWhere('relationPriv')->eq($relationPriv)->exec();
+ }
+
/**
* Ajax get priv tree.
*
* @param string $privIdList
* @param string $module
+ * @param string $type recommend|depend
* @access public
* @return void
*/
- public function ajaxGetPrivTree($privIdList, $module)
+ public function ajaxGetPrivTree($privIdList, $module, $type = 'recommend')
{
if(is_string($privIdList)) $privIdList = explode(',', $privIdList);
$modules = $this->group->getMenuModules(null, true);
$modulePrivs = $this->group->getPrivByModule($module);
- $recommends = $this->group->getPrivRelation($privIdList, 'recommend', $module);
+ $relations = $this->group->getPrivRelation($privIdList, $type, $module);
$tree = "
-
group->addRecommendation;?>
+ group->addDependent : $lang->group->addRecommendation;?>
@@ -43,8 +39,7 @@
$modulePriv):?>
-
- - module}]", array($id => $modulePriv->name), (empty($recommends) or isset($recommends[$id])) ? $id : '')?>
+ - $modulePriv->name), (empty($relations) or isset($relations[$id])) ? $id : '')?>
@@ -57,19 +52,5 @@
-
+
diff --git a/module/group/view/editmanagepriv.html.php b/module/group/view/editmanagepriv.html.php
index 6da4f38a02..9c3583aeb1 100644
--- a/module/group/view/editmanagepriv.html.php
+++ b/module/group/view/editmanagepriv.html.php
@@ -26,25 +26,24 @@