<?php
/**
 * Smarty plugin
 *
 * @category Smarty
 * @license /_licenses/untermStrich/agb_normal.pdf
 * @author Christian Wengg
 * @copyright 2009 untermStrich
 * @package Smarty
 * @subpackage plugins
 * @version $Id$
*/

/**
 * Smarty view function plugin
 *
 * Purpose:  Create the view for project offers status fields
 *
 * @param   array   $params Parameters:
 *                  <ul>
 *                      <li>value   integer     The variable</li>
 *                  </ul>
 * @return  string  The field source
 */
function smarty_function_project_offers_status(array $params)
{
    if (isset($params['value'])) {
        $CI = CI_Controller::get_instance();
        $CI->load->model('Project_offers_model', 'project_offers');
        
        $CI->lang->load('projects', $CI->web_settings->getLanguage());        
        
        if ($params['value']== Project_offers_model::S_OFFERED) {
            return $CI->lang->line('offers_management_status_offered');
        } elseif ($params['value']== Project_offers_model::S_ORDERED) {
            return $CI->lang->line('offers_management_status_ordered');
        } elseif ($params['value']== Project_offers_model::S_INVALID) {
            return $CI->lang->line('offers_management_status_invalid');
        } else {
            return '';
        }
    } else {
        return '';
    }
}

