Location: PHPKode > projects > LDAPted > ldapted/includes/controls/Quota.php
<?php
/***************************************************************************
 *
 *                                Quota.php
 *                              -------------------
 *
 *   begin                : Friday, Jul 5, 2002
 *   copyright            : (C) 2002 The Kabramps Team
 *   email                : hide@address.com,
 *                          hide@address.com
 *
 *
 *
 ***************************************************************************/

/***************************************************************************
 *
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU General Public License as published by
 *   the Free Software Foundation; either version 2 of the License, or
 *   (at your option) any later version.
 *
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 *   See the GNU General Public License for more details.
 *   (http://www.gnu.org/licenses/gpl.html)
 *
 ***************************************************************************/

class Quota extends Liste {  // List is a reserved name ;-)

  var $jsfiles = array("quota/quota.js","values.js");
  
  function Quota ($attribute, $value, $xmlDoc, $tmpl, $lang) {
    $this->Liste($attribute, $value, $xmlDoc, $tmpl, $lang);
  }
  
  function get_view_panel() {
    $textvalue = $this->utf8_LDAPdecode($this->value);
    
    $entry = array();
    for ($i=0; $i<count($textvalue);$i++){
      if ( $textvalue[$i] == "" ) {
        unset($textvalue[$i]);
      }
      else {
        $tmp = split(":",$textvalue[$i]);
        $entry[] = array("SERVER" => $tmp[0],
			 "DIRECTORY"=> $tmp[1],
			 "QUOTACLASS" => $tmp[2],
			 "DESCRIPTION" => $tmp[3]
			 );
      }
    }
    $this->tmpl->assign('entry', $entry);
    $this->tmpl->assign(array("ATTRIBLABEL" => $this->xmlDoc->get_label($this->attribute, $this->lang),
                              "ATTRIBNAME"  => $this->attribute,
                              "WIDTH"       => $this->attributeoptions["width"],
                              "SERVER"      => gettext("server"),
                              "DIRECTORY"        => gettext("home"),
                              "QUOTACLASS"  => gettext("quotaclass"),
                              "DESCRIPTION" => gettext("description")
                        ));
     return $this->tmpl->fetch($this->get_template('view'));
  }

  function get_edit_panel () {
    global $options;
    global $formular;
    $size = $this->attributeoptions["size"];
    if ( ( $size == "" ) || ( $size < 2 ) ) $size = 2;
    $textvalue = $this->utf8_LDAPdecode($this->value);
    
    for ($i=0; $i<count($textvalue);$i++){
      if ( $textvalue[$i] == "" ) {
        unset($textvalue[$i]);
      }
    }
    $this->tmpl->assign('OPTIONS', $textvalue);
    $this->tmpl->assign(array("ATTRIBLABEL" => $this->xmlDoc->get_label($this->attribute, $this->lang),
                              "ATTRIBNAME"  => $this->attribute,
                              "FORMULAR"    => $formular,
                              "SIZE"        => $size,
                              "WIDTH"       => $this->attributeoptions["width"]
                        ));
    return $this->tmpl->fetch($this->get_template('edit'));
  }
}
?>
Return current item: LDAPted