示例#1
0
function guifi_radio_validate($form, $edit)
{
    guifi_log(GUIFILOG_TRACE, "function _guifi_radio_validate()");
    if ($edit['variable']['firmware'] != 'n/a' and $edit['variable']['firmware'] != NULL) {
        $radiof = db_fetch_object(db_query("\n      SELECT model\n      FROM {guifi_model_specs}\n      WHERE mid='%d'", $edit['variable']['model_id']));
        if (!guifi_type_relation('firmware', $edit['variable']['firmware'], $radiof->model)) {
            form_set_error('variable][firmware', t('This firmware with this radio model is NOT supported.'));
        }
    }
}
示例#2
0
function theme_budgets_supplier_footer($node, $teaser)
{
    global $user;
    $output = '<br></hr><em>' . strtoupper(t($node->role)) . '</em><br>';
    $max = 0;
    $max < count($node->certs['tp_certs']) ? $max = count($node->certs['tp_certs']) : NULL;
    $max < count($node->certs['guifi_certs']) ? $max = count($node->certs['guifi_certs']) : NULL;
    $max < count($node->caps['caps_services']) ? $max = count($node->caps['caps_services']) : NULL;
    $max < count($node->caps['caps_network']) ? $max = count($node->caps['caps_network']) : NULL;
    $max < count($node->caps['caps_project']) ? $max = count($node->caps['caps_project']) : NULL;
    $tp_certs = guifi_types('tp_certs');
    $guifi_certs = guifi_types('guifi_certs');
    $caps_services = guifi_types('caps_services');
    $caps_network = guifi_types('caps_network');
    $caps_project = guifi_types('caps_project');
    $certs = array();
    if ($teaser) {
        if (count($node->certs) > 0) {
            $certs_types = array_merge($tp_certs, $guifi_certs);
            foreach ($node->certs as $kcert => $cert_values) {
                foreach ($cert_values as $k => $value) {
                    $certs[] = $certs_types[$k];
                }
            }
            $output .= t('Certifications') . ':<small> ' . implode(', ', $certs) . '</small>';
        }
        if (count($node->caps) > 0) {
            $caps_types = array_merge($caps_services, $caps_network, $caps_project);
            foreach ($node->caps as $kcap => $cap_values) {
                foreach ($cap_values as $k => $value) {
                    guifi_log(GUIFILOG_TRACE, 'caps', $kcap . ' ' . $k . ' ' . $node->role);
                    if (guifi_type_relation($kcap, $k, $node->role)) {
                        $caps[] = $caps_types[$k];
                    }
                }
            }
            if (count($caps) > 0) {
                $output .= ' ' . t('Capabilities') . ':<small> ' . implode(', ', $caps) . '</small>';
            }
        }
    } else {
        $output .= '<small />';
        for ($i = 0; $i < $max; $i++) {
            $rows[$i] = array(array('data' => $tp_certs[key($node->certs['tp_certs'])] . ' ' . current($node->certs['tp_certs'])), array('data' => $guifi_certs[key($node->certs['guifi_certs'])] . ' ' . current($node->certs['guifi_certs'])), array('data' => theme_budgets_supplier_showcap($caps_services[key($node->caps['caps_services'])], current($node->caps['caps_services']))), array('data' => theme_budgets_supplier_showcap($caps_network[key($node->caps['caps_network'])], current($node->caps['caps_network']))), array('data' => theme_budgets_supplier_showcap($caps_project[key($node->caps['caps_project'])], current($node->caps['caps_project']))));
            next($node->certs['tp_certs']);
            next($node->certs['guifi_certs']);
            next($node->caps['caps_services']);
            next($node->caps['caps_network']);
            next($node->caps['caps_project']);
        }
        $headers = array(array('data' => t('Professional certifications')), array('data' => t('guifi.net certifications')), array('data' => t('Services')), array('data' => t('Network infraestructure')), array('data' => t('Projects')));
        $output .= theme('table', $headers, $rows);
        /*
         * Contact
         */
        if ($user->uid) {
            $contact .= t('Email contact: ') . '<a href="mailto:' . $node->notification . '">' . $node->notification . '</a>';
        } else {
            $contact .= l(t('Login to view email contact'), 'user/login');
        }
        if (!empty($node->phone)) {
            $contact .= ' - ' . t('Phone(s): ') . $node->phone;
        }
        /*
         * Address
         */
        $address = $node->address1;
        if (!empty($node->address2)) {
            $address .= ',' . $node->address2;
        }
        $address .= ' ' . $node->postal_code . ' ' . $node->city . ' ' . $node->country;
        if (!empty($address)) {
            $output .= theme('box', t('Contact'), $contact . '<hr />' . $address);
        } else {
            $output .= theme('box', t('Contact'), $contact);
        }
    }
    return $output;
}