<?php

/**
 * TestLink Open Source Project - http://testlink.sourceforge.net/
 * This script is distributed under the GNU General Public License 2 or later.
 *
 * @filesource  cfieldsView.php
 *
**/
require_once dirname(__FILE__) . "/../../config.inc.php";
require_once "common.php";
testlinkInitPage($db, false, false, "checkRights");
$gui = new stdClass();
$templateCfg = templateConfiguration();
$cfield_mgr = new cfield_mgr($db);
$gui->cf_map = $cfield_mgr->get_all(null, 'transform');
$gui->cf_types = $cfield_mgr->get_available_types();
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
function checkRights(&$db, &$user)
{
    return $user->hasRight($db, "cfield_view");
}
                    $active[] = $cf_id;
                } else {
                    $inactive[] = $cf_id;
                }
            }
            if (!is_null($active)) {
                $cfield_mgr->set_active_for_testproject($args->testproject_id, $active, 1);
            }
            if (!is_null($inactive)) {
                $cfield_mgr->set_active_for_testproject($args->testproject_id, $inactive, 0);
            }
        }
        break;
}
// Get all available custom fields
$cfield_map = $cfield_mgr->get_all();
$gui = new stdClass();
$gui->locations = createLocationsMenu($cfield_mgr->getLocations());
$gui->tproject_name = $args->testproject_name;
$gui->my_cf = $cfield_mgr->get_linked_to_testproject($args->testproject_id);
$cf2exclude = is_null($gui->my_cf) ? null : array_keys($gui->my_cf);
$gui->other_cf = $cfield_mgr->get_all($cf2exclude);
$gui->cf_available_types = $cfield_mgr->get_available_types();
$gui->cf_allowed_nodes = array();
$allowed_nodes = $cfield_mgr->get_allowed_nodes();
foreach ($allowed_nodes as $verbose_type => $type_id) {
    $gui->cf_allowed_nodes[$type_id] = lang_get($verbose_type);
}
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
 *
 * @filesource	cfieldsView.php
 *
 *
**/
require_once dirname(__FILE__) . "/../../config.inc.php";
require_once "common.php";
testlinkInitPage($db);
$templateCfg = templateConfiguration();
$cfield_mgr = new cfield_mgr($db);
$args = init_args($db);
checkRights($db, $_SESSION['currentUser'], $args);
$gui = new stdClass();
$gui->tproject_id = $args->tproject_id;
$gui->tproject_name = $args->tproject_name;
$gui->cf_map = $cfield_mgr->get_all();
$gui->cf_types = $cfield_mgr->get_available_types();
$smarty = new TLSmarty();
$smarty->assign('gui', $gui);
$smarty->display($templateCfg->template_dir . $templateCfg->default_template);
/**
 * create object with all user inputs
 *
 * @internal revisions
 * 20110417 - franciscom - BUGID 4429: Code refactoring to remove global coupling as much as possible
 */
function init_args(&$dbHandler)
{
    $_REQUEST = strings_stripSlashes($_REQUEST);
    $args = new stdClass();
    $args->tproject_id = isset($_REQUEST['tproject_id']) ? intval($_REQUEST['tproject_id']) : 0;