当前位置: 首页>>代码示例>>PHP>>正文


PHP JURI::setFragment方法代码示例

本文整理汇总了PHP中JURI::setFragment方法的典型用法代码示例。如果您正苦于以下问题:PHP JURI::setFragment方法的具体用法?PHP JURI::setFragment怎么用?PHP JURI::setFragment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JURI的用法示例。


在下文中一共展示了JURI::setFragment方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateWeekend

 /**
  * Update the current walk with passed in form data
  */
 public function updateWeekend(array $formData)
 {
     $this->loadWeekend($formData['id']);
     // Update all basic fields
     // Fields that can't be saved are just ignored
     // Invalid fields throw an exception - display this to the user and continue
     foreach ($formData as $name => $value) {
         try {
             $this->weekend->{$name} = $value;
         } catch (UnexpectedValueException $e) {
             // TODO: Error message
             echo "<p>";
             var_dump($name);
             var_dump($value);
             var_dump($e->getMessage());
             echo "</p>";
         }
     }
     // Date fields need to be converted
     if (!empty($formData['startdate'])) {
         $this->weekend->start = strtotime($formData['startdate']);
     } else {
         $this->weekend->start = null;
     }
     if (!empty($formData['enddate'])) {
         $this->weekend->endDate = strtotime($formData['enddate']);
     } else {
         $this->weekend->endDate = null;
     }
     // Alterations
     $this->weekend->alterations->incrementVersion();
     $this->weekend->alterations->setDetails(!empty($formData['alterations_details']));
     $this->weekend->alterations->setCancelled(!empty($formData['alterations_cancelled']));
     $this->weekend->alterations->setOrganiser(!empty($formData['alterations_organiser']));
     $this->weekend->alterations->setDate(!empty($formData['alterations_date']));
     if ($this->weekend->isValid()) {
         $this->weekend->save();
         // Redirect to the list page
         $itemid = JRequest::getInt('returnPage');
         if (empty($itemid)) {
             return false;
         }
         $item = JFactory::getApplication()->getMenu()->getItem($itemid);
         $link = new JURI("/" . $item->route);
         // Jump to the event?
         if (JRequest::getBool('jumpToEvent')) {
             $link->setFragment("weekend_" . $this->weekend->id);
         }
         JFactory::getApplication()->redirect($link, "Weekend saved");
     }
 }
开发者ID:SheffieldWalkingGroup,项目名称:swgwebsite,代码行数:54,代码来源:addeditweekend.php

示例2: updateWI

 /**
  * Update the current walk with passed in form data
  */
 public function updateWI(array $formData)
 {
     // Load an existing walk instance (if any)
     if (!empty($formData['id'])) {
         $factory = SWG::walkInstanceFactory();
         $this->wi = $factory->getSingle($formData['id']);
     } else {
         $this->wi = new WalkInstance();
     }
     // Update all basic fields
     // Fields that can't be saved are just ignored
     // Invalid fields throw an exception - display this to the user and continue
     foreach ($formData as $name => $value) {
         try {
             $this->wi->{$name} = $value;
         } catch (UnexpectedValueException $e) {
             echo "<p>";
             var_dump($name);
             var_dump($value);
             var_dump($e->getMessage());
             echo "</p>";
         }
     }
     // Now do the fields that have to be done separately
     // Date & time
     $this->wi->start = strtotime($formData['date'] . " " . $formData['meetTime']);
     // Alterations
     $this->wi->alterations->incrementVersion();
     $this->wi->alterations->setDetails($formData['alterations_details']);
     $this->wi->alterations->setCancelled($formData['alterations_cancelled']);
     $this->wi->alterations->setPlaceTime($formData['alterations_placeTime']);
     $this->wi->alterations->setOrganiser($formData['alterations_organiser']);
     $this->wi->alterations->setDate($formData['alterations_date']);
     if ($this->wi->isValid()) {
         $this->wi->save();
         // Redirect to the list page
         $itemid = JRequest::getInt('returnPage');
         if (empty($itemid)) {
             return false;
         }
         $item = JFactory::getApplication()->getMenu()->getItem($itemid);
         $link = new JURI("/" . $item->route);
         // Jump to the event?
         if (JRequest::getBool('jumpToEvent')) {
             $link->setFragment("walk_" . $this->wi->id);
         }
         JFactory::getApplication()->redirect($link, "Walk scheduled");
     } else {
     }
 }
开发者ID:SheffieldWalkingGroup,项目名称:swgwebsite,代码行数:53,代码来源:schedulewalk.php

示例3: testSetFragment

	public function testSetFragment() {
		$this->object->setFragment('someFragment');

		$this->assertThat(
			$this->object->getFragment(),
			$this->equalTo('someFragment')
		);
	}
开发者ID:realityking,项目名称:JAJAX,代码行数:8,代码来源:JURITest.php

示例4: updateSocial

 /**
  * Update the current walk with passed in form data
  * This also handles GPX data
  */
 public function updateSocial(array $formData)
 {
     $this->loadSocial($formData['id']);
     // Update all basic fields
     // Fields that can't be saved are just ignored
     // Invalid fields throw an exception - display this to the user and continue
     foreach ($formData as $name => $value) {
         try {
             $this->social->{$name} = $value;
         } catch (UnexpectedValueException $e) {
             echo "<p>";
             var_dump($name);
             var_dump($value);
             var_dump($e->getMessage());
             echo "</p>";
         }
     }
     // Empty checkboxes...
     if (empty($formData['showNormal'])) {
         $this->social->showNormal = false;
     }
     if (empty($formData['showNewMember'])) {
         $this->social->showNewMember = false;
     }
     // Time fields need to be built up (they combine date & time internally)
     if (!empty($formData['date'])) {
         if (!empty($formData['starttime'])) {
             $this->social->start = strtotime($formData['date'] . " " . $formData['starttime']);
         } else {
             $this->social->start = strtotime($formData['date']);
         }
         if (!empty($formData['endtime'])) {
             $this->social->end = strtotime($formData['date'] . " " . $formData['endtime']);
         } else {
             if ($formData['endtime'] == "") {
                 $this->social->end = null;
             }
         }
     }
     if (!empty($formData['newMemberStart'])) {
         $this->social->newMemberStart = strtotime($formData['date'] . " " . $formData['newMemberStart']);
     }
     if (!empty($formData['newMemberEnd'])) {
         $this->social->newMemberEnd = strtotime($formData['date'] . " " . $formData['newMemberEnd']);
     }
     // Alterations
     $this->social->alterations->incrementVersion();
     $this->social->alterations->setDetails($formData['alterations_details']);
     $this->social->alterations->setCancelled($formData['alterations_cancelled']);
     $this->social->alterations->setPlaceTime($formData['alterations_placeTime']);
     $this->social->alterations->setOrganiser($formData['alterations_organiser']);
     $this->social->alterations->setDate($formData['alterations_date']);
     if ($this->social->isValid()) {
         $this->social->save();
         // Redirect to the list page
         $itemid = JRequest::getInt('returnPage');
         if (empty($itemid)) {
             return false;
         }
         $item = JFactory::getApplication()->getMenu()->getItem($itemid);
         $link = new JURI("/" . $item->route);
         // Jump to the event?
         if (JRequest::getBool('jumpToEvent')) {
             $link->setFragment("social_" . $this->social->id);
         }
         JFactory::getApplication()->redirect($link, "Social saved");
     } else {
         // Find out why it's invalid.
         // All other errors should be caught by JS - just check it's either a normal social or a new members one.
         if (!$this->social->showNormal && !$this->social->showNewMember) {
         }
     }
 }
开发者ID:SheffieldWalkingGroup,项目名称:swgwebsite,代码行数:77,代码来源:addeditsocial.php

示例5: array

 static function append_sid($hook, $url, $params = false, $is_amp = true, $session_id = false)
 {
     global $_SID, $_EXTRA_URL;
     $arrParams = array();
     $arrExtra = array();
     $anchor = '';
     JForumHook::fixPage();
     $config =& JFactory::getConfig();
     if ($url == '.php') {
         $url = '/' . $config->getValue('config.phpbb_path') . '/index.php';
     }
     // Assign sid if session id is not specified
     if ($session_id === false) {
         $session_id = $_SID;
     }
     //Clean the url and the params first
     if ($is_amp) {
         $url = str_replace('&amp;', '&', $url);
         if (!is_array($params)) {
             $params = str_replace('&amp;', '&', $params);
         }
     }
     $amp_delim = $is_amp ? '&amp;' : '&';
     $url_delim = strpos($url, '?') === false ? '?' : $amp_delim;
     // Process the parameters array
     if (is_array($params)) {
         foreach ($params as $key => $item) {
             if ($item === NULL) {
                 continue;
             }
             if ($key == '#') {
                 $anchor = '#' . $item;
                 continue;
             }
             $arrParams[$key] = $item;
         }
     } else {
         if (strpos($params, '#') !== false) {
             list($params, $anchor) = explode('#', $params, 2);
             $anchor = '#' . $anchor;
         }
         parse_str($params, $arrParams);
     }
     //Process the extra array
     if (!empty($_EXTRA_URL)) {
         $extra = implode('&', $_EXTRA_URL);
         parse_str($extra, $arrExtra);
     }
     //Create the URL
     $uri = new JURI($url);
     $query = $uri->getQuery(true);
     $query = $query + $arrParams + $arrExtra;
     $uri->setQuery($query);
     //Set session id variable
     if ($session_id) {
         $uri->setVar('sid', $session_id);
     }
     //Set fragment
     if ($anchor) {
         $uri->setFragment($anchor);
     }
     $view = basename($uri->getPath(), '.php');
     if (!$uri->getVar('rb_v') && $view != "style") {
         if (JRequest::getVar('rb_v') == 'adm') {
             if (strpos($url, $config->getValue('config.phpbb_path')) === false) {
                 $view = 'adm';
             }
         }
         if (stripos($url, $config->getValue('config.phpbb_path') . '/adm') !== false) {
             $view = 'adm';
         }
         if ($view != 'index') {
             $uri->setVar('rb_v', $view);
         }
     }
     if ($view != 'style') {
         $url = 'index.php' . $uri->toString(array('query', 'fragment'));
         // {} getting lost in encoding
         $url = str_replace(array('%7B', '%7D'), array('{', '}'), $url);
         return urldecode(JURI::base() . JRoute::_($url, $is_amp));
     } else {
         $url = 'style.php' . $uri->toString(array('query', 'fragment'));
         $url = str_replace(array('%7B', '%7D'), array('{', '}'), $url);
         return urldecode(JPATH_ROOT . '/' . $config->getValue('config.phpbb_path') . '/' . $url);
     }
 }
开发者ID:skyview059,项目名称:e-learning-website,代码行数:86,代码来源:hooks.php

示例6: upload

 public function upload()
 {
     // Check for request forgeries.
     JRequest::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
     $this->errors = array();
     // Initialise variables.
     $app = JFactory::getApplication();
     $model = $this->getModel('uploadtrack');
     $view = $this->getView('uploadtrack', 'html');
     $view->setModel($model, true);
     $wi = $model->getWalkInstance();
     // Are we uploading a track, or saving the track we've already uploaded?
     $file = JRequest::getVar('file', array(), 'FILES', 'array');
     if (!empty($file) && $file['error'] == UPLOAD_ERR_OK) {
         // We've been given a GPX file. Try to parse it.
         $gpx = DOMDocument::load($file['tmp_name']);
         if ($gpx && $gpx->getElementsByTagName("gpx")->length == 1) {
             $route = new Route();
             $wi = $model->getWalkInstance();
             if ($wi != null) {
                 $route->setWalk($wi);
             }
             $route->readGPX($gpx);
             $route->uploadedBy = JFactory::getUser()->id;
             $route->uploadedDateTime = time();
             $route->type = Route::Type_Logged;
             if ($wi != null) {
                 // Check that this route matches the walk
                 if ($route->checkAgainstWalk($model->getWalkInstance(), $message, $details)) {
                     // Store this route for later requests
                     JFactory::getApplication()->setUserState("uploadedroute", serialize($route));
                 } else {
                     throw new UserException("Can't upload this track", 0, "This track doesn't match that walk", $message . ": " . $details);
                 }
             } else {
                 // Try to find a matching walk
                 $wi = $route->findMatchingWalk();
                 if (isset($wi)) {
                     $route->setWalk($wi);
                     // Store this route for later requests
                     JFactory::getApplication()->setUserState("uploadedroute", serialize($route));
                     $model->setWalkInstance($wi);
                 } else {
                     throw new Exception("That track doesn't match any walks. Check that it doesn't contain anything other than the walk.");
                 }
             }
         } else {
             throw new Exception("The track you uploaded is not a valid GPX file. If your track is in another format, please convert it to GPX first, then upload it again.");
         }
         $view->display();
     } else {
         $route = unserialize(JFactory::getApplication()->getUserState("uploadedroute"));
         if ($route) {
             $route->save();
             // Set the distance on the WalkInstance, if it's not already set
             if (empty($wi->distance)) {
                 $wi->distance = $route->getDistance();
                 $wi->save();
             }
         } else {
             throw new Exception("There was an error while saving your track. You can try again in a while, or email us if that doesn't work.");
         }
         // Redirect to the specified page after saving
         $itemid = JRequest::getInt('returnPage');
         if (empty($itemid)) {
             return false;
         }
         $item = JFactory::getApplication()->getMenu()->getItem($itemid);
         $link = new JURI("/" . $item->route);
         // Jump to the event?
         if (JRequest::getBool('jumpToEvent')) {
             $link->setFragment("walk_" . $wi->id);
         }
         JFactory::getApplication()->redirect($link, "Track saved");
     }
 }
开发者ID:SheffieldWalkingGroup,项目名称:swgwebsite,代码行数:76,代码来源:uploadtrack.php


注:本文中的JURI::setFragment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。