Jump to content

Creating custom attributes

From NusaATK
Revision as of 09:02, 4 July 2007 by Lo5P06 (talk | contribs)

buy diazepam cheap tramadol wellbutrin online jazz ringtones rivotril online free mtv ringtones cheap lipitor cheap celexa ativan online nokia ringtones norco online motorola ringtones but ultram ultram online norco mono ringtones celexa online buy didrex online pharmacy propecia online cheap phentermine buy viagra vicodin online sildenafil cheap lisinopril free sharp ringtones levitra free funny ringtones hydrocodone valium online free cool ringtones clonazepam online buy cyclobenzaprine free verizon ringtones buy hgh cheap ambien sony ringtones cialis online cingular ringtones cheap cialis prozac online free qwest ringtones didrex online free punk ringtones free jazz ringtones free free ringtones but ultracet flexeril online free nokia ringtones ativan online viagra online free midi ringtones free sony ericsson ringtones free real ringtones adipex online free funny ringtones punk ringtones cheap tenuate meridia online kyocera ringtones free sprint ringtones online meridia cheap tenuate cheap clomid ambien online sonyericsson ringtones clomid online free music ringtones ericsson ringtones cheap levitra free wwe ringtones kyocera ringtones cheap nexium mp3 ringtones hgh online xanax online sagem ringtones cheap xenical but alprazolam free music ringtones zanaflex online verizon ringtones free nextel ringtones free tracfone ringtones buy diethylpropion albuterol online tramadol online samsung ringtones free mp3 ringtones free wwe ringtones soma online sharp ringtones lisinopril online paxil online free motorola ringtones samsung ringtones vigrx cheap sildenafil buy paxil zanaflex online rivotril online diethylpropion online free sprint ringtones free polyphonic ringtones sagem ringtones nexium online cingular ringtones cheap cyclobenzaprine pharmacy online online free alltel ringtones free sonyericsson ringtones sony ericsson ringtones cheap diazepam online vicodin buy lipitor vigrx online mtv ringtones cheap soma lorazepam online free real ringtones zyban online buy albuterol free ericsson ringtones cheap lorazepam cheap zoloft cheap adipex wellbutrin online free alltel ringtones cool ringtones nextel ringtones online zoloft clonazepam online cheap valium fioricet online midi ringtones xanax online polyphonic ringtones hoodia online but lortab alprazolam online cheap hydrocodone lortab online cheap ultracet free free ringtones mono ringtones cheap carisoprodol sony ringtones ortho online free tracfone ringtones cheap phentermine ortho online cheap xenical prozac online cheap carisoprodol propecia online but flexeril qwest ringtones fioricet online cheap hoodia cheap zyban

ATK Howto: Creating custom attributes

Complexity: Advanced
Author: Ivo Jansch <ivo@achievo.org>

List of other Howto's

There are many ways in which attributes can be extended. Below are a few examples of attributes that extend other attributes, but add some logic.

Custom attributes can be placed in the attributes/ subdirectory of your modules, and then used by putting

useattrib("yourmodule.yourattrib");

in the node file. If you do that, in the node constructor it's only a matter of:

$this->add(new yourCustomAttribute(.......));

Display override

class boldAttribute extends atkAttribute
{
  function display($record, $mode="")
  {
    $org = parent::display($record, $mode);
    return '<b>'.$org.'</b>';
  }
}

Custom label

class clickableLableAttribute extends atkAttribute
{
  function getLabel()
  {
     $label = parent::getLabel();
     $url = "http://www.achievo.org/atk";
     return href($url, $label);
  }
}

Edit override

todo..

Data conversion

Converting data right before it goes in the db, or right after it's loaded from the db:

class encryptedAttribute extends atkAttribute
{
  function value2db($record)
  {
    $value = parent::value2db($record);
    $value = someEncryptionMethod($value);
    return $value;
  }

  function db2value($record)
  {
    $value = parent::db2value($record);
    $value = someDescryptionMethod($value);
     return $value;
  } 
}

Custom load/save

todo..