Пример #1
0
 public function setting()
 {
     $module_directory = $this->cms_module_path();
     $data = array();
     $data['IS_ACTIVE'] = $this->IS_ACTIVE;
     $data['module_directory'] = $module_directory;
     if (!$this->IS_ACTIVE) {
         // get setting
         $module_table_prefix = $this->input->post('module_table_prefix');
         $module_prefix = $this->input->post('module_prefix');
         // set values
         if (isset($module_table_prefix) && $module_table_prefix !== FALSE) {
             cms_module_config($module_directory, 'module_table_prefix', $module_table_prefix);
         }
         if (isset($module_prefix) && $module_prefix !== FALSE) {
             cms_module_prefix($module_directory, $module_prefix);
         }
         // get values
         $data['module_table_prefix'] = cms_module_config($module_directory, 'module_table_prefix');
         $data['module_prefix'] = cms_module_prefix($module_directory);
     } else {
         $slideshow_height = $this->input->post('slideshow_height');
         if (isset($slideshow_height) && $slideshow_height !== FALSE) {
             cms_module_config($module_directory, 'slideshow_height', $slideshow_height);
         }
         // get values
         $data['slideshow_height'] = cms_module_config($module_directory, 'slideshow_height');
     }
     $navigation_name = $this->cms_navigation_name($module_directory . '/install/setting');
     if ($navigation_name === NULL || $navigation_name == '') {
         $navigation_name = 'main_module_management';
     }
     $this->view($module_directory . '/install_setting', $data, $navigation_name);
 }
Пример #2
0
 public function setting()
 {
     $module_directory = $this->cms_module_path();
     $data = array();
     $data['IS_ACTIVE'] = $this->IS_ACTIVE;
     $data['module_directory'] = $module_directory;
     if (!$this->IS_ACTIVE) {
         // get setting
         $module_table_prefix = $this->input->post('module_table_prefix');
         $module_prefix = $this->input->post('module_prefix');
         // set values
         if (isset($module_table_prefix) && $module_table_prefix !== FALSE) {
             cms_module_config($module_directory, 'module_table_prefix', $module_table_prefix);
         }
         if (isset($module_prefix) && $module_prefix !== FALSE) {
             cms_module_prefix($module_directory, $module_prefix);
         }
         // get values
         $data['module_table_prefix'] = cms_module_config($module_directory, 'module_table_prefix');
         $data['module_prefix'] = cms_module_prefix($module_directory);
     }
     $this->view($module_directory . '/install_setting', $data, 'main_module_management');
 }
Пример #3
0
 /**
  * @author  goFrendiAsgard
  * @param   string navigation_name
  * @return  string
  * @desc    return submenu screen
  */
 public function cms_submenu_screen($navigation_name)
 {
     $submenus = array();
     if (!isset($navigation_name)) {
         $submenus = $this->cms_navigations(NULL, 1);
     } else {
         $query = $this->db->select('navigation_id')->from(cms_table_name('main_navigation'))->where('navigation_name', $navigation_name)->get();
         if ($query->num_rows() == 0) {
             return '';
         } else {
             $row = $query->row();
             $navigation_id = $row->navigation_id;
             $submenus = $this->cms_navigations($navigation_id, 1);
         }
     }
     $html = '<ul class="thumbnails row-fluid">';
     $module_path = $this->cms_module_path();
     $image_directories = array();
     if ($module_path != '') {
         $image_directories[] = "modules/{$module_path}/assets/navigation_icon";
     }
     $image_directories[] = "assets/nocms/navigation_icon";
     foreach ($this->cms_get_module_list() as $module_list) {
         $other_module_path = $module_list['module_path'];
         $image_directories[] = "modules/{$other_module_path}/assets/navigation_icon";
     }
     foreach ($submenus as $submenu) {
         $navigation_name = $submenu["navigation_name"];
         $title = $submenu["title"];
         $url = $submenu["url"];
         $description = $submenu["description"];
         $allowed = $submenu["allowed"];
         if (!$allowed) {
             continue;
         }
         // check image in current module
         $image_file_names = array();
         $image_file_names[] = $navigation_name . '.png';
         if ($module_path !== '' && $module_path !== 'main') {
             $module_prefix = cms_module_prefix($this->cms_module_path());
             $navigation_parts = explode('_', $navigation_name);
             if (count($navigation_parts) > 0 && $navigation_parts[0] == $module_prefix) {
                 $image_file_names[] = substr($navigation_name, strlen($module_prefix) + 1) . '.png';
             }
         }
         $image_file_path = '';
         foreach ($image_directories as $image_directory) {
             foreach ($image_file_names as $image_file_name) {
                 $image_file_path = $image_directory . '/' . $image_file_name;
                 if (!file_exists($image_file_path)) {
                     $image_file_path = '';
                 }
                 if ($image_file_path !== '') {
                     break;
                 }
             }
             if ($image_file_path !== '') {
                 break;
             }
         }
         // default icon
         if ($image_file_path == '') {
             $image_file_path = 'assets/nocms/images/icons/package.png';
         }
         $html .= '<li class="well" style="width:80px!important; height:90px!important; float:left!important; list-style-type:none;">';
         $html .= '<a href="' . $url . '" style="width: 100%; height: 100%; display: block;">';
         if ($image_file_path != '') {
             $html .= '<img style="max-width:32px; max-height:32px;" src="' . base_url($image_file_path) . '" /><br /><br />';
         }
         $html .= $title . '</a>';
         $html .= '</li>';
     }
     $html .= '</ul>';
     return $html;
 }
Пример #4
0
 /**
  * @author  goFrendiAsgard
  * @param   string navigation_name
  * @return  string
  * @desc    return submenu screen
  */
 public function cms_submenu_screen($navigation_name)
 {
     $submenus = array();
     if (!isset($navigation_name)) {
         $submenus = $this->cms_navigations(NULL, 1);
     } else {
         $query = $this->db->select('navigation_id')->from(cms_table_name('main_navigation'))->where('navigation_name', $navigation_name)->get();
         if ($query->num_rows() == 0) {
             return '';
         } else {
             $row = $query->row();
             $navigation_id = $row->navigation_id;
             $submenus = $this->cms_navigations($navigation_id, 1);
         }
     }
     $html = '
     <script type="text/javascript">
         function __adjust_component(identifier){
             var max_height = 0;
             $(identifier).each(function(){
                 $(this).css("margin-bottom", 0);
                 if($(this).height()>max_height){
                     max_height = $(this).height();
                 }
             });
             $(identifier).each(function(){
                 $(this).height(max_height);
                 var margin_bottom = 0;
                 if($(this).height()<max_height){
                     margin_bottom = max_height - $(this).height();
                 }
                 margin_bottom += 10;
                 $(this).css("margin-bottom", margin_bottom);
             });
         }
         function __adjust_thumbnail_submenu(){
             __adjust_component(".thumbnail_submenu img");
             __adjust_component(".thumbnail_submenu div.caption");
             __adjust_component(".thumbnail_submenu");
         }
         $(window).load(function(){
             __adjust_thumbnail_submenu();
             // resize
             $(window).resize(function(){
                 __adjust_thumbnail_submenu();
             });
         });
     </script>';
     $html .= '<div class="row">';
     $module_path = $this->cms_module_path();
     $image_directories = array();
     if ($module_path != '') {
         $image_directories[] = "modules/{$module_path}/assets/navigation_icon";
     }
     $image_directories[] = "assets/nocms/navigation_icon";
     foreach ($this->cms_get_module_list() as $module_list) {
         $other_module_path = $module_list['module_path'];
         $image_directories[] = "modules/{$other_module_path}/assets/navigation_icon";
     }
     foreach ($submenus as $submenu) {
         $navigation_id = $submenu["navigation_id"];
         $navigation_name = $submenu["navigation_name"];
         $title = $submenu["title"];
         $url = $submenu["url"];
         $description = $submenu["description"];
         $allowed = $submenu["allowed"];
         $notif_url = $submenu["notif_url"];
         if (!$allowed) {
             continue;
         }
         // check image in current module
         $image_file_names = array();
         $image_file_names[] = $navigation_name . '.png';
         if ($module_path !== '' && $module_path !== 'main') {
             $module_prefix = cms_module_prefix($this->cms_module_path());
             $navigation_parts = explode('_', $navigation_name);
             if (count($navigation_parts) > 0 && $navigation_parts[0] == $module_prefix) {
                 $image_file_names[] = substr($navigation_name, strlen($module_prefix) + 1) . '.png';
             }
         }
         $image_file_path = '';
         foreach ($image_directories as $image_directory) {
             foreach ($image_file_names as $image_file_name) {
                 $image_file_path = $image_directory . '/' . $image_file_name;
                 if (!file_exists($image_file_path)) {
                     $image_file_path = '';
                 }
                 if ($image_file_path !== '') {
                     break;
                 }
             }
             if ($image_file_path !== '') {
                 break;
             }
         }
         $badge = '';
         if ($notif_url != '') {
             $badge_id = '__cms_notif_submenu_screen_' . $navigation_id;
             $badge = '&nbsp;<span id="' . $badge_id . '" class="badge"></span>';
             $badge .= '<script type="text/javascript">
                     $(window).load(function(){
                         setInterval(function(){
                             $.ajax({
                                 dataType:"json",
                                 url: "' . addslashes($notif_url) . '",
                                 success: function(response){
                                     if(response.success){
                                         $("#' . $badge_id . '").html(response.notif);
                                     }
                                     __adjust_thumbnail_submenu();
                                 }
                             });
                         }, 1000);
                     });
                 </script>
             ';
         }
         // default icon
         if ($image_file_path == '') {
             $image_file_path = 'assets/nocms/images/icons/package.png';
         }
         $html .= '<a href="' . $url . '" style="text-decoration:none;">';
         $html .= '<div class="col-xs-12 col-sm-6 col-md-4 col-lg-3">';
         $html .= '<div class="thumbnail thumbnail_submenu">';
         if ($image_file_path != '') {
             $html .= '<img style="margin-top:10px; max-height:60px;" src="' . base_url($image_file_path) . '" />';
         }
         $html .= '<div class="caption">';
         $html .= '<h4>' . $title . $badge . '</h4>';
         $html .= '<p>' . $description . '</p>';
         $html .= '</div>';
         // end of div.caption
         $html .= '</div>';
         // end of div.thumbnail
         $html .= '</div>';
         // end of div.col-xs-6 col-sm-4 col-md-3
         $html .= '</a>';
     }
     $html .= '</div>';
     return $html;
 }
Пример #5
0
function cms_module_navigation_name($module_directory, $name)
{
    $module_prefix = cms_module_prefix($module_directory);
    if ($module_prefix != '') {
        return $module_prefix . '_' . $name;
    } else {
        return $name;
    }
}
Пример #6
0
 public function cms_execute_sql($SQL, $separator)
 {
     $queries = explode($separator, $SQL);
     foreach ($queries as $query) {
         if (trim($query) == '') {
             continue;
         }
         $table_prefix = cms_module_table_prefix($this->cms_module_path());
         $module_prefix = cms_module_prefix($this->cms_module_path());
         $query = preg_replace('/\\{\\{ complete_table_name:(.*) \\}\\}/si', $table_prefix == '' ? '$1' : $table_prefix . '_' . '$1', $query);
         $query = preg_replace('/\\{\\{ module_prefix \\}\\}/si', $module_prefix, $query);
         $this->db->query($query);
     }
 }