示例#1
0
 public static function load_js()
 {
     $out = '';
     if (self::$instance) {
         $instance = reset(self::$instance);
         $language = $instance->language;
         $lang_arr = $instance->lang_arr;
     } else {
         $language = XcrudConfig::$language;
         $lang_arr = self::_get_language_static();
     }
     if (!self::$css_loaded && !self::$instance) {
         XcrudConfig::$scripts_url = self::check_url(XcrudConfig::$scripts_url, true);
         XcrudConfig::$editor_url = self::check_url(XcrudConfig::$editor_url);
         XcrudConfig::$editor_init_url = self::check_url(XcrudConfig::$editor_init_url);
     }
     if (self::$js_loaded) {
         self::error('Xcrud\'s scripts already rendered! Please, set <strong>$manual_load = true</strong> in your configuration file');
     }
     self::$js_loaded = true;
     if (XcrudConfig::$load_jquery) {
         $out .= '<script src="' . XcrudConfig::$scripts_url . '/' . XcrudConfig::$plugins_uri . '/jquery.min.js"></script>';
     }
     if (XcrudConfig::$jquery_no_conflict) {
         $out .= '
         <script type="text/javascript">
         <!--
         
         jQuery.noConflict();
         
         -->
         </script>';
     }
     if (XcrudConfig::$load_jquery_ui) {
         $out .= '<script src="' . XcrudConfig::$scripts_url . '/' . XcrudConfig::$plugins_uri . '/jquery-ui/jquery-ui.min.js"></script>';
     }
     if (XcrudConfig::$load_jcrop) {
         $out .= '<script src="' . XcrudConfig::$scripts_url . '/' . XcrudConfig::$plugins_uri . '/jcrop/jquery.Jcrop.min.js"></script>';
     }
     if (XcrudConfig::$load_bootstrap) {
         $out .= '<script src="' . XcrudConfig::$scripts_url . '/' . XcrudConfig::$plugins_uri . '/bootstrap/js/bootstrap.min.js"></script>';
     }
     $out .= '<script src="' . XcrudConfig::$scripts_url . '/' . XcrudConfig::$plugins_uri . '/timepicker/jquery-ui-timepicker-addon.js"></script>';
     if (XcrudConfig::$editor_url) {
         $out .= '<script src="' . XcrudConfig::$editor_url . '"></script>';
     }
     if (XcrudConfig::$load_googlemap) {
         $out .= '<script src="//maps.google.com/maps/api/js?sensor=false&language=' . $language . '"></script>';
     }
     $out .= '<script src="' . XcrudConfig::$scripts_url . '/' . XcrudConfig::$plugins_uri . '/xcrud.js"></script>';
     $config = array('url' => XcrudConfig::$scripts_url . '/' . XcrudConfig::$ajax_uri, 'editor_url' => XcrudConfig::$editor_url, 'editor_init_url' => XcrudConfig::$editor_init_url, 'force_editor' => XcrudConfig::$force_editor, 'date_first_day' => XcrudConfig::$date_first_day, 'date_format' => XcrudConfig::$date_format, 'time_format' => XcrudConfig::$time_format, 'lang' => $lang_arr, 'rtl' => XcrudConfig::$is_rtl ? 1 : 0);
     $out .= '
         <script type="text/javascript">
         <!--
         
        	var XcrudConfig = ' . json_encode($config) . ';
                         
         -->
         </script>';
     if ($language != 'en') {
         if (is_file(XCRUD_PATH . '/' . XcrudConfig::$lang_path . '/datepicker/jquery.ui.datepicker-' . $language . '.js')) {
             $out .= '<script src="' . XcrudConfig::$scripts_url . '/' . XcrudConfig::$lang_uri . '/datepicker/jquery.ui.datepicker-' . $language . '.js"></script>';
         }
         if (is_file(XCRUD_PATH . '/' . XcrudConfig::$lang_path . '/timepicker/jquery-ui-timepicker-' . $language . '.js')) {
             $out .= '<script src="' . XcrudConfig::$scripts_url . '/' . XcrudConfig::$lang_uri . '/timepicker/jquery-ui-timepicker-' . $language . '.js"></script>';
         }
     }
     return $out;
 }
 public function structure($slug)
 {
     if (!$this->exists()) {
         return $this->notFound();
     }
     $community = $this->communityRepostory->get($slug);
     XcrudConfig::$editor_url = '/app/editors/ckeditor/ckeditor.js';
     if ($this->community->present()->isAdmin()) {
         $data = Xcrud::get_instance()->table('inti_community_structure')->columns('user_id,position,job_desc')->fields('user_id,position,job_desc')->relation('user_id', 'inti_view_community_members', 'user_id', 'fullname', 'community_id = ' . $community->id)->column_name('user_id', 'Nama Pengurus')->label('user_id', 'Nama Pengurus')->label('position', 'Jabatan')->label('job_desc', 'Deskripsi Tugas')->label('created_at', 'Tanggal Dibuat')->pass_var('community_id', $community->id)->where("inti_community_structure.community_id = '" . $community->id . "'")->unset_title()->unset_limitlist()->unset_view()->unset_csv()->limit(10);
     } else {
         $data = Xcrud::get_instance()->table('inti_community_structure')->columns('user_id,position,job_desc')->fields('user_id,position,job_desc')->relation('user_id', 'inti_view_community_members', 'user_id', 'fullname', 'community_id = ' . $community->id)->column_name('user_id', 'Nama Pengurus')->label('user_id', 'Nama Pengurus')->label('position', 'Jabatan')->label('job_desc', 'Deskripsi Tugas')->label('created_at', 'Tanggal Dibuat')->pass_var('community_id', $community->id)->where("inti_community_structure.community_id = '" . $community->id . "'")->unset_title()->unset_limitlist()->unset_view()->unset_edit()->unset_remove()->unset_add()->unset_csv()->limit(10);
     }
     return $this->render('community.page.manage', ['data' => $data, 'header' => 'Daftar Struktur Organisasi'], ['title' => $this->setTitle(trans('global.about'))]);
 }