function fb_admin_page in Drupal for Facebook 7.3
Same name and namespace in other branches
- 6.3 fb.admin.inc \fb_admin_page()
- 6.2 fb.admin.inc \fb_admin_page()
Drupal page callback.
File
- ./
fb.admin.inc, line 21 - Admin pages and forms for Drupal for Facebook.
Code
function fb_admin_page() {
$apps = fb_get_all_apps();
$output = array();
if (count($apps)) {
$header = array(
t('Label'),
t('Name'),
t('Canvas'),
t('Local Operations'),
t('Remote Settings'),
);
$protocol = fb_protocol();
foreach ($apps as $fb_app) {
// Get properties from facebook.
fb_admin_get_app_info($fb_app);
$row = array();
// Title.
$row[] = $fb_app->label . ($fb_app->status ? '' : ' ' . t('(<em>not enabled</em>)'));
// New apps no longer have about pages.
$name = isset($fb_app->name) ? $fb_app->name : $fb_app->label;
$row[] = $name;
// Canvas Page.
if (isset($fb_app->namespace) && $fb_app->namespace != $fb_app->canvas) {
drupal_set_message(t('Canvas page for %label is out of sync! Facebook believes it is %fbcanvas, while our database believes %canvas. Edit and save the application to remedy this.', array(
'%label' => $fb_app->label,
'%fbcanvas' => $fb_app->namespace,
'%canvas' => $fb_app->canvas,
)), 'error');
}
if ($fb_app->canvas) {
$row[] = l($fb_app->canvas, $protocol . '://apps.facebook.com/' . $fb_app->canvas);
}
else {
$row[] = t('n/a');
}
// Local Ops
$local_links = fb_invoke(FB_ADMIN_OP_LOCAL_LINKS, array(
'fb_app' => $fb_app,
), array(
t('view') => FB_PATH_ADMIN_APPS . '/' . $fb_app->label,
t('sync props') => FB_PATH_ADMIN_APPS . '/' . $fb_app->label . '/fb/set_props',
), FB_ADMIN_HOOK);
$links = array();
foreach ($local_links as $title => $href) {
$links[] = array(
'title' => $title,
'href' => $href,
);
}
$row[] = theme('links', array(
'links' => $links,
));
// Remote Settings
$row[] = l($fb_app->id, 'https://www.facebook.com/developers/editapp.php?app_id=' . $fb_app->id);
$rows[] = $row;
}
$output['apps_table'] = array(
'#theme' => 'table',
'#header' => $header,
'#rows' => $rows,
);
}
else {
$output['intro'] = array(
'#markup' => t('Start by creating an application.'),
);
if (!module_exists('fb_app')) {
$output['module_enabled'] = array(
'#markup' => t('Enable the <em>Facebook Apps</em> module (fb_app.module) to manage an application.'),
);
}
else {
$output['add_app'] = array(
'#markup' => t('Click <a href="!url">Add Application</a> to get started.', array(
'!url' => url(FB_PATH_ADMIN . '/fb_app_create'),
)),
'#prefix' => '<p>',
'#suffix' => '</p>',
);
}
}
return $output;
}