Exemple #1
0
 public static function getRSS()
 {
     $data = array();
     $id = Tree::getIdTreeByModule('news');
     $sql = 'SELECT * FROM {{tree}} WHERE parent=' . $id . ' AND visible=1 ORDER BY udate DESC LIMIT 0,10';
     $list = DB::getAll($sql);
     foreach ($list as $item) {
         $field = Fields::getFieldsByTree($item['id']);
         $data[] = array('id' => $item['id'], 'name' => trim(strip_tags($item['name'])), 'preview' => strip_tags($field['preview']), 'path' => 'http:://' . $_SERVER['HTTP_HOST'] . '/about/news/' . $item['id'] . '/', 'udate' => date("D, d M Y H:i:s O", strtotime($item['udate'])));
     }
     return array('list' => $data);
 }
Exemple #2
0
 function ask()
 {
     if ($_POST) {
         $tree = Tree::getIdTreeByModule('faq');
         $model = new Faq();
         if ($model->ask($tree) === true) {
             $this->redirect('/faq/thanks/');
             View::render('faq/ask', $tree);
         }
     } else {
         $tree = Tree::getTreeByUrl('wide');
         Funcs::setMeta($tree);
         $tree['rubrics'] = Faq::getRubricsTree($tree['parent']);
         View::render('faq/ask', $tree);
     }
 }
Exemple #3
0
    public function getRubricsTree($tree)
    {
        $data = array();
        $parent = Tree::getIdTreeByModule('faq');
        $sql = '
			SELECT * FROM {{tree}}
			WHERE parent=' . $parent . ' AND visible=1 AND path<>\'ask\' AND path<>\'thanks\'
			ORDER BY num
		';
        $list = DB::getAll($sql);
        foreach ($list as $item) {
            $countAll = 0;
            if (Funcs::$uri[1] == '' || Funcs::$uri[1] == 'ask' || Funcs::$uri[1] != '' && $tree == $item['id'] && Funcs::$uri[1] != 'ask') {
                $items = Faq::getRecurs($item['id']);
                $data[] = array('id' => $item['id'], 'name' => $item['name'], 'path' => $item['path'], 'sub' => $items['sub'], 'count' => $countAll);
            }
        }
        return $data;
    }
Exemple #4
0
 function run()
 {
     $id = Tree::getIdTreeByModule('news');
     $list = News::getList($id, 5);
     View::widget('news', array('list' => $list));
 }