本文整理汇总了PHP中Activity类的典型用法代码示例。如果您正苦于以下问题:PHP Activity类的具体用法?PHP Activity怎么用?PHP Activity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Activity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _new
public function _new($followup = FALSE)
{
if (array_key_exists('followup', $this->_data)) {
$followup = $this->_data['followup'];
}
$this->view->set('page_title', 'New CRM Activity');
// New follow-up activity
if ($followup) {
$this->view->set('page_title', 'New CRM Follow-up Activity');
unset($this->_data['id']);
$activity = new Activity();
$activity->load($followup);
$this->_data['person_id'] = $activity->person_id;
$this->_data['company_id'] = $activity->company_id;
$this->_data['name'] = $activity->name;
$this->_data['description'] = $activity->description;
$this->_data['completed'] = '';
}
// Edit existing activity
if (isset($this->_data['id'])) {
$this->view->set('page_title', 'Edit CRM Activity');
}
// New activity from opportunity
if (isset($this->_data['opportunity_id'])) {
$this->view->set('page_title', 'New CRM Activity');
$opportunity = DataObjectFactory::Factory('Opportunity');
$opportunity->load($this->_data['opportunity_id']);
$this->_data['person_id'] = $opportunity->person_id;
$this->_data['company_id'] = $opportunity->company_id;
}
parent::_new();
}
示例2: logActivity
function logActivity($action, $body = null)
{
$activity = new Activity($this);
$name = $this->logName();
$activity->body = "{$action} {$activity->target_class} {$activity->target_id}" . ($name ? ", \"{$name}\"" : "");
$activity->save();
}
示例3: load
/**
* load in the Activities for the given SQL statement
*
* @param string $sql
* @param array $params the parameters that go into the sql statement
* @param String $style (optional - default 'long') may be 'short' or 'long' or 'cif'
* @return ActivitySet (this)
*/
function load($sql, $params, $style = 'long')
{
global $DB;
if (!isset($params)) {
$params = array();
}
// get records
$resArray = $DB->select($sql, $params);
if ($resArray !== false) {
$count = count($resArray);
for ($i = 0; $i < $count; $i++) {
$array = $resArray[$i];
$a = new Activity();
$xml = $array['XML'];
$activity = $a->load($array['ItemID'], $array['UserID'], $array['Type'], $array['ModificationDate'], $array['ChangeType'], $xml, $style);
if (!$activity instanceof Error) {
$this->add($a);
}
}
$this->totalno = count($this->activities);
} else {
return database_error();
}
return $this;
}
示例4: log
function log($activity)
{
$act = new Activity();
$act->message = $activity;
$act->user_id = Auth::user()->id;
$act->save();
}
示例5: store
/**
* Store to the database the given entities as entities decendent from the given
* document.
*
* @param $document Parent document -- Must be a document entity on the database.
* @param $entities List of entities to be created as decendents from the given document.
*
* @return multitype:string A status array containing the result status information.
*/
public function store($parent, $units, $type)
{
if (count($units) <= 0 && count($units) >= 10000) {
// We will have problems processing empty files or more than 10,000 entities
return ['error' => 'Unable to process files with more than 10,000 lines: ' . $nEnts . 'found'];
}
$activity = new \Activity();
$activity->softwareAgent_id = $this->softwareComponent->_id;
$activity->save();
$entities = [];
foreach ($units as $unit) {
try {
$entity = new Unit();
$entity->project = $parent->project;
$entity->activity_id = $activity->_id;
$entity->documentType = $type;
$entity->parents = [$parent->_id];
$entity->content = $unit;
$entity->hash = md5(serialize($entity));
$entity->save();
array_push($entities, $entity);
} catch (Exception $e) {
foreach ($entities as $en) {
$en->forceDelete();
}
throw $e;
}
}
\Temp::truncate();
return ['success' => 'Sentences created successfully'];
}
示例6: boot
public static function boot()
{
parent::boot();
static::creating(function ($workerunit) {
// dd($workerunit);
// Inherit type, domain and format
if (empty($workerunit->type) or empty($workerunit->domain) or empty($workerunit->format)) {
$j = Job::where('_id', $workerunit->job_id)->first();
$workerunit->type = $j->type;
$workerunit->domain = $j->domain;
$workerunit->format = $j->format;
}
$workerunit->annotationVector = $workerunit->createAnnotationVector();
// Activity if not exists
if (empty($workerunit->activity_id)) {
try {
$activity = new Activity();
$activity->label = "Workerunit is saved.";
$activity->softwareAgent_id = $workerunit->softwareAgent_id;
$activity->save();
$workerunit->activity_id = $activity->_id;
Log::debug("Saving workerunit {$workerunit->_id} with activity {$workerunit->activity_id}.");
} catch (Exception $e) {
if ($activity) {
$activity->forceDelete();
}
//if($workerunit) $workerunit->forceDelete();
throw new Exception('Error saving activity for workerunit.');
}
}
});
}
示例7: update
public function update($id, $data)
{
$action = $this->params()->fromQuery('action');
$project = $this->find('\\User\\Entity\\Project', $id);
if ($action == 1) {
$project->setData(['tax' => $data['tax'], 'discount' => $data['discount']]);
$project->save($this->getEntityManager());
}
if ($action == 2) {
$project->setData(['status' => 2]);
$project->save($this->getEntityManager());
$activity = new Activity();
$activity->setData(['activityDate' => new \DateTime('NOW'), 'project' => $project, 'type' => "accept_quote", 'sender' => $this->getReference('\\User\\Entity\\User', $data['client']['id'])]);
//$activity->save($this->getEntityManager());
}
if ($action == 3) {
$arr = [];
foreach ($data['types'] as $type) {
$arr[] = $type['id'];
}
$data['types'] = $arr;
$project->setData(['tax' => $data['tax'], 'discount' => $data['discount'], 'duration' => $data['duration'], 'serviceLevel' => $data['serviceLevel'], 'types' => $data['types']]);
$project->save($this->getEntityManager());
}
return new JsonModel(['project' => $project->getData()]);
}
示例8: get
function get($criteria = null)
{
$user = current_user();
$projects = new Project();
$activity = new Activity();
$this->projects = $projects->get();
$this->activity = $activity->get();
}
示例9: afterFind
function afterFind(\Model $model, $results, $primary)
{
parent::afterFind($model, $results, $primary);
if ($model->id) {
$data = array('model' => $model->alias, 'model_id' => $model->id, 'activity_type' => 'R', 'user_id' => $model->loginUser['id']);
$activity = new Activity();
$activity->save($data);
}
}
示例10: getOldActivity
protected function getOldActivity($subject, $created)
{
$activity = new Activity(['subject_id' => $subject->getKey(), 'subject_type' => get_class($subject), 'user_id' => 1, 'name' => 'created_post']);
$time = Carbon::createFromTimestamp($created)->toDateTimeString();
$activity->setCreatedAt($time);
$activity->setUpdatedAt($time);
$activity->save();
return $activity;
}
示例11: actionActivity
public function actionActivity()
{
$model = new Activity('search');
$model->with('users');
$model->unsetAttributes();
if (isset($_GET['Activity'])) {
$model->attributes = $_GET['Activity'];
}
$this->render('activity', array('model' => $model));
}
示例12: op_activity_body_filter
/**
* op_activity_body_filter
*
* @param Activity $activity
* @param boolean $is_auto_link
* @return string
*/
function op_activity_body_filter($activity, $is_auto_link = true)
{
$body = $activity->getBody();
if ($activity->getTemplate()) {
$config = $activity->getTable()->getTemplateConfig();
if (!isset($config[$activity->getTemplate()])) {
return '';
}
$params = array();
foreach ($activity->getTemplateParam() as $key => $value) {
$params[$key] = $value;
}
$body = __($config[$activity->getTemplate()], $params);
$event = sfContext::getInstance()->getEventDispatcher()->filter(new sfEvent(null, 'op_activity.template.filter_body'), $body);
$body = $event->getReturnValue();
}
$event = sfContext::getInstance()->getEventDispatcher()->filter(new sfEvent(null, 'op_activity.filter_body'), $body);
$body = $event->getReturnValue();
if (false === strpos($body, '<a') && $activity->getUri()) {
return link_to($body, $activity->getUri());
}
if ($is_auto_link) {
if ('mobile_frontend' === sfConfig::get('sf_app')) {
return op_auto_link_text_for_mobile($body);
}
return op_auto_link_text($body);
}
return $body;
}
示例13: pay
public function pay($tid)
{
$trade = $this->getOne($tid);
if (!empty($trade) && $trade['status'] == 'created') {
$this->touch($tid, 'paid');
require_once MB_ROOT . '/source/Activity.class.php';
$a = new Activity();
$activity = $a->getOne($trade['activity']);
$this->pool($trade['activity'], $activity['tag']['price']);
}
}
示例14: createFromXML
/**
* Convert the raw XML into an object
*
* @param \SimpleXMLElement $xml
* @return Activity
*/
public static function createFromXML(\SimpleXMLElement $xml)
{
$activity = new Activity();
if (isset($xml->attributes()['count'])) {
$activity->setCount((int) $xml->attributes()['count']);
}
if (isset($xml->attributes()['type'])) {
$activity->setType((string) $xml->attributes()['type']);
}
return $activity;
}
示例15: pay
public function pay(Order $order, Activity $activity, $lang)
{
$activity_data = $activity->get_activity_data();
$info = model('wt_payment_info')->get_one(array('activity_id' => $activity_data['activity_id']));
if (!$info) {
$ret['r'] = 'error';
$ret['msg'] = '50004:Payment Info get failed.';
}
$data = array();
$data['payment_info'] = $lang == 'en' ? $info['info_en'] : $info['info_zh'];
return $this->generate_html($data);
}