本文整理汇总了PHP中Audit::create方法的典型用法代码示例。如果您正苦于以下问题:PHP Audit::create方法的具体用法?PHP Audit::create怎么用?PHP Audit::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Audit
的用法示例。
在下文中一共展示了Audit::create方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: audit
private function audit($markerSite, $action)
{
Log::info("Auditing " . $markerSite->id . "for " . $action);
$data = $this->getAuditData($markerSite);
$data["action"] = $action;
Audit::create($data);
}
示例2: store
/**
* Store a newly created audit in storage.
*
* @return Response
*/
public function store()
{
$validator = Validator::make($data = Input::all(), Audit::$rules);
if ($validator->fails()) {
return Redirect::back()->withErrors($validator)->withInput();
}
Audit::create($data);
return Redirect::route('audits.index');
}
示例3: delete_page
public function delete_page($args)
{
$page_id = array_shift($args);
if ($page = R::load('page', $page_id)) {
$old = clone $page;
R::trash($page);
Audit::create($old, NULL, 'Developer deleted page from system');
}
$this->redirect(PACKAGE_URL);
}
示例4: crud
function crud($posttype, RedBeanPHP\OODBBean $post_object)
{
$fields = $this->get_fields($posttype, false);
$view = new G2_TwigView('post_form');
$view->fields = $fields;
$form = new G2_FormMagic($view->get_render());
if (!$form->is_posted() && $post_object->getID()) {
$data = [];
foreach ($post_object->ownPostdata as $postdata) {
$data[$postdata->postmeta->fieldname] = $postdata->value;
}
$form->set_data($data);
}
if ($form->is_posted()) {
$old = clone $post_object;
//Save fields to correct db locations
$postdatas = [];
foreach ($form->data() as $field => $value) {
// First Match the field with the correct postdata record from the current post
unset($postdata);
foreach ($post_object->ownPostdata as &$data) {
if ($data->postmeta->fieldname == $field) {
$postdata = $data;
}
}
if (!isset($postdata)) {
$postdata = R::dispense('postdata');
$postdata->postmeta = R::findOne('postmeta', 'fieldname = :field AND post_type = :type', ['type' => $posttype, 'field' => $field]);
}
$postdata->value = $value;
R::store($postdata);
$postdatas[] = $postdata;
}
$post_object->ownPostdata = $postdatas;
$post_object->post_type = $posttype;
if (!$post_object->getID()) {
$post_object->date_created = date('Y-m-d H:i:s');
}
$post_object->date_modified = date('Y-m-d H:i:s');
$files = $form->get_uploaded_files();
R::store($post_object);
//Save files to
Audit::create($old, $post_object, 'An Post was saved');
return true;
}
echo $form->parse();
}
示例5: save_area
function save_area()
{
G2_User::init();
if (G()->logged_in() && !empty($_POST)) {
$content = $_POST['content'];
$area_id = $_POST['area_id'];
$area = R::findOne('area', 'id = :area', ['area' => $area_id]);
$old = clone $area;
$area->html = $content;
R::store($area);
Audit::create($old, $area, 'An Area was updated with new content');
echo json_encode(['success' => true, 'message' => 'Content Saved Successfully']);
} else {
echo json_encode(['success' => false, 'message' => 'Not Logged in']);
}
die;
}
示例6: remove
function remove($args)
{
$id = array_shift($args);
if (is_numeric($id) && ($user = R::load('user', $id))) {
Audit::create($user, null, 'User was removed from the system');
R::trash($user);
}
$this->redirect(PACKAGE_URL);
}
示例7: update_titles
/**
* Update titles of pages in site
*
*/
function update_titles()
{
echo 'Load Config <br>';
$config = new Zend_Config_Ini('meta.ini', APP_DEPLOY);
$title = $config->meta->title->change;
$pages_slugs = [];
$this->filter($title, $pages_slugs);
$pages = R::findAll('page');
$meta = new Meta_Generator($config);
foreach ($pages as $page) {
$old = clone $page;
echo "{$page->title} ==== " . $meta->get_title($page->slug) . '<br>';
echo "{$page->description} ==== " . $meta->get_description($page->slug) . '<br>';
$page->title = $meta->get_title($page->slug);
$page->description = $meta->get_description($page->slug);
Audit::create($old, $page, "Script updated Meta Data");
R::store($page);
}
// foreach($pages_slugs as $slug => $title){
// $page = R::findOne('page','slug = :slug',['slug' => $slug]);
// if($page){
// echo "$page->title => $title ==== $page->slug<br>";
// } else {
// echo "$slug Page not Found <br>";
// }
// }
}
示例8: restore
function restore($args)
{
$what = array_shift($args);
$id = array_shift($args);
if (!is_numeric($id) || !($audit = R::load('audit', $id))) {
$this->redirect(PACKAGE_URL);
}
$audit = current(Audit::deserialize([$audit]));
if ($what == 'new') {
$bean = $audit->new_obj;
} else {
$bean = $audit->old_obj;
}
//Retrieve the current record
$current = R::findOne($bean->getMeta('type'), 'id = :id', array('id' => $bean->id));
if (!$current) {
// Record was removed. Thus record needs to be recreated
//$bean = R::dup($bean);
}
$old = $current != null ? clone $current : null;
if ($current == null) {
$current = R::dispense($bean->getMeta('type'));
}
foreach ($bean as $field => $value) {
$current->{$field} = $value;
}
R::store($current);
Audit::create($old, $current, "restored to previous version changed on {$audit->date_logged}");
$this->redirect(PACKAGE_URL);
}