Exemple #1
0
 public function edit()
 {
     if (!isset($_SESSION[APP_SES . 'id']) || $_SESSION[APP_SES . 'id'] == 0) {
         $_SESSION[APP_SES . 'route'] = '/application/schnippets&m=edit&id=' . $_GET['id'];
         gotoUrl('/?route=/users/users');
         exit;
     }
     $this->loadModel('schnippet');
     $id = intval($_GET['id']);
     $schnippet = new Schnippet();
     $schnippet->load($id);
     $data['schnippet'] = $schnippet->getMembers();
     if (!isset($_POST['save'])) {
         $this->setTitle('Update a Schnippet');
         $this->loadView(SLASH . 'application' . SLASH . 'edit', TRUE, $data);
     } else {
         $schnippet->setMembers($_POST);
         $schnippet->save();
         gotoUrl('/?route=/application/schnippets&m=get&id=' . $schnippet->getPrimaryKey());
     }
 }