public static function getSingleHistoryStr($fieldLabelArr, $type, $productId, $historyInfo) { $singleHistoryStr = ''; if (isset($fieldLabelArr[$historyInfo['action_field']])) { $fieldName = $fieldLabelArr[$historyInfo['action_field']]; } else { //search label in Common.php if BugInfo.php not contain related label //ex. created_by field $fieldName = Yii::t('Common', Yii::t(ucfirst($type) . 'Info', $historyInfo['action_field'])); } if ('repeat_step' == $historyInfo['action_field'] || 'case_step' == $historyInfo['action_field'] || 'result_step' == $historyInfo['action_field']) { $historyInfo['old_value'] = htmlspecialchars($historyInfo['old_value']); $historyInfo['old_value'] = str_replace("\r\n", '', $historyInfo['old_value']); $historyInfo['old_value'] = str_replace("\n", '', $historyInfo['old_value']); $historyInfo['new_value'] = htmlspecialchars($historyInfo['new_value']); $historyInfo['new_value'] = str_replace("\r\n", '', $historyInfo['new_value']); $historyInfo['new_value'] = str_replace("\n", '', $historyInfo['new_value']); $singleHistoryStr = 'Changed <strong>' . $fieldName . '</strong> from <strong onmouseover="return overlib(\'' . str_replace("'", "\\'", str_replace("\"", "\\\"", $historyInfo['old_value'])) . '\',ABOVE,WIDTH,300,BGCOLOR,\'#75736E\',FGCOLOR,\'#F6F6F6\');" onmouseout="return nd();">' . '"<a href="javascript:void(0);">...</a>"</strong> to <strong onmouseover="return overlib(\'' . str_replace("'", "\\'", str_replace("\"", "\\\"", $historyInfo['new_value'])) . '\',ABOVE,WIDTH,300,BGCOLOR,\'#75736E\',FGCOLOR,\'#F6F6F6\');" onmouseout="return nd();">' . '"<a href="javascript:void(0);" >...</a>"</strong>'; } else { if ('delete_flag' == $historyInfo['action_field']) { $historyInfo['old_value'] = CommonService::getTrueFalseName($historyInfo['old_value']); $historyInfo['new_value'] = CommonService::getTrueFalseName($historyInfo['new_value']); } else { if ('severity' == $historyInfo['action_field'] || 'priority' == $historyInfo['action_field']) { $nameArr = array(); if ('priority' == $historyInfo['action_field']) { if (Info::TYPE_BUG == $type) { $nameArr = ProductService::getBugPriorityOption($productId); } else { $nameArr = ProductService::getCasePriorityOption($productId); } } else { $nameArr = ProductService::getBugSeverityOption($productId); } $historyInfo['old_value'] = CommonService::getNameByValue($nameArr, $historyInfo['old_value']); $historyInfo['new_value'] = CommonService::getNameByValue($nameArr, $historyInfo['new_value']); } } $singleHistoryStr = 'Changed <strong>' . $fieldName . '</strong> from <strong>"' . CHtml::encode($historyInfo['old_value']) . '"</strong> to <strong>"' . CHtml::encode($historyInfo['new_value']) . '"</strong>'; } return $singleHistoryStr; }
public static function getFilterLink($infoType, $productId, $columnName, $value, $fieldType) { if (Info::$InputType['date'] == $fieldType) { $value = substr($value, 0, 10); } if ('delete_flag' == $columnName) { return '<a href="' . Yii::app()->createUrl('info/index', array('type' => $infoType, 'product_id' => $productId, 'filter' => $columnName . '|' . $value)) . '">' . CHtml::encode(CommonService::getTrueFalseName($value)) . '</a>'; } else { if ('result_value' == $columnName && Info::TYPE_RESULT == $infoType) { $statusColorConfig = ResultInfo::getResultValueColorConfig(); return '<a href="' . Yii::app()->createUrl('info/index', array('type' => $infoType, 'product_id' => $productId, 'filter' => $columnName . '|' . $value)) . '" style="color:' . $statusColorConfig[$value] . '">' . CHtml::encode($value) . '</a>'; } else { if ('priority' == $columnName || 'severity' == $columnName) { $nameArr = array(); if ('priority' == $columnName) { if (Info::TYPE_BUG == $infoType) { $nameArr = ProductService::getBugPriorityOption($productId); } else { if (Info::TYPE_CASE == $infoType) { $nameArr = ProductService::getCasePriorityOption($productId); } } } else { $nameArr = ProductService::getBugSeverityOption($productId); } return '<a href="' . Yii::app()->createUrl('info/index', array('type' => $infoType, 'product_id' => $productId, 'filter' => $columnName . '|' . $value)) . '">' . CHtml::encode(CommonService::getNameByValue($nameArr, $value)) . '</a>'; } else { return '<a href="' . Yii::app()->createUrl('info/index', array('type' => $infoType, 'product_id' => $productId, 'filter' => $columnName . '|' . $value)) . '">' . CHtml::encode($value) . '</a>'; } } } }
?> </div> <div class="row"> <?php echo $form->label($model, 'severity'); ?> <?php echo CHtml::encode(CommonService::getNameByValue(ProductService::getBugSeverityOption($model['product_id']), $model->severity)); ?> </div> <div class="row"> <?php echo $form->label($model, 'priority'); ?> <?php echo CHtml::encode(CommonService::getNameByValue(ProductService::getBugPriorityOption($model['product_id']), $model->priority)); ?> </div> <?php echo empty($customfield['bug_status']) ? '' : $customfield['bug_status']; ?> <div class="row"> <?php echo $form->label($model, 'updated_by'); ?> <?php echo CHtml::encode($model->updated_by_name); ?> </div> <div class="row"> <?php
public static function handleRawData($rawData, $infoType, $searchFieldConfig, $columnArr, $productId) { $needHandleFieldArr = array(); $needHandleFieldTypeArr = array(Info::$InputType['multipeople']); foreach ($columnArr as $columnName) { if (isset($searchFieldConfig[$columnName])) { $fieldInfo = $searchFieldConfig[$columnName]; if (true == $fieldInfo['isBasic'] && in_array($fieldInfo['type'], $needHandleFieldTypeArr) && 'mail_to' != $columnName) { $needHandleFieldArr[$columnName] = $fieldInfo['type']; } } } $priorityArr = array(); $severityArr = array(); if (!empty($productId)) { if (Info::TYPE_BUG == $infoType) { $priorityArr = ProductService::getBugPriorityOption($productId); $severityArr = ProductService::getBugSeverityOption($productId); } else { $priorityArr = ProductService::getCasePriorityOption($productId); } } $handleResultArr = array(); $rawDataNum = count($rawData); for ($i = 0; $i < $rawDataNum; $i++) { foreach ($needHandleFieldArr as $needHandledKey => $type) { $rawData[$i][$needHandledKey] = self::parseRawData($rawData[$i][$needHandledKey], $infoType, $needHandledKey, $type); } if (isset($rawData[$i]['delete_flag'])) { $rawData[$i]['delete_flag'] = CommonService::getTrueFalseName($rawData[$i]['delete_flag']); } if (isset($rawData[$i]['severity']) && !empty($severityArr)) { $rawData[$i]['severity'] = CommonService::getNameByValue($severityArr, $rawData[$i]['severity']); } if (isset($rawData[$i]['priority']) && !empty($priorityArr)) { $rawData[$i]['priority'] = CommonService::getNameByValue($priorityArr, $rawData[$i]['priority']); } } return $rawData; }