當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。