foreach ($files as $file) { $file = trim($file); // for cache file, we move it to its proper location if (strpos($file, str_replace(WEBROOT . DS, "", CACHE_DIR)) === 0) { $oldname = WEBROOT . DS . $file; $newname = WEBROOT . DS . "files/application" . str_replace(CACHE_DIR, "", WEBROOT . DS . $file); rename($oldname, $newname); $file = str_replace(WEBROOT . DS, "", $newname); } $rtn[] = $file; } $object->setIeltsTranscripts(implode("\n", $rtn)); $object->setCreatedAt(time()); if ($error_flag == false) { if ($object->save()) { Message::register(new Message(Message::SUCCESS, i18n(array("en" => "Thanks for your application. We will come back to you as soon as possible.", "zh" => "记录保存成功")))); sendemailAdmin('Apply for course', '<p>A new application for course has just been submitted: <br /><a href="http://en.ct21.com.au/admin/application/edit/' . $object->getId() . '">http://en.ct21.com.au/admin/application/edit/' . $object->getId() . '</a></p>'); HTML::forwardBackToReferer(); } else { Message::register(new Message(Message::DANGER, i18n(array("en" => "Record failed to save", "zh" => "记录保存失败")))); } } } $html = new HTML(); $html->renderOut('core/backend/html_header', array('title' => i18n(array('en' => 'Create Application', 'zh' => 'Create 申请')))); $html->output('<div id="wrapper">'); $html->renderOut('core/backend/header'); $html->renderOut('application/backend/application_create', array('object' => $object)); $html->output('</div>'); $html->renderOut('core/backend/html_footer'); exit;
<?php /** handle submission **/ if (isset($_POST['submit'])) { $content = "<table>"; foreach ($_POST as $key => $val) { $tokens = explode("_", $key); $key = ""; foreach ($tokens as $token) { $key .= ucfirst($token) . " "; } $content .= "<tr><th>{$key}</th><td>{$val}</td></tr>"; } $content .= "</table>"; sendemailAdmin($settings['sitename'] . " - Apply for course", $content); Message::register(new Message(Message::SUCCESS, 'Thank you for your application. We will contact you soon!')); } $html = new HTML(); $html->renderOut('site/components/html_header', array('title' => 'Apply for a course', 'body_class' => 'page page-template page-template-templates page-template-full-width page-template-templatesfull-width-php has-toolbar')); $html->output('<div id="page-container">'); //$html->renderOut('site/components/toptoolbar'); $html->renderOut('site/components/header'); $html->renderOut('site/apply', array('full_page_sidebar_right' => $html->render('site/components/full_page_sidebar_right', array('blocks' => array(Block::findByName('Get in Touch')))))); $html->renderOut('site/components/footer'); $html->output('</div>'); $html->renderOut('site/components/page_footer'); $html->renderOut('site/components/html_footer');
Message::register($messages); HTML::forward($_SERVER['HTTP_REFERER'] . '#contact-form'); } // check spam if (module_enabled('form') && !Form::checkSpamToken('global contact form')) { $message = new Message(Message::DANGER, i18n(array('en' => 'Form login session expired. Please try again', 'zh' => '表单提交时限过期,请重新尝试登录'))); Message::register($message); HTML::forward($_SERVER['HTTP_REFERER'] . '#contact-form'); } /** success action **/ Message::register(new Message(Message::SUCCESS, i18n(array('en' => 'Thank you for your contact ;) We will get back to you soon.', 'zh' => '感谢您的留言 ;) 我们会及时和您沟通')))); if (module_enabled('mail')) { $message = array(); foreach ($_POST['contact'] as $key => $val) { $message[] = "<p><strong>{$key}</strong>:<br />" . str_replace("\n", "<br />", $val) . "</p><br />"; } $message = implode("\n", $message); sendemailAdmin('Site contact form', $message); } HTML::forward($_SERVER['HTTP_REFERER'] . '#contact-form'); } $html = new HTML(); $html->renderOut('site/components/html_header', array('title' => 'Contact', 'body_class' => 'page page-template page-template-templates page-template-full-width page-template-templatesfull-width-php has-toolbar')); $html->output('<div id="page-container">'); //$html->renderOut('site/components/toptoolbar'); $html->renderOut('site/components/header'); $html->renderOut('site/contact', array('pagetitle' => $page->getTitle(), 'content' => $page->getContent(), 'googlemap' => $html->render('site/components/googlemap', array('latitude' => '-33.877348', 'longitude' => '151.2079613')), 'full_page_sidebar_right' => $html->render('site/components/full_page_sidebar_right', array('blocks' => array(Block::findByName('Get in Touch'), Block::findByName('Apply Now')))))); $html->renderOut('site/components/footer'); $html->output('</div>'); $html->renderOut('site/components/page_footer'); $html->renderOut('site/components/html_footer');