當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Group::tableName方法代碼示例

本文整理匯總了PHP中app\models\Group::tableName方法的典型用法代碼示例。如果您正苦於以下問題:PHP Group::tableName方法的具體用法?PHP Group::tableName怎麽用?PHP Group::tableName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在app\models\Group的用法示例。


在下文中一共展示了Group::tableName方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionSubmit

 /**
  * 提交任務
  *
  * @param $projectId 沒有projectId則顯示列表
  * @return string
  */
 public function actionSubmit($projectId = null)
 {
     // 為了方便用戶更改表名,避免表名直接定死
     $projectTable = Project::tableName();
     $groupTable = Group::tableName();
     if (!$projectId) {
         // 顯示所有項目列表
         $projects = Project::find()->leftJoin(Group::tableName(), "`{$groupTable}`.`project_id` = `{$projectTable}`.`id`")->where(["`{$projectTable}`.status" => Project::STATUS_VALID, "`{$groupTable}`.`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;
             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:meolu,項目名稱:walle-web,代碼行數:40,代碼來源:TaskController.php

示例2: actionSubmit

 /**
  * 提交任務
  *
  * @param $projectId
  * @return string
  */
 public function actionSubmit($projectId = null)
 {
     $task = new Task();
     if ($projectId) {
         $conf = Project::find()->where(['id' => $projectId, 'status' => Project::STATUS_VALID])->one();
     }
     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]);
     }
     // 成員所屬項目
     $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:Richard87,項目名稱:walle-web,代碼行數:39,代碼來源:TaskController.php

示例3: actionIndex

 /**
  * 配置項目列表
  *
  */
 public function actionIndex()
 {
     // 顯示該用戶為管理員的所有項目
     $project = Project::find()->leftJoin(Group::tableName(), '`group`.`project_id`=`project`.`id`')->where(['`group`.`user_id`' => $this->uid, '`group`.`type`' => Group::TYPE_ADMIN]);
     $kw = \Yii::$app->request->post('kw');
     if ($kw) {
         $project->andWhere(['like', "name", $kw]);
     }
     $project = $project->asArray()->all();
     return $this->render('index', ['list' => $project]);
 }
開發者ID:ashehui,項目名稱:walle-web,代碼行數:15,代碼來源:ConfController.php

示例4: actionIndex

 /**
  * 配置項目列表
  *
  */
 public function actionIndex()
 {
     // 為了方便用戶更改表名,避免表名直接定死
     $groupTable = Group::tableName();
     $projectTable = Project::tableName();
     // 顯示該用戶為管理員的所有項目
     $project = Project::find()->leftJoin(Group::tableName(), "`{$groupTable}`.`project_id`=`{$projectTable}`.`id`")->where(["`{$groupTable}`.`user_id`" => $this->uid, "`{$groupTable}`.`type`" => Group::TYPE_ADMIN]);
     $kw = \Yii::$app->request->post('kw');
     if ($kw) {
         $project->andWhere(['like', "name", $kw]);
     }
     $project = $project->asArray()->all();
     return $this->render('index', ['list' => $project]);
 }
開發者ID:meolu,項目名稱:walle-web,代碼行數:18,代碼來源:ConfController.php

示例5: 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

示例6: search

 public function search()
 {
     $count = Yii::$app->db->createCommand("SELECT\n\t\t\t\tCOUNT(DISTINCT (z_p_id))\n\t\t\t\tfrom " . Code::tableName() . "\n\t\t\t\twhere LOWER(z_b_id) = :bank\n\t\t\t\t", [':bank' => strtolower($this->z_b_id)])->queryScalar();
     $dataProvider = new SqlDataProvider(['sql' => "select\n\t\t\t\tbezeichnung,\n\t\t\t\tcount(z_b_id) as tic_count,\n\t\t\t\tSUM(if(used = 1, 1, 0)) AS bused,\n\t\t\t\tSUM(if(status > 49 and used=0, 1, 0)) AS bused50,\n\t\t\t\tSUM(if(status > 49, 1, 0)) AS busedtot\n\t\t\t\tfrom " . Code::tableName() . ", " . Group::tableName() . "\n\t\t\t\twhere LOWER(z_b_id) = :bank and z_p_id = p_id\n\t\t\t\tgroup by z_p_id", "params" => [':bank' => strtolower($this->z_b_id)], 'totalCount' => $count]);
     return $dataProvider;
 }
開發者ID:emotionbanker,項目名稱:emotionbanking,代碼行數:6,代碼來源:Statistic.php

示例7: down

 public function down()
 {
     $this->dropColumn(Group::tableName(), 'type');
     echo "m151010_050344_group_user_admin  be reverted.\n";
     return true;
 }
開發者ID:9618211,項目名稱:walle-web,代碼行數:6,代碼來源:m151010_050344_group_user_admin.php


注:本文中的app\models\Group::tableName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。