Exemplo n.º 1
0
function getFieldCode($fieldNameIntern, $user)
{
    global $gPreferences, $g_root_path, $gCurrentUser, $gProfileFields, $gL10n;
    $html = array('label' => '', 'value' => '');
    $value = '';
    $msg_image = '';
    if (!$gCurrentUser->hasRightEditProfile($user) && $gProfileFields->getProperty($fieldNameIntern, 'usf_hidden') == 1) {
        return '';
    }
    // get value of field in html format
    $value = $user->getValue($fieldNameIntern, 'html');
    // if birthday then show age
    if ($gProfileFields->getProperty($fieldNameIntern, 'usf_name_intern') === 'BIRTHDAY') {
        $birthday = new DateTimeExtended($user->getValue($fieldNameIntern, 'Y.m.d'), 'Y.m.d');
        $value = $value . '   (' . $birthday->getAge() . ' ' . $gL10n->get('PRO_YEARS') . ')';
    } elseif (strlen($gProfileFields->getProperty($fieldNameIntern, 'usf_icon')) > 0) {
        $value = $gProfileFields->getProperty($fieldNameIntern, 'usf_icon') . '  ' . $value;
    }
    // show html of field, if user has a value for that field or it's a checkbox field
    if (strlen($user->getValue($fieldNameIntern)) > 0 || $gProfileFields->getProperty($fieldNameIntern, 'usf_type') === 'CHECKBOX') {
        $html['label'] = $gProfileFields->getProperty($fieldNameIntern, 'usf_name');
        $html['value'] = $value;
    }
    return $html;
}
 /**
  * @covers DateTimeExtended::getNextWorkingDay
  */
 public function testGetNextWorkingDayTest()
 {
     $date1 = new DateTimeExtended('2015-09-25');
     $this->assertEquals('2015-09-29', $date1->getNextWorkingDay()->format('Y-m-d'));
     $date2 = new DateTimeExtended('2015-10-02');
     $this->assertEquals('2015-10-05', $date2->getNextWorkingDay()->format('Y-m-d'));
     $date3 = new DateTimeExtended('2015-04-03');
     $this->assertEquals('2015-04-07', $date3->getNextWorkingDay()->format('Y-m-d'));
     $date4 = new DateTimeExtended('2010-04-02');
     $this->assertEquals('2010-04-06', $date4->getNextWorkingDay()->format('Y-m-d'));
     $date5 = new DateTimeExtended('2008-03-21');
     $this->assertEquals('2008-03-25', $date5->getNextWorkingDay()->format('Y-m-d'));
     $date6 = new DateTimeExtended('2004-04-09');
     $this->assertEquals('2004-04-13', $date6->getNextWorkingDay()->format('Y-m-d'));
 }
Exemplo n.º 3
0
function getFieldCode($fieldNameIntern, $user)
{
    global $gPreferences, $g_root_path, $gCurrentUser, $gProfileFields, $gL10n;
    $html = array('label' => '', 'value' => '');
    $value = '';
    $msg_image = '';
    if (!$gCurrentUser->hasRightEditProfile($user) && $gProfileFields->getProperty($fieldNameIntern, 'usf_hidden') == 1) {
        return '';
    }
    // get value of field in html format
    $value = $user->getValue($fieldNameIntern, 'html');
    // if birthday then show age
    if ($gProfileFields->getProperty($fieldNameIntern, 'usf_name_intern') === 'BIRTHDAY') {
        $birthday = new DateTimeExtended($user->getValue($fieldNameIntern, 'Y.m.d'), 'Y.m.d');
        $value = $value . '   (' . $birthday->getAge() . ' ' . $gL10n->get('PRO_YEARS') . ')';
    }
    // Icons der Messenger anzeigen
    if ($gProfileFields->getProperty($fieldNameIntern, 'usf_name_intern') === 'ICQ') {
        if (strlen($user->getValue($fieldNameIntern)) > 0) {
            // Sonderzeichen aus der ICQ-Nummer entfernen (damit kommt www.icq.com nicht zurecht)
            preg_match_all('/\\d+/', $user->getValue($fieldNameIntern), $matches);
            $icq_number = implode("", reset($matches));
            // ICQ Onlinestatus anzeigen
            $value = '
            <a class="admidio-icon-link" href="http://www.icq.com/people/cmd.php?uin=' . $icq_number . '&amp;action=add"><img
                src="http://status.icq.com/online.gif?icq=' . $icq_number . '&amp;img=5"
                alt="' . $gL10n->get('PRO_TO_ADD', $user->getValue($fieldNameIntern), $gProfileFields->getProperty($fieldNameIntern, 'usf_name')) . '"
                title="' . $gL10n->get('PRO_TO_ADD', $user->getValue($fieldNameIntern), $gProfileFields->getProperty($fieldNameIntern, 'usf_name')) . '" /></a> ' . $value;
        }
    } elseif ($gProfileFields->getProperty($fieldNameIntern, 'usf_name_intern') === 'SKYPE') {
        if (strlen($user->getValue($fieldNameIntern)) > 0) {
            // Skype Onlinestatus anzeigen
            $value = '<script type="text/javascript" src="http://download.skype.com/share/skypebuttons/js/skypeCheck.js"></script>
            <a class="admidio-icon-link" href="skype:' . $user->getValue($fieldNameIntern) . '?add"><img
                src="http://mystatus.skype.com/smallicon/' . $user->getValue($fieldNameIntern) . '"
                title="' . $gL10n->get('PRO_TO_ADD', $user->getValue($fieldNameIntern), $gProfileFields->getProperty($fieldNameIntern, 'usf_name')) . '"
                alt="' . $gL10n->get('PRO_TO_ADD', $user->getValue($fieldNameIntern), $gProfileFields->getProperty($fieldNameIntern, 'usf_name')) . '" /></a> ' . $value;
        }
    } elseif (strlen($gProfileFields->getProperty($fieldNameIntern, 'usf_icon')) > 0) {
        $value = $gProfileFields->getProperty($fieldNameIntern, 'usf_icon') . '&nbsp;&nbsp;' . $value;
    }
    // show html of field, if user has a value for that field or it's a checkbox field
    if (strlen($user->getValue($fieldNameIntern)) > 0 || $gProfileFields->getProperty($fieldNameIntern, 'usf_type') === 'CHECKBOX') {
        $html['label'] = $gProfileFields->getProperty($fieldNameIntern, 'usf_name');
        $html['value'] = $value;
    }
    return $html;
}
Exemplo n.º 4
0
 /**
  * Creates a valid date format @b YYYY-MM-DD for the SQL statement
  * @param  string $date     The unformated date from user input e.g. @b 12.04.2012
  * @param  string $operator The actual operator for the @b date parameter
  * @return string String with a SQL valid date format @b YYYY-MM-DD
  */
 private function getFormatDate($date, $operator)
 {
     global $gPreferences;
     $formatDate = '';
     // if last char is Y or J then user searches for age
     $last = substr($date, -1);
     $last = admStrToUpper($last);
     if ($last === 'J' || $last === 'Y') {
         $age = (int) substr($date, 0, -1);
         $date = new DateTimeExtended(date('Y') . '-' . date('m') . '-' . date('d'), 'Y-m-d', 'date');
         $ageCondition = '';
         switch ($operator) {
             case '=':
                 // first remove = from destination condition
                 $this->mDestCond = substr($this->mDestCond, 0, strlen($this->mDestCond) - 4);
                 // now compute the dates for a valid birthday with that age
                 $date->modify('-' . $age . ' years');
                 $dateTo = $date->format('Y-m-d');
                 $date->modify('-1 year');
                 $date->modify('+1 day');
                 $dateFrom = $date->format('Y-m-d');
                 $ageCondition = ' BETWEEN \'' . $dateFrom . '\' AND \'' . $dateTo . '\'';
                 $this->mOpenQuotes = false;
                 break;
             case '}':
                 // search for dates that are older than the age
                 // because the age itself takes 1 year we must add 1 year and 1 day to age
                 $date->modify('-' . ($age + 1) . ' years');
                 $date->modify('+1 day');
                 $ageCondition = $date->format('Y-m-d');
                 break;
             case '{':
                 // search for dates that are younger than the age
                 // we must add 1 day to the date because the day itself belongs to the age
                 $date->modify('-' . $age . ' years');
                 $date->modify('+1 day');
                 $ageCondition = $date->format('Y-m-d');
                 break;
         }
         return $ageCondition;
     }
     // validate date and return it in database format
     if ($date !== '') {
         $date = new DateTimeExtended($date, $gPreferences['system_date']);
         if ($date->isValid()) {
             $formatDate = $date->format('Y-m-d');
         }
     }
     return $formatDate;
 }
Exemplo n.º 5
0
    }
}
if ($gPreferences['enable_weblinks_module'] > 0) {
    $form->addCheckbox('rol_weblinks', $gL10n->get('ROL_RIGHT_WEBLINKS'), $role->getValue('rol_weblinks'), array('icon' => 'weblinks.png'));
}
/*if($gPreferences['enable_inventory_module'] > 0)
{
    $form->addCheckbox('rol_inventory', $gL10n->get('ROL_RIGHT_INVENTORY'), $role->getValue('rol_inventory'), array('icon' => 'inventory.png'));
}*/
$form->closeGroupBox();
$form->openGroupBox('gb_dates_meetings', $gL10n->get('DAT_DATES') . ' / ' . $gL10n->get('ROL_MEETINGS') . '&nbsp;&nbsp;(' . $gL10n->get('SYS_OPTIONAL') . ')');
$form->addInput('rol_start_date', $gL10n->get('ROL_VALID_FROM'), $role->getValue('rol_start_date'), array('type' => 'date'));
$form->addInput('rol_end_date', $gL10n->get('ROL_VALID_TO'), $role->getValue('rol_end_date'), array('type' => 'date'));
$form->addInput('rol_start_time', $gL10n->get('SYS_TIME_FROM'), $role->getValue('rol_start_time'), array('type' => 'time'));
$form->addInput('rol_end_time', $gL10n->get('SYS_TIME_TO'), $role->getValue('rol_end_time'), array('type' => 'time'));
$form->addSelectBox('rol_weekday', $gL10n->get('ROL_WEEKDAY'), DateTimeExtended::getWeekdays(), array('defaultValue' => $role->getValue('rol_weekday')));
$form->addInput('rol_location', $gL10n->get('SYS_LOCATION'), $role->getValue('rol_location'), array('maxLength' => 100));
$form->closeGroupBox();
$form->openGroupBox('gb_dependencies', $gL10n->get('ROL_DEPENDENCIES') . '&nbsp;&nbsp;(' . $gL10n->get('SYS_OPTIONAL') . ')');
$rolename_var = $gL10n->get('ROL_NEW_ROLE');
if ($role->getValue('rol_name') !== '') {
    $rolename_var = $gL10n->get('SYS_ROLE') . ' <b>' . $role->getValue('rol_name') . '</b>';
}
$form->addHtml('<p>' . $gL10n->get('ROL_ROLE_DEPENDENCIES', $rolename_var) . '</p>');
//  list all roles that the user is allowed to see
$sqlAllRoles = '
    SELECT rol_id, rol_name, cat_name
      FROM ' . TBL_ROLES . ', ' . TBL_CATEGORIES . '
     WHERE rol_valid   = 1
       AND rol_visible = 1
       AND rol_cat_id  = cat_id
Exemplo n.º 6
0
 /** Returns the user value for this column @n
  *  format = 'd.m.Y' : a date or timestamp field accepts the format of the PHP date() function @n
  *  format = 'html'  : returns the value in html-format if this is necessary for that field type @n
  *  format = 'database' : returns the value that is stored in database with no format applied
  *  @param $fieldNameIntern Expects the @b usf_name_intern of table @b adm_user_fields
  *  @param $format Returns the field value in a special format @b text, @b html, @b database or datetime (detailed description in method description)
  */
 public function getValue($fieldNameIntern, $format = '')
 {
     global $gL10n, $gPreferences;
     $value = '';
     // exists a profile field with that name ?
     // then check if user has a data object for this field and then read value of this object
     if (array_key_exists($fieldNameIntern, $this->mProfileFields) && array_key_exists($this->mProfileFields[$fieldNameIntern]->getValue('usf_id'), $this->mUserData)) {
         $value = $this->mUserData[$this->mProfileFields[$fieldNameIntern]->getValue('usf_id')]->getValue('usd_value', $format);
         if ($format != 'database') {
             if ($this->mProfileFields[$fieldNameIntern]->getValue('usf_type') == 'DATE' && $value !== '') {
                 // if no format or html is set then show date format from Admidio settings
                 if ($format === '' || $format == 'html') {
                     $dateFormat = $gPreferences['system_date'];
                 } else {
                     $dateFormat = $format;
                 }
                 // if date field then the current date format must be used
                 $date = new DateTimeExtended($value, 'Y-m-d', 'date');
                 if (!$date->isValid()) {
                     return $value;
                 }
                 $value = $date->format($dateFormat);
             } elseif ($this->mProfileFields[$fieldNameIntern]->getValue('usf_type') == 'DROPDOWN' || $this->mProfileFields[$fieldNameIntern]->getValue('usf_type') == 'RADIO_BUTTON') {
                 // the value in db is only the position, now search for the text
                 if ($value > 0 && $format != 'html') {
                     $arrListValues = $this->mProfileFields[$fieldNameIntern]->getValue('usf_value_list');
                     $value = $arrListValues[$value];
                 }
             } elseif ($fieldNameIntern == 'COUNTRY' && $value !== '') {
                 // read the language name of the country
                 $value = $gL10n->getCountryByCode($value);
             }
         }
     }
     // get html output for that field type and value
     if ($format == 'html') {
         $value = $this->getHtmlValue($fieldNameIntern, $value);
     }
     return $value;
 }
Exemplo n.º 7
0
     $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('PHO_ALBUM')));
 }
 // Beginn
 if (strlen($_POST['pho_begin']) > 0) {
     $startDate = new DateTimeExtended($_POST['pho_begin'], $gPreferences['system_date']);
     if ($startDate->isValid()) {
         $_POST['pho_begin'] = $startDate->format('Y-m-d');
     } else {
         $gMessage->show($gL10n->get('SYS_DATE_INVALID', $gL10n->get('SYS_START'), $gPreferences['system_date']));
     }
 } else {
     $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('SYS_START')));
 }
 // Ende
 if (strlen($_POST['pho_end']) > 0) {
     $endDate = new DateTimeExtended($_POST['pho_end'], $gPreferences['system_date']);
     if ($endDate->isValid()) {
         $_POST['pho_end'] = $endDate->format('Y-m-d');
     } else {
         $gMessage->show($gL10n->get('SYS_DATE_INVALID', $gL10n->get('SYS_END'), $gPreferences['system_date']));
     }
 } else {
     $_POST['pho_end'] = $_POST['pho_begin'];
 }
 // Anfang muss vor oder gleich Ende sein
 if (strlen($_POST['pho_end']) > 0 && $_POST['pho_end'] < $_POST['pho_begin']) {
     $gMessage->show($gL10n->get('SYS_DATE_END_BEFORE_BEGIN'));
 }
 // Photographen
 if (strlen($_POST['pho_photographers']) === 0) {
     $_POST['pho_photographers'] = $gL10n->get('SYS_UNKNOWN');
Exemplo n.º 8
0
        $downloadOverview->addRowByArray($columnValues, 'row_folder_' . $nextFolder['fol_id']);
    }
}
// Get contained files
if (isset($folderContent['files'])) {
    for ($i = 0; $i < count($folderContent['files']); $i++) {
        $nextFile = $folderContent['files'][$i];
        // Check filetyp
        $fileExtension = admStrToLower(substr($nextFile['fil_name'], strrpos($nextFile['fil_name'], '.') + 1));
        // Choose icon for the file
        $iconFile = 'page_white_question.png';
        if (array_key_exists($fileExtension, $icon_file_extension)) {
            $iconFile = $icon_file_extension[$fileExtension];
        }
        // Format timestamp
        $timestamp = new DateTimeExtended($nextFile['fil_timestamp'], 'Y-m-d H:i:s');
        $fileDescription = '';
        if ($nextFile['fil_description'] != '') {
            $fileDescription = '<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/info.png" alt="' . $gL10n->get('SYS_FILE') . '" title="' . $nextFile['fil_description'] . '" />';
        }
        // create array with all column values
        $columnValues = array(2, '<a class="admidio-icon-link" href="' . $g_root_path . '/adm_program/modules/downloads/get_file.php?file_id=' . $nextFile['fil_id'] . '">
                <img src="' . THEME_PATH . '/icons/' . $iconFile . '" alt="' . $gL10n->get('SYS_FILE') . '" title="' . $gL10n->get('SYS_FILE') . '" /></a>', '<a href="' . $g_root_path . '/adm_program/modules/downloads/get_file.php?file_id=' . $nextFile['fil_id'] . '">' . $nextFile['fil_name'] . '</a>' . $fileDescription, $timestamp->format($gPreferences['system_date'] . ' ' . $gPreferences['system_time']), $nextFile['fil_size'] . ' kB&nbsp;', $nextFile['fil_counter'] != '' ? $nextFile['fil_counter'] : '0');
        if ($gCurrentUser->editDownloadRight()) {
            //Links for change and delete
            $noteFileNotExists = '';
            if ($nextFile['fil_exists'] == false) {
                $noteFileNotExists = '
                <a class="admidio-icon-link" data-toggle="modal" data-target="#admidio_modal"
                    href="' . $g_root_path . '/adm_program/system/msg_window.php?message_id=DOW_FILE_NOT_EXISTS&amp;inline=true"><img
                    src="' . THEME_PATH . '/icons/warning.png" alt="' . $gL10n->get('SYS_WARNING') . '" /></a>';
Exemplo n.º 9
0
     }
     if ($getMode === 'csv' && $member[$sqlColumnNumber] != null) {
         $content = $gL10n->get('LST_USER_PHOTO');
     }
 } elseif ($gProfileFields->getPropertyById($usf_id, 'usf_type') === 'CHECKBOX') {
     if ($getMode !== 'html') {
         if ($content == 1) {
             $content = $gL10n->get('SYS_YES');
         } else {
             $content = $gL10n->get('SYS_NO');
         }
     }
 } elseif ($gProfileFields->getPropertyById($usf_id, 'usf_type') === 'DATE' || $column->getValue('lsc_special_field') === 'mem_begin' || $column->getValue('lsc_special_field') === 'mem_end') {
     if (strlen($member[$sqlColumnNumber]) > 0) {
         // date must be formated
         $date = new DateTimeExtended($member[$sqlColumnNumber], 'Y-m-d');
         $content = $date->format($gPreferences['system_date']);
     }
 } elseif (($gProfileFields->getPropertyById($usf_id, 'usf_type') === 'DROPDOWN' || $gProfileFields->getPropertyById($usf_id, 'usf_type') === 'RADIO_BUTTON') && $getMode === 'csv') {
     if (strlen($member[$sqlColumnNumber]) > 0) {
         // show selected text of optionfield or combobox
         $arrListValues = $gProfileFields->getPropertyById($usf_id, 'usf_value_list', 'text');
         $content = $arrListValues[$member[$sqlColumnNumber]];
     }
 }
 // format value for csv export
 if ($getMode === 'csv') {
     $str_csv = $str_csv . $separator . $valueQuotes . $content . $valueQuotes;
 } else {
     // firstname and lastname get a link to the profile
     if ($getMode === 'html' && ($usf_id == $gProfileFields->getProperty('LAST_NAME', 'usf_id') || $usf_id == $gProfileFields->getProperty('FIRST_NAME', 'usf_id'))) {
Exemplo n.º 10
0
              LEFT JOIN ' . TBL_USER_DATA . ' AS last_name ON last_name.usd_usr_id = usr_id
               AND last_name.usd_usf_id = ' . $gProfileFields->getProperty('LAST_NAME', 'usf_id') . '
              LEFT JOIN ' . TBL_USER_DATA . ' AS first_name ON first_name.usd_usr_id = usr_id
               AND first_name.usd_usf_id = ' . $gProfileFields->getProperty('FIRST_NAME', 'usf_id') . '
             WHERE rol_cat_id = cat_id
               AND cat_org_id = ' . $gCurrentOrganization->getValue('org_id') . '
               AND rol_id     = mem_rol_id
               AND mem_usr_id = usr_id
               AND mem_begin <= \'' . DATE_NOW . '\'
               AND mem_end    > \'' . DATE_NOW . '\'
               AND usr_valid  = 1
             ORDER BY Month(birthday.usd_value) ASC, DayOfMonth(birthday.usd_value) ASC, last_name, first_name';
    $result = $gDb->query($sql);
    $anz_geb = $gDb->num_rows($result);
    while ($row = $gDb->fetch_array($result)) {
        $birthdayDate = new DateTimeExtended($row['birthday'], 'Y-m-d', 'date');
        $geb_day[$geb] = $birthdayDate->format('d');
        $geb_year[$geb] = $birthdayDate->format('Y');
        $alter[$geb] = $jahr - $geb_year[$geb];
        $geb_name[$geb] = $row['last_name'] . ' ' . $row['first_name'];
        $geb++;
    }
}
// Kalender erstellen
$erster = date('w', mktime(0, 0, 0, $monat, 1, $jahr));
$insgesamt = date('t', mktime(0, 0, 0, $monat, 1, $jahr));
$monate = explode(',', $gL10n->get('PLG_CALENDAR_MONTH'));
if ($erster == 0) {
    $erster = 7;
}
echo '<div id="plgCalendarContent" class="admidio-plugin-content">
Exemplo n.º 11
0
            $iconText = $gL10n->get('SYS_NOT_MEMBER_OF_ORGANIZATION', $gCurrentOrganization->getValue('org_longname'));
        }
        // Haekchen setzen ob jemand Mitglied ist oder nicht
        if ($user['member_this_role']) {
            $htmlMemberStatus = '<input type="checkbox" id="member_' . $user['usr_id'] . '" name="member_' . $user['usr_id'] . '" checked="checked" class="memlist_checkbox memlist_member" /><b id="loadindicator_member_' . $user['usr_id'] . '"></b>';
        } else {
            $htmlMemberStatus = '<input type="checkbox" id="member_' . $user['usr_id'] . '" name="member_' . $user['usr_id'] . '" class="memlist_checkbox memlist_member" /><b id="loadindicator_member_' . $user['usr_id'] . '"></b>';
        }
        if (strlen($addressText) > 1) {
            $htmlAddress = '<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/map.png" alt="' . $addressText . '" title="' . $addressText . '" />';
        }
        // Haekchen setzen ob jemand Leiter ist oder nicht
        if ($user['leader_this_role']) {
            $htmlRoleLeader = '<input type="checkbox" id="leader_' . $user['usr_id'] . '" name="leader_' . $user['usr_id'] . '" checked="checked" class="memlist_checkbox memlist_leader" />';
        } else {
            $htmlRoleLeader = '<input type="checkbox" id="leader_' . $user['usr_id'] . '" name="leader_' . $user['usr_id'] . '" class="memlist_checkbox memlist_leader" />';
        }
        // Geburtstag nur ausgeben wenn bekannt
        if (strlen($user['birthday']) > 0) {
            $birthdayDate = new DateTimeExtended($user['birthday'], 'Y-m-d');
            $htmlBirthday = $birthdayDate->format($gPreferences['system_date']);
        }
        // create array with all column values
        $columnValues = array(array('value' => '<img class="admidio-icon-info" src="' . THEME_PATH . '/icons/' . $icon . '" alt="' . $iconText . '" title="' . $iconText . '" />', 'order' => $memberOfThisOrganization), $htmlMemberStatus, '<a href="' . $g_root_path . '/adm_program/modules/profile/profile.php?user_id=' . $user['usr_id'] . '">' . $user['last_name'] . '</a>', '<a href="' . $g_root_path . '/adm_program/modules/profile/profile.php?user_id=' . $user['usr_id'] . '">' . $user['first_name'] . '</a>', array('value' => $htmlAddress, 'order' => $addressText), $htmlBirthday, $htmlRoleLeader . '<b id="loadindicator_leader_' . $user['usr_id'] . '"></b>');
        $table->addRowByArray($columnValues, 'userid_' . $user['usr_id']);
    }
    //End While
    $page->addHtml($table->show(false));
    $page->addHtml('<p>' . $gL10n->get('SYS_CHECKBOX_AUTOSAVE') . '</p>');
    $page->show();
}
 if (!$role->allowedToAssignMembers($gCurrentUser)) {
     exit($gL10n->get('SYS_NO_RIGHTS'));
 }
 $formatedStartDate = '';
 $formatedEndDate = '';
 // Check das Beginn Datum
 $startDate = new DateTimeExtended($getMembershipStart, $gPreferences['system_date']);
 if ($startDate->isValid()) {
     // Datum formatiert zurueckschreiben
     $formatedStartDate = $startDate->format('Y-m-d');
 } else {
     exit($gL10n->get('SYS_DATE_INVALID', $gL10n->get('SYS_START'), $gPreferences['system_date']));
 }
 // Falls gesetzt wird das Enddatum gecheckt
 if ($getMembershipEnd !== '') {
     $endDate = new DateTimeExtended($getMembershipEnd, $gPreferences['system_date']);
     if ($endDate->isValid()) {
         // Datum formatiert zurueckschreiben
         $formatedEndDate = $endDate->format('Y-m-d');
     } else {
         exit($gL10n->get('SYS_DATE_INVALID', $gL10n->get('SYS_END'), $gPreferences['system_date']));
     }
     // 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);
Exemplo n.º 13
0
             $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('ROL_VALID_TO')));
         }
     } else {
         $gMessage->show($gL10n->get('SYS_DATE_INVALID', $gL10n->get('ROL_VALID_FROM'), $gPreferences['system_date']));
     }
 }
 // Uhrzeit von/bis auf Gueltigkeit pruefen
 if (strlen($_POST['rol_start_time']) > 0) {
     $startTime = new DateTimeExtended($_POST['rol_start_time'], $gPreferences['system_time']);
     if ($startTime->isValid()) {
         $_POST['rol_start_time'] = $startTime->format('H:i:s');
     } else {
         $gMessage->show($gL10n->get('SYS_TIME_INVALID', $gL10n->get('ROL_TIME_FROM'), $gPreferences['system_time']));
     }
     if (strlen($_POST['rol_end_time']) > 0) {
         $endTime = new DateTimeExtended($_POST['rol_end_time'], $gPreferences['system_time']);
         if ($endTime->isValid()) {
             $_POST['rol_end_time'] = $endTime->format('H:i:s');
         } else {
             $gMessage->show($gL10n->get('SYS_TIME_INVALID', $gL10n->get('ROL_TIME_TO'), $gPreferences['system_time']));
         }
     } else {
         $gMessage->show($gL10n->get('SYS_FIELD_EMPTY', $gL10n->get('ROL_TIME_TO')));
     }
 }
 // Kontrollieren ob bei nachtraeglicher Senkung der maximalen Mitgliederzahl diese nicht bereits ueberschritten wurde
 if ($getRoleId > 0 && $_POST['rol_max_members'] != $role->getValue('rol_max_members')) {
     // Zaehlen wieviele Leute die Rolle bereits haben, ohne Leiter
     $role->setValue('rol_max_members', $_POST['rol_max_members']);
     $num_free_places = $role->countVacancies();
     if ($num_free_places < 0) {
                    } else {
                        $user = new User($gDb, $gProfileFields, $value);
                        $receiverName .= '; ' . $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME');
                    }
                }
            } else {
                if (strpos($receivers, ':') > 0) {
                    $receiverName .= '; ' . $moduleMessages->msgGroupNameSplit($receivers);
                } else {
                    $user = new User($gDb, $gProfileFields, $receivers);
                    $receiverName .= '; ' . $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME');
                }
            }
            // @ptabaden: removed div container
            $receiverName = $gL10n->get('MSG_OPPOSITE') . ': ' . substr($receiverName, 2);
        }
        // @ptabaden: Changed order of message display; removed $sentUser because obviou; renamed to panel-primary, removed bottom receivername
        $date = new DateTimeExtended($row['msc_timestamp'], 'Y-m-d H:i:s');
        $page->addHtml('
        <div class="panel panel-primary">
            <div class="panel-heading">
            	<h3>' . $receiverName . '</h3>
            	<h4>' . $date->format($gPreferences['system_date'] . ' ' . $gPreferences['system_time']) . '</h4>
            </div>
            <div class="panel-body">' . $messageText . '
            </div>
        </div>');
    }
}
// show page
$page->show();
Exemplo n.º 15
0
 /**
  * Method validates all date inputs and formats them to date format 'Y-m-d' needed for database queries
  * @param  string       $date Date to be validated and formated if needed
  * @return string|false
  */
 private function formatDate($date)
 {
     global $gPreferences;
     $objDate = new DateTimeExtended($date, 'Y-m-d', 'date');
     if ($objDate->isValid()) {
         return $date;
     } else {
         // check if date has system format
         $objDate = new DateTimeExtended($date, $gPreferences['system_date']);
         if ($objDate->isValid()) {
             return substr($objDate->getDateTimeString(), 0, 10);
         } else {
             return false;
         }
     }
 }
Exemplo n.º 16
0
 /**
  * Set a date range in which the dates should be searched. The method will fill
  * 4 parameters @b dateStartFormatEnglish, @b dateStartFormatEnglish,
  * @b dateEndFormatEnglish and @b dateEndFormatAdmidio that could be read with
  * getParameter and could be used in the script.
  * @param string $dateRangeStart A date in english or Admidio format that will be the start date of the range.
  * @param string $dateRangeEnd   A date in english or Admidio format that will be the end date of the range.
  * @return false|void Returns false if invalid date format is submitted
  */
 public function setDateRange($dateRangeStart, $dateRangeEnd)
 {
     global $gPreferences;
     if ($dateRangeStart === '') {
         $dateRangeStart = '1970-01-01';
         $dateRangeEnd = DATE_NOW;
     }
     // Create date object and format date_from in English format and system format and push to daterange array
     $objDate = new DateTimeExtended($dateRangeStart, 'Y-m-d');
     if ($objDate->isValid()) {
         $this->setParameter('dateStartFormatEnglish', $objDate->format('Y-m-d'));
         $this->setParameter('dateStartFormatAdmidio', $objDate->format($gPreferences['system_date']));
     } else {
         // check if date_from  has system format
         $objDate = new DateTimeExtended($dateRangeStart, $gPreferences['system_date']);
         if ($objDate->isValid()) {
             $this->setParameter('dateStartFormatEnglish', $objDate->format('Y-m-d'));
             $this->setParameter('dateStartFormatAdmidio', $objDate->format($gPreferences['system_date']));
         } else {
             return false;
         }
     }
     // Create date object and format date_to in English format and sytem format and push to daterange array
     $objDate = new DateTimeExtended($dateRangeEnd, 'Y-m-d');
     if ($objDate->isValid()) {
         $this->setParameter('dateEndFormatEnglish', $objDate->format('Y-m-d'));
         $this->setParameter('dateEndFormatAdmidio', $objDate->format($gPreferences['system_date']));
     } else {
         // check if date_from  has system format
         $objDate = new DateTimeExtended($dateRangeEnd, $gPreferences['system_date']);
         if ($objDate->isValid()) {
             $this->setParameter('dateEndFormatEnglish', $objDate->format('Y-m-d'));
             $this->setParameter('dateEndFormatAdmidio', $objDate->format($gPreferences['system_date']));
         } else {
             return false;
         }
     }
 }
Exemplo n.º 17
0
 /**
  * set value for column usd_value of field
  * @param $fieldNameIntern
  * @param $fieldValue
  * @return bool
  */
 public function setValue($fieldNameIntern, $fieldValue)
 {
     global $gPreferences;
     $returnCode = false;
     if ($fieldValue !== '') {
         switch ($this->mInventoryFields[$fieldNameIntern]->getValue('inf_type')) {
             case 'CHECKBOX':
                 // Checkbox darf nur 1 oder 0 haben
                 if ($fieldValue != 0 && $fieldValue != 1 && !$this->noValueCheck) {
                     return false;
                 }
                 break;
             case 'DATE':
                 // Datum muss gueltig sein und formatiert werden
                 $date = new DateTimeExtended($fieldValue, $gPreferences['system_date']);
                 if (!$date->isValid()) {
                     if (!$this->noValueCheck) {
                         return false;
                     }
                 } else {
                     $fieldValue = $date->format('Y-m-d');
                 }
                 break;
             case 'EMAIL':
                 // Email darf nur gueltige Zeichen enthalten und muss einem festen Schema entsprechen
                 $fieldValue = admStrToLower($fieldValue);
                 if (!strValidCharacters($fieldValue, 'email') && !$this->noValueCheck) {
                     return false;
                 }
                 break;
             case 'NUMBER':
                 // A number must be numeric
                 if (!is_numeric($fieldValue) && !$this->noValueCheck) {
                     return false;
                 } else {
                     // numbers don't have leading zero
                     $fieldValue = ltrim($fieldValue, '0');
                 }
                 break;
             case 'DECIMAL':
                 // A number must be numeric
                 if (!is_numeric(strtr($fieldValue, ',.', '00')) && !$this->noValueCheck) {
                     return false;
                 } else {
                     // numbers don't have leading zero
                     $fieldValue = ltrim($fieldValue, '0');
                 }
                 break;
             case 'URL':
                 // Homepage darf nur gueltige Zeichen enthalten
                 if (!strValidCharacters($fieldValue, 'url') && !$this->noValueCheck) {
                     return false;
                 }
                 // Homepage noch mit http vorbelegen
                 if (strpos(admStrToLower($fieldValue), 'http://') === false && strpos(admStrToLower($fieldValue), 'https://') === false) {
                     $fieldValue = 'http://' . $fieldValue;
                 }
                 break;
         }
     }
     $infId = $this->mInventoryFields[$fieldNameIntern]->getValue('inf_id');
     // first check if user has a data object for this field and then set value of this user field
     if (array_key_exists($infId, $this->mInventoryData)) {
         $returnCode = $this->mInventoryData[$infId]->setValue('ind_value', $fieldValue);
     } elseif (isset($this->mInventoryFields[$fieldNameIntern]) && $fieldValue !== '') {
         $this->mInventoryData[$infId] = new TableAccess($this->mDb, TBL_INVENT_DATA, 'ind');
         $this->mInventoryData[$infId]->setValue('ind_inf_id', $this->mInventoryFields[$fieldNameIntern]->getValue('inf_id'));
         $this->mInventoryData[$infId]->setValue('ind_itm_id', $this->mItemId);
         $returnCode = $this->mInventoryData[$infId]->setValue('ind_value', $fieldValue);
     }
     if ($returnCode && $this->mInventoryData[$infId]->hasColumnsValueChanged()) {
         $this->columnsValueChanged = true;
     }
     return $returnCode;
 }
Exemplo n.º 18
0
 /**
  * Add a new input field with a label to the form.
  * @param string $id      Id of the input field. This will also be the name of the input field.
  * @param string $label   The label of the input field.
  * @param string $value   A value for the text field. The field will be created with this value.
  * @param array  $options (optional) An array with the following possible entries:
  *                        - @b type : Set the type if the field. Default will be @b text. Possible values are @b text,
  *                          @b number, @b date, @b datetime or @b birthday. If @b date, @b datetime or @b birthday are set
  *                          than a small calendar will be shown if the date field will be selected.
  *                        - @b maxLength : The maximum number of characters that are allowed in a text field.
  *                        - @b minNumber : The minimum number that is allowed in a number field.
  *                        - @b maxNumber : The maximum number that is allowed in a number field.
  *                        - @b step : The steps between two numbers that are allowed.
  *                          E.g. if steps is set to 5 then only values 5, 10, 15 ... are allowed
  *                        - @b property : With this param you can set the following properties:
  *                          + @b FIELD_DEFAULT  : The field can accept an input.
  *                          + @b FIELD_REQUIRED : The field will be marked as a mandatory field where the user must insert a value.
  *                          + @b FIELD_DISABLED : The field will be disabled and could not accept an input.
  *                          + @b FIELD_HIDDEN   : The field will not be shown. Useful to transport additional informations.
  *                        - @b helpTextIdLabel : A unique text id from the translation xml files that should be shown
  *                          e.g. SYS_ENTRY_MULTI_ORGA. If set a help icon will be shown after the control label where
  *                          the user can see the text if he hover over the icon. If you need an additional parameter
  *                          for the text you can add an array. The first entry must be the unique text id and the second
  *                          entry will be a parameter of the text id.
  *                        - @b helpTextIdInline : A unique text id from the translation xml files that should be shown
  *                          e.g. SYS_ENTRY_MULTI_ORGA. If set the complete text will be shown after the form element.
  *                          If you need an additional parameter for the text you can add an array. The first entry must
  *                          be the unique text id and the second entry will be a parameter of the text id.
  *                        - @b icon : An icon can be set. This will be placed in front of the label.
  *                        - @b class : An additional css classname. The class @b admSelectbox
  *                          is set as default and need not set with this parameter.
  */
 public function addInput($id, $label, $value, $options = array())
 {
     global $gL10n, $gPreferences, $g_root_path, $gDebug;
     $attributes = array('class' => 'form-control');
     ++$this->countElements;
     // create array with all options
     $optionsDefault = array('type' => 'text', 'minLength' => null, 'maxLength' => 0, 'minNumber' => null, 'maxNumber' => null, 'step' => 1, 'property' => FIELD_DEFAULT, 'helpTextIdLabel' => '', 'helpTextIdInline' => '', 'icon' => '', 'class' => '');
     $optionsAll = array_replace($optionsDefault, $options);
     // set min/max input length
     if ($optionsAll['type'] === 'text' || $optionsAll['type'] === 'password' || $optionsAll['type'] === 'search' || $optionsAll['type'] === 'email' || $optionsAll['type'] === 'url' || $optionsAll['type'] === 'tel') {
         $attributes['minlength'] = $optionsAll['minLength'];
         if ($optionsAll['maxLength'] > 0) {
             $attributes['maxlength'] = $optionsAll['maxLength'];
         }
     } elseif ($optionsAll['type'] === 'number') {
         $attributes['min'] = $optionsAll['minNumber'];
         $attributes['max'] = $optionsAll['maxNumber'];
         $attributes['step'] = $optionsAll['step'];
     }
     // disable field
     switch ($optionsAll['property']) {
         case FIELD_DISABLED:
             $attributes['disabled'] = 'disabled';
             break;
         case FIELD_READONLY:
             $attributes['readonly'] = 'readonly';
             break;
         case FIELD_REQUIRED:
             $attributes['required'] = 'required';
             break;
         case FIELD_HIDDEN:
             $attributes['hidden'] = 'hidden';
             $attributes['class'] .= ' hide';
             break;
     }
     // set specific css class for this field
     if ($optionsAll['class'] !== '') {
         $attributes['class'] .= ' ' . $optionsAll['class'];
     }
     // add a nice modern datepicker to date inputs
     if ($optionsAll['type'] === 'date' || $optionsAll['type'] === 'datetime' || $optionsAll['type'] === 'birthday') {
         $attributes['placeholder'] = DateTimeExtended::getDateFormatForDatepicker($gPreferences['system_date']);
         $javascriptCode = '';
         $datepickerOptions = '';
         // if you have a birthday field than start with the years selection
         if ($optionsAll['type'] === 'birthday') {
             $attributes['data-provide'] = 'datepicker-birthday';
             $datepickerOptions = ' startView: 2, ';
         } else {
             $attributes['data-provide'] = 'datepicker';
             $datepickerOptions = ' todayBtn: "linked", ';
         }
         if ($this->datepickerInitialized === false || $optionsAll['type'] === 'birthday') {
             $javascriptCode = '
                 $("input[data-provide=\'' . $attributes['data-provide'] . '\']").datepicker({
                     language: "' . $gL10n->getLanguageIsoCode() . '",
                     format: "' . DateTimeExtended::getDateFormatForDatepicker($gPreferences['system_date']) . '",
                     ' . $datepickerOptions . '
                     todayHighlight: "true"
                 });';
             if ($optionsAll['type'] !== 'birthday') {
                 $this->datepickerInitialized = true;
             }
         }
         // if a htmlPage object was set then add code to the page, otherwise to the current string
         if (is_object($this->htmlPage)) {
             $this->htmlPage->addCssFile($g_root_path . '/adm_program/libs/bootstrap-datepicker/css/bootstrap-datepicker3.css');
             $this->htmlPage->addJavascriptFile($g_root_path . '/adm_program/libs/bootstrap-datepicker/js/bootstrap-datepicker.js');
             $this->htmlPage->addJavascriptFile($g_root_path . '/adm_program/libs/bootstrap-datepicker/locales/bootstrap-datepicker.' . $gL10n->getLanguageIsoCode() . '.js');
             $this->htmlPage->addJavascript($javascriptCode, true);
         } else {
             $this->addHtml('<script type="text/javascript">' . $javascriptCode . '</script>');
         }
     }
     if ($optionsAll['property'] !== FIELD_HIDDEN) {
         // now create html for the field
         $this->openControlStructure($id, $label, $optionsAll['property'], $optionsAll['helpTextIdLabel'], $optionsAll['icon']);
     }
     // if datetime then add a time field behind the date field
     if ($optionsAll['type'] === 'datetime') {
         // first try to split datetime to a date and a time value
         $datetime = DateTime::createFromFormat($gPreferences['system_date'] . ' ' . $gPreferences['system_time'], $value);
         $dateValue = $datetime->format($gPreferences['system_date']);
         $timeValue = $datetime->format($gPreferences['system_time']);
         // now add a date and a time field to the form
         $attributes['class'] .= ' datetime-date-control';
         $this->addSimpleInput('text', $id, $id, $dateValue, $attributes);
         $attributes['class'] .= ' datetime-time-control';
         $attributes['maxlength'] = '8';
         $attributes['data-provide'] = '';
         $this->addSimpleInput('text', $id . '_time', $id . '_time', $timeValue, $attributes);
     } else {
         // a date type has some problems with chrome so we set it as text type
         if ($optionsAll['type'] === 'date' || $optionsAll['type'] === 'birthday') {
             $optionsAll['type'] = 'text';
         }
         $this->addSimpleInput($optionsAll['type'], $id, $id, $value, $attributes);
     }
     if ($optionsAll['property'] !== FIELD_HIDDEN) {
         $this->closeControlStructure($optionsAll['helpTextIdInline']);
     }
 }
Exemplo n.º 19
0
    // show link to maintain profile fields
    $itemsAdministrationMenu->addItem('menu_item_maintain_inventory_fields', $g_root_path . '/adm_program/modules/inventory/fields.php', $gL10n->get('PRO_MAINTAIN_ITEM_FIELDS'), 'application_form_edit.png');
}
// Create table object
$itemsTable = new HtmlTable('tbl_invent', $page, true, true, 'table table-condensed');
// create array with all column heading values
$columnHeading = array($gL10n->get('SYS_ABR_NO'), $gL10n->get('SYS_NAME'), $gL10n->get('SYS_ROOM'), $gL10n->get('MEM_UPDATED_ON'), '&nbsp;');
$itemsTable->setColumnAlignByArray(array('left', 'left', 'left', 'left', 'right'));
$itemsTable->disableDatatablesColumnsSort(5);
$itemsTable->addRowHeadingByArray($columnHeading);
$itemsTable->setDatatablesRowsPerPage($gPreferences['members_users_per_page']);
$itemsTable->setMessageIfNoRowsFound('SYS_NO_ENTRIES');
$irow = 1;
// count for line in table
while ($row = $mglStatement->fetch()) {
    $timestampChange = new DateTimeExtended($row['timestamp'], 'Y-m-d H:i:s');
    $room = new TableRooms($gDb, $row['room_id']);
    $roomLink = $g_root_path . '/adm_program/system/msg_window.php?message_id=room_detail&amp;message_title=DAT_ROOM_INFORMATIONS&amp;message_var1=' . $row['room_id'] . '&amp;inline=true';
    // create array with all column values
    $columnValues = array($irow, '<a href="' . $g_root_path . '/adm_program/modules/inventory/item.php?item_id=' . $row['inv_id'] . '">' . $row['item_name'] . '</a>', '<a class="admidio-icon-link-popup" href="' . $roomLink . '">' . $room->getValue('room_name') . '</a>');
    $columnValues[] = $timestampChange->format($gPreferences['system_date'] . ' ' . $gPreferences['system_time']);
    $itemAdministration = '';
    // Link to modify Item
    $itemAdministration .= '<a class="admidio-icon-link" href="' . $g_root_path . '/adm_program/modules/inventory/item_new.php?item_id=' . $row['inv_id'] . '"><img
                                src="' . THEME_PATH . '/icons/edit.png" alt="' . $gL10n->get('MEM_EDIT_USER') . '" title="' . $gL10n->get('MEM_EDIT_USER') . '" /></a>';
    // remove Item
    if ($gCurrentUser->isWebmaster()) {
        $itemAdministration .= '<a class="admidio-icon-link" href="' . $g_root_path . '/adm_program/modules/inventory/items_function.php?item_id=' . $row['inv_id'] . '&amp;mode=6"><img
                                    src="' . THEME_PATH . '/icons/delete.png" alt="' . $gL10n->get('MEM_REMOVE_USER') . '" title="' . $gL10n->get('MEM_REMOVE_USER') . '" /></a>';
    } else {
        $itemAdministration .= '&nbsp;<img class="admidio-icon-link" src="' . THEME_PATH . '/icons/dummy.png" alt="dummy" />';
Exemplo n.º 20
0
     }
 }
 // wenn Datum-bis nicht gefüllt ist, dann mit Datum-von nehmen
 if (strlen($_POST['date_to']) == 0) {
     $_POST['date_to'] = $_POST['date_from'];
 }
 if (strlen($_POST['date_to_time']) == 0) {
     $_POST['date_to_time'] = $_POST['date_from_time'];
 }
 $endDateTime = new DateTimeExtended($_POST['date_to'] . ' ' . $_POST['date_to_time'], $gPreferences['system_date'] . ' ' . $gPreferences['system_time']);
 if ($endDateTime->isValid()) {
     // Datum & Uhrzeit formatiert zurueckschreiben
     $date->setValue('dat_end', $endDateTime->getDateTimeString());
 } else {
     // Fehler: pruefen, ob Datum oder Uhrzeit falsches Format hat
     $endDateTime = new DateTimeExtended($_POST['date_to'], $gPreferences['system_date']);
     if ($endDateTime->isValid()) {
         $gMessage->show($gL10n->get('SYS_DATE_INVALID', $gL10n->get('SYS_END'), $gPreferences['system_date']));
     } else {
         $gMessage->show($gL10n->get('SYS_TIME_INVALID', $gL10n->get('SYS_TIME') . ' ' . $gL10n->get('SYS_END'), $gPreferences['system_time']));
     }
 }
 // DateTo should be greater than DateFrom (Timestamp must be less)
 if ($startDateTime < $endDateTime) {
     $gMessage->show($gL10n->get('SYS_DATE_END_BEFORE_BEGIN'));
 }
 if (isset($_POST['dat_highlight']) == false) {
     $_POST['dat_highlight'] = 0;
 }
 if (isset($_POST['dat_global']) == false) {
     $_POST['dat_global'] = 0;
Exemplo n.º 21
0
          src="' . THEME_PATH . '/icons/' . $icon . '" alt="' . $iconText . '" title="' . $iconText . '" />', 'order' => $memberOfThisOrganization), '<a href="' . $g_root_path . '/adm_program/modules/profile/profile.php?user_id=' . $row['usr_id'] . '">' . $row['last_name'] . ',&nbsp;' . $row['first_name'] . '</a>');
 if (strlen($row['usr_login_name']) > 0) {
     $columnValues[] = $row['usr_login_name'];
 } else {
     $columnValues[] = '';
 }
 if (strlen($row['gender']) > 0) {
     // show selected text of optionfield or combobox
     $arrListValues = $gProfileFields->getProperty('GENDER', 'usf_value_list');
     $columnValues[] = array('value' => $arrListValues[$row['gender']], 'order' => $row['gender']);
 } else {
     $columnValues[] = array('value' => '', 'order' => '0');
 }
 if (strlen($row['birthday']) > 0) {
     // date must be formated
     $date = new DateTimeExtended($row['birthday'], 'Y-m-d');
     $columnValues[] = $date->format($gPreferences['system_date']);
 } else {
     $columnValues[] = '';
 }
 $columnValues[] = $timestampChange->format($gPreferences['system_date'] . ' ' . $gPreferences['system_time']);
 $userAdministration = '';
 // Webmasters can change or send password if login is configured and user is member of current organization
 if ($row['member_this_orga'] > 0 && $gCurrentUser->isWebmaster() && strlen($row['usr_login_name']) > 0 && $row['usr_id'] != $gCurrentUser->getValue('usr_id')) {
     if (strlen($row['email']) > 0 && $gPreferences['enable_system_mails'] == 1) {
         // if email is set and systemmails are activated then webmaster can send a new password to user
         $userAdministration = '
         <a class="admidio-icon-link" href="' . $g_root_path . '/adm_program/modules/members/members_function.php?usr_id=' . $row['usr_id'] . '&amp;mode=5"><img
             src="' . THEME_PATH . '/icons/key.png" alt="' . $gL10n->get('MEM_SEND_USERNAME_PASSWORD') . '" title="' . $gL10n->get('MEM_SEND_USERNAME_PASSWORD') . '" /></a>';
     } else {
         // if user has no email or send email is disabled then webmaster could set a new password
Exemplo n.º 22
0
$page = new HtmlPage($headline);
$page->enableModal();
if ($gCurrentUser->isWebmaster()) {
    // get module menu
    $registrationMenu = $page->getMenu();
    // show link to system preferences of announcements
    $registrationMenu->addItem('menu_item_preferences', $g_root_path . '/adm_program/modules/preferences/preferences.php?show_option=registration', $gL10n->get('SYS_MODULE_PREFERENCES'), 'options.png', 'right');
}
$table = new HtmlTable('new_user_table', $page, true);
// create array with all column heading values
$columnHeading = array($gL10n->get('SYS_NAME'), $gL10n->get('SYS_REGISTRATION'), $gL10n->get('SYS_USERNAME'), $gL10n->get('SYS_EMAIL'), '&nbsp;');
$table->setColumnAlignByArray(array('left', 'left', 'left', 'left', 'right'));
$table->setDatatablesOrderColumns(1);
$table->addRowHeadingByArray($columnHeading);
while ($row = $usrStatement->fetch()) {
    $timestampCreate = new DateTimeExtended($row['reg_timestamp'], 'Y-m-d H:i:s');
    $datetimeCreate = $timestampCreate->format($gPreferences['system_date'] . ' ' . $gPreferences['system_time']);
    if ($gPreferences['enable_mail_module'] == 1) {
        $mailLink = '<a href="' . $g_root_path . '/adm_program/modules/messages/messages_write.php?usr_id=' . $row['usr_id'] . '">' . $row['email'] . '</a>';
    } else {
        $mailLink = '<a href="mailto:' . $row['email'] . '">' . $row['email'] . '</a>';
    }
    // create array with all column values
    $columnValues = array('<a href="' . $g_root_path . '/adm_program/modules/profile/profile.php?user_id=' . $row['usr_id'] . '">' . $row['last_name'] . ', ' . $row['first_name'] . '</a>', $datetimeCreate, $row['usr_login_name'], $mailLink, '<a class="admidio-icon-link" href="' . $g_root_path . '/adm_program/modules/registration/registration_assign.php?new_user_id=' . $row['usr_id'] . '"><img
                            src="' . THEME_PATH . '/icons/new_registrations.png" alt="' . $gL10n->get('NWU_ASSIGN_REGISTRATION') . '" title="' . $gL10n->get('NWU_ASSIGN_REGISTRATION') . '" /></a>
        <a class="admidio-icon-link" data-toggle="modal" data-target="#admidio_modal"
            href="' . $g_root_path . '/adm_program/system/popup_message.php?type=nwu&amp;element_id=row_user_' . $row['usr_id'] . '&amp;name=' . urlencode($row['first_name'] . ' ' . $row['last_name']) . '&amp;database_id=' . $row['usr_id'] . '"><img
            src="' . THEME_PATH . '/icons/delete.png" alt="' . $gL10n->get('SYS_DELETE') . '" title="' . $gL10n->get('SYS_DELETE') . '" /></a>');
    $table->addRowByArray($columnValues, 'row_user_' . $row['usr_id']);
}
$page->addHtml($table->show(false));
Exemplo n.º 23
0
                 } else {
                     $user = new User($gDb, $gProfileFields, $value);
                     $ReceiverName .= "; " . $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME');
                 }
             }
         } else {
             if (strpos($receivers, ':') == true) {
                 $ReceiverName .= "; " . $modulemessages->msgGroupNameSplit($receivers);
             } else {
                 $user = new User($gDb, $gProfileFields, $receivers);
                 $ReceiverName .= "; " . $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME');
             }
         }
         $ReceiverName = '<div class="panel-footer">' . $gL10n->get('MSG_OPPOSITE') . ': ' . substr($ReceiverName, 2) . '</div>';
     }
     $date = new DateTimeExtended($row['msc_timestamp'], 'Y-m-d H:i:s');
     $page->addHtml('
     <div class="panel panel-default">
         <div class="panel-heading">
             <div class="row">
                 <div class="col-sm-8">
                     <img class="admidio-panel-heading-icon" src="' . THEME_PATH . '/icons/guestbook.png" alt="' . $sentUser . '" />' . $sentUser . '
                 </div>
                 <div class="col-sm-4 text-right">' . $date->format($gPreferences['system_date'] . ' ' . $gPreferences['system_time']) . '</div>
             </div>
         </div>
         <div class="panel-body">' . $message_text . '
         </div>
         ' . $ReceiverName . '
     </div>');
 }
Exemplo n.º 24
0
     <div class="panel-heading">' . $gL10n->get('LST_INFOBOX') . ': ' . $role->getValue('rol_name') . '</div>
     <div class="panel-body">';
 $form = new HtmlForm('list_infobox_items', null);
 $form->addStaticControl('infobox_category', $gL10n->get('SYS_CATEGORY'), $role->getValue('cat_name'));
 // Description
 if (strlen($role->getValue('rol_description')) > 0) {
     $form->addStaticControl('infobox_description', $gL10n->get('SYS_DESCRIPTION'), $role->getValue('rol_description'));
 }
 // Period
 if (strlen($role->getValue('rol_start_date')) > 0) {
     $form->addStaticControl('infobox_period', $gL10n->get('SYS_PERIOD'), $gL10n->get('SYS_DATE_FROM_TO', $role->getValue('rol_start_date', $gPreferences['system_date']), $role->getValue('rol_end_date', $gPreferences['system_date'])));
 }
 // Event
 if ($role->getValue('rol_weekday') > 0 || strlen($role->getValue('rol_start_time')) > 0) {
     if ($role->getValue('rol_weekday') > 0) {
         $value = DateTimeExtended::getWeekdays($role->getValue('rol_weekday')) . ' ';
     }
     if (strlen($role->getValue('rol_start_time')) > 0) {
         $value = $gL10n->get('LST_FROM_TO', $role->getValue('rol_start_time', $gPreferences['system_time']), $role->getValue('rol_end_time', $gPreferences['system_time']));
     }
     $form->addStaticControl('infobox_date', $gL10n->get('DAT_DATE'), $value);
 }
 // Meeting Point
 if (strlen($role->getValue('rol_location')) > 0) {
     $form->addStaticControl('infobox_location', $gL10n->get('SYS_LOCATION'), $role->getValue('rol_location'));
 }
 // Member Fee
 if (strlen($role->getValue('rol_cost')) > 0) {
     $form->addStaticControl('infobox_contribution', $gL10n->get('SYS_CONTRIBUTION'), $role->getValue('rol_cost') . ' ' . $gPreferences['system_currency']);
 }
 // Fee period
Exemplo n.º 25
0
         $gDb->query($sql);
         $sql = "UPDATE " . TBL_MESSAGES_CONTENT . " SET msc_part_id = msc_part_id - 50 WHERE msc_msg_id = '" . $msg_id . "'";
         $gDb->query($sql);
         $postLines = $postLines - 50;
         $MsgId = $MsgId - 50;
     }
     if ($postLines == $MsgId) {
         $log['state'] = $postLines;
         $log['text'] = false;
     } else {
         $text = array();
         $sql = "SELECT msc_part_id, msc_usr_id, msc_message, msc_timestamp\n              FROM " . TBL_MESSAGES_CONTENT . "\n             WHERE msc_msg_id  = '" . $msg_id . "'\n               AND msc_part_id > " . $postLines . "\n             ORDER BY msc_part_id";
         $statement = $gDb->query($sql);
         while ($row = $statement->fetch()) {
             $user = new User($gDb, $gProfileFields, $row['msc_usr_id']);
             $date = new DateTimeExtended($row['msc_timestamp'], 'Y-m-d H:i:s');
             $text[] = '<time>' . $date->format($gPreferences['system_date'] . ' ' . $gPreferences['system_time']) . '</time><span>' . $user->getValue('FIRST_NAME') . ' ' . $user->getValue('LAST_NAME') . '</span>' . $row['msc_message'];
         }
         $log['state'] = $MsgId;
         $log['text'] = $text;
     }
     break;
 case 'send':
     $reg_exUrl = '/^(http|ftp)s?\\:\\/\\/[\\da-zA-Z\\-\\.]+\\.[a-zA-Z]{2,6}(\\/\\S*)?/';
     if ($postMessage !== "\n") {
         if (preg_match($reg_exUrl, $postMessage, $url)) {
             $postMessage = preg_replace($reg_exUrl, '<a href="' . $url[0] . '" target="_blank">' . $url[0] . '</a>', $postMessage);
         }
     }
     if ($MsgId == 0) {
         $sql = "INSERT INTO " . TBL_MESSAGES . " (msg_type, msg_subject, msg_usr_id_sender, msg_usr_id_receiver, msg_timestamp, msg_read)\n            VALUES ('CHAT', 'DUMMY', '1', '" . $MsgId . "', CURRENT_TIMESTAMP, '0')";
Exemplo n.º 26
0
                 <a class="admidio-icon-link" href="' . $g_root_path . '/adm_program/modules/messages/messages_write.php?usr_id=' . $row['usr_id'] . '"><img
                 src="' . THEME_PATH . '/icons/email.png" alt="' . $gL10n->get('MAI_SEND_EMAIL') . '" title="' . $gL10n->get('MAI_SEND_EMAIL') . '" /></a>';
     }
 } elseif ($plg_show_email_extern == 1 && strlen($row['email']) > 0) {
     $plg_show_name = $plg_show_name . '
             <a class="admidio-icon-link" href="mailto:' . $row['email'] . '"><img
             src="' . THEME_PATH . '/icons/email.png" alt="' . $gL10n->get('MAI_SEND_EMAIL') . '" title="' . $gL10n->get('MAI_SEND_EMAIL') . '" /></a>';
 }
 // Soll das Alter auch für nicht angemeldete Benutzer angezeigt werden?
 if ($plg_show_names_extern < 2 || $gValidLogin) {
     // Geburtstagskinder am aktuellen Tag bekommen anderen Text
     if ($row['days_to_bdate'] == 0) {
         // Die Anzeige der Geburtstage folgt nicht mehr als Liste, sondern mittels div-Tag
         echo '<li><span id="plgBirthdayNameHighlight">' . $gL10n->get('PLG_BIRTHDAY_TODAY', $plg_show_name, $row['age']) . '</span></li>';
     } else {
         $birthayDate = new DateTimeExtended($row['birthday'], 'Y-m-d');
         $plgDays = ' ';
         $plgCssClass = '';
         if ($row['days_to_bdate'] < 0) {
             $plgCssClass = 'plgBirthdayNameHighlightAgo';
             if ($row['days_to_bdate'] == -1) {
                 $birthdayText = 'PLG_BIRTHDAY_YESTERDAY';
             } else {
                 $birthdayText = 'PLG_BIRTHDAY_PAST';
                 $plgDays = -$row['days_to_bdate'];
             }
         } elseif ($row['days_to_bdate'] > 0) {
             $plgCssClass = 'plgBirthdayNameHighlightFuture';
             if ($row['days_to_bdate'] == 1) {
                 $birthdayText = 'PLG_BIRTHDAY_TOMORROW';
             } else {
Exemplo n.º 27
0
        $downloadOverview->addRowByArray($columnValues, 'row_folder_' . $nextFolder['fol_id']);
    }
}
// Get contained files
if (isset($folderContent['files'])) {
    for ($i = 0; $i < count($folderContent['files']); ++$i) {
        $nextFile = $folderContent['files'][$i];
        // Check filetyp
        $fileExtension = admStrToLower(substr($nextFile['fil_name'], strrpos($nextFile['fil_name'], '.') + 1));
        // Choose icon for the file
        $iconFile = 'page_white_question.png';
        if (array_key_exists($fileExtension, $icon_file_extension)) {
            $iconFile = $icon_file_extension[$fileExtension];
        }
        // Format timestamp
        $timestamp = new DateTimeExtended($nextFile['fil_timestamp'], 'Y-m-d H:i:s');
        $fileDescription = '';
        if ($nextFile['fil_description'] != '') {
            $fileDescription = '';
        }
        // create array with all column values
        // @ptabaden: Changed file icons to Font Awesome icons
        // @ptabaden: Removed counter and separate col for file-type icon
        // @ptabaden: added h4
        $columnValues = array(2, '<a href="' . $g_root_path . '/adm_program/modules/downloads/get_file.php?file_id=' . $nextFile['fil_id'] . '">
                <h4><i class="' . $iconFile . ' file-icon" alt="' . $gL10n->get('SYS_FILE') . '" title="' . $gL10n->get('SYS_FILE') . '"></i>' . $nextFile['fil_name'] . '</h4></a>' . $fileDescription, '<h5>' . $timestamp->format($gPreferences['system_date']) . '</h5>', '<h5>' . $nextFile['fil_size'] . 'kB</h5>');
        if ($gCurrentUser->editDownloadRight()) {
            // Links for change and delete
            // @ptabaden: changed icons
            $additionalFileFunctions = '';
            if ($nextFile['fil_exists'] === true) {