<?php
/**
 * Project module - getting actors by ajax call
 * 
 * Return a json file populating actors field in add/mod project page
 *  
 * @package linea21\modules\project
 * @author $Author$ - Simon Georget <simon@linea21.com>
 * @version $Id$ 
 * @access public
 * @license http://opensource.org/licenses/gpl-3.0.html
 */

$noplugin = true; // flag for ../config/define.php file
include_once('../config/define.php');
session_start();

//////////// Check Droits utilisateur ////////////
if (!$l21auth->hasRight('project')) ReloadIndex('admin');
////////////

include_once('../project/'.SQL.'.inc.php');

$data = $sql_object->DBSelect(SQL_getActorsList());

$response = array();

foreach ($data as $i => $value)
{
  $fullname = '';
  if(!empty($value['actor_name'])) {
  	$fullname = formatText($value['actor_name'], '2HTML');
  	$str_id = $fullname; // $value['actor_id'];
  }
  $response[] = array($str_id, $fullname, null, $fullname);
}

header('Content-type: application/json');
echo json_encode($response);