本文整理汇总了PHP中JemHelper::globalattribs方法的典型用法代码示例。如果您正苦于以下问题:PHP JemHelper::globalattribs方法的具体用法?PHP JemHelper::globalattribs怎么用?PHP JemHelper::globalattribs使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JemHelper
的用法示例。
在下文中一共展示了JemHelper::globalattribs方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: display
/**
* Creates the output for the event view
*/
function display($tpl = null)
{
$settings = JemHelper::globalattribs();
// check iCal global setting
if ($settings->get('global_show_ical_icon','0')==1) {
// Get data from the model
$row = $this->get('Item');
if (empty($row)) {
return;
}
$row->categories = $this->get('Categories');
$row->id = $row->did;
$row->slug = $row->alias ? ($row->id.':'.$row->alias) : $row->id;
$params = $row->params;
// check individual iCal Event setting
if ($params->get('event_show_ical_icon',1)) {
// initiate new CALENDAR
$vcal = JemHelper::getCalendarTool();
$vcal->setConfig( "filename", "event".$row->did.".ics" );
JemHelper::icalAddEvent($vcal, $row);
// generate and redirect output to user browser
$vcal->returnCalendar();
} else {
return;
}
} else {
return;
}
}
示例2: display
/**
* Creates the output for the Venue view
*/
function display($tpl = null)
{
$settings = JemHelper::config();
$settings2 = JemHelper::globalattribs();
$app = JFactory::getApplication();
$jinput = JFactory::getApplication()->input;
if ($settings2->get('global_show_ical_icon', '0') == 1) {
// Get data from the model
$model = $this->getModel();
$model->setLimit($settings->ical_max_items);
$model->setLimitstart(0);
$rows = $model->getItems();
$venueid = $jinput->getInt('id');
// initiate new CALENDAR
$vcal = JemHelper::getCalendarTool();
// $vcal->setProperty('unique_id', 'category'.$catid.'@'.$mainframe->getCfg('sitename'));
$vcal->setConfig("filename", "venue" . $venueid . ".ics");
foreach ($rows as $row) {
JemHelper::icalAddEvent($vcal, $row, $rows);
}
// generate and redirect output to user browser
$vcal->returnCalendar();
} else {
return;
}
}
示例3: getGroups
/**
* Method to get the time zone field option groups.
*
* @return array The field option objects as a nested array in groups.
*/
protected function getGroups()
{
$settings = JemHelper::globalattribs();
$globalTz = $settings->get('global_timezone');
$groups = array();
$keyField = !empty($this->keyField) ? $this->keyField : 'id';
$keyValue = $this->form->getValue($keyField);
$view = $this->element['view'];
// If the timezone is not set use the server setting.
if (strlen($this->value) == 0 && empty($keyValue)) {
# we didn't select A timezone so we'll take a look at the server setting.
# are we in settings-view?
if ($view == 'venue') {
# check if there is a setting filled
if ($globalTz) {
$this->value = $globalTz;
} else {
# there is no global value so check the the server setting
$serverTz = JFactory::getConfig()->get('offset');
# UTC is seen as Abidjan and that's not something we want
if ($serverTz == 'UTC') {
$serverTz = 'Europe/Berlin';
// for the moment it's been set to this
}
$this->value = $serverTz;
}
}
}
// Get the list of time zones from the server.
$zones = DateTimeZone::listIdentifiers();
// Build the group lists.
foreach ($zones as $zone) {
// Time zones not in a group we will ignore.
if (strpos($zone, '/') === false) {
continue;
}
// Get the group/locale from the timezone.
list($group, $locale) = explode('/', $zone, 2);
// Only use known groups.
if (in_array($group, self::$zones)) {
// Initialize the group if necessary.
if (!isset($groups[$group])) {
$groups[$group] = array();
}
// Only add options where a locale exists.
if (!empty($locale)) {
$groups[$group][$zone] = JHtml::_('select.option', $zone, str_replace('_', ' ', $locale), 'value', 'text', false);
}
}
}
// Sort the group lists.
ksort($groups);
foreach ($groups as &$location) {
sort($location);
}
// Merge any additional groups in the XML definition.
$groups = array_merge(parent::getGroups(), $groups);
return $groups;
}
示例4: display
/**
* Creates the Calendar View
*/
function display($tpl = null)
{
$app = JFactory::getApplication();
//initialize variables
$menu = $app->getMenu();
$menuitem = $menu->getActive();
$jemsettings = JemHelper::config();
$params = $app->getParams();
$settings = JemHelper::globalattribs();
// Load css
JemHelper::loadCss('calendar');
JemHelper::loadCss('jem');
JemHelper::loadCustomCss();
JemHelper::loadCustomTag();
$evlinkcolor = $params->get('eventlinkcolor');
$evbackgroundcolor = $params->get('eventbackgroundcolor');
$currentdaycolor = $params->get('currentdaycolor');
$eventandmorecolor = $params->get('eventandmorecolor');
$style = '
div[id^=\'catz\'] a {color:' . $evlinkcolor . ';}
div[id^=\'catz\'] {background-color:' . $evbackgroundcolor . ';}
.eventcontent {background-color:' . $evbackgroundcolor . ';}
.eventandmore {background-color:' . $eventandmorecolor . ';}
.today .daynum {background-color:' . $currentdaycolor . ';}';
$this->document->addStyleDeclaration($style);
// add javascript (using full path - see issue #590)
JHtml::_('script', 'media/com_jem/js/calendar.js');
$rows = $this->get('Items');
$currentweek = $this->get('Currentweek');
$currentyear = Date("Y");
$showweeknr = $params->get('showweeknr', true);
//Set Page title
$pagetitle = $params->def('page_title', $menuitem->title);
$params->def('page_heading', $pagetitle);
$pageclass_sfx = $params->get('pageclass_sfx');
// Add site name to title if param is set
if ($app->getCfg('sitename_pagetitles', 0) == 1) {
$pagetitle = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $pagetitle);
} elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
$pagetitle = JText::sprintf('JPAGETITLE', $pagetitle, $app->getCfg('sitename'));
}
$this->document->setTitle($pagetitle);
$this->document->setMetaData('title', $pagetitle);
$cal = new activeCalendarWeek($currentyear, 1, 1);
$cal->enableWeekNum(JText::_('COM_JEM_WKCAL_WEEK'), null, '', $showweeknr);
// enables week number column with linkable week numbers
$cal->setFirstWeekDay($params->get('firstweekday', 0));
$this->rows = $rows;
$this->params = $params;
$this->jemsettings = $jemsettings;
$this->settings = $settings;
$this->currentweek = $currentweek;
$this->cal = $cal;
$this->pageclass_sfx = htmlspecialchars($pageclass_sfx);
parent::display($tpl);
}
示例5: __construct
/**
* Constructor
*
* @param object &$subject The object to observe
* @param array $config An array that holds the plugin configuration
*
*/
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
$this->loadLanguage();
$app = JFactory::getApplication();
$jemsettings = JemHelper::globalattribs();
$this->_SiteName = $app->getCfg('sitename');
$this->_MailFrom = $app->getCfg('mailfrom');
$this->_FromName = $app->getCfg('fromname');
$this->_AdminDBList = self::Adminlist();
$this->_UseLoginName = !$jemsettings->get('global_regname', 1);
// regname == 1: name, 0: username (login name)
}
示例6: getItem
/**
* Method to get venue data.
*
* @param integer The id of the venue.
* @return mixed item data object on success, false on failure.
*/
public function getItem($itemId = null)
{
$jemsettings = JEMHelper::config();
// Initialise variables.
$itemId = (int) (!empty($itemId)) ? $itemId : $this->getState('venue.id');
// Get a row instance.
$table = $this->getTable();
// Attempt to load the row.
$return = $table->load($itemId);
// Check for a table object error.
if ($return === false && $table->getError()) {
$this->setError($table->getError());
return false;
}
$properties = $table->getProperties(1);
$value = JArrayHelper::toObject($properties, 'JObject');
// Convert attrib field to Registry.
//$registry = new JRegistry();
//$registry->loadString($value->attribs);
$globalregistry = JemHelper::globalattribs();
$value->params = clone $globalregistry;
//$value->params->merge($registry);
// Compute selected asset permissions.
$user = JemFactory::getUser();
// Check edit permission.
$value->params->set('access-edit', $user->can('edit', 'venue', $value->id, $value->created_by));
// Check edit state permission.
$value->params->set('access-change', $user->can('publish', 'venue', $value->id, $value->created_by));
$value->author_ip = $jemsettings->storeip ? JemHelper::retrieveIP() : false;
$files = JemAttachment::getAttachments('venue' . $itemId);
$value->attachments = $files;
if (empty($itemId)) {
$value->country = $jemsettings->defaultCountry;
}
return $value;
}
示例7: display
public function display($tpl = null)
{
// Initialise variables.
$this->form = $this->get('Form');
$this->item = $this->get('Item');
$this->state = $this->get('State');
// Check for errors.
if (count($errors = $this->get('Errors'))) {
JError::raiseError(500, implode("\n", $errors));
return false;
}
// initialise variables
$document = JFactory::getDocument();
$app = JFactory::getApplication();
$jinput = $app->input;
$this->settings = JEMAdmin::config();
$this->settings2 = JemHelper::globalattribs();
$task = $jinput->getCmd('task');
$this->task = $task;
# load css
JHtml::_('stylesheet', 'com_jem/backend.css', array(), true);
# load js
//JHtml::_('behavior.framework'); //mootools
JHtml::_('script', 'com_jem/attachments.js', false, true);
//$document->addScript('http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js');
$this->access = JEMHelper::getAccesslevelOptions();
# retrieve mapType setting
$settings = JemHelper::globalattribs();
$mapType = $settings->get('mapType', '0');
switch ($mapType) {
case '0':
$type = '"roadmap"';
break;
case '1':
$type = '"satellite"';
break;
case '2':
$type = '"hybrid"';
break;
case '3':
$type = '"terrain"';
break;
}
$this->mapType = $type;
//JHtml::_('jquery.framework');
JHtml::_('script', 'com_jem/slider-state.js', false, true);
$this->addToolbar();
parent::display($tpl);
}
示例8: display
//.........这里部分代码省略.........
$partVenid = ($venueID > 0) ? '&id=' . $venueID : '';
$partLocid = ($venueID > 0) ? '&locid=' . $venueID : '';
$partDate = ($year ? ('&yearID=' . $year) : '') . ($month ? ('&monthID=' . $month) : '');
$url_base = 'index.php?option=com_jem&view=venue&layout=calendar' . $partVenid . $partItemid;
$print_link = JRoute::_($url_base . $partDate . '&print=1&tmpl=component');
// init calendar
$cal = new JEMCalendar($year, $month, 0);
$cal->enableMonthNav($url_base . ($print ? '&print=1&tmpl=component' : ''));
$cal->setFirstWeekDay($params->get('firstweekday',1));
$cal->enableDayLinks('index.php?option=com_jem&view=day'.$partLocid);
// map variables
$this->rows = $rows;
$this->locid = $venueID;
$this->params = $params;
$this->jemsettings = $jemsettings;
$this->permissions = $permissions;
$this->cal = $cal;
$this->pageclass_sfx = htmlspecialchars($pageclass_sfx);
$this->print_link = $print_link;
} else
{
### Venue List view ###
// initialize variables
$app = JFactory::getApplication();
$document = JFactory::getDocument();
$menu = $app->getMenu();
$menuitem = $menu->getActive();
$jemsettings = JemHelper::config();
$settings = JemHelper::globalattribs();
$params = $app->getParams('com_jem');
$pathway = $app->getPathWay ();
$uri = JFactory::getURI();
$jinput = $app->input;
$task = $jinput->getCmd('task', '');
$print = $jinput->getBool('print', false);
$user = JemFactory::getUser();
$itemid = $app->input->getInt('id', 0) . ':' . $app->input->getInt('Itemid', 0);
// Load css
JemHelper::loadCss('jem');
JemHelper::loadCustomCss();
JemHelper::loadCustomTag();
if ($print) {
JemHelper::loadCss('print');
$document->setMetaData('robots', 'noindex, nofollow');
}
// get data from model
$rows = $this->get('Items');
$venue = $this->get('Venue');
// check for data error
if (empty($venue)) {
$app->enqueueMessage(JText::_('COM_JEM_VENUE_ERROR_VENUE_NOT_FOUND'), 'error');
return false;
}
// are events available?
$noevents = (!$rows) ? 1 : 0;
示例9: getCategories
/**
* Retrieve Categories
*
* Due to multi-cat this function is needed
* filter-index (4) is pointing to the cats
*/
function getCategories($id)
{
$user = JemFactory::getUser();
$userid = (int) $user->get('id');
$levels = $user->getAuthorisedViewLevels();
$app = JFactory::getApplication();
$params = $app->getParams();
$catswitch = $params->get('categoryswitch', '0');
$settings = JemHelper::globalattribs();
// Query
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$case_when_c = ' CASE WHEN ';
$case_when_c .= $query->charLength('c.alias');
$case_when_c .= ' THEN ';
$id_c = $query->castAsChar('c.id');
$case_when_c .= $query->concatenate(array($id_c, 'c.alias'), ':');
$case_when_c .= ' ELSE ';
$case_when_c .= $id_c.' END as catslug';
$query->select(array('DISTINCT c.id','c.catname','c.access','c.checked_out AS cchecked_out','c.color',$case_when_c));
$query->from('#__jem_categories as c');
$query->join('LEFT', '#__jem_cats_event_relations AS rel ON rel.catid = c.id');
$query->select(array('a.id AS multi'));
$query->join('LEFT','#__jem_events AS a ON a.id = rel.itemid');
if ($id != 'all'){
$query->where('rel.itemid ='.(int)$id);
}
$query->where('c.published = 1');
###################
## FILTER-ACCESS ##
###################
# Filter by access level.
###################################
## FILTER - MAINTAINER/JEM GROUP ##
###################################
# as maintainter someone who is registered can see a category that has special rights
# let's see if the user has access to this category.
// $query3 = $db->getQuery(true);
// $query3 = 'SELECT gr.id'
// . ' FROM #__jem_groups AS gr'
// . ' LEFT JOIN #__jem_groupmembers AS g ON g.group_id = gr.id'
// . ' WHERE g.member = ' . (int) $user->get('id')
// // . ' AND ' .$db->quoteName('gr.addevent') . ' = 1 '
// . ' AND g.member NOT LIKE 0';
// $db->setQuery($query3);
// $groupnumber = $db->loadColumn();
// $jemgroups = implode(',',$groupnumber);
// JEM groups doesn't overrule view access levels!
// if ($jemgroups) {
// $query->where('(c.access IN ('.$groups.') OR c.groupid IN ('.$jemgroups.'))');
// } else {
$query->where('(c.access IN ('.implode(',', $levels).'))');
// }
#######################
## FILTER - CATEGORY ##
#######################
# set filter for top_category
$top_cat = $this->getState('filter.category_top');
if ($top_cat) {
$query->where($top_cat);
}
# Filter by a single or group of categories.
$categoryId = $this->getState('filter.category_id');
if (is_numeric($categoryId)) {
$type = $this->getState('filter.category_id.include', true) ? '= ' : '<> ';
$query->where('c.id '.$type.(int) $categoryId);
}
elseif (is_array($categoryId) && count($categoryId)) {
JArrayHelper::toInteger($categoryId);
$categoryId = implode(',', $categoryId);
$type = $this->getState('filter.category_id.include', true) ? 'IN' : 'NOT IN';
$query->where('c.id '.$type.' ('.$categoryId.')');
//.........这里部分代码省略.........
示例10: rmObsImages
/**
* Remove images
*/
function rmObsImages()
{
$settings = JemHelper::globalattribs();
$trash_path = $settings->get('trashedimages_path', '/trashedimages');
$trash_folder = JPATH_SITE . $trash_path;
$trash_foldersmall = JPATH_SITE . $trash_path . '/small';
if (JFolder::exists($trash_folder)) {
$files = JFolder::files($trash_folder, $filter = '.', false, true, array('index.html'));
if ($files) {
JFile::delete($files);
}
}
if (JFolder::exists($trash_foldersmall)) {
$files = JFolder::files($trash_foldersmall, $filter = '.', false, true, array('index.html'));
if ($files) {
JFile::delete($files);
}
}
return;
}
示例11: populateState
/**
* Method to auto-populate the model state.
*/
protected function populateState($ordering = null, $direction = null)
{
// Initiliase variables.
$app = JFactory::getApplication('site');
$jemsettings = JemHelper::config();
$settings = JemHelper::globalattribs();
$jinput = JFactory::getApplication()->input;
$task = $jinput->getCmd('task');
$itemid = $jinput->getInt('id', 0) . ':' . $jinput->getInt('Itemid', 0);
$pk = $jinput->getInt('id');
$this->setState('category.id', $pk);
$this->setState('filter.req_catid', $pk);
$global = new JRegistry();
$global->loadString($settings);
$params = clone $global;
$params->merge($global);
if ($menu = $app->getMenu()->getActive()) {
$params->merge($menu->params);
}
$this->setState('params', $params);
$user = JFactory::getUser();
// Create a new query object.
$db = $this->getDbo();
$query = $db->getQuery(true);
$groups = implode(',', $user->getAuthorisedViewLevels());
# limit/start
$limit = $app->getUserStateFromRequest('com_jem.category.' . $itemid . '.limit', 'limit', $jemsettings->display_num, 'uint');
$this->setState('list.limit', $limit);
$limitstart = $app->input->get('limitstart', 0, 'uint');
$this->setState('list.start', $limitstart);
# Search - variables
$search = $app->getUserStateFromRequest('com_jem.category.' . $itemid . '.filter_search', 'filter_search', '', 'string');
$this->setState('filter.filter_search', $search);
$filtertype = $app->getUserStateFromRequest('com_jem.category.' . $itemid . '.filter_type', 'filter_type', '', 'int');
$this->setState('filter.filter_type', $filtertype);
# publish state
if ($task == 'archive') {
$this->setState('filter.published', 2);
} else {
# we've to check if the setting for the filter has been applied
if ($params->get('global_show_archive_icon')) {
$this->setState('filter.published', 1);
} else {
# retrieve the status to be displayed
switch ($params->get('global_show_eventstatus')) {
case 0:
$status = 1;
break;
case 1:
$status = 2;
break;
case 2:
$status = array(1, 2);
break;
default:
$status = 1;
}
$this->setState('filter.published', $status);
}
}
###############
## opendates ##
###############
$this->setState('filter.opendates', $params->get('showopendates', 0));
###########
## ORDER ##
###########
# retrieve default sortDirection + sortColumn
$sortDir = strtoupper($params->get('sortDirection'));
$sortDirArchive = strtoupper($params->get('sortDirectionArchive'));
$sortCol = $params->get('sortColumn');
$direction = array('DESC', 'ASC');
if (!in_array($sortCol, $this->filter_fields)) {
$sortCol = 'a.dates';
}
if (!in_array($sortDir, $direction)) {
$sortDir = 'ASC';
}
if (!in_array($sortDirArchive, $direction)) {
$sortDirArchive = 'DESC';
}
$filter_order = $app->getUserStateFromRequest('com_jem.category.' . $itemid . '.filter_order', 'filter_order', $sortCol, 'cmd');
$filter_order_DirDefault = $sortDir;
// Reverse default order for dates in archive mode
if ($task == 'archive' && $filter_order == 'a.dates') {
$filter_order_DirDefault = $sortDirArchive;
}
$filter_order_Dir = $app->getUserStateFromRequest('com_jem.category.' . $itemid . '.filter_order_Dir', 'filter_order_Dir', $filter_order_DirDefault, 'word');
$filter_order = JFilterInput::getInstance()->clean($filter_order, 'string');
$filter_order_Dir = JFilterInput::getInstance()->clean($filter_order_Dir, 'string');
if ($filter_order == 'a.dates') {
$orderby = array('a.dates ' . $filter_order_Dir, 'a.times ' . $filter_order_Dir);
} else {
$orderby = $filter_order . ' ' . $filter_order_Dir;
}
$this->setState('filter.orderby', $orderby);
$this->setState('filter.access', true);
//.........这里部分代码省略.........
示例12: save
/**
* Method to save the form data.
*
* @param $data array
*/
public function save($data)
{
$date = JFactory::getDate();
$app = JFactory::getApplication();
$jinput = $app->input;
$user = JFactory::getUser();
$jemsettings = JEMHelper::config();
$settings = JemHelper::globalattribs();
$veditevent = JemHelper::viewSettings('veditevent');
$fileFilter = new JInput($_FILES);
$table = $this->getTable();
# Check if we're in the front or back
if ($app->isAdmin()) {
$backend = true;
} else {
$backend = false;
}
$cats = $data['cats'];
$data['author_ip'] = $jinput->getString('author_ip');
## Recurrence - check option ##
# if the option to hide the recurrence/other tab has been set (front) then
# we should ignore the recurrence variables.
$option_othertab = $veditevent->get('editevent_show_othertab');
if ($option_othertab) {
$hide_othertab = false;
} else {
$hide_othertab = true;
}
if ($backend || $hide_othertab == false) {
##############
## HOLIDAYS ##
##############
if (isset($data['activated'])) {
if ($data['activated'] == null) {
$holidays = array();
} else {
$holidays = $data['activated'];
}
} else {
$holidays = array();
}
$countryholiday = $jinput->getInt('recurrence_country_holidays', '');
################
## RECURRENCE ##
################
# check if a startdate has been set
if (isset($data['dates'])) {
if ($data['dates'] == null) {
$dateSet = false;
} else {
$dateSet = true;
}
} else {
$dateSet = false;
}
if (!isset($data['recurrence_freq'])) {
$data['recurrence_freq'] = 0;
}
# implode weekday values
# @todo implement check to see if days have been selected in case of freq week
if (isset($data['recurrence_weekday'])) {
$data['recurrence_weekday'] = implode(',', $data['recurrence_weekday']);
}
# blank recurrence-fields
#
# if we don't have a startdate or a recurrence-type then
# the recurrence-fields within the event-table will be blanked.
#
# but the recurrence_group field will stay filled as it's not removed by the user.
if (empty($data['dates']) || $data['recurrence_freq'] == '0') {
$data['recurrence_count'] = '';
$data['recurrence_freq'] = '';
$data['recurrence_interval'] = '';
$data['recurrence_until'] = '';
$data['recurrence_weekday'] = '';
$data['recurrence_exdates'] = '';
}
# the exdates are not stored in the event-table but they are trown in an variable
if (isset($data['recurrence_exdates'])) {
$exdates = $data['recurrence_exdates'];
} else {
$exdates = false;
}
}
# parent-Save
if (parent::save($data)) {
// At this point we do have an id.
$pk = $this->getState($this->getName() . '.id');
if (isset($data['featured'])) {
$this->featured($pk, $data['featured']);
}
$checkAttachName = $jinput->post->get('attach-name', '', 'array');
if ($checkAttachName) {
# attachments, new ones first
$attachments = array();
//.........这里部分代码省略.........
示例13: getCategories
/**
* Retrieve Categories
*
* Due to multi-cat this function is needed
* filter-index (4) is pointing to the cats
*/
function getCategories($id)
{
$user = JFactory::getUser();
$levels = $user->getAuthorisedViewLevels();
$app = JFactory::getApplication();
$settings = JemHelper::globalattribs();
# Query
$db = JFactory::getDBO();
$query = $db->getQuery(true);
$case_when_c = ' CASE WHEN ';
$case_when_c .= $query->charLength('c.alias');
$case_when_c .= ' THEN ';
$id_c = $query->castAsChar('c.id');
$case_when_c .= $query->concatenate(array($id_c, 'c.alias'), ':');
$case_when_c .= ' ELSE ';
$case_when_c .= $id_c . ' END as catslug';
$query->select(array('DISTINCT c.id', 'c.catname', 'c.access', 'c.path', 'c.checked_out AS cchecked_out', 'c.color', $case_when_c));
$query->from('#__jem_categories as c');
$query->join('LEFT', '#__jem_cats_event_relations AS rel ON rel.catid = c.id');
$query->select(array('a.id AS multi'));
$query->join('LEFT', '#__jem_events AS a ON a.id = rel.itemid');
$query->where('rel.itemid =' . (int) $id);
###################
## FILTER-ACCESS ##
###################
# Filter by access level.
$access = $this->getState('filter.access');
if ($access) {
$groups = implode(',', $user->getAuthorisedViewLevels());
$query->where('c.access IN (' . $groups . ')');
}
###################
## FILTER-SEARCH ##
###################
# define variables
$filter = $this->getState('filter.filtertype');
$search = $this->getState('filter.search');
if (!empty($search)) {
if (stripos($search, 'id:') === 0) {
$query->where('c.id = ' . (int) substr($search, 3));
} else {
$search = $db->Quote('%' . $db->escape($search, true) . '%');
if ($search) {
if ($filter == 4) {
$query->where('c.catname LIKE ' . $search);
}
}
}
}
$db->setQuery($query);
$cats = $db->loadObjectList();
return $cats;
}
示例14: validate_guest
/**
* validates guest rights
*/
static function validate_guest($option = false)
{
$user = JFactory::getUser();
$guest = $user->get('guest');
$settings = JemHelper::globalattribs();
if ($guest) {
# check if he global setting has been set
$addevent = $settings->get('guest_addevent', 0);
if (!$addevent) {
return false;
}
# then check if we have 1 of the antispam measures enabled
# if not then the guest is not allowed to submit events
$mathquiz = $settings->get('guest_as_math', 0);
$captcha = $settings->get('guest_as_captcha', 0);
if (!$mathquiz && !$captcha) {
return false;
}
return true;
}
}
示例15: formatSchemaOrgDateTime
static function formatSchemaOrgDateTime($dateStart, $timeStart, $dateEnd = "", $timeEnd = "")
{
$settings = JemHelper::globalattribs();
$output = "";
$formatD = "Y-m-d";
$formatT = "%H:%M";
if(JemHelper::isValidDate($dateStart)) {
$content = self::formatdate($dateStart, $formatD);
if($settings->get('global_show_timedetails','1') && $timeStart) {
$content .= 'T'.self::formattime($timeStart, $formatT, false);
}
$output .= '<meta itemprop="startDate" content="'.$content.'" />';
if(JemHelper::isValidDate($dateEnd)) {
$content = self::formatdate($dateEnd, $formatD);
if($settings->get('global_show_timedetails','1') && $timeEnd) {
$content .= 'T'.self::formattime($timeEnd, $formatT, false);
}
$output .= '<meta itemprop="endDate" content="'.$content.'" />';
}
} else {
// Open date
if($settings->get('global_show_timedetails','1')) {
if($timeStart) {
$content = self::formattime($timeStart, $formatT, false);
$output .= '<meta itemprop="startDate" content="'.$content.'" />';
}
// Display end time only when both times are set
if($timeStart && $timeEnd) {
$content .= self::formattime($timeEnd, $formatT, false);
$output .= '<meta itemprop="endDate" content="'.$content.'" />';
}
}
}
return $output;
}