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


PHP Group::find方法代码示例

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


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

示例1: handle

 /**
  * @param Event $event
  */
 public function handle(Event $event)
 {
     $cloneModel = $this->clone->find($event->request['clone_id']);
     $group = $this->group->find($event->request['group_id']);
     $sitePath = Str::camel($event->request['name']);
     $event->site->updateStatus('Cloning the repo');
     $this->envoy->run('clone --path="' . $group->starting_path . '" --name="' . $sitePath . '" --url=' . $cloneModel->url, true);
 }
开发者ID:NukaCode,项目名称:dasher,代码行数:11,代码来源:Clones.php

示例2: handle

 /**
  * @param Event $event
  */
 public function handle(Event $event)
 {
     $event->site->updateStatus('Running the installer');
     $installerType = $event->request['installType'] == 'base' ? null : '"--' . $event->request['installType'] . '"';
     $group = $this->group->find($event->request['group_id']);
     $sitePath = Str::camel($event->request['name']);
     $this->envoy->run('make-site --path="' . $group->starting_path . '" --name="' . $sitePath . '" --type=' . $installerType, true);
 }
开发者ID:NukaCode,项目名称:dasher,代码行数:11,代码来源:Install.php

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

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

示例5: run

 public function run()
 {
     $total = [];
     foreach (Group::find()->all() as $key => $group) {
         $total[$group->name] = GroupClient::find()->where(['groups_id' => $group->id])->count();
     }
     return $this->render('groups/index', ['group' => new Group(), 'total' => $total]);
 }
开发者ID:hoangngk,项目名称:adminpanel,代码行数:8,代码来源:GroupsWidget.php

示例6: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Group::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['p_id' => $this->p_id]);
     $query->andFilterWhere(['like', 'bezeichnung', $this->bezeichnung]);
     return $dataProvider;
 }
开发者ID:emotionbanker,项目名称:emotionbanking,代码行数:18,代码来源:GroupSearch.php

示例7: addGroupUser

 /**
  * 项目添加用户
  *
  * @param $projectId
  * @param $userId
  * @return bool
  */
 public static function addGroupUser($projectId, $userId)
 {
     // 是否已在组内
     $exists = Group::find()->where(['project_id' => $projectId, 'user_id' => $userId])->count();
     if ($exists) {
         return true;
     }
     $group = new Group();
     $group->attributes = ['project_id' => $projectId, 'user_id' => $userId];
     return $group->save();
 }
开发者ID:uedzen,项目名称:walle-web,代码行数:18,代码来源:Group.php

示例8: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Group::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description]);
     return $dataProvider;
 }
开发者ID:secondsano,项目名称:mebel,代码行数:18,代码来源:GroupSearch.php

示例9: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Group::find();
     $pageSize = Yii::$app->session->get('pageSize', Yii::$app->params['defaultPageSize']);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => $pageSize]]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['p_id' => $this->p_id]);
     $query->andFilterWhere(['like', 'bezeichnung', $this->bezeichnung]);
     return $dataProvider;
 }
开发者ID:emotionbanker,项目名称:emotion-banking,代码行数:19,代码来源:GroupSearch.php

示例10: groups

 public function groups()
 {
     $groups = Group::find('all', array('conditions' => array('y2011' => array('$gte' => 0)), 'order' => array('name' => 'asc'), 'limit' => 9))->to('array');
     $total = 0;
     foreach ($groups as $group) {
         $total += $group['y2011'];
     }
     foreach ($groups as &$group) {
         $group['percentage'] = round($group['y2011'] / $total, 4);
     }
     return compact('total', 'groups');
 }
开发者ID:nervetattoo,项目名称:Bergenbudsjett,代码行数:12,代码来源:BudgetController.php

示例11: actionGroup

 /**
  * 配置项目
  *
  * @param $projectId
  * @return string
  * @throws \Exception
  */
 public function actionGroup($projectId)
 {
     // 配置信息
     $project = $this->findModel($projectId);
     // 添加用户
     if (\Yii::$app->request->getIsPost() && \Yii::$app->request->post('user')) {
         Group::addGroupUser($projectId, \Yii::$app->request->post('user'));
     }
     // 项目的分组用户
     $group = Group::find()->with('user')->where(['project_id' => $projectId])->indexBy('user_id')->orderBy(['type' => SORT_DESC])->asArray()->all();
     // 所有用户
     $users = User::find()->select(['id', 'email', 'realname'])->where(['is_email_verified' => 1])->asArray()->all();
     return $this->render('group', ['conf' => $project, 'users' => $users, 'group' => $group]);
 }
开发者ID:charlestang,项目名称:walle-web,代码行数:21,代码来源:ConfController.php

示例12: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Group::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id]);
     $query->andFilterWhere(['like', 'nama', $this->nama]);
     return $dataProvider;
 }
开发者ID:krngoeps,项目名称:presensi,代码行数:21,代码来源:GroupSearch.php

示例13: addGroupUser

 /**
  * 项目添加用户
  *
  * @param $projectId
  * @param $userId array
  * @return bool
  */
 public static function addGroupUser($projectId, $userIds, $type = Group::TYPE_USER)
 {
     // 是否已在组内
     $exitsUids = Group::find()->select(['user_id'])->where(['project_id' => $projectId, 'user_id' => $userIds])->column();
     $notExists = array_diff($userIds, $exitsUids);
     if (empty($notExists)) {
         return true;
     }
     $group = new Group();
     foreach ($notExists as $uid) {
         $relation = clone $group;
         $relation->attributes = ['project_id' => $projectId, 'user_id' => $uid, 'type' => $type];
         $relation->save();
     }
     return true;
 }
开发者ID:ShuangRen,项目名称:walle-web,代码行数:23,代码来源:Group.php

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

示例15: actionGroup

 /**
  * 配置项目
  *
  * @param $projectId
  * @return string
  * @throws \Exception
  */
 public function actionGroup($projectId)
 {
     // 配置信息
     $project = Project::findOne($projectId);
     if (!$project) {
         throw new \Exception('项目不存在:)');
     }
     if ($project->user_id != $this->uid) {
         throw new \Exception('不可以操作其它人的项目:)');
     }
     // 添加用户
     if (\Yii::$app->request->getIsPost() && \Yii::$app->request->post('user')) {
         Group::addGroupUser($projectId, \Yii::$app->request->post('user'));
     }
     // 项目的分组用户
     $group = Group::find()->with('user')->where(['project_id' => $projectId])->indexBy('user_id')->asArray()->all();
     // 所有用户
     $users = User::find()->select(['id', 'email', 'realname'])->where(['is_email_verified' => 1])->asArray()->all();
     return $this->render('group', ['conf' => $project, 'users' => $users, 'group' => $group]);
 }
开发者ID:ZuoGuocai,项目名称:walle-web,代码行数:27,代码来源:ConfController.php


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