Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions e107_core/templates/emailprint_template.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

if (!defined('e107_INIT')) { exit; }

if(deftrue('BOOTSTRAP'))
{
$EMAILPRINT_TEMPLATE['ICON_EMAIL'] = "<i class='fas fa-envelope'></i>"; //$tp->toGlyph('fa-envelope',false);
$EMAILPRINT_TEMPLATE['ICON_PRINT'] = "<i class='fas fa-print'></i>"; //$tp->toGlyph('fa-print',false);
}
else // BC
{
$EMAILPRINT_TEMPLATE['ICON_EMAIL'] = "<img src='".e_IMAGE_ABS."generic/email.png' alt='".LAN_EMAIL_7."' />";
$EMAILPRINT_TEMPLATE['ICON_PRINT'] = "<img src='".e_IMAGE_ABS."generic/printer.png' alt='".LAN_PRINT_1."' />";
}

$EMAILPRINT_TEMPLATE['email'] = "<a rel='alternate' class='e-tip hidden-print btn btn-default btn-secondary hidden-print' href='{EMAILICON: url=1}' title='".LAN_EMAIL_7."'>".$EMAILPRINT_TEMPLATE['ICON_EMAIL']."</a>";
$EMAILPRINT_TEMPLATE['print'] = "<a rel='alternate' class='e-tip btn btn-default btn-secondary hidden-print' href='{PRINTICON: url=1}' title='".LAN_PRINT_1."'>".$EMAILPRINT_TEMPLATE['ICON_PRINT']."</a>";
56 changes: 46 additions & 10 deletions e107_handlers/emailprint_class.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,17 @@ class emailprint
*/
static function render_emailprint($mode, $id, $look = 0, $parm=array())
{
//currently only used in news_shortcodes -> sc_emailicon & sc_printicon
// failsafe for output single button data, if you request all buttons parm can't be used....
$parm = ($look == 0)?null:$parm;

// $look = 0 --->display all icons
// $look = 1 --->display email icon only
// $look = 2 --->display print icon only

// $parm['url'] --->output url only
// no $parm or $parm['class']--> output full button render
// $parm['class'] --->used to inject class in output, redundant if using templates
$tp = e107::getParser();

$text_emailprint = "";
Expand Down Expand Up @@ -68,33 +76,61 @@ static function render_emailprint($mode, $id, $look = 0, $parm=array())
}
}

$TEMPLATE = e107::getCoreTemplate('emailprint');
$sc = e107::getScBatch($mode);


$genericMail = $tp->parseTemplate($TEMPLATE['ICON_EMAIL'], true, $sc);
$genericPrint = $tp->parseTemplate($TEMPLATE['ICON_PRINT'], true, $sc);
// Default icons if there's no templated icons
if(deftrue('BOOTSTRAP'))
{
$genericMail = $tp->toGlyph('fa-envelope',false); // "<i class='icon-envelope'></i>";
$genericPrint = $tp->toGlyph('fa-print',false); // "<i class='icon-print'></i>";
// $genericMail = $tp->toGlyph('fa-envelope',false); // "<i class='icon-envelope'></i>";
// $genericPrint = $tp->toGlyph('fa-print',false); // "<i class='icon-print'></i>";
$genericMail = $genericMail?:$tp->toGlyph('fa-envelope',false); // "<i class='icon-envelope'></i>";
$genericPrint = $genericPrint?:$tp->toGlyph('fa-print',false); // "<i class='icon-print'></i>";
// Probably redundant if using templates. Left here for legacy purposes?
$class = !empty($parm['class']) ? $parm['class'] : "btn btn-default btn-secondary";
}
else // BC
{
$genericMail = "<img src='".e_IMAGE_ABS."generic/email.png' alt='".LAN_EMAIL_7."' />";
$genericPrint = "<img src='".e_IMAGE_ABS."generic/printer.png' alt='".LAN_PRINT_1."' />";
// $genericMail = "<img src='".e_IMAGE_ABS."generic/email.png' alt='".LAN_EMAIL_7."' />";
// $genericPrint = "<img src='".e_IMAGE_ABS."generic/printer.png' alt='".LAN_PRINT_1."' />";
$genericMail = $genericMail?:"<img src='".e_IMAGE_ABS."generic/email.png' alt='".LAN_EMAIL_7."' />";
$genericPrint = $genericPrint?:"<img src='".e_IMAGE_ABS."generic/printer.png' alt='".LAN_PRINT_1."' />";
$class = "";
}


if ($look == 0 || $look == 1)
{
// Probably redundant if using templates. Left here for legacy purposes?
$ico_mail = (defined("ICONMAIL") && file_exists(THEME."images/".ICONMAIL) ? "<img src='".THEME_ABS."images/".ICONMAIL."' alt='".LAN_EMAIL_7."' />" : $genericMail);
//TDOD CSS class
$text_emailprint .= "<a class='e-tip hidden-print ".$class."' href='".e_HTTP."email.php?".$email.".".$id."' title='".LAN_EMAIL_7."'>".$ico_mail."</a> ";
$url_mail = e_HTTP."email.php?".$email.".".$id;
if (!$parm || !empty($parm['class'])){
// Default output without templates. Left here for legacy purposes?
//TODO CSS class
// $text_emailprint .= "<a class='e-tip hidden-print ".$class."' href='".$url_mail."' title='".LAN_EMAIL_7."'>".$ico_mail."</a> ";

$text_emailprint .= $tp->parseTemplate($TEMPLATE['email'], true, $sc)?:"<a class='e-tip hidden-print ".$class."' href='".$url_mail."' title='".LAN_EMAIL_7."'>".$ico_mail."</a> ";

} else if (!empty($parm['url'])) {
$text_emailprint .= $url_mail;
}
}
if ($look == 0 || $look == 2)
{
// Probably redundant if using templates. Left here for legacy purposes?
$ico_print = (defined("ICONPRINT") && file_exists(THEME."images/".ICONPRINT) ? "<img src='".THEME_ABS."images/".ICONPRINT."' alt='".LAN_PRINT_1."' />" : $genericPrint);
//TODO CSS class
$text_emailprint .= "<a rel='alternate' class='e-tip ".$class." hidden-print' href='".e_HTTP."print.php?".$print.".".$id."' title='".LAN_PRINT_1."'>".$ico_print."</a>";
$url_print = e_HTTP."print.php?".$print.".".$id;
if (!$parm || !empty($parm['class'])){
// Default output without templates. Left here for legacy purposes?
//TODO CSS class
// $text_emailprint .= "<a rel='alternate' class='e-tip ".$class." hidden-print' href='".e_HTTP."print.php?".$print.".".$id."' title='".LAN_PRINT_1."'>".$ico_print."</a>";

$text_emailprint .= $tp->parseTemplate($TEMPLATE['print'], true, $sc)?:"<a rel='alternate' class='e-tip ".$class." hidden-print' href='".$url_print."' title='".LAN_PRINT_1."'>".$ico_print."</a>";

} else if (!empty($parm['url'])) {
$text_emailprint .= $url_print;
}
}
return $text_emailprint;
}
Expand Down
Loading