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; }
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); }