本文整理汇总了PHP中Activity::log方法的典型用法代码示例。如果您正苦于以下问题:PHP Activity::log方法的具体用法?PHP Activity::log怎么用?PHP Activity::log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Activity
的用法示例。
在下文中一共展示了Activity::log方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: local
public function local()
{
// Local file upload
try {
if (empty($_FILES['file']) || !is_uploaded_file($_FILES['file']['tmp_name'])) {
throw new Exception("Something went wrong with uploading this file. The file may be too large to upload.");
}
$tmp_file = $_FILES['file'];
$dst = STORAGE_PATH . "/uploads/" . $tmp_file["name"];
$this->ensureGoodFile($tmp_file);
if (file_exists($dst)) {
unlink($dst);
}
// Create the directory structure if it doesn't exist
if (!is_dir(dirname($dst))) {
mkdir(dirname($dst), 0777, true);
}
rename($tmp_file["tmp_name"], $dst);
$file = FileUploadHandler::fromName("uploads/" . $tmp_file["name"]);
Activity::log("uploaded a new file called " . $file->getLink() . ".");
//send us to step 2.
$this->forwardToUrl("/job/create/file:{$file->id}");
} catch (Exception $e) {
$this->set('megaerror', $e->getMessage());
}
}
示例2: afterValidate
/**
* After validate event
* @return object
*/
public function afterValidate()
{
if (count($this->ids)) {
$save = array();
// The values we would like to check if they were changed
// key = value from this model
// value = value from the tickets model
$valuesChanged = array('status' => 'ticketstatus', 'type' => 'tickettype', 'category' => 'ticketcategory', 'priority' => 'priority', 'version' => 'ticketversion', 'fixedin' => 'fixedin', 'assignedtoid' => 'assignedtoid');
// Loop the values
foreach ($valuesChanged as $key => $value) {
if ($this->{$key}) {
$save[$value] = $this->{$key};
}
}
// Only update if we have any
if (count($save)) {
// Update all the ticket ids
Tickets::model()->updateByPk($this->ids, $save);
// Load one ticket model
$model = Tickets::model()->findByPk(reset($this->ids));
$this->activity['projectid'] = $model->projectid;
$this->activity['type'] = Activity::TYPE_TICKET;
$this->activity['title'] = 'Used multi-Moderation to update <strong>{n}</strong> {title}.';
// Append project params
$this->activity['params'] = array_merge($this->activity['params'], array('{n}' => count($this->ids), '{title}' => CHtml::link(Yii::t('tickets', 'Tickets'), array('/tickets'))));
// Activity: New Project
Activity::log($this->activity);
}
}
return parent::afterValidate();
}
示例3: create
public function create()
{
$this->assertLoggedIn();
$this->setTitle('Create a New Queue');
if ($this->args('submit')) {
//did we get a name?
if (!$this->args('name')) {
$errors['name'] = "You need to provide a name.";
$errorfields['name'] = 'error';
}
//okay, we good?
if (empty($errors)) {
//woot!
$q = new Queue();
$q->set('name', $this->args('name'));
$q->set('user_id', User::$me->id);
$q->save();
//todo: send a confirmation email.
Activity::log("created a new queue named " . $q->getLink() . ".");
$this->forwardToUrl($q->getUrl());
} else {
$this->set('errors', $errors);
$this->set('errorfields', $errorfields);
$this->setArg('name');
}
}
}
示例4: Parallax
public function Parallax()
{
$menus = Menu::roots()->get();
$menu = Menu::where('slug', '/anasayfa')->first();
\Activity::log('Ziyaret: Anasayfa (Tek Sayfa Site)');
return view('parallax')->with(['menus' => $menus, 'menu' => $menu]);
}
示例5: destroy
public function destroy($id)
{
Admin::where('id', '=', $id)->delete();
Activity::log(['contentId' => $id, 'user_id' => Auth::admin()->get()->id, 'contentType' => 'Administrador', 'action' => 'Delete ', 'description' => 'Eliminacion de un administrador', 'details' => 'Usuario: ' . Auth::admin()->get()->name, 'updated' => $id ? true : false]);
$output['success'] = 'deleted';
return Response::json($output, 200);
}
示例6: createRetailerOnSignUp
public function createRetailerOnSignUp($user, $data)
{
$retailer = new Retailer();
$retailer->admin_id = $user->id;
$retailer->category_id = $data['category'];
$retailer->name = $data['spaname'];
$retailer->save();
Activity::log(['contentId' => $retailer->id, 'contentType' => 'Retailer', 'action' => 'Create', 'description' => 'Created a retailer', 'details' => 'Retailer Name: ' . $retailer->name, 'updated' => false]);
}
示例7: restoreRevisionLog
/**
* Restore revision log
*
*/
public function restoreRevisionLog($revisionId)
{
$this->activity['projectid'] = $this->page->projectid;
$this->activity['type'] = Activity::TYPE_WIKI;
$this->activity['title'] = "Restored Revision <strong>{revid}</strong> for the page <strong>{pagetitle}</strong> ";
// Append project params
$this->activity['params'] = array_merge($this->activity['params'], array('{revid}' => WikiPages::model()->getModelRevisionLink($revisionId, $this->page->id, $this->page->alias), '{pagetitle}' => $this->page->getLink()));
// Activity: New Project
Activity::log($this->activity);
}
示例8: destroy
public function destroy($id)
{
if (Request::ajax()) {
Donacion::destroy($id);
$output['success'] = 'deleted';
Activity::log(['contentId' => $id, 'contentType' => 'Donacion', 'user_id' => Auth::admin()->get()->id, 'action' => 'Update', 'description' => 'Eliminacion de Donacion ' . $id, 'details' => 'Usuario: ' . Auth::admin()->get()->name, 'updated' => $id ? true : false]);
return Response::json($output, 200);
} else {
throw new Exception('Wrong request');
}
}
示例9: subscribes
/**
* Download Subscribes
*
*/
public function subscribes()
{
$subscribes = Subscribe::all('email')->toArray();
$file = '';
foreach ($subscribes as $key => $subscribe) {
$file .= $key == 0 ? $subscribe['email'] : "\r\n" . $subscribe['email'];
}
$path = storage_path('app/subscribes.txt');
\File::put($path, $file);
\Activity::log('Abone Listesi İndirildi');
return response()->download($path)->deleteFileAfterSend(true);
}
示例10: success
public function success()
{
$this->assertLoggedIn();
//handle our upload
try {
$file = FileUploadHandler::fromName($this->args('key'));
Activity::log("uploaded a new file called " . $file->getLink() . ".");
//send us to step 2.
$this->forwardToUrl("/job/create/file:{$file->id}");
} catch (Exception $e) {
$this->setTitle("Upload File - Error");
$this->set('megaerror', $e->getMessage());
}
}
示例11: afterSave
/**
* afterSave event
*
*/
public function afterSave()
{
$this->activity['projectid'] = $this->projectid;
$this->activity['type'] = Activity::TYPE_TICKET;
if ($this->isNewRecord) {
$this->activity['title'] = 'Created a new ticket <strong>{tickettitle}</strong>';
} else {
$this->activity['title'] = 'Updated ticket <strong>{tickettitle}</strong>';
}
// Append project params
$this->activity['params'] = array_merge($this->activity['params'], array('{tickettitle}' => $this->getLink()));
// Activity: New Project
Activity::log($this->activity);
return parent::afterSave();
}
示例12: forgotpass
public function forgotpass()
{
$this->setTitle("Retrieve Forgotten Password");
if ($this->args('submit')) {
$user = User::byEmail($this->args('email'));
if ($user->isHydrated()) {
//give them a pass hash.
$user->set('pass_reset_hash', sha1(mt_rand() . mt_rand() . mt_rand()));
$user->save();
$link = "http://" . SITE_HOSTNAME . $user->getUrl() . "/resetpass:" . $user->get('pass_reset_hash');
$text = Controller::byName('email')->renderView('lost_pass', array('user' => $user, 'link' => $link));
$html = Controller::byName('email')->renderView('lost_pass_html', array('user' => $user, 'link' => $link));
Activity::log("forgot his/her password. :P", $user);
Email::queue($user, "Password Reset", $text, $html);
$this->set('status', "We have sent a reset password confirmation email to '" . $this->args('email') . "'.");
} else {
$this->set('error', "We could not find an account with that email address.");
}
$this->setArg('email');
}
}
示例13: success
public function success()
{
$this->assertLoggedIn();
//get our payload.
$payload = unserialize(base64_decode($this->args('payload')));
//handle our upload
try {
//some basic error checking.
if (!preg_match('/gcode$/i', $this->args('key'))) {
throw new Exception("Only .gcode files are allowed at this time.");
}
//make our file.
$info = $this->_lookupFileInfo();
$file = $this->_createS3File();
Activity::log("uploaded a new file called " . $file->getLink() . ".");
//send us to step 2.
$this->forwardToUrl("/job/create/file:{$file->id}");
} catch (Exception $e) {
$this->setTitle("Upload File - Error");
$this->set('megaerror', $e->getMessage());
}
}
示例14: getTimeSlot
public function getTimeSlot($service_id)
{
Activity::log(['contentId' => $service_id, 'contentType' => 'Outlet', 'action' => 'getTimeSlot', 'description' => 'getTimeSlot of Service', 'details' => 'Service Id: ' . $service_id, 'updated' => false]);
$service = Service::find($service_id);
$outlet = Outlet::find($service->outlet_id);
$startTime = explode(':', $outlet->startTime);
$endTime = explode(':', $outlet->endTime);
if (count($startTime) < 2 || count($endTime) < 2) {
return array();
}
$start = mktime($startTime[0], $startTime[1], 0, 8, 12, 2014);
$end = mktime($endTime[0], $endTime[1], 0, 8, 12, 2014);
$hourArray = array();
$count = 1;
$hourArray[] = $start;
while ($start < $end && $count < 1000) {
$date = $start + $service->time_operate * 60;
$hourArray[] = $date;
$start = $date;
$count++;
}
return $hourArray;
}
示例15: add_comment
function add_comment()
{
$this->assertLoggedIn();
try {
$this->setTitle('Add Comment');
$content_id = $this->args('content_id');
$content_type = $this->args('content_type');
$content = Comment::getContent($content_id, $content_type);
if (!is_object($content)) {
throw new Exception("That content does not exist.");
}
if (!$content->isHydrated()) {
throw new Exception("That content does not exist.");
}
if (!$content->canComment()) {
throw new Exception("You cannot comment on this content.");
}
$form = $this->_createAddCommentForm($content_id, $content_type);
//handle our form
if ($form->checkSubmitAndValidate($this->args())) {
$comment = new Comment();
$comment->set('content_id', $form->data('content_id'));
$comment->set('content_type', $form->data('content_type'));
$comment->set('comment', $form->data('comment'));
$comment->set('user_id', User::$me->id);
$comment->set('comment_date', date("Y-m-d H:i:s"));
$comment->save();
Activity::log("commented on " . $content->getLink() . ".");
$this->forwardToUrl($content->getUrl());
}
$this->set('form', $form);
} catch (Exception $e) {
$this->setTitle('Add Comment - Error');
$this->set('megaerror', $e->getMessage());
}
}