function beforeInsert($db) { $event = $db->get(new Event($this->event)); if (Variable::istype('Event', $event) && $event->isActive($db)) { $this->hash = crypt($this->name . time() . mt_rand(0, 9999)); if ($this->mail) { $parser = new HtmlParser('thanks.mtpl'); $parser->setVariable('participant', $this); $mail = new Mail('*****@*****.**', 'rhaco kaigi'); $mail->to($this->mail, $this->name); $mail->subject('rhaco kaigi'); $mail->message($parser->read()); $mail->send(); } return true; } return false; }
<?php require dirname(__FILE__) . '/__init__.php'; Rhaco::import('tag.HtmlParser'); $db = new DbUtil(Event::connection()); $p = new HtmlParser('index.html'); $p->setVariable('event', $db->get(new Event(), new C(Q::depend(), Q::eq(Event::columnId(), Rhaco::constant('CURRENT_EVENT', 1))))); $p->setVariable('hatena', Rhaco::obj('HatenaSyntax', array('headlevel' => 4, 'id' => 'event_description'))); $p->write();