2016-01-12 15:44:54 -08:00
< ? php
/*
* e107 website system
*
2016-12-02 10:33:29 +00:00
* Copyright ( C ) 2008 - 2016 e107 Inc ( e107 . org )
2016-01-12 15:44:54 -08:00
* Released under the terms and conditions of the
* GNU General Public License ( http :// www . gnu . org / licenses / gpl . txt )
*
*
*/
if ( ! defined ( 'e107_INIT' )) { exit ; }
//v2.x Standard for extending menu configuration within Menu Manager. (replacement for v1.x config.php)
class banner_menu
{
function __construct ()
{
2019-02-01 14:41:30 +01:00
e107 :: lan ( 'banner' , true );
2016-01-12 15:44:54 -08:00
}
/**
* Configuration Fields .
* @ return array
*/
2016-02-08 13:54:44 -08:00
public function config ( $menu = '' )
2016-01-12 15:44:54 -08:00
{
$renderTypes = array ( BNRLAN_48 , '1 - ' . BNRLAN_45 , '2 - ' . BNRLAN_46 , " 3 - " . BNRLAN_47 );
$fields = array ();
2016-12-02 10:33:29 +00:00
$fields [ 'banner_caption' ] = array ( 'title' => LAN_CAPTION , 'type' => 'text' , 'multilan' => true , 'writeParms' => array ( 'size' => 'xxlarge' ));
2016-01-12 15:44:54 -08:00
$fields [ 'banner_campaign' ] = array ( 'title' => BNRLAN_39 , 'type' => 'method' );
$fields [ 'banner_amount' ] = array ( 'title' => BNRLAN_41 , 'type' => 'text' , 'writeParms' => array ( 'pattern' => '[0-9]*' ));
2016-12-02 10:33:29 +00:00
$fields [ 'banner_width' ] = array ( 'title' => LAN_WIDTH , 'type' => 'text' , 'help' => " In pixels " , 'writeParms' => array ( 'pattern' => '[0-9]*' ));
2021-01-01 09:33:51 -08:00
$fields [ 'banner_rendertype' ] = array ( 'title' => BNRLAN_43 , 'type' => 'dropdown' , 'writeParms' => array ( 'optArray' => $renderTypes , 'size' => 'xxlarge' ));
2016-01-12 15:44:54 -08:00
return $fields ;
}
}
// optional
class banner_menu_form extends e_form
{
public function banner_campaign ( $curVal )
{
$sql = e107 :: getDb ();
$sql -> select ( " banner " , " DISTINCT(banner_campaign) as banner_campaign " , " ORDER BY banner_campaign " , " mode=no_where " );
$text = '' ;
2021-01-01 09:33:51 -08:00
if ( empty ( $curVal ))
{
$curVal = array ();
}
2016-01-12 15:44:54 -08:00
while ( $row = $sql -> fetch ())
{
2021-01-01 09:33:51 -08:00
$checked = in_array ( $row [ 'banner_campaign' ], $curVal );
2016-01-12 15:44:54 -08:00
$text .= $this -> checkbox ( 'banner_campaign[]' , $row [ 'banner_campaign' ], $checked , array ( 'label' => $row [ 'banner_campaign' ], 'class' => 'e-save' )); // e-save class is required.
}
return $text ;
}
2019-02-01 14:41:30 +01:00
}