public function createadvertisingagencyAction()
 {
     $config = Zend_Registry::get('config');
     $this->view->headScript()->appendFile($config->baseurl . '/js/jquery.validate.min.js');
     $this->view->headScript()->appendFile($config->baseurl . '/js/agency.js');
     $city = $this->_getParam('city');
     $next = $this->_getParam('next');
     $cityObj = $this->city->findByName($city);
     if (isset($cityObj)) {
         $form = new CreateAdvertisingAgency($cityObj, $next);
         $this->view->form = $form;
         if ($this->getRequest()->isPost()) {
             $formData = $this->getRequest()->getPost();
             if ($form->isValid($formData)) {
                 //					$isValid = $this->_helper->common->validReCaptcha($this->_getAllParams());
                 //                	if ($isValid) {
                 $city_id = $this->_getParam(AdvertisingAgency::CITY);
                 $name = $this->_getParam(User::NAME);
                 $email = $this->_getParam(User::EMAIL);
                 $mobile = $this->_getParam(User::MOBILE);
                 $description = $this->_getParam(AdvertisingAgency::DESCRIPTION);
                 $comment = $this->_getParam(AdvertisingAgency::COMMENT);
                 $db = Zend_Registry::get("db");
                 $db->beginTransaction();
                 $data = array(User::NAME => $name, User::EMAIL => $email, User::MOBILE => $mobile);
                 $user = $this->user->addUser($data);
                 $data = array(AdvertisingAgency::CITY => $city_id, AdvertisingAgency::USER => $user->id, AdvertisingAgency::DESCRIPTION => $description, AdvertisingAgency::COMMENT => $comment, AdvertisingAgency::CREATED => $this->_helper->generator->generateCurrentTime(), AdvertisingAgency::MODIFIED => $this->_helper->generator->generateCurrentTime(), AdvertisingAgency::STATUS => PostStatus::ACTIVE);
                 $advertisingAgency = $this->advertisingAgency->addEntry($data);
                 // send out emails
                 $message = MailTemplate::getAdvertisingAgencyEmailNotificationMessage($user, $advertisingAgency, MailTemplate::ADVERTISING_AGENCY_REQUEST_BODY);
                 $this->mailQueue->addToQueue(MailType::SYSINFO, null, MailTemplate::SUBJECT_ADVERTISING_AGENCY_REQUEST, Constant::SYSTEM_MAIL, Constant::ADVERTISING_AGENCY_RECIPIENTS, $message, $this->_helper->generator->generateCurrentTime());
                 $message = MailTemplate::getAdvertisingAgencyEmailNotificationMessage($user, $advertisingAgency, MailTemplate::ADVERTISING_AGENCY_REQUEST_RECEIPT_BODY);
                 $this->mailQueue->addToQueue(MailType::SYSINFO, null, MailTemplate::SUBJECT_ADVERTISING_AGENCY_REQUEST_RECEIPT, Constant::SYSTEM_MAIL, $user->email, $message, $this->_helper->generator->generateCurrentTime());
                 $db->commit();
                 $this->_flashMessenger->addMessage("您的需求已经发送,我们会尽快与您取得联系!谢谢!");
                 if (empty($next)) {
                     $this->_redirect("/" . $cityObj->name . "/bulletin/list");
                 } else {
                     $this->_redirect(urldecode($next));
                 }
                 //					} else {
                 //						echo "Capthca is not correct!";
                 //					}
             } else {
                 echo "invalid form";
             }
         }
     } else {
         throw new Exception('暂时不支持所在城市!');
     }
 }