r); $i++) {
$naviUnit[] = $this->r[$i];
}
$naviUnit[] = $tog;
} else {
$naviUnit[] = array(
0 => $mplugin->_getScatNameFromID($subcatid),
1 => createCategoryLink($catid, array($subrequest => $subcatid)),
// 1 => createCategoryLink($catid, array('subcatid' => $subcatid)),
// 1 => createBlogidLink($blogid, $this->linkparams),
2 => createArchiveListLink($blogid, $this->linkparams)
);
}
}
}
}
//store Page ===================================== todo How to get PageNo. ? ...cookie...
if (intRequestVar('page') != 0) {
$naviUnit[] = array(
0 => 'Page.' . intRequestVar('page'),
2 => createArchiveListLink($blogid, $this->linkparams)
);
}
//store Item =====================================
if ($skinType == 'item') {
$item =& $manager->getItem($itemid, 0, 0);
$naviUnit[] = array(
0 => $item['title']
);
$query = 'SELECT i.ititle, i.inumber'
. ' FROM ' . sql_table('item') . ' as i' . $mtable
. ' WHERE i.idraft = 0'
. " and i.itime < '" . $item['itime'] . "' " . $where
. ' ORDER BY i.itime DESC';
$res = sql_query($query);
if ($ares = mysql_fetch_row($res)) {
$alink = createItemLink($ares[1], $this->linkparams);
$subNaviUnit[1] = ' ' . $prevLabel . ' '
. shorten($ares[0], 14, '...')
. '';
}
$query = 'SELECT i.ititle, i.inumber'
. ' FROM ' . sql_table('item') . ' as i' . $mtable
. ' WHERE i.idraft = 0'
. " and i.itime > '" . $item['itime'] . "' " . $where
. ' ORDER BY i.itime ASC';
$res = sql_query($query);
if ($ares = mysql_fetch_row($res)) {
$alink = createItemLink($ares[1], $this->linkparams);
$subNaviUnit[2] = ' '
. shorten($ares[0], 14, '...')
. ' ' . $nextLabel . '';
}
}
//store ArchiveList =====================================
if ($skinType == 'archivelist' || $skinType == 'archive') {
$naviUnit[] = array(
0 => $this->getOption('archivelinkLabel'),
// 0 => 'ArchiveList',
1 => createArchiveListLink($blogid, $this->linkparams)
);
}
if ($skinType == 'archive') {
sscanf($archive,'%d-%d-%d', $y, $m, $d);
//store ArchiveMonth
$archiveMonth = $y . '-' . $m;
$naviUnit[] = array(
0 => $archiveMonth,
1 => createArchiveLink($blogid, $archiveMonth, $this->linkparams)
);
if (empty($d)) {
$timestamp_start = mktime(0, 0, 0, $m, 1, $y);
$timestamp_end = mktime(0, 0, 0, $m+1, 1, $y);
$date_str = 'SUBSTRING(i.itime, 1, 7)';
} else {
$timestamp_start = mktime(0, 0, 0, $m, $d, $y);
$timestamp_end = mktime(0, 0, 0, $m, $d+1, $y);
$date_str = 'SUBSTRING(i.itime, 1, 10)';
//store ArchiveDay
$naviUnit[] = array(
0 => $y . '-' . $m . '-' . $d,
1 => createArchiveLink($blogid, $archive, $this->linkparams)
);
}
//=============================
$query = 'SELECT ' . $date_str . ' as Date'
. ' FROM ' . sql_table('item') . ' as i' . $mtable
. ' WHERE i.idraft = 0'
. ' and i.itime < ' . mysqldate($timestamp_start) . $where
. ' GROUP BY Date'
. ' ORDER BY i.itime DESC';
$res = sql_query($query);
if ($ares = mysql_fetch_row($res)) {
// $prev_date = $ares[0];
sscanf($ares[0], '%d-%d-%d', $y, $m, $d);
if (empty($d)) {
$prev_date = sprintf('%04d-%02d', $y, $m);
} else {
$prev_date = sprintf('%04d-%02d-%02d', $y, $m, $d);
}
$prev_alink = createArchiveLink($blogid, $prev_date, $this->linkparams);
$subNaviUnit[1] = ''
. ' ' . $prevLabel . ' '
. htmlspecialchars($prev_date, ENT_QUOTES, _CHARSET)
. '';
// $abuf .= ''.$prev_date.'';
// } else {
// $today_link = createBlogidLink($b->getID(), $this->linkparams);
// $abuf .= ' ( Today )';
}
$abuf .= ' | ' . htmlspecialchars($archive, ENT_QUOTES, _CHARSET) . ' ';
//=============================
$query = 'SELECT ' . $date_str . ' as Date'
. ' FROM ' . sql_table('item') . ' as i' . $mtable
. ' WHERE i.idraft = 0'
. ' and i.itime < ' . mysqldate($b->getCorrectTime())
. ' and i.itime >= ' . mysqldate($timestamp_end) . $where
. ' GROUP BY Date'
. ' ORDER BY i.itime ASC';
$res = sql_query($query);
if ($ares = mysql_fetch_row($res)) {
// $next_date = $ares[0];
sscanf($ares[0],'%d-%d-%d', $y, $m, $d);
if (empty($d)) {
$next_date = sprintf('%04d-%02d', $y, $m);
} else {
$next_date = sprintf('%04d-%02d-%02d', $y, $m, $d);
}
$next_alink = createArchiveLink($blogid, $next_date, $this->linkparams);
$subNaviUnit[2] = ''
. htmlspecialchars($next_date, ENT_QUOTES, _CHARSET)
. ' ' . $nextLabel . '';
// $a2buf = ' | '.$next_date.'';
// } else {
// $today_link = createBlogidLink($b->getID(), $this->linkparams);
// $a2buf .= ' | ( Today )';
}
}
//============================= // end of archive(s)
// Print subNavi
// todo Henceforth to template
// echo ' ';
// echo '
';
// echo ' ';
$endKey = $this->scanEndKey($naviUnit);
// if ($skinType != 'archivelist' && $skinType != 'archive' && $skinType != 'item') {
// echo '» ArchiveList';
// }
// echo @join(' :: ', $subNaviUnit);
// echo ' ';
// echo '';
///
/*
<%subnavi%> --> prev. and next link
<%archivedata%> --> ArchiveList link
*/
$subNaviData['subnavi'] = implode($this->getOption('PNSeparator'), $subNaviUnit);
if ($skinType != 'archivelist' && $skinType != 'archive' && $skinType != 'item') {
if (!empty($naviUnit)) {
$subNaviData['archivedata'] .= '' . $this->getOption('archivelinkLabel') . '';
}
}
$subnaviTemplate = $this->getOption('subnaviTemplate');
$navigateData['subnaviblock'] = TEMPLATE::fill($subnaviTemplate, $subNaviData);
// echo TEMPLATE::fill($subnaviTemplate, $subNaviData);
//*/
// Print mainNavi
unset($naviUnit[$endKey][1]);
$naviVar = array_map(array(&$this, 'createNaviLink'), $naviUnit);
// echo '', @join(' > ', $naviVar);
$topicPathData['topicpath'] = implode($this->getOption('topicPathSeparator'), $naviVar);
//add Taginfo =====================================
// display selected TAGs whith link mod by shizuki
if ($manager->pluginInstalled('NP_TagEX')) {
// if (requestVar('tag')) {
$tagPlugin =& $manager->getPlugin('NP_TagEX');
$requestT = $tagPlugin->getNoDecodeQuery('tag');
if (!empty($requestT)) {
$requestTarray = $tagPlugin->splitRequestTags($requestT);
$reqAND = array_map(array(&$tagPlugin, "_rawdecode"), $requestTarray['and']);
if ($requestTarray['or']) {
$reqOR = array_map(array(&$tagPlugin, "_rawdecode"), $requestTarray['or']);
}
if ($reqOR) {
$reqTags = array_merge($reqAND, $reqOR);
} else {
$reqTags = $reqAND;
}
for ($i=0;$i'
. htmlspecialchars($tag, ENT_QUOTES, _CHARSET) . '';
}
// echo ' ';
// echo ' (Tag for "'.$tagPlugin->_rawdecode(requestVar('tag')).'")';
// echo ' (Tag for "' . @join(' / ', $taglist) . '")';
// echo '';
/*
<%tags%> --> selected TAGs with own link
*/
$tagsData['tags'] = implode(' / ', $taglist);
$tagListTemplate = $this->getOption('tagListTemplate');
$topicPathData['taglist'] = TEMPLATE::fill($tagListTemplate, $tagsData);
//*/
}
}
/*
<%topicpath%> --> topicpath
<%taglist%> --> selected TAG list
*/
$topicPathTemplate = $this->getOption('topicPathTemplate');
$navigateData['topicpathblock'] = TEMPLATE::fill($topicPathTemplate, $topicPathData);
// echo TEMPLATE::fill($topicPathTemplate, $topicPathData);
$navigateBlockTemplate = $this->getOption('ItemNaviTemplate');
/*
<%subnaviblock%>
<%topicpathblock%>
*/
echo TEMPLATE::fill($navigateBlockTemplate, $navigateData);
//*/
// echo '';
}
function getParenta($subcat_id, $blogid=0)
{
$subcat_id = intval($subcat_id);
$blogid = intval($blogid);
$r = array();
$que = 'SELECT scatid, parentid, sname, catid FROM %s WHERE scatid = %d';
$que = sprintf($que, sql_table('plug_multiple_categories_sub'), $subcat_id);
$res = sql_query($que);
list ($sid, $parent, $sname, $cat_id) = mysql_fetch_row($res);
if (intval($parent) != 0) {
$this->r[] = $this->getParenta(intval($parent), $blogid);
$this->linkparams[subcatid] = $sid;
$r = array(
0 => $sname,
1 => createBlogidLink($blogid, $this->linkparams),
2 => createArchiveListLink($blogid, $this->linkparams)
);
} else {
$this->linkparams[subcatid] = $sid;
$r = array(
0 => $sname,
1 => createBlogidLink($blogid, $this->linkparams),
2 => createArchiveListLink($blogid, $this->linkparams)
);
}
return $r;
}
function getParent($subcat_id)
{
$subcat_id = intval($subcat_id);
$que = 'SELECT scatid, parentid, sname FROM %s WHERE scatid = %d';
$que = sprintf($que, sql_table('plug_multiple_categories_sub'), $subcat_id);
$res = sql_query($que);
list ($sid, $parent, $sname) = mysql_fetch_row($res);
if (intval($parent) != 0) {
$r = $this->getParent(intval($parent)) . " -> $sname";
} else {
$r = "" . htmlspecialchars($sname) . "";
}
return $r;
}
function getChildren($subcat_id)
{
$subcat_id = intval($subcat_id);
$que = 'SELECT scatid, parentid, sname FROM %s WHERE parentid = %d';
$que = sprintf($que, sql_table('plug_multiple_categories_sub'), $subcat_id);
$res = sql_query($que);
while ($so = mysql_fetch_object($res)) {
$r .= $this->getChildren($so->scatid) . '/' . intval($so->scatid);
}
return $r;
}
function install()
{
// include language file for this plugin
$language = ereg_replace( '[\\|/]', '', getLanguageName());
if (file_exists($this->getDirectory() . $language . '.php')) {
include_once($this->getDirectory() . $language . '.php');
} else {
include_once($this->getDirectory() . 'english.php');
}
$sub = '<%archivedata%><%subnavi%>
';
$path = '<%topicpath%><%taglist%>
';
$tags = ' (Selected TAG(s) : <%tags%>)';
$navi = '<%subnaviblock%><%topicpathblock%>
';
$this->createOption('subnaviTemplate', _INEXOP_SUB, 'text', $sub);
$this->createOption('PNSeparator', _INEXOP_PNSP, 'tect', ' :: ');
$this->createOption('PNNextLabel', _INEXOP_PNNX, 'tect', '»');
$this->createOption('PNPrevLabel', _INEXOP_PNPR, 'tect', '«');
$this->createOption('topicPathTemplate', _INEXOP_PATH, 'text', $path);
$this->createOption('topicPathSeparator', _INEXOP_PSEP, 'text', ' > ');
$this->createOption('tagListTemplate', _INEXOP_TAGS, 'text', $tags);
$this->createOption('ItemNaviTemplate', _INEXOP_NAVI, 'text', $navi);
$this->createOption('archivelinkLabel', _INEXOP_ALBL, 'text', '» ArchiveList');
}
}