public static function GetInstance($table_name = 'category', $sulg = 'category') { if (!isset(self::$instance)) { self::$instance = new self($table_name, $sulg); } return self::$instance; }
require './libs/Smarty.class.php'; require './libs/TDatabasePDO.php'; $pdbc = new TModel('topic', 'topic_'); $model = new TModel('topic', 'topic_'); require_once './libs/TMagicFunctions.php'; require_once './inc/fnc.php'; $smarty = new Smarty(); $smarty->caching = 0; $smarty->template_dir = './soh3il/template/'; $smarty->compile_dir = './soh3il/compile/'; $smarty->config_dir = './soh3il/config/'; $smarty->cache_dir = './soh3il/cash/'; //$smarty->debugging = true; $reg = TRegistry::GetInstance(); $title = $reg->GetValue(ROOT_SYSTEM, 'title'); $footer = $reg->GetValue(ROOT_SYSTEM, 'footer'); $links = $reg->GetValue(ROOT_SYSTEM, 'links'); $smarty->assign('footer', $footer); $smarty->assign('links', $links); $cat = TCategory::GetInstance(); $smarty->assign('cat_list', $cat->CategoryUL()); $menu = new TDropDownMenu(); $tmp = $menu->DropDownUL(); $smarty->assign('menu', $tmp); $smarty->assign('memberz', GetCount('member')); $smarty->assign('likez', GetCount('relation', ' typ = 4 ')); $smarty->assign('frnz', GetCount('relation', ' typ = 5 ')); $smarty->assign('topiczz', GetCount('topic', ' topic_status > 0 ')); $smarty->assign('stopic', GetCount('topic', ' topic_status = 2 ')); $smarty->assign('comment', GetCount('comment')); $smarty->assign('rtag', TagRandom());
</div> <div class="grd-secondary" style="padding:1em;"> <input id="id" type="hidden" value="<?php echo $this->record['topic_id']; ?> " /> <div class="category"> <h3> دسته بندی </h3> <div class="nice_scroll"> <?php $cat = new TCategory(); echo $cat->GetCategories($this->record['topic_id']); ?> </div> <input type="hidden" name="category[]" value="0" /> </div> <div> <h3> برچسب ها </h3> <input class="tags" value="<?php echo $this->tags; ?> " data-ajax="<?php echo UR_MP;
/** * retrun dropdown menu in ordered list * @param int $parent start parent id * @return string */ public function DropDownUL($parent = 0) { global $database_handle; $this->db = $database_handle; // Pre hook _hk('P' . ':' . __CLASS__ . ':' . __FUNCTION__, $this, $parent); if ($parent != 0) { $result = '<ul>'; } else { $result = null; } // get drop down by parent $item_list = $this->DropDownByParent($parent, $mode = 0, $lnk = ''); // and show this in the each foreach ($item_list as $record) { $mod = $record['dropdown_mode']; switch ($mod) { case 0: $link = $record['dropdown_link']; break; case 1: $link = UR_BASE . 'یادداشت' . '/' . $record['dropdown_link']; break; case 2: $link = UR_BASE . 'برچسب' . '/' . $record['dropdown_link']; break; default: $link = UR_BASE . 'سرفصل' . '/' . $record['dropdown_link']; break; } $result .= '<li data-id="' . $record[$this->table_name . '_id'] . '" ' . '> <a href="' . $link . '">'; $result .= $record[$this->table_name . '_title'] . '</a>'; // get the child of them if ($mod == 4) { $result .= '<ul>'; $splt = explode('/', $record['dropdown_link']); $splt = (int) $splt[0]; echo $splt; if ($splt > 0) { $cat = TCategory::GetInstance(); $cats = $cat->CategoryByParent($splt); foreach ($cats as $itm) { $link = UR_BASE . 'سرفصل' . '/' . $itm['category_id'] . '/' . $itm['category_title']; $result .= '<li> <a href="' . $link . '">' . $itm['category_title'] . '</a></li>'; } } $result .= '</ul>'; } $result .= $this->DropDownUL($record[$this->table_name . '_id'], $mod, $record['dropdown_link']); $result .= '</li>' . PHP_EOL; } if ($parent != 0) { $result .= '</ul>' . PHP_EOL; } // result hook _hk('R' . ':' . __CLASS__ . ':' . __FUNCTION__, $this, $result); return $result; }
function __construct() { parent::__construct('category'); }