function smiley_export_page in Smiley 6
Menu callback; Present a page for .pak file for a Smiley pack.
1 string reference to 'smiley_export_page'
- smiley_import_menu in ./
smiley_import.module - Implementation of hook_menu().
File
- ./
smiley_import.module, line 73
Code
function smiley_export_page() {
if ($package = arg(4)) {
$smileys = db_query("SELECT * FROM {smiley} WHERE package = '%s' ORDER BY weight", $package);
if (!($packd = smiley_import_packs($package))) {
drupal_set_message(t('Cannot find smiley package %pack.', array(
'%pack' => $package,
)));
drupal_goto('admin/settings/smiley/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() . '/smiley/' . $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 {smiley} 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/smiley/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;
}