本文整理汇总了PHP中Activity::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Activity::create方法的具体用法?PHP Activity::create怎么用?PHP Activity::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity::create方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: discuss
public function discuss($content, User $user)
{
$info = compact('content', 'user');
$info['comment'] = $this;
$d = Discuss::create($info);
// generate activity
$info = array('user' => $user, 'action' => 'discuss', 'object' => $this, 'link' => $d);
$act = Activity::create($info);
// inform all stack holders
$info = array('activity' => $act, 'user' => $this->user);
Timeline::create($info);
}
示例2: addActivity
public function addActivity($action, $doer_id = null, $victim_id = null, $feed_type = null)
{
if (empty($doer_id)) {
if (!empty($this->activity_item_field)) {
$doer_id = $this->{$this->activity_doer_field};
} else {
// todo track global user from Auth::user() or config or class object
//Activity::user();
}
}
$activity = array('doer_id' => $doer_id, 'victim_id' => $victim_id, 'action' => $action, 'item_id' => $this->{$this->activity_item_field}, 'item_type' => static::activityItemType(), 'feed_type' => isset($this->activity_feed_type) ? $this->activity_feed_type : $feed_type);
return Activity::create($activity);
}
示例3: comment
public function comment($title, $content, User $user)
{
$c = parent::comment($title, $content, $user);
// generate activity
$info = array('user' => $user, 'action' => 'comment', 'object' => $this, 'link' => $c);
$act = Activity::create($info);
// inform all stack holders
$users = Sdb::fetch('user', Comment::table(), array('teacher=?' => array($this->id)));
$info = array('activity' => $act);
foreach ($users as $u) {
$info['user'] = $u;
Timeline::create($info);
}
}
示例4: attitude
/**
* @author ryan <cumt.xiaochi@gmail.com>
*/
function attitude($type)
{
if (!$GLOBALS['has_login']) {
return;
}
$class = camel2under($type);
$map = array('like' => 1, 'hate' => 0);
$target = _req('target');
$action = _req('action');
$info = array($type => $target, 'user' => $GLOBALS['user'], '`like`' => $map[$action]);
$at = Attitude::create($info);
if ($at) {
$info = array('user' => $GLOBALS['user'], 'action' => $action, 'object' => $target);
$act = Activity::create($info);
// inform author
$comment = new $class($target);
$info = array('user' => $comment->user, 'activity' => $act);
Timeline::create($info);
}
$o = new $class($target);
echo $o->{$action . 'Count'}();
}
示例5: doWebRedActivity
public function doWebRedActivity()
{
global $_W, $_GPC;
if (!$_W['ispost']) {
$this->doWebAuth();
checklogin();
}
$modulePublic = '../addons/wwx_fxxt/style/static/';
$foo = $_GPC['foo'];
$foos = array('list', 'create', 'modify', 'delete', 'records');
$foo = in_array($foo, $foos) ? $foo : 'list';
require_once WWX_FXXT_ROOT . '/class/Activity.class.php';
if ($foo == 'create') {
if ($_W['ispost']) {
$input = $_GPC;
$input['rules'] = htmlspecialchars_decode($input['rules']);
$input['start'] = strtotime($input['time']['start'] . ':00');
$input['end'] = strtotime($input['time']['end'] . ':59');
$input['share'] = serialize($input['share']);
$input['limit'] = serialize($input['limit']);
if ($input['type'] == 'game') {
$input['tag'] = serialize($input['game']);
} elseif ($input['type'] == 'shared') {
$input['tag'] = serialize($input['shared']);
} else {
$input['tag'] = serialize($input['tag']);
}
$gifts = array();
foreach ($input['gifts']['id'] as $k => $v) {
$gifts[] = array('gift' => $v, 'quantity' => $input['gifts']['quantity'][$k], 'rate' => $input['gifts']['rate'][$k]);
}
$a = new Activity();
$ret = $a->create($input, $gifts);
/**Activity:1.保存活动**/
if (is_error($ret)) {
message($ret['message']);
} else {
message("成功创建活动", $this->createWebUrl('redactivity'));
}
}
$activity = array();
$time = array();
$time['start'] = date('Y-m-d 00:00');
$time['end'] = date('Y-m-d 15:00');
$activity['gifts'] = array();
$activity['type'] = 'shared';
load()->func('tpl');
include $this->template('redactivity_form');
}
if ($foo == 'modify') {
$id = $_GPC['id'];
$id = intval($id);
$a = new Activity();
$activity = $a->getOne($id);
/**Activity:2.根据活动ID查询活动内容及设置等**/
if (empty($activity)) {
$this->error('访问错误');
}
if ($_W['ispost']) {
$input = $_GPC;
$input['rules'] = htmlspecialchars_decode($input['rules']);
$input['start'] = strtotime($input['time']['start'] . ':00');
$input['end'] = strtotime($input['time']['end'] . ':59');
$input['share'] = serialize($input['share']);
$input['limit'] = serialize($input['limit']);
if ($input['type'] == 'game') {
$input['tag'] = serialize($input['game']);
} elseif ($input['type'] == 'shared') {
$input['tag'] = serialize($input['shared']);
} else {
$input['tag'] = serialize($input['tag']);
}
$gifts = array();
foreach ($input['gifts']['id'] as $k => $v) {
$gifts[] = array('gift' => $v, 'quantity' => $input['gifts']['quantity'][$k], 'rate' => $input['gifts']['rate'][$k]);
}
$a = new Activity();
$ret = $a->modify($id, $input, $gifts);
/**Activity:3.根据活动ID编辑活动内容及设置等**/
if (is_error($ret)) {
message($ret['message']);
} else {
message("成功编辑活动", $this->createWebUrl('redactivity'));
}
}
$time = array();
$time['start'] = date('Y-m-d H:i', $activity['start']);
$time['end'] = date('Y-m-d H:i', $activity['end']);
if ($activity['type'] == 'game') {
$game = $activity['tag'];
} elseif ($activity['type'] == 'shared') {
$shared = $activity['tag'];
}
load()->func('tpl');
include $this->template('redactivity_form');
}
if ($foo == 'records') {
$id = $_GPC['id'];
$id = intval($id);
$a = new Activity();
//.........这里部分代码省略.........
示例6: header
<?php
require_once "./includes/initialize.php";
session_start();
if (!isset($_SESSION['bdmemp'])) {
header("Location: index.php");
exit;
}
if (isset($_POST['Rotahaler'])) {
$field_array = array('Practicing_Change' => $_POST['Practicing_Change'], 'Check_Points' => $_POST['Check_Points'], 'RCP_Drives' => $_POST['RCP_Drives'], 'Rotahaler' => $_POST['Rotahaler'], 'smsWayid' => $_SESSION['bdm'], 'BM_Emp_Id' => $_SESSION['bdmemp'], 'SM_Emp_Id' => $_SESSION['sm_emp'], 'created' => date('Y-m-d H:i:s'));
$add = new Activity();
$query = $add->create($field_array);
header("location:ThankYou.php");
}
require_once 'header.php';
?>
<a href="BMDashboard.php"> << Back</a>
<!--<div class="row">
<div class="col-lg-12">
<h3>Add Detail</h3>
</div>
</div>-->
<div class="row">
<div class="col-lg-12">
<div class="panel panel-default">
<form action="Add_detail.php" method="POST">
<div class="panel-heading">Enter Details For Reporting TMs</div>
<div class="panel-body">
<div class="form-group">
<input type="number" name="Practicing_Change" class="form-control" placeholder="Drs. Started Practicing Change" required="">
示例7: header
<?php
session_start();
if (!isset($_SESSION['tmemp'])) {
header('Location:index.php');
}
require_once "./includes/initialize.php";
$TM_Emp_id = $_SESSION['tmemp'];
if (isset($_POST['submit'])) {
$addActivity = new Activity('TM_Activity');
$field_array = array('launch' => $_POST['launch'], 'device_check' => $_POST['device_check'], 'paramedic' => $_POST['paramedic'], 'chemist_meet' => $_POST['chemist_meet'], 'visibility' => $_POST['visibility'], 'revolizer' => $_POST['revolizer'], 'zvt' => $_POST['zvt'], 'rotahaler' => $_POST['rotahaler'], 'TM_Emp_id' => $TM_Emp_id, 'created' => date('Y-m-d H:i:s'), 'smswayid' => $_SESSION['smsWayID']);
$addActivity->create($field_array);
echo '<script>alert("Data Added Successfully.");</script>';
redirect_to('TM_Activity.php');
}
require_once './header.php';
?>
<div class="col-lg-12">
<a href="TM_Add.php" class="badge">GO Back</a>
</div>
<div class="col-lg-12">
<h4>ADD BIP ACTIVITY</h4>
<form action="#" method="post">
<div class="form-group">
<label>BIP Launch</label>
<input type="number" min="0" class="form-control" name="launch" placeholder="No.of Dr To Whom BIP Is Launched" >
</div>
<div class="form-group">
<label>BIP Device Check Camp</label>
<input type="number" min="0" class="form-control" name="device_check" placeholder="No.of Device Check Camp Conducted">
</div>
示例8: serialize
$input['tag'] = serialize($input['tag']);
}
$gifts = array();
foreach ($input['gifts']['id'] as $k => $v) {
$gifts[] = array('gift' => $v, 'quantity' => $input['gifts']['quantity'][$k], 'rate' => $input['gifts']['rate'][$k]);
}
$api = new Api();
$page = unserialize($input['shake']);
$page['url'] = $_W['siteroot'] . 'app/' . substr($this->createMobileUrl('activity', array('actid' => $ret)), 2);
$page['title'] = $input['title'];
$pageId = $api->createPage($page);
if (is_error($pageId)) {
message('创建活动失败, 错误详情: ' . $pageId['message']);
}
$a = new Activity();
$ret = $a->create($input, $gifts);
if (is_error($ret)) {
message($ret['message']);
} else {
$page['url'] = $_W['siteroot'] . 'app/' . substr($this->createMobileUrl('activity', array('actid' => $ret)), 2);
$api->modifyPage($pageId, $page);
$a->touchPage($ret, $pageId);
message("成功创建活动", $this->createWebUrl('activity'));
}
}
$activity = array();
$time = array();
$time['start'] = date('Y-m-d 00:00');
$time['end'] = date('Y-m-d 15:00');
$activity['gifts'] = array();
$activity['type'] = 'direct';
示例9: addRemoveContactsFromListsActivityFromFile
/**
* Create an Remove Contacts Activity from a file. Valid file types are txt, csv, xls, xlsx
* @param string $accessToken - Constant Contact OAuth2 access token
* @param string $fileName - The name of the file (ie: contacts.csv)
* @param string $contents - The contents of the file
* @param string $lists - Comma separated list of ContactList id' to add the contacts too
* @return \Ctct\Components\Activities\Activity
*/
public function addRemoveContactsFromListsActivityFromFile($accessToken, $fileName, $contents, $lists)
{
$eol = "\r\n";
$data = '';
$boundary = md5(time());
$data .= '--' . $boundary . $eol;
$data .= 'Content-Disposition: form-data; name="file_name"' . $eol;
$data .= 'Content-Type: text/plain' . $eol . $eol;
$data .= $fileName . $eol;
$data .= '--' . $boundary . $eol;
$data .= 'Content-Disposition: form-data; name="lists"' . $eol;
$data .= 'Content-Type: text/plain' . $eol . $eol;
$data .= $lists . $eol;
$data .= '--' . $boundary . $eol;
$data .= 'Content-Disposition: form-data; name="data"' . $eol . $eol;
$data .= $contents . $eol;
$data .= "--" . $boundary . "--" . $eol;
$headers = array("Authorization: Bearer {$accessToken}", "Content-Type: multipart/form-data; boundary={$boundary}");
$baseUrl = Config::get('endpoints.base_url') . Config::get('endpoints.remove_from_lists_activity');
$url = $this->buildUrl($baseUrl);
$response = parent::getRestClient()->post($url, $headers, $data);
return Activity::create(json_decode($response->body, true));
}