1+ <?php
2+
3+ class DocManagerFrontend {
4+ var $ dm = null ;
5+ var $ modx = null ;
6+
7+ function __construct (&$ dm , &$ modx ) {
8+ $ this ->dm = &$ dm ;
9+ $ this ->modx = &$ modx ;
10+ include (MODX_MANAGER_PATH .'includes/controls/datagrid.class.php ' );
11+ }
12+
13+ function getViews () {
14+ $ this ->renderTemplates ();
15+ $ this ->renderTemplateVars ();
16+ $ this ->renderDocGroups ();
17+ $ this ->renderMisc ();
18+ $ this ->renderChangeAuthors ();
19+ $ this ->renderDocumentSelect ();
20+ }
21+
22+ function renderTemplates () {
23+ $ templateRecordSet = $ this ->modx ->db ->select ('id,templatename,description ' , $ this ->modx ->getFullTableName ('site_templates ' ),'' ,'id ASC ' );
24+
25+ $ grd = new DataGrid ('' , $ templateRecordSet );
26+ $ grd ->noRecordMsg = $ this ->dm ->lang ['DM_tpl_no_templates ' ];
27+ $ grd ->cssClass = "grid " ;
28+ $ grd ->columnHeaderClass = "gridHeader " ;
29+ $ grd ->itemClass = "gridItem " ;
30+ $ grd ->altItemClass = "gridAltItem " ;
31+ $ grd ->columns = " , " . $ this ->dm ->lang ['DM_tpl_column_id ' ] . ", " . $ this ->dm ->lang ['DM_tpl_column_name ' ] . ", " . $ this ->dm ->lang ['DM_tpl_column_description ' ];
32+ $ grd ->colTypes = "template:<input type='radio' name='id' value='[+id+]' /> " ;
33+ $ grd ->colWidths = "5%,5%,40%,50% " ;
34+ $ grd ->fields = "template,id,templatename,description " ;
35+
36+ $ this ->dm ->ph ['templates.grid ' ] = $ grd ->render ();
37+ $ this ->dm ->ph ['view.templates ' ] = $ this ->dm ->parseTemplate ('templates.tpl ' , $ this ->dm ->ph );
38+ }
39+
40+ function renderTemplateVars () {
41+ $ templateRecordSet = $ this ->modx ->db ->select ('id,templatename,description ' , $ this ->modx ->getFullTableName ('site_templates ' ),'' ,'id ASC ' );
42+
43+ $ grd = new DataGrid ('' , $ templateRecordSet );
44+ $ grd ->noRecordMsg = $ this ->dm ->lang ['DM_tpl_no_templates ' ];
45+ $ grd ->cssClass = "grid " ;
46+ $ grd ->columnHeaderClass = "gridHeader " ;
47+ $ grd ->itemClass = "gridItem " ;
48+ $ grd ->altItemClass = "gridAltItem " ;
49+ $ grd ->columns = " , " . $ this ->dm ->lang ['DM_tpl_column_id ' ] . ", " . $ this ->dm ->lang ['DM_tpl_column_name ' ] . ", " . $ this ->dm ->lang ['DM_tpl_column_description ' ];
50+ $ grd ->colTypes = 'template:<input name="tid" type="radio" value="[+id+]" onclick="loadTemplateVars( \'[+id+] \');" /> ' ;
51+ $ grd ->colWidths = "5%,5%,40%,50% " ;
52+ $ grd ->fields = "template,id,templatename,description " ;
53+
54+ $ this ->dm ->ph ['templatevars.grid ' ] = $ grd ->render ();
55+ $ this ->dm ->ph ['view.templatevars ' ] = $ this ->dm ->parseTemplate ('templatevars.tpl ' , $ this ->dm ->ph );
56+ }
57+
58+ function renderDocGroups () {
59+ $ documentgroups = $ this ->modx ->db ->select ('id,name ' , $ this ->modx ->getFullTableName ('documentgroup_names ' ),'' ,'id ASC ' );
60+
61+ $ grd = new DataGrid ('' , $ documentgroups );
62+ $ grd ->noRecordMsg = $ this ->dm ->lang ['DM_doc_no_docs ' ];
63+ $ grd ->cssClass = "grid " ;
64+ $ grd ->columnHeaderClass = "gridHeader " ;
65+ $ grd ->itemClass = "gridItem " ;
66+ $ grd ->altItemClass = "gridAltItem " ;
67+ $ grd ->columns = " , " . $ this ->dm ->lang ['DM_doc_column_id ' ] . ", " . $ this ->dm ->lang ['DM_doc_column_name ' ];
68+ $ grd ->colTypes = "template:<input type='radio' name='docgroupid' value='[+id+]' /> " ;
69+ $ grd ->colWidths = "5%,5%,40%,50% " ;
70+ $ grd ->fields = "template,id,name " ;
71+
72+ $ this ->dm ->ph ['documentgroups.grid ' ] = $ grd ->render ();
73+ $ this ->dm ->ph ['view.documentgroups ' ] = $ this ->dm ->parseTemplate ('documentgroups.tpl ' , $ this ->dm ->ph );
74+ }
75+
76+ function renderDocumentSelect () {
77+ $ this ->dm ->ph ['view.documents ' ] = $ this ->dm ->parseTemplate ('documents.tpl ' , $ this ->dm ->ph );
78+ }
79+
80+
81+ function renderMisc () {
82+ $ this ->dm ->ph ['view.misc ' ] = $ this ->dm ->parseTemplate ('misc.tpl ' , $ this ->dm ->ph );
83+ $ this ->dm ->ph ['view.tab ' ] = (isset ($ _GET ['tab ' ]) && is_numeric ($ _GET ['tab ' ])) ? '<script type="text/javascript"> tpResources.setSelectedIndex( ' .$ _GET ['tab ' ].' );</script> ' : '' ;
84+ }
85+
86+ function renderChangeAuthors () {
87+ $ users = $ this ->modx ->db ->select ('id,username ' , $ this ->modx ->getFullTableName ('manager_users ' ));
88+ $ userOptions = '' ;
89+
90+ while ($ row = $ this ->modx ->db ->getRow ($ users )) {
91+ $ userOptions .= '<option value=" ' . $ row ['id ' ] . '"> ' . $ row ['username ' ] . '</option> ' ;
92+ }
93+ $ this ->dm ->ph ['changeauthors.options ' ] = $ userOptions ;
94+ $ this ->dm ->ph ['view.changeauthors ' ] = $ this ->dm ->parseTemplate ('changeauthors.tpl ' , $ this ->dm ->ph );
95+ }
96+ }
97+ ?>
0 commit comments