Back to index

awl  0.53
Public Member Functions | Public Attributes
EditorField Class Reference

List of all members.

Public Member Functions

 __construct ($field, $sql="", $lookup_sql="")
 Set ($value)
 SetSql ($sql)
 SetLookup ($lookup_sql)
 SetOptionList ($options, $current=null, $parameters=null)
 GetTarget ()
 AddAttribute ($k, $v)
 RenderLabel ($wrapme)
 RenderAttributes ()

Public Attributes

 $Field
 $Sql
 $Value
 $Attributes
 $LookupSql
 $OptionList

Detailed Description

Definition at line 19 of file classEditor.php.


Constructor & Destructor Documentation

EditorField::__construct ( field,
sql = "",
lookup_sql = "" 
)

Definition at line 28 of file classEditor.php.

                                                          {
    global $session;
    $this->Field      = $field;
    $this->Sql        = $sql;
    $this->LookupSql  = $lookup_sql;
    $this->Attributes = array();
  }

Member Function Documentation

EditorField::AddAttribute ( k,
v 
)

Definition at line 79 of file classEditor.php.

                                  {
    $this->Attributes[$k] = $v;
  }

Definition at line 74 of file classEditor.php.

                       {
    if ( $this->Sql == "" ) return $this->Field;
    return "$this->Sql AS $this->Field";
  }

Definition at line 91 of file classEditor.php.

                              {
    $attributes = "";
    if ( count($this->Attributes) == 0 ) return $attributes;
    foreach( $this->Attributes AS $k => $v ) {
      if ( $k == '_label' ) continue;
      $attributes .= " $k=\"" . str_replace('"', ''', $v) . '"';
    }
    return $attributes;
  }
EditorField::RenderLabel ( wrapme)

Definition at line 83 of file classEditor.php.

                                  {
    if ( !isset($this->Attributes['_label']) || !isset($this->Attributes['id'])) return $wrapme;
    $class = (isset($this->Attributes['class']) ? $this->Attributes['class'] : 'entry');
    $title = (isset($this->Attributes['title']) ? ' title="'.str_replace('"', ''', $this->Attributes['title']) . '"' : '');
    return( sprintf( '<label for="%s" class="%s"%s>%s %s</label>',
             $this->Attributes['id'], $class, $title, $wrapme, $this->Attributes['_label']) );
  }
EditorField::Set ( value)

Definition at line 36 of file classEditor.php.

                       {
    $this->Value = $value;
  }
EditorField::SetLookup ( lookup_sql)

Definition at line 44 of file classEditor.php.

                                    {
    $this->LookupSql  = $lookup_sql;
  }
EditorField::SetOptionList ( options,
current = null,
parameters = null 
)

Definition at line 48 of file classEditor.php.

                                                                         {
    if ( gettype($options) == 'array' ) {
      $this->OptionList = '';

      if ( is_array($parameters) ) {
        if ( isset($parameters['maxwidth']) ) $maxwidth = max(4,intval($parameters['maxwidth']));
        if ( isset($parameters['translate']) ) $translate = true;
      }

      foreach( $options AS $k => $v ) {
        if (is_array($current)) {
          $selected = ( ( in_array($k,$current,true) || in_array($v,$current,true)) ? ' selected="selected"' : '' );
        }
        else {
          $selected = ( ( "$k" == "$current" || "$v" == "$current" ) ? ' selected="selected"' : '' );
        }
        if ( isset($translate) ) $v = translate( $v );
        if ( isset($maxwidth) ) $v = substr( $v, 0, $maxwidth);
        $this->OptionList .= "<option value=\"".htmlspecialchars($k)."\"$selected>".htmlspecialchars($v)."</option>";
      }
    }
    else {
      $this->OptionList = $options;
    }
  }
EditorField::SetSql ( sql)

Definition at line 40 of file classEditor.php.

                          {
    $this->Sql  = $sql;
  }

Member Data Documentation

Definition at line 24 of file classEditor.php.

Definition at line 21 of file classEditor.php.

Definition at line 25 of file classEditor.php.

Definition at line 26 of file classEditor.php.

Definition at line 22 of file classEditor.php.

Definition at line 23 of file classEditor.php.


The documentation for this class was generated from the following file: