Exemplo n.º 1
0
 /**
  * Handles badge action
  *
  * @param sfWebRequest $request Web request object
  */
 public function executeBadge($request)
 {
     $this->jotag = TagPeer::getFromField(TagPeer::JOTAG, $request->getParameter('jotag'));
     $this->forward404Unless($this->jotag && $this->jotag->getStatus() == TagPeer::ST_ACTIVE);
     // get badge
     $this->badge = $this->jotag->getBadge();
     // is authorized
     $this->authorized = TagPrivacyPeer::allowedToView($this->getUser(), $this->jotag);
     // reload
     $this->reload = $request->getParameter('reload') ? true : false;
     // build list of contact info
     $this->contacts = array();
     $jotag =& $this->jotag;
     if ($jotag->getTagEmailsJoinEmail(EmailPeer::buildConfirmedCriteria())) {
         foreach ($jotag->getTagEmailsJoinEmail(EmailPeer::buildConfirmedCriteria()) as $k => $email) {
             $this->contacts["EMAIL"][] = $email->getEmail()->getEmail($this->authorized);
         }
     }
     if ($jotag->getTagPhonesJoinPhone()) {
         foreach ($jotag->getTagPhonesJoinPhone() as $k => $phone) {
             $this->contacts["PHONE"][] = array("number" => $phone->getPhone()->getNumber($this->authorized), "exten" => $phone->getPhone()->getExten($this->authorized));
         }
     }
     if ($jotag->getTagUrlsJoinUrl()) {
         foreach ($jotag->getTagUrlsJoinUrl() as $k => $url) {
             $this->contacts["URL"][] = $url->getUrl()->getUrl($this->authorized);
         }
     }
     if ($jotag->getTagSNsJoinSN()) {
         foreach ($jotag->getTagSNsJoinSN() as $k => $sn) {
             $this->contacts["SN"][] = array("network" => $sn->getSN()->getNetwork(), "identifier" => $sn->getSN()->getIdentifier($this->authorized));
         }
     }
     if ($jotag->getTagIMsJoinIM()) {
         foreach ($jotag->getTagIMsJoinIM() as $k => $im) {
             $this->contacts["IM"][] = array("network" => $im->getIM()->getNetwork(), "identifier" => $im->getIM()->getIdentifier($this->authorized));
         }
     }
     if ($jotag->getTagCustomsJoinCustom()) {
         foreach ($jotag->getTagCustomsJoinCustom() as $k => $custom) {
             $this->contacts["CUSTOM"][] = array("netname" => $custom->getCustom()->getNetName(), "netid" => $custom->getCustom()->getNetId($this->authorized));
         }
     }
 }
Exemplo n.º 2
0
 public function executeAddQuickContact($request)
 {
     $user = $this->getUser()->getSubscriber();
     $jotag = TagPeer::getFromField(TagPeer::JOTAG, $request->getParameter('jotag'));
     $this->jotag = $jotag;
     $this->forward404Unless(($this->isWebserviceCall() || $request->isXmlHttpRequest()) && $jotag);
     // check privacy
     $this->form = new PrivacyCheckForm($this->jotag);
     $this->forward404Unless(TagPrivacyPeer::allowedToView($this->getUser(), $this->jotag, $this->form));
     $user->addQuickContact($jotag);
     return $this->renderPartial('jotag/toolbar', array('jotag' => $jotag));
 }
Exemplo n.º 3
0
 /**
  * Handles vcard action
  *
  * @param sfWebRequest $request Web request object
  */
 public function executeVcard($request)
 {
     $jotag = TagPeer::getFromField(TagPeer::JOTAG, $request->getParameter('jotag'));
     $this->jotag = $jotag;
     $this->forward404Unless($jotag && $jotag->getStatus() == TagPeer::ST_ACTIVE && $jotag->haveContacts());
     // check privacy
     $this->form = new PrivacyCheckForm($this->jotag);
     $this->forward404Unless(TagPrivacyPeer::allowedToView($this->getUser(), $this->jotag, $this->form));
     // get vcard (convert to ISO-8859-1)
     $this->vcard = $jotag->getVCard()->fetch();
     // Set the headers for downloading vcard
     $this->getResponse()->setHttpHeader('Content-Disposition', 'attachment; filename="' . $jotag->getTagProfile()->__toString() . '.vcf"');
     $this->getResponse()->setHttpHeader('Content-length', strlen($this->vcard));
 }