本文整理汇总了PHP中sfWebRequest::getGetParameter方法的典型用法代码示例。如果您正苦于以下问题:PHP sfWebRequest::getGetParameter方法的具体用法?PHP sfWebRequest::getGetParameter怎么用?PHP sfWebRequest::getGetParameter使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sfWebRequest
的用法示例。
在下文中一共展示了sfWebRequest::getGetParameter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: executeQuery
public function executeQuery(sfWebRequest $request)
{
if ($request->isXmlHttpRequest()) {
if ($request->isMethod(sfRequest::GET)) {
$startDate = $request->getGetParameter('startDate');
$endDate = $request->getGetParameter('endDate');
$page = $request->getGetParameter('page');
$start = $request->getGetParameter('start');
$limit = $request->getGetParameter('limit');
$this->convertParamToDateTime($startDate);
$this->convertParamToDateTime($endDate);
$result = Doctrine_Core::getTable('Appointment')->getBetween($startDate, $endDate);
$response = $this->buildResponse($result, "Loading Record");
} else {
if ($request->isMethod(sfRequest::POST)) {
$form_data = json_decode(file_get_contents('php://input'));
$location = $form_data->loc;
$title = $form_data->title;
$notes = $form_data->notes;
$url = $form_data->url;
$reminder = $form_data->rem;
$cid = $form_data->cid;
$startDate = str_replace('T', ' ', $form_data->start);
$endDate = str_replace('T', ' ', $form_data->end);
$this->convertParamToDateTime($startDate, 'Y-m-d H:i:s');
$this->convertParamToDateTime($endDate, 'Y-m-d H:i:s');
$a = new Appointment();
$a->fromArray(array('coach_id' => 1, 'client_id' => 1, 'calendar_type_id' => $cid, 'scheduled' => $startDate, 'started_at' => $startDate, 'finished_at' => $endDate, 'title' => $title, 'location' => $location, 'notes' => $notes, 'web_link' => $url, 'reminder' => $reminder));
$a->save();
$response = $this->buildResponse($a, "Creating Record");
} else {
if ($request->isMethod(sfRequest::PUT)) {
$form_data = json_decode(file_get_contents('php://input'));
$location = $form_data->loc;
$title = $form_data->title;
$notes = $form_data->notes;
$url = $form_data->url;
$reminder = $form_data->rem;
$cid = $form_data->cid;
$startDate = str_replace('T', ' ', $form_data->start);
$endDate = str_replace('T', ' ', $form_data->end);
$this->convertParamToDateTime($startDate, 'Y-m-d H:i:s');
$this->convertParamToDateTime($endDate, 'Y-m-d H:i:s');
$a = Doctrine_Core::getTable('Appointment')->find(array($request->getParameter('id')));
$a->fromArray(array('coach_id' => 1, 'client_id' => 1, 'calendar_type_id' => $cid, 'scheduled' => $startDate, 'started_at' => $startDate, 'finished_at' => $endDate, 'title' => $title, 'location' => $location, 'notes' => $notes, 'web_link' => $url, 'reminder' => $reminder));
$a->save();
$response = $this->buildResponse($a, "Updating Record");
} else {
if ($request->isMethod(sfRequest::DELETE)) {
$app = Doctrine_Core::getTable('Appointment')->find(array($request->getParameter('id')));
$app->delete();
$response = array('success' => true, 'message' => 'Destroyed Record', 'data' => array());
}
}
}
}
sfConfig::set('sf_web_debug', false);
return $this->renderPartial('global/ajax', array('ajax' => json_encode($response)));
}
}
示例2: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
$this->class = $request->getParameter('class');
if (empty($this->class)) {
$this->class = $request->getGetParameter('class');
}
$this->method = $request->getParameter('method');
if (empty($this->method)) {
$this->method = $request->getGetParameter('method');
}
if (!empty($this->method)) {
$this->class = array($this->class, $this->method);
}
$this->viewer = new sfCodeViewer($this->class);
if ($request->isXmlHttpRequest()) {
sfProjectConfiguration::getActive()->loadHelpers('Url');
$this->renderText($this->viewer->render(url_for('sfCodeView')));
return sfView::NONE;
} else {
// maintain history
$this->history = $this->getUser()->getAttribute('history', array());
if (false !== ($index = array_search($this->class, $this->history))) {
unset($this->history[$index]);
}
array_unshift($this->history, $this->class);
array_splice($this->history, 10);
$this->getUser()->setAttribute('history', $this->history);
}
}
示例3: executeIndex
public function executeIndex(sfWebRequest $request)
{
$pageNumber = (int) $request->getGetParameter('page');
$limit = 100;
$offset = $limit * ($pageNumber > 1) ? $pageNumber - 1 : $pageNumber;
$this->reservations = Doctrine_Core::getTable('Reservation')->createQuery('a')->where('deleted=false')->orderBy('a.arrival_date DESC')->limit($limit)->offset($offset)->execute();
}
示例4: executeMatrix
/**
* Executes matrix action
*
* @param sfRequest $request A request object
*/
public function executeMatrix(sfWebRequest $request)
{
$dateFrom = $request->getGetParameter('dateFrom', date('Y-m-01'));
$dateTo = $request->getGetParameter('dateTo', date('Y-m-01'));
$currency = $request->getGetParameter('currency', 1);
$account = $request->getGetParameter('account', null);
$type = $request->getGetParameter('type', null);
$dateFrom = new DateTime(preg_replace("/(\\d{2}).(\\d{2}).(\\d{4})/", "\$3-\$2-\$1", $dateFrom));
$dateTo = new DateTime(preg_replace("/(\\d{2}).(\\d{2}).(\\d{4})/", "\$3-\$2-\$1", $dateTo));
$currency = Doctrine::getTable('Currency')->findOneById($currency);
$user = $this->getUser()->getUserRecord();
$account = $account ? Doctrine::getTable('Account')->findOneById($account) : null;
$report = new myReportMatrix($currency);
$report->buildReport($user, $account, $dateFrom, $dateTo, $type);
$result = array('headerLeft' => $report->getHeaderLeft(), 'headerTop' => $report->getHeaderTop(), 'matrix' => $report->getMatrix());
return $this->renderJson($result);
}
示例5: executeIndex
public function executeIndex(sfWebRequest $request)
{
$this->getUser()->setAttribute('redirect_back', $this->getRequest()->getUri());
$uid = $request->getParameter('uid');
if ($uid == null) {
$this->profile = Doctrine_Core::getTable('profile')->findOneByUsername($this->getUser()->getAttribute('username'));
} else {
$this->profile = Doctrine_Core::getTable('profile')->findOneByUid($uid);
}
$this->show_edit_link = !$request->hasParameter('uid') || $request->getGetParameter('uid') == $this->getUser()->getAttribute('id');
$this->getUser()->setAttribute('viewing_profile_id', $this->profile->uid);
$this->form = new WallpostForm();
}
示例6: executeAjaxSearch
public function executeAjaxSearch(sfWebRequest $request)
{
$query = $request->getGetParameter('query');
$profiles = ProfileTable::findProfilesByNameSimilarTo($query);
$display_string = "<table>";
foreach ($profiles as $profile) {
$display_string .= "<tr>";
$url = $this->generateUrl('profile', array('uid' => $profile['uid']));
$display_string .= "<td><img src = http://rks.ath.cx:8080/nexus+/web/images/" . $profile['pic'] . " width = '30' height = '30'/><a class = 'ajax_search_result' href = {$url}>" . $profile['name'] . "</a></td>";
$display_string .= "</tr>";
}
$display_string .= "</table>";
$this->renderText($display_string);
//sleep(1);
return sfView::NONE;
}
示例7: executeRegister
/**
* Executes register action
*
* @param sfWebRequest $request A request object
*/
public function executeRegister(sfWebRequest $request)
{
if (!StoreTable::getInstance()->getValueCached(StoreTable::REGISTER_ON)) {
return $this->notFound();
}
$user = new sfGuardUser();
$this->form = new RegisterForm($user);
if ($request->getGetParameter('widgetval')) {
$storage = sfContext::getInstance()->getStorage();
if ($storage instanceof policatSessionStorage) {
$storage->needSession();
}
$this->getUser()->setAttribute(myUser::SESSION_WIDGETVAL_ON, 1);
}
if ($request->isMethod('post')) {
if (!$this->getUser()->human()) {
return $this->captchaModal();
}
$this->form->bind($request->getPostParameter($this->form->getName()));
if ($this->form->isValid()) {
$user->setIsActive(false);
$user = $this->form->updateObject();
$user->setUsername($user->getEmailAddress());
$user->setValidationKind(sfGuardUserTable::VALIDATION_KIND_REGISTER_LINK);
$user->randomValidationCode();
$user->save();
$user->addPermissionByName(myUser::CREDENTIAL_USER);
$subject = 'validate register';
$body = "#VALIDATION-URL#";
$store = StoreTable::getInstance()->findByKeyAndLanguageWithFallback(StoreTable::REGISTER_MAIL, $user->getLanguageId());
if ($store) {
$subject = $store->getField('subject');
$body = $store->getField('body');
}
$subst = array('#VALIDATION-URL#' => $this->generateUrl('register_validation', array('id' => $user->getId(), 'code' => $user->getValidationCode()), true), '#USER-NAME#' => $user->getFullName());
UtilMail::send(null, null, $user->getEmailAddress(), $subject, $body, null, $subst);
return $this->ajax()->form($this->form)->attr('#register_form input, #register_form select, #register_form button', 'disabled', 'disabled')->scroll()->alert('Congratulations! You have created a new account. For your first login, you need to check your inbox ' . 'and click the account validation link in the e-mail we have sent to you.', 'Please check your inbox now!', '.page-header', 'after')->render();
} else {
return $this->ajax()->form($this->form)->render();
}
}
$this->includeChosen();
}
示例8: executePetition
public function executePetition(sfWebRequest $request)
{
$petition = PetitionTable::getInstance()->findById($request->getParameter('id'), $this->userIsAdmin());
/* @var $petition Petition */
if (!$petition) {
return $this->notFound();
}
if (!$petition->isGeoKind()) {
return $this->notFound();
}
if (!$petition->isEditableBy($this->getGuardUser())) {
return $this->noAccess();
}
$target_list_id = $petition->getMailingListId();
if ($target_list_id) {
$target_list = $petition->getMailingList();
if ($this->getGuardUser()->isTargetListMember($target_list, true)) {
$this->csrf_token = UtilCSRF::gen('target_activate');
$this->metas = $target_list->getMailingListMeta();
if ($target_list->getCampaignId()) {
$this->campaign = $target_list->getCampaign();
if (!$this->userIsAdmin() && $this->campaign->getStatus() == CampaignTable::STATUS_DELETED) {
return $this->notFound();
}
$this->target_list = $target_list;
$this->form = new MailingListForm($target_list);
}
}
}
$this->petition = $petition;
$this->target_form = new EditPetitionTargetForm($petition, array(EditPetitionTargetForm::USER => $this->getGuardUser()));
$this->open_edit = $request->getGetParameter('e') ? true : false;
$this->setTemplate('edit');
$this->includeIframeTransport();
$this->includeChosen();
}
示例9: executeExportRestApiDownloadCsv
public function executeExportRestApiDownloadCsv(sfWebRequest $request)
{
// Retrieve $_GET
$test_session_id = $request->getGetParameter("id");
$product_type = $request->getGetParameter("product");
$project = $request->getGetParameter("release_version");
$environment = $request->getGetParameter("target");
$testset = $request->getGetParameter("testset");
// Check test session id
if (empty($test_session_id)) {
echo "ERROR : test session id is not valid";
exit;
}
$testSession = Doctrine_Core::getTable('TestSession')->findOneById($test_session_id);
if (empty($testSession)) {
echo "ERROR : test session id doesn't exist";
exit;
}
Import::exportAsCsv($test_session_id);
}
示例10: executeIndex
/**
* Executes index action
*
* @param sfRequest $request A request object
*/
public function executeIndex(sfWebRequest $request)
{
$this->includeChosen();
$this->no_campaign = $request->getGetParameter('no_campaign', 0) ? true : false;
}
示例11: executeTranslationDefaultText
public function executeTranslationDefaultText(sfWebRequest $request)
{
$campaign = CampaignTable::getInstance()->findById($request->getParameter('id'), $this->userIsAdmin());
if (!$campaign) {
return $this->notFound();
}
if (!$this->getGuardUser()->isCampaignMember($campaign)) {
return $this->noAccess();
}
$form = new TranslationForm();
$form_name = $form->getName();
$value = $request->getGetParameter('value');
if (!is_string($value)) {
return $this->notFound();
}
$language = LanguageTable::getInstance()->find($value);
if (!$language) {
return $this->notFound();
}
$validation_email = StoreTable::getInstance()->findByKeyAndLanguageCached(StoreTable::SIGNING_VALIDATION_EMAIL, $value);
if ($validation_email) {
$this->ajax()->val('#' . $form_name . '_email_validation_subject', $validation_email->getField('subject', ''));
$this->ajax()->val('#' . $form_name . '_email_validation_body', $validation_email->getField('body', ''));
}
$tellyourfriend_email = StoreTable::getInstance()->findByKeyAndLanguageCached(StoreTable::ACTION_TELL_YOUR_FRIEND_EMAIL, $value);
if ($tellyourfriend_email) {
$this->ajax()->val('#' . $form_name . '_email_tellyour_subject', $tellyourfriend_email->getField('subject', ''));
$this->ajax()->val('#' . $form_name . '_email_tellyour_body', $tellyourfriend_email->getField('body', ''));
}
$default_campaign_privacy = CampaignStoreTable::getInstance()->findByCampaignLanguageKey($campaign, $language, CampaignStoreTable::KEY_PRIVACY_POLICY);
if ($default_campaign_privacy) {
$this->ajax()->val('#' . $form_name . '_privacy_policy_body', $default_campaign_privacy->getValue());
} else {
$privacy = StoreTable::getInstance()->findByKeyAndLanguageCached(StoreTable::ACTION_PRIVACY_POLICY, $value);
if ($privacy) {
$this->ajax()->val('#' . $form_name . '_privacy_policy_body', $privacy->getField('body', ''));
}
}
return $this->ajax()->render();
}
示例12: executeOnpay
public function executeOnpay(sfWebRequest $request)
{
$pay_for = $request->getGetParameter('pay_for');
if (!is_numeric($pay_for)) {
throw new sfException('wrong argument for onpay');
}
$transaction = TransactionTable::getInstance()->findOneById($pay_for);
$onpay = OnPay::forTransaction($transaction);
$result = $onpay->processApiRequest($request->getGetParameter('type'), $request->getGetParameter('order_amount'), $request->getGetParameter('order_currency'), $pay_for, $request->getGetParameter('md5'), $request->getGetParameter('onpay_id'), $request->getGetParameter('balance_amount'), $request->getGetParameter('balance_currency'), $request->getGetParameter('exchange_rate'), $request->getGetParameter('paymentDateTime'));
$this->getResponse()->setContentType('text/plain');
return $this->renderText($result);
}
示例13: executeAttendance
public function executeAttendance(sfWebRequest $request)
{
// todo: Handle NON-AJAX requests
#$this->forward404Unless( $request->isXmlHttpRequest() );
$this->class = $this->enrolment->getClass();
$this->lessons = $this->class->getLessons();
$this->form = true;
if ($request->getGetParameter('form') == 'false')
{
/* saving */
$this->redirect( 'danceTrackAttendance',
array(
'dance_slug' => $dance_slug
)
);
} else {
}
return $this->renderPartial(
'attendance_form',
array(
'enrolment' => $this->enrolment,
'class' => $this->class,
'lessons' => $this->lessons
)
);
}
示例14: executeGetConfigs
public function executeGetConfigs(sfWebRequest $request)
{
$c = new Criteria();
$c->add(ConfigPeer::MODEL_ID, $request->getGetParameter('model_id'));
$this->configs = ConfigPeer::doSelect($c);
}
示例15: executeView
public function executeView(sfWebRequest $request)
{
$ticket = TicketTable::getInstance()->find($request->getParameter('id'));
if (!$ticket) {
return $this->notFound();
}
if (!$this->hasTicketRight($ticket)) {
return $this->ajax()->alert('You have no rights to handle this ticket.', 'Error', '#todo', 'append')->render();
}
$csrf_token = in_array($ticket->getStatus(), array(TicketTable::STATUS_APPROVED, TicketTable::STATUS_DENIED)) ? null : UtilCSRF::gen('tickets');
return $this->ajax()->appendPartial('body', 'view', array('ticket' => $ticket, 'csrf_token' => $csrf_token, 'campaign_id' => $request->getGetParameter('campaign_id'), 'petition_id' => $request->getGetParameter('petition_id')))->modal('#ticket_view_modal')->render();
}