function loadRight() { $rightManager = new Right(); $rights = $rightManager->loadAll(array('rank' => $this->getRank())); $sectionManager = new Section(); foreach ($rights as $right) { $section = $sectionManager->getById($right->getSection()); if (is_object($section)) { $this->rights[$section->getLabel()]['c'] = $right->getCreate() == '1' ? true : false; $this->rights[$section->getLabel()]['r'] = $right->getRead() == '1' ? true : false; $this->rights[$section->getLabel()]['u'] = $right->getUpdate() == '1' ? true : false; $this->rights[$section->getLabel()]['d'] = $right->getDelete() == '1' ? true : false; } else { $rightManager->delete(array('section' => $right->getSection())); } } }
$tpl->assign('label_rank', $selected->getLabel()); $tpl->assign('description_rank', $selected->getDescription()); } else { $description = "Ajout d'un rang"; $button = "Ajouter"; } $tpl->assign('description', $description); $tpl->assign('button', $button); $tpl->assign('ranks', $ranks); break; case 'right': $rightManager = new Right(); $sectionManager = new Section(); $rank = new Rank(); $rank = $rank->getById($_['id']); $rights = $rightManager->loadAll(array('rank' => $_['id'])); $rightsDictionnary = array(); foreach ($rights as $value) { $rightsDictionnary[$value->getSection()]['c'] = $value->getCreate(); $rightsDictionnary[$value->getSection()]['r'] = $value->getRead(); $rightsDictionnary[$value->getSection()]['u'] = $value->getUpdate(); $rightsDictionnary[$value->getSection()]['d'] = $value->getDelete(); } $tpl->assign('rights', $rightsDictionnary); $tpl->assign('sections', $sectionManager->populate('label')); $tpl->assign('rank', $rank); break; } $view = 'setting'; } else { exit('Vous devez être connecté');