本文整理汇总了PHP中Activity::set方法的典型用法代码示例。如果您正苦于以下问题:PHP Activity::set方法的具体用法?PHP Activity::set怎么用?PHP Activity::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity::set方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: log
public static function log($activity, User $user = null)
{
if ($user === null) {
$user = User::$me;
}
$a = new Activity();
$a->set('user_id', $user->id);
$a->set('action_date', date("Y-m-d H:i:s"));
$a->set('activity', $activity);
$a->save();
return $a;
}
示例2: array
static function payment_created($payment, $invoice, $payment_method, $user_id)
{
$title = Language::get('activity.payment_created', array('invoice_number' => $invoice->number, 'currency_symbol' => get_config('currency_symbol'), 'paymentAmount' => $payment->amount));
$activity = new Activity();
$activity->set_object($payment);
$activity->set('action_taken', Language::get('activity.completed'));
$activity->set('object_title', $title);
$activity->set('project_id', $invoice->project_id);
$activity->set('client_id', $invoice->client_id);
if ($payment_method == 'paypal') {
$activity->is_user_generated = false;
$activity->set('user_id', $user_id);
}
$activity->save();
}
示例3: action_index
public function action_index()
{
$this->template->title = __('Contact');
$this->template->content = View::factory('page/contact')->bind('errors', $errors);
// Validate the required fields
$data = Validate::factory($_POST)->filter('name', 'trim')->rule('name', 'not_empty')->filter('email', 'trim')->rule('email', 'not_empty')->rule('email', 'email')->filter('message', 'trim')->filter('message', 'Security::xss_clean')->filter('message', 'strip_tags')->rule('message', 'not_empty');
if ($data->check()) {
// Load Swift Mailer
require Kohana::find_file('vendor', 'swiftmailer/lib/swift_required');
$transport = Swift_MailTransport::newInstance();
$mailer = Swift_Mailer::newInstance($transport);
// Get the email config
$config = Kohana::config('site.contact');
$recipient = $config['recipient'];
$subject = $config['subject'];
// Create an email message
$message = Swift_Message::newInstance()->setSubject(__($subject, array(':name' => $data['name'])))->setFrom(array($data['email'] => $data['name']))->setTo($recipient)->addPart($data['message'], 'text/plain');
// Send the message
Swift_Mailer::newInstance($transport)->send($message);
// Set the activity and flash message
Activity::set(Activity::SUCCESS, __('Message sent from :email', array(':email' => $data['email'])));
Message::set(Message::SUCCESS, __('Message successfully sent.'));
// Redirect to prevent POST refresh
$this->request->redirect($this->request->uri);
}
if ($errors = $data->errors('contact')) {
// Set the error flash message
Message::set(Message::ERROR, __('Please correct the errors.'));
}
$_POST = $data->as_array();
}