当前位置: 首页>>代码示例>>PHP>>正文


PHP CActiveRecord::getAttribute方法代码示例

本文整理汇总了PHP中CActiveRecord::getAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP CActiveRecord::getAttribute方法的具体用法?PHP CActiveRecord::getAttribute怎么用?PHP CActiveRecord::getAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CActiveRecord的用法示例。


在下文中一共展示了CActiveRecord::getAttribute方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getAttribute

 public function getAttribute($field)
 {
     if ($field == 'adv_number') {
         return $this->adv_number;
     }
     return parent::getAttribute($field);
 }
开发者ID:qyt1988528,项目名称:union,代码行数:7,代码来源:CP.php

示例2: getAttribute

 public function getAttribute($name)
 {
     if ($name === 'cp.name') {
         return $this->cp->name;
     } else {
         return parent::getAttribute($name);
     }
 }
开发者ID:qyt1988528,项目名称:union,代码行数:8,代码来源:Advertise.php

示例3: getAttribute

 public function getAttribute($field)
 {
     switch ($field) {
         case 'adv.name':
             return $this->advertise->name;
         case 'channel.name':
             return $this->channel->name;
         case 'cp.name':
             return $this->advertise->cp->name;
         case 'uploader.name':
             return $this->uploader->name;
             /*11-12*/
         /*11-12*/
         case 'income_price':
             return sprintf("%01.2f", $this->income_price);
         case 'price':
             return sprintf("%01.2f", $this->price);
         case 'profit_margin':
             return sprintf("%01.2f", $this->profit_margin) . '%';
         case 'running_account':
             return sprintf("%01.2f", $this->running_account);
         case 'total_price':
             return sprintf("%01.2f", $this->total_price);
         case 'profit':
             return sprintf("%01.2f", $this->profit);
             /*end*/
     }
     return parent::getAttribute($field);
 }
开发者ID:qyt1988528,项目名称:union,代码行数:29,代码来源:AdvData.php

示例4: getAttribute

 public function getAttribute($name)
 {
     $value = parent::getAttribute($name);
     if (is_array($value)) {
         $value = implode(",", $value);
     }
     return $value;
 }
开发者ID:cebe,项目名称:chive,代码行数:8,代码来源:Row.php

示例5: getAttribute

 /**
  * Returns the named attribute value.
  * Recognizes linked attributes and looks them up with {@link getLinkedAttribute()}
  * @param string $name the attribute name
  * @param bool $renderFlag
  * @param bool $makeLinks If the render flag is set, determines whether to render attributes
  *  as links
  * @return mixed the attribute value. Null if the attribute is not set or does not exist.
  * @see hasAttribute
  */
 public function getAttribute($name, $renderFlag = false, $makeLinks = false)
 {
     $nameParts = explode('.', $name);
     // check for a linked attribute (eg. "account.assignedTo")
     if (count($nameParts) > 1) {
         // We have a complicated link like "account.primaryContact.email"
         $linkField = array_shift($nameParts);
         // Remove the current model
         $linkModel = $this->getLinkedModel($linkField);
         $name = implode('.', $nameParts);
         // Put the name back together e.g. primaryContact.email
         if (isset($linkModel)) {
             return $linkModel->getAttribute($name, $renderFlag);
         } else {
             $fieldInfo = $this->getField($linkField);
             // If it's an assignment field, check the Profile model
             if ($fieldInfo instanceof Fields && $fieldInfo->type == 'assignment') {
                 $profRecord = X2Model::model('Profile')->findByAttributes(array('username' => $this->{$linkField}));
                 if (isset($profRecord)) {
                     return $profRecord->getAttribute($name, false);
                 }
             }
         }
     } else {
         if ($renderFlag) {
             return $this->renderAttribute($name, $makeLinks);
         } else {
             return parent::getAttribute($name);
         }
     }
     return null;
 }
开发者ID:keyeMyria,项目名称:CRM,代码行数:42,代码来源:X2Model.php

示例6: getAttribute

 public function getAttribute($field)
 {
     switch ($field) {
         case 'cp.name':
             return $this->cp ? $this->cp->name : '';
         case 'adv.name':
             return $this->advertise ? $this->advertise->name : '';
         case 'channel.name':
             return $this->channel ? $this->channel->name : '';
     }
     return parent::getAttribute($field);
 }
开发者ID:qyt1988528,项目名称:union,代码行数:12,代码来源:AdvertiseChannel.php

示例7: inheritvalues

 /**
  * This method is used to at create/copy or move. If the last $inherit attribute is true
  * the nodes under current and current also will inherit the values from the new parent.
  * @param CActiveRecord $current node that is created/copied or moved
  * @param CActiveRecord $parent the new parent in either senario
  */
 public function inheritvalues($current, $parent)
 {
     //        $differentparent = $parent->getAttribute($this->identity)!=$current->parent()->getAttribute($this->identity);
     //        if ( $differentparent ) {
     foreach ($this->inherit as $attr) {
         $current->setAttribute($attr, $parent->getAttribute($attr));
     }
     $current->saveNode();
     $descendants = $current->descendants()->findAll();
     foreach ($descendants as $i => $node) {
         foreach ($this->inherit as $attr) {
             $node->setAttribute($attr, $parent->getAttribute($attr));
         }
         $node->saveNode();
     }
     //}
 }
开发者ID:samdark,项目名称:EJNestedTreeActions,代码行数:23,代码来源:EBehavior.php


注:本文中的CActiveRecord::getAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。