Exemplo n.º 1
0
 /**
  * replace html select element with span element
  *
  * @author                                  youzhao.zxw<*****@*****.**>
  * @param   string  $stepStr                result st string
  * @return  string                          handled result step
  */
 public static function removeSelectFromResultStep($stepStr)
 {
     $resultValueColorConfig = ResultInfo::getResultValueColorConfig();
     $stepDom = str_get_html($stepStr);
     if (empty($stepDom)) {
         return $stepStr;
     }
     foreach ($stepDom->find('select') as $selectElement) {
         $handledStr = '';
         $index = 1;
         foreach ($selectElement->find('option') as $optionElement) {
             if ($optionElement->hasAttribute('bugfree_set_option')) {
                 $selectedValue = $optionElement->innertext;
                 if ('' == $selectedValue) {
                     $selectElement->outertext = '<span class="bugfree_step_result_span" style="width:90px;font-weight:bold;">' . $selectedValue . '</span>';
                 } else {
                     $selectElement->outertext = '<span class="bugfree_step_result_span" style="width:90px;font-weight:bold;color:' . $resultValueColorConfig[$selectedValue] . '">' . $selectedValue . '</span>';
                 }
                 break;
             }
         }
     }
     return $stepDom->__toString();
 }
Exemplo n.º 2
0
 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>';
             }
         }
     }
 }