Esempio n. 1
0
function select_support($name, $value)
{
    $model = MODEL . 'Users';
    $Users = new $model();
    #    $rows  = $Users->getRows( 'Users.status = "A" AND Users.company_id = ' . COMPANY_ID, 'name' );
    $rows = $Users->getRows('Users.status = "A" AND Users.company_id = ' . get_session('user_company') . ' AND Users.user_level >= ' . MINIMUM_TO_UPDATE, 'name');
    $options = '';
    $selected = '' == $value ? '" selected="selected' : '';
    $options .= NL . '<option value="' . '' . $selected . '">' . translate('Undefined') . '</option>';
    foreach ($rows as $row) {
        $selected = $row['id'] == $value ? '" selected="selected' : '';
        $options .= NL . '<option value="' . $row['id'] . $selected . '">' . put_name($row['name']) . '</option>';
    }
    return NL . '<select id="' . $name . '" name="' . $name . '">' . $options . NL . '</select>';
}
Esempio n. 2
0
function get_user_name($id)
{
    if (!$id) {
        return translate('Undefined');
    }
    $sql = 'SELECT name FROM Users WHERE id = ' . $id;
    $db = Zend_Registry::get('db');
    return put_name($db->fetchOne($sql));
}