/** * get file's edit info * * @author youzhao.zxw<*****@*****.**> * @param string $type bug,case or result * @param int $id file id * @return array edit result information. */ public static function getFileEditInfos($type, $id) { $fileInfos = TestFileService::getRelatedFileInfos($type, $id); $addFileInfo = array(); $deleteFileInfo = array(); foreach ($fileInfos as $fileInfo) { $addFileInfo[$fileInfo['add_action_id']][] = $fileInfo['file_title']; if (!empty($fileInfo['delete_action_id'])) { $deleteFileInfo[$fileInfo['delete_action_id']][] = $fileInfo['file_title']; } } return array($addFileInfo, $deleteFileInfo); }
public function actionView($id) { TestFileService::viewFile($id); }
/** * get info object's file information * * @author youzhao.zxw<*****@*****.**> * @param string $infoType bug,case or result * @param int $id info object id * @param boolean $fileDeleteable set file delete link or not * @return MixInfo load model result */ public static function loadModel($infoType, $id, $fileDeleteable = true) { $rawDataInfo = self::loadRawData($infoType, $id); $mixedInfo = new MixInfo(); if (CommonService::$ApiResult['SUCCESS'] == $rawDataInfo['status']) { $mixedInfo = $rawDataInfo['detail']; } else { //return $rawDataInfo; throw new CHttpException(400, Yii::t('Common', 'Required URL not found or permission denied.')); } $basicModel = $mixedInfo->getBasicInfo(); $fileInfoStr = TestFileService::getRelatedFileHtml($basicModel->attachment_file, $fileDeleteable); $basicModel->attachment_file = $fileInfoStr; $mixedInfo->setBasicInfo($basicModel); return $mixedInfo; }
</div> <div class="row"> <?php echo $form->label($model, 'related_result'); ?> <?php echo InfoService::getRelatedIdHtml('result', $model->related_result); ?> </div> </fieldset> <fieldset> <legend> <?php echo Yii::t('Common', 'Attachments') . '(' . TestFileService::getFileSize(CommonService::getMaxFileSize()) . ')'; ?> </legend> <?php echo $model->attachment_file; ?> <?php $this->widget('CMultiFileUpload', array('model' => $model, 'name' => 'attachment_file', 'accept' => '', 'htmlOptions' => array('size' => 16), 'remove' => '<img src="' . Yii::app()->theme->baseUrl . '/assets/images/deletefile.gif" alt="remove" />', 'options' => array())); ?> </fieldset> </div> </div> <div style="clear:both;"> <fieldset class="action_note" style="width:460px;"> <legend><?php echo Yii::t('Common', 'Comment');