// echo $mainSql; exit(); } catch (AdmException $e) { $e->showHtml(); } // determine the number of users in this list $listStatement = $gDb->query($mainSql); $numMembers = $listStatement->rowCount(); // get all members and their data of this list in an array $membersList = $listStatement->fetchAll(); if ($numMembers == 0) { // Es sind keine Daten vorhanden ! $gMessage->show($gL10n->get('LST_NO_USER_FOUND')); } // define title (html) and headline $title = $gL10n->get('LST_LIST') . ' - ' . $roleName; if (strlen($list->getValue('lst_name')) > 0) { $headline = $roleName . ' - ' . $list->getValue('lst_name'); } else { $headline = $roleName; } // if html mode and last url was not a list view then save this url to navigation stack if ($getMode === 'html' && strpos($gNavigation->getUrl(), 'lists_show.php') === false) { $gNavigation->addUrl(CURRENT_URL); } if ($getMode !== 'csv') { $datatable = false; $hoverRows = false; if ($getShowMembers === 0) { $htmlSubHeadline .= ' - ' . $gL10n->get('LST_ACTIVE_MEMBERS'); } elseif ($getShowMembers === 1) { $htmlSubHeadline .= ' - ' . $gL10n->get('LST_FORMER_MEMBERS');
} if (!isset($formValues['sel_roles_ids'])) { $formValues['sel_roles_ids'] = 0; } // falls vorher schon Zeilen fuer Spalten manuell hinzugefuegt wurden, // muessen diese nun direkt angelegt werden for ($i = $defaultColumnRows + 1; $i > 0; ++$i) { if (isset($formValues['column' . $i])) { ++$defaultColumnRows; } else { $i = -1; } } } else { $formValues['sel_select_configuation'] = $getListId; $formValues['cbx_global_configuration'] = $list->getValue('lst_global'); $formValues['sel_roles_ids'] = $getRoleId; $formValues['sel_show_members'] = $getShowMembers; // if a saved configuration was loaded then add columns to formValues array if ($getListId > 0) { $defaultColumnRows = $list->countColumns(); for ($number = 1; $number <= $list->countColumns(); ++$number) { $column = $list->getColumnObject($number); if ($column->getValue('lsc_usf_id') > 0) { $column_content = $column->getValue('lsc_usf_id'); } else { $column_content = $column->getValue('lsc_special_field'); } $formValues['column' . $number] = $column_content; $formValues['sort' . $number] = $column->getValue('lsc_sort'); $formValues['condition' . $number] = $column->getValue('lsc_filter');
} // Zeitstempel der Konfigurationen ohne Namen oder Namen anzeigen if (strlen($tableList->getValue('lst_name')) == 0) { $description = $tableList->getValue('lst_timestamp', $gPreferences['system_date'] . ' ' . $gPreferences['system_time']); } else { $description = $tableList->getValue('lst_name'); } // Comboboxeintrag ausgeben $page->addHtml('<option ' . $selected . ' value="' . $tableList->getValue('lst_id') . '">' . $description . '</option>'); } } $page->addHtml('</optgroup>'); } $page->addHtml('</select>'); // Listen speichern darf man speichern, wenn es Eigene sind, Neue oder als Webmaster auch Systemlisten if ($gCurrentUser->isWebmaster() && $list->getValue('lst_global') == 1 || $gCurrentUser->getValue('usr_id') == $list->getValue('lst_usr_id') && strlen($list->getValue('lst_name')) > 0) { $page->addHtml(' <a class="admidio-icon-link" href="javascript:send(\'save\');"> <img src="' . THEME_PATH . '/icons/disk.png" alt="' . $gL10n->get('LST_SAVE_CONFIGURATION') . '" title="' . $gL10n->get('LST_SAVE_CONFIGURATION') . '" /> </a>'); } if ($gCurrentUser->isWebmaster() || $getListId == 0 || $gCurrentUser->getValue('usr_id') == $list->getValue('lst_usr_id')) { if (strlen($list->getValue('lst_name')) > 0) { $icon = 'disk_copy.png'; $icon_text = $gL10n->get('LST_SAVE_CONFIGURATION_OTHER_NAME'); } else { $icon = 'disk.png'; $icon_text = $gL10n->get('LST_SAVE_CONFIGURATION'); } $page->addHtml(' <a class="admidio-icon-link" href="javascript:send(\'save_as\');">
if (!isset($_POST['column1']) || strlen($_POST['column1']) === 0) { $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', '1. ' . $gL10n->get('LST_COLUMN'))); } // Rolle muss beim Anzeigen gefuellt sein if ($getMode === 2 && (!isset($_POST['sel_roles_ids']) || $_POST['sel_roles_ids'] == 0 || !is_array($_POST['sel_roles_ids']))) { $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('SYS_ROLE'))); } if (!isset($_POST['sel_show_members'])) { $_POST['sel_show_members'] = 0; } // Listenobjekt anlegen $list = new ListConfiguration($gDb, $getListId); // pruefen, ob Benutzer die Rechte hat, diese Liste zu bearbeiten if ($getMode !== 2) { // globale Listen duerfen nur von Webmastern editiert werden if ($list->getValue('lst_global') == 1 && !$gCurrentUser->isWebmaster()) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); } elseif ($list->getValue('lst_usr_id') != $gCurrentUser->getValue('usr_id') && $list->getValue('lst_global') == 0 && $list->getValue('lst_id') > 0) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); } } // Liste speichern if ($getMode === 1 || $getMode === 2) { // alle vorhandenen Spalten durchgehen for ($columnNumber = 1; isset($_POST['column' . $columnNumber]); ++$columnNumber) { if (strlen($_POST['column' . $columnNumber]) > 0) { $list->addColumn($columnNumber, $_POST['column' . $columnNumber], $_POST['sort' . $columnNumber], $_POST['condition' . $columnNumber]); } else { $list->deleteColumn($columnNumber, true); } }
} if (isset($_POST['show_members']) == false) { $_POST['show_members'] = 0; } // Ehemalige if (array_key_exists('former', $_POST)) { $member_status = 1; } else { $member_status = 0; } // Listenobjekt anlegen $list = new ListConfiguration($gDb, $getListId); // pruefen, ob Benutzer die Rechte hat, diese Liste zu bearbeiten if ($getMode != 2) { // globale Listen duerfen nur von Webmastern editiert werden if ($list->getValue('lst_global') == 1 && $gCurrentUser->isWebmaster() == false) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); } elseif ($list->getValue('lst_usr_id') != $gCurrentUser->getValue('usr_id') && $list->getValue('lst_global') == 0 && $list->getValue('lst_id') > 0) { $gMessage->show($gL10n->get('SYS_NO_RIGHTS')); } } // Liste speichern if ($getMode == 1 || $getMode == 2 || $getMode == 4) { // alle vorhandenen Spalten durchgehen $columnNumber = 0; for ($number = 1; isset($_POST['column' . $number]); $number++) { if (strlen($_POST['column' . $number]) > 0) { $columnNumber++; $list->addColumn($columnNumber, $_POST['column' . $number], $_POST['sort' . $number], $_POST['conditioncolumn' . $number]); } else { $list->deleteColumn($number, true);
/** * 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') . '\' '; $systemUserStatement = $this->db->query($sql); $row = $systemUserStatement->fetch(); $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->lastInsertId(); $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->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(); // set addresslist to default configuration $sql = 'UPDATE ' . TBL_PREFERENCES . ' SET prf_value = \'' . $addressList->getValue('lst_id') . '\' WHERE prf_org_id = ' . $this->getValue('org_id') . ' AND prf_name = \'lists_default_configuation\' '; $this->db->query($sql); $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(); }