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


PHP Activity::find方法代码示例

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


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

示例1: actionDelete

 /**
  * Deletes an existing Activity model.
  * @param integer $id
  * @return mixed
  */
 public function actionDelete($id)
 {
     $this->findModel($id)->delete();
     $activities = Activity::find()->where(['belong_to' => $this->data_post['belong_to']])->orderBy('id DESC')->limit(5)->offset(0)->all();
     $this->data_post = array_merge($this->data_post, ['activities' => $activities]);
     return ['errors' => '', 'data' => $this->renderPartial('@widget/views/activities/_list', $this->data_post)];
 }
开发者ID:hoangngk,项目名称:adminpanel,代码行数:12,代码来源:ActivitiesController.php

示例2: actionList

 public function actionList()
 {
     $query = Activity::find();
     $pagination = new Pagination(['defaultPageSize' => 10, 'totalCount' => $query->count()]);
     $models = $query->orderby("id DESC")->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render("list", ['models' => $models, 'pagination' => $pagination]);
 }
开发者ID:JeremiahW,项目名称:membermgt,代码行数:7,代码来源:ActivityController.php

示例3: show

 /**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     $act = Models\Activity::find($id);
     //活动列表
     $activities = Models\Activity::select('id', 'title')->get();
     return view('home.activity.show', compact('act', 'activities'));
 }
开发者ID:honxin,项目名称:studentclub,代码行数:13,代码来源:ActivityController.php

示例4: run

 public function run()
 {
     $disViewMore = false;
     $activities = Activity::find()->where(['belong_to' => $this->belong_to])->orderBy('id DESC')->limit(5)->offset(0)->all();
     $allActivities = Activity::find()->where(['belong_to' => $this->belong_to])->orderBy('id DESC')->all();
     if (count($allActivities) <= 5) {
         $disViewMore = true;
     }
     return $this->render('activities/index', ['activities' => $activities, 'belong_to' => $this->belong_to, 'disViewMore' => $disViewMore]);
 }
开发者ID:hoangngk,项目名称:adminpanel,代码行数:10,代码来源:ActivitiesWidget.php

示例5: search

 public function search($params)
 {
     $query = Activity::find()->where(['user_id' => Yii::$app->user->getId()]);
     $dataProvider = new ActiveDataProvider(['query' => $query, 'pagination' => ['pageSize' => 30], 'sort' => ['defaultOrder' => ['start' => SORT_DESC]]]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'date' => $this->calories, 'val' => $this->peak_heartrate]);
     return $dataProvider;
 }
开发者ID:nikolasg22,项目名称:curso_yii,代码行数:10,代码来源:CalendarSearch.php

示例6: search

 public function search($params)
 {
     $query = Activity::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:pyw5pkU9PcdW,项目名称:COMP3421,代码行数:11,代码来源:ActivitySearch_old.php

示例7: actionIndex

 /**
  * Lists all Activity models.
  * @return mixed
  */
 public function actionIndex($id = null)
 {
     //Check user level & existence of $id
     $user = Yii::$app->user->identity->level == 0 && $id != null ? User::findOne($id) : Yii::$app->user->identity;
     $searchModel = new ActivitySearch();
     $dataProvider = $searchModel->search(Yii::$app->request->queryParams);
     $parentIds = \yii\helpers\ArrayHelper::getColumn($user->findParents()->all(), 'id');
     $query = Activity::find()->where(['in', 'user_id', $parentIds])->orderBy(['id' => SORT_DESC]);
     //Activity::find()->where('user_id = :parent_id OR user_id = :id', [':parent_id' =>  $user->id, ':id'=> $user->parent->id ])->orderBy(['id' => SORT_DESC]);
     //var_dump($user); die();
     $activityProvider = new ActiveDataProvider(['query' => $user->level == 3 ? $query : $query->orWhere('user_id = :parent_id OR user_id = :id', [':parent_id' => $user->id, ':id' => $user->parent->id]), 'pagination' => ['pageSize' => 8]]);
     return $this->render('index', ['searchModel' => $searchModel, 'dataProvider' => $dataProvider, 'activityProvider' => $activityProvider, 'user' => $user]);
 }
开发者ID:livingdreams,项目名称:kidcrossing,代码行数:17,代码来源:ActivityController.php

示例8: search

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

示例9: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Activity::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'category' => $this->category, 'level_id' => $this->level_id, 'recruit_count' => $this->recruit_count, 'sign_up_begin_time' => $this->sign_up_begin_time, 'sign_up_end_time' => $this->sign_up_end_time, 'sign_up_status' => $this->sign_up_status, 'begin_time' => $this->begin_time, 'end_time' => $this->end_time, 'status' => $this->status, 'lesson' => $this->lesson, 'score' => $this->score, 'create_time' => $this->create_time, 'update_time' => $this->update_time]);
     $query->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'address', $this->address])->andFilterWhere(['like', 'launch', $this->launch])->andFilterWhere(['like', 'organizers', $this->organizers])->andFilterWhere(['like', 'join_teams', $this->join_teams])->andFilterWhere(['like', 'create_user', $this->create_user])->andFilterWhere(['like', 'update_user', $this->update_user]);
     return $dataProvider;
 }
开发者ID:hanxiao84322,项目名称:coach_system,代码行数:21,代码来源:ActivitySearch.php

示例10: search

 public function search($params)
 {
     $query = Activity::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['created_at' => $this->created_at, 'updated_at' => $this->updated_at]);
     $query->andFilterWhere(['like', 'id', $this->id])->andFilterWhere(['like', 'name', $this->name])->andFilterWhere(['like', 'description', $this->description])->andFilterWhere(['like', 'program_id', $this->program_id]);
     return $dataProvider;
 }
开发者ID:HazimAnas,项目名称:point-tracker,代码行数:14,代码来源:ActivitySearch.php

示例11: actionIndex

 public function actionIndex()
 {
     $levelId = \Yii::$app->request->get('levelId') ? \Yii::$app->request->get('levelId') : 2;
     $query = Activity::find()->where(['level_id' => $levelId]);
     $countQuery = clone $query;
     $pages = new Pagination(['totalCount' => $countQuery->count()]);
     $models = $query->offset($pages->offset)->limit($pages->limit)->all();
     if (!empty($models)) {
         foreach ($models as $key => $val) {
             $val->begin_time = date('Y-m-d', strtotime($val->begin_time));
             //录取人数
             $countResult = \app\models\ActivityUsers::find()->where(['activity_id' => $val->id, 'status' => [ActivityUsers::APPROVED, ActivityUsers::DOING, ActivityUsers::END]]);
             $val->already_recruit_count = $countResult->count();
         }
     }
     return $this->render('index', ['models' => $models, 'pages' => $pages, 'levelId' => $levelId]);
 }
开发者ID:hanxiao84322,项目名称:coach_system,代码行数:17,代码来源:ActivityController.php

示例12: actionIndex

 public function actionIndex($id = -1)
 {
     $message = "";
     $errormsg = "";
     $model = new ActivityItemForm();
     if ($id > -1) {
         $model = ActivityItemForm::find()->where(['id' => $id])->one();
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $message = "活动提交成功";
         $model->save();
     } else {
         $errormsg = $model->getErrors();
     }
     $activities = Activity::find()->select(['subject', 'id'])->asArray()->all();
     $acts = array();
     foreach ($activities as $activity) {
         $acts[$activity['id']] = $activity['subject'];
     }
     return $this->render("index", ['model' => $model, 'acts' => $acts, 'message' => $message, 'errormsg' => $errormsg]);
 }
开发者ID:JeremiahW,项目名称:membermgt,代码行数:21,代码来源:ActivityItemController.php

示例13: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Activity::find();
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $query->asArray()->all();
     }
     $query->joinWith('venue');
     $query->joinWith('topic');
     $query->joinWith('activityType');
     $query->orFilterWhere(['like', 'Activity_name', $this->globalSearch])->orFilterWhere(['like', 'startDatetime', $this->globalSearch])->orFilterWhere(['like', 'endDatetime', $this->globalSearch])->orFilterWhere(['like', 'Venue.name', $this->globalSearch])->orFilterWhere(['like', 'Topic.name', $this->globalSearch])->orFilterWhere(['like', 'ActivityType.ActivityType_name', $this->globalSearch]);
     $raw = $query->asArray()->all();
     $returnArr = [];
     foreach ($raw as $row) {
         $detail = substr($row['description'], 0, 200) . '...';
         $arrayRow = ['type' => 'activity', 'id' => $row['id'], 'title' => $row['Activity_name'], 'detail' => $detail];
         array_push($returnArr, $arrayRow);
     }
     return $returnArr;
 }
开发者ID:pyw5pkU9PcdW,项目名称:COMP3421,代码行数:29,代码来源:ActivitySearchGlobal.php

示例14: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Activity::find();
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->joinWith('venue');
     $query->joinWith('topic');
     $query->joinWith('activityType');
     //$query->andFilterWhere([
     //'id' => $this ->id,
     //'Venue_id' => $this -> Venue_id,
     //'ActivityType_id' => $this -> ActivityType_id
     /*$query->andFilterWhere([
                 'id' => $this->id,
                 'personInCharge' => $this->personInCharge,
                 'lastModifyTime' => $this->lastModifyTime,
                 'startDatetime' => $this->startDatetime,
                 'endDatetime' => $this->endDatetime,
                 //'Venue_id' => $this->Venue_id,
                 //'Topic_id' => $this->Topic_id,
                 //'ActivityType_id' => $this->ActivityType_id,
                 'Administrator_id' => $this->Administrator_id,
             ]);
     
             $query->andFilterWhere(['like', 'Activity_name', $this->Activity_name])
                 ->andFilterWhere(['like', 'description', $this->description])
                 ->andFilterWhere(['like', 'documentLink', $this->documentLink])
                 ->andFilterWhere(['like', 'venue.name', $this->Venue_id])
                 ->andFilterWhere(['like', 'topic.name', $this->Topic_id])
                 ->andFilterWhere(['like', 'activityType.ActivityType_name', $this->ActivityType_id]);*/
     $query->orFilterWhere(['like', 'Activity_name', $this->globalSearch])->orFilterWhere(['like', 'startDatetime', $this->globalSearch])->orFilterWhere(['like', 'endDatetime', $this->globalSearch])->orFilterWhere(['like', 'venue.name', $this->globalSearch])->orFilterWhere(['like', 'topic.name', $this->globalSearch])->orFilterWhere(['like', 'activityType.ActivityType_name', $this->globalSearch]);
     return $dataProvider;
 }
开发者ID:pyw5pkU9PcdW,项目名称:COMP3421,代码行数:45,代码来源:ActivitySearch.php

示例15: actionDashboard

 /**
  * Display user dashboard
  * @param integer $id User ID
  */
 public function actionDashboard($id = null)
 {
     //Check user level & existence of $id
     $id = Yii::$app->user->identity->level == 0 && $id != null ? $id : Yii::$app->user->id;
     $model = User::findOne($id);
     $photos = \app\models\Photos::getItems();
     $journals = new ActiveDataProvider(['query' => Journal::find()->where('FIND_IN_SET(' . $id . ', shared_with)')->orWhere(['user_id' => $id])->orderBy(['date' => SORT_DESC])->limit(5), 'pagination' => false]);
     if ($model->level == 3) {
         //if the user is child
         $moods = new ActiveDataProvider(['query' => Mood::find()->select('mood')->where(['user_id' => $id])->orderBy(['date' => SORT_DESC, 'time' => SORT_DESC])->limit(1), 'pagination' => false]);
         $DataProvider = new ActiveDataProvider(['query' => $model->findParents(), 'pagination' => ['pageSize' => 20]]);
         return $this->render('childdashboard', ['dataProvider' => $DataProvider, 'journalProvider' => $journals, 'moodsProvider' => $moods, 'moods' => new Mood(), 'model' => $model, 'photos' => $photos]);
     } else {
         //if the user is parent
         $events = new ActiveDataProvider(['query' => \app\models\Event::find()->where('FIND_IN_SET(' . $id . ', shared_with)')->orWhere(['user_id' => $id])->orderBy(['date' => SORT_DESC])->limit(5), 'pagination' => false]);
         $wishlists = new ActiveDataProvider(['query' => \app\models\Wishlist::find()->where(['assigned_to' => $id, 'status' => 0])->orderBy('id')->limit(5), 'pagination' => false]);
         $DataProvider = new ActiveDataProvider(['query' => $model->findFamily()]);
         $activity = new ActiveDataProvider(['query' => \app\models\Activity::find()->where(['user_id' => Yii::$app->user->id])->orderBy(['id' => SORT_DESC])->limit(4), 'pagination' => false]);
         return $this->render('dashboard', ['dataProvider' => $DataProvider, 'activity' => $activity, 'events' => $events, 'journals' => $journals, 'photos' => $photos, 'wishlists' => $wishlists]);
     }
 }
开发者ID:livingdreams,项目名称:kidcrossing,代码行数:25,代码来源:UserController.php


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