1
0
mirror of https://github.com/e107inc/e107.git synced 2025-07-30 11:20:25 +02:00

Hero now has a background image and an image/video field. Re-install and clear db cache.

This commit is contained in:
Cameron
2020-12-17 09:57:14 -08:00
parent b6dbb86c1d
commit 50af16ab45
8 changed files with 63 additions and 30 deletions

View File

@@ -80,7 +80,8 @@ class hero_ui extends e_admin_ui
protected $fields = array (
'checkboxes' => array ( 'title' => '', 'type' => null, 'data' => null, 'width' => '5%', 'thclass' => 'center', 'forced' => '1', 'class' => 'center', 'toggle' => 'e-multiselect', ),
'hero_id' => array ( 'title' => LAN_ID, 'type' => null, 'data' => 'int', 'width' => '5%', 'help' => '', 'readParms' => '', 'writeParms' => '', 'class' => 'left', 'thclass' => 'left', ),
'hero_image' => array('title'=> LAN_IMAGE, 'type'=>'image', 'data'=>'str', 'readParms'=>array('thumb'=>'100x80'), 'writeParms'=>array('media'=>'hero^')),
'hero_media' => array('title'=> "Image/Video", 'type'=>'image', 'data'=>'str', 'readParms'=>array('thumb'=>'100x80'), 'writeParms'=>array('media'=>'hero^', 'video' => 1)),
'hero_bg' => array('title'=> "Background", 'type'=>'image', 'data'=>'str', 'readParms'=>array('thumb'=>'100x80'), 'writeParms'=>array('media'=>'hero^')),
'hero_title' => array ( 'title' => LAN_TITLE, 'type' => 'text', 'data' => 'str', 'width' => '18%', 'inline' => true, 'help' => '', 'readParms' => '', 'writeParms' => array('size'=>'block-level'), 'class' => 'left', 'thclass' => 'left', ),
'hero_description' => array ( 'title' => LAN_DESCRIPTION, 'type' => 'text', 'data' => 'str', 'width' => '30%', 'inline' => true, 'help' => '', 'readParms' => '', 'writeParms' => array('size'=>'block-level'), 'class' => 'left', 'thclass' => 'left', ),
@@ -93,7 +94,7 @@ class hero_ui extends e_admin_ui
'options' => array ( 'title' => LAN_OPTIONS, 'type' => null, 'data' => null, 'width' => '10%', 'thclass' => 'center last', 'class' => 'center last', 'forced' => '1', ),
);
protected $fieldpref = array('hero_image', 'hero_title', 'hero_description', 'hero_bullets', 'hero_button1', 'hero_class');
protected $fieldpref = array('hero_media', 'hero_bg', 'hero_title', 'hero_description', 'hero_bullets', 'hero_button1', 'hero_class');
// protected $preftabs = array('General', 'Other' );

View File

@@ -108,8 +108,10 @@ li .hero-list-text {
position:relative;
text-align: center;
margin-top: -80px;
width: 100%;
width: 350px;
z-index:1000;
margin-left: auto;
margin-right: auto;
}
#carousel-hero.carousel .carousel-controls a {

View File

@@ -48,11 +48,9 @@ class hero_shortcodes extends e_shortcode
$data = e107::getDb()->retrieve('hero','*',"hero_class IN(".USERCLASS_LIST.") ORDER BY hero_order",true);
$sc = e107::getScBatch('hero', true, 'hero');
$sc = e107::getScBatch('hero',true, 'hero');
$template = e107::getTemplate('hero','hero','menu');
$template = e107::getTemplate('hero','hero','default'); // todo use a table field to make layout dynamic.
$tp = e107::getParser();
@@ -96,16 +94,11 @@ class hero_shortcodes extends e_shortcode
$sc->count = $cnt;
$text .= $tp->parseTemplate($template['item'],true,$sc);
}
$text .= $tp->parseTemplate($template['end'],true,$sc);
}
$text .= $tp->parseTemplate($template['footer'], true, $sc);

View File

@@ -37,6 +37,7 @@ if(!class_exists("hero_setup"))
if(!empty($ret['failed']))
{
e107::getMessage()->addError("Failed to import default slides.");
e107::getMessage()->addDebug(print_a($ret['failed'],true));
}
}

View File

@@ -17,14 +17,35 @@ class plugin_hero_hero_shortcodes extends e_shortcode
return $this->var['hero_id'];
}
public function sc_hero_image($parm=null)
public function sc_hero_media($parm=null)
{
if(empty($this->var['hero_image']))
if(empty($this->var['hero_media']))
{
return null;
}
return e107::getParser()->replaceConstants($this->var['hero_image'], 'full');
if(empty($parm['w']) )
{
$parm['w'] = e107::getParser()->thumbWidth();
}
if(empty($parm['h']) )
{
$parm['h'] = e107::getParser()->thumbHeight();
}
return e107::getMedia()->previewTag($this->var['hero_media'], $parm);
// return e107::getParser()->replaceConstants($this->var['hero_media'], 'full');
}
public function sc_hero_bgimage($parm=null)
{
if(empty($this->var['hero_bg']))
{
return null;
}
return e107::getParser()->replaceConstants($this->var['hero_bg'], 'full');
}
public function sc_hero_carousel_indicators($parm=null)

View File

@@ -1,11 +1,12 @@
CREATE TABLE `hero` (
`hero_id` int(10) NOT NULL AUTO_INCREMENT,
`hero_title` varchar(255) NOT NULL,
`hero_description` varchar(255) NOT NULL,
`hero_image` varchar(255) NOT NULL,
`hero_bullets` text NOT NULL,
`hero_button1` text NOT NULL,
`hero_button2` text NOT NULL,
`hero_description` varchar(255) default '',
`hero_bg` varchar(255) NOT NULL,
`hero_media` varchar(255) default '',
`hero_bullets` text default '',
`hero_button1` text default '',
`hero_button2` text default '',
`hero_order` tinyint(3) unsigned NOT NULL default '0',
`hero_class` int(5) default '0',
PRIMARY KEY (hero_id)

View File

@@ -7,12 +7,12 @@ if (!defined('e107_INIT')) { exit; }
$HERO_TEMPLATE = array();
$HERO_TEMPLATE['menu']['header'] = '<!-- Hero Menu: header -->{SETIMAGE: w=400&h=400}
$HERO_TEMPLATE['default']['header'] = '<!-- Hero Menu: header -->{SETIMAGE: w=400&h=400}
<div id="carousel-hero" class="carousel carousel-fade slide" data-ride="carousel" data-interval="{HERO_SLIDE_INTERVAL}">
<div class="carousel-inner" role="listbox">';
$HERO_TEMPLATE['menu']['footer'] = '</div><div class="carousel-controls">
$HERO_TEMPLATE['default']['footer'] = '</div><div class="carousel-controls">
<!-- Controls -->
<a class="left carousel-left carousel-control animated zoomIn animation-delay-30" href="#carousel-hero" role="button" data-slide="prev">
<i class="fa fa-chevron-left fa-fw"></i>
@@ -33,19 +33,29 @@ $HERO_TEMPLATE['menu']['footer'] = '</div><div class="carousel-controls">
</div>';
$HERO_TEMPLATE['menu']['start'] = '<div class="carousel-item item {HERO_SLIDE_ACTIVE}" style="background-image:url({HERO_IMAGE})">
$HERO_TEMPLATE['default']['start'] = '<div class="carousel-item item {HERO_SLIDE_ACTIVE}" style="background-image:url({HERO_BGIMAGE})">
<div class="container">
<div class="carousel-caption">
<div class="hero-text-container">
<header class="hero-title animated slideInLeft animation-delay-5">
<h1 class="animated fadeInLeft animation-delay-10 font-smoothing">{HERO_TITLE: enwrap=strong}</h1>
<h2 class="animated fadeInLeft animation-delay-12">{HERO_DESCRIPTION: enwrap=span&class=text-bold}</h2>
</header>
<ul class="hero-list list-unstyled">';
<div class="row">
<div class="col-md-6">
<ul class="hero-list list-unstyled">';
$HERO_TEMPLATE['menu']['end'] = ' </ul>
$HERO_TEMPLATE['default']['end'] = '</ul>
</div>
<div class="col-md-6 ">
<div class="pull-right animated fadeInRight animation-delay-10">
{HERO_MEDIA}
</div>
</div>
</div>
<div class="hero-buttons text-right">
<a href="{HERO_BUTTON1_URL}" class="btn btn-{HERO_BUTTON1_CLASS} btn-raised animated fadeInRight animation-delay-28">
{HERO_BUTTON1_ICON} {HERO_BUTTON1_LABEL}
</a>
@@ -58,7 +68,8 @@ $HERO_TEMPLATE['menu']['end'] = ' </ul>
$HERO_TEMPLATE['menu']['item'] = '<li>
$HERO_TEMPLATE['default']['item'] = '<li>
<div class="hero-list-icon animated zoomInUp {HERO_ANIMATION_DELAY}">
<span class="hero-icon hero-icon-circle hero-icon-xlg label-{HERO_ICON_STYLE} badge-{HERO_ICON_STYLE} shadow-3dp">
{HERO_ICON}

View File

@@ -56,7 +56,8 @@
"class": ""
}</field>
<field name="hero_order">0</field>
<field name="hero_image">{e_PLUGIN}hero/images/slide1.jpg</field>
<field name="hero_media"></field>
<field name="hero_bg">{e_PLUGIN}hero/images/slide1.jpg</field>
</item>
<item>
<field name="hero_id">2</field>
@@ -112,7 +113,8 @@
"class": ""
}</field>
<field name="hero_order">1</field>
<field name="hero_image">{e_PLUGIN}hero/images/slide2.jpg</field>
<field name="hero_media"></field>
<field name="hero_bg">{e_PLUGIN}hero/images/slide2.jpg</field>
</item>
<item>
<field name="hero_id">3</field>
@@ -168,7 +170,8 @@
"class": ""
}</field>
<field name="hero_order">2</field>
<field name="hero_image">{e_PLUGIN}hero/images/slide3.jpg</field>
<field name="hero_media"></field>
<field name="hero_bg">{e_PLUGIN}hero/images/slide3.jpg</field>
</item>
</dbTable>
</database>