get() public static method

This method is mainly useful for libraries that want to provide some flexibility. If you don't need the flexibility in controllers, it is better to explicitly get request parameters from the appropriate public property instead (attributes, query, request). Order of precedence: PATH (routing placeholders or custom attributes), GET, BODY
public static get ( string $key, mixed $default = null ) : mixed
$key string the key
$default mixed the default value if the parameter key does not exist
return mixed
Example #1
0
 /**
  * Update or creates a 'Calle' as from the resquest data, and return the id.
  *
  * @param  Request  $request
  * @return int
  */
 protected function getCalleIdAsociado($request)
 {
     $nombre_calle = strtolower($request->get('nombre_calle'));
     // Intento buscar la calle, si no existe entonces la creo.
     $calle = Calle::firstOrCreate(['nombre' => $nombre_calle, 'localidad_id' => $request->get('localidad_id')]);
     return $calle->id;
 }
Example #2
0
 /**
  * @covers Request::translate
  * @todo   Implement testTranslate().
  */
 public function testTranslate()
 {
     // Remove the following lines when you implement this test.
     $test_t = $this->object->add("test_add2", " <p>タグ</p> ");
     $test_t = $this->object->get("test_add2");
     $this->assertEquals($test_t, "タグ");
 }
Example #3
0
 public function testReturnsResultOfPassingWpDataToFactoryCreate()
 {
     $wpData = ['response' => ['code' => 201]];
     $this->wpHttp->get('uri', [])->willReturn($wpData);
     $this->factory->create($wpData)->shouldBeCalled();
     $this->request->get('uri');
 }
 /**
  * @Route("/alipayreturn", name="alipayreturn")
  */
 public function alipayreturn(Request $request)
 {
     $payment = $this->get('payment')->get('alipay');
     $verify_result = $payment->verifyReturn();
     if ($verify_result) {
         //验证成功
         //请在这里加上商户的业务逻辑程序代码
         //——请根据您的业务逻辑来编写程序(以下代码仅作参考)——
         //获取支付宝的通知返回参数,可参考技术文档中页面跳转同步通知参数列表
         //商户订单号
         $out_trade_no = $request->get('out_trade_no');
         //支付宝交易号
         $trade_no = $request->get('trade_no');
         //交易状态
         $trade_status = $request->get('trade_status');
         if ($trade_status == 'TRADE_FINISHED' || $trade_status == 'TRADE_SUCCESS') {
             //判断该笔订单是否在商户网站中已经做过处理
             //如果没有做过处理,根据订单号(out_trade_no)在商户网站的订单系统中查到该笔订单的详细,并执行商户的业务程序
             //如果有做过处理,不执行商户的业务程序
         } else {
             echo "trade_status=" . $trade_status;
         }
         echo "验证成功<br />";
         //——请根据您的业务逻辑来编写程序(以上代码仅作参考)——
     } else {
         //验证失败
         //如要调试,请看alipay_notify.php页面的verifyReturn函数
         echo "验证失败";
     }
     return $this->render('default/index.html.twig', ['base_dir' => realpath($this->getParameter('kernel.root_dir') . '/..')]);
 }
Example #5
0
 /**
  * AJAX call for set payment and cancel dates on Dossier details page (Financial > Price)
  *
  * @Route("/ajax/set/date", name="payment_ajax_set_date")
  */
 public function ajaxSetDate(Request $request)
 {
     $type = $request->get('type');
     $dateType = $request->get('dateType');
     $dossierId = $request->get('dossierId');
     $paymentId = $request->get('paymentId');
     $value = $request->get('value');
     $em = $this->getDoctrine()->getManager();
     $dossier = $em->getRepository('BraemBackofficeBundle:Dossier')->find($dossierId);
     if (!$dossier) {
         throw $this->createNotFoundException('Unable to find Dossier entity.');
     }
     $payment = $this->getCurrentPayment($paymentId, $type, $dossierId);
     $hasPayment = $payment->getId() ? true : false;
     if (!$hasPayment) {
         $payment->setDossier($dossier);
         $user = $this->container->get('security.context')->getToken()->getUser();
         $payment->setUser($user);
     }
     $payment->setType($type);
     $dateSetter = 'set' . ucfirst($dateType);
     $date = \DateTime::createFromFormat('d/m/Y', $value);
     $payment->{$dateSetter}($date);
     $em->persist($payment);
     $em->flush();
     $dateTitle = $this->getTitleForDate($dateType);
     $dateTitleReturn = $this->get('translator')->trans($dateTitle);
     $valueArr = explode('/', $value);
     $valueReturn = $valueArr[2] . '-' . $valueArr[1] . '-' . $valueArr[0];
     $dateTypeReturn = str_replace('Date', '', $dateType);
     $response = array('type' => $type, 'dateType' => $dateTypeReturn, 'dossierId' => $dossierId, 'paymentId' => $payment->getId(), 'value' => $valueReturn, 'title' => $dateTitleReturn);
     $return = new Response();
     $return->setContent(json_encode($response));
     return $return;
 }
 /**
  * Split dossier with few units into dossiers with one unit for selected.
  *
  * @Route("/{id}/split/process", name="dossier_split_process")
  * @Secure(roles="ROLE_ADVANCED_USER")
  * @Template("IMSCCSBundle:BaseDossier:show.html.twig")
  */
 public function splitDossierProcessAction(Request $request, $id)
 {
     $newDossierIds = "";
     $em = $this->getDoctrine()->getManager();
     $baseDossier = $em->getRepository('IMSCCSBundle:BaseDossier')->find($id);
     if (!$baseDossier) {
         throw $this->createNotFoundException('Unable to find Dossier entity.');
     }
     if ($baseDossier->isLockedManifest()) {
         throw new AccessDeniedException('The manifest is locked this action is not possible anymore');
     }
     if ($request->get('units') == 0) {
         $this->get('logger')->info('request: ' . var_export($this->getRequest()->request, TRUE));
         throw $this->createNotFoundException('No selected units for split.');
     }
     $detailedDossiers = $baseDossier->getDossiers();
     $detailedDossier = $detailedDossiers[0];
     $carsIds = array();
     foreach ($request->get('units') as $key => $value) {
         array_push($carsIds, $key);
     }
     $cars = $em->createQuery('SELECT c FROM IMSCCSBundle:Car c WHERE c.id IN(?1)')->setParameter(1, $carsIds)->getResult();
     $totalCars = $em->createQuery('SELECT c FROM IMSCCSBundle:Car c WHERE c.detailedDossier = ?1')->setParameter(1, $detailedDossier->getId())->getResult();
     $amountCars = count($cars);
     $amountTotalCars = count($totalCars);
     foreach ($cars as $key => $car) {
         if ($amountCars == $amountTotalCars && $key != 0 || $amountCars != $amountTotalCars) {
             $newBaseDossier = clone $baseDossier;
             $newBaseDossier->setDonorDossier($baseDossier->getUniqueId());
             $bl = clone $detailedDossier->getBl();
             $newDetailedDossier = clone $detailedDossier;
             // It's important that the creation date of the new dossier is the current date
             // otherwise it can mess up the BL numbering for the departure
             $newBaseDossier->setDate(new \DateTime());
             // Prevent integrity constraint violation
             $newBaseDossier->setInvoice($baseDossier->getInvoice());
             $car->setDetailedDossier($newDetailedDossier);
             $car->setBaseDossierForExternalApps($newBaseDossier);
             $bl->setDossier($newDetailedDossier);
             $newDetailedDossier->setBaseDossier($newBaseDossier);
             $newBaseDossier->setReference($em->getRepository('IMSCCSBundle:BaseDossier')->generateDossierReference($baseDossier->getCustomer()));
             $em->persist($baseDossier);
             $em->persist($newBaseDossier);
             $em->persist($newDetailedDossier);
             $em->persist($car);
             $em->persist($bl);
             $em->flush();
             $isMaster = $this->container->getParameter('master_app');
             if ($isMaster) {
                 $newBaseDossier->setSourceDossierId($newBaseDossier->getId());
                 $em->flush();
             }
             $newDossierIds .= " <a href=" . $this->generateUrl('dossier_show', array('id' => $newBaseDossier->getId())) . ">#" . $newBaseDossier->getId() . "</a>,";
         }
     }
     $em->clear();
     $this->get('session')->getFlashBag()->add('success', 'Current dossier was successfully split on current and ' . rtrim($newDossierIds, ",") . ' dossier(s)');
     return $this->redirect($this->generateUrl('dossier_show', array('id' => $id)));
 }
Example #7
0
 protected function getInput($value, $label = '', $transformers = null, $validators = null)
 {
     $value = $this->request->get($value);
     if (!empty($transformers) && !empty($validators)) {
         $value = \eBuildy\DataBinder\DataBinderHelper::get($value, $label, $transformers, $validators);
     }
     return $value;
 }
 public function searchAction()
 {
     $phrase = $this->request->get('search_type[phrase]', false, true);
     if (empty($phrase)) {
         return $this->render('ValantirForumBundle:Search:search-result.html.twig', array('phrase' => $phrase));
     }
     $searchQuery = $this->getTopicManager()->findWith($phrase);
     $pagination = $this->paginator->paginate($searchQuery, $this->request->get('page', 1), 10, array('wrap-queries' => true));
     return $this->render('ValantirForumBundle:Search:search-result.html.twig', array('topics' => $pagination, 'phrase' => $phrase));
 }
Example #9
0
 public function convert(Request $request)
 {
     $messageData = [];
     $messageData['to'] = "*****@*****.**";
     $messageData['from'] = [$request->get('name') => $request->get('email')];
     $messageData['subject'] = 'Contact form submission';
     $messageData['alt'] = true;
     $body = "{$request->get}('name') \n {$request->get}('company') \n {$request->get}('phone') \n {$request->get}('comment')";
     $messageData['body'] = $body;
     return $messageData;
 }
 public function getPagination()
 {
     $request = new Request();
     $bookModel = new BookModel();
     $itemsCount = $bookModel->getBooksCount();
     $itemsPerPage = BOOKS_PER_PAGE;
     $currentPage = $request->get('page') ? (int) $request->get('page') : 1;
     if ($currentPage < 0) {
         throw new Exception('Bad request', 400);
     }
     $pagination = new Pagination($currentPage, $itemsCount, $itemsPerPage);
     $args['pagination'] = $pagination->buttons;
     return $this->render('pagination', $args);
     //Debugger::PrintR($args);
 }
 function execute()
 {
     $app = strtolower(Request::get('app_local'));
     $locale = new Locales($app);
     $locale->deleteTranslate(Request::get('local_iso'), Request::post('var'));
     return false;
 }
 public function __construct($table, $id = null, $fields = array())
 {
     $this->table = $table;
     $this->content = $this->view();
     $this->id = $id;
     $this->fields = $fields;
     switch (Request::get('action')) {
         case 'index':
             $this->content = $this->index();
             break;
         case 'add':
             $this->content = $this->create();
             break;
         case 'view':
             $this->content = $this->view();
             break;
         case 'edit':
             $this->content = $this->create($this->id);
             break;
         case 'delete':
             $this->delete($this->id);
             $this->content = $this->index();
             break;
         case 'update':
             $this->update();
             $this->content = $this->index();
             break;
         default:
             $this->content = $this->index();
             break;
     }
 }
 public function unpaidPayeePayments()
 {
     $query = PayeePayment::unpaid();
     $query->with(["payee", "client"]);
     $query->join(User::table() . " as user", 'user.code', '=', PayeePayment::table() . '.payee_code');
     $filters = Request::get('_filter');
     if (count($filters)) {
         foreach ($filters as $key => $filter) {
             list($field, $value) = explode(':', $filter);
             if (strpos($filter, 'search') !== false) {
                 $query->where(function ($query) use($value) {
                     $query->orWhere("user.name", "like", '%' . $value . '%');
                 });
             } else {
                 $this->attachWhere($query, $value, $field);
             }
         }
     }
     $this->attachSort(new PayeePayment(), $query);
     $count = $this->getQueryCount($query);
     $offset = $this->attachOffset($query);
     $limit = $this->attachLimit($query);
     $items = $query->get([PayeePayment::table() . '.*']);
     return Response::json(array('model' => "PayeePayment", 'items' => $items->toApiArray(), 'offset' => $offset, 'limit' => $limit, 'count' => $count), 200, [], JSON_NUMERIC_CHECK);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $route = Route::getCurrentRoute()->getPath();
     if ('/admin/disciplinas' == $route) {
         $conteudoDisciplinas = new Disciplinas();
         /*$id = Input::get('id');
           if($id>0){
               $conteudoDisciplinas = Disciplinas::find($id);
           }*/
         $conteudoDisciplinas->nome_dis = Request::get('nomeDisciplina');
         $conteudoDisciplinas->codigo_dis = Request::get('codigoDisciplina');
         $conteudoDisciplinas->periodo_dis = Request::get('periodoDisciplina');
         $conteudoDisciplinas->save();
         $value = array('success' => true);
         //        return json_encode($value);
         return Redirect::to('/admin/disciplinas');
     }
     if ('/admin/professores' == $route) {
         return 'oi';
     }
     /*switch($route){
                 case '/admin/disciplinas/add':
                     $queryBuilder = 'Disciplinas';
                     break;
                 default:
                     break;
             }
     
             $updater    = new $queryBuilder();*/
 }
Example #15
0
 public function before_filter(&$action, &$args)
 {
     parent::before_filter($action, $args);
     $course_id = Request::option('sem_id', $args[0]);
     if (empty($course_id)) {
         checkObject();
         //wirft Exception, wenn $SessionSeminar leer ist
         $course_id = $GLOBALS['SessionSeminar'];
     }
     $this->course = Course::find($course_id);
     if (!$this->course) {
         throw new Trails_Exception(400);
     }
     $this->send_from_search_page = Request::get('send_from_search_page');
     if ($GLOBALS['SessionSeminar'] != $this->course->id && !(int) $this->course->visible && !($GLOBALS['perm']->have_perm(Config::get()->SEM_VISIBILITY_PERM) || $GLOBALS['perm']->have_studip_perm('user', $this->course->id))) {
         throw new AccessDeniedException(_('Diese Veranstaltung ist versteckt. Hier gibt es nichts zu sehen.'));
     }
     if (!preg_match('/^(' . preg_quote($GLOBALS['CANONICAL_RELATIVE_PATH_STUDIP'], '/') . ')?([a-zA-Z0-9_-]+\\.php)([a-zA-Z0-9_?&=-]*)$/', $this->send_from_search_page)) {
         $this->send_from_search_page = '';
     }
     if ($this->course->getSemClass()->offsetGet('studygroup_mode')) {
         if ($GLOBALS['perm']->have_studip_perm('autor', $this->course->id)) {
             // participants may see seminar_main
             $link = URLHelper::getUrl('seminar_main.php', array('auswahl' => $this->course->id));
         } else {
             $link = URLHelper::getUrl('dispatch.php/course/studygroup/details/' . $this->course->id, array('send_from_search_page' => $this->send_from_search_page));
         }
         $this->redirect($link);
         return;
     }
 }
Example #16
0
 /**
  * Image Manager Popup
  *
  * @param string $listFolder The image directory to display
  * @since 1.5
  */
 function getFolderList($base = null)
 {
     // Get some paths from the request
     if (empty($base)) {
         $base = COM_MEDIA_BASE;
     }
     //corrections for windows paths
     $base = str_replace(DIRECTORY_SEPARATOR, '/', $base);
     $com_media_base_uni = str_replace(DIRECTORY_SEPARATOR, '/', COM_MEDIA_BASE);
     // Get the list of folders
     $folders = Filesystem::directories($base, '.', true, true);
     Document::setTitle(Lang::txt('COM_MEDIA_INSERT_IMAGE'));
     // Build the array of select options for the folder list
     $options[] = Html::select('option', "", "/");
     foreach ($folders as $folder) {
         $folder = str_replace($com_media_base_uni, "", str_replace(DIRECTORY_SEPARATOR, '/', $folder));
         $value = substr($folder, 1);
         $text = str_replace(DIRECTORY_SEPARATOR, "/", $folder);
         $options[] = Html::select('option', $value, $text);
     }
     // Sort the folder list array
     if (is_array($options)) {
         sort($options);
     }
     // Get asset and author id (use integer filter)
     $asset = Request::getInt('asset', 0);
     $author = Request::get('author', 0);
     // Create the drop-down folder select list
     $list = Html::select('genericlist', $options, 'folderlist', 'class="inputbox" size="1" onchange="ImageManager.setFolder(this.options[this.selectedIndex].value, ' . $asset . ', ' . $author . ')" ', 'value', 'text', $base);
     return $list;
 }
Example #17
0
function contactProcess()
{
    if (Session::has('contactus')) {
        $total = (int) Session::get('contactus');
        if ($total >= 5) {
            Redirect::to('404page');
            // Alert::make('Page not found');
        }
    }
    $valid = Validator::make(array('send.fullname' => 'min:2|slashes', 'send.email' => 'min:5|slashes', 'send.content' => 'min:3|slashes'));
    if (!$valid) {
        $alert = '<div class="alert alert-warning">Contact information not valid.</div>';
        return $alert;
    }
    if (!($id = Contactus::insert(Request::get('send')))) {
        $alert = '<div class="alert alert-warning">Error. ' . Database::$error . '</div>';
        return $alert;
    }
    if (Session::has('contactus')) {
        $total = (int) Session::get('contactus');
        $total++;
        Session::make('contactus', $total);
    } else {
        Session::make('contactus', '1');
    }
    $alert = '<div class="alert alert-success">Success. We will response soon!</div>';
    return $alert;
}
Example #18
0
 private function sortCourseNavigation()
 {
     global $perm;
     $restNavigation = array();
     $newNavigation = Navigation::getItem('/course');
     foreach (Navigation::getItem('/course') as $key => $tab) {
         $block = SeminarTab::findOneBySQL('seminar_id = ? AND tab IN (?) ORDER BY position ASC', array($this->getSeminarId(), $key));
         if ($block) {
             $tab->setTitle($block->getValue('title'));
             if ($block->getValue('tn_visible') == true || $perm->have_studip_perm('dozent', Request::get('cid'))) {
                 $subNavigations[$block->getValue('position')][$key] = $tab;
             }
         } else {
             //keine Info bezüglich Reihenfolge also hinten dran
             //greift bei neu aktivierten Navigationselementen
             $restNavigation[$key] = $tab;
         }
         $newNavigation->removeSubNavigation($key);
     }
     ksort($subNavigations);
     foreach ($subNavigations as $subNavs) {
         foreach ($subNavs as $key => $subNav) {
             $newNavigation->addSubNavigation($key, $subNav);
         }
     }
     if (count($restNavigation) > 0) {
         foreach ($restNavigation as $key => $restNav) {
             $newNavigation->addSubNavigation($key, $restNav);
         }
     }
     Navigation::addItem('/course', $newNavigation);
 }
 public function download__download()
 {
     $file = Request::get('file');
     $filename = Path::fromAsset($file);
     $as = Request::get('as', $file);
     $logged_in = filter_var(Request::get('logged_in', true), FILTER_VALIDATE_BOOLEAN);
     $override = Request::get('override');
     if (!$logged_in) {
         // first make sure there's an override in the config
         $override_config = $this->fetchConfig('override');
         if (!$override_config) {
             die('No override key configured');
         }
         // now see if there's an override param
         if (!$override) {
             die('No override param');
         }
         if ($override_config != $override) {
             die("Override key & param don't match");
         }
     } elseif (!Auth::isLoggedIn()) {
         // if the user has to be logged in, see if they are
         die('Must be logged in');
     }
     if (!$this->download($filename, $as)) {
         die('File doesn\'t exist');
     }
 }
 function metodoverLista($gestor)
 {
     $bd = new DataBase();
     $gestorCuadro = new ManageCuadro($bd);
     $nombreArtistico = Request::get("nombre");
     $artista = $gestor->getPorNombreArtistico($nombreArtistico);
     $email = $artista->getEmail();
     $plantilla = $artista->getPlantilla();
     $condicion = "autor='{$email}'";
     $listaObras = $gestorCuadro->getListWhere($condicion);
     $plantillaObras = Plantilla::cargarPlantilla("templates/_cuadros{$plantilla}.html");
     $obras = "";
     foreach ($listaObras as $key => $value) {
         $obrai = str_replace("{titulo}", $value->getNombreCuadro(), $plantillaObras);
         $obrai = str_replace("{ruta}", "../" . $value->getruta(), $obrai);
         $obrai = str_replace("{descripcion}", $value->getDescripcion(), $obrai);
         $obras .= $obrai;
     }
     $pagina = Plantilla::cargarPlantilla("templates/_plantilla.cuadros1.html");
     if ($plantilla == 1) {
         $contenedor = 'contenedor1';
     } else {
         if ($plantilla == 2) {
             $contenedor = 'contenedor2';
         } else {
             $contenedor = 'contenedor3';
         }
     }
     $datos = array("contenedor" => $contenedor, "contenidoParticular" => $obras);
     echo Plantilla::sustituirDatos($datos, $pagina);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $imageurl = '';
     if (Request::get('image') != '') {
         $imageurl = "/images/report/accident_" . time() . ".jpg";
         $base = Request::get('image');
         $binary = base64_decode($base);
         $ifp = fopen($imageurl, "wb");
         fwrite($ifp, $binary);
         fclose($ifp);
         $imageurl = 'http://125.62.200.54/traffic/' . $imageurl;
     }
     $accident = Accident::create(array('user' => Request::get('user'), 'latitude' => Request::get('lat'), 'longitude' => Request::get('lng'), 'time' => date('g:i A', time()), 'date' => date('M j', time()), 'details' => Request::get('details'), 'image_url' => $imageurl));
     $report = new Report();
     $report->traffic_jam_id = $accident->id;
     $report->user = Request::get('user');
     $report->latitude = Request::get('lat');
     $report->longitude = Request::get('lng');
     $report->time = date('g:i A', time());
     $report->date = date('M j', time());
     $report->description = "There has been an accident. " . Request::get('details');
     $report->image_url = $imageurl;
     $report->type = 'Accident';
     $report->title = RestApi::getaddress(Request::get('lat'), Request::get('lng'));
     $report->save();
     //RestApi::sendNotification()
     return Response::json(array('error' => false), 200);
 }
Example #22
0
 public static function initController()
 {
     $id = Request::get('Currency', null, 'COOKIE');
     $Current = new Currency();
     $Default = Currency::findDefault();
     $code = null;
     if (function_exists('geoip_record_by_name')) {
         $arr = @geoip_record_by_name(Request::get('REMOTE_ADDR', '', 'SERVER'));
         $code = isset($arr['country_code']) ? $arr['country_code'] : null;
     }
     $arr = Currency::findCurrencies(true);
     foreach ($arr as $i => $Currency) {
         if ($Currency->Id == $id) {
             $Current = $Currency;
             break;
         }
     }
     if (!$Current->Id && $code) {
         foreach ($arr as $Currency) {
             if ($Currency->hasCountry($code)) {
                 $Current = $Currency;
                 break;
             }
         }
     }
     if (!$Current->Id) {
         foreach ($arr as $Currency) {
             $Current = $Currency;
             break;
         }
     }
     Runtime::set('CURRENCY_DEFAULT', $Default);
     Runtime::set('CURRENCY_CURRENT', $Current);
     return false;
 }
 function execute()
 {
     $this->frame = false;
     $item = Payment::getItem(Request::get('payment'), 'connection');
     $settings = Settings::getHtml(false, $item['settings']);
     $this->smarty->assign('settings', $settings);
 }
 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $imageurl = '';
     if (Request::get('image') != '') {
         $imageurl = "public/images/report/trafficjam_" . time() . ".jpg";
         $base = Request::get('image');
         $binary = base64_decode($base);
         $ifp = fopen($imageurl, "wb");
         fwrite($ifp, $binary);
         fclose($ifp);
         $imageurl = 'http://125.62.200.54/traffic/' . $imageurl;
     }
     $roadblock = RoadBlock::create(array('user' => Request::get('user'), 'latitude' => Request::get('lat'), 'longitude' => Request::get('lng'), 'time' => date('g:iA', time()), 'date' => date('M j', time()), 'status' => Request::get('status'), 'reason' => Request::get('reason'), 'image_url' => $imageurl));
     $report = new Report();
     $report->user = Request::get('user');
     $report->latitude = Request::get('lat');
     $report->longitude = Request::get('lng');
     $report->time = date('g:i A', time());
     $report->date = date('M j', time());
     $report->description = "The road is blocked at " . RestApi::getaddress(Request::get('lat'), Request::get('lng')) . " due to " . Request::get('reason');
     $report->image_url = $imageurl;
     $report->type = 'Road Block';
     $report->title = RestApi::getaddress(Request::get('lat'), Request::get('lng'));
     $report->save();
     return RestApi::sendNotification('RB', Request::get('lat'), Request::get('lng'), RestApi::getaddress(Request::get('lat'), Request::get('lng')), '12');
 }
Example #25
0
 function exeArticle()
 {
     $id = (int) Request::get('article');
     if ($id > 0) {
         $data = $this->model->selectOne($id);
         if (empty($data)) {
             $data['error'] = true;
         } else {
             $data['error'] = false;
             Document::setTitle($data['title']);
             $comments = $this->exeGetComment((int) Request::get('article'), 0, 20);
             $data['comments'] = $comments['data'];
             $data['viewComment'] = $comments['view'];
             Document::setTitle($data['title']);
             if (Session::get('user') != null) {
                 $data['submit'] = '<input name="submitComment" type="button" class="input_submit" login="******" value="Bình luận"/>';
             } else {
                 $data['submit'] = '<input name="submitComment" type="button" class="input_submit" value="Đăng nhập để bình luận"/>';
             }
         }
     } else {
         $data['error'] = true;
     }
     if ($data['error'] == true) {
         Document::setTitle('Lỗi');
     }
     $this->view->render('article', $data);
 }
 protected function termsAjaxHandler()
 {
     \Plugin::add_action('ajax_backend_get_taxonomy_terms', function () {
         $terms = $this->app->make(Repositories\TermTaxonomyRepository::class)->ajaxGetSelect2TaxonomyTerms(\Request::get('taxonomy'), \Request::get('term'), \Request::get('value'));
         return \Response::json($terms)->send();
     }, 0);
     \Plugin::add_action('ajax_backend_add_taxonomy_term', function () {
         $term = \Request::all();
         $response = [];
         if (count($term) > 1) {
             $termKeys = array_keys($term);
             $termValues = array_values($term);
             $taxName = str_replace('new', '', $termKeys[0]);
             $taxObj = $this->app->make('Taxonomy')->getTaxonomy($taxName);
             $termName = $termValues[0];
             $termParent = 0 != $termValues[1] ? (int) $termValues[1] : null;
             $postId = isset($termValues[2]) ? $termValues[2] : 0;
             $createdTerm = $this->app->make('Taxonomy')->createTerm($termName, $taxName, ['parent' => $termParent]);
             if ($createdTerm && !$createdTerm instanceof EtherError) {
                 $result['replaces'][$taxName . '_parent_select'] = View::make('backend::post.taxonomy-parent-select', ['taxName' => $taxName, 'taxObj' => $taxObj])->render();
                 $result['replaces'][$taxName . '_checklist'] = View::make('backend::post.taxonomy-checklist', ['taxName' => $taxName, 'postId' => $postId, 'taxObj' => $taxObj])->render();
                 $response['success'] = $result;
             } else {
                 $response['error'] = $response['error'] = $createdTerm->first();
             }
         } else {
             $response['error'] = 'Invalid Arguments Supplied';
         }
         return \Response::json($response)->send();
     }, 0);
 }
Example #27
0
 function before_filter(&$action, &$args)
 {
     if (Request::option('auswahl')) {
         Request::set('cid', Request::option('auswahl'));
     }
     parent::before_filter($action, $args);
     checkObject();
     $this->institute = Institute::findCurrent();
     if (!$this->institute) {
         throw new CheckObjectException(_('Sie haben kein Objekt gewählt.'));
     }
     $this->institute_id = $this->institute->id;
     //set visitdate for institute, when coming from meine_seminare
     if (Request::option('auswahl')) {
         object_set_visit($this->institute_id, "inst");
     }
     //gibt es eine Anweisung zur Umleitung?
     if (Request::get('redirect_to')) {
         $query_parts = explode('&', stristr(urldecode($_SERVER['QUERY_STRING']), 'redirect_to'));
         list(, $where_to) = explode('=', array_shift($query_parts));
         $new_query = $where_to . '?' . join('&', $query_parts);
         page_close();
         $new_query = preg_replace('/[^:0-9a-z+_\\-.#?&=\\/]/i', '', $new_query);
         header('Location: ' . URLHelper::getURL($new_query, array('cid' => $this->institute_id)));
         die;
     }
     PageLayout::setHelpKeyword("Basis.Einrichtungen");
     PageLayout::setTitle($this->institute->getFullName() . " - " . _("Kurzinfo"));
     Navigation::activateItem('/course/main/info');
 }
Example #28
0
 /**
  * Return specified element of Request.
  * Return all items of Request if empty parameter.
  *
  * @param null $ele
  *
  * @return array
  */
 function rq($ele = null)
 {
     if (!$ele) {
         return Request::all();
     }
     return Request::get($ele);
 }
function loadApi($action)
{
    switch ($action) {
        case 'install':
            if (!isset($_COOKIE['groupid'])) {
                throw new Exception("Error Processing Request");
            }
            $url = Request::get('send_url', '');
            $send_method = Request::get('send_method', 'plugin');
            if (!isset($url[4])) {
                throw new Exception("Error Processing Request");
            }
            $path = 'contents/plugins/';
            if ($send_method == 'template') {
                $path = 'contents/themes/';
            }
            File::downloadModule($url, $path, 'yes');
            break;
        case 'load':
            $queryData = array('send_catid' => Request::get('send_catid', 0), 'is_filter' => Request::get('is_filter', 'no'), 'send_keyword' => Request::get('send_keyword', ''), 'send_page' => Request::get('send_page', 0), 'send_limitshow' => Request::get('send_limitshow', 20), 'send_method' => Request::get('send_method', 'plugin'), 'send_showtype' => Request::get('send_showtype', 'lastest'));
            $loadData = PluginStoreApi::get($queryData);
            $loadData = json_decode($loadData, true);
            if ($loadData['error'] == 'yes') {
                throw new Exception($loadData['message']);
            }
            return $loadData['data'];
            break;
        case 'loadhtml':
            $queryData = array('send_catid' => Request::get('send_catid', 0), 'is_filter' => Request::get('is_filter', 'no'), 'send_keyword' => Request::get('send_keyword', ''), 'send_page' => Request::get('send_page', 0), 'send_limitshow' => Request::get('send_limitshow', 20), 'send_method' => Request::get('send_method', 'plugin'), 'send_showtype' => Request::get('send_showtype', 'lastest'));
            $loadData = PluginStoreApi::getHTML($queryData);
            return $loadData;
            break;
    }
}
Example #30
0
 public static function run($routeArgs = [])
 {
     self::$routeArgs = $routeArgs;
     //URL结构处理
     $param = array_filter(explode('/', Request::get(c('http.url_var'))));
     switch (count($param)) {
         case 2:
             array_unshift($param, c('http.default_module'));
             break;
         case 1:
             array_unshift($param, c('http.default_controller'));
             array_unshift($param, c('http.default_module'));
             break;
         case 0:
             array_unshift($param, c('http.default_action'));
             array_unshift($param, c('http.default_controller'));
             array_unshift($param, c('http.default_module'));
             break;
     }
     Request::set('get.' . c('http.url_var'), implode('/', $param));
     $param[1] = preg_replace_callback('/_([a-z])/', function ($matches) {
         return ucfirst($matches[1]);
     }, $param[1]);
     define('MODULE', $param[0]);
     define('CONTROLLER', ucfirst($param[1]));
     define('ACTION', $param[2]);
     define('MODULE_PATH', ROOT_PATH . '/' . c('app.path') . '/' . MODULE);
     define('VIEW_PATH', MODULE_PATH . '/' . 'view');
     define('__VIEW__', __ROOT__ . '/' . c('app.path') . '/' . MODULE . '/view');
     self::action();
 }