function display($tpl = null) { // Assign data to the view $this->events = $this->get('Events'); $this->protocolReminders = $this->get('ProtocolReminders'); // Check for errors. if (count($errors = $this->get('Errors'))) { JError::raiseError(500, implode('<br />', $errors)); return false; } $document = JFactory::getDocument(); $this->mapJS($document); $totalEvents = $this->get('NumEvents'); $apiParams = json_encode($this->get('ApiParams')); $userID = Jfactory::getUser()->id; $canRecordAttendance = SWG_EventsController::canRecordAttendance() ? 'true' : 'false'; $document->addScript('/components/com_swg_events/views/eventlisting/script/eventlisting.js'); $document->addScriptDeclaration(<<<MAP window.addEvent('domready', function() { \tregisterMapLinks(); \tdocument.addEvent("scroll",scrolled); \ttotalEvents = {$totalEvents}; \tapiParams = {$apiParams}; \tcanRecordAttendance = {$canRecordAttendance}; \tuserID = {$userID}; }); MAP ); // Display the view parent::display($tpl); }
/** * Retrieve the Twitter connection details for the current user * @return array */ function _lookupUserLogin() { global $mainframe; $user =& Jfactory::getUser(); if ($user->id) { // make sure there is a logged in user $btuser =& JTable::getInstance('btuser'); $data = $this->getUser($user->id); $key = str_rot13(strrev($user->username)); $crypt = new JSimpleCrypt($key); $password = $crypt->decrypt($data->password); return array('username' => $data->username, 'password' => $password); } else { return array('username' => '', 'password' => ''); } }
/** * Returns a reference to the global User object, only creating it if it * doesn't already exist. * * This method must be invoked as: * <pre> $user =& JUser::getInstance($id);</pre> * * @access public * @param int $id The user to load - Can be an integer or string - If string, it is converted to ID automatically. * @return JUser The User object. * @since 1.5 */ function &getInstance($id = 0) { static $instances; if (!isset($instances)) { $instances = array(); } // Find the user id if (!$id) { $user =& Jfactory::getUser(); $id = $user->get('id'); } if (empty($instances[$id])) { $inst = new UserAcl($id); $instances[$id] = $inst; } return $instances[$id]; }
/** * Creates the output * * @since 0.5 * @param int $tpl */ function display($tpl = null) { $params = JComponentHelper::getParams('com_redevent'); if (!$params->get('enable_moreinfo', 1)) { echo Jtext::_('COM_REDEVENT_MOREINFO_ERROR_DISABLED_BY_ADMIN'); return; } if ($this->getLayout() == 'final') { return $this->_displayFinal($tpl); } $xref = JRequest::getInt('xref'); $uri =& JFactory::getUri(); $document = JFactory::getDocument(); $user =& Jfactory::getUser(); if (!$xref) { echo JText::_('COM_REDEVENT_MOREINFO_ERROR_MISSING_XREF'); } $document->addStyleSheet($this->baseurl . '/components/com_redevent/assets/css/moreinfo.css'); $this->assign('xref', $xref); $this->assign('action', JRoute::_(RedeventHelperRoute::getMoreInfoRoute($xref))); $this->assignRef('user', $user); parent::display($tpl); }
/** * add form */ public function add() { $user = Jfactory::getUser(); $db = JFactory::getDBO(); JSession::checkToken('get') or die('Invalid Token'); $this->getState(); $this->saveState(); $model = $this->getModel($this->modelName); $item = $model->getItem(0); $item->termek_id = JRequest::getVar('termek_id'); $item->user_id = $user->id; $item->user_name = $user->username; if ($this->actionAccess('INSERT', $item) == false) { $this->message->txt = JText::_('ACCESS_DENIED'); $this->message->class = 'alert-error'; $this->browser(); } $form =& JForm::getInstance($this->browserName, JPATH_COMPONENT . '/models/forms/' . $this->formName . '.xml', array('control' => 'jform')); $form->bind($item); $this->formAccess($form); $this->itemAccess($item); if ($item) { $view = $this->getView($this->browserName, 'html'); $view->set('title', JText::_($this->lngPre . '_ADD')); $view->set('state', $this->state); $view->set('item', $item); $view->set('form', $form); $view->set('message', $this->message); $view->termek = $model->getTermek($item->termek_id); $buttons = array(array('varhatok.save', 'okbtn', JText::_('OK'), false), array('termekek.browser', 'cancelbtn', JText::_('CANCEL'), true)); $view->set('buttons', $buttons); $view->setLayout('form'); $view->display(); } else { $this->message->txt = JText::_($this->lngPre . '_DATA_NOT_FOUND'); $this->message->class = 'alert-error'; $this->browser(); } }
* modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ // No direct access to this file defined('_JEXEC') or die('Restricted access'); $user = Jfactory::getUser(); ?> <style type="text/css"> #txtEmpresa, #txtEmailProf, select[name="cBoxTipoEmp"]{ margin-bottom:10px; padding: 2px; width:100%; max-width: 400px;} .prof_extraopt2 { margin-left:20px;} input[type="submit"]{ background: #5ea561 none repeat scroll 0% 0%;
/** * Loads and caches events of a specified type * Can only load 100 events at a time to avoid slowdowns - more will be loaded as a 'bottomless page' type thing * @param int $eventType Event type - see SWG constants */ private function loadEvents($eventType) { // Get the parameters set $factory = SWG::eventFactory($eventType); $startDate = $this->paramDateToValue(JRequest::getInt("startDateType"), JRequest::getString("startDateSpecify")); $endDate = $this->paramDateToValue(JRequest::getInt("endDateType"), JRequest::getString("endDateSpecify")); $factory->reset(); // Set specific factory parameters if ($eventType == Event::TypeSocial) { $factory->getNormal = true; $factory->getNewMember = true; } if ($eventType == Event::TypeWalk) { if (JRequest::getInt("walkProgramme") != 0) { switch (JRequest::getInt("walkProgramme")) { case 1: // Current published $factory->walkProgramme = WalkProgramme::getCurrentProgrammeID(); break; case 2: $factory->walkProgramme = WalkProgramme::getNextProgrammeID(); break; case 3: // Specify $factory->walkProgramme = JRequest::getInt("walkProgrammeSpecify"); break; } } } // Set standard/shared factory parameters $factory->startDate = $startDate; $factory->endDate = $endDate; $factory->limit = 100; $factory->offset = JRequest::getInt("offset", 0); $factory->reverse = JRequest::getBool("order"); $factory->showUnpublished = JRequest::getBool("unpublished", false); $factory->includeAttendees = true; $factory->includeAttendedBy = Jfactory::getUser()->id; if (JRequest::getBool("diaryMode", false)) { // Default is the current logged in user. // TODO: Allow view access to other people's diaries $factory->addAttendee(JFactory::getUser()->id); } // Get events from factories switch ($eventType) { case Event::TypeWalk: $this->numWalks = $factory->numEvents(); $this->walks = $factory->get(); break; case Event::TypeSocial: $this->numSocials = $factory->numEvents(); $this->socials = $factory->get(); break; case Event::TypeWeekend: $this->numWeekends = $factory->numEvents(); $this->weekends = $factory->get(); break; } }
function getUserPoints($cms_user_id = null, $mode = 'all') { $ret = 0; if ($mode == 'all') { $ret = array(); } if ($mode == 'aup' || $mode == 'all' && $this->getAUP()) { if ($mode == 'aup' && !$this->getAUP(true)) { return false; } if ($cms_user_id === null) { $user = Jfactory::getUser(); $cms_user_id = $user->id; } $userInfo = AlphaUserPointsHelper::getUserInfo('', $cms_user_id); if ($mode == 'aup') { return (int) $userInfo->points; } $ret['aup'] = (int) $userInfo->points; } if ($cms_user_id === null) { $user = hikashop_loadUser(true); } else { $userClass = hikashop_get('class.user'); $user = $userClass->get($cms_user_id, 'cms'); } if ($mode == 'hk') { if (isset($user->user_points) || $user != null && in_array('user_points', array_keys(get_object_vars($user)))) { return (int) @$user->user_points; } return false; } if (isset($user->user_points) || $user != null && in_array('user_points', array_keys(get_object_vars($user)))) { if ($mode == 'all') { $ret['hk'] = (int) @$user->user_points; } else { $ret = (int) @$user->user_points; } } return $ret; }
?> <p> <a href="/api/route?walkinstanceid=<?php echo $event->id; ?> &format=gpx" title="Download this walk in GPX format for a computer or GPS device">Download route</a> </p> <?php } ?> <?php } ?> <?php if ($this->eventInPast($event)) { $attended = $event->wasAttendedBy(Jfactory::getUser()->id); ?> <?php if (SWG_EventsController::canSeeAttendanceCount() && $event->numAttendees > 0) { // TODO: Add attendees & tickbox to past events on bottomless page ?> <p><?php echo $event->numAttendees; if ($event->numAttendees == 1) { ?> person<?php } else { ?> people<?php } ?>