public function getCategoryPath($category_id, $generateLinks = true, $separator = ' » ') { App::uses('Category', 'Model'); $Category = new Category(); $path = $Category->getPath($category_id); $out = array(); foreach ($path as $step) { $tmp = $step['Category']['name']; if ($generateLinks) { $tmp = $this->Html->link($step['Category']['name'], "/{$step['Category']['slug']}-{$step['Category']['id']}", array('title' => $step['Category']['title'], 'escape' => false)); } $out[] = $tmp; } return implode($separator, $out); }
// Middle row // --> <div class="content product-menu-content"> <h1 class="align-center"><?php echo $objCategory->TitleHeading; ?> </h1> <h3 class="align-center"><?php echo $objCategory->SubtitleHeading; ?> </h3> <div class="menu-option"> <div class="option col-sm-6"> <a data-id="/<?php echo $objCategory->getPath() . $objCategory->ExploreAllActiveImageUrl; ?> " href="items.php" class="icon-mousedown"> <img src="/<?php echo $objCategory->getPath() . $objCategory->ExploreAllImageUrl; ?> " alt=""><br> <span>All <?php echo $objCategory->CategoryName; ?> </span> </a> </div> <div class="option col-sm-6"> <a data-id="/<?php echo $objCategory->getPath() . $objCategory->TechnologyActiveImageUrl;
/** * Get the path to this category * * @param array $path The starting path * * @return array The calculated path * * @since 2.0 */ public function getPath($path = array()) { $path[] = $this->id; if ($this->_parent != null) { $path = $this->_parent->getPath($path); } return $path; }
/** * generateXHTMLFile() * * This function generates a plain XHTML file with all entries. * * @return boolean * @access public * @author Thorsten Rinne <*****@*****.**> * @since 2004-11-13 */ function generateXHTMLFile() { global $db, $PMF_CONF, $PMF_LANG; $tree = new Category(); $tree->transform(0); $old = 0; $result = $db->query('SELECT ' . SQLPREFIX . 'faqdata.id AS id, ' . SQLPREFIX . 'faqdata.lang AS lang, ' . SQLPREFIX . 'faqdata.solution_id AS solution_id, ' . SQLPREFIX . 'faqdata.revision_id AS revision_id, ' . SQLPREFIX . 'faqcategoryrelations.category_id AS category_id, ' . SQLPREFIX . 'faqdata.keywords AS keywords, ' . SQLPREFIX . 'faqdata.thema AS thema, ' . SQLPREFIX . 'faqdata.content AS content, ' . SQLPREFIX . 'faqdata.author AS author, ' . SQLPREFIX . 'faqdata.datum AS datum FROM ' . SQLPREFIX . 'faqdata LEFT JOIN ' . SQLPREFIX . 'faqcategoryrelations ON ' . SQLPREFIX . 'faqdata.id = ' . SQLPREFIX . 'faqcategoryrelations.record_id AND ' . SQLPREFIX . 'faqdata.lang = ' . SQLPREFIX . 'faqcategoryrelations.record_lang ORDER BY ' . SQLPREFIX . 'faqcategoryrelations.category_id, ' . SQLPREFIX . 'faqdata.id'); $xhtml = '<?xml version="1.0" encoding="' . $PMF_LANG['metaCharset'] . '" ?>'; $xhtml .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">'; $xhtml .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="' . $PMF_LANG['metaLanguage'] . '" lang="' . $PMF_LANG['metaLanguage'] . '">'; $xhtml .= '<head>'; $xhtml .= ' <title>' . $PMF_CONF['title'] . '</title>'; $xhtml .= ' <meta http-equiv="Content-Type" content="application/xhtml+xml; charset=' . $PMF_LANG['metaCharset'] . '" />'; $xhtml .= ' <meta name="title" content="' . $PMF_CONF['title'] . '" />'; $xhtml .= '</head>'; $xhtml .= '<body dir="' . $PMF_LANG['dir'] . '">'; if ($db->num_rows($result) > 0) { while ($row = $db->fetch_object($result)) { if ($row->category_id != $old) { $xhtml .= '<h1>' . $tree->getPath($row->category_id) . '</h1>'; } $xhtml .= '<h2>' . $row->thema . '</h2>'; $xhtml .= '<p>' . $row->content . '</p>'; $xhtml .= '<p>' . $PMF_LANG["msgAuthor"] . $row->author . '<br />'; $xhtml .= 'ID: ' . $row->solution_id . '<br />'; $xhtml .= $PMF_LANG['ad_entry_revision'] . ': 1.' . $row->revision_id . '<br />'; $xhtml .= $PMF_LANG["msgLastUpdateArticle"] . makeDate($row->datum) . '</p>'; $xhtml .= '<hr style="width: 90%;" />'; $old = $row->category_id; } } $xhtml .= '</body>'; $xhtml .= '</html>'; if ($fp = fopen("../xml/phpmyfaq.html", "w")) { fputs($fp, $xhtml); fclose($fp); } }
// Insert the new category relations foreach ($rubrik as $categories) { $db->query("INSERT INTO " . SQLPREFIX . "faqcategoryrelations VALUES (" . $categories . ", '" . $lang . "', " . $nextID . ", '" . $lang . "')"); } print $PMF_LANG["ad_entry_savedsuc"]; } else { print $PMF_LANG["ad_entry_savedfail"] . $db->error(); } } elseif (isset($submit[2]) && isset($_POST["thema"]) && $_POST["thema"] != "" && isset($_POST['rubrik']) && is_array($_POST['rubrik'])) { // Preview $rubrik = $_POST["rubrik"]; $cat = new Category(); $cat->transform(0); $categorylist = ''; foreach ($rubrik as $categories) { $categorylist .= $cat->getPath($categories) . '<br />'; } if (isset($_REQUEST["id"]) && $_REQUEST["id"] != "") { $id = $_REQUEST["id"]; } else { $id = ""; } $content = $_POST['content']; ?> <h3><strong><em><?php print $categorylist; ?> </em> <?php print $_POST["thema"]; ?>
} $catInfo .= ')'; if ($cid != $old) { if ($old == 0) { ?> <!--<a name="cat_<?php print $cid; ?> " />--><div class="categorylisting"><a href="#cat_<?php print $cid; ?> " onclick="showhideCategory('category_<?php print $cid; ?> ');"><img src="../images/more.gif" width="11" height="11" alt="" /> <?php print $tree->getPath($cid); ?> </a><?php print $catInfo; ?> </div> <div id="category_<?php print $cid; ?> " class="categorybox" style="display: none;"> <table class="listrecords"> <?php } else { ?> </table> </div>
/** * 查看相册 */ public function action_list() { if (ORM::factory('user')->check_space($this->auth['uid'])) { } else { $this->checkSpace(); //空间验证 } $this->_add_script('scripts/copy.js'); $this->_add_script('scripts/wal8/menu.js'); $this->template->pageTitle = '查看相册'; ORM::factory('user')->upcache($this->auth['uid']); $this->template->num = $num = $this->getQuery('num', 20); $select = DB::select('cate.cate_id', 'cate.cate_name', 'cate.index_img', 'cate.img_num', 'cate.is_share', 'cate.type', 'cate.index_img_id')->from(array('img_categories', 'cate'))->where('uid', '=', (int) $this->auth['uid']); $select2 = DB::select('i.id', 'i.cate_id', 'i.picname', 'i.custom_name', 'i.disk_id', 'i.userid', 'i.click', 'i.is_share', 'i.disk_name', array('i.disk_id', 'disk_domain'))->from(array('imgs', 'i'))->where('i.userid', '=', (int) $this->auth['uid']); $this->template->order_by = $order_by = trim($this->getQuery('order_by')); if (!empty($order_by)) { $select2->order_by('i.id', $order_by); } $this->template->cate_id = $cate_id = (int) $this->getQuery('cate_id'); $this->template->recycle = $recycle = (int) $this->getQuery('recycle'); $this->template->keyword = $keyword = trim($this->getQuery('keyword')); $this->template->type = $type = trim($this->getQuery('search_type')); if ($cate_id > 0) { $select->where('cate.parent_id', '=', $cate_id); $select2->where('i.cate_id', '=', (int) $cate_id)->where('i.recycle', '=', 0); } else { if ($recycle) { $select2->where('i.recycle', '=', '1'); $select->where('cate.cate_name', '=', null); } else { $select2->where('i.recycle', '=', 0); if (empty($keyword)) { $select2->where('i.cate_id', '=', 0); } $select->where('cate.parent_id', '=', 0); } } if (!empty($keyword)) { if ($type == 1) { $select->where('cate.cate_name', 'like', "%{$keyword}%"); if ($cate_id <= 0) { $select2->where('i.cate_id', '=', (int) $keyword); } } else { $select->where('cate.cate_name', '=', null); $select2->where('i.custom_name', 'like', "%{$keyword}%"); } } $this->template->order_by = $order_by = trim($this->getQuery('order_by', 'DESC')); if (!empty($order_by)) { $select->order_by('cate.cate_id', $order_by); $select2->order_by('i.id', $order_by); } $this->template->pic_num = $pic_num = $select2->count_all(); $this->template->cate_num = $cate_num = $select->count_all(); $pageNum = $pic_num + $cate_num; // 显示分页链接(图片+分类的) $this->template->pagination = $pagination = Pagination::factory(array('total_items' => $pageNum, 'items_per_page' => $num)); // 分类结果 $this->template->results = $results = $select->limit($pagination->items_per_page)->offset($pagination->offset)->execute(); //需要显示多少张图片, 每页显示数-当前显示目录数 $piclimit = $pagination->items_per_page - count($results->as_array()); if ($piclimit > 0) { //图片从几条数据取起 $offset = $pagination->offset - $cate_num; if ($offset < 0) { $offset = 0; } $select2 = $select2->limit($piclimit)->offset($offset); $this->template->rootresults = $select2->execute(); } // 图片分类列表 $this->template->cate_list = $cate_list = DB::select('cate_name', 'cate_id', 'path')->from('img_categories')->where('uid', '=', $this->auth['uid'])->fetch_all(); $arr = array(); if ($cate_id > 0) { $cate = new Category(); $path = $cate->getPath($cate_id); $path = explode(';', $path); foreach ($path as $value) { if (!empty($value)) { $info = $cate->infoSql($value)->execute()->current(); $arr[$value] = $info['cate_name']; } } $this->template->cateInfo = $cateInfo = $cate->infoSql($cate_id)->execute()->current(); } $this->template->arr = $arr; }