Esempio n. 1
0
 /**
  * This is get info function, via info id and type
  * 
  * @param string $lowerItem
  * @param integer $id
  * @param boolean $compatible
  * @return type 
  */
 public function getInfo($lowerItem, $id, $compatible = false)
 {
     $code = API::ERROR_NONE;
     $result = @InfoService::loadRawData($lowerItem, $id);
     $detail = $result['detail'];
     if (CommonService::$ApiResult['FAIL'] === $result['status']) {
         $code = API::ERROR_SAVE_INFO;
         $info = $detail;
     } else {
         $info = $detail->getBasicInfo()->attributes + $detail->getCustomInfo();
         $info['repeat_step'] = CHtml::encode($info['repeat_step']);
         $actionList = ActionHistoryService::getInfoActionForApi($lowerItem, $id, $detail->getBasicInfo()->product_id);
         $info['action_list'] = $actionList;
         if ($compatible) {
             foreach ($info as $key => $val) {
                 unset($info[$key]);
                 $key = $this->fieldNew2Old($key, $lowerItem);
                 $info[$key] = $val;
             }
         } else {
             $info['attachment_file'] = array();
             foreach ($detail->getBasicInfo()->attachment_file as $val) {
                 unset($val['is_dropped']);
                 unset($val['target_id']);
                 unset($val['target_type']);
                 unset($val['add_action_id']);
                 unset($val['delete_action_id']);
                 $info['attachment_file'][] = $val;
             }
         }
     }
     return array($code, $info);
 }