<?php

/**
 * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @package clearFusionCMS
 * @copyright Copyright (c) 2013 clearFusionCMS. All rights reserved.
 * @link http://clearfusioncms.com
 */

/**
 * contentDrafts Class
 *
 * Class to look up draft documents.
 *
 * @package clearFusionCMS
 */
class contentDrafts {
	/**
	 * Get the list of drafts.
	 *
	 * @param flDb $db The database.
	 * @return array of module, title, editAction, editData
	 */
	function getDrafts($db) {
		$r = array();
		$results = $db->query("SELECT id,title FROM cf_content_" . clearFusionCMS::getSite() . " WHERE draft != '' ORDER BY title");
		while($row = $results->fetch()) {
			$r[] = array(
				'module' => 'content',
				'title' => $row['title'],
				'editAction' => 'documents',
				'editData' => array('*' => $row['id'])
			);
		}
		return $r;
	}
}