当前位置: 首页>>代码示例>>PHP>>正文


PHP Project::getConf方法代码示例

本文整理汇总了PHP中app\models\Project::getConf方法的典型用法代码示例。如果您正苦于以下问题:PHP Project::getConf方法的具体用法?PHP Project::getConf怎么用?PHP Project::getConf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Project的用法示例。


在下文中一共展示了Project::getConf方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionSubmit

 /**
  * 提交任务
  *
  * @param $projectId 没有projectId则显示列表
  * @return string
  */
 public function actionSubmit($projectId = null)
 {
     if (!$projectId) {
         // 显示所有项目列表
         $projects = Project::find()->leftJoin(Group::tableName(), '`group`.`project_id`=`project`.`id`')->where(['project.status' => Project::STATUS_VALID, '`group`.`user_id`' => $this->uid])->asArray()->all();
         return $this->render('select-project', ['projects' => $projects]);
     }
     $task = new Task();
     $conf = Project::getConf($projectId);
     if (!$conf) {
         throw new \Exception(yii::t('task', 'unknown project'));
     }
     if (\Yii::$app->request->getIsPost()) {
         $group = Group::find()->where(['user_id' => $this->uid, 'project_id' => $projectId])->count();
         if (!$group) {
             throw new \Exception(yii::t('task', 'you are not the member of project'));
         }
         if ($task->load(\Yii::$app->request->post())) {
             // 是否需要审核
             $status = $conf->audit == Project::AUDIT_YES ? Task::STATUS_SUBMIT : Task::STATUS_PASS;
             $task->user_id = $this->uid;
             $task->project_id = $projectId;
             $task->status = $status;
             $task->file_list = implode("\n", (array) $task->file_list);
             if ($task->save()) {
                 return $this->redirect('@web/task/');
             }
         }
     }
     $tpl = $conf->repo_type == Project::REPO_GIT ? 'submit-git' : 'submit-svn';
     return $this->render($tpl, ['task' => $task, 'conf' => $conf]);
 }
开发者ID:ashehui,项目名称:walle-web,代码行数:38,代码来源:TaskController.php

示例2: actionFilediff

 public function actionFilediff($projectId, $file)
 {
     \Yii::$app->response->format = 'json';
     $project = Project::getConf($projectId);
     if (!$project) {
         throw new \Exception(yii::t('task', 'unknown project'));
     }
     return (new CodeFile($project))->diffWithOnline($file);
 }
开发者ID:ashehui,项目名称:walle-web,代码行数:9,代码来源:ProjectController.php

示例3: actionSubmit

 /**
  * 提交任务
  *
  * @param $projectId
  * @return string
  */
 public function actionSubmit($projectId = null)
 {
     $task = new Task();
     if ($projectId) {
         // svn下无trunk
         $nonTrunk = false;
         $conf = Project::find()->where(['id' => $projectId, 'status' => Project::STATUS_VALID])->one();
         $conf = Project::getConf($projectId);
         // 第一次可能会因为更新而耗时,但一般不会,第一次初始化会是在检测里
         if ($conf->repo_type == Project::REPO_SVN && !file_exists(Project::getDeployFromDir())) {
             $version = Repo::getRevision($conf);
             $version->updateRepo();
         }
         // 为了简化svn无trunk, branches时,不需要做查看分支,直接就是主干
         $svnTrunk = sprintf('%s/trunk', Project::getDeployFromDir());
         // svn下无trunk目录
         if (!file_exists($svnTrunk)) {
             $nonTrunk = true;
         }
     }
     if (\Yii::$app->request->getIsPost()) {
         if (!$conf) {
             throw new \Exception(yii::t('task', 'unknown project'));
         }
         $group = Group::find()->where(['user_id' => $this->uid, 'project_id' => $projectId])->count();
         if (!$group) {
             throw new \Exception(yii::t('task', 'you are not the member of project'));
         }
         if ($task->load(\Yii::$app->request->post())) {
             // 是否需要审核
             $status = $conf->audit == Project::AUDIT_YES ? Task::STATUS_SUBMIT : Task::STATUS_PASS;
             $task->user_id = $this->uid;
             $task->project_id = $projectId;
             $task->status = $status;
             if ($task->save()) {
                 return $this->redirect('/task/');
             }
         }
     }
     if ($projectId) {
         $tpl = $conf->repo_type == Project::REPO_GIT ? 'submit-git' : 'submit-svn';
         return $this->render($tpl, ['task' => $task, 'conf' => $conf, 'nonTrunk' => $nonTrunk]);
     }
     // 成员所属项目
     $projects = Project::find()->leftJoin(Group::tableName(), '`group`.project_id=project.id')->where(['project.status' => Project::STATUS_VALID, '`group`.user_id' => $this->uid])->asArray()->all();
     return $this->render('select-project', ['projects' => $projects]);
 }
开发者ID:9618211,项目名称:walle-web,代码行数:53,代码来源:TaskController.php

示例4: actionGetCommitFile

 /**
  * 获取commit之间的文件
  *
  * @param $projectId
  */
 public function actionGetCommitFile($projectId, $start, $end, $branch = 'trunk')
 {
     $conf = Project::getConf($projectId);
     $revision = Repo::getRevision($conf);
     $list = $revision->getFileBetweenCommits($branch, $start, $end);
     $this->renderJson($list);
 }
开发者ID:rockjava,项目名称:walle-web,代码行数:12,代码来源:WalleController.php

示例5: findModel

 /**
  * 简化
  *
  * @param integer $id
  * @return the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Project::getConf($id)) !== null) {
         if ($model->user_id != $this->uid) {
             throw new \Exception(yii::t('w', 'you are not master of project'));
         }
         return $model;
     } else {
         throw new NotFoundHttpException(yii::t('conf', 'project not exists'));
     }
 }
开发者ID:charlestang,项目名称:walle-web,代码行数:18,代码来源:ConfController.php

示例6: actionGetCommitHistory

 /**
  * 获取commit历史
  *
  * @param $projectId
  */
 public function actionGetCommitHistory($projectId, $branch = 'master')
 {
     $git = new Git();
     $conf = Project::getConf($projectId);
     $git->setConfig($conf);
     if ($conf->git_type == Project::GIT_TAG) {
         $list = $git->getTagList();
     } else {
         $list = $git->getCommitList($branch);
     }
     $this->renderJson($list);
 }
开发者ID:royalwang,项目名称:walle-web,代码行数:17,代码来源:WalleController.php

示例7: findModel

 /**
  * 简化
  *
  * @param integer $id
  * @return the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Project::getConf($id)) !== null) {
         if ($model->user_id != $this->uid) {
             throw new \Exception('不可以操作其它人的项目:)');
         }
         return $model;
     } else {
         throw new NotFoundHttpException('该项目不存在:)');
     }
 }
开发者ID:ShuangRen,项目名称:walle-web,代码行数:18,代码来源:ConfController.php

示例8: findModel

 /**
  * 简化
  *
  * @param integer $id
  * @return the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Project::getConf($id)) !== null) {
         //判断是否为管理员
         if (!Group::isAuditAdmin($this->uid, $model->id)) {
             throw new \Exception(yii::t('w', 'you are not admin of project'));
         }
         return $model;
     } else {
         throw new NotFoundHttpException(yii::t('conf', 'project not exists'));
     }
 }
开发者ID:ashehui,项目名称:walle-web,代码行数:19,代码来源:ConfController.php


注:本文中的app\models\Project::getConf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。