Esempio n. 1
0
 protected function generateSearchForm()
 {
     if (!$this->checkSearchDefinition()) {
         return '';
     }
     $controller = $this->search_definition['controller'];
     $form = $this->search_definition['form'];
     $search_session = $this->getValuesSessionPost($controller);
     // print_r($_SESSION);
     // print_r($_POST);
     // var_dump($search_session);
     $o = '<tr class="form_search">';
     $o .= '<form method="post" action="' . ClassTools::getDomainLink() . ClassTools::getValue('controller') . '">';
     foreach ($form as $column_name => $values) {
         $class = isset($values['class']) ? ' class="' . $values['class'] . '"' : '';
         $type = isset($values['type']) ? $values['type'] : false;
         $o .= "<td{$class}>";
         switch ($type) {
             case 'text':
                 $o .= '<input type="text" value="' . ($search_session && isset($search_session[$column_name]) ? htmlspecialchars($search_session[$column_name]) : '') . '" name="' . $column_name . '" />';
                 break;
             case 'select':
                 $class_select = isset($values['search']) && $values['search'] === true ? 'jsselect' : 'jsselectnosearch';
                 if (isset($values['optgroup']) && is_array($values['optgroup']) && count($values['optgroup']) > 0) {
                     $o .= '<select name="' . $column_name . '" class="' . $class_select . '">';
                     $o .= '<option value="">---</option>';
                     foreach ($values['optgroup'] as $group) {
                         $o .= '<optgroup label="' . htmlspecialchars($group['name']) . '">';
                         if (isset($group['childs']) && is_array($group['childs']) && count($group['childs']) > 0) {
                             foreach ($group['childs'] as $key_type => $type) {
                                 $selected = $search_session && isset($search_session[$column_name]) && $search_session[$column_name] != '' && $search_session[$column_name] == $key_type ? ' selected="selected"' : '';
                                 $o .= '<option value="' . $key_type . '"' . $selected . '>' . htmlspecialchars($type) . '</option>';
                             }
                         }
                         $o .= '</optgroup>';
                     }
                     $o .= '</select>';
                 } elseif (isset($values['options']) && is_array($values['options']) && count($values['options']) > 0) {
                     $o .= '<select name="' . $column_name . '" class="' . $class_select . '">';
                     $o .= '<option value="">---</option>';
                     foreach ($values['options'] as $option_key => $option_value) {
                         $selected = $search_session && isset($search_session[$column_name]) && $search_session[$column_name] != '' && $search_session[$column_name] == $option_key ? ' selected="selected"' : '';
                         $o .= '<option value="' . $option_key . '"' . $selected . '>' . $option_value . '</option>';
                     }
                     $o .= '</select>';
                 }
                 break;
             default:
                 if ($column_name == 'actions') {
                     $o .= '<div class="btn-group btn-group-sm">
                             <button class="btn btn-primary" value="search" name="form_action_search" type="submit">Szukaj</button>
                             <button class="btn btn-warning" value="search_delete" name="form_action_search" type="submit">Wyczyść</button>
                         </div>
                         ';
                 } else {
                     // $o .= '---';
                     $o .= '';
                 }
                 break;
         }
         $o .= '</td>';
     }
     $o .= '</form>';
     $o .= '</tr>';
     return $o;
 }
Esempio n. 2
0
 protected function sendMailNewPasswordLink($adres, $password_key)
 {
     // mail
     // $adres = "*****@*****.**";
     // od kogo
     $from = "System Ewidencji Wojskowej <*****@*****.**>";
     // temat
     $temat = "Resetowanie hasła";
     // link
     $link = ClassTools::getDomainLink() . "haslo/{$password_key}";
     // wysylka
     $boundary = "-->===_54654747_===<---->>4255==_";
     $head = 'From: ' . $from . "\n";
     $head .= "MIME-version: 1.0\n";
     $head .= "Content-type: multipart/mixed; ";
     $head .= "boundary=\"{$boundary}\"\n";
     $head .= "Content-Transfer-Encoding: 8bit\n";
     $head .= "charset=\"iso-8859-2\"\n";
     $tresc_maila = "--" . $boundary . "\n";
     $tresc_maila .= "Content-Type: text/plain; charset=\"iso-8859-2\"\n\n";
     $tresc_maila .= "Aby zresetować hasło proszę wejść na na poniższy link:\n\n";
     $tresc_maila .= '<a href="' . $link . '">' . $link . '</a>' . "\n\n";
     $tresc_maila .= "Link aktywny jest tylko przez " . ClassAuth::$password_link_time . " godzin.\n\n";
     $tresc_maila .= "Wiadomość została wygenerowana przez system, prosimy na niego nie odpowiadać.\n\n";
     $tresc_maila .= "--" . $boundary . "-- \n\n";
     $temat_iso = iconv('UTF-8', 'ISO-8859-2//TRANSLIT', $temat);
     $tresc_maila_iso = iconv('UTF-8', 'ISO-8859-2//TRANSLIT', $tresc_maila);
     $head_iso = iconv('UTF-8', 'ISO-8859-2//TRANSLIT', $head);
     mail($adres, $temat_iso, $tresc_maila_iso, $head_iso);
     // mail($adres, $temat, $tresc_maila, $head);
 }