本文整理汇总了PHP中sfWebRequest::getHost方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWebRequest::getHost方法的具体用法?PHP sfWebRequest::getHost怎么用?PHP sfWebRequest::getHost使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfWebRequest
的用法示例。
在下文中一共展示了sfWebRequest::getHost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
if (!($request->getHost() == gcr::rootDomainName || $request->getHost() == gcr::domainName)) {
global $CFG;
$this->redirect($CFG->current_app->getAppUrl());
}
$this->getResponse()->setTitle('Global Classroom - Cloud-based, private social network and eLearning Platform');
$this->getResponse()->addMeta('description', 'Global Classroom provides a cloud-based private social and elearning platform for business, education, ' . 'government, non-profits, and membership organizations.');
}
示例2: AddComment
private function AddComment(sfWebRequest $request)
{
$text = $request->getParameter('comment_text');
if ($request->isMethod("GET")) {
$text = urldecode($text);
}
if ($this->getRequestParameter('comment_picture_url')) {
$filename = jrFileUploader::UploadRemote($request->getParameter('comment_picture_url'));
if ($text) {
$text .= "<br/>";
}
$text .= "<img src='http://" . $request->getHost() . "/uploads/" . $filename . "' />";
}
if (!trim($text)) {
return;
}
sfApplicationConfiguration::getActive()->loadHelpers(array('Parse', 'Text', 'Tag', 'I18N', 'Url'));
$user = $this->getUser()->getGuardUser();
$comment = new PostComment();
$comment->setUser($user);
$comment->setPost($this->post);
if ($this->parent) {
$comment->setParent($this->parent);
}
$comment->setComment(parsetext($text));
$comment->setCommentOriginal($text);
$comment->save();
$this->curUser = $this->getUser()->getGuardUser();
if ($this->curUser) {
Cookie::setCookie($this->curUser, "comments" . $this->post->getId(), $this->post->getAllComments('count'), time() + 24 * 60 * 60);
Cookie::setCookie($this->curUser, "comments" . $this->post->getId() . "Time", date("Y-m-d H:i:s"), time() + 24 * 60 * 60);
}
}
示例3: getHost
public function getHost()
{
$result = parent::getHost();
if (!$result) {
$result = parse_url(sfConfig::get('op_base_url'), PHP_URL_HOST);
}
return $result;
}
示例4: executeIndex
/**
* Executes index action
*/
public function executeIndex(sfWebRequest $r)
{
// If we aren't auth and when it's allowed, display register form
if (!$this->getUser()->isAuthenticated() && sfConfig::get("app_register")) {
$this->regform = new RegisterForm();
// If we posted
if ($r->isMethod('post')) {
$params = $r->getParameter($this->regform->getName());
$this->regform->bind($params);
if ($this->regform->isValid()) {
// Blacklisted domains
$blacklistdomain = array('pourri.fr', 'yopmail.com', 'yopmail.fr', 'jetable.org', 'mail-temporaire.fr', 'ephemail.com', 'trashmail.net', 'kasmail.com', 'spamgourmet.com', 'tempomail.com', 'guerrillamail.com', 'mytempemail.com', 'saynotospams.com', 'tempemail.co.za', 'mailinator.com', 'mytrashmail.com', 'mailexpire.com', 'maileater.com', 'spambox.us', 'guerrillamail.com', '10minutemail.com', 'dontreg.com', 'filzmail.com', 'spamfree24.org', 'brefmail.com', '0-mail.com', 'link2mail.com', 'dodgeit.com', 'dontreg.com', 'e4ward.com', 'gishpuppy', 'guerrillamail.com', 'haltospam.com', 'kasmail.com', 'mailexpire.com', 'maileater.com', 'mailinator.com', 'mailnull.com', 'mytrashmail', 'nobulk.com', 'nospamfor.us', 'pookmail.com', 'shortmail.net', 'sneakemail.com', 'spam.la', 'spambob.com', 'spambox.us', 'spamday.com', 'spamh0le.com', 'spaml.com', 'tempinbox.com', 'temporaryinbox.com', 'willhackforfood.biz', 'willselfdestruct.com', 'wuzupmail.net', '10minutemail.com', 'klzlk.com', 'courriel.fr.nf');
// Checking email domain
if (in_array(parse_url("http://" . $params['email'], PHP_URL_HOST), $blacklistdomain)) {
$this->getUser()->setFlash("error", $this->getContext()->getI18N()->__("Your e-mail address is invalid."));
$this->redirect("@homepage");
}
// It's good : saving datas
$m = $this->regform->save();
// We're sending confirmation mail if validation is needed
if (sfConfig::get("app_validate")) {
// Launch the mailer
$message = $this->getMailer()->compose();
// Setting subject
$message->setSubject(sfConfig::get('app_name') . " : " . $this->getContext()->getI18N()->__("account validation"));
// The recipient
$message->setTo($m->getEmail());
// Our mail address
$message->setFrom(sfConfig::get('app_mail'));
// Vars inside the mail
$mailContext = array('id' => $m->getId(), 'cle' => $m->getPid(), 'pseudo' => $this->regform->getValue("username"), 'hote' => $r->getHost());
// Get the HTML version
$html = $this->getPartial('global/mail_validation_html', $mailContext);
$message->setBody($html, 'text/html');
// Text version (HTML with strip_tags)
$text = $this->getPartial('global/mail_validation_html', $mailContext);
$message->addPart(strip_tags($text), 'text/plain');
// Sending...
$this->getMailer()->send($message);
// Confirmation and redirect
$this->getUser()->setFlash("notice", $this->getContext()->getI18N()->__("Your account has been created. A confirmation mail has just been sent in order to activate it."));
} else {
$this->getUser()->setFlash("notice", $this->getContext()->getI18N()->__("Your account has been created. You can now proceed to login."));
}
$this->redirect("@homepage");
}
$c = (string) $this->regform->getErrorSchema();
preg_match_all('#(.+) \\[(.+)\\]#U', $c, $m);
$m[1] = array_map('trim', $m[1]);
die(json_encode($m, JSON_FORCE_OBJECT));
}
}
if (!$this->getUser()->isAuthenticated()) {
$this->loginForm = new LoginForm();
}
}
示例5: executeUploadUrl
public function executeUploadUrl(sfWebRequest $request)
{
$this->filename = '';
if ($request->getParameter('picture_url') != null) {
try {
$filename = jrFileUploader::UploadRemote($request->getParameter('picture_url'));
$this->filename = 'http://' . $request->getHost() . '/uploads/' . $filename;
} catch (Exception $e) {
}
}
return $this->renderPartial('upload', array('filename' => $this->filename));
}
示例6: executeList
public function executeList(sfWebRequest $request)
{
$this->jobs = array();
foreach ($this->getRoute()->getObjects() as $job) {
$this->jobs[$this->generateUrl('job_show_user', $job, true)] = $job->asArray($request->getHost());
}
switch ($request->getRequestFormat()) {
case 'yaml':
$this->setLayout(false);
$this->getResponse()->setContentType('text/yaml');
break;
}
}
示例7: executeError404
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeError404(sfWebRequest $request)
{
// URI
$this->uri = $request->getUri();
// URL
$this->url = @current(explode('?', $this->uri));
/*
// main site
$this->mainSite = Doctrine::getTable('Site')->findOneBySlug('cmais');
// editorials
$this->editorials = Doctrine_Query::create()
->select('s.*')
->from('Section s')
->where('s.site_id = ?', $this->mainSite->id)
->andWhere('s.is_active = ?', 1)
->andWhere('s.is_editorial = ?', 1)
->orderBy('s.display_order')
->execute();
// channels
$this->channels = array();
$this->live = array();
$this->coming = array();
$this->important = array();
$cs = Doctrine_Query::create()
->select('c.*')
->from('Channel c')
->where('c.is_active = ?', 1)
->orderBy('c.title')
->execute();
foreach($cs as $c){
$this->channels[$c->slug] = $c;
$this->live[$c->slug] = $c->retriveLiveProgram();
$this->important[$c->slug] = $c->retriveImportantPrograms(1);
$this->coming[$c->slug] = $c->retriveLivePrograms(3,$this->live[$c->slug][0]->getId());
}
*/
if ($request->getHost() == "culturafm.cmais.com.br") {
$this->getResponse()->setTitle('cmais+ O portal de conteúdo da Cultura - Página não encontrada!', false);
$this->setTemplate('sites/culturafm/error404', 'default');
} else {
$this->getResponse()->setTitle('cmais+ O portal de conteúdo da Cultura - Puxa, puxa que puxa! Não conseguimos encontrar a página...', false);
}
}
示例8: executeIndex
public function executeIndex(sfWebRequest $request)
{
$this->curUser = $this->getUser()->getGuardUser();
if ($this->curUser) {
Cookie::setCookie($this->curUser, "index", Post::getNewLine('count'), time() + 24 * 60 * 60);
Cookie::setCookie($this->curUser, "indexTime", date("Y-m-d H:i:s"), time() + 24 * 60 * 60);
return;
}
$this->form = $this->applyForm();
if (!$request->isMethod('post')) {
return;
}
sfApplicationConfiguration::getActive()->loadHelpers(array('Guid'));
$this->form->bind($request->getParameter('sfApplyApply'));
if ($this->form->isValid()) {
$this->form->setValidate("n" . createGuid());
$this->form->save();
$this->getUser()->signin($this->form->getObject()->getUser(), true);
$post = new Post();
$post->setText($this->getRequestParameter('text'));
$post->setMoodName($this->getRequestParameter('mood'));
$post->setUser($this->form->getObject()->getUser());
$post->save();
try {
$mailer = $this->getMailer();
$profile = $this->form->getObject();
$mailContext = array('name' => $profile->getFullname(), 'validate' => $profile->getValidate(), 'partnerId' => $this->partnerId);
$message = Swift_Message::newInstance();
$from = sfConfig::get('app_sfApplyPlugin_from');
$message->setFrom($from['email'], $from['fullname']);
$message->setTo($profile->getEmail(), $profile->getUser()->getUsername());
$message->setSubject(sfConfig::get('app_sfApplyPlugin_apply_subject', "Активация аккаунта на сайте " . $request->getHost()));
$message->setBody($this->getPartial('global/sendValidateNew', $mailContext), 'text/html');
$message->addPart($this->getPartial('global/sendValidateNewText', $mailContext), 'text/plain');
$mailer->send($message);
} catch (Exception $e) {
}
return 'After';
}
}
示例9: executeParse
/**
* Executes parse action
*
* @param sfRequest $request A request object
*/
public function executeParse(sfWebRequest $request)
{
//subdomain
$subdomain = @current(explode(".", $request->getHost()));
$param1 = FALSE;
$param2 = FALSE;
$param3 = FALSE;
$param4 = FALSE;
$param5 = FALSE;
$param6 = FALSE;
if (in_array($subdomain, array('tvcultura', 'tvratimbum', 'culturabrasil', 'culturafm', 'univesptv', 'multicultura', 'cmais', 'nucleodevideosp', 'm', 'radarcultura', 'fpa'))) {
$param1 = $subdomain;
if ($request->getParameter('param1')) {
$param2 = $request->getParameter('param1');
}
if ($request->getParameter('param2')) {
$param3 = $request->getParameter('param2');
}
if ($request->getParameter('param3')) {
$param4 = $request->getParameter('param3');
}
if ($request->getParameter('param4')) {
$param5 = $request->getParameter('param4');
}
if ($request->getParameter('param5')) {
$param6 = $request->getParameter('param5');
}
} else {
if ($request->getParameter('param1')) {
$param1 = $request->getParameter('param1');
}
if ($request->getParameter('param2')) {
$param2 = $request->getParameter('param2');
}
if ($request->getParameter('param3')) {
$param3 = $request->getParameter('param3');
}
if ($request->getParameter('param4')) {
$param4 = $request->getParameter('param4');
}
if ($request->getParameter('param5')) {
$param5 = $request->getParameter('param5');
}
}
if (!$param1) {
$this->forward('main', 'index');
} elseif ($param1 == "tudo" || $param2 == "tudo" || $param1 == "busca" || $param2 == "busca" && $param1 != "culturabrasil" && $param1 != "vilasesamo") {
$this->forward('main', 'search');
} elseif ($param1 == "criancasdobrasil" || $param1 == "criancas-do-brasil") {
header("Location: http://tvcultura.com.br/criancasdobrasil");
die;
} elseif (($param1 == "cartao" || $param2 == "cartao") && ($subdomain == "cmais" || $subdomain == "tvcultura")) {
header("Location: http://tvcultura.cmais.com.br/cartaoverde");
die;
} elseif ($param1 == "quintal" || $param1 == "quintal-da-cultura") {
header("Location: http://cmais.com.br/quintaldacultura");
die;
} elseif ($param1 == "cmais" && $param2 == "segundatela" && $param3 == "jornaldacultura" && $param4 != "") {
$date = date("d-m-Y");
if ($param4 == $date) {
//$section = $this->site = Doctrine::getTable('Section')->findOneBySiteIdAndSlug(1188, "online");
$section = $this->site = Doctrine::getTable('Section')->findOneById(2331);
} else {
//$section = $this->site = Doctrine::getTable('Section')->findOneBySiteIdAndSlug(1188, "offline");
$section = $this->site = Doctrine::getTable('Section')->findOneById(2330);
}
$this->getRequest()->setParameter('object', $section);
$this->forward('_section', 'index');
die;
} elseif ($param1 == "cmais" && $param2 == "segundatela" && $param3 == "rodaviva" && $param4 != "") {
$date = date("d-m-Y");
if ($param4 == $date) {
//$section = $this->site = Doctrine::getTable('Section')->findOneBySiteIdAndSlug(1188, "online");
$section = $this->site = Doctrine::getTable('Section')->findOneById(2371);
} else {
//$section = $this->site = Doctrine::getTable('Section')->findOneBySiteIdAndSlug(1188, "offline");
$section = $this->site = Doctrine::getTable('Section')->findOneById(2373);
}
$this->getRequest()->setParameter('object', $section);
$this->forward('_section', 'index');
die;
} elseif ($param1 == "cmais" && $param2 == "segundatela" && $param3 == "cartaoverde" && $param4 != "") {
$date = date("d-m-Y");
if ($param4 == $date) {
//$section = $this->site = Doctrine::getTable('Section')->findOneBySiteIdAndSlug(1188, "online");
$section = $this->site = Doctrine::getTable('Section')->findOneById(2374);
} else {
//$section = $this->site = Doctrine::getTable('Section')->findOneBySiteIdAndSlug(1188, "offline");
$section = $this->site = Doctrine::getTable('Section')->findOneById(2375);
}
$this->getRequest()->setParameter('object', $section);
$this->forward('_section', 'index');
die;
} elseif ($param1 == "culturabrasil") {
if ($param2 == "especiais") {
//.........这里部分代码省略.........
示例10: executeWidgetOuter
public function executeWidgetOuter(sfWebRequest $request)
{
$this->fetchWidget();
$petition = $this->widget['Petition'];
/* @var $petition Petition */
$petition_text = $this->widget['PetitionText'];
/* @var $petition_text PetitionText */
$this->count = $petition->getCount(60);
$this->target = $this->count . '-' . Petition::calcTarget($this->count, $this->widget->getPetition()->getTargetNum());
$image_prefix = ($request->isSecure() ? 'https://' : 'http://') . $request->getHost() . '/' . $request->getRelativeUrlRoot() . 'images/';
$this->kind = $this->widget->getPetition()->getKind();
$this->lang = $this->widget->getPetitionText()->getLanguageId();
$this->getUser()->setCulture($this->lang);
$this->label_mode = $this->widget->getPetition()->getLabelMode();
$stylings = json_decode($this->widget->getStylings(), true);
if (!is_array($stylings)) {
$stylings = array();
}
$widget_colors = $petition->getWidgetIndividualiseDesign();
foreach (array('title_color', 'body_color', 'button_color', 'bg_left_color', 'bg_right_color', 'form_title_color') as $style) {
if (!$widget_colors || !isset($stylings[$style]) || !$stylings[$style]) {
$stylings[$style] = $petition['style_' . $style];
}
}
$this->stylings = $stylings;
$this->keyvisual = $this->widget->getPetition()->getKeyVisual() ? $image_prefix . 'keyvisual/' . $this->widget->getPetition()->getKeyVisual() : null;
$this->sprite = $image_prefix . 'policat.spr.png';
$this->url = $this->getContext()->getRouting()->generate('sign', array('id' => $this->widget['id'], 'hash' => $this->widget->getLastHash(true)), true);
$this->getResponse()->setContentType('text/javascript');
$this->setLayout(false);
$title = $this->widget->getTitle();
if (!$petition->getWidgetIndividualiseText()) {
$title = $petition_text->getTitle();
}
$this->title = Util::enc($title);
}
示例11: executeVncviewer
public function executeVncviewer(sfWebRequest $request)
{
if ($request->getParameter('sleep')) {
$tsleep = $request->getParameter('sleep');
sleep($tsleep);
}
$etva_server = EtvaServerPeer::retrieveByPk($request->getParameter('id'));
if (!$etva_server) {
return sfView::NONE;
}
$etva_node = $etva_server->getEtvaNode();
$user = $this->getUser();
$tokens = $user->getGuardUser()->getEtvaVncTokens();
$this->username = $tokens[0]->getUsername();
$this->token = $tokens[0]->getToken();
$proxyhost1 = $request->getHost();
$proxyhost1_arr = split(':', $proxyhost1);
$proxyhost1 = $proxyhost1_arr[0];
$proxyport1 = $request->isSecure() ? 443 : 80;
//$proxyport1 = 80;
if ($proxyhost1_arr[1]) {
$proxyport1 = $proxyhost1_arr[1];
}
$this->proxyhost1 = $proxyhost1;
$this->proxyport1 = $proxyport1;
$this->socketFactory = $request->isSecure() ? 'AuthHTTPSConnectSSLSocketFactory' : 'AuthHTTPConnectSocketFactory';
$this->host = $etva_node->getIp();
//if host is localhost address then is the same machine
if ($this->host == '127.0.0.1') {
$this->host = $proxyhost1;
}
$this->port = $etva_server->getVncPort();
$response = $this->getResponse();
$response->setTitle($etva_server->getName() . ' :: Console');
}
示例12: executeUpdate
//.........这里部分代码省略.........
$this->person->setTitle($this->person_form->getValue('title'));
$this->person->setFirstName($this->person_form->getValue('first_name'));
$this->person->setLastName($this->person_form->getValue('last_name'));
$this->person->setAddress1($this->person_form->getValue('address1'));
$this->person->setAddress2($this->person_form->getValue('address2'));
$this->person->setCity($this->person_form->getValue('city'));
$this->person->setCounty($this->person_form->getValue('county'));
$this->person->setState($this->person_form->getValue('state'));
$this->person->setCountry($this->person_form->getValue('country'));
$this->person->setZipcode($this->person_form->getValue('zipcode'));
$this->person->setDayPhone($this->person_form->getValue('day_phone'));
$this->person->setDayComment($this->person_form->getValue('day_comment'));
$this->person->setEveningPhone($this->person_form->getValue('evening_phone'));
$this->person->setEveningComment($this->person_form->getValue('evening_comment'));
$this->person->setMobilePhone($this->person_form->getValue('mobile_phone'));
$this->person->setMobileComment($this->person_form->getValue('mobile_comment'));
$this->person->setPagerPhone($this->person_form->getValue('paper_phone'));
$this->person->setPagerComment($this->person_form->getValue('paper_comment'));
$this->person->setOtherPhone($this->person_form->getValue('other_phone'));
$this->person->setOtherComment($this->person_form->getValue('other_comment'));
$this->person->setFaxPhone1($this->person_form->getValue('fax_phone1'));
$this->person->setFaxComment1($this->person_form->getValue('fax_comment1'));
$this->person->setAutoFax($this->person_form->getValue('auto_fax'));
$this->person->setFaxPhone2($this->person_form->getValue('fax_phone2'));
$this->person->setFaxComment2($this->person_form->getValue('fax_comment2'));
$this->person->setEmail($this->person_form->getValue('email'));
$this->person->setEmailTextOnly($this->person_form->getValue('email_text_only'));
$this->person->setEmailBlocked($this->person_form->getValue('email_blocked'));
$this->person->setComment($this->person_form->getValue('comment'));
//$this->person->setBlockMailings($this->person_form->getValue('block_mailings')==0?null:$this->person_form->getValue('block_mailings'));
$this->person->setBlockMailings($this->person_form->getValue('block_mailings'));
$this->person->setNewsletter($this->person_form->getValue('newsletter'));
$this->person->setGender($this->person_form->getValue('gender'));
$this->person->setDeceased($this->person_form->getValue('deceased'));
$this->person->setDeceasedComment($this->person_form->getValue('deceased_comment'));
$this->person->setSecondaryEmail($this->person_form->getValue('secondary_email'));
$this->person->setDeceasedDate($this->person_form->getValue('deceased_date'));
$this->person->setMiddleName($this->person_form->getValue('middle_name'));
$this->person->setSuffix($this->person_form->getValue('suffix'));
$this->person->setNickname($this->person_form->getValue('nickname'));
$this->person->setVeteran($this->person_form->getValue('veteran'));
if ($this->person->isNew()) {
$content = $this->getUser()->getName() . ' added new Person: ' . $this->person->getFirstName();
ActivityPeer::log($content);
}
$this->person->save();
if ($this->person->getId()) {
$c = new Criteria();
$c->add(RoleNotificationPeer::MID, 5);
$c->add(RoleNotificationPeer::NOTIFICATION, 1);
$c->addOr(RoleNotificationPeer::NOTIFICATION, 3);
$c->addJoin(RoleNotificationPeer::ROLE_ID, PersonRolePeer::ROLE_ID);
$c->addJoin(PersonRolePeer::PERSON_ID, PersonPeer::ID);
$personemail = PersonPeer::doSelect($c);
$allemail = array();
$pindex = 0;
foreach ($personemail as $getEmail) {
if (strlen($getEmail->getEmail()) > 0) {
$allemail[$pindex++] = $getEmail->getEmail();
} else {
if (strlen($getEmail->getSecondaryEmail()) > 0) {
$allemail[$pindex++] = $getEmail->getSecondaryEmail();
}
}
}
//$allemail[$pindex]="engfaruque@gmail.com";
$email['subject'] = "New Person added";
$link = $request->getHost() . "/person/view/" . $this->person->getId();
$body = "A new person added in " . $request->getHost() . "\r\n" . $this->person->getFirstName() . " " . $this->person->getLastName() . "\r\n Profile Link: " . $link;
$email['body'] = $body;
$email['sender_email'] = "admin@afw.com";
$this->getComponent('mail', 'sendBulk', array('subject' => $email['subject'], 'recievers' => $allemail, 'sender' => $email['sender_email'], 'body' => $email['body']));
}
if ($request->hasParameter('has')) {
$data = '';
if ($request->getParameter('camp_id')) {
$data = '&camp_id=' . $request->getParameter('camp_id');
}
$this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add passenger!');
$this->redirect('@passenger_create?add_pass=' . $request->getParameter('has') . '&p_id=' . $this->person->getId() . $data);
}
if ($request->hasParameter('iti')) {
$this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add passenger!');
$this->redirect('@passenger_create?add_pass_iti=' . $request->getParameter('iti') . '&p_id=' . $this->person->getId());
}
if ($request->hasParameter('contact')) {
$this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add contact!');
$this->redirect('@contact_create?person_id=' . $this->person->getId());
}
$this->getUser()->setFlash('success', 'Person information has been successfully saved!');
$last = $request->getParameter('back');
$referer_session = $this->getUser()->getAttribute('ref');
$back_url = '@person_view?id=' . $this->person->getId();
$this->redirect($back_url);
}
} else {
# Set referer URL
$this->person_referer = $request->getReferer() ? $request->getReferer() : '@person';
}
}
示例13: executeUpdate
//.........这里部分代码省略.........
$this->person->setState($this->form->getValue('state'));
$this->person->setCountry($this->form->getValue('country'));
$this->person->setZipcode($this->form->getValue('zipcode'));
$this->person->setDayPhone($this->form->getValue('day_phone'));
$this->person->setDayComment($this->form->getValue('day_comment'));
$this->person->setEveningPhone($this->form->getValue('evening_phone'));
$this->person->setEveningComment($this->form->getValue('evening_comment'));
$this->person->setMobilePhone($this->form->getValue('mobile_phone'));
$this->person->setMobileComment($this->form->getValue('mobile_comment'));
$this->person->setPagerPhone($this->form->getValue('paper_phone'));
$this->person->setPagerComment($this->form->getValue('paper_comment'));
$this->person->setOtherPhone($this->form->getValue('other_phone'));
$this->person->setOtherComment($this->form->getValue('other_comment'));
$this->person->setFaxPhone1($this->form->getValue('fax_phone1'));
$this->person->setFaxComment1($this->form->getValue('fax_comment1'));
$this->person->setAutoFax($this->form->getValue('auto_fax'));
$this->person->setFaxPhone2($this->form->getValue('fax_phone2'));
$this->person->setFaxComment2($this->form->getValue('fax_comment2'));
$this->person->setEmail($this->form->getValue('email'));
$this->person->setEmailTextOnly($this->form->getValue('email_text_only'));
$this->person->setEmailBlocked($this->form->getValue('email_blocked'));
$this->person->setComment($this->form->getValue('comment'));
// $this->person->setBlockMailings($this->form->getValue('block_mailings')==0?null:$this->form->getValue('block_mailings'));
$this->person->setBlockMailings($this->form->getValue('block_mailings'));
$this->person->setNewsletter($this->form->getValue('newsletter'));
$this->person->setGender($this->form->getValue('gender'));
$this->person->setDeceased($this->form->getValue('deceased'));
$this->person->setDeceasedComment($this->form->getValue('deceased_comment'));
$this->person->setSecondaryEmail($this->form->getValue('secondary_email'));
$this->person->setDeceasedDate($this->form->getValue('deceased_date'));
$this->person->setMiddleName($this->form->getValue('middle_name'));
$this->person->setSuffix($this->form->getValue('suffix'));
$this->person->setNickname($this->form->getValue('nickname'));
$this->person->setVeteran($this->form->getValue('veteran'));
if ($this->person->isNew()) {
$content = $this->getUser()->getName() . ' added new Person: ' . $this->person->getFirstName();
ActivityPeer::log($content);
}
$this->person->save();
//////////////////////////////////////#bglobal omar
if ($this->person->getId()) {
$c = new Criteria();
$c->add(RoleNotificationPeer::MID, 5);
$c->add(RoleNotificationPeer::NOTIFICATION, 1);
$c->addOr(RoleNotificationPeer::NOTIFICATION, 3);
$c->addJoin(RoleNotificationPeer::ROLE_ID, PersonRolePeer::ROLE_ID);
$c->addJoin(PersonRolePeer::PERSON_ID, PersonPeer::ID);
$personemail = PersonPeer::doSelect($c);
$allemail = array();
$pindex = 0;
foreach ($personemail as $getEmail) {
if (strlen($getEmail->getEmail()) > 0) {
$allemail[$pindex++] = $getEmail->getEmail();
} else {
if (strlen($getEmail->getSecondaryEmail()) > 0) {
$allemail[$pindex++] = $getEmail->getSecondaryEmail();
}
}
}
$allemail[$pindex] = "farazi@bglobalsourcing.com";
/*
echo "<pre>";
print_r($allemail);
echo "</pre>";
*/
$email['subject'] = "New Person added";
$link = $request->getHost() . "/person/view/" . $this->person->getId();
$body = "A new person added in " . $request->getHost() . "\r\n" . $this->person->getFirstName() . " " . $this->person->getLastName() . "\r\n Profile Link: " . $link;
$email['body'] = $body;
$email['sender_email'] = "admin@afw.com";
$this->getComponent('mail', 'sendBulk', array('subject' => $email['subject'], 'recievers' => $allemail, 'sender' => $email['sender_email'], 'body' => $email['body']));
}
/////////////////////////////////////
if ($request->hasParameter('has')) {
$data = '';
if ($request->getParameter('camp_id')) {
$data = '&camp_id=' . $request->getParameter('camp_id');
}
$this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add passenger!');
$this->redirect('@passenger_create?add_pass=' . $request->getParameter('has') . '&p_id=' . $this->person->getId() . $data);
}
if ($request->hasParameter('iti')) {
$this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add passenger!');
$this->redirect('@passenger_create?add_pass_iti=' . $request->getParameter('iti') . '&p_id=' . $this->person->getId());
}
if ($request->hasParameter('contact')) {
$this->getUser()->setFlash('success', 'Step 1 : New Person information has been successfully created! Now you can add contact!');
$this->redirect('@contact_create?person_id=' . $this->person->getId());
}
$this->getUser()->setFlash('success', 'Person information has been successfully saved!');
$last = $request->getParameter('back');
$referer_session = $this->getUser()->getAttribute('ref');
$back_url = '@person_view?id=' . $this->person->getId();
$this->redirect($back_url);
}
} else {
# Set referer URL
$this->referer = $request->getReferer() ? $request->getReferer() : '@person';
}
}
示例14: executeIndex
//.........这里部分代码省略.........
}
$this->getResponse()->addMetaProp('og:image', $og_image);
if (!$this->section) {
$this->section = Doctrine::getTable('Section')->findOneById(1);
}
$debug = false;
if ($request->getParameter('debug') != "") {
print "<br>Related>>" . count($this->relatedAssets);
print "<br>SiteType>>" . $this->site->getType();
print "<br>Asset>>>" . $this->asset->id;
print "<br>AssetType>>>" . $this->asset->AssetType->getTitle();
print "<br>1>>>" . $this->section->id;
print "<br>2>>" . $this->section->slug;
print "<br>Site Type>>" . $this->site->type;
$debug = true;
}
$this->ipad = false;
if (strstr($_SERVER['HTTP_USER_AGENT'], 'iPad')) {
$this->ipad = true;
}
if ($this->site->getSlug() == 'radarcultura' && $this->asset->getSlug() == 'player') {
$this->setLayout(false);
}
/*
if($this->site->getSlug() == "maiscrianca")
$this->setLayout(false);
*/
if ($this->site->getSlug() == "castelo" && $this->asset->getSlug() != "equipe-castelo" && !isset($_REQUEST['layout'])) {
$this->setLayout(false);
}
if ($this->site->getSlug() == "culturabrasil" || $this->site->Program->Channel->getSlug() == "culturabrasil" || $this->site->getSlug() == "especiais-1") {
$this->setLayout('culturabrasil');
}
if ($request->getHost() == "m.cmais.com.br") {
if (is_file(sfConfig::get('sf_app_template_dir') . DIRECTORY_SEPARATOR . 'sites/m/' . $this->asset->AssetType->getSlug() . 'Success.php')) {
$this->setLayout(false);
if ($debug) {
print "<br>2>>" . sfConfig::get('sf_app_template_dir') . DIRECTORY_SEPARATOR . 'sites/m/' . $this->asset->AssetType->getSlug();
}
$this->setTemplate(sfConfig::get('sf_app_template_dir') . DIRECTORY_SEPARATOR . 'sites/m/' . $this->asset->AssetType->getSlug());
}
} elseif ($this->asset->getSlug() == "seumulticultura") {
if ($debug) {
print "<br>multicultura-1 >>" . sfConfig::get('sf_app_template_dir') . DIRECTORY_SEPARATOR . 'sites/' . $this->site->getSlug() . '/seumulticultura';
}
$this->setTemplate(sfConfig::get('sf_app_template_dir') . DIRECTORY_SEPARATOR . 'sites/' . $this->site->getSlug() . '/seumulticultura');
} elseif ($this->site->getSlug() == "cocorico") {
$this->setLayout('cocorico');
if ($this->section->slug == "joguinhos" && $this->asset->getSlug() != "jogo de-pintar") {
if ($debug) {
print "<br>cocorico-1 >>" . sfConfig::get('sf_app_template_dir') . DIRECTORY_SEPARATOR . 'sites/' . $this->site->getSlug() . '/joguinho';
}
$this->setTemplate(sfConfig::get('sf_app_template_dir') . DIRECTORY_SEPARATOR . 'sites/' . $this->site->getSlug() . '/joguinho');
}
if ($this->section->slug == "joguinhos" && $this->asset->getSlug() == "jogo-de-pintar") {
if ($debug) {
print "<br>cocorico-1 >>" . sfConfig::get('sf_app_template_dir') . DIRECTORY_SEPARATOR . 'sites/' . $this->site->getSlug() . '/jogo-de-pintar';
}
$this->setTemplate(sfConfig::get('sf_app_template_dir') . DIRECTORY_SEPARATOR . 'sites/' . $this->site->getSlug() . '/jogo-de-pintar');
}
if ($this->section->slug == "receitinhas") {
if ($debug) {
print "<br>cocorico-receitinhas >>" . sfConfig::get('sf_app_template_dir') . DIRECTORY_SEPARATOR . 'sites/' . $this->site->getSlug() . '/receitinha';
}
$this->setTemplate(sfConfig::get('sf_app_template_dir') . DIRECTORY_SEPARATOR . 'sites/' . $this->site->getSlug() . '/receitinha');
} elseif ($this->section->slug == "tour-virtual") {
示例15: executeInstrumentNotication
public function executeInstrumentNotication(sfWebRequest $request)
{
$c = new Criteria();
$c->add(PersonRolePeer::PERSON_ID, $this->getUser()->getId());
$c->addJoin(PersonRolePeer::ROLE_ID, RoleNotificationPeer::ROLE_ID);
$personNotification = RoleNotificationPeer::doSelect($c);
$this->mid = 0;
foreach ($personNotification as $key => $value) {
$this->mid = $value->getMid();
$this->notification = $value->getNotification();
//5. person add
if ($this->mid == 5 && ($this->notification == 2 || $this->notification == 3)) {
$c = new Criteria();
$c->addDescendingOrderByColumn(PersonPeer::ID);
$c->setLimit(5);
$this->newperson = PersonPeer::doSelect($c);
}
}
$this->host = $request->getHost();
$this->memberId = $this->getUser()->getMemberId();
//$query = "SELECT COUNT(pilot_request.accepted) FROM pilot_request ";
//$query .="WHERE pilot_request.accepted = 1 AND pilot_request.processed = 1 AND pilot_request.member_id = ".$this->memberId;
//$con = Propel::getConnection();
//$stmt = $con->prepare($query);
//$stmt->execute();
/*if($rs = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int)$rs[0];
}else{
$count = 0;
}*/
$c = new Criteria();
$c->add(PilotRequestPeer::ACCEPTED, 1);
$c->add(PilotRequestPeer::PROCESSED, 1);
$c->add(PilotRequestPeer::MEMBER_ID, $this->memberId);
$this->totalAccepted = PilotRequestPeer::doCount($c);
/* $this->memberId = $this->getUser()->getMemberId();
$query = "SELECT COUNT(pilot_request.accepted) FROM pilot_request ";
$query .="WHERE pilot_request.accepted = 0 AND pilot_request.member_id = $this->memberId";
$con = Propel::getConnection();
$stmt = $con->prepare($query);
$stmt->execute();
if($rs = $stmt->fetch(PDO::FETCH_NUM)) {
$count = (int)$rs[0];
}else{
$count = 0;
}*/
$c = new Criteria();
$c->add(PilotRequestPeer::ACCEPTED, 0);
$c->add(PilotRequestPeer::MEMBER_ID, $this->memberId);
$this->totaldeclined = PilotRequestPeer::doCount($c);
$c = new Criteria();
$c->add(MissionLegPeer::PILOT_ID, $this->getUser()->getPilotId());
$c->add(MissionLegPeer::CANCEL_MISSION_LEG, 0);
$this->totalMissionCancellation = MissionLegPeer::doCount($c);
//total signup events count
$pilot_id = $this->getUser()->getPilotId();
if ($pilot_id) {
$pilot = PilotPeer::retrieveByPK($pilot_id);
$member_id = $pilot->getMemberId();
$date = date('Y-m-d');
$c = new Criteria();
$c->add(EventReservationPeer::MEMBER_ID, $member_id, Criteria::EQUAL);
$c->addJoin(EventPeer::ID, EventReservationPeer::EVENT_ID);
$c->add(EventPeer::EVENT_DATE, $date, Criteria::GREATER_EQUAL);
$this->totalSignupEvents = EventReservationPeer::doCount($c);
}
//
}