<?php $logs = new Model_Mailform_Log(); $logs->order('`read`, datesubmitted DESC'); $logs->where('hidden = ?', 0); // filter by the given id if (!empty($_REQUEST['mailformid'])) { $logs->where('mailformid = ?', $_REQUEST['mailformid']); } $pagination = Pagination::Calculate(count($logs)); $logs->paginate($pagination['page'], $pagination['perpage']); foreach ($logs->select() as $log) { $log['read'] = 1; $log->save(); } $pm->setVariable('log', $logs); $pm->setVariable('pagination', $pagination);
<?php $mailform = Model_Mailform::Get($_REQUEST['mailformid']); if ($mailform->exists()) { include 'form.inc.php'; $log = new Model_Mailform_Log(); $log->where('mailformid = ?', $_REQUEST['mailformid']); /*if ($log->count()) { Typeframe::Redirect( 'This mailform has submissions. If you want to change the fields, it is recommended that you create a new mailform instead.', Typeframe::CurrentPage()->applicationUri(), -1); return; }*/ $pm->setVariable('mailform', $mailform); if ($_SERVER['REQUEST_METHOD'] == 'POST') { require_once 'update.inc.php'; Typeframe::Redirect('Mailform updated.', Typeframe::CurrentPage()->applicationUri()); } } else { Typeframe::Redirect('Invalid mailform specified.', Typeframe::CurrentPage()->applicationUri()); }