コード例 #1
0
ファイル: tabledate.php プロジェクト: martinbrylski/admidio
 /**
  * Deletes the selected record of the table and all references in other tables.
  * After that the class will be initialize.
  * @return bool @b true if no error occurred
  */
 public function delete()
 {
     $this->db->startTransaction();
     $sql = 'DELETE FROM ' . TBL_DATE_ROLE . ' WHERE dtr_dat_id = ' . $this->getValue('dat_id');
     $this->db->query($sql);
     // if date has participants then the role with their memberships must be deleted
     if ($this->getValue('dat_rol_id') > 0) {
         $sql = 'UPDATE ' . TBL_DATES . ' SET dat_rol_id = NULL WHERE dat_id = ' . $this->getValue('dat_id');
         $this->db->query($sql);
         $dateRole = new TableRoles($this->db, $this->getValue('dat_rol_id'));
         $dateRole->delete();
     }
     parent::delete();
     return $this->db->endTransaction();
 }
コード例 #2
0
     $date->setValue('dat_rol_id', $role->getValue('rol_id'));
     $return_code = $date->save();
     if ($return_code < 0) {
         $role->delete();
         $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
     }
 } elseif ($_POST['date_registration_possible'] == 0 && $date->getValue('dat_rol_id') > 0) {
     // date participation was deselected -> delete flag in event and than delete role
     $role = new TableRoles($gDb, $date->getValue('dat_rol_id'));
     $date->setValue('dat_rol_id', '');
     $date->save();
     $role->delete();
 } elseif ($_POST['date_registration_possible'] == 1 && $date->getValue('dat_rol_id') > 0) {
     // if event exists and you could register to this event then we must check
     // if the data of the role must be changed
     $role = new TableRoles($gDb, $date->getValue('dat_rol_id'));
     // only change name of role if no custom name was set
     if (strpos($role->getValue('rol_name'), $gL10n->get('DAT_DATE')) !== false) {
         $roleName = $gL10n->get('DAT_DATE') . ' ' . $date->getValue('dat_begin', 'Y-m-d H:i') . ' - ' . $date->getValue('dat_id');
     } else {
         $roleName = $role->getValue('rol_name');
     }
     if ($role->getValue('rol_max_members') != $date->getValue('dat_max_members') || $role->getValue('role_name' != $roleName)) {
         $role->setValue('rol_name', $roleName);
         $role->setValue('rol_max_members', $date->getValue('dat_max_members'));
         $role->save();
     }
 }
 // check if flag is set that current user wants to participate as leader to the date
 if (isset($_POST['date_current_user_assigned']) && $_POST['date_current_user_assigned'] == 1 && !$gCurrentUser->isLeaderOfRole($date->getValue('dat_rol_id'))) {
     // user wants to participate -> add him to date
コード例 #3
0
ファイル: import_function.php プロジェクト: bash-t/admidio
unset($_SESSION['import_csv_request']);
// nur berechtigte User duerfen User importieren
if (!$gCurrentUser->editUsers()) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
if (strlen($_FILES['userfile']['tmp_name'][0]) == 0) {
    $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('SYS_FILE')));
} elseif ($_FILES['userfile']['error'][0] == 1) {
    //Dateigroesse ueberpruefen Servereinstellungen
    $gMessage->show($gL10n->get('SYS_FILE_TO_LARGE_SERVER', $gPreferences['max_file_upload_size']));
} elseif ($postRoleId == 0) {
    $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('SYS_ROLE')));
}
// Rolle einlesen und pruefen, ob der User diese selektieren kann und dadurch nicht
// evtl. ein Rollenzuordnungsrecht bekommt, wenn er es vorher nicht hatte
$role = new TableRoles($gDb, $postRoleId);
if ($gCurrentUser->hasRightViewRole($role->getValue('rol_id')) == false || $gCurrentUser->manageRoles() == false && $role->getValue('rol_assign_roles') == false) {
    $gMessage->show($gL10n->get('MEM_ROLE_SELECT_RIGHT', $role->getValue('rol_name')));
}
// read file in an array; auto-detect the line endings of different os
ini_set('auto_detect_line_endings', 1);
$_SESSION['file_lines'] = file($_FILES['userfile']['tmp_name'][0]);
$_SESSION['rol_id'] = $role->getValue('rol_id');
$_SESSION['user_import_mode'] = $postUserImportMode;
if ($postImportCoding == 'iso-8859-1') {
    // Daten der Datei erst einmal in UTF8 konvertieren, damit es damit spaeter keine Probleme gibt
    foreach ($_SESSION['file_lines'] as $key => $value) {
        $_SESSION['file_lines'][$key] = utf8_encode($value);
    }
}
// CSV-Import (im Moment gibt es nur diesen, spaeter muss hier dann unterschieden werden)
コード例 #4
0
ファイル: organization.php プロジェクト: bash-t/admidio
 /** Creates all necessary data for a new organization. This method can only be
  *  called once for an organization. It will create the basic categories, lists,
  *  roles, systemmails etc.
  *  @param $userId The id of the webmaster who creates the new organization.
  *                 This will be the first valid user of the new organization.
  */
 public function createBasicData($userId)
 {
     global $gL10n, $gProfileFields;
     // read id of system user from database
     $sql = 'SELECT usr_id FROM ' . TBL_USERS . '
              WHERE usr_login_name LIKE \'' . $gL10n->get('SYS_SYSTEM') . '\' ';
     $this->db->query($sql);
     $row = $this->db->fetch_array();
     $systemUserId = $row['usr_id'];
     // create all systemmail texts and write them into table adm_texts
     $systemmailsTexts = array('SYSMAIL_REGISTRATION_USER' => $gL10n->get('SYS_SYSMAIL_REGISTRATION_USER'), 'SYSMAIL_REGISTRATION_WEBMASTER' => $gL10n->get('SYS_SYSMAIL_REGISTRATION_WEBMASTER'), 'SYSMAIL_REFUSE_REGISTRATION' => $gL10n->get('SYS_SYSMAIL_REFUSE_REGISTRATION'), 'SYSMAIL_NEW_PASSWORD' => $gL10n->get('SYS_SYSMAIL_NEW_PASSWORD'), 'SYSMAIL_ACTIVATION_LINK' => $gL10n->get('SYS_SYSMAIL_ACTIVATION_LINK'));
     $text = new TableText($this->db);
     foreach ($systemmailsTexts as $key => $value) {
         // convert <br /> to a normal line feed
         $value = preg_replace('/<br[[:space:]]*\\/?[[:space:]]*>/', chr(13) . chr(10), $value);
         $text->clear();
         $text->setValue('txt_org_id', $this->getValue('org_id'));
         $text->setValue('txt_name', $key);
         $text->setValue('txt_text', $value);
         $text->save();
     }
     // create default category for roles, events and weblinks
     $sql = 'INSERT INTO ' . TBL_CATEGORIES . ' (cat_org_id, cat_type, cat_name_intern, cat_name, cat_hidden, cat_default, cat_sequence, cat_usr_id_create, cat_timestamp_create)
                                            VALUES (' . $this->getValue('org_id') . ', \'ROL\', \'COMMON\', \'SYS_COMMON\', 0, 1, 1, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')';
     $this->db->query($sql);
     $categoryCommon = $this->db->insert_id();
     $sql = 'INSERT INTO ' . TBL_CATEGORIES . ' (cat_org_id, cat_type, cat_name_intern, cat_name, cat_hidden, cat_default, cat_system, cat_sequence, cat_usr_id_create, cat_timestamp_create)
                                      VALUES (' . $this->getValue('org_id') . ', \'ROL\', \'GROUPS\',  \'INS_GROUPS\', 0, 0, 0, 2, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')
                                           , (' . $this->getValue('org_id') . ', \'ROL\', \'COURSES\', \'INS_COURSES\', 0, 0, 0, 3, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')
                                           , (' . $this->getValue('org_id') . ', \'ROL\', \'TEAMS\',   \'INS_TEAMS\', 0, 0, 0, 4, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')
                                           , (' . $this->getValue('org_id') . ', \'LNK\', \'COMMON\',  \'SYS_COMMON\', 0, 1, 0, 1, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')
                                           , (' . $this->getValue('org_id') . ', \'LNK\', \'INTERN\',  \'INS_INTERN\', 1, 0, 0, 2, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')
                                           , (' . $this->getValue('org_id') . ', \'DAT\', \'COMMON\',  \'SYS_COMMON\', 0, 1, 0, 1, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')
                                           , (' . $this->getValue('org_id') . ', \'DAT\', \'TRAINING\',\'INS_TRAINING\', 0, 0, 0, 2, ' . $systemUserId . ',\'' . DATETIME_NOW . '\')
                                           , (' . $this->getValue('org_id') . ', \'DAT\', \'COURSES\', \'INS_COURSES\', 0, 0, 0, 3, ' . $systemUserId . ',\'' . DATETIME_NOW . '\') ';
     $this->db->query($sql);
     // create default folder for download module in database
     $sql = 'INSERT INTO ' . TBL_FOLDERS . ' (fol_org_id, fol_type, fol_name, fol_path,
                                            fol_locked, fol_public, fol_timestamp)
                                     VALUES (' . $this->getValue('org_id') . ', \'DOWNLOAD\', \'download\', \'/adm_my_files\',
                                             0,1,\'' . DATETIME_NOW . '\')';
     $this->db->query($sql);
     // now create default roles
     // Create role webmaster
     $roleWebmaster = new TableRoles($this->db);
     $roleWebmaster->setValue('rol_cat_id', $categoryCommon);
     $roleWebmaster->setValue('rol_name', $gL10n->get('SYS_WEBMASTER'));
     $roleWebmaster->setValue('rol_description', $gL10n->get('INS_DESCRIPTION_WEBMASTER'));
     $roleWebmaster->setValue('rol_assign_roles', 1);
     $roleWebmaster->setValue('rol_approve_users', 1);
     $roleWebmaster->setValue('rol_announcements', 1);
     $roleWebmaster->setValue('rol_dates', 1);
     $roleWebmaster->setValue('rol_download', 1);
     $roleWebmaster->setValue('rol_guestbook', 1);
     $roleWebmaster->setValue('rol_guestbook_comments', 1);
     $roleWebmaster->setValue('rol_photo', 1);
     $roleWebmaster->setValue('rol_weblinks', 1);
     $roleWebmaster->setValue('rol_edit_user', 1);
     $roleWebmaster->setValue('rol_mail_to_all', 1);
     $roleWebmaster->setValue('rol_mail_this_role', 3);
     $roleWebmaster->setValue('rol_profile', 1);
     $roleWebmaster->setValue('rol_this_list_view', 1);
     $roleWebmaster->setValue('rol_all_lists_view', 1);
     $roleWebmaster->setValue('rol_webmaster', 1);
     $roleWebmaster->setValue('rol_inventory', 1);
     $roleWebmaster->save();
     // Create role member
     $roleMember = new TableRoles($this->db);
     $roleMember->setValue('rol_cat_id', $categoryCommon);
     $roleMember->setValue('rol_name', $gL10n->get('SYS_MEMBER'));
     $roleMember->setValue('rol_description', $gL10n->get('INS_DESCRIPTION_MEMBER'));
     $roleMember->setValue('rol_mail_this_role', 2);
     $roleMember->setValue('rol_profile', 1);
     $roleMember->setValue('rol_this_list_view', 1);
     $roleMember->setValue('rol_default_registration', 1);
     $roleMember->save();
     // Create role board
     $roleManagement = new TableRoles($this->db);
     $roleManagement->setValue('rol_cat_id', $categoryCommon);
     $roleManagement->setValue('rol_name', $gL10n->get('INS_BOARD'));
     $roleManagement->setValue('rol_description', $gL10n->get('INS_DESCRIPTION_BOARD'));
     $roleManagement->setValue('rol_announcements', 1);
     $roleManagement->setValue('rol_dates', 1);
     $roleManagement->setValue('rol_weblinks', 1);
     $roleManagement->setValue('rol_edit_user', 1);
     $roleManagement->setValue('rol_mail_to_all', 1);
     $roleManagement->setValue('rol_mail_this_role', 2);
     $roleManagement->setValue('rol_profile', 1);
     $roleManagement->setValue('rol_this_list_view', 1);
     $roleManagement->setValue('rol_all_lists_view', 1);
     $roleManagement->save();
     // Create membership for user in role 'Webmaster' and 'Members'
     $member = new TableMembers($this->db);
     $member->startMembership($roleWebmaster->getValue('rol_id'), $userId);
     $member->startMembership($roleMember->getValue('rol_id'), $userId);
     // create object with current user field structure
     $gProfileFields = new ProfileFields($this->db, $this->getValue('org_id'));
     // create default list configurations
     $addressList = new ListConfiguration($this->db);
     $addressList->setValue('lst_name', $gL10n->get('INS_ADDRESS_LIST'));
     $addressList->setValue('lst_org_id', $this->getValue('org_id'));
     $addressList->setValue('lst_global', 1);
     $addressList->setValue('lst_default', 1);
     $addressList->addColumn(1, $gProfileFields->getProperty('LAST_NAME', 'usf_id'), 'ASC');
     $addressList->addColumn(2, $gProfileFields->getProperty('FIRST_NAME', 'usf_id'), 'ASC');
     $addressList->addColumn(3, $gProfileFields->getProperty('BIRTHDAY', 'usf_id'));
     $addressList->addColumn(4, $gProfileFields->getProperty('ADDRESS', 'usf_id'));
     $addressList->addColumn(5, $gProfileFields->getProperty('POSTCODE', 'usf_id'));
     $addressList->addColumn(6, $gProfileFields->getProperty('CITY', 'usf_id'));
     $addressList->save();
     $phoneList = new ListConfiguration($this->db);
     $phoneList->setValue('lst_name', $gL10n->get('INS_PHONE_LIST'));
     $phoneList->setValue('lst_org_id', $this->getValue('org_id'));
     $phoneList->setValue('lst_global', 1);
     $phoneList->addColumn(1, $gProfileFields->getProperty('LAST_NAME', 'usf_id'), 'ASC');
     $phoneList->addColumn(2, $gProfileFields->getProperty('FIRST_NAME', 'usf_id'), 'ASC');
     $phoneList->addColumn(3, $gProfileFields->getProperty('PHONE', 'usf_id'));
     $phoneList->addColumn(4, $gProfileFields->getProperty('MOBILE', 'usf_id'));
     $phoneList->addColumn(5, $gProfileFields->getProperty('EMAIL', 'usf_id'));
     $phoneList->addColumn(6, $gProfileFields->getProperty('FAX', 'usf_id'));
     $phoneList->save();
     $contactList = new ListConfiguration($this->db);
     $contactList->setValue('lst_name', $gL10n->get('SYS_CONTACT_DETAILS'));
     $contactList->setValue('lst_org_id', $this->getValue('org_id'));
     $contactList->setValue('lst_global', 1);
     $contactList->addColumn(1, $gProfileFields->getProperty('LAST_NAME', 'usf_id'), 'ASC');
     $contactList->addColumn(2, $gProfileFields->getProperty('FIRST_NAME', 'usf_id'), 'ASC');
     $contactList->addColumn(3, $gProfileFields->getProperty('BIRTHDAY', 'usf_id'));
     $contactList->addColumn(4, $gProfileFields->getProperty('ADDRESS', 'usf_id'));
     $contactList->addColumn(5, $gProfileFields->getProperty('POSTCODE', 'usf_id'));
     $contactList->addColumn(6, $gProfileFields->getProperty('CITY', 'usf_id'));
     $contactList->addColumn(7, $gProfileFields->getProperty('PHONE', 'usf_id'));
     $contactList->addColumn(8, $gProfileFields->getProperty('MOBILE', 'usf_id'));
     $contactList->addColumn(9, $gProfileFields->getProperty('EMAIL', 'usf_id'));
     $contactList->save();
     $formerList = new ListConfiguration($this->db);
     $formerList->setValue('lst_name', $gL10n->get('INS_MEMBERSHIP'));
     $formerList->setValue('lst_org_id', $this->getValue('org_id'));
     $formerList->setValue('lst_global', 1);
     $formerList->addColumn(1, $gProfileFields->getProperty('LAST_NAME', 'usf_id'));
     $formerList->addColumn(2, $gProfileFields->getProperty('FIRST_NAME', 'usf_id'));
     $formerList->addColumn(3, $gProfileFields->getProperty('BIRTHDAY', 'usf_id'));
     $formerList->addColumn(4, 'mem_begin');
     $formerList->addColumn(5, 'mem_end', 'DESC');
     $formerList->save();
 }
コード例 #5
0
 *         8 - set role visible
 *         9 - return if role has former members ? Return: 1 und 0
 *
 *****************************************************************************/
require_once '../../system/common.php';
require_once '../../system/login_valid.php';
// Initialize and check the parameters
$getRoleId = admFuncVariableIsValid($_GET, 'rol_id', 'int');
$getMode = admFuncVariableIsValid($_GET, 'mode', 'int', array('requireValue' => true));
// only members who are allowed to create and edit roles should have access to
// most of these functions
if (!$gCurrentUser->manageRoles() && $getMode != 9) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
// Rollenobjekt anlegen
$role = new TableRoles($gDb);
if ($getRoleId > 0) {
    $role->readDataById($getRoleId);
    // Pruefung, ob die Rolle zur aktuellen Organisation gehoert
    if ($role->getValue('cat_org_id') != $gCurrentOrganization->getValue('org_id') && $role->getValue('cat_org_id') > 0) {
        $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
    }
}
$_SESSION['roles_request'] = $_POST;
if ($getMode === 1) {
    // create html page object
    $page = new HtmlPage($gL10n->get('ROL_ROLE_DELETE'));
    // add back link to module menu
    $messageMenu = $page->getMenu();
    $messageMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'back.png');
    $page->addHtml('
コード例 #6
0
ファイル: messages_write.php プロジェクト: sistlind/admidio
         $act_group = $gL10n->get('SYS_ROLES') . ' (' . $gL10n->get('LST_FORMER_MEMBERS') . ')';
         $act_group_short = '(' . $gL10n->get('SYS_FORMER_PL') . ')';
         $act_number = '-1';
     } elseif ($act_or === 2) {
         $act_group = $gL10n->get('SYS_ROLES') . ' (' . $gL10n->get('LST_ACTIVE_FORMER_MEMBERS') . ')';
         $act_group_short = '(' . $gL10n->get('MSG_ACTIVE_FORMER_SHORT') . ')';
         $act_number = '-2';
     } else {
         $act_group = $gL10n->get('SYS_ROLES') . ' (' . $gL10n->get('LST_ACTIVE_MEMBERS') . ')';
         $act_number = '';
     }
     // list array with all roles where user is allowed to send mail to
     $send_roles = $gCurrentUser->getAllMailRoles();
     foreach ($send_roles as &$allowed_role) {
         // Rollenobjekt anlegen
         $role = new TableRoles($gDb);
         $role->readDataById($allowed_role);
         if ($act_number == '' || $role->hasFormerMembers($allowed_role) > 0 && $gPreferences['mail_show_former'] == 1) {
             $list[] = array('groupID: ' . $allowed_role . $act_number, $role->getValue('rol_name') . ' ' . $act_group_short, $act_group);
             $list_rol_id_array[] = $allowed_role;
         }
     }
 }
 foreach (array_unique($list_rol_id_array) as $key) {
     if (isset($list_rol_id)) {
         $list_rol_id .= ", '" . $key . "'";
     } else {
         $list_rol_id = "'" . $key . "'";
     }
 }
 // select Users
コード例 #7
0
ファイル: lists_show.php プロジェクト: martinbrylski/admidio
if ($numberRoles > 1) {
    $sql = 'SELECT rol_id, rol_name
              FROM ' . TBL_ROLES . '
             WHERE rol_id IN (' . implode(',', $roleIds) . ')';
    $rolesStatement = $gDb->query($sql);
    $rolesData = $rolesStatement->fetchAll();
    // check if user has right to view all roles
    foreach ($rolesData as $role) {
        if (!$gCurrentUser->hasRightViewRole($role['rol_id'])) {
            $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
        }
        $htmlSubHeadline .= ', ' . $role['rol_name'];
    }
    $htmlSubHeadline = substr($htmlSubHeadline, 2);
} else {
    $role = new TableRoles($gDb, $roleIds[0]);
    // check if user has right to view role
    if (!$gCurrentUser->hasRightViewRole($roleIds[0])) {
        $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
    }
    $roleName = $role->getValue('rol_name');
    $htmlSubHeadline .= $role->getValue('cat_name');
}
// if no list parameter is set then load role default list configuration or system default list configuration
if ($numberRoles === 1 && $getListId === 0) {
    // set role default list configuration
    $getListId = $role->getDefaultList();
    if ($getListId === 0) {
        $gMessage->show($gL10n->get('LST_DEFAULT_LIST_NOT_SET_UP'));
    }
}
コード例 #8
0
        }
        // If start-date is later/bigger or on same day than end-date we show an error
        if ($formatedStartDate > $formatedEndDate) {
            exit($gL10n->get('SYS_DATE_END_BEFORE_BEGIN'));
        }
    } else {
        $formatedEndDate = '9999-12-31';
    }
    // save role membership
    $user->editRoleMembership($getMemberId, $formatedStartDate, $formatedEndDate);
    echo 'success';
} elseif ($getMode === 8) {
    // Export every member of a role into one vCard file
    if ($gCurrentUser->hasRightViewRole($getRoleId)) {
        // create filename of organization name and role name
        $role = new TableRoles($gDb, $getRoleId);
        $filename = $gCurrentOrganization->getValue('org_shortname') . '-' . str_replace('.', '', $role->getValue('rol_name')) . '.vcf';
        // for IE the filename must have special chars in hexadecimal
        if (preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) {
            $filename = urlencode($filename);
        }
        header('Content-Type: text/x-vcard; charset=iso-8859-1');
        header('Content-Disposition: attachment; filename="' . $filename . '"');
        // necessary for IE, because without it the download with SSL has problems
        header('Cache-Control: private');
        header('Pragma: public');
        // Ein Leiter darf nur Rollen zuordnen, bei denen er auch Leiter ist
        $sql = 'SELECT
                    bm.mem_usr_id
                FROM
                    ' . TBL_MEMBERS . ' bm
コード例 #9
0
ファイル: roles.php プロジェクト: sistlind/admidio
             WHERE bm.mem_usr_id  = ' . $gCurrentUser->getValue('usr_id') . '
                 AND bm.mem_begin  <= \'' . DATE_NOW . '\'
                 AND bm.mem_end     > \'' . DATE_NOW . '\'
                 AND bm.mem_leader  = 1
                 AND rol_id         = bm.mem_rol_id
                 AND rol_leader_rights IN (' . ROLE_LEADER_MEMBERS_ASSIGN . ',' . ROLE_LEADER_MEMBERS_ASSIGN_EDIT . ')
                 AND rol_valid      = 1
                 AND rol_visible    = 1
                 AND rol_cat_id     = cat_id
                 AND (  cat_org_id  = ' . $gCurrentOrganization->getValue('org_id') . '
                     OR cat_org_id IS NULL )
             ORDER BY cat_sequence, cat_id, rol_name';
}
$statement = $gDb->query($sql);
$category = '';
$role = new TableRoles($gDb);
while ($row = $statement->fetch()) {
    $columnValues = array();
    $memberChecked = '';
    $memberDisabled = '';
    $leaderChecked = '';
    $leaderDisabled = '';
    $role->setArray($row);
    if ($role->getValue('rol_visible') == 1) {
        // if user is assigned to this role
        // or if user is created in members.php of list module
        if ($row['mem_usr_id'] > 0 || $role->getValue('rol_id') == $setRoleId) {
            $memberChecked = ' checked="checked" ';
        }
        // if role is webmaster than only webmaster can add new user,
        // but don't change their own membership, because there must be at least one webmaster
コード例 #10
0
ファイル: lists_show.php プロジェクト: bash-t/admidio
$getMode = admFuncVariableIsValid($_GET, 'mode', 'string', array('requireValue' => true, 'validValues' => array('csv-ms', 'csv-oo', 'html', 'print', 'pdf', 'pdfl')));
$getListId = admFuncVariableIsValid($_GET, 'lst_id', 'numeric');
$getRoleId = admFuncVariableIsValid($_GET, 'rol_id', 'numeric');
$getStart = admFuncVariableIsValid($_GET, 'start', 'numeric');
$getShowMembers = admFuncVariableIsValid($_GET, 'show_members', 'numeric');
$getFullScreen = admFuncVariableIsValid($_GET, 'full_screen', 'numeric');
// Initialize the content of this parameter (otherwise some servers will keep the content)
unset($role_ids);
if ($getRoleId > 0) {
    $role_ids[] = $getRoleId;
} else {
    $role_ids = $_SESSION['role_ids'];
    $getRoleId = $role_ids[0];
}
// Rollenobjekt erzeugen
$role = new TableRoles($gDb, $getRoleId);
//Testen ob Recht zur Listeneinsicht besteht
if ($role->viewRole() == false) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
// if no list parameter is set then load role default list configuration or system default list configuration
if ($getListId == 0) {
    // set role default list configuration
    $getListId = $role->getDefaultList();
    if ($getListId == 0) {
        $gMessage->show($gL10n->get('LST_DEFAULT_LIST_NOT_SET_UP'));
    }
}
// initialize some special mode parameters
$separator = '';
$valueQuotes = '';
コード例 #11
0
ファイル: roles_functions.php プロジェクト: bash-t/admidio
function getRoleMemberships($htmlListId, $user, $result_role, $count_role, $directOutput)
{
    global $gDb, $gL10n, $gCurrentUser, $gPreferences, $g_root_path, $gProfileFields;
    $countShowRoles = 0;
    $member = new TableMembers($gDb);
    $role = new TableRoles($gDb);
    $roleMemHTML = '<ul class="list-group admidio-list-roles-assign" id="' . $htmlListId . '">';
    while ($row = $gDb->fetch_array($result_role)) {
        if ($gCurrentUser->hasRightViewRole($row['mem_rol_id']) && $row['rol_visible'] == 1) {
            $formerMembership = false;
            $futureMembership = false;
            $showRoleEndDate = false;
            $deleteMode = 'pro_role';
            $member->clear();
            $member->setArray($row);
            $role->clear();
            $role->setArray($row);
            // if membership will not end, then don't show end date
            if (strcmp($member->getValue('mem_end', 'Y-m-d'), '9999-12-31') != 0) {
                $showRoleEndDate = true;
            }
            // check if membership ends in the past
            if (strcmp(DATE_NOW, $member->getValue('mem_end', 'Y-m-d')) > 0) {
                $formerMembership = true;
                $deleteMode = 'pro_former';
            }
            // check if membership starts in the future
            if (strcmp($member->getValue('mem_begin', 'Y-m-d'), DATE_NOW) > 0) {
                $futureMembership = true;
                $deleteMode = 'pro_future';
            }
            // create list entry for one role
            $roleMemHTML .= '
            <li class="list-group-item" id="role_' . $row['mem_rol_id'] . '">
                <ul class="list-group admidio-list-roles-assign-pos">
                    <li class="list-group-item">
                        <span>' . $role->getValue('cat_name') . ' - ';
            if ($gCurrentUser->hasRightViewRole($member->getValue('mem_rol_id'))) {
                $roleMemHTML .= '<a href="' . $g_root_path . '/adm_program/modules/lists/lists_show.php?mode=html&amp;rol_id=' . $member->getValue('mem_rol_id') . '" title="' . $role->getValue('rol_description') . '">' . $role->getValue('rol_name') . '</a>';
            } else {
                echo $role->getValue('rol_name');
            }
            if ($member->getValue('mem_leader') == 1) {
                $roleMemHTML .= ' - ' . $gL10n->get('SYS_LEADER');
            }
            $roleMemHTML .= '&nbsp;
                        </span>
                        <span class="pull-right text-right">';
            if ($showRoleEndDate == true) {
                $roleMemHTML .= $gL10n->get('SYS_SINCE_TO', $member->getValue('mem_begin', $gPreferences['system_date']), $member->getValue('mem_end', $gPreferences['system_date']));
            } elseif ($futureMembership == true) {
                $roleMemHTML .= $gL10n->get('SYS_FROM', $member->getValue('mem_begin', $gPreferences['system_date']));
            } else {
                $roleMemHTML .= $gL10n->get('SYS_SINCE', $member->getValue('mem_begin', $gPreferences['system_date']));
            }
            if ($role->allowedToAssignMembers($gCurrentUser)) {
                // You are not allowed to delete your own webmaster membership, other roles could be deleted
                if ($role->getValue('rol_webmaster') == 1 && $gCurrentUser->getValue('usr_id') != $user->getValue('usr_id') || $role->getValue('rol_webmaster') == 0) {
                    $roleMemHTML .= '
                                    <a class="admidio-icon-link" data-toggle="modal" data-target="#admidio_modal"
                                        href="' . $g_root_path . '/adm_program/system/popup_message.php?type=' . $deleteMode . '&amp;element_id=role_' . $role->getValue('rol_id') . '&amp;database_id=' . $member->getValue('mem_id') . '&amp;name=' . urlencode($role->getValue('rol_name')) . '"><img
                                        src="' . THEME_PATH . '/icons/delete.png" alt="' . $gL10n->get('PRO_CANCEL_MEMBERSHIP') . '" title="' . $gL10n->get('PRO_CANCEL_MEMBERSHIP') . '" /></a>';
                } else {
                    $roleMemHTML .= '
                                    <a class="admidio-icon-link"><img src="' . THEME_PATH . '/icons/dummy.png" alt=""/></a>';
                }
                // do not edit webmaster role
                if ($row['rol_webmaster'] == 0) {
                    $roleMemHTML .= '<a class="admidio-icon-link" style="cursor:pointer;" onclick="profileJS.toggleDetailsOn(' . $member->getValue('mem_id') . ')"><img
                                        src="' . THEME_PATH . '/icons/edit.png" alt="' . $gL10n->get('PRO_CHANGE_DATE') . '" title="' . $gL10n->get('PRO_CHANGE_DATE') . '" /></a>';
                } else {
                    $roleMemHTML .= '<a class="admidio-icon-link"><img src="' . THEME_PATH . '/icons/dummy.png" alt=""/></a>';
                }
            }
            // only show info if system setting is activated
            if ($gPreferences['system_show_create_edit'] > 0) {
                $roleMemHTML .= '<a class="admidio-icon-link admMemberInfo" id="member_info_' . $member->getValue('mem_id') . '" href="javascript:"><img src="' . THEME_PATH . '/icons/info.png" alt="' . $gL10n->get('SYS_INFORMATIONS') . '" title="' . $gL10n->get('SYS_INFORMATIONS') . '"/></a>';
            }
            $roleMemHTML .= '</span>
                    </li>
                    <li class="list-group-item" id="membership_period_' . $member->getValue('mem_id') . '" style="visibility: hidden; display: none;"><div class="collapse navbar-collapse">';
            $form = new HtmlForm('membership_period_form_' . $member->getValue('mem_id'), $g_root_path . '/adm_program/modules/profile/profile_function.php?mode=7&amp;user_id=' . $user->getValue('usr_id') . '&amp;mem_id=' . $row['mem_id'], null, array('type' => 'navbar', 'setFocus' => false, 'class' => 'admidio-form-membership-period'));
            $form->addInput('membership_start_date_' . $member->getValue('mem_id'), $gL10n->get('SYS_START'), $member->getValue('mem_begin', $gPreferences['system_date']), array('type' => 'date', 'maxLength' => 10));
            $form->addInput('membership_end_date_' . $member->getValue('mem_id'), $gL10n->get('SYS_END'), $member->getValue('mem_end', $gPreferences['system_date']), array('type' => 'date', 'maxLength' => 10));
            $form->addSubmitButton('btn_send_' . $member->getValue('mem_id'), $gL10n->get('SYS_OK'));
            $roleMemHTML .= $form->show(false);
            $roleMemHTML .= '</div></li>
                    <li class="list-group-item" id="member_info_' . $member->getValue('mem_id') . '_Content" style="display: none;">';
            // show informations about user who creates the recordset and changed it
            $roleMemHTML .= admFuncShowCreateChangeInfoById($member->getValue('mem_usr_id_create'), $member->getValue('mem_timestamp_create'), $member->getValue('mem_usr_id_change'), $member->getValue('mem_timestamp_change')) . '
                    </li>
                </ul>
            </li>';
            $countShowRoles++;
        }
    }
    if ($countShowRoles == 0) {
        $roleMemHTML = '<div class="block-padding">' . $gL10n->get('PRO_NO_ROLES_VISIBLE') . '</div>';
    } else {
        $roleMemHTML .= '</ul>';
    }
    if ($directOutput) {
        echo $roleMemHTML;
        return '';
    } else {
        return $roleMemHTML;
    }
}
コード例 #12
0
    }
}
// Get list configurations
$listConfigurations = $lists->getListConfigurations();
foreach ($listConfigurations as &$rowConfigurations) {
    if ($rowConfigurations[2] == 0) {
        $rowConfigurations[2] = $gL10n->get('LST_YOUR_LISTS');
    } else {
        $rowConfigurations[2] = $gL10n->get('LST_GENERAL_LISTS');
    }
}
// add list item for own list
// @ptabaden: Removed myList item
// $listConfigurations[] = array('mylist', $gL10n->get('LST_CREATE_OWN_LIST'), $gL10n->get('LST_CONFIGURATION'));
// Create role object
$role = new TableRoles($gDb);
foreach ($listsResult['recordset'] as $row) {
    // Put data to Roleobject
    $role->setArray($row);
    // if category is different than previous, close old and open new one
    if ($previousCategoryId != $role->getValue('cat_id')) {
        // close only if previous category is not 0
        if ($previousCategoryId != 0) {
            $page->addHtml('</div></div></div>');
        }
        $page->addHtml('<div class="panel panel-primary">
            <div class="panel-heading">' . $role->getValue('cat_name') . '</div>
            <div class="panel-body">
                <div class="panel-group" id="accordion_' . $role->getValue('cat_id') . '">');
        $previousCategoryId = $role->getValue('cat_id');
    }
コード例 #13
0
     // if only send mail to one user than this user must be in a role the current user is allowed to see
     $listVisibleRoleArray = $gCurrentUser->getAllVisibleRoles();
 } else {
     // list array with all roles where user is allowed to send mail to
     $sql = 'SELECT rol_id, rol_name
               FROM ' . TBL_ROLES . '
         INNER JOIN ' . TBL_CATEGORIES . '
                 ON cat_id = rol_cat_id
              WHERE rol_id IN (' . $sqlRoleIds . ')
                    ' . $sqlParticipationRoles . '
           ORDER BY rol_name ASC';
     $rolesStatement = $gDb->query($sql);
     $rolesArray = $rolesStatement->fetchAll();
     foreach ($rolesArray as $roleArray) {
         // Rollenobjekt anlegen
         $role = new TableRoles($gDb);
         $role->setArray($roleArray);
         $list[] = array('groupID: ' . $roleArray['rol_id'], $roleArray['rol_name'], $gL10n->get('SYS_ROLES') . ' (' . $gL10n->get('LST_ACTIVE_MEMBERS') . ')');
         $listRoleIdsArray[] = $roleArray['rol_id'];
         if ($role->hasFormerMembers() > 0 && $gPreferences['mail_show_former'] == 1) {
             // list role with former members
             $listFormer[] = array('groupID: ' . $roleArray['rol_id'] . '-1', $roleArray['rol_name'] . ' ' . '(' . $gL10n->get('SYS_FORMER_PL') . ')', $gL10n->get('SYS_ROLES') . ' (' . $gL10n->get('LST_FORMER_MEMBERS') . ')');
             // list role with active and former members
             $listActiveAndFormer[] = array('groupID: ' . $roleArray['rol_id'] . '-2', $roleArray['rol_name'] . ' ' . '(' . $gL10n->get('MSG_ACTIVE_FORMER_SHORT') . ')', $gL10n->get('SYS_ROLES') . ' (' . $gL10n->get('LST_ACTIVE_FORMER_MEMBERS') . ')');
         }
     }
     $list = array_merge($list, $listFormer, $listActiveAndFormer);
     $listVisibleRoleArray = array_intersect($listRoleIdsArray, $gCurrentUser->getAllVisibleRoles());
 }
 if ($getRoleId === 0 && count($listVisibleRoleArray) > 0) {
     // if no special role was preselected then list users
コード例 #14
0
ファイル: roles.php プロジェクト: bash-t/admidio
$table->setDatatablesAlternativOrderColumns(1, 2);
$table->setDatatablesColumnsHide(2);
$table->setDatatablesGroupColumn(1);
$table->addRowHeadingByArray($columnHeading);
$cat_id = '';
// list all roles group by category
$sql = 'SELECT * FROM ' . TBL_ROLES . ', ' . TBL_CATEGORIES . '
            WHERE rol_cat_id  = cat_id
                AND cat_type    = \'ROL\'
                    ' . $sqlRolesStatus . '
                AND (  cat_org_id = ' . $gCurrentOrganization->getValue('org_id') . '
                     OR cat_org_id IS NULL )
            ORDER BY cat_sequence ASC, rol_name ASC ';
$rol_result = $gDb->query($sql);
// Create role object
$role = new TableRoles($gDb);
while ($row = $gDb->fetch_array($rol_result)) {
    $assignRoles = '';
    $listView = '';
    $linkAdministration = '';
    // Add data to role object
    $role->setArray($row);
    $categoryName = $role->getValue('cat_name');
    if ($role->getValue('cat_hidden') == 1) {
        $categoryName .= '<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/user_key.png"
                             alt="' . $gL10n->get('SYS_VISIBLE_TO_USERS', $gL10n->get('SYS_ROLE')) . '" title="' . $gL10n->get('SYS_VISIBLE_TO_USERS', $gL10n->get('SYS_ROLE')) . '" />';
    }
    if ($role->getValue('rol_assign_roles') == 1) {
        $assignRoles .= '<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/roles.png"
                            alt="' . $gL10n->get('ROL_RIGHT_ASSIGN_ROLES') . '" title="' . $gL10n->get('ROL_RIGHT_ASSIGN_ROLES') . '" />';
    }
コード例 #15
0
 /**
  * This method deletes all roles that belongs to still deleted dates.
  */
 public function updateStepDeleteDateRoles()
 {
     $sql = 'SELECT rol_id
               FROM ' . TBL_ROLES . '
         INNER JOIN ' . TBL_CATEGORIES . '
                 ON cat_id = rol_cat_id
              WHERE cat_name_intern LIKE \'CONFIRMATION_OF_PARTICIPATION\'
                AND NOT exists (SELECT 1
                                  FROM ' . TBL_DATES . '
                                 WHERE dat_rol_id = rol_id)';
     $rolesStatement = $this->db->query($sql);
     while ($row = $rolesStatement->fetch()) {
         $role = new TableRoles($this->db, $row['rol_id']);
         $role->delete();
     }
 }
コード例 #16
0
ファイル: roles_new.php プロジェクト: sistlind/admidio
// Initialize and check the parameters
$getRoleId = admFuncVariableIsValid($_GET, 'rol_id', 'numeric');
// Initialize local parameters
$showSystemCategory = false;
// only users with the special right are allowed to manage roles
if (!$gCurrentUser->manageRoles()) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
if ($getRoleId > 0) {
    $headline = $gL10n->get('ROL_EDIT_ROLE');
} else {
    $headline = $gL10n->get('SYS_CREATE_ROLE');
}
$gNavigation->addUrl(CURRENT_URL, $headline);
// Rollenobjekt anlegen
$role = new TableRoles($gDb);
if ($getRoleId > 0) {
    $role->readDataById($getRoleId);
    // Pruefung, ob die Rolle zur aktuellen Organisation gehoert
    if ($role->getValue('cat_org_id') != $gCurrentOrganization->getValue('org_id') && $role->getValue('cat_org_id') > 0) {
        $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
    }
    // Rolle Webmaster darf nur vom Webmaster selber erstellt oder gepflegt werden
    if ($role->getValue('rol_webmaster') == 1 && !$gCurrentUser->isWebmaster()) {
        $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
    }
    // hidden roles can also see hidden categories
    if ($role->getValue('cat_system') == 1) {
        $showSystemCategory = true;
    }
} else {
コード例 #17
0
ファイル: dates_function.php プロジェクト: bash-t/admidio
     $date->setValue('dat_rol_id', $role->getValue('rol_id'));
     $return_code = $date->save();
     if ($return_code < 0) {
         $role->delete();
         $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
     }
 } elseif ($_POST['date_registration_possible'] == 0 && $date->getValue('dat_rol_id') > 0) {
     // date participation was deselected -> delete flag in event and than delete role
     $role = new TableRoles($gDb, $date->getValue('dat_rol_id'));
     $date->setValue('dat_rol_id', '');
     $date->save();
     $role->delete();
 } elseif ($_POST['date_registration_possible'] == 1 && $date->getValue('dat_rol_id') > 0) {
     // if event exists and you could register to this event then we must check
     // if the data of the role must be changed
     $role = new TableRoles($gDb, $date->getValue('dat_rol_id'));
     $roleName = $gL10n->get('DAT_DATE') . ' ' . $date->getValue('dat_begin', 'Y-m-d H:i') . ' - ' . $date->getValue('dat_id');
     if ($role->getValue('rol_max_members') != $date->getValue('dat_max_members') || $role->getValue('role_name' != $roleName)) {
         $role->setValue('rol_name', $roleName);
         $role->setValue('rol_max_members', $date->getValue('dat_max_members'));
         $role->save();
     }
 }
 // check if flag is set that current user wants to participate as leader to the date
 if (isset($_POST['date_current_user_assigned']) && $_POST['date_current_user_assigned'] == 1 && $gCurrentUser->isLeaderOfRole($date->getValue('dat_rol_id')) == false) {
     // user wants to participate -> add him to date
     $member = new TableMembers($gDb);
     $member->startMembership($role->getValue('rol_id'), $gCurrentUser->getValue('usr_id'), 1);
 } elseif (isset($_POST['date_current_user_assigned']) == false && $gCurrentUser->isMemberOfRole($date->getValue('dat_rol_id')) == true) {
     // user does't want to participate as leader -> remove his participation as leader from the event,
     // dont remove the participation itself!
コード例 #18
0
ファイル: lists.php プロジェクト: sistlind/admidio
        require_once '../../system/login_valid.php';
    }
}
// Get list configurations
$listConfigurations = $lists->getListConfigurations();
foreach ($listConfigurations as &$rowConfigurations) {
    if ($rowConfigurations[2] == 0) {
        $rowConfigurations[2] = $gL10n->get('LST_YOUR_LISTS');
    } else {
        $rowConfigurations[2] = $gL10n->get('LST_GENERAL_LISTS');
    }
}
// add list item for own list
$listConfigurations[] = array('mylist', $gL10n->get('LST_CREATE_OWN_LIST'), $gL10n->get('LST_CONFIGURATION'));
// Create role object
$role = new TableRoles($gDb);
foreach ($listsResult['recordset'] as $row) {
    // Put data to Roleobject
    $role->setArray($row);
    // if category is different than previous, close old and open new one
    if ($previousCategoryId != $role->getValue('cat_id')) {
        // close only if previous category is not 0
        if ($previousCategoryId != 0) {
            $page->addHtml('</div></div></div>');
        }
        $page->addHtml('<div class="panel panel-primary">
            <div class="panel-heading">' . $role->getValue('cat_name') . '</div>
            <div class="panel-body">
                <div class="panel-group" id="accordion_' . $role->getValue('cat_id') . '">');
        $previousCategoryId = $role->getValue('cat_id');
    }
コード例 #19
0
 *****************************************************************************/
require_once '../../system/common.php';
require_once '../../system/login_valid.php';
if (isset($_GET['mode']) && $_GET['mode'] === 'assign') {
    // ajax mode then only show text if error occurs
    $gMessage->showTextOnly(true);
}
// Initialize and check the parameters
$getMode = admFuncVariableIsValid($_GET, 'mode', 'string', array('defaultValue' => 'html', 'validValues' => array('html', 'assign')));
$getRoleId = admFuncVariableIsValid($_GET, 'rol_id', 'numeric', array('requireValue' => true, 'directOutput' => true));
$getUserId = admFuncVariableIsValid($_GET, 'usr_id', 'numeric', array('directOutput' => true));
$getFilterRoleId = admFuncVariableIsValid($_GET, 'filter_rol_id', 'numeric');
$getMembersShowAll = admFuncVariableIsValid($_GET, 'mem_show_all', 'boolean');
$_SESSION['set_rol_id'] = $getRoleId;
// create object of the commited role
$role = new TableRoles($gDb, $getRoleId);
// roles of other organizations can't be edited
if ($role->getValue('cat_org_id') != $gCurrentOrganization->getValue('org_id') && $role->getValue('cat_org_id') > 0) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
// check if user is allowed to assign members to this role
if (!$role->allowedToAssignMembers($gCurrentUser)) {
    $gMessage->show($gL10n->get('SYS_NO_RIGHTS'));
}
if ($getMembersShowAll == 1) {
    $getFilterRoleId = 0;
}
if ($getFilterRoleId > 0) {
    if (!$gCurrentUser->hasRightViewRole($getFilterRoleId)) {
        $gMessage->show($gL10n->get('LST_NO_RIGHTS_VIEW_LIST'));
    }
コード例 #20
0
     INNER JOIN ' . TBL_CATEGORIES . '
             ON cat_id = rol_cat_id
     INNER JOIN ' . TBL_ORGANIZATIONS . '
             ON org_id = cat_org_id
          WHERE mem_usr_id  = ' . $user->getValue('usr_id') . '
            AND mem_begin  <= \'' . DATE_NOW . '\'
            AND mem_end    >= \'' . DATE_NOW . '\'
            AND rol_valid   = 1
            AND rol_visible = 1
            AND org_id     <> ' . $gCurrentOrganization->getValue('org_id') . '
       ORDER BY org_shortname, cat_sequence, rol_name';
 $roleStatement = $gDb->query($sql);
 if ($roleStatement->rowCount() > 0) {
     $showRolesOtherOrganizations = false;
     $actualOrganization = 0;
     $role = new TableRoles($gDb);
     while ($row = $roleStatement->fetch()) {
         // if roles of new organization than read the rights of this organization
         if ($actualOrganization != $row['org_id']) {
             $gCurrentUser->setOrganization($row['org_id']);
             $actualOrganization = $row['org_id'];
         }
         // check if current user has right to view the role of that organization
         if ($gCurrentUser->hasRightViewRole($row['rol_id'])) {
             $role->clear();
             $role->setArray($row);
             if (!$showRolesOtherOrganizations) {
                 $page->addHtml('
                 <div class="panel panel-default" id="profile_other_orga_roles_box">
                     <div class="panel-heading">' . $gL10n->get('PRO_ROLE_MEMBERSHIP_OTHER_ORG') . HtmlForm::getHelpTextIcon('PRO_VIEW_ROLES_OTHER_ORGAS') . '
                     </div>
コード例 #21
0
ファイル: componentupdate.php プロジェクト: sistlind/admidio
 /**
  * This method deletes all roles that belongs to still deleted dates.
  */
 public function updateStepDeleteDateRoles()
 {
     $sql = 'select rol_id from ' . TBL_CATEGORIES . ', ' . TBL_ROLES . '
              where cat_name_intern LIKE \'CONFIRMATION_OF_PARTICIPATION\'
                and rol_cat_id = cat_id
                and not exists (select 1 from ' . TBL_DATES . ' where dat_rol_id = rol_id)';
     $rolesStatement = $this->db->query($sql);
     while ($row = $rolesStatement->fetch()) {
         $role = new TableRoles($this->db, $row['rol_id']);
         $role->delete();
     }
 }
コード例 #22
0
ファイル: login.php プロジェクト: martinbrylski/admidio
$headline = $gL10n->get('SYS_LOGIN');
// remember url (will be removed in cookie_check)
$gNavigation->addUrl(CURRENT_URL, $headline);
// read id of webmaster role
$sql = 'SELECT rol_id
          FROM ' . TBL_ROLES . '
    INNER JOIN ' . TBL_CATEGORIES . '
            ON cat_id = rol_cat_id
         WHERE rol_name LIKE \'' . $gL10n->get('SYS_WEBMASTER') . '\'
           AND rol_webmaster = 1
           AND (  cat_org_id = ' . $gCurrentOrganization->getValue('org_id') . '
               OR cat_org_id IS NULL )';
$pdoStatement = $gDb->query($sql);
$row = $pdoStatement->fetch();
// create role object for webmaster
$roleWebmaster = new TableRoles($gDb, $row['rol_id']);
// create html page object
$page = new HtmlPage($headline);
// add back link to module menu
$loginMenu = $page->getMenu();
$loginMenu->addItem('menu_item_back', $gNavigation->getPreviousUrl(), $gL10n->get('SYS_BACK'), 'back.png');
// show form
$form = new HtmlForm('login_form', $g_root_path . '/adm_program/system/login_check.php', $page, array('showRequiredFields' => false));
$form->addInput('usr_login_name', $gL10n->get('SYS_USERNAME'), null, array('maxLength' => 35, 'property' => FIELD_REQUIRED, 'class' => 'form-control-small'));
// TODO Future: 'minLength' => 8
$form->addInput('usr_password', $gL10n->get('SYS_PASSWORD'), null, array('type' => 'password', 'property' => FIELD_REQUIRED, 'class' => 'form-control-small'));
// show selectbox with all organizations of database
if ($gPreferences['system_organization_select'] == 1) {
    $sql = 'SELECT org_id, org_longname
              FROM ' . TBL_ORGANIZATIONS . '
          ORDER BY org_longname ASC, org_shortname ASC';