Hi Francisco José.
Finally I have adapt the code that you were raising in your post some time ago in order that my K2 calendar shows the children categories, but now I have a problem: when I click on the date in the calendar it jumps to a blank page. I am not a programmer and I don´t know what could be the reason, please could you (or someone) help me?
The code I have introduced in helper.php after replace itemlist.php is:
function getDateLink($day, $month, $year) {
$mainframe = JFactory::getApplication();
$user = JFactory::getUser();
$aid = $user->get('aid');
$db = JFactory::getDBO();
$jnow = JFactory::getDate();
$now = K2_JVERSION == '15' ? $jnow->toMySQL() : $jnow->toSql();
$nullDate = $db->getNullDate();
$languageCheck = '';
if (K2_JVERSION != '15')
{
$accessCheck = " access IN(".implode(',', $user->getAuthorisedViewLevels()).") ";
if ($mainframe->getLanguageFilter())
{
$languageTag = JFactory::getLanguage()->getTag();
$languageCheck = " AND language IN (".$db->Quote($languageTag).", ".$db->Quote('*').") ";
}
}
else
{
$accessCheck = " access <= {$aid}";
}
$query = "SELECT COUNT(*) FROM #__k2_items WHERE YEAR(created)={$year} AND MONTH(created)={$month} AND DAY (created)={$day} AND published=1 AND ( publish_up = ".$db->Quote($nullDate)." OR publish_up <= ".$db->Quote($now)." ) AND ( publish_down = ".$db->Quote($nullDate)." OR publish_down >= ".$db->Quote($now)." ) AND trash=0 AND {$accessCheck}
{$languageCheck} AND EXISTS(SELECT * FROM #__k2_categories WHERE id= #__k2_items.catid AND published=1 AND trash=0 AND
{$accessCheck} {$languageCheck})";
$catid = $this->category;
if ($catid > 0)
$categories = modK2ToolsHelper::getCategoryChildren($catid);
$categories[] = $catid;
$categories = @array_unique($categories);
$sql = @implode(',', $categories);
$query .= " AND catid IN ({$sql})";
$db->setQuery($query);
$result = $db->loadResult();
if ($db->getErrorNum())
{
echo $db->stderr();
return false;
}
if ($result > 0)
{
if ($catid > 0)
return JRoute::_(K2HelperRoute::getDateRoute($year, $month, $day, $catid));
else
return JRoute::_(K2HelperRoute::getDateRoute($year, $month, $day));
}
else
{
return false;
}
}
My K2 version is 2.6.5 and inks on dates are like this: .../joomla/index.php/component/k2/itemlist/date/2013/2/4?catid=115 and "catid" changes in consecutive numbers (115=February, 116 = March, etc ...)...
Thanks!
Helena
(Por fin he conseguido adaptar el código que planteabas en tu post de hace tiempo para que mi K2 calendar muestre las subcategorías, pero ahora tengo un problema y es que al pulsar sobre la fecha en el calendario me salta a una página en blanco. No soy programadora y no sé a qué se debe, ¿me puedes ayudar?
El código que he introducido en helper.php después de modificar el archivo itemlist.php es:
....
....
Mi versión de K2 es la 2.6.5 y el tipo de enlace que me sale en las fechas es: .../joomla/index.php/component/k2/itemlist/date/2013/2/4?catid=115 donde "catid" cambia por meses en números consecutivos (115=February, 116 = March, etc ...)...
Gracias!)