Example #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);
 }
Example #2
0
</legend>
                <?php 
echo $model->attachment_file;
?>
             </fieldset>
            </div>
            </div>
             <div style="clear:both;">
                <fieldset id="fieldset_comment" style ="width:460px;float: left;word-break:break-all;word-wrap:break-word;">
                    <legend><?php 
echo Yii::t('Common', 'Comment');
?>
</legend>
                    <?php 
$this->renderPartial('_fullscreen', array('position' => 'left'));
echo ActionHistoryService::getActionHistory('result', $model->id, $model->product_id);
?>
                </fieldset>
                <fieldset id="fieldset_step" style="width:460px;float: right;">
                    <legend><?php 
echo Yii::t('ResultInfo', 'Steps');
?>
</legend>
                    <?php 
$this->renderPartial('_fullscreen', array('position' => 'right'));
?>
                    <div class="row" style="width: 460px;overflow-x: auto;word-break:break-all;word-wrap:break-word;">
                        <?php 
echo $model->result_step;
?>
                    </div>
Example #3
0
             </fieldset>
            </div>
            </div>
             <div style="clear:both;">
                <fieldset class="action_note" style="width:460px;">
                    <legend><?php 
echo Yii::t('Common', 'Comment');
?>
</legend>
                    <div class="row" style="overflow: auto;padding: 2px;">
                        <?php 
$this->widget('application.extensions.kindeditor4.KindEditorWidget', array('model' => $model, 'attribute' => 'action_note', 'htmlOptions' => array('style' => 'width:100px;'), 'miniMode' => true, 'editorname' => 'action_note_editor'));
?>
                    </div>
                    <?php 
echo ActionHistoryService::getActionHistory('case', $model->id, $model->product_id);
?>
                </fieldset>
                <fieldset style="width: 460px;float: right;">
                    <legend><?php 
echo Yii::t('CaseInfo', 'Steps');
?>
</legend>
                    <div class="row">
                        <?php 
$this->widget('application.extensions.kindeditor4.KindEditorWidget', array('model' => $model, 'attribute' => 'case_step', 'htmlOptions' => array('style' => 'width:100px;'), 'editorname' => 'repeat_step_editor'));
?>
                    </div>
                </fieldset>

Example #4
0
 /**
  * get message content
  *
  * @author                                  youzhao.zxw<*****@*****.**>
  * @param   array  $basicInfo               basic info
  * @param   string $infoType                bug,case or result
  * @param   int    $actionId                action id
  * @param   string $repeatStep              repeat step
  * @param   string $replyNote               reply note
  * @return  array                           message content
  */
 private static function getMessageContent($basicInfo, $infoType, $actionId, $repeatStep, $replyNote)
 {
     $infoId = $basicInfo['id'];
     $absoluteUrl = Yii::app()->createAbsoluteUrl('info/edit', array('type' => $infoType, 'id' => $infoId));
     $linkUrl = '<a target="blank" href="' . $absoluteUrl . '">[' . ucfirst($infoType) . ' #' . $infoId . ' => ' . CommonService::getUserRealName($basicInfo['assign_to']) . ']</a>';
     $msgContent = $linkUrl;
     $fileEditInfos = ActionHistoryService::getFileEditInfos($infoType, $infoId);
     $actionInfo = Yii::app()->db->createCommand()->select('*')->from('{{' . $infoType . '_action' . '}}')->where('id = :id', array(':id' => $actionId))->queryRow();
     $fieldLabelArr = FieldConfigService::getCustomFieldLabel($infoType, $basicInfo['product_id']);
     $msgContent .= ActionHistoryService::getSingleActionHistory($fileEditInfos, $actionInfo, $infoType, $infoId, $fieldLabelArr, $basicInfo['product_id']);
     if ('' != $repeatStep) {
         $msgContent .= "<br/><br/>" . str_repeat("-", 20) . "<br/><br/>" . $repeatStep;
     }
     $wangwangMsg = '';
     if (Info::TYPE_BUG == $infoType) {
         $wangwangMsg .= 'Bug #' . $infoId . ':' . CommonService::sysSubStr($basicInfo['title'], 150, true) . "<br/>";
         $wangwangMsg .= $linkUrl;
         if (BugInfo::ACTION_RESOLVE == $actionInfo['action_type']) {
             $wangwangMsg .= Yii::t('BugInfo', $actionInfo['action_type']) . ' as ' . $basicInfo['solution'] . ' by ' . CommonService::getUserRealName($actionInfo['created_by']);
         } else {
             $wangwangMsg .= Yii::t('BugInfo', $actionInfo['action_type']) . ' by ' . CommonService::getUserRealName($actionInfo['created_by']);
         }
         if ($replyNote != '') {
             $wangwangMsg .= "<br/>" . $replyNote;
         }
     }
     return array($msgContent, $wangwangMsg);
 }
Example #5
0
 private static function getExportComment($infoType, $dataArr, $productId)
 {
     $infoIdArr = array();
     $fieldLabelArr = FieldConfigService::getCustomFieldLabel($infoType, $productId);
     foreach ($dataArr as $data) {
         $infoIdArr[] = $data['id'];
     }
     $historyChangeArr = array();
     if (!empty($infoIdArr)) {
         $getActionNoteSql = 'select * from {{' . $infoType . '_action}} where ' . $infoType . 'info_id in (' . join(',', $infoIdArr) . ') order by ' . $infoType . 'info_id desc, created_at desc';
         $actionNoteInfos = Yii::app()->db->createCommand($getActionNoteSql)->queryAll();
         $actionIdArr = array();
         foreach ($actionNoteInfos as $noteInfo) {
             $actionIdArr[] = $noteInfo['id'];
         }
         if (!empty($actionIdArr)) {
             $actionIdKey = $infoType . 'action_id';
             $historySql = 'select * from {{' . $infoType . '_history}} where ' . $actionIdKey . ' in (' . join(',', $actionIdArr) . ') order by ' . $actionIdKey . ',id asc';
             $historyInfos = Yii::app()->db->createCommand($historySql)->queryAll();
             $historyChangeArr = array();
             foreach ($historyInfos as $historyInfo) {
                 if (empty($historyChangeArr[$historyInfo[$actionIdKey]])) {
                     $historyChangeArr[$historyInfo[$actionIdKey]] = array();
                 }
                 $historyChangeArr[$historyInfo[$actionIdKey]][] = $historyInfo;
             }
         }
         $infoCommentArr = array();
         foreach ($actionNoteInfos as $noteInfo) {
             if (!empty($historyChangeArr[$noteInfo['id']])) {
                 $singleChangeArr = $historyChangeArr[$noteInfo['id']];
             } else {
                 $singleChangeArr = array();
             }
             $historyStr = '';
             foreach ($singleChangeArr as $historyInfo) {
                 $historyStr .= '<br/>' . ActionHistoryService::getSingleHistoryStr($fieldLabelArr, $infoType, $productId, $historyInfo);
             }
             $singleActionStr = ActionHistoryService::getActionCleanContent($noteInfo, $infoType, $noteInfo[$infoType . 'info_id']);
             if ('' != $historyStr) {
                 $singleActionStr .= $historyStr;
             }
             if (!in_array($noteInfo['action_note'], array('', '<br />', '<br/>', '<br>'))) {
                 $singleActionStr .= '<br/><br/>' . ActionHistoryService::handDuplicateIdStr($noteInfo['action_note']);
             }
             if (empty($infoCommentArr[$noteInfo[$infoType . 'info_id']])) {
                 $infoCommentArr[$noteInfo[$infoType . 'info_id']] = array();
             }
             $infoCommentArr[$noteInfo[$infoType . 'info_id']][] = $singleActionStr;
         }
     }
     $dataCount = count($dataArr);
     for ($i = 0; $i < $dataCount; $i++) {
         $dataArr[$i]['action_note'] = join("<br/><br/><br/>", $infoCommentArr[$dataArr[$i]['id']]);
     }
     return $dataArr;
 }