[ Index ]
 

Code source de eGroupWare 1.2.106-2

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/sambaadmin/inc/ -> class.uisambaadmin.inc.php (source)

   1  <?php
   2      /***************************************************************************\
   3      * eGroupWare - SambaAdmin                                                   *
   4      * http://www.egroupware.org                                                 *
   5      * http://www.linux-at-work.de                                               *
   6      * Written by : Lars Kneschke [lkneschke@linux-at-work.de]                   *
   7      * -------------------------------------------------                         *
   8      * This program is free software; you can redistribute it and/or modify it   *
   9      * under the terms of the GNU General Public License as published by the     *
  10      * Free Software Foundation; either version 2 of the License, or (at your    *
  11      * option) any later version.                                                *
  12      \***************************************************************************/
  13      /* $Id: class.uisambaadmin.inc.php 20093 2005-12-02 16:35:48Z lkneschke $ */
  14  
  15      class uisambaadmin
  16      {
  17          #var $grants;
  18          #var $cat_id;
  19          #var $start;
  20          #var $search;
  21          #var $filter;
  22  
  23          var $public_functions = array
  24          (
  25              'checkLDAPSetup'    => True,
  26              'listWorkstations'    => True,
  27              'deleteWorkstation'    => True,
  28              'editWorkstation'    => True,
  29              'setSearchFilter'    => True,
  30          );
  31  
  32  		function uisambaadmin()
  33          {
  34              $this->restoreSessionData();
  35              
  36              $this->t            =& CreateObject('phpgwapi.Template',EGW_APP_TPL);
  37              $this->bosambaadmin        =& CreateObject('sambaadmin.bosambaadmin');
  38              
  39              $this->rowColor[0] = $GLOBALS['egw_info']["theme"]["row_on"];
  40              $this->rowColor[1] = $GLOBALS['egw_info']["theme"]["row_off"];
  41  
  42              $this->dataRowColor[0] = $GLOBALS['egw_info']["theme"]["bg01"];
  43              $this->dataRowColor[1] = $GLOBALS['egw_info']["theme"]["bg02"];
  44                                               
  45          }
  46          
  47  		function checkLDAPSetup()
  48          {
  49              $this->bosambaadmin->checkLDAPSetup();
  50          }
  51          
  52  		function deleteWorkstation()
  53          {
  54              if($workstations = get_var('deleteWorkstation','POST'))
  55              {
  56                  $this->bosambaadmin->deleteWorkstation($workstations);
  57              }
  58              $this->listWorkstations();
  59          }
  60          
  61  		function displayAppHeader()
  62          {
  63              $GLOBALS['egw']->common->egw_header();
  64              echo parse_navbar();
  65          }
  66  
  67  		function editWorkstation($_workstationID='')
  68          {
  69              $workstationData = array();
  70              
  71              if(get_var('workstationID',array('GET','POST')))
  72              {
  73                  $workstationID = get_var('workstationID',array('GET','POST'));
  74              }
  75              else
  76              {
  77                  $workstationID = $_workstationID;
  78              }
  79              
  80              if(get_var('save','POST'))
  81              {
  82                  $workstationData['workstationName']    = get_var('workstationname','POST');
  83                  $workstationData['workstationID']    = get_var('workstationID','POST');
  84                  $workstationData['description']        = get_var('description','POST');
  85                  
  86                  if($newUID = $this->bosambaadmin->updateWorkstation($workstationData))
  87                  {
  88                      $workstationID = $newUID;
  89                      $this->listWorkstations();
  90                      return;
  91                  }
  92              }
  93              
  94              $this->displayAppHeader();
  95  
  96              $this->t->set_file(array("body" => 'editworkstation.tpl'));
  97              $this->t->set_block('body','main');
  98              
  99              $this->translate();
 100              
 101              $linkData = array
 102              (
 103                  'menuaction'    => 'sambaadmin.uisambaadmin.editWorkstation'
 104              );
 105              $this->t->set_var('form_action',$GLOBALS['egw']->link('/index.php',$linkData));
 106  
 107              $linkData = array
 108              (
 109                  'menuaction'    => 'sambaadmin.uisambaadmin.listWorkstations'
 110              );
 111              $this->t->set_var('back_link',$GLOBALS['egw']->link('/index.php',$linkData));
 112  
 113              if(is_numeric($workstationID) && $workstationID > 0)
 114              {
 115                  $workstationData = $this->bosambaadmin->getWorkstationData($workstationID);
 116                  $this->t->set_var('workstationid',$workstationData['workstationID']);
 117              }
 118              else
 119              {
 120                  $this->t->set_var('workstationid','new');
 121              }
 122  
 123              $this->t->set_var('workstationname',$workstationData['workstationName']);
 124              $this->t->set_var('description',$workstationData['description']);
 125  
 126              print $this->t->fp("out","main");
 127              #print $this->t->get('out','main');
 128          }
 129          
 130  		function listWorkstations()
 131          {
 132              $sort    = get_var('sort',array('POST','GET')) ? get_var('sort',array('POST','GET')) : 'ASC';
 133              $order    = get_var('order',array('POST','GET')) ? get_var('order',array('POST','GET')) : 'workstation_name';
 134              $start  = get_var('start',array('POST','GET')) ? get_var('start',array('POST','GET')) : 0;
 135              
 136              $nextMatch =& CreateObject('sambaadmin.uibaseclass');
 137              $workstationList = $this->bosambaadmin->getWorkstationList($start, $sort, $order, $this->sessionData['searchString']);
 138              $this->displayAppHeader();
 139  
 140              $this->t->set_file(array("body" => 'listworkstations.tpl'));
 141              $this->t->set_block('body','main');
 142              #$this->t->set_block('body','status_row_tpl');
 143              #$this->t->set_block('body','header_row');
 144              
 145              $linkData = array
 146              (
 147                  'menuaction'    => 'sambaadmin.uisambaadmin.editWorkstation'
 148              );
 149              $this->t->set_var('add_link',$GLOBALS['egw']->link('/index.php',$linkData));
 150  
 151              $linkData = array
 152              (
 153                  'menuaction'    => 'sambaadmin.uisambaadmin.deleteWorkstation'
 154              );
 155              $formAction = $GLOBALS['egw']->link('/index.php',$linkData);
 156  
 157              $linkData = array
 158              (
 159                  'menuaction'    => 'sambaadmin.uisambaadmin.setSearchFilter'
 160              );
 161              $this->t->set_var('search_form_action',$GLOBALS['egw']->link('/index.php',$linkData));
 162              
 163              $this->t->set_var('search_string',$this->sessionData['searchString']);
 164              
 165              $tableHeader = array
 166              (
 167                  lang('workstation name') => 'workstation_name',
 168                  lang('description')    => 'description',
 169                  lang('delete')        => ''
 170                  
 171              );
 172              
 173              if(is_array($workstationList['workstations']))
 174              {
 175                  $wsCount = count($workstationList['workstations']);
 176                  for($i = 0; $i < $wsCount; $i++)
 177                  {
 178                      $linkData = array
 179                      (
 180                          'menuaction'    => 'sambaadmin.uisambaadmin.editWorkstation',
 181                          'workstationID'    => $workstationList['workstations'][$i]['uidnumber'][0]
 182                      );
 183                      $editLink = $GLOBALS['egw']->link('/index.php',$linkData);
 184                      
 185                      $rows[] = array
 186                      (
 187                          'workstationname'    => '<a href="'.$editLink.'">'.$workstationList['workstations'][$i]['uid'][0].'</a>',
 188                          'description'        => '<a href="'.$editLink.'">'.$workstationList['workstations'][$i]['description'][0].'</a>',
 189                          'select'        => '<input type="checkbox" name="deleteWorkstation['.$workstationList['workstations'][$i]['uidnumber'][0].']">'
 190                      );
 191                  }
 192              }
 193              
 194              $tablePrefix = "<form method='POST' action='$formAction'>";
 195              
 196              $this->t->set_var
 197              (
 198                  'next_match_table',$nextMatch->create_table
 199                  (
 200                      $start, 
 201                      $workstationList['total'], 
 202                      $sort,
 203                      $order,
 204                      $tableHeader, 
 205                      $rows,
 206                      'sambaadmin.uibaseclass.listWorkstations',
 207                      lang('workstations'),
 208                      $tablePrefix
 209                  )
 210              );
 211  
 212              $this->translate();
 213  
 214              $this->t->parse("out","main");
 215              print $this->t->get('out','main');
 216          }
 217          
 218  		function restoreSessionData()
 219          {
 220              $this->sessionData = $GLOBALS['egw']->session->appsession('session_data');
 221          }
 222          
 223  		function saveSessionData()
 224          {
 225              $GLOBALS['egw']->session->appsession('session_data','',$this->sessionData);
 226          }
 227          
 228  		function setSearchFilter()
 229          {
 230              $this->sessionData['searchString'] = $_POST['search_string'];
 231              
 232              $this->saveSessionData();
 233              
 234              $this->listWorkstations();
 235          }
 236  
 237  
 238  		function translate()
 239          {
 240              $this->t->set_var('th_bg',$GLOBALS['egw_info']["theme"]["th_bg"]);
 241              $this->t->set_var('bg_01',$GLOBALS['egw_info']["theme"]["bg01"]);
 242              $this->t->set_var('bg_02',$GLOBALS['egw_info']["theme"]["bg02"]);
 243  
 244              $this->t->set_var('lang_workstation_list',lang('workstation list'));
 245              $this->t->set_var('lang_add_workstation',lang('add workstation'));
 246              $this->t->set_var('lang_workstation_name',lang('workstation name'));
 247              $this->t->set_var('lang_description',lang('description'));
 248              $this->t->set_var('lang_select',lang('select'));
 249              $this->t->set_var('lang_workstation_config',lang('workstation configuration'));
 250              $this->t->set_var('lang_account_active',lang('workstationaccount active'));
 251              $this->t->set_var('lang_save',lang('save'));
 252              $this->t->set_var('lang_back',lang('back'));
 253              $this->t->set_var('lang_delete',lang('delete'));
 254              $this->t->set_var('lang_do_you_really_want_to_delete',lang('Do you really want to delete selected workstation accounts?'));
 255              $this->t->set_var('lang_search',lang('search'));
 256          }
 257      }
 258  ?>


Généré le : Sun Feb 25 17:20:01 2007 par Balluche grâce à PHPXref 0.7