venus /fuel/packages/oil/views/scaffolding/crud/actions/edit.php

Language PHP Lines 34
MD5 Hash 61aaaef0d5ccc3533406bfba420898a3 Estimated Cost $260 (why?)
Repository https://bitbucket.org/arkross/venus View Raw File View Project SPDX
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
		is_null($id) and Response::redirect('<?php echo $controller_name ?>');

		$<?php echo $singular_name; ?> = Model_<?php echo $model_name; ?>::find_one_by_id($id);

		if (Input::method() == 'POST')
		{
			$val = Model_<?php echo $model_name; ?>::validate('edit');

			if ($val->run())
			{
<?php foreach ($fields as $field): ?>
				$<?php echo $singular_name; ?>-><?php echo $field['name']; ?> = Input::post('<?php echo $field['name']; ?>');
<?php endforeach; ?>

				if ($<?php echo $singular_name; ?>->save())
				{
					Session::set_flash('success', 'Updated <?php echo $singular_name; ?> #'.$id);
					Response::redirect('<?php echo $uri; ?>');
				}
				else
				{
					Session::set_flash('error', 'Nothing updated.');
				}
			}
			else
			{
				Session::set_flash('error', $val->show_errors());
			}
		}

		$this->template->set_global('<?php echo $singular_name; ?>', $<?php echo $singular_name; ?>, false);
		$this->template->title = "<?php echo ucfirst($plural_name); ?>";
		$this->template->content = View::forge('<?php echo $view_path; ?>/edit');
Back to Top