Beispiel #1
0
 public function post()
 {
     //init variable
     $app = JFactory::getApplication();
     $result = new stdClass();
     $article_id = $app->input->get('id', 0, 'INT');
     if (!$article_id) {
         $result->success = 0;
         $result->message = 'Please select article';
         $this->plugin->setResponse($result);
         return;
     }
     $art_obj = new ContentModelArticle();
     $art_obj->setId($article_id);
     $a_data = $art_obj->getArticle();
     //format data
     $obj = new BlogappSimpleSchema();
     //$item = $obj->mapPost($a_data,'', 100, array('text'));
     $item = $obj->mapPost($a_data, '', 100, array());
     $this->plugin->setResponse($item);
 }
 function getList($ids = '', $catid = '', $limit = 0)
 {
     global $mainframe;
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     $aid = $user->get('aid', 0);
     $contentConfig = JComponentHelper::getParams('com_content');
     $noauth = !$contentConfig->get('shownoauth');
     jimport('joomla.utilities.date');
     $date = new JDate();
     $now = $date->toMySQL();
     $nullDate = $db->getNullDate();
     // query to determine article count
     $query = 'SELECT a.id' . ' FROM #__content AS a';
     $query .= ' WHERE a.state = 1 ';
     $query .= ' AND (a.publish_up = ' . $db->Quote($nullDate) . ' OR a.publish_up <= ' . $db->Quote($now) . ' ) ' . ' AND (a.publish_down = ' . $db->Quote($nullDate) . ' OR a.publish_down >= ' . $db->Quote($now) . ' )';
     if ($ids != '') {
         $query .= "\n AND a.id in ({$ids})";
     }
     if ($catid != '') {
         $query .= " AND a.catid in ({$catid})";
     }
     $query .= ' ORDER BY a.ordering ';
     if ($catid != '' && $limit > 0) {
         $query .= "LIMIT 0, {$limit}";
     }
     $db->setQuery($query);
     $ids = $db->loadResultArray();
     jimport('joomla.plugin.helper');
     JPluginHelper::importPlugin('content');
     $app = JFactory::getApplication();
     $params = new JParameter('');
     $limitstart = JRequest::getVar('limitstart', 0, '', 'int');
     require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'query.php';
     require_once JPATH_SITE . DS . 'components' . DS . 'com_content' . DS . 'models' . DS . 'article.php';
     $model = new ContentModelArticle();
     $rows = array();
     foreach ($ids as $id) {
         $model->setId($id);
         $row = $model->getArticle();
         if ($row->id) {
             $app->triggerEvent('onPrepareContent', array(&$row, &$params, $limitstart));
             $row->introtext = $row->text;
             $rows[] = $row;
         }
     }
     return $rows;
 }
Beispiel #3
0
        $view->set('State', $state);
        // Send the display
        print $view->display();
        JRequest::setVar("id", $original_id);
        $pathway->setPathway($oldPath);
    }
} else {
    JHTML::addIncludePath(JPATH_BASE . DS . 'components' . DS . 'com_content' . DS . 'helpers');
    require_once JPATH_BASE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'query.php';
    require_once JPATH_BASE . DS . 'components' . DS . 'com_content' . DS . 'helpers' . DS . 'route.php';
    require_once JPATH_BASE . DS . 'components' . DS . 'com_content' . DS . 'models' . DS . 'article.php';
    jimport('joomla.application.component.helper');
    require_once 'view.html.php';
    $id = (int) $params->get('id', 0);
    $articleModel = new ContentModelArticle();
    $articleModel->setId($id);
    $articleView = new ContentViewArticle2();
    $mainframe =& JFactory::getApplication();
    jimport('joomla.filesystem.file');
    // Chose the template to use. Thanks to Jasper Jaklofsky of djeedjee.net for the code!
    if (JFile::exists(JPATH_BASE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'mod_article' . DS . 'article' . DS . 'default.php')) {
        $articleView->addTemplatePath(JPATH_BASE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'mod_article' . DS . 'article');
    } else {
        if ($params->get('allowTemplateOveride', false) && JFile::exists(JPATH_BASE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_content' . DS . 'article' . DS . 'default.php')) {
            $articleView->addTemplatePath(JPATH_BASE . DS . 'templates' . DS . $mainframe->getTemplate() . DS . 'html' . DS . 'com_content' . DS . 'article');
        } else {
            $articleView->addTemplatePath(JPATH_BASE . DS . 'components' . DS . 'com_content' . DS . 'views' . DS . 'article' . DS . 'tmpl');
        }
    }
    // End template choice
    $articleView->setModel($articleModel, "true");