static function getHeadForObject($tab_object, $fk_object)
 {
     global $db, $conf, $langs, $user;
     $head = array();
     if (empty($tab_object)) {
         return $head;
     }
     if ($tab_object === 'product') {
         dol_include_once('/product/class/product.class.php');
         dol_include_once('/core/lib/product.lib.php');
         $object = new Product($db);
         $object->fetch($fk_object);
         $head = product_prepare_head($object);
     } else {
         if ($tab_object === 'thirdparty') {
             dol_include_once('/societe/class/societe.class.php');
             dol_include_once('/core/lib/company.lib.php');
             $object = new Societe($db);
             $object->fetch($fk_object);
             $head = societe_prepare_head($object);
         } else {
             if ($tab_object === 'contact') {
                 dol_include_once('/contact/class/contact.class.php');
                 dol_include_once('/core/lib/contact.lib.php');
                 $object = new Contact($db);
                 $object->fetch($fk_object);
                 $head = contact_prepare_head($object);
             } else {
                 if ($tab_object === 'user') {
                     dol_include_once('/user/class/user.class.php');
                     dol_include_once('/core/lib/usergroups.lib.php');
                     $object = new User($db);
                     $object->fetch($fk_object);
                     $head = user_prepare_head($object);
                 } else {
                     if ($tab_object === 'group') {
                         dol_include_once('/user/class/usergroup.class.php');
                         dol_include_once('/lib/usergroups.lib.php');
                         $object = new UserGroup($db);
                         $object->fetch($fk_object);
                         $head = group_prepare_head($object);
                     } else {
                         if ($tab_object === 'project') {
                             dol_include_once('/projet/class/project.class.php');
                             dol_include_once('/core/lib/project.lib.php');
                             $object = new Project($db);
                             $object->fetch($fk_object);
                             $head = project_prepare_head($object);
                         }
                     }
                 }
             }
         }
     }
     return $head;
 }
Esempio n. 2
0
        $editgroup->delrights($rights, $module);
    }
}
/**
 * View
 */
$form = new Form($db);
llxHeader('', $langs->trans("Permissions"));
if ($id) {
    $fgroup = new Usergroup($db);
    $fgroup->fetch($id);
    $fgroup->getrights();
    /*
     * Affichage onglets
     */
    $head = group_prepare_head($fgroup);
    $title = $langs->trans("Group");
    dol_fiche_head($head, 'rights', $title, 0, 'group');
    // Charge les modules soumis a permissions
    $modules = array();
    $modulesdir = dolGetModulesDirs();
    $db->begin();
    foreach ($modulesdir as $dir) {
        // Load modules attributes in arrays (name, numero, orders) from dir directory
        //print $dir."\n<br>";
        $handle = @opendir(dol_osencode($dir));
        if (is_resource($handle)) {
            while (($file = readdir($handle)) !== false) {
                if (is_readable($dir . $file) && substr($file, 0, 3) == 'mod' && substr($file, dol_strlen($file) - 10) == '.class.php') {
                    $modName = substr($file, 0, dol_strlen($file) - 10);
                    if ($modName) {
Esempio n. 3
0
    print "</td></tr>\n";
    // Other attributes
    $parameters = array('object' => $object, 'colspan' => ' colspan="2"');
    $reshook = $hookmanager->executeHooks('formObjectOptions', $parameters, $object, $action);
    // Note that $action and $object may have been modified by hook
    if (empty($reshook) && !empty($extrafields->attribute_label)) {
        print $object->showOptionals($extrafields, 'edit');
    }
    print "</table>\n";
    dol_fiche_end();
    print '<div class="center"><input class="button" value="' . $langs->trans("CreateGroup") . '" type="submit"></div>';
    print "</form>";
} else {
    if ($id) {
        $object->fetch($id);
        $head = group_prepare_head($object);
        $title = $langs->trans("Group");
        /*
         * Confirmation suppression
         */
        if ($action == 'delete') {
            print $form->formconfirm($_SERVER['PHP_SELF'] . "?id=" . $object->id, $langs->trans("DeleteAGroup"), $langs->trans("ConfirmDeleteGroup", $object->name), "confirm_delete", '', 0, 1);
        }
        /*
         * Fiche en mode visu
         */
        if ($action != 'edit') {
            dol_fiche_head($head, 'group', $title, 0, 'group');
            print '<table class="border" width="100%">';
            // Ref
            print '<tr><td width="25%">' . $langs->trans("Ref") . '</td>';