コード例 #1
0
ファイル: PageController.php プロジェクト: sheldon/dejavu
 public function recruitment()
 {
     $this->rec_form = new WaxForm();
     $this->rec_form->add_element("age", "TextInput");
     $this->rec_form->add_element("english_level", "TextInput", array('label' => 'How well do you speak english'));
     $this->rec_form->add_element("name", "TextInput", array("label" => "Character Name"));
     $this->rec_form->add_element("class", "TextInput", array('label' => "Character Class"));
     $this->rec_form->add_element("level", "TextInput", array('label' => "Character Level"));
     $this->rec_form->add_element("gear", "TextInput", array("label" => "Average gear level (heroic/naxx10/25/uld10/25)"));
     $this->rec_form->add_element("attendance", "TextInput", array("label" => "Can you attend 2 of our weekly planned raids every week"));
     $this->rec_form->add_element("talents", "TextareaInput", array("label" => "Your chosen raid talents and why you chose them"));
     $this->rec_form->add_element("previous_guild", "TextareaInput", array("label" => "Reason for leaving your previous guild"));
     $this->rec_form->add_element("raid_experience", "TextareaInput", array("label" => "Previous raiding experience (which classes have you played in raids, and to what level of raid)"));
     $this->rec_form->add_element("internet", "TextareaInput", array("label" => "What kind of internet connection do you have. (Please mention anything about regular lags here)"));
     $this->rec_form->add_element("other_members", "TextareaInput", array("label" => "Do you know any other members in Deja Vu and what is your replationship to them"));
     $this->rec_form->add_element("about", "TextareaInput", array("label" => "About Yourself"));
     $this->rec_form->submit_text = "Apply to Guild";
     if ($this->rec_form->save()) {
         $notifier = new Notifier();
         $notifier->send_recruitment($this->rec_form);
         $forum_data_row = array("user_id" => "1", "status" => "0", "forum_id" => "7", "thread" => "0", "parent_id" => "0", "thread_count" => "0", "author" => "Paracetamol", "ip" => "127.0.0.1", "status" => "2", "modifystamp" => time(), "subject" => "Application from " . $this->rec_form->handler->elements['name']->value, "body" => "");
         foreach ($this->rec_form as $name => $element) {
             $forum_data_row['body'] .= "[b][size=large]" . $element->label . " :[/size][/b]\n" . $element->value . "\n\n";
         }
         $forum_model = new WaxModel();
         $forum_model->table = "phorum_messages";
         $forum_model->row = $forum_data_row;
         $forum_model->primary_key = "message_id";
         $forum_model->save();
         $forum_model->thread = $forum_model->message_id;
         $forum_model->save();
         $this->recruitment_message = 'Thanks for your application, we\'ll get back to your shortly. Please check our <a href="/forum/list.php?7">recruitment forum</a> for an assessment from our members.';
     }
 }