本文整理汇总了PHP中sfWebRequest::getUrlParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWebRequest::getUrlParameter方法的具体用法?PHP sfWebRequest::getUrlParameter怎么用?PHP sfWebRequest::getUrlParameter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfWebRequest
的用法示例。
在下文中一共展示了sfWebRequest::getUrlParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeDisown
public function executeDisown(sfWebRequest $request)
{
$this->forward404Unless($ei_device = Doctrine_Core::getTable('EiDeviceUser')->find(array($request->getUrlParameter('device_id'))), sprintf('Object device does not exist (%s).', $request->getUrlParameter('device_id')));
$ei_device->delete();
$this->getUser()->setFlash('alert_form', array('title' => 'Success', 'class' => 'alert-success', 'text' => 'Well done ...'));
$this->redirect($this->generateUrl('resourcesDevices'));
}
示例2: executeNewWithAsso
public function executeNewWithAsso(sfWebRequest $request)
{
$table = AssoTable::getInstance();
$this->redirectUnless($this->asso = $table->retrieveAsso($table->getOneByLogin($request->getUrlParameter('login1', ''))), 'avances');
$this->redirectUnless($this->asso1 = $table->retrieveAsso($table->getOneByLogin($request->getUrlParameter('login2', ''))), 'avances_new', $this->asso);
$this->checkAuthorisation($this->asso);
$avance = new AvanceTreso();
$avance->Emetteur = $this->asso;
$avance->Asso = $this->asso1;
$this->form = new AvanceTresoForm($avance);
$this->getResponse()->setSlot('current_asso', $this->asso);
$this->setTemplate('new');
}
示例3: executeDuplicate
public function executeDuplicate(sfWebRequest $request)
{
// get class
$this->forward404Unless(
$this->class_id = $request->getUrlParameter('class_id'));
$this->forward404Unless(
$this->class = Doctrine::getTable('dsClass')->findOneById($this->class_id));
// $this->checkParameters($request);
// $this->save = null;
// $this->class = new dsClass();
// Deal with the request
/*
if ($request->isMethod('post'))
{
$this->create();
}
*/
// GET REQUEST - 1 start process
// NEW FORM
// new person obj.
$class = new dsClass();
/*
- name
- dance
- descri
- teacher lead - follow
- level from - to
- studio
- weekday
- LEER: date from - to
- zeit
- kursbeitrag
*/
$person->firstname = $this->row['firstname'];
$person->lastname = $this->row['lastname'];
$person->email = $this->row['email'];
$person->gender = ($this->role == 'leader') ? 'male' : 'female';
$person->is_student = $this->row['student'];
// create form
$this->form = new classForm($person);
$this->classid = $this->class_id;
}
示例4: executeFormNew
public function executeFormNew(sfWebRequest $request)
{
$this->idSalle = $request->getUrlParameter("id", -1);
$this->userIdentified = false;
if ($this->getUser()->isAuthenticated()) {
$this->userIdentified = true;
$this->UserID = $this->getUser()->getGuardUser()->getId();
// création du tableua à passer au constructeur du formulaire de réservation
$values = array('UserID' => $this->UserID, 'idSalle' => $this->idSalle);
$this->form = new ReservationForm(array(), $values);
// TO DO : Voir si la salle appartient au BDE ou non et en fonction donner possiblité de rentrer une asso ou non.
$PoleId = SalleTable::getInstance()->getSalleById($this->idSalle)->fetchOne()->getIdPole();
if ($PoleId == 1) {
$this->form->getWidget('id_asso')->setOption('add_empty', true);
}
// valeur par défaut pour les champs cachés.
$this->form->setDefault('id_salle', $this->idSalle);
$this->form->setDefault('id_user_reserve', $this->getUser()->getGuardUser()->getId());
$this->form->setDefault('estvalide', 0);
// A VOIR si 2 semaines avant ou pas
$this->ok = false;
$this->afficherErreur = false;
}
}
示例5: getUrlParameter
public function getUrlParameter($name, $default = null, $isStripNullbyte = true)
{
if ($isStripNullbyte) {
return opToolkit::stripNullByteDeep(parent::getUrlParameter($name, $default));
} else {
return parent::getUrlParameter($name, $default);
}
}
示例6: executeReseed
/**
* Demande de reseed
*/
public function executeReseed(sfWebRequest $r)
{
// On récupère le titre et les complétés du torrent
$t = Doctrine_Query::create()->select('t.titre, c.mid, c.reste')->from('Torrent t')->leftJoin('t.TorrentsConnectes c')->where('t.hash = ?', $r->getUrlParameter("hash"))->useQueryCache(true)->setQueryCacheLifeSpan(3600 * 24)->execute(array(), Doctrine::HYDRATE_ARRAY);
if (count($t) === 0) {
$this->forward404();
}
// On crée le MP
$s = new MpSujet();
$s->setMpSujet($this->getContext()->getI18N()->__("Reseed.") . " : " . $t[0]['titre']);
$s->save();
// On crée le contenu du message
$c = new MpMsg();
$c->setMpId($s->getMpId());
$c->setMpAuteur($this->getUser()->getAttribute('id'));
$c->setMpDate(date("Y-m-d H:i:s"));
$c->setMpTxt("Bonjour. Je demande le reseed d'un torrent que vous posséder : " . $t[0]['titre'] . ". Pourriez-vous, s'il vous plaît reprendre le partage ? Merci d'avance. " . $this->getUser()->getAttribute('username'));
$c->save();
// On ajoute les participants ('d'abord, soi-même')
$p = new MpParticipants();
$p->setMpId($s->getMpId());
$p->setMpMid($this->getUser()->getAttribute("id"));
$p->setReaded(1);
$p->setDeleted(0);
$p->save();
// Puis chaque connecté
foreach ($t[0]['TorrentsConnectes'] as $pp) {
// ... qui a fini le fichier
if ($pp['reste'] == 0) {
$p = new MpParticipants();
$p->setMpId($s->getMpId());
$p->setMpMid($pp['mid']);
$p->setReaded(0);
$p->setDeleted(0);
$p->save();
}
}
// On redirige et basta
$this->getUser()->setFlash("notice", $this->getContext()->getI18N()->__("Your reseed request has been sent. Keep an eye on your private messages."));
$this->redirect("messages/index");
}
示例7: executeEdit
/**
* Editer une news
*/
public function executeEdit(sfWebRequest $r)
{
// On récupère la news
$n = Doctrine::getTable("News")->find($r->getUrlParameter("id"));
// On charge le formulaire
$this->form = $form = new NewsForm($n);
$this->id = $r->getUrlParameter("id");
// Si on a posté
if ($r->isMethod('post')) {
$form->bind($r->getParameter($form->getName()));
// Si le formulaire est valide
if ($form->isValid()) {
// On sauvegarde
$form->save();
// Reset cache
if ($cache = $this->getContext()->getViewCacheManager()) {
$cache->remove('news/index');
$cache->remove("@sf_cache_partial?module=news&action=_news&sf_cache_key=*");
}
// On confirme
$this->getUser()->setFlash("notice", $this->getContext()->getI18N()->__("Changes are saved successfully."));
// On redirige
$this->redirect("news/index");
}
}
}
示例8: executeIndex
public function executeIndex(sfWebRequest $request)
{
$dto = new DateTime();
if ($this->year = $request->getUrlParameter('year'))
{
$this->getContext()->getRouting()->setDefaultParameter('year', $this->year);
if ($this->week = $request->getUrlParameter('week'))
{
$this->getContext()->getRouting()->setDefaultParameter('week', $this->week);
} else {
$this->week = 1;
}
} else {
$this->year = date("Y");
$this->week = date("W");
}
$dto->setISODate($this->year, $this->week, 1);
$this->date_start = $dto;
$this->classTable = Doctrine_Core::getTable('dsClass');
$this->dances = Doctrine_Core::getTable('dsDance')->findAll();
}
示例9: executeEdit
public function executeEdit(sfWebRequest $r)
{
$q = Doctrine::getTable("MsgMessages")->find($r->getUrlParameter("mid"));
if ($this->getUser()->hasCredential("adm") || $this->getUser()->hasCredential("mod") || $this->getUser()->getAttribute("id") == $q->getAuthor()) {
$q->setContent($r->getPostParameter("msg"));
$q->save();
return $this->renderText("ok");
} else {
$this->getResponse()->setStatusCode(403);
return $this->renderText("Can't edit");
}
}
示例10: executeShow
public function executeShow(sfWebRequest $request)
{
$id = $request->getUrlParameter("id", -1);
if ($id == -1) {
$this->forward404Unless(false);
}
$this->forward404Unless(ReservationTable::getInstance()->isReservationExist($id));
$this->reservation = ReservationTable::getInstance()->getReservationById($id)->fetchOne();
}
示例11: executeSupprimer
/**
* Supprimer un sondage
*/
public function executeSupprimer(sfWebRequest $r)
{
$s = Doctrine::getTable("SdgQuestions")->find($r->getUrlParameter("id"))->delete();
$this->getUser()->setFlash("notice", $this->getContext()->getI18N()->__("The poll has been deleted."));
$this->redirect("sondages/index");
}
示例12: executeStats
public function executeStats(sfWebRequest $request)
{
$petition = PetitionTable::getInstance()->findById($request->getParameter('id'), $this->userIsAdmin());
/* @var $petition Petition */
if (!$petition) {
return $this->notFound();
}
if (!$petition->isEditableBy($this->getGuardUser())) {
return $this->noAccess();
}
if ($petition->getKind() != Petition::KIND_PLEDGE) {
return $this->noAccess();
}
if ($petition->getMailingListId()) {
$mailing_list = $petition->getMailingList();
$filter_form = new FilterContactForm();
$filter_form->bindSelf('p' . $petition->getId());
$page = $request->getUrlParameter('page');
if ($page < 1) {
$page = 1;
}
$contact_table = ContactTable::getInstance();
$contacts = new policatPager($filter_form->filter($contact_table->queryByTargetList($mailing_list, $petition)), $page, 'pledge_stats_pager', array('id' => $petition->getId()), true, 20);
$active_pledge_item_ids = $petition->getActivePledgeItemIds();
$pledges = PledgeTable::getInstance()->getPledgesForContacts($contacts->getResults(), $active_pledge_item_ids);
$pledge_items = PledgeItemTable::getInstance()->fetchByIds($active_pledge_item_ids);
if ($request->getUrlParameter('page')) {
return $this->ajax()->replaceWithPartial('#contacts', 'contacts', array('contacts' => $contacts, 'petition_id' => $petition->getId(), 'active_pledge_item_ids' => $active_pledge_item_ids, 'pledges' => $pledges, 'pledge_items' => $pledge_items))->tooltip('#contacts .add_tooltip')->render();
}
$this->form = $filter_form;
$this->petition = $petition;
$this->contacts = $contacts;
$this->no_target_list = false;
$this->active_pledge_item_ids = $active_pledge_item_ids;
$this->pledges = $pledges;
$this->pledge_items = $pledge_items;
} else {
$this->no_target_list = true;
}
}
示例13: executeAttendanceToggle
public function executeAttendanceToggle(sfWebRequest $request)
{
// get lesson
$this->forward404Unless(
$this->lesson_id = $request->getUrlParameter('lesson_id'));
$this->forward404Unless(
$this->lesson = Doctrine::getTable('dsLesson')->findOneById($this->lesson_id));
// find attendance record
$this->attendance = Doctrine::getTable('dsLessonStudent')
->findByEnrolmentAndLesson($this->enrolment->id, $this->lesson->id);
// change
$this->attendance->toggleWillAttend();
$this->attendance->save();
// redirect to list
$this->getUser()->setFlash('notice',
sprintf('Die Anwesenheits-Änderung von %s für die Lektion vom %s wurde gespeichert.',
$this->enrolment->getPerson(),
$this->lesson->getDateTimeObject('date')->format('d.m.Y')
));
$this->redirect(
'danceTrack_attendance', array(
'id' => $this->enrolment->getClass()->id,
'dance_slug' => $this->enrolment->getClass()->getDance()->slug
));
#$this->class = $this->enrolment->getClass();
#$this->lessons = $this->class->getLessons();
}
示例14: executeShow
/**
* Showing a shout (eg comments...)
*/
public function executeShow(sfWebRequest $r)
{
$a = array();
// Getting selected shout
$s = Doctrine::getTable("Shoutbox")->find($r->getUrlParameter("id"));
// If not found, 404
$this->forward404Unless($s);
// Loading form
$f = new ShoutboxComsForm();
$f->setDefault('shtid', $s->getId());
// If comment is posted
if ($r->isMethod('post')) {
$f->bind($r->getParameter($f->getName()));
if ($f->isValid()) {
$c = $f->save();
}
}
// If there is a link in the text (user specified, not system)
if (preg_match("#((http|https|ftp)://(\\S*?\\.\\S*?))(\\s|\\;|\\)|\\]|\\[|\\{|\\}|,|\"|'|:|\\<|\$|\\.\\s)#ie", $s->getDescription(), $match)) {
$a['frame'] = $this->getTab("Link", "world.png", '<div style="text-align: center;margin-bottom: 5px">
<a href="' . $match[0] . '" class="btn btn-primary" target="_blank">
<i class="icon-white icon-share"></i>
' . sfContext::getInstance()->getI18n()->__('Open in a new tab') . '
</a>
</div>
<iframe style="width: 100%;height: 700px;border: none" src="' . $match[0] . '"></iframe>');
}
// Comments
$this->coms = Doctrine::getTable("MsgMessages")->getComments("sht", $s->getId());
$a['coms'] = $this->getTab("Comments", "comments.png", $this->coms->toArray());
$a["new"] = $this->getTab("Add comment", "comment_add.png", $this->getComponent('messages', 'new', array("form" => $f, "submitUrl" => "#")));
if ($s->getAuthor() == $this->getUser()->getAttribute("id") || $this->getUser()->hasCredential("adm") || $this->getUser()->hasCredential("mod")) {
$a['delete'] = $this->getTab('Delete shout', 'delete.png', $this->getPartial($this->getModuleName() . '/delete', array("shtid" => $s->getId())));
}
return $this->renderText(json_encode(array("right" => $a)));
}
示例15: executeValidation
/**
* Validation process
*/
public function executeValidation(sfWebRequest $r)
{
// If key is sha1
if (preg_match('#([0-9a-f]{40})#', $r->getUrlParameter("key"))) {
// Fetching data from user account
$k = Doctrine::getTable("Users")->find($r->getUrlParameter("id"));
// If user doesn't exists
$this->forward404Unless($k);
// Already activated
if ($k->getRole() != "val") {
$this->getUser()->setFlash("error", $this->getContext()->getI18N()->__("Hey ! Your account is already activated, you don't remember ?"));
} elseif ($k->getPid() != $r->getUrlParameter("key")) {
$this->getUser()->setFlash("error", $this->getContext()->getI18N()->__("I'm sorry, but your validation key is not correct."));
} else {
// Setting user to member
$u = Doctrine_Query::create()->update("Users")->set("role", '"mbr"')->where("id = ?", $r->getUrlParameter("id"))->execute();
$this->getUser()->setFlash("notice", $this->getContext()->getI18N()->__("Account validated ! Log you in and let the show begin !"));
}
} else {
$this->forward404();
}
// Redirect to homepage
$this->redirect("@homepage");
}