diff --git a/e107_plugins/hero/admin_config.php b/e107_plugins/hero/admin_config.php index ad076908b..de65d11a4 100644 --- a/e107_plugins/hero/admin_config.php +++ b/e107_plugins/hero/admin_config.php @@ -98,7 +98,7 @@ class hero_ui extends e_admin_ui // protected $preftabs = array('General', 'Other' ); protected $prefs = array( - 'visibility' => array('title'=> LAN_VISIBILITY, 'tab'=>0, 'type'=>'userclass', 'data' => 'str', 'help'=>''), + 'visibility' => array('title'=> LAN_VISIBILITY, 'tab'=>0, 'type'=>'userclass', 'data' => 'str', 'help'=>'', 'writeParms'=>array('classlist' => 'public,member,guest,admin,main,classes,nobody, no-excludes')), 'icon_pack' => array('title'=> "Icon Pack", 'tab'=>0, 'type'=>'method', 'data' => 'str', 'writeParms'=>array(),'help'=>''), 'slide_interval' => array('title'=>'Slide Interval', 'type'=>'dropdown', 'data'=>'int', 'writeParms'=>array('optArray'=>array())), ); diff --git a/e107_plugins/hero/css/hero.css b/e107_plugins/hero/css/hero.css index 1a0b73fea..5773d0243 100644 --- a/e107_plugins/hero/css/hero.css +++ b/e107_plugins/hero/css/hero.css @@ -58,10 +58,11 @@ li .hero-list-text { #carousel-hero.carousel { position: relative; left: 0; - top: 0; + top: 30px; width: 100%; height: 100%; - overflow: hidden + overflow: hidden; + margin-bottom: 30px; } #carousel-hero.carousel .carousel-indicators li { @@ -78,9 +79,9 @@ li .hero-list-text { #carousel-hero.carousel .carousel-indicators { position: static; width: auto; - display: inline-block; - margin: 0; - text-align: left; + display: block; + margin: 15px; + text-align: center; } #carousel-hero.carousel .carousel-indicators li { @@ -94,7 +95,8 @@ li .hero-list-text { margin: 2px; margin-top: 10px; border-radius: 2px; - cursor: pointer + cursor: pointer; + text-align:center; } #carousel-hero.carousel .carousel-indicators li.active { @@ -103,10 +105,11 @@ li .hero-list-text { } #carousel-hero.carousel .carousel-controls { - position: absolute; - left: 20px; - bottom: 20px; - width: 160px + position:relative; + text-align: center; + margin-top: -80px; + width: 100%; + z-index:1000; } #carousel-hero.carousel .carousel-controls a { @@ -125,7 +128,7 @@ li .hero-list-text { text-align: center; cursor: pointer; transition: all ease .5s; - margin-right: 10px; + margin-left: 1rem; margin-right: 1rem } @@ -141,8 +144,8 @@ li .hero-list-text { } #carousel-hero.carousel .carousel-controls a.right { - margin-right: 20px; - margin-right: 2rem + margin-right: 0; + margin-right: 1rem } #carousel-hero.carousel .carousel-inner { diff --git a/e107_plugins/hero/e_shortcode.php b/e107_plugins/hero/e_shortcode.php new file mode 100644 index 000000000..6b434c933 --- /dev/null +++ b/e107_plugins/hero/e_shortcode.php @@ -0,0 +1,117 @@ +active = check_class($pref['visibility']); + + } + + /** + * @param null $parm + * @example {HERO} + * @return string + */ + function sc_hero($parm = null) // Naming: "sc_" + [plugin-directory] + '_uniquename' + { + if(empty($this->active)) + { + return null; + } + + $text = ""; + + // if(!empty($parm)) + // { + // $text .= print_a($parm,true); // e_menu.php form data. + // } + + $data = e107::getDb()->retrieve('hero','*',"hero_class IN(".USERCLASS_LIST.") ORDER BY hero_order",true); + + + $sc = e107::getScBatch('hero',true, 'hero'); + + $template = e107::getTemplate('hero','hero','menu'); + + + $tp = e107::getParser(); + + $totalSlides = count($data); + + $default = array('hero_total_slides'=>$totalSlides); + + if(!is_object($sc)) + { + return "Hero shortcodes failed to load"; + } + + $sc->setVars($default); + + $text = $tp->parseTemplate($template['header'],true, $sc); + + foreach($data as $k=>$row) + { + $bullet = e107::unserialize($row['hero_bullets']); + $row['hero_bullets'] = $bullet; + + $button1 = e107::unserialize($row['hero_button1']); + $row['hero_button1'] = $button1; + + $button2 = e107::unserialize($row['hero_button2']); + $row['hero_button2'] = $button2; + + $row['hero_slide_active'] = ($k == 0) ? 'active' : ''; + $row['hero_total_slides'] = $totalSlides; + + $sc->setVars($row); + + $text .= $tp->parseTemplate($template['start'],true,$sc); + + foreach($row['hero_bullets'] as $cnt=>$row2) + { + if(empty($row2['text'])) + { + continue; + } + + $sc->count = $cnt; + + + $text .= $tp->parseTemplate($template['item'],true,$sc); + + } + + + $text .= $tp->parseTemplate($template['end'],true,$sc); + + + + } + + $text .= $tp->parseTemplate($template['footer'], true, $sc); + + return $text; + + } + +} diff --git a/e107_plugins/hero/hero_menu.php b/e107_plugins/hero/hero_menu.php index 21de8bc01..d505258ed 100644 --- a/e107_plugins/hero/hero_menu.php +++ b/e107_plugins/hero/hero_menu.php @@ -13,97 +13,5 @@ if (!defined('e107_INIT')) { exit; } -// $sql = e107::getDB(); // mysql class object -// $tp = e107::getParser(); // parser for converting to HTML and parsing templates etc. -// $frm = e107::getForm(); // Form element class. -// $ns = e107::getRender(); // render in theme box. - -//require_once("../../class2.php"); -// define('e_IFRAME', true); -//require_once(HEADERF); - -$text = ""; - -if(!empty($parm)) -{ -// $text .= print_a($parm,true); // e_menu.php form data. -} - -$data = e107::getDb()->retrieve('hero','*',"hero_class IN(".USERCLASS_LIST.") ORDER BY hero_order",true); - - -$sc = e107::getScBatch('hero',true, 'hero'); - -$template = e107::getTemplate('hero','hero','menu'); - - -$tp = e107::getParser(); - -$totalSlides = count($data); - -$default = array('hero_total_slides'=>$totalSlides); - -if(!is_object($sc)) -{ - return "Hero shortcodes failed to load"; -} - -$sc->setVars($default); - -$text = $tp->parseTemplate($template['header'],true, $sc); - -foreach($data as $k=>$row) -{ - $bullet = e107::unserialize($row['hero_bullets']); - $row['hero_bullets'] = $bullet; - - $button1 = e107::unserialize($row['hero_button1']); - $row['hero_button1'] = $button1; - - $button2 = e107::unserialize($row['hero_button2']); - $row['hero_button2'] = $button2; - - $row['hero_slide_active'] = ($k == 0) ? 'active' : ''; - $row['hero_total_slides'] = $totalSlides; - - $sc->setVars($row); - - $text .= $tp->parseTemplate($template['start'],true,$sc); - - foreach($row['hero_bullets'] as $cnt=>$row2) - { - if(empty($row2['text'])) - { - continue; - } - - $sc->count = $cnt; - - - $text .= $tp->parseTemplate($template['item'],true,$sc); - - } - - - $text .= $tp->parseTemplate($template['end'],true,$sc); - - - -} - -$text .= $tp->parseTemplate($template['footer'], true, $sc); - +$text = e107::getParser()->parseTemplate("{HERO}", true); e107::getRender()->tablerender(null, $text, 'hero-menu'); - -/* -$arr = array( - 0 => array('caption'=>'Slide 1', 'text'=>'
Slide 1 text
'), - 1 => array('caption'=> 'Slide 2', 'text'=> '
Slide 2 text
') -); - -$text = e107::getForm()->carousel('my-carousel',$arr); - -e107::getRender()->tablerender("Core", print_a($text,true), 'hero-menu');*/ - -//require_once(FOOTERF); - diff --git a/e107_plugins/hero/hero_shortcodes.php b/e107_plugins/hero/hero_shortcodes.php index 7051550fd..99e369b29 100644 --- a/e107_plugins/hero/hero_shortcodes.php +++ b/e107_plugins/hero/hero_shortcodes.php @@ -210,6 +210,11 @@ class plugin_hero_hero_shortcodes extends e_shortcode public function sc_hero_button1_label($parm=null) { + if(empty($this->var['hero_button1']['label'])) + { + return null; + } + return e107::getParser()->parseTemplate($this->var['hero_button1']['label'], true); } diff --git a/e107_plugins/hero/templates/hero_template.php b/e107_plugins/hero/templates/hero_template.php index a5d5b0bbd..fd7db8aac 100644 --- a/e107_plugins/hero/templates/hero_template.php +++ b/e107_plugins/hero/templates/hero_template.php @@ -34,6 +34,7 @@ $HERO_TEMPLATE['menu']['footer'] = '';