Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* Koberz Bili?im.
- * @2010
- * BölÃ?mler ModÃ?l Sayfası
- * mod/mod_durum/index.php
- */
- class mod_durum_mod {
- function __construct() {
- // Tema KÃ?tÃ?phanesini Ça?ıralım
- $this->tema = Load::lib ( 'Template' );
- // Database KÃ?tÃ?phanesini YÃ?kleyelim
- $this->db = Load::lib ( 'Database' );
- // Site ayarlarını çekelim
- $this->site = Kayit::getir ( 'site_config' );
- // Dil Dosyasını Ça?ıralım
- $this->lang = Load::lang ( 'mod_durum' );
- // Dil Dosyasını Temaya Gönderelim
- $this->tema->lang ( $this->lang );
- // Session KÃ?tÃ?phanesi
- $this->ses = Load::lib ( 'Session' );
- // User Model
- $this->user = Load::model ( 'mod_user.user' );
- }
- public function index() {
- echo 'Well Come To Hell';
- }
- public function ekle($yerid=NULL) {
- // Ekleme Yetkisi varmı?
- if ($this->user->yetki ( 'mod_durum', 'ekle', $this->lang ['mod_durum'] ['rhata'] ['ekle'], 1 ) === False) {
- return False;
- }
- if (Req::is_Post ( 'ekle' )) {
- $this->_ekle ();
- }
- if (Roll::varmi ('mod_yer', 'moderate' ) === False) {
- $yerlist=Run::import('mod_yer','_optgrupu');
- }else{
- $yerlist=Run::import('mod_yer','_optgrup');
- }
- Run::import ( 'index', '_index' );
- $this->site ['title'] = $this->lang ['mod_durum'] ['1'];
- $this->tema->veri ( 'tpl', 'mod_durum/ekle.tpl' );
- $this->tema->veri('yerlist',$yerlist);
- $this->tema->veri ( 'site', $this->site );
- }
- // DÃ?zenleme Fonksiyonu
- public function duzenle($id = NULL) {
- // DÃ?zenleme Yetkisi varmı?
- if ($this->user->yetki ( 'mod_durum', 'duzenle', $this->lang ['mod_durum'] ['rhata'] ['duzenle'], 1 ) === False) {
- return False;
- }
- $this->i = Load::model ( 'mod_durum' );
- $id = Req::Url_Clear ( $id );
- if ($this->i->exists_id ( $id ) === False) {
- exit ( 'AAAA...' );
- return;
- }
- $this->i->Getid ( $id );
- $d = $this->db->result;
- // E?er Eklenen ?çerik Ba?kasınınsa Yönetme Yetkisi Varmı ?
- if ($this->user->yetkili ( 'mod_durum', $d->user_id, $this->lang ['mod_durum'] ['rhata'] ['1'], 1 ) === False) {
- return False;
- }
- if (Req::is_Post ( 'duzenle' )) {
- $this->_duzenle ();
- }
- if (Roll::varmi ('mod_yer', 'moderate' ) === False) {
- $yerlist=Run::import('mod_yer','_optgrupu',array($d->yer_id));
- }else{
- $yerlist=Run::import('mod_yer','_optgrup',array($d->yer_id));
- }
- $d = Helper::convertObjectToArray ( $d );
- $this->site ['title'] = $this->lang ['mod_durum'] ['40'];
- Run::import ( 'index', '_index' );
- $this->tema->veri ( 'd', $d );
- $this->tema->veri('yerlist',$yerlist);
- $this->tema->veri ( 'tpl', 'mod_durum/duzenle.tpl' );
- $this->tema->veri ( 'site', $this->site );
- }
- function listele($id=NULL) {
- $bolum=Load::model('mod_yer');
- // Çalı?ma Yeri Varmı
- if($id!=NULL){
- if ($bolum->exists_id($id)===False) {
- return Helper::yonver ( 'mod_yer/listele' );
- }
- }
- // Listeleme Yetkisi varmı?
- if ($this->user->yetki ( 'mod_durum', 'listele', $this->lang ['mod_durum'] ['rhata'] ['listele'], 1 ) === False) {
- return False;
- }
- Run::import ( 'index', '_index' );
- $this->site ['title'] = $this->lang ['mod_durum'] ['3'];
- $this->tema->veri('yer',$id);
- $this->tema->veri ( 'tpl', 'mod_durum/listele.tpl' );
- $this->tema->veri ( 'site', $this->site );
- }
- function xml($gelenid=NULL) {
- // Listeleme Yetkisi varmı?
- if ($this->user->yetki ( 'mod_durum', 'listele', $this->lang ['mod_durum'] ['rhata'] ['listele'], 1 ) === False) {
- return False;
- }
- $this->grid = Load::model ( 'mod_durum.grid' );
- return $this->grid->xml ($gelenid);
- }
- function sil() {
- // Silme Yetkisi varmı?
- if ($this->user->yetki ( 'mod_durum', 'sil', $this->lang ['mod_durum'] ['rhata'] ['sil'] ) === False) {
- return False;
- }
- // Böl�mler Modeli
- $this->i = Load::model ( 'mod_durum' );
- // Kategori Modeli
- //$this->k = Load::model ( 'mod_kategoriler' );
- foreach ( $_POST ['sil'] as $s ) {
- $this->i->Getid ( $s );
- $d = $this->db->result;
- // BölÃ?m Ba?ka birine ait ise Yetkisi varmı?
- if ($this->user->yetkili ( 'mod_durum', $d->user_id, $this->lang ['mod_durum'] ['rhata'] ['2'] ) === False) {
- return False;
- }
- $this->i->delete_id ( $s );
- }
- echo 'Oke';
- }
- // Ekleme FOnksiyonu
- private function _ekle() {
- $this->val = Load::validator ( 'mod_durum' );
- if ($this->val->ekle ()) {
- $this->tema->veri ( 'ad', Req::Post_Safe ( 'ad' ) );
- $this->tema->veri ( 'hatalar', $this->val->hatalar );
- } else {
- $kat = Load::model ( 'mod_durum' );
- $kat->ad = Req::Post_Safe ( 'ad' );
- $kat->user_id = $this->ses->getir ( 'id' );
- $kat->yer_id = Req::Post_Safe ( 'yer_id' );
- if ($kat->save ()) {
- $this->_mesaj ( $this->lang ['mod_durum'] ['6'] );
- } else {
- $this->tema->veri ( 'hatalar', $kat->sql_error );
- }
- }
- }
- // DÃ?zenleme Fonksiyonu
- private function _duzenle() {
- $this->val = Load::validator ( 'mod_durum.duzenle' );
- if ($this->val->ekle ()) {
- $this->tema->veri ( 'ad', Req::Post_Safe ( 'ad' ) );
- $this->tema->veri ( 'hatalar', $this->val->hatalar );
- } else {
- $kat = Load::model ( 'mod_durum' );
- $kat->id = Req::Post_Safe ( 'id' );
- $kat->ad = Req::Post_Safe ( 'ad' );
- $kat->yer_id = Req::Post_Safe ( 'yer_id' );
- if ($kat->update ( 'id' )) {
- $this->_mesaj ( $this->lang ['mod_durum'] ['10'] );
- } else {
- $this->tema->veri ( 'hatalar', $kat->sql_error );
- }
- }
- }
- // Valid Mesajı
- private function _mesaj($mesaj) {
- $this->tema->veri ( 'oke', True );
- $this->tema->veri ( 'mesaj', $mesaj );
- }
- // Hata Mesajı
- private function _emesaj($mesaj) {
- $this->tema->veri ( 'hata', True );
- $this->tema->veri ( 'mesaj', $mesaj );
- }
- }
Add Comment
Please, Sign In to add comment