AAAAhome/academiac/www/administrator/components/com_xmap/controllers/sitemaps.php 0000604 00000004110 15145256104 0023756 0 ustar 00 registerTask('unpublish', 'publish');
$this->registerTask('trash', 'publish');
$this->registerTask('unfeatured', 'featured');
}
/**
* Method to toggle the default sitemap.
*
* @return void
* @since 2.0
*/
function setDefault()
{
// Check for request forgeries
JRequest::checkToken() or die('Invalid Token');
// Get items to publish from the request.
$cid = JRequest::getVar('cid', 0, '', 'array');
$id = @$cid[0];
if (!$id) {
JError::raiseWarning(500, JText::_('Select an item to set as default'));
}
else
{
// Get the model.
$model = $this->getModel();
// Publish the items.
if (!$model->setDefault($id)) {
JError::raiseWarning(500, $model->getError());
}
}
$this->setRedirect('index.php?option=com_xmap&view=sitemaps');
}
/**
* Proxy for getModel.
*
* @param string $name The name of the model.
* @param string $prefix The prefix for the PHP class name.
*
* @return JModel
* @since 2.0
*/
public function getModel($name = 'Sitemap', $prefix = 'XmapModel', $config = array('ignore_request' => true))
{
$model = parent::getModel($name, $prefix, $config);
return $model;
}
} home/academiac/www/administrator/components/com_xmap/models/sitemaps.php 0000604 00000013570 15145263260 0022706 0 ustar 00 context .= '.'.$layout;
}
$access = $this->getUserStateFromRequest($this->context.'.filter.access', 'filter_access', 0, 'int');
$this->setState('filter.access', $access);
$published = $this->getUserStateFromRequest($this->context.'.filter.published', 'filter_published', '');
$this->setState('filter.published', $published);
$search = $this->getUserStateFromRequest($this->context.'.filter.search', 'filter_search');
$this->setState('filter.search', $search);
// List state information.
parent::populateState('a.title', 'asc');
}
/**
* Method to get a store id based on model configuration state.
*
* This is necessary because the model is used by the component and
* different modules that might need different sets of data or different
* ordering requirements.
*
* @param string $id A prefix for the store id.
*
* @return string A store id.
*/
protected function getStoreId($id = '')
{
// Compile the store id.
$id .= ':'.$this->getState('filter.search');
$id .= ':'.$this->getState('filter.access');
$id .= ':'.$this->getState('filter.published');
return parent::getStoreId($id);
}
/**
* @param boolean True to join selected foreign information
*
* @return string
*/
protected function getListQuery($resolveFKs = true)
{
$db = $this->getDbo();
// Create a new query object.
$query = $db->getQuery(true);
// Select the required fields from the table.
$query->select(
$this->getState(
'list.select',
'a.*')
);
$query->from('#__xmap_sitemap AS a');
// Join over the asset groups.
$query->select('ag.title AS access_level');
$query->join('LEFT', '#__viewlevels AS ag ON ag.id = a.access');
// Filter by access level.
if ($access = $this->getState('filter.access')) {
$query->where('a.access = ' . (int) $access);
}
// Filter by published state
$published = $this->getState('filter.published');
if (is_numeric($published)) {
$query->where('a.state = ' . (int) $published);
} else if ($published === '') {
$query->where('(a.state = 0 OR a.state = 1)');
}
// Filter by search in title.
$search = $this->getState('filter.search');
if (!empty($search)) {
if (stripos($search, 'id:') === 0) {
$query->where('a.id = '.(int) substr($search, 3));
}
else {
$search = $db->Quote('%'.$db->escape($search, true).'%');
$query->where('(a.title LIKE '.$search.' OR a.alias LIKE '.$search.')');
}
}
// Add the list ordering clause.
$query->order($db->escape($this->state->get('list.ordering', 'a.title')) . ' ' . $db->escape($this->state->get('list.direction', 'ASC')));
//echo nl2br(str_replace('#__','jos_',$query));
return $query;
}
public function getExtensionsMessage()
{
$db = $this->getDbo();
$query = $db->getQuery(true);
$query->select('e.*');
$query->from($db->quoteName('#__extensions'). 'AS e');
$query->join('INNER', '#__extensions AS p ON e.element=p.element and p.enabled=0 and p.type=\'plugin\' and p.folder=\'xmap\'');
$query->where('e.type=\'component\' and e.enabled=1');
$db->setQuery($query);
$extensions = $db->loadObjectList();
if ( count($extensions) ) {
$sep = $extensionsNameList = '';
foreach ($extensions as $extension) {
$extensionsNameList .= "$sep$extension->element";
$sep = ', ';
}
return JText::sprintf('XMAP_MESSAGE_EXTENSIONS_DISABLED',$extensionsNameList);
} else {
return "";
}
}
}
home/academiac/www/administrator/components/com_xmap/models/fields/modal/sitemaps.php 0000604 00000006102 15147560504 0025244 0 ustar 00 value) {
$db->setQuery(
'SELECT title' .
' FROM #__xmap_sitemap' .
' WHERE id = ' . (int) $this->value
);
$title = $db->loadResult();
if ($error = $db->getErrorMsg()) {
JError::raiseWarning(500, $error);
}
} else {
$title = '';
}
if (empty($title)) {
$title = JText::_('COM_XMAP_SELECT_AN_SITEMAP');
}
$doc->addScriptDeclaration(
"function jSelectSitemap_" . $this->id . "(id, title, object) {
$('" . $this->id . "_id').value = id;
$('" . $this->id . "_name').value = title;
SqueezeBox.close();
}"
);
$link = 'index.php?option=com_xmap&view=sitemaps&layout=modal&tmpl=component&function=jSelectSitemap_' . $this->id;
JHTML::_('behavior.modal', 'a.modal');
$html = '';
$html .= "\n" . '';
if(version_compare(JVERSION,'3.0.0','ge'))
$html .= ' ' . JText::_('COM_XMAP_CHANGE_SITEMAP_BUTTON') . '' . "\n";
else
$html .= '' . "\n";
$html .= '';
$html .= "\n" . '';
return $html;
}
}