<?php
namespace admin\factory;

class ArticleSort {

  public function getPageArticleSort( $id )
  {
    global $db;

    $articles = array();

    $query = $db -> prepare( 'SELECT * FROM pcms_article_page WHERE page_id = :page_id ORDER BY o ASC' );
    $query -> bindValue( ':page_id' , $id , \PDO::PARAM_INT );
    $query -> execute();
    if ( $query -> rowCount() ) while ( $row = $query -> fetch() )
    {
      $row['title'] = \System::getArticleTitle( $row['article_id'] );
      $articles[]   = $row;
    }
    $query -> closeCursor();

    return $articles;
  }
}
?>
