Guest User

Untitled

a guest
May 26th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.56 KB | None | 0 0
  1. <?php
  2. /* Koberz Bili?im.
  3. * @2010
  4. * BölÃ?mler ModÃ?l Sayfası
  5. * mod/mod_durum/index.php
  6. */
  7. class mod_durum_mod {
  8. function __construct() {
  9. // Tema KÃ?tÃ?phanesini Ça?ıralım
  10. $this->tema = Load::lib ( 'Template' );
  11. // Database KÃ?tÃ?phanesini YÃ?kleyelim
  12. $this->db = Load::lib ( 'Database' );
  13. // Site ayarlarını çekelim
  14. $this->site = Kayit::getir ( 'site_config' );
  15. // Dil Dosyasını Ça?ıralım
  16. $this->lang = Load::lang ( 'mod_durum' );
  17. // Dil Dosyasını Temaya Gönderelim
  18. $this->tema->lang ( $this->lang );
  19. // Session KÃ?tÃ?phanesi
  20. $this->ses = Load::lib ( 'Session' );
  21. // User Model
  22. $this->user = Load::model ( 'mod_user.user' );
  23. }
  24.  
  25. public function index() {
  26. echo 'Well Come To Hell';
  27. }
  28.  
  29. public function ekle($yerid=NULL) {
  30. // Ekleme Yetkisi varmı?
  31.  
  32. if ($this->user->yetki ( 'mod_durum', 'ekle', $this->lang ['mod_durum'] ['rhata'] ['ekle'], 1 ) === False) {
  33. return False;
  34. }
  35.  
  36. if (Req::is_Post ( 'ekle' )) {
  37. $this->_ekle ();
  38. }
  39.  
  40. if (Roll::varmi ('mod_yer', 'moderate' ) === False) {
  41. $yerlist=Run::import('mod_yer','_optgrupu');
  42. }else{
  43. $yerlist=Run::import('mod_yer','_optgrup');
  44. }
  45.  
  46.  
  47. Run::import ( 'index', '_index' );
  48. $this->site ['title'] = $this->lang ['mod_durum'] ['1'];
  49. $this->tema->veri ( 'tpl', 'mod_durum/ekle.tpl' );
  50. $this->tema->veri('yerlist',$yerlist);
  51. $this->tema->veri ( 'site', $this->site );
  52. }
  53.  
  54. // DÃ?zenleme Fonksiyonu
  55. public function duzenle($id = NULL) {
  56. // DÃ?zenleme Yetkisi varmı?
  57. if ($this->user->yetki ( 'mod_durum', 'duzenle', $this->lang ['mod_durum'] ['rhata'] ['duzenle'], 1 ) === False) {
  58. return False;
  59. }
  60.  
  61. $this->i = Load::model ( 'mod_durum' );
  62.  
  63. $id = Req::Url_Clear ( $id );
  64. if ($this->i->exists_id ( $id ) === False) {
  65. exit ( 'AAAA...' );
  66. return;
  67. }
  68. $this->i->Getid ( $id );
  69.  
  70. $d = $this->db->result;
  71. // E?er Eklenen ?çerik Ba?kasınınsa Yönetme Yetkisi Varmı ?
  72. if ($this->user->yetkili ( 'mod_durum', $d->user_id, $this->lang ['mod_durum'] ['rhata'] ['1'], 1 ) === False) {
  73. return False;
  74. }
  75.  
  76. if (Req::is_Post ( 'duzenle' )) {
  77. $this->_duzenle ();
  78. }
  79.  
  80. if (Roll::varmi ('mod_yer', 'moderate' ) === False) {
  81. $yerlist=Run::import('mod_yer','_optgrupu',array($d->yer_id));
  82. }else{
  83. $yerlist=Run::import('mod_yer','_optgrup',array($d->yer_id));
  84. }
  85. $d = Helper::convertObjectToArray ( $d );
  86. $this->site ['title'] = $this->lang ['mod_durum'] ['40'];
  87. Run::import ( 'index', '_index' );
  88. $this->tema->veri ( 'd', $d );
  89. $this->tema->veri('yerlist',$yerlist);
  90. $this->tema->veri ( 'tpl', 'mod_durum/duzenle.tpl' );
  91. $this->tema->veri ( 'site', $this->site );
  92. }
  93.  
  94. function listele($id=NULL) {
  95. $bolum=Load::model('mod_yer');
  96. // Çalı?ma Yeri Varmı
  97. if($id!=NULL){
  98. if ($bolum->exists_id($id)===False) {
  99. return Helper::yonver ( 'mod_yer/listele' );
  100. }
  101. }
  102.  
  103. // Listeleme Yetkisi varmı?
  104. if ($this->user->yetki ( 'mod_durum', 'listele', $this->lang ['mod_durum'] ['rhata'] ['listele'], 1 ) === False) {
  105. return False;
  106. }
  107. Run::import ( 'index', '_index' );
  108. $this->site ['title'] = $this->lang ['mod_durum'] ['3'];
  109. $this->tema->veri('yer',$id);
  110. $this->tema->veri ( 'tpl', 'mod_durum/listele.tpl' );
  111. $this->tema->veri ( 'site', $this->site );
  112.  
  113. }
  114.  
  115. function xml($gelenid=NULL) {
  116. // Listeleme Yetkisi varmı?
  117. if ($this->user->yetki ( 'mod_durum', 'listele', $this->lang ['mod_durum'] ['rhata'] ['listele'], 1 ) === False) {
  118. return False;
  119. }
  120. $this->grid = Load::model ( 'mod_durum.grid' );
  121. return $this->grid->xml ($gelenid);
  122. }
  123.  
  124. function sil() {
  125. // Silme Yetkisi varmı?
  126. if ($this->user->yetki ( 'mod_durum', 'sil', $this->lang ['mod_durum'] ['rhata'] ['sil'] ) === False) {
  127. return False;
  128. }
  129. // Böl�mler Modeli
  130. $this->i = Load::model ( 'mod_durum' );
  131. // Kategori Modeli
  132. //$this->k = Load::model ( 'mod_kategoriler' );
  133. foreach ( $_POST ['sil'] as $s ) {
  134. $this->i->Getid ( $s );
  135. $d = $this->db->result;
  136. // BölÃ?m Ba?ka birine ait ise Yetkisi varmı?
  137. if ($this->user->yetkili ( 'mod_durum', $d->user_id, $this->lang ['mod_durum'] ['rhata'] ['2'] ) === False) {
  138. return False;
  139. }
  140. $this->i->delete_id ( $s );
  141. }
  142. echo 'Oke';
  143.  
  144. }
  145. // Ekleme FOnksiyonu
  146. private function _ekle() {
  147. $this->val = Load::validator ( 'mod_durum' );
  148. if ($this->val->ekle ()) {
  149. $this->tema->veri ( 'ad', Req::Post_Safe ( 'ad' ) );
  150. $this->tema->veri ( 'hatalar', $this->val->hatalar );
  151. } else {
  152. $kat = Load::model ( 'mod_durum' );
  153. $kat->ad = Req::Post_Safe ( 'ad' );
  154. $kat->user_id = $this->ses->getir ( 'id' );
  155. $kat->yer_id = Req::Post_Safe ( 'yer_id' );
  156. if ($kat->save ()) {
  157. $this->_mesaj ( $this->lang ['mod_durum'] ['6'] );
  158. } else {
  159. $this->tema->veri ( 'hatalar', $kat->sql_error );
  160. }
  161.  
  162. }
  163. }
  164.  
  165. // DÃ?zenleme Fonksiyonu
  166. private function _duzenle() {
  167. $this->val = Load::validator ( 'mod_durum.duzenle' );
  168. if ($this->val->ekle ()) {
  169. $this->tema->veri ( 'ad', Req::Post_Safe ( 'ad' ) );
  170. $this->tema->veri ( 'hatalar', $this->val->hatalar );
  171. } else {
  172. $kat = Load::model ( 'mod_durum' );
  173. $kat->id = Req::Post_Safe ( 'id' );
  174. $kat->ad = Req::Post_Safe ( 'ad' );
  175. $kat->yer_id = Req::Post_Safe ( 'yer_id' );
  176. if ($kat->update ( 'id' )) {
  177. $this->_mesaj ( $this->lang ['mod_durum'] ['10'] );
  178. } else {
  179. $this->tema->veri ( 'hatalar', $kat->sql_error );
  180. }
  181.  
  182. }
  183. }
  184. // Valid Mesajı
  185. private function _mesaj($mesaj) {
  186. $this->tema->veri ( 'oke', True );
  187. $this->tema->veri ( 'mesaj', $mesaj );
  188. }
  189. // Hata Mesajı
  190. private function _emesaj($mesaj) {
  191. $this->tema->veri ( 'hata', True );
  192. $this->tema->veri ( 'mesaj', $mesaj );
  193. }
  194.  
  195. }
Add Comment
Please, Sign In to add comment