@@ -8,6 +8,7 @@ public function __construct()
88 parent ::__construct ();
99 $ this ->load ->model ('admin_model ' );
1010 $ this ->load ->helper ('url ' );
11+ $ this ->load ->library ('pagination ' );
1112 }
1213
1314 /**
@@ -102,28 +103,90 @@ public function logout()//登出功能
102103 */
103104 public function article ()
104105 {
105- $ data ['rows ' ] = $ this ->admin_model ->article ();
106+ $ config ['base_url ' ] = 'http://cc.com:89/admin/admin/article ' ;
107+ $ config ['total_rows ' ] = $ this ->db ->get ("article " )->num_rows ();
108+ $ config ['per_page ' ] = 8 ;
109+ $ config ['num_links ' ] = 100 ;
110+ $ this ->pagination ->initialize ($ config );
111+
112+ $ data ['rows ' ] = $ this ->admin_model ->article ($ config );
106113 $ this ->load ->view ('admin/article ' , $ data );
107114 }
108115
109116 public function diaries ()
110117 {
111- $ data ['rows ' ] = $ this ->admin_model ->diaries ();
118+ $ config ['base_url ' ] = 'http://cc.com:89/admin/admin/diaries ' ;
119+ $ config ['total_rows ' ] = $ this ->db ->get ("diaries " )->num_rows ();
120+ $ config ['per_page ' ] = 8 ;
121+ $ config ['num_links ' ] = 100 ;
122+ $ this ->pagination ->initialize ($ config );
123+
124+ $ data ['rows ' ] = $ this ->admin_model ->diaries ($ config );
112125 $ this ->load ->view ('admin/diaries ' , $ data );
113126 }
114127
115128 public function tweets ()
116129 {
117- $ data ['rows ' ] = $ this ->admin_model ->tweets ();
130+ $ config ['base_url ' ] = 'http://cc.com:89/admin/admin/tweets ' ;
131+ $ config ['total_rows ' ] = $ this ->db ->get ("tweets " )->num_rows ();
132+ $ config ['per_page ' ] = 10 ;
133+ $ config ['num_links ' ] = 100 ;
134+ $ this ->pagination ->initialize ($ config );
135+
136+ $ data ['rows ' ] = $ this ->admin_model ->tweets ($ config );
118137 $ this ->load ->view ('admin/tweets ' , $ data );
119138 }
120139
121140 public function guestbook ()
122141 {
123- $ data ['rows ' ] = $ this ->admin_model ->guestbook ();
142+ $ config ['base_url ' ] = 'http://cc.com:89/admin/admin/guestbook ' ;
143+ $ config ['total_rows ' ] = $ this ->db ->get ("guestbook " )->num_rows ();
144+ $ config ['per_page ' ] = 8 ;
145+ $ config ['num_links ' ] = 100 ;
146+ $ this ->pagination ->initialize ($ config );
147+
148+ $ data ['rows ' ] = $ this ->admin_model ->guestbook ($ config );
124149 $ this ->load ->view ('admin/guestbook ' , $ data );
125150 }
126151
152+ public function reply ($ id )
153+ {
154+ if ($ _SESSION ['logged_in ' ] == TRUE )
155+ {
156+ $ data ['rows ' ] = $ this ->admin_model ->reply ($ id );
157+ $ this ->load ->view ('admin/reply ' , $ data );
158+ }else {
159+ redirect ('admin/admin/login ' );
160+ }
161+ }
162+
163+ public function reply_store ()
164+ {
165+ if ($ _SESSION ['logged_in ' ] == TRUE )
166+ {
167+ if ($ _POST != True )
168+ {
169+ $ this ->load ->view ('admin/reply ' );
170+ }
171+ elseif (
172+ $ this ->input ->post ('name ' ) &&
173+ $ this ->input ->post ('content ' ) &&
174+ $ this ->input ->post ('date ' ) != null
175+ ){
176+ $ name = $ this ->input ->post ('name ' );
177+ $ content = $ this ->input ->post ('content ' );
178+ $ date = $ this ->input ->post ('date ' );
179+
180+ $ result = $ this ->admin_model ->reply_store ($ name , $ content , $ date );
181+ $ this ->load ->view ('admin/reply ' , $ result );
182+ }else {
183+ $ this ->load ->view ('admin/reply ' );
184+ }
185+ }else {
186+ redirect ('admin/admin/login ' );
187+ }
188+ }
189+
127190 public function photos ()
128191 {
129192 $ data ['rows ' ] = $ this ->admin_model ->photos ();
0 commit comments