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


PHP Activity::find方法代码示例

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


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

示例1: index

 public function index($leadership_event_id, $activity_id)
 {
     $event = LeadershipEvent::find($leadership_event_id);
     $activity = Activity::find($activity_id);
     $this->layout->with('subtitle', $event->name());
     $this->layout->content = View::make('signup.index')->with('event', $event)->with('activity', $activity);
 }
开发者ID:ajwgibson,项目名称:leadership,代码行数:7,代码来源:SignupController.php

示例2: destroy

 public function destroy($id)
 {
     $ac = Activity::find($id);
     $ac->delete();
     Session::flash('success', 'Data telah dihapus.');
     return Redirect::to('/' . Auth::user()->role . '/activity');
 }
开发者ID:heruujoko,项目名称:tsel-net-management,代码行数:7,代码来源:ActivityController.php

示例3: show

 public function show($id)
 {
     $activity = Activity::find($id);
     $participations = Participation::with('issue', 'employee')->where('activity_id', '=', $id)->get();
     $menu = 'academic';
     $courses = Course::where('project_id', '=', Auth::user()->curr_project_id)->where('location_id', '=', Auth::user()->location_id)->get();
     return View::make('participations.show', compact('activity', 'participations', 'courses', 'menu'));
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:8,代码来源:ParticipationsController.php

示例4: upload

 public function upload(Request $request)
 {
     // loop through files and move the chunks to a temporarily created directory
     if (!empty($_FILES)) {
         foreach ($_FILES as $file) {
             // check the error status
             if ($file['error'] != 0) {
                 $this->_log('error ' . $file['error'] . ' in file ' . $_POST['flowFilename']);
                 continue;
             }
             // init the destination file (format <filename.ext>.part<#chunk>
             // the file is stored in a temporary directory
             $temp_dir = public_path() . '/temp/' . $_POST['flowIdentifier'];
             $dest_file = $temp_dir . '/' . $_POST['flowFilename'] . '.part' . $_POST['flowChunkNumber'];
             // create the temporary directory
             if (!is_dir($temp_dir)) {
                 mkdir($temp_dir, 0777, true);
             }
             // move the temporary file
             if (!move_uploaded_file($file['tmp_name'], $dest_file)) {
                 $this->_log('Error saving (move_uploaded_file) chunk ' . $_POST['flowChunkNumber'] . ' for file ' . $_POST['flowFilename']);
             } else {
                 // check if all the parts present, and create the final destination file
                 $this->createFileFromChunks($temp_dir, $_POST['flowFilename'], $_POST['flowChunkSize'], $_POST['flowTotalSize']);
                 if ($request->input('mode') == "register") {
                     $user = User::find($request->input('id'));
                     $user->pictureDist = 'temp/' . $_POST['flowFilename'];
                     $user->update();
                 } else {
                     if ($request->input('mode') == "activity") {
                         $activity = Activity::find($request->input('id'));
                         $activity->pictureDist = 'temp/' . $_POST['flowFilename'];
                         $activity->update();
                     } else {
                         if ($request->input('mode') == "task") {
                             $activity = TaskList::find($request->input('id'));
                             $activity->pictureLocation = 'temp/' . $_POST['flowFilename'];
                             $activity->update();
                         }
                     }
                 }
             }
         }
     }
     ////////////////////////////////////////////////////////////////////
     // THE SCRIPT
     ////////////////////////////////////////////////////////////////////
     //check if request is GET and the requested chunk exists or not. this makes testChunks work
     if ($_SERVER['REQUEST_METHOD'] === 'GET') {
         $temp_dir = 'temp/' . $_GET['flowIdentifier'];
         $chunk_file = $temp_dir . '/' . $_GET['flowFilename'] . '.part' . $_GET['flowChunkNumber'];
         if (file_exists($chunk_file)) {
             header("HTTP/1.0 200 Ok");
         } else {
             header("HTTP/1.0 404 Not Found");
         }
     }
 }
开发者ID:bossgame1234,项目名称:MS4SF,代码行数:58,代码来源:FileUploadController.php

示例5: saveActivity

 /**
  * This is a temp solution, we need something better depending
  * on authority to update activity stored.
  *
  **/
 public function saveActivity($activity_id, $activity_def)
 {
     $exists = \Activity::find($activity_id);
     //if the object activity exists, remove and update with recent
     if ($exists) {
         \Activity::where('_id', $activity_id)->delete();
     }
     //save record
     \Activity::insert(array('_id' => $activity_id, 'definition' => $activity_def));
 }
开发者ID:jesposito,项目名称:learninglocker,代码行数:15,代码来源:EloquentActivityRepository.php

示例6: destroy

 public function destroy($id)
 {
     $activity = Activity::find($id);
     if ($activity->participations()->count() > 0) {
         Session::flash('message', 'Tidak dapat membatalkan agenda kegiatan! Kegiatan ini pernah dijalankan!');
     } else {
         Activity::destroy($id);
         Session::flash('message', 'Sukses membatalkan agenda kegiatan');
     }
 }
开发者ID:emanmks,项目名称:oneschool,代码行数:10,代码来源:ActivitiesController.php

示例7: search

 /**
  * [search description]
  * @param  array $params [description]
  * @param  string $module [description]
  * @param  integer $id     [description]
  * @return [type]         [description]
  */
 public function search($params, $entity = NULL, $entity_id = NULL)
 {
     $query = Activity::find()->active()->related($entity, $entity_id);
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     if (!($this->load($params) && $this->validate())) {
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'created_at' => $this->created_at, 'updated_at' => $this->updated_at, 'country_id' => $this->country_id]);
     $query->andFilterWhere(['like', 'cityName', $this->cityName])->andFilterWhere(['like', 'zipCode', $this->zipCode])->andFilterWhere(['like', 'postBox', $this->postBox])->andFilterWhere(['like', 'addresslineOne', $this->addresslineOne])->andFilterWhere(['like', 'addresslineTwo', $this->addresslineTwo])->andFilterWhere(['like', 'regionName', $this->regionName]);
     return $dataProvider;
 }
开发者ID:frenzelgmbh,项目名称:cm-activity,代码行数:18,代码来源:ActivitySearch.php

示例8: testActivityCRUD

 /**
  * Test Activity
  */
 public function testActivityCRUD()
 {
     $activity = new Activity();
     $activity->_id = \app\locker\helpers\Helpers::getRandomValue();
     $activity->definition = array('type' => \app\locker\helpers\Helpers::getRandomValue(), 'name' => array('en-US' => \app\locker\helpers\Helpers::getRandomValue()), 'description' => array('en-US' => \app\locker\helpers\Helpers::getRandomValue()));
     $result = $activity->save();
     $this->assertTrue($result);
     // Load activity from db
     $aid = $activity->_id;
     $db_activity = Activity::find($aid);
     $this->assertEquals($db_activity->_id, $activity->_id);
     // Delete activity
     $db_activity->delete();
     $this->assertEquals(Activity::find($aid), NULL);
 }
开发者ID:jesposito,项目名称:learninglocker,代码行数:18,代码来源:ActivityTest.php

示例9: shutdown

function shutdown()
{
    global $user_activity_id, $info;
    if ($user_activity_id != 0) {
        $active = Activity::find($user_activity_id);
        $active->date_end = Carbon::now();
        $active->save();
    }
    if (empty($info['type']) || $info['type'] == 'live') {
        fastcgi_finish_request();
        posix_kill(getmypid(), 9);
    } else {
        exit;
    }
}
开发者ID:addonBrasil,项目名称:FOS-Streaming-v1,代码行数:15,代码来源:stream.php

示例10: updateActivity

 public function updateActivity($id, $action = null, $doer_id = null, $victim_id = null, $feed_type = null)
 {
     $activity = Activity::find($id);
     if (!empty($action)) {
         $activity->action = $action;
     }
     if (!empty($doer_id)) {
         $activity->doer_id = $doer_id;
     }
     if (!empty($victim_id)) {
         $activity->victim_id = $victim_id;
     }
     if (!empty($feed_type)) {
         $activity->feed_type = $feed_type;
     }
     return $activity->save();
 }
开发者ID:dmyers,项目名称:laravel-activity,代码行数:17,代码来源:ActivityTrait.php

示例11: Exception

<?php

include '../../inc/init.inc';
if (isset($id) && is_numeric($id) && Activity::exists($id)) {
    $activity = Activity::find($id);
    if ($activity->user_id != $res->user->id) {
        throw new Exception('Unauthorized action');
    }
} else {
    $activity = new Activity();
}
$activity->name = $name;
$activity->start = $start . " " . $startTime;
$activity->end = $end . " " . $endTime;
$activity->status = $status;
$activity->privacy = $privacy;
$activity->description = $description;
$activity->user_id = $res->user->id;
if ($activity->is_valid()) {
    $activity->save();
    if (isset($member_list_values)) {
        preg_match_all('#\\(([^)]+)\\)#', $member_list_values, $organizers_ids);
        Activities_User::table()->delete(array('activity_id' => $activity->id));
        $organizers_ids[1][] = $activity->user_id;
        foreach ($organizers_ids[1] as $organizers_id) {
            if (!User::exists($organizers_id)) {
                continue;
            }
            $activity_user = Activities_User::create(array('activity_id' => $activity->id, 'user_id' => $organizers_id));
        }
    }
开发者ID:Osin,项目名称:Intranet,代码行数:31,代码来源:action.activity.update.php

示例12: array

<?php

include '../../inc/init.inc';
$list = array();
foreach ($res->user->getPotientialUserNetwork()->asArray() as $potentialUserNetwork) {
    $list[] = "&quot; <img src='" . $potentialUserNetwork->getPicture(16) . " /> " . $potentialUserNetwork->name() . "&nbsp;" . "(" . $potentialUserNetwork->id . ")" . "&quot;";
}
if (count($list) > 0) {
    $res->memberList = implode(',', $list);
}
if (isset($id)) {
    $res->activity = Activity::find($id);
    $res->is_new = false;
} else {
    $res->activity = new Activity();
    $res->is_new = true;
}
if (isset($infos)) {
    $res->useTemplate('Administration de l\'activité', $infos);
} else {
    $res->useTemplate('Administration de l\'activité');
}
开发者ID:Osin,项目名称:Intranet,代码行数:22,代码来源:activity.create.base.php

示例13: getGoodCategory

 /**
  * 功能:商家菜单页美食分类,商品的分类和活动是一起的,不过活动还是单独列一张表出来的
  */
 public function getGoodCategory($shop_id)
 {
     $data = array();
     $shop = Shop::find($shop_id);
     $groups = $shop->groups->all();
     $goods_category = array();
     $good_activity = array();
     foreach ($groups as $group) {
         $one = array();
         if ($group->activity_id == 0) {
             // 不是活动
             $one['classify_name'] = $group->name;
             $one['classify_name_abbr'] = $group->name_abbr;
             $one['classify_id'] = $group->id;
             $one['classify_count'] = Menu::where('shop_id', $shop_id)->where('group_id', $group->activity_id)->get()->count('shop_id');
             $one['classify_icon'] = $group->icon;
             array_push($goods_category, $one);
         } else {
             // 是活动的
             $act = Activity::find($group->activity_id);
             $one['activity_name'] = $act->name;
             $one['activity_id'] = $act->aid;
             $one['activity_icon'] = $act->icon;
             $one['activity_statement'] = $act->intro;
             array_push($good_activity, $one);
         }
     }
     $data['goods_category'] = $goods_category;
     $data['good_activity'] = $good_activity;
     return $data;
 }
开发者ID:uwitec,项目名称:haochigo,代码行数:34,代码来源:ShopController.php

示例14:

<?php

$res->edit = true;
if (isset($id) && Page::exists($id)) {
    $page = Page::find($id);
    $res->title = $page->title;
    $res->content = $page->content;
    $res->id = $page->id;
    if (isset($page->activity_id) && $page->activity_id > 0) {
        $res->edit = $res->user->id == $page->user_id;
    } else {
        $res->edit = 2;
    }
} else {
    $res->title = "";
    $res->content = "";
    $res->id = "";
}
if (isset($activity) && is_numeric($activity) && $res->user->id == Activity::find($activity)->id) {
    $res->activity = $activity;
}
$res->useTemplate();
开发者ID:Osin,项目名称:Intranet,代码行数:22,代码来源:block.page.php

示例15: testFind

 function testFind()
 {
     //Arrange
     $activity_name = "Activity One";
     $activity_date = '2016-01-01';
     $activity_location = "Location";
     $activity_description = "Description of Activity One";
     $activity_price = "Price of Activity One";
     $activity_quantity = 10;
     $business_id = 1;
     $activity_category_id = 2;
     $id = 1;
     $test_activity = new Activity($activity_name, $activity_date, $activity_location, $activity_description, $activity_price, $activity_quantity, $business_id, $activity_category_id, $id);
     $test_activity->save();
     $activity_name2 = "Activity Two";
     $activity_date2 = '2016-02-02';
     $activity_location2 = "Location Two";
     $activity_description2 = "Description of Activity Two";
     $activity_price2 = "Price of Activity Two";
     $activity_quantity2 = 20;
     $business_id2 = 21;
     $activity_category_id2 = 22;
     $id2 = 2;
     $test_activity2 = new Activity($activity_name, $activity_date, $activity_location, $activity_description, $activity_price, $activity_quantity, $business_id, $activity_category_id, $id = null);
     $test_activity2->save();
     //Act
     $result = Activity::find($test_activity->getId());
     //Assert
     $this->assertEquals($test_activity, $result);
 }
开发者ID:jtorrespdx,项目名称:walk_ins_welcome,代码行数:30,代码来源:ActivityTest.php


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