Changeset 694 for trunk/Modules/User


Ignore:
Timestamp:
Sep 14, 2014, 9:41:58 PM (10 years ago)
Author:
chronos
Message:
  • Added: Show list of registered user contacts in user panel.
File:
1 edited

Legend:

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

    r693 r694  
    1313        $Title .= '<div class="Action">'.$Item.'</div>';
    1414    return('<div class="Panel"><div class="Title">'.$Title.'</div><div class="Content">'.$Content.'</div></div>');
     15  }
     16
     17  function ShowContacts()
     18  {
     19    $Query = 'SELECT `Contact`.`Value`, (SELECT `Name` FROM `ContactCategory` WHERE `ContactCategory`.`Id` = `Contact`.`Category`) AS `Category` '.
     20      'FROM `Contact` WHERE `User` = '.
     21      $this->System->User->User['Id'];
     22    $DbResult = $this->Database->query('SELECT COUNT(*) FROM ('.$Query.') AS T');
     23    $DbRow = $DbResult->fetch_row();
     24    $PageList = GetPageList($DbRow[0]);
     25
     26    $Output = '<div>Kontakty</div>';
     27    $Output .= $PageList['Output'];
     28    $Output .= '<table class="WideTable" style="font-size: small;">';
     29
     30    $TableColumns = array(
     31      array('Name' => 'Category', 'Title' => 'Skupina'),
     32      array('Name' => 'Value', 'Title' => 'Hodnota'),
     33    );
     34    $Order = GetOrderTableHeader($TableColumns, 'Value', 0);
     35    $Output .= $Order['Output'];
     36
     37    $Query = $Query.' '.$Order['SQL'].$PageList['SQLLimit'];
     38
     39    $DbResult = $this->Database->query($Query);
     40    while($Contact = $DbResult->fetch_assoc())
     41    {
     42      $Output .= '<tr><td>'.$Contact['Category'].'</td>'.
     43      '<td>'.$Contact['Value'].'</td></tr>';
     44    }
     45    $Output .= '</table>';
     46    $Output .= $PageList['Output'];
     47
     48    return($Output);
    1549  }
    1650
     
    2963          } else $Actions .= call_user_func($Action).'<br/>';
    3064        }
    31       $Output .= '<div class="Centred"><table id="MainTable"><tr><td>';
     65      $Output .= '<div class="Centred"><table id="MainTable"><tr><td style="vertical-align:top;">';
    3266      $Output .= $this->Panel('Nabídka uživatele', $Actions);
    33       $Output .= '</td><td>';
     67      $Output .= '</td><td style="vertical-align:top;">';
    3468      if($this->System->User->User['Id'] != null)
    3569        {
     
    3973          $Form->OnSubmit = '?Action=UserOptionsSave';
    4074          $Output .= $Form->ShowViewForm();
     75
     76          $Output .= '<br/>'.$this->ShowContacts();
    4177        } else $Output .= $this->SystemMessage('Nastavení uživatele', 'Nejste přihlášen');
    4278
Note: See TracChangeset for help on using the changeset viewer.