Example #1
1
 function detail($title_none = NULL)
 {
     $cat_news_url = $this->uri->segment(1);
     $cat_news = new Newscatalogue();
     $cat_news->where(array('name_none' => $cat_news_url))->get();
     if (!$cat_news->exists()) {
         show_404();
     }
     $dis['cat_news'] = $cat_news;
     $cat = $this->uri->segment(2);
     $category = new Newscatalogue();
     $category->where(array('name_none' => $cat, 'parentcat_id' => $cat_news->id))->get();
     if (!$category->exists()) {
         show_404();
     }
     $dis['category'] = $category;
     $title_none = geturlfromuri($this->uri->segment(3));
     $news = new Article();
     $news->where(array('title_none' => $title_none, 'newscatalogue_id' => $category->id));
     $news->get();
     if (!$news->exists()) {
         redirect(base_url() . $this->uri->segment(1, '') . '/' . $this->uri->segment(2, ''));
         die;
     }
     $dis['news'] = $news;
     $tag = $news->tag;
     $dis['tag'] = explode(',', $tag);
     $news->view_count = $news->view_count + 1;
     $news->save();
     //related news
     $related_news = new Article();
     $related_news->where('recycle', 0);
     $related_news->where('newscatalogue_id', $news->newscatalogue_id);
     $related_news->where("id !=", $news->id);
     $related_news->order_by('created', 'DESC');
     $related_news->get_paged(0, 15, TRUE);
     $dis['related_news'] = $related_news;
     $arrayCateNewsId = array();
     foreach ($this->guideCate as $row) {
         $arrayCateNewsId[] = $row->id;
     }
     $arrayCateNewsId = array();
     foreach ($this->guideCate as $row) {
         $arrayCateNewsId[] = $row->id;
     }
     // get news view most
     $newViewMost = new Article();
     $newViewMost->where('recycle', 0);
     $newViewMost->where_in('newscatalogue_id', $arrayCateNewsId);
     $newViewMost->order_by('view_count', 'desc');
     $newViewMost->get(5);
     $dis['newViewMost'] = $newViewMost;
     // get news view most
     $newView = new Article();
     $newView->where('recycle', 0);
     $newView->where_in('newscatalogue_id', $arrayCateNewsId);
     $newView->order_by('created', 'desc');
     $newView->get(5);
     $dis['newView'] = $newView;
     $this->page_title = $news->{'title_vietnamese'} . ' | SotayNhadat.vn';
     $this->page_description = $news->short_vietnamese;
     $this->page_keyword = $news->tag;
     $this->url = base_url() . substr($this->uri->uri_string, 1, strlen($this->uri->uri_string));
     $this->isRobotFollow = 1;
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/guides/news_de';
     $this->viewfront($dis);
 }
Example #2
0
 public function loadCustomCssJs()
 {
     $managerUrl = $this->context->getOption('manager_url', MODX_MANAGER_URL, $this->modx->_userConfig);
     $articlesAssetsUrl = $this->modx->getOption('articles.assets_url', null, $this->modx->getOption('assets_url', null, MODX_ASSETS_URL) . 'components/articles/');
     $quipAssetsUrl = $this->modx->getOption('quip.assets_url', null, $this->modx->getOption('assets_url', null, MODX_ASSETS_URL) . 'components/quip/');
     $connectorUrl = $articlesAssetsUrl . 'connector.php';
     $articlesJsUrl = $articlesAssetsUrl . 'js/';
     $this->addJavascript($managerUrl . 'assets/modext/util/datetime.js');
     $this->addJavascript($managerUrl . 'assets/modext/widgets/element/modx.panel.tv.renders.js');
     $this->addJavascript($managerUrl . 'assets/modext/widgets/resource/modx.grid.resource.security.js');
     $this->addJavascript($managerUrl . 'assets/modext/widgets/resource/modx.panel.resource.tv.js');
     $this->addJavascript($managerUrl . 'assets/modext/widgets/resource/modx.panel.resource.js');
     $this->addJavascript($managerUrl . 'assets/modext/sections/resource/update.js');
     $this->addJavascript($articlesJsUrl . 'articles.js');
     $this->addJavascript($articlesJsUrl . 'extras/combo.js');
     $this->addJavascript($articlesJsUrl . 'extras/tagfield.js');
     $this->addCss($quipAssetsUrl . 'css/mgr.css');
     $this->addJavascript($quipAssetsUrl . 'js/quip.js');
     $this->addJavascript($quipAssetsUrl . 'js/widgets/comments.grid.js');
     $this->addHtml('<script type="text/javascript">
     Ext.onReady(function() {
         Quip.config = ' . $this->modx->toJSON(array()) . ';
         Quip.config.connector_url = "' . $quipAssetsUrl . 'connector.php";
         Quip.request = ' . $this->modx->toJSON($_GET) . ';
     });
     </script>');
     $this->addLastJavascript($articlesJsUrl . 'article/update.js');
     $this->addHtml('
     <script type="text/javascript">
     // <![CDATA[
     Articles.assets_url = "' . $articlesAssetsUrl . '";
     Articles.connector_url = "' . $connectorUrl . '";
     MODx.config.publish_document = "' . $this->canPublish . '";
     MODx.onDocFormRender = "' . $this->onDocFormRender . '";
     MODx.ctx = "' . $this->resource->get('context_key') . '";
     Ext.onReady(function() {
         MODx.load({
             xtype: "articles-page-article-update"
             ,resource: "' . $this->resource->get('id') . '"
             ,record: ' . $this->modx->toJSON($this->resourceArray) . '
             ,publish_document: "' . $this->canPublish . '"
             ,preview_url: "' . $this->previewUrl . '"
             ,locked: ' . ($this->locked ? 1 : 0) . '
             ,lockedText: "' . $this->lockedText . '"
             ,canSave: ' . ($this->canSave ? 1 : 0) . '
             ,canEdit: ' . ($this->canEdit ? 1 : 0) . '
             ,canCreate: ' . ($this->canCreate ? 1 : 0) . '
             ,canDuplicate: ' . ($this->canDuplicate ? 1 : 0) . '
             ,canDelete: ' . ($this->canDelete ? 1 : 0) . '
             ,show_tvs: ' . (!empty($this->tvCounts) ? 1 : 0) . '
             ,mode: "update"
         });
     });
     // ]]>
     </script>');
     /* load RTE */
     $this->loadRichTextEditor();
 }
Example #3
0
 public function test_multilingual_getting_an_specific_locale()
 {
     $Article = new Article();
     $this->assertTrue($Article =& $Article->findFirstBy('en_headline', 'New PHP Framework released'));
     $this->assertEqual($Article->get('excerpt_limit', 'en'), 7);
     $this->assertEqual($Article->get('excerpt_limit', 'es'), 3);
     $this->assertEqual($Article->getAttribute('excerpt_limit', 'en'), 7);
     $this->assertEqual($Article->getAttribute('excerpt_limit', 'es'), 3);
     $this->assertEqual($Article->get('headline', 'en'), 'New PHP Framework released');
     $this->assertEqual($Article->get('headline', 'es'), 'Se ha liberado un nuevo Framework para PHP');
     $this->assertEqual($Article->getAttribute('headline', 'en'), 'New PHP Framework released');
     $this->assertEqual($Article->getAttribute('headline', 'es'), 'Se ha liberado un nuevo Framework para PHP');
     $this->assertEqual($Article->get('headline'), 'New PHP Framework released');
     $this->assertEqual($Article->getAttribute('headline'), 'New PHP Framework released');
     $this->assertEqual($Article->getAttributeLocales('headline'), array('en' => 'New PHP Framework released', 'es' => 'Se ha liberado un nuevo Framework para PHP'));
 }
Example #4
0
 function detail($url)
 {
     $urlcat = $this->uri->segment(1);
     $category = new Newscatalogue();
     $category->where(array('recycle' => 0, 'name_none' => $urlcat))->get();
     if (!$category->exists()) {
         show_404();
     }
     $dis['category'] = $category;
     $url = geturlfromuri($this->uri->segment(2));
     $news = new Article();
     $news->where(array('title_none' => $url, 'recycle' => 0));
     $news->get();
     if (!$news->exists()) {
         show_404();
     }
     $dis['news'] = $news;
     $this->page_title = $news->title_vietnamese;
     $this->page_description = $news->short_vietnamese;
     $this->page_keyword = $news->tag;
     //related news
     $related_news = new Article();
     $related_news->where('recycle', 0);
     $related_news->where('newscatalogue_id', $news->newscatalogue_id);
     $related_news->where("id !=", $news->id);
     $related_news->order_by('created', 'DESC');
     $related_news->get_paged(0, 10, TRUE);
     $dis['related_news'] = $related_news;
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/newsother/news_de';
     $this->viewfront($dis);
 }
Example #5
0
 public function get($id = 0, $useCache = true)
 {
     if (!$id) {
         $id =& $this->id;
     }
     if ($useCache && ($cache = Cache::get($id))) {
         return $cache;
     }
     parent::get($id, !USE_CACHE);
     $this->photos = array();
     $i = 0;
     if (!is_array($this->files['photo'])) {
         return $this;
     }
     foreach ($this->files['photo'] as &$f) {
         $f->main =& Image::createThumbnail($f->name, $this->folder->config['imgWidth']);
         $f->thumb =& Image::createThumbnail($f->name, $this->folder->config['imgThumbWidth']);
         if (++$i == 1) {
             $f->fpthumb =& Image::createThumbnail($f->name, $this->folder->config['fpThumbWidth']);
         }
         $this->photos[] = $f;
     }
     if ($this->pub_on > 0) {
         Cache::set($id, $this);
     }
     return $this;
 }
Example #6
0
 function detail($title_none = NULL)
 {
     $title_none = $this->uri->segment(3);
     $arrTitle = explode('.', $title_none);
     if ($arrTitle[1] == '' || $arrTitle[1] != 'html') {
         redirect('');
     }
     $title_none = $arrTitle[0];
     $news = new Article();
     $news->where('title_none', $title_none);
     $news->get();
     //print_r($this->db->last_query());exit();
     if (!$news->exists()) {
         show_404();
     }
     $dis['news'] = $news;
     //related news
     $related_news = new Article();
     $related_news->where('recycle', 0);
     $related_news->where('newscatalogue_id', $news->newscatalogue_id);
     $related_news->where("id !=", $news->id);
     $related_news->order_by('created', 'DESC');
     $related_news->get_paged(0, 10, TRUE);
     $dis['related_news'] = $related_news;
     $category = new Newscatalogue($news->newscatalogue_id);
     $dis['category'] = $category;
     $this->page_title = $news->{'title_vietnamese'};
     $this->page_description = $news->short_vietnamese;
     $this->page_keyword = $news->tag;
     $dis['base_url'] = base_url();
     $dis['link'] = base_url() . $_SERVER['REQUEST_URI'];
     $dis['view'] = 'front/services/news_de';
     $this->viewfront($dis);
 }
 public function show(SS_HTTPRequest $request)
 {
     $article_ID = $request->param('ID');
     $article = Article::get()->byID($article_ID);
     if (!$article) {
         return $this->httpError(404, 'That article could not be found');
     }
     return array('Article' => $article, 'Title' => $article->Title);
 }
Example #8
0
function getNewsByCategory($categoryID)
{
    $CI =& get_instance();
    $cat_news = new Article();
    $cat_news->where(array('recycle' => 0));
    $cat_news->where('newscatalogue_id', $categoryID);
    $cat_news->order_by('created', 'desc');
    $cat_news->get(4);
    return $cat_news;
}
Example #9
0
 function index()
 {
     $articlecategories = new Articlecategory();
     $this->template->set('res_articlecategories', $articlecategories->get());
     $articles = new Article();
     $this->template->set('res_articles', $articles->get());
     $this->template->set('page_name', 'Artikel');
     $this->template->current_view = 'content/articles/home';
     $this->template->render();
 }
Example #10
0
 public function get($id = 0, $useCache = true)
 {
     if (!$id) {
         $id =& $this->id;
     }
     if ($useCache && ($cache = Cache::get($id))) {
         return $cache;
     }
     parent::get($id, false);
     $this->price = $this->getLastItem(PRICE);
     if ($this->pub_on > 0) {
         Cache::set($id, $this);
     }
     return $this;
 }
 public function manymany()
 {
     $article = Article::get()->first();
     $tags = $article->Tags();
     foreach ($tags as $tag) {
         $articles = $tag->Articles();
         $articles->toArray();
     }
     $content .= '$article = Article::get()->first(); <br>';
     $content .= '$tags = $article->Tags(); <br>';
     $content .= 'foreach ($tags as $tag) { <br>';
     $content .= '&nbsp;&nbsp;&nbsp; $articles = $tag->Articles(); <br>';
     $content .= '&nbsp;&nbsp;&nbsp; $articles->toArray();<br>';
     return $this->customise(new ArrayData(array('Title' => "Performance: {$this->dbType} many many", 'Content' => $content)))->renderWith(array('PerformanceController', 'AppController'));
 }
Example #12
0
 public function get($id = 0, $useCache = true)
 {
     if (!$id) {
         $id =& $this->id;
     }
     if ($useCache && ($cache = Cache::get($id))) {
         return $cache;
     }
     parent::get($id, false);
     $this->video = @array_shift($this->files['video']);
     $this->image = @array_shift($this->files['image']);
     if ($this->pub_on > 0) {
         Cache::set($id, $this);
     }
     return $this;
 }
Example #13
0
 public function get($id = 0, $useCache = true)
 {
     if ($useCache && ($cache = Cache::get($id))) {
         return $cache;
     }
     if (!$id) {
         $id =& $this->id;
     }
     parent::get($id, false);
     $this->question = $this->getLastItem(QUESTION);
     $this->answer = $this->getLastItem(ANSWER);
     $this->alias = $this->getLastItem(ALIAS);
     if ($this->pub_on > 0) {
         Cache::set($id, $this);
     }
     return $this;
 }
Example #14
0
 public function get($id = 0, $useCache = true)
 {
     $_SESSION['vote'] =& $_SERVER['REQUEST_TIME'];
     if (!$id) {
         $id =& $this->id;
     }
     if ($useCache && ($cache = Cache::get($id))) {
         return $cache;
     }
     parent::get($id, false);
     $res =& self::$dbh->query('SELECT id, name FROM poll_opt WHERE article_id=? ORDER BY id', array($this->id));
     while ($row =& $res->fetchRow()) {
         $k = $row['id'];
         $this->options[$k] = $row['name'];
     }
     if ($this->pub_on > 0) {
         Cache::set($id, $this);
     }
     return $this;
 }
 public function getMonth()
 {
     $key = "GENRE_TRENDS_MONTH_" . $this->genre;
     if (MEMCACHE) {
         $memcache = Zend_Registry::get('memcache');
         $popular = $memcache->get($key);
     }
     if (empty($popular)) {
         $popular = array_slice(Popular::genre('month', $this->genre, true), 0, 10);
         foreach ($popular as $i => $row) {
             $article = Article::get($row['post_id']);
             $popular[$i] = new ArticlePresenter($article[0]);
         }
         if (MEMCACHE) {
             if (count($popular) > 5) {
                 $memcache->set($key, $popular, 7200);
             }
         }
     }
     $this->view_data['month'] = $popular;
 }
 public function parseAlias(SimpleXMLElement $entry, Article $article)
 {
     $alias = '';
     foreach ($entry->link as $link) {
         if (!empty($link['rel']) && $link['rel'] == 'alternate') {
             $url = (string) $link['href'];
             $this->hrefMap[$url] = !$this->debug ? $article->get('id') : rand(1, 10000);
             $lastSlash = strpos(strrev($url), '/');
             $strLength = strlen($url);
             $lastPos = $strLength - $lastSlash;
             $alias = substr($url, $lastPos);
             $ext = pathinfo($alias, PATHINFO_EXTENSION);
             $alias = str_replace(array('.', $ext), '', $alias);
         }
     }
     if (empty($alias)) {
         $title = (string) $entry->title;
         $alias = $article->cleanAlias($title);
     }
     return $alias;
 }
Example #17
0
                        </a>
                    </div>
                </div>
                <?php 
    }
}
?>
            </div>
            <!-- end cotphainoibat-->
        </div>
        <?php 
foreach ($this->newsCate as $row) {
    $news = new Article();
    $news->where(array('recycle' => 0, 'newscatalogue_id' => $row->id));
    $news->order_by('id', 'desc');
    $news->get(5);
    $newsFirst = $news->limit(1);
    ?>
            <!--tin con 1 -->
            <div class="tinthitruong">
                <p style="font-size:16px; font-weight:bold; color:#FFFFFF; margin-left:12px; margin-top:8px;">
                    <a style="color: #FFF;" href="<?php 
    echo $base_url . 'tin-tuc/' . $row->name_none;
    ?>
">
                        <?php 
    echo $row->name_vietnamese;
    ?>
                    </a>
                </p>
            </div>
Example #18
0
 function warranty()
 {
     $news = new Article();
     $news->where('id', 166);
     $news->get();
     if (!$news->exists()) {
         show_404();
     }
     $dis['news'] = $news;
     $this->page_title = $news->{'title_vietnamese'} . " - " . $this->page_title;
     $dis['base_url'] = base_url();
     $dis['view'] = 'singlepage';
     $this->viewfront($dis);
 }
Example #19
0
 /**
  * Clear the site cache to properly refresh the URIs
  */
 public function clearCache()
 {
     $this->modx->cacheManager->refresh(array('db' => array(), 'auto_publish' => array('contexts' => array($this->object->get('context_key'))), 'context_settings' => array('contexts' => array($this->object->get('context_key'))), 'resource' => array('contexts' => array($this->object->get('context_key')))));
 }
Example #20
0
 private function arrange_position_home()
 {
     $o = new Article();
     $o->where('home_hot', 1);
     $o->order_by('home_hot_position', 'asc');
     $o->get();
     $c = $o->count();
     $i = 1;
     foreach ($o as $row) {
         $i++;
         $row->home_hot_position = $i;
         $row->save();
     }
 }
 /**
  * Import comments into Quip
  *
  * @param Article $article
  * @param SimpleXMLElement $item
  * @return boolean
  */
 public function importComments(Article $article, SimpleXMLElement $item)
 {
     $settings = $this->container->getContainerSettings();
     $threadKey = 'article-b' . $this->container->get('id') . '-' . $article->get('id');
     /** @var quipThread $thread */
     $thread = $this->modx->newObject('quipThread');
     $thread->fromArray(array('createdon' => $article->get('publishedon'), 'moderated' => $this->modx->getOption('commentsModerated', $settings, 1), 'moderator_group' => $this->modx->getOption('commentsModeratorGroup', $settings, 'Administrator'), 'moderators' => $this->modx->getOption('commentsModerators', $settings, ''), 'resource' => $article->get('id'), 'idprefix' => 'qcom'));
     $thread->set('name', $threadKey);
     if (!$this->debug) {
         $thread->save();
     }
     /** @var SimpleXMLElement $wp */
     $wp = $item->children('wp', true);
     $idMap = array();
     /** @var SimpleXMLElement $commentXml */
     foreach ($wp->comment as $commentXml) {
         $commentId = (int) $this->getXPath($commentXml, 'wp:comment_id');
         $commentParent = (int) $this->getXPath($commentXml, 'wp:comment_parent');
         /** @var SimpleXMLElement $commentWp */
         $commentWp = $commentXml->children('wp', true);
         /** @var quipComment $comment */
         $comment = $this->modx->newObject('quipComment');
         $comment->fromArray(array('thread' => $threadKey, 'parent' => array_key_exists($commentParent, $idMap) ? $idMap[$commentParent] : 0, 'author' => $this->matchCreator((string) $commentWp->comment_author), 'body' => $this->parseContent((string) $commentWp->comment_content), 'createdon' => (string) $commentWp->comment_date, 'approved' => (bool) $commentWp->comment_approved, 'name' => (string) $commentWp->comment_author, 'email' => (string) $commentWp->comment_author_email, 'website' => (string) $commentWp->comment_author_url, 'ip' => (string) $commentWp->comment_author_IP, 'resource' => $article->get('id'), 'idprefix' => 'qcom'), '', true);
         if (!$this->debug) {
             $comment->save();
         }
         $idMap[$commentId] = $comment->get('id');
     }
     return true;
 }
Example #22
0
 public function LimitChildren($Limit)
 {
     $articleLimited = Article::get()->sort('Created DESC')->limit($Limit);
     return $articleLimited;
 }
Example #23
0
 function getProject()
 {
     //$type = new Estatetype($this->input->post('typeId'));
     //$category = new Estatecatalogue($type->estatecatalogue_id);
     $o = new Article();
     $o->where('recycle', 0);
     $o->where('estatecity_id', $this->input->post('provincesId'));
     $o->order_by('title_vietnamese', 'asc');
     $o->get();
     $option = '<option value="">Chọn Dự án</option>';
     foreach ($o as $row) {
         if ($row->id == $this->input->post('priceSelected')) {
             $option .= '<option selected="selected" value=' . $row->id . '>' . $row->title_vietnamese . '</option>';
         } else {
             $option .= '<option value=' . $row->id . '>' . $row->title_vietnamese . '</option>';
         }
     }
     echo $option;
     die;
 }
Example #24
0
 function MY_Controller()
 {
     parent::Controller();
     $this->load->library('enum');
     $this->load->config('fireignition');
     $this->load->helper('language');
     $this->lang->load('site');
     $this->load->library('hit_counter');
     $this->load->library('FirePHP');
     if ($this->config->item('fireignition_enabled')) {
         if (floor(phpversion()) < 5) {
             log_message('error', 'PHP 5 is required to run fireignition');
         } else {
             $this->load->library('FirePHP');
         }
     } else {
         $this->load->library('Firephp_fake');
         $this->firephp =& $this->firephp_fake;
     }
     //redirect from old website
     $this->redirectList();
     $cauhinh = new cauhinh();
     $cauhinh->get();
     $this->cauhinh = $cauhinh;
     if ($this->uri->segment(1, "") == "admin") {
         $this->logged_in_user = $this->_get_user();
         $this->admin = $this->config->item('admin');
         $this->admin_url = $this->config->item('admin_url');
         $this->admin_images = base_url() . "images/admin/";
         //LOAD HELPER
         $this->load_admin_resource();
         //check maintenance admin , only webmaster can login
         $this->resetNewsViewMost();
     } else {
         //check login user
         //$this->flogged_in_user=$this->_fget_user();
         $this->isCache = true;
         $this->userLoginFlag = 0;
         $userLogin = $this->session->userdata('userLogin');
         $userToken = $this->session->userdata('userToken');
         $customer = new Customer();
         $customer->get_by_username($userLogin);
         if ($customer->exists() && md5($customer->id) == trim($userToken)) {
             $loginUsername = $customer->username;
             $this->customer = $customer;
             if ($this->session->userdata('userloginFlag') == "1") {
                 $this->userLoginFlag = 1;
                 $this->session->set_userdata('userloginFlag', "0");
             }
         } else {
             $loginUsername = "";
         }
         $this->loginUsername = $loginUsername;
         $this->loginUser = $customer;
         $this->page_title = getconfigkey("defaultPageTitle");
         $this->load->helper('language');
         $this->show_analytic = TRUE;
         $this->page_keyword = getconfigkey("defaultKeyword");
         $this->page_description = getconfigkey("defaultDescription");
         $this->isRobotFollow = true;
         //------------------------------------------------
         // get data handler
         //------------------------------------------------
         $listAllCat = array();
         $newsCate = new Newscatalogue();
         $newsCate->order_by('position');
         $newsCate->where(array('recycle' => 0, 'parentcat_id' => 58));
         $newsCate->get_iterated();
         $this->newsCate = $newsCate;
         foreach ($newsCate as $row) {
             array_push($listAllCat, $row->id);
         }
         /*Get all business cat*/
         $businessCat = new Newscatalogue();
         $businessCat->order_by('position');
         $businessCat->where(array('recycle' => 0, 'parentcat_id' => 91));
         $businessCat->get_iterated();
         $this->businessCat = $businessCat;
         $guideCate = new Newscatalogue();
         $guideCate->order_by('position');
         $guideCate->where(array('recycle' => 0, 'parentcat_id' => 76));
         $guideCate->get_iterated();
         $this->guideCate = $guideCate;
         foreach ($guideCate as $row) {
             array_push($listAllCat, $row->id);
         }
         $this->listAllCat = $listAllCat;
         $projectsCate = new Newscatalogue();
         $projectsCate->order_by('position');
         $projectsCate->where(array('recycle' => 0, 'parentcat_id' => 83));
         $projectsCate->get_iterated();
         $this->projectsCate = $projectsCate;
         $arrayCateNewsId = array();
         foreach ($this->projectsCate as $row) {
             $arrayCateNewsId[] = $row->id;
         }
         $this->arrCateProject = $arrayCateNewsId;
         // project hot
         $projectHot = new Article();
         $projectHot->where('recycle', 0);
         $projectHot->where('hot', 1);
         $projectHot->where_in('newscatalogue_id', $arrayCateNewsId);
         $projectHot->order_by('created', 'desc');
         $projectHot->get(3);
         $this->projectHot = $projectHot;
         //get all housesale
         $typeHouseSale = new Estatetype();
         $typeHouseSale->where('estatecatalogue_id', 1);
         $typeHouseSale->order_by('position');
         $typeHouseSale->get_iterated();
         $this->typeHouseSale = $typeHouseSale;
         //get all houselease
         $typeHouseLease = new Estatetype();
         $typeHouseLease->where('estatecatalogue_id', 2);
         $typeHouseLease->order_by('position');
         $typeHouseLease->get_iterated();
         $this->typeHouseLease = $typeHouseLease;
         //get all housedemand
         $typeHouseDemand = new Estatetype();
         $typeHouseDemand->where('estatecatalogue_id', 3);
         $typeHouseDemand->order_by('position');
         $typeHouseDemand->get_iterated();
         $this->typeHouseDemand = $typeHouseDemand;
         // get all province
         $estateProvince = new Estatecity();
         $estateProvince->order_by('position', 'asc');
         $estateProvince->get_iterated();
         $this->estateProvince = $estateProvince;
         // get all Direction
         $estateDirection = new Estatedirection();
         $estateDirection->order_by('id', 'desc');
         $estateDirection->get_iterated();
         $this->estateDirection = $estateDirection;
         // get all Estatecatalogues
         $estateCatalogues = new Estatecatalogue();
         $estateCatalogues->order_by('position', 'asc');
         $estateCatalogues->get_iterated();
         $this->estateCatalogues = $estateCatalogues;
         // get all business world
         $businessWorld = new Article();
         $businessWorld->order_by('id', 'desc');
         $businessWorld->where(array('recycle' => 0, 'newscatalogue_id' => 78));
         $businessWorld->get(20);
         $this->businessWorld = $businessWorld;
         // get all project news
         $projectNews = new Article();
         $projectNews->order_by('id', 'desc');
         $projectNews->where(array('recycle' => 0, 'newscatalogue_id' => 71));
         $projectNews->get(6);
         $this->projectNews = $projectNews;
         $this->projectNewsFirst = $projectNews->limit(1);
         // get all legal advice
         $legalAdvices = new Article();
         $legalAdvices->order_by('id', 'desc');
         $legalAdvices->where(array('recycle' => 0, 'newscatalogue_id' => 82));
         $legalAdvices->get(11);
         $this->legalAdvices = $legalAdvices;
         // get all new STND
         $newsPrivate = new Article();
         $newsPrivate->order_by('id', 'desc');
         $newsPrivate->where(array('recycle' => 0, 'newscatalogue_id' => 75));
         $newsPrivate->get_iterated();
         $this->newsPrivate = $newsPrivate;
         // get all estateareas
         $estateareas = new Estatearea();
         $estateareas->order_by('position', 'asc');
         $estateareas->get_iterated();
         $this->estateareas = $estateareas;
         // get all estateprices
         $estateprices = new Estateprice();
         $estateprices->order_by('position', 'asc');
         $estateprices->get_iterated();
         $this->estateprices = $estateprices;
         //------------------------------------------------
         // Top Advertise
         //------------------------------------------------
         $banner = new banner();
         $banner->where('bannercat_id', 1);
         $banner->get_iterated();
         $this->banner = $banner;
         $bannerAdversiting = new Banner();
         $bannerAdversiting->where('bannercat_id', 19);
         $bannerAdversiting->get_iterated();
         $this->bannerAdversiting = $bannerAdversiting;
         $bannerLeft = new Banner();
         $bannerLeft->where('bannercat_id', 21);
         $bannerLeft->get_iterated();
         $this->bannerLeft = $bannerLeft;
         $bannerFooter = new Banner();
         $bannerFooter->where('bannercat_id', 20);
         $bannerFooter->get_iterated();
         $this->bannerFooter = $bannerFooter;
         $menu = new menu();
         $menu->order_by('position', 'asc');
         $menu->get_iterated(8);
         $this->menu = $menu;
         $productFooter = new menuitem();
         $productFooter->where('menu_id', 9);
         $productFooter->order_by('position', 'asc');
         $productFooter->get_iterated();
         $this->productFooter = $productFooter;
         $relation = new menuitem();
         $relation->order_by('position', 'asc');
         $relation->where('menu_id', 10);
         $relation->get_iterated();
         $this->relation = $relation;
         $this->_increaseVisiter();
         //load product manufacture
         $productManufacture = new Productmanufacture();
         $productManufacture->order_by('name', 'asc');
         $productManufacture->get_iterated();
         $this->productManufacture = $productManufacture;
         $adverHeader = new Banner();
         $adverHeader->where('bannercat_id', 25);
         $adverHeader->get(1);
         $this->adverHeader = $adverHeader;
         // get estates hot
         $newsHot = new Article();
         $newsHot->where_in('newscatalogue_id', array(71, 72, 73, 74, 75, 77, 78, 79, 80, 81, 82));
         $newsHot->order_by('id', 'desc');
         $newsHot->where('hotHome', 1);
         $newsHot->get(5);
         $this->newsHot = $newsHot;
     }
 }
Example #25
0
 function postGuide()
 {
     $news = new Article();
     $news->where(array('recycle' => 0, 'newscatalogue_id' => 90))->get_iterated();
     if (!$news->exists()) {
         show_404();
     }
     $dis['news'] = $news;
     // get news view most
     $newViewMost = new Article();
     $newViewMost->where('recycle', 0);
     $newViewMost->where_in('newscatalogue_id', $this->listAllCat);
     $newViewMost->order_by('view_count', 'desc');
     $newViewMost->get(10);
     $dis['newViewMost'] = $newViewMost;
     $this->page_title = "Hướng dẫn đăng tin - " . $this->page_title;
     $this->menu_active = 'home';
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/postGuide';
     $this->viewfront($dis);
 }
Example #26
0
 function detail($title_none = NULL)
 {
     $cat_news_url = $this->uri->segment(1);
     $cat_news = new Newscatalogue();
     $cat_news->where(array('name_none' => $cat_news_url, 'parentcat_id' => NULL))->get();
     if (!$cat_news->exists()) {
         show_404();
     }
     $dis['cat_news'] = $cat_news;
     $cat = $this->uri->segment(2);
     $category = new Newscatalogue();
     $category->where(array('name_none' => $cat, 'parentcat_id' => $cat_news->id))->get();
     if (!$category->exists()) {
         show_404();
     }
     $dis['category'] = $category;
     $title_none = geturlfromuri($this->uri->segment(3));
     $news = new Article();
     $news->where(array('title_none' => $title_none, 'newscatalogue_id' => $category->id));
     $news->get();
     if (!$news->exists()) {
         show_404();
     }
     $dis['news'] = $news;
     $tag = $news->tag;
     $dis['tag'] = explode(',', $tag);
     $news->view_count = $news->view_count++;
     $news->save();
     //related news
     $related_news = new Article();
     $related_news->where('recycle', 0);
     $related_news->where('newscatalogue_id', $news->newscatalogue_id);
     $related_news->where("id !=", $news->id);
     $related_news->order_by('created', 'DESC');
     $related_news->get_paged(0, 10, TRUE);
     $dis['related_news'] = $related_news;
     $this->page_title = $news->{'title_vietnamese'} . ' | Dự án ' . $category->name_vietnamese . ' ' . $news->{'title_vietnamese'} . ' | SotayNhadat.vn';
     $this->page_description = $news->short_vietnamese;
     $this->page_keyword = $news->tag;
     $this->isRobotFollow = 1;
     $dis['base_url'] = base_url();
     $dis['view'] = 'front/project/news_de';
     $this->viewfront($dis);
 }
Example #27
0
* receipt
* 
* @since 2004-06-05
* @author Christian Ehret <*****@*****.**> 
*/
$smartyType = "www";
include_once "../includes/default.inc.php";
$auth->is_authenticated();
include_once '../includes/receiptclass.inc.php';
$receipt = new Receipt();
include_once '../includes/articleclass.inc.php';
$article = new Article();
$receiptid = -1;
$loaddraft = false;
$draftdeleted = false;
$smarty->assign('tpl_articles', $article->get());
// save receipt
if ($request->GetVar('frm_action', 'post') == "save") {
    $receiptid = $receipt->save();
    $smarty->assign('tpl_saved', 'true');
    $smarty->assign('tpl_location', $wwwroot . 'receiptrtf.php/receiptid.' . $receiptid . '/receiptrtf.php');
    // save draft receipt
} elseif ($request->GetVar('frm_action', 'post') == "savedraft") {
    $draftreceiptid = $receipt->savedraft();
    $smarty->assign('tpl_saved', 'draft');
    // do anything else than save
} elseif ($request->GetVar('frm_action', 'post') == "deletedraft") {
    $receipt->deletedraft($request->GetVar('frm_draftreceiptid', 'post'), true);
    $location = $wwwroot . "checkopenbookings.php/bookid." . $request->GetVar('frm_bookid', 'post') . "/checkopenbookings.php";
    header("Location: {$location}");
} else {
Example #28
0
 /**
  * Override cleanup to send only back needed params
  * @return array|string
  */
 public function cleanup()
 {
     $this->object->removeLock();
     $this->clearCache();
     $returnArray = $this->object->get(array_diff(array_keys($this->object->_fields), array('content', 'ta', 'introtext', 'description', 'link_attributes', 'pagetitle', 'longtitle', 'menutitle', 'articles_container_settings', 'properties')));
     foreach ($returnArray as $k => $v) {
         if (strpos($k, 'tv') === 0) {
             unset($returnArray[$k]);
         }
         if (strpos($k, 'setting_') === 0) {
             unset($returnArray[$k]);
         }
     }
     $returnArray['class_key'] = $this->object->get('class_key');
     $this->workingContext->prepare(true);
     $returnArray['preview_url'] = $this->modx->makeUrl($this->object->get('id'), $this->object->get('context_key'), '', 'full');
     return $this->success('', $returnArray);
 }