Example #1
0
function guifi_node_get_service($id, $type, $path = FALSE)
{
    if (is_numeric($id)) {
        $z = guifi_node_load($id);
    } else {
        $z = $id;
    }
    $ret = NULL;
    if (!empty($z->{$type})) {
        $ret = $z->{$type};
    } else {
        $ret = guifi_zone_get_service($z->zone_id, $type);
    }
    if ($path) {
        if ($ret) {
            $ret = 'node/' . $ret;
        }
    }
    return $ret;
}
Example #2
0
function guifi_user_proxy_validate($element, &$form_state)
{
    $s =& $form_state['values']['services']['proxy'];
    switch ($element['#value']) {
        case t('No service'):
            $s = '-1';
            break;
        case t('Take from parents'):
            $n = node_load($form_state['values']['nid']);
            $s = guifi_zone_get_service($n->zone_id, 'proxy_id');
            break;
        default:
            $nid = explode('-', $element['#value']);
            $s = $nid[0];
    }
}