本文整理汇总了PHP中TagPeer::getFromField方法的典型用法代码示例。如果您正苦于以下问题:PHP TagPeer::getFromField方法的具体用法?PHP TagPeer::getFromField怎么用?PHP TagPeer::getFromField使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TagPeer
的用法示例。
在下文中一共展示了TagPeer::getFromField方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeBadge
/**
* 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));
}
}
}
示例2: doClean
protected function doClean($values)
{
$this->already_exists = null;
$jotag = $values[$this->getOption('jotag')];
$user = sfContext::getInstance()->getUser()->getSubscriber();
$tag = TagPeer::getFromField(TagPeer::JOTAG,$jotag);
if($tag && (!$user || ($tag->getUserId() != $user->getId())))
{
$this->already_exists = $tag;
$error = new sfValidatorError($this,'exist',array(
$this->getOption('jotag')=>$jotag
));
throw new sfValidatorErrorSchema($this,array($this->getOption('jotag')=>$error));
}
elseif($tag) $values["jotag_object"] = $tag; // renewing jotag
else $values["jotag_object"] = null;
return $values;
}
示例3: executeAddInterest
public function executeAddInterest($request)
{
$user = $this->getUser()->getSubscriber();
$jotag = TagPeer::getFromField(TagPeer::JOTAG, $request->getParameter('jotag'));
$this->forward404Unless($jotag && $jotag->getUser()->getId() != $this->getUser()->getSubscriberId() && !$user->hasInterest($jotag) && !$jotag->getIsPrimary());
$this->jotag = $jotag;
$this->form = new AddInterestForm(array('jotag' => $jotag->getJotag()));
if ($request->isMethod('post')) {
$this->form->bind(array('confirm_jotag' => $request->getParameter('confirm_jotag'), 'jotag' => $request->getParameter('jotag')));
if ($this->form->isValid()) {
$user->addJotagInterest($jotag);
// notify owner
Mailer::sendEmail($jotag->getUser()->getPrimaryEmail(), 'interestNotifyOwner', array('user' => $user, 'jotag' => $jotag), $jotag->getUser()->getPreferedLanguage());
$this->setMessage('ADD_INTEREST', 'SUCCESS', $jotag->getJotag());
if (!$this->isWebserviceCall()) {
$this->redirect('@account');
}
}
}
}
示例4: executeBackOption
public function executeBackOption($request)
{
$jotag = TagPeer::getFromField(TagPeer::JOTAG, $request->getParameter('jotag'));
$this->jotag = $jotag;
$this->getUser()->getAttributeHolder()->remove('nextOption');
}