Ignore:
Timestamp:
Feb 7, 2014, 5:14:20 PM (10 years ago)
Author:
maron
Message:
  • Added: Users tag. Means style translation names for users
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Modules/User/Options.php

    r636 r787  
    3030                                '<tr><td>Upřednostněná verze klienta: </td><td>'.ClientVersionSelection($this->System->User->PreferredVersion).'</td></tr>'.
    3131                                '<tr><td>Veřejný text profilu:</td><td>'.
    32                                 '<textarea name="info" cols="60" rows="10">'.$this->System->User->Info.'</textarea></td></tr>'.
    33                                 '<tr><td colspan="2"><input type="submit" value="Uložit" /></td></tr>'.
     32                                '<textarea name="info" cols="60" rows="10">'.$this->System->User->Info.'</textarea></td></tr>';
     33       
     34       
     35    $Output .= '<tr><td>';
     36                $Query = 'SELECT * FROM UserTagType';
     37                $DbResult = $this->Database->query($Query);
     38    $Output .= 'Překladatel se řídí zaškrtnutými pravidly:</td><td>';
     39    while ($UserTag = $DbResult->fetch_array()) {
     40                 $Query = 'SELECT * FROM `UserTag` '.
     41     //'LEFT JOIN `UserTagType` ON `UserTagType`.`ID` = `UserTag`.`UserTagType` '.
     42     'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($this->System->User->Id * 1);
     43                  $DbResult2 = $this->Database->query($Query);
     44      if ($DbResult2->num_rows != 0) $checked = true;
     45      else  $checked = false;
     46     
     47      $Output .= CheckBox('Tag'.$UserTag['ID'], $checked, 'CheckBox');   
     48      $Output .= ''.$UserTag['Text'].'<br />';
     49    }
     50    $Output .= '</td></tr>';
     51   
     52                $Output .= '<tr><td colspan="2"><input type="submit" value="Uložit" /></td></tr>'.
    3453                                '</table></fieldset>'.
    3554                                '</form>';
     
    85104                                } else $Output .= ShowMessage('Hesla se neshodují.', MESSAGE_CRITICAL);
    86105                        }
     106      //tag
     107                $Query = 'SELECT * FROM UserTagType';
     108                $DbResult = $this->Database->query($Query);
     109      while ($UserTag = $DbResult->fetch_array()) {
     110       if (array_key_exists('Tag'.$UserTag['ID'], $_POST)) {
     111                   $Query = 'SELECT * FROM `UserTag` '.
     112         'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($this->System->User->Id * 1);
     113                 $DbResult2 = $this->Database->query($Query);
     114         if ($DbResult2->num_rows == 0) {
     115                   $Query = 'INSERT INTO `UserTag` (`ID` ,`UserTagType`,`User` ) '.
     116           'VALUES (NULL, '.$UserTag['ID'].' , '.($this->System->User->Id * 1).')';
     117                 $DbResult2 = $this->Database->query($Query);
     118         }
     119       } else {
     120                   $Query = 'DELETE FROM `UserTag` '.
     121         'WHERE `UserTagType` = '.$UserTag['ID'].' AND `User` = '.($this->System->User->Id * 1);
     122                     $DbResult2 = $this->Database->query($Query);
     123       }
     124      }
     125     
    87126                        $this->Database->update('User', '`ID` = '.$this->System->User->Id, array('Email' => $Email,
    88127                          'Language' => $Language, 'Redirecting' => $Redirecting, 'Info' => $Info,
Note: See TracChangeset for help on using the changeset viewer.