Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
535b01f
added new services, stil in test phase
IzudinVragic Mar 26, 2018
d5d4531
filtered by language and menu
IzudinVragic Mar 26, 2018
598655b
filtered by language and menu and type
IzudinVragic Mar 26, 2018
aaf7e67
paging for category articles
IzudinVragic Mar 28, 2018
58b28fb
paging for category articles corrected
IzudinVragic Mar 28, 2018
092ecd2
Getting particular menu item
IzudinVragic Mar 29, 2018
51a5869
Getting particular menu item corrected
IzudinVragic Mar 29, 2018
e7a9454
Test featured categories in menu item
IzudinVragic Mar 29, 2018
5e895e0
Test featured categories in menu item*
IzudinVragic Mar 29, 2018
f7336b2
Test category_id in menu item
IzudinVragic Mar 29, 2018
3fc02eb
category_ids combinated
IzudinVragic Mar 29, 2018
7e40743
category_ids combinated*
IzudinVragic Mar 29, 2018
99441d1
category_ids combinated**
IzudinVragic Mar 29, 2018
77ffe8e
Fixed russian languge featured ids problem with not using russian ids…
IzudinVragic Mar 29, 2018
d49c3f1
Fixed russian languge featured ids problem with not using russian ids…
IzudinVragic Mar 29, 2018
b923e51
Fixed russian languge featured ids problem with not using russian ids…
IzudinVragic Mar 29, 2018
7f1ba01
echo test
IzudinVragic Mar 29, 2018
7a6d18b
echo test*
IzudinVragic Mar 29, 2018
96ac109
Fixed russian languge featured ids problem with not using russian ids…
IzudinVragic Mar 29, 2018
2967d2d
category_ids removed from response
IzudinVragic Jul 18, 2018
e670671
Fix bug with more categories
Mar 5, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
Empty file modified README.md
100644 → 100755
Empty file.
Empty file modified admin/index.html
100644 → 100755
Empty file.
Empty file modified admin/push.php
100644 → 100755
Empty file.
Empty file modified admin/sql/index.html
100644 → 100755
Empty file.
Binary file added admin/sql/updates/.DS_Store
Binary file not shown.
Empty file modified admin/sql/updates/index.html
100644 → 100755
Empty file.
Empty file modified admin/sql/updates/mysql/0.0.1.sql
100644 → 100755
Empty file.
Empty file modified admin/sql/updates/mysql/index.html
100644 → 100755
Empty file.
48 changes: 48 additions & 0 deletions controller.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_push
*
* @copyright Copyright (C) 2015 International Center For Journalists
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
/**
* Push Component Controller
*
* @since 0.0.1
*/
class PushController extends JControllerLegacy
{
function articles() {
$view = $this->getView( 'articles', 'json' );
$view->setLayout( 'default' );
$view->display();
}

function category_articles() {
$view = $this->getView( 'category_articles', 'json' );
$view->setLayout( 'default' );
$view->display();
}

function categories() {
$view = $this->getView( 'categories', 'json' );
$view->setLayout( 'default' );
$view->display();
}


function url_lookup() {
$view = $this->getView( 'urllookup', 'json');
$view->setLayout( 'default' );
$view->display();
}

function article() {
$view = $this->getView( 'article', 'json');
$view->setLayout( 'default' );
$view->display();
}
}
1 change: 1 addition & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
21 changes: 21 additions & 0 deletions push.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_push
*
* @copyright Copyright (C) 2015 International Center For Journalists
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

// Get an instance of the controller prefixed by HelloWorld
$controller = JControllerLegacy::getInstance('Push');

// Perform the Request task
$input = JFactory::getApplication()->input;
$controller->execute($input->getCmd('task'));

// Redirect if set by the controller
$controller->redirect();
Empty file modified push.xml
100644 → 100755
Empty file.
Binary file added site/.DS_Store
Binary file not shown.
13 changes: 13 additions & 0 deletions site/controller.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,19 @@ function articles() {
$view->display();
}

function category_articles() {
$view = $this->getView( 'category_articles', 'json' );
$view->setLayout( 'default' );
$view->display();
}

function categories() {
$view = $this->getView( 'categories', 'json' );
$view->setLayout( 'default' );
$view->display();
}


function url_lookup() {
$view = $this->getView( 'urllookup', 'json');
$view->setLayout( 'default' );
Expand Down
Empty file modified site/index.html
100644 → 100755
Empty file.
Empty file modified site/push.php
100644 → 100755
Empty file.
Binary file added site/views/.DS_Store
Binary file not shown.
Empty file modified site/views/article/index.html
100644 → 100755
Empty file.
Empty file modified site/views/article/tmpl/default.php
100644 → 100755
Empty file.
Empty file modified site/views/article/tmpl/index.html
100644 → 100755
Empty file.
2 changes: 1 addition & 1 deletion site/views/article/view.json.php
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function display($tpl = null)
$query->select('*');
$query->from($db->quoteName('#__content'));
$query->where("id = " . $article_id);
$query->setLimit(1);
//$query->setLimit(1);
//
// Reset the query using our newly populated query object.
$db->setQuery($query);
Expand Down
Binary file added site/views/articles/.DS_Store
Binary file not shown.
Empty file modified site/views/articles/index.html
100644 → 100755
Empty file.
Empty file modified site/views/articles/tmpl/default.php
100644 → 100755
Empty file.
Empty file modified site/views/articles/tmpl/index.html
100644 → 100755
Empty file.
Empty file modified site/views/articles/view.json.php
100644 → 100755
Empty file.
1 change: 1 addition & 0 deletions site/views/categories/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
14 changes: 14 additions & 0 deletions site/views/categories/tmpl/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_helloworld
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>

<?php echo $this->msg; ?>
1 change: 1 addition & 0 deletions site/views/categories/tmpl/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
85 changes: 85 additions & 0 deletions site/views/categories/view.json.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_helloworld
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

/**
* HTML View class for the HelloWorld Component
*
* @since 0.0.1
*/
class PushViewCategories extends JViewLegacy
{
/**
* Display the Push view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
function display($tpl = null)
{

//Get limit, default is 10
$limit = JRequest::getVar('limit');

if(!$limit) {
$limit = 10;
}

// Get a db connection.
$db = JFactory::getDbo();

// Create a new query object.
$query = $db->getQuery(true);

// Select all records from the user profile table where key begins with "custom.".
// Order it by the ordering field.
$query->select('*');
$query->from($db->quoteName('#__categories'));
$query->order('created_time DESC');
$query->setLimit($limit);

$model_categories = JCategories::getInstance('Content');
$root = $model_categories->get('root');
$categories = $root->getChildren();
//
// Reset the query using our newly populated query object.
$db->setQuery($query);

// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$results = $categories;

$responseArray = [];
$articleArray = [];
foreach($results as $article){
if($article->fulltext == ""){
$article->fulltext = null;
}

$articleArray[] = ['headline' => $article->title,
'description' => $article->description,
'body' => $article->params,
'publish_date' => $article->created_time,
'id' => $article->id,
'language' => $article->language
];
}

$responseArray['start_date'] = null;
$responseArray['end_date'] = null;
$responseArray['total_items'] = $limit;
$responseArray['total_pages'] = '1';
$responseArray['page'] = '1';
$responseArray['results'] = $articleArray;
//echo var_dump($results);
echo json_encode($responseArray);
}
}
1 change: 1 addition & 0 deletions site/views/category_articles/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
14 changes: 14 additions & 0 deletions site/views/category_articles/tmpl/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_helloworld
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>

<?php echo $this->msg; ?>
1 change: 1 addition & 0 deletions site/views/category_articles/tmpl/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
92 changes: 92 additions & 0 deletions site/views/category_articles/view.json.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_helloworld
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');

/**
* HTML View class for the HelloWorld Component
*
* @since 0.0.1
*/
class PushViewCategory_articles extends JViewLegacy
{
/**
* Display the Push view
*
* @param string $tpl The name of the template file to parse; automatically searches through the template paths.
*
* @return void
*/
function display($tpl = null)
{

//Get limit, default is 10
$limit = JRequest::getVar('limit');
$id = JRequest::getVar('id');
$page = JRequest::getVar('page');

if(!$limit) {
$limit = 10;
}

// Get a db connection.
$db = JFactory::getDbo();

// Create a new query object.
$query = $db->getQuery(true);

// Select all records from the user profile table where key begins with "custom.".
// Order it by the ordering field.
$query = $db->getQuery(true);
$query->select('*');
$query->from('#__content');
$query->where('catid="'.$id.'"');
$query->order($db->quoteName('created') . ' DESC limit '.$page*$limit.','.$limit.'');

$query2 = $db->getQuery(true);
$query2->select('COUNT(*)');
$query2->from('#__content');
$query2->where('catid="'.$id.'"');


//limit "'.$page.',"'.$limit.'"
$db->setQuery((string)$query);

// Load the results as a list of stdClass objects (see later for more options on retrieving data).
$results = $db->loadObjectList();
$db->setQuery((string)$query2);

$responseArray = [];
$articleArray = [];
foreach($results as $article){
if($article->fulltext == ""){
$article->fulltext = null;
}

$articleArray[] = ['headline' => $article->title,
'description' => $article->introtext,
'body' => $article->fulltext,
'author' => $article->created_by_alias,
'publish_date' => $article->publish_up,
'id' => $article->id,
'language' => $article->language
];
}

$responseArray['start_date'] = null;
$responseArray['end_date'] = null;
$responseArray['total_items'] = $db->loadResult();
$responseArray['total_pages'] = ceil($db->loadResult()/$limit);
$responseArray['page'] = $page;
$responseArray['results'] = $articleArray;
//echo var_dump($results);
echo json_encode($responseArray);
}
}
1 change: 1 addition & 0 deletions site/views/menu_item/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
14 changes: 14 additions & 0 deletions site/views/menu_item/tmpl/default.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?php
/**
* @package Joomla.Administrator
* @subpackage com_helloworld
*
* @copyright Copyright (C) 2005 - 2015 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/

// No direct access to this file
defined('_JEXEC') or die('Restricted access');
?>

<?php echo $this->msg; ?>
1 change: 1 addition & 0 deletions site/views/menu_item/tmpl/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<html><body bgcolor="#FFFFFF"></body></html>
Loading