1
0
mirror of https://github.com/e107inc/e107.git synced 2025-01-17 20:58:30 +01:00

Added visibility option to page books/chapters.

This commit is contained in:
Cameron 2014-02-08 16:57:34 -08:00
parent 2fae296023
commit 39ef038062
3 changed files with 6 additions and 4 deletions

View File

@ -138,7 +138,8 @@ class page_chapters_ui extends e_admin_ui
'chapter_sef' => array('title'=> "SEF Url String", 'type' => 'text', 'width' => 'auto', 'readonly'=>FALSE, 'inline'=>true, 'writeParms'=>'size=xxlarge&inline-empty=1'), // Display name 'chapter_sef' => array('title'=> "SEF Url String", 'type' => 'text', 'width' => 'auto', 'readonly'=>FALSE, 'inline'=>true, 'writeParms'=>'size=xxlarge&inline-empty=1'), // Display name
'chapter_manager' => array('title'=> "Can be edited by", 'type' => 'userclass', 'inline'=>true, 'width' => 'auto', 'data' => 'int','batch'=>TRUE, 'filter'=>TRUE), 'chapter_manager' => array('title'=> "Can be edited by", 'type' => 'userclass', 'inline'=>true, 'width' => 'auto', 'data' => 'int','batch'=>TRUE, 'filter'=>TRUE),
'chapter_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => 'auto', 'thclass' => 'right', 'class'=> 'right' ), 'chapter_order' => array('title'=> LAN_ORDER, 'type' => 'text', 'width' => 'auto', 'thclass' => 'right', 'class'=> 'right' ),
'chapter_visibility' => array('title'=> LAN_VISIBILITY, 'type' => 'userclass', 'inline'=>true, 'width' => 'auto', 'data' => 'int','batch'=>TRUE, 'filter'=>TRUE),
'options' => array('title'=> LAN_OPTIONS, 'type' => 'method', 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'left last', 'class' => 'left', 'readParms'=>'sort=1') 'options' => array('title'=> LAN_OPTIONS, 'type' => 'method', 'width' => '10%', 'forced'=>TRUE, 'thclass' => 'left last', 'class' => 'left', 'readParms'=>'sort=1')
); );

View File

@ -412,6 +412,7 @@ CREATE TABLE page_chapters (
chapter_icon varchar(250) NOT NULL default '', chapter_icon varchar(250) NOT NULL default '',
chapter_order tinyint(3) unsigned NOT NULL default '0', chapter_order tinyint(3) unsigned NOT NULL default '0',
chapter_template varchar(50) NOT NULL default '', chapter_template varchar(50) NOT NULL default '',
chapter_visibility tinyint(3) unsigned NOT NULL default '0',
PRIMARY KEY (chapter_id), PRIMARY KEY (chapter_id),
KEY chapter_order (chapter_order) KEY chapter_order (chapter_order)
) ENGINE=MyISAM; ) ENGINE=MyISAM;

View File

@ -218,7 +218,7 @@ class pageClass
$text = ""; $text = "";
if(e107::getPref('listBooks',false) && $sql->select("page_chapters", "*", "chapter_parent ='0' ORDER BY chapter_order ASC ")) if(e107::getPref('listBooks',false) && $sql->select("page_chapters", "*", "chapter_parent ='0' AND chapter_visibility IN (".USERCLASS_LIST.") ORDER BY chapter_order ASC "))
{ {
$layout = e107::getPref('listBooksTemplate','default'); $layout = e107::getPref('listBooksTemplate','default');
$tml = e107::getCoreTemplate('chapter','', true, true); // always merge $tml = e107::getCoreTemplate('chapter','', true, true); // always merge
@ -282,7 +282,7 @@ class pageClass
$frm = e107::getForm(); $frm = e107::getForm();
// retrieve the template to use for this book // retrieve the template to use for this book
if(!$layout = $sql->retrieve('page_chapters','chapter_template','chapter_id = '.intval($book).' LIMIT 1')) if(!$layout = $sql->retrieve('page_chapters','chapter_template','chapter_id = '.intval($book).' AND chapter_visibility IN ('.USERCLASS_LIST.') LIMIT 1'))
{ {
$layout = 'default'; $layout = 'default';
} }
@ -293,7 +293,7 @@ class pageClass
$template = $tmpl['listChapters']; $template = $tmpl['listChapters'];
if($sql->select("page_chapters", "*", "chapter_parent = ".intval($book)." ORDER BY chapter_order ASC ")) if($sql->select("page_chapters", "*", "chapter_parent = ".intval($book)." AND chapter_visibility IN (".USERCLASS_LIST.") ORDER BY chapter_order ASC "))
{ {
$text .= $template['start']; $text .= $template['start'];