function smileys_export_page in Smileys 6
Same name and namespace in other branches
- 5 smileys_import.module \smileys_export_page()
Menu callback; Present a page for .pak file for a Smiley pack.
1 string reference to 'smileys_export_page'
- smileys_import_menu in ./
smileys_import.module - Implementation of hook_menu().
File
- ./
smileys_import.module, line 73
Code
function smileys_export_page() {
if ($package = arg(4)) {
$smileys = db_query("SELECT * FROM {smileys} WHERE package = '%s' ORDER BY weight", $package);
if (!($packd = smileys_import_packs($package))) {
drupal_set_message(t('Cannot find smiley package %pack.', array(
'%pack' => $package,
)));
drupal_goto('admin/settings/smileys/export');
}
$smile_pak = "";
$delimeter = '=+:';
while ($smiley = db_fetch_object($smileys)) {
$smile_pak .= str_replace(dirname($packd->filename) . '/', '', $smiley->image) . $delimeter;
$smile_pak .= $smiley->description . $delimeter;
$smile_pak .= $smiley->acronyms . "\n";
}
$output = "<div id=\"module-message\">\n";
$output .= t('Bundle a .pak file containing the following text along with each smiley image in the same folder as defined by example:<br /><strong>%package</strong>', array(
'%package' => file_directory_path() . '/smileys/' . $package . '/' . $package . '.pak',
)) . "\n";
$output .= "</div>\n";
$output .= "<div id=\"module-code\">\n";
$output .= "<textarea cols=\"80\" rows=\"15\">\n";
$output .= check_plain($smile_pak);
$output .= "</textarea>\n";
$output .= "</div>\n";
}
else {
$header = array(
t('Smiley Packs'),
t('Operations'),
);
$smileyp = db_query("SELECT DISTINCT package FROM {smileys} ORDER BY package");
while ($pack = db_fetch_object($smileyp)) {
if ($pack->package != 'Uncategorized') {
$rows[] = array(
'<strong>' . check_plain($pack->package) . '</strong>',
l(t('Export'), 'admin/settings/smileys/export/' . check_plain($pack->package)),
);
}
}
$output = theme('table', $header, $rows);
if (empty($rows)) {
drupal_set_message(t('No smiley packs to export.'));
$output = '';
}
}
return $output;
}